Skip to content

fix(packages/core): use deep glob pattern for recursive workspace includes#69

Merged
zrosenbauer merged 13 commits intomainfrom
fix/recursive-workspace-glob
Mar 25, 2026
Merged

fix(packages/core): use deep glob pattern for recursive workspace includes#69
zrosenbauer merged 13 commits intomainfrom
fix/recursive-workspace-glob

Conversation

@zrosenbauer
Copy link
Copy Markdown
Member

@zrosenbauer zrosenbauer commented Mar 25, 2026

Summary

  • When a workspace item (apps/packages) sets recursive: true without an explicit include, the default glob pattern was docs/*.md — a shallow pattern that only matches the top-level directory
  • This changes the default to docs/**/*.md when recursive: true, so fast-glob discovers files in nested subdirectories as expected

Changes

  • packages/core/src/sync/workspace.tsapplyOptionalFields() now selects the default include pattern based on item.recursive

Test plan

  • Verify a workspace with recursive: true and no include discovers nested markdown files (e.g. docs/guides/setup.md)
  • Verify a workspace without recursive still defaults to docs/*.md (shallow)
  • Verify an explicit include always takes precedence regardless of recursive

…ludes

The default include pattern for workspace items was always `docs/*.md`
regardless of the `recursive` flag. This meant recursive mode with
no explicit `include` would only discover files at the top level of
`docs/`, never in subdirectories like `docs/guides/setup.md`.

Switch the default to `docs/**/*.md` when `recursive: true` so
fast-glob discovers nested files as expected.

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 580e4b2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@zpress/core Patch
@zpress/config Patch
@zpress/cli Patch
@zpress/ui Patch
@zpress/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oss-zpress Ready Ready Preview, Comment Mar 25, 2026 2:01am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Modified applyOptionalFields() to compute a default include glob pattern based on the item.recursive flag: docs/**/*.md when recursive is true, otherwise docs/*.md. If item.include is provided explicitly, it continues to take precedence. Other include-resolution steps (deriving basePath, calling normalizeAndResolveInclude(), and populating the returned Section) remain unchanged.

Changes

Cohort / File(s) Summary
Include Pattern Default Logic
packages/core/src/sync/workspace.ts
Added conditional logic to compute default include glob based on item.recursive flag; explicit values remain prioritized.
Release Notes
.changeset/fix-recursive-workspace-glob.md
Added changeset documenting the default include glob change for recursive discovery (docs/**/*.md).
Review Config
.coderabbit.yaml
Toggled walkthrough/reporting config: collapse_walkthrough changed to true, changed_files_summary changed to false; trailing newline removed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and clearly summarizes the main change: updating the glob pattern for recursive workspace includes from shallow to deep pattern.
Description check ✅ Passed The description is well-detailed and directly related to the changeset, explaining the problem, solution, and test plan for the recursive workspace glob pattern fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/core/src/sync/workspace.ts (1)

384-387: ⚠️ Potential issue | 🟡 Minor

Update stale JSDoc to match the new conditional default.

Line 384 still says the default is always "docs/*.md", but runtime behavior is now conditional on item.recursive. Please update this comment to avoid config confusion.

✏️ Suggested doc fix
- * (derived from `path`). Defaults to `"docs/*.md"` when omitted.
+ * (derived from `path`). Defaults to `"docs/**/*.md"` when `recursive: true`,
+ * otherwise defaults to `"docs/*.md"` when omitted.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/sync/workspace.ts` around lines 384 - 387, Update the stale
JSDoc for the "include" default in workspace.ts to reflect the new conditional
behavior: instead of saying the default is always "docs/*.md", note that the
default is "docs/**/*.md" when item.recursive is true and "docs/*.md" when
item.recursive is false (or when recursion is not enabled). Edit the JSDoc block
that documents the `path` + `include` resolution so it explicitly states the
conditional default based on `item.recursive` and references `item.recursive`
and the `include` field so readers can find the related logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/core/src/sync/workspace.ts`:
- Around line 384-387: Update the stale JSDoc for the "include" default in
workspace.ts to reflect the new conditional behavior: instead of saying the
default is always "docs/*.md", note that the default is "docs/**/*.md" when
item.recursive is true and "docs/*.md" when item.recursive is false (or when
recursion is not enabled). Edit the JSDoc block that documents the `path` +
`include` resolution so it explicitly states the conditional default based on
`item.recursive` and references `item.recursive` and the `include` field so
readers can find the related logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 98842cc9-df98-45fd-88b3-9f9aa2d401d3

📥 Commits

Reviewing files that changed from the base of the PR and between 1d81aaa and 8465367.

📒 Files selected for processing (1)
  • packages/core/src/sync/workspace.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.coderabbit.yaml:
- Line 14: The `walkthrough` key is invalid under the `reviews` object; remove
the `walkthrough: false` entry or replace it with supported flags—set
`high_level_summary: false` if you want to disable summaries while keeping
`collapse_walkthrough: true` (which is already present); update the `reviews`
block by removing the unsupported `walkthrough` property to satisfy the schema.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d05cdb14-483b-4756-9ffc-765ddab806c2

📥 Commits

Reviewing files that changed from the base of the PR and between 8465367 and 2e9b6e3.

📒 Files selected for processing (2)
  • .changeset/fix-recursive-workspace-glob.md
  • .coderabbit.yaml

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • .coderabbit.yaml

Commit: 20311ecc7913e9d907595d1d85da8f43d04d162b

The changes have been pushed to the fix/recursive-workspace-glob branch.

Time taken: 6m 27s

coderabbitai bot and others added 2 commits March 25, 2026 01:03
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
Collapse walkthrough and disable all sub-features: changed files
summary, sequence diagrams, linked issues, related issues/PRs,
and review status messages.

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.coderabbit.yaml:
- Line 92: The file is missing a trailing newline at the end causing
POSIX/non-diff issues; update the file so that after the final line containing
"auto_reply: true" there is a single newline character (ensure EOF ends with
"\n") to restore the trailing newline.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 614183c3-cbed-4b81-a75f-fcd1f18ac779

📥 Commits

Reviewing files that changed from the base of the PR and between 20311ec and a8ef1f2.

📒 Files selected for processing (1)
  • .coderabbit.yaml

Disable every feature that populates the walkthrough comment:
high_level_summary, review_status, review_details, changed_files_summary,
sequence_diagrams, estimate_code_review_effort, assess_linked_issues,
related_issues, related_prs. The walkthrough comment itself has no
master toggle in the v2 schema — this is as close to off as it gets.

Co-Authored-By: Claude <noreply@anthropic.com>
zrosenbauer and others added 2 commits March 24, 2026 21:18
When a workspace item provides an explicit repo-relative include like
`apps/api/docs/**/*.md`, `normalizeAndResolveInclude` was prepending
the basePath derived from `path`, producing a broken double path:
`apps/api/apps/api/docs/**/*.md`. The glob silently matched 0 files,
so only landing pages appeared in the output.

Skip the basePath prefix when the pattern already starts with it.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
…orrecting

Replace the silent auto-fix with a warning that tells the user their
include pattern is already repo-relative and will be double-prefixed.
Include is documented as relative to the workspace path — the user
should fix their config.

Co-Authored-By: Claude <noreply@anthropic.com>
Remove the log.warn from the sync hot path and add a proper config
check that surfaces during `zpress check`. When a workspace include
pattern already starts with the basePath derived from path, warn that
the resolved glob will be double-prefixed and likely match zero files.

- Add ConfigWarning type and configWarning factory to @zpress/config
- Add checkWorkspaceIncludes to @zpress/core (exported)
- Wire warnings into runConfigCheck and presentResults in @zpress/cli

Co-Authored-By: Claude <noreply@anthropic.com>
Reflect that the default include pattern is now docs/**/*.md when
recursive is true, otherwise docs/*.md.

Co-Authored-By: Claude <noreply@anthropic.com>
…n emit

TypeScript's declaration emitter interprets the sequence star-slash
inside JSDoc backtick spans as end-of-comment, breaking the build.
Remove glob examples from exported function JSDoc blocks.

Co-Authored-By: Claude <noreply@anthropic.com>
The ConfigCheckResult interface gained a warnings field but existing
test fixtures were not updated, causing presentResults to crash on
configResult.warnings.length.

Co-Authored-By: Claude <noreply@anthropic.com>
@zrosenbauer zrosenbauer merged commit 1e966e1 into main Mar 25, 2026
5 checks passed
@zrosenbauer zrosenbauer deleted the fix/recursive-workspace-glob branch March 25, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant