Skip to content

fix: harden monorepo workspace detection and workflow generation#83

Open
WolfieLeader wants to merge 13 commits intoTanStack:mainfrom
WolfieLeader:fix/monorepo-pnpm-detection
Open

fix: harden monorepo workspace detection and workflow generation#83
WolfieLeader wants to merge 13 commits intoTanStack:mainfrom
WolfieLeader:fix/monorepo-pnpm-detection

Conversation

@WolfieLeader
Copy link
Contributor

@WolfieLeader WolfieLeader commented Mar 16, 2026

🎯 Changes

Fixes #71. Also fixes #86, #87, #88.

This PR fixes the monorepo regressions reported against @tanstack/intent and tightens workspace handling across setup, validation, and generated CI workflows.

  • Fix setup-github-actions so monorepo roots are detected from actual workspace config, not just current skill-bearing packages.
  • Keep workflow generation anchored to the workspace root even when the command is run from a package directory.
  • Fix validate packages/<pkg>/skills so packaging warnings are evaluated against the target package instead of the workspace root.
  • Remove false !skills/_artifacts warnings for pnpm workspace packages.
  • Generate validation and watch globs from real workspace patterns instead of hardcoding packages/*.
  • Support nested workspace patterns and Deno workspace config in the workspace-resolution path.
  • Add regression coverage for monorepo root setup, package-dir setup, pnpm validation, nested workspace layouts, and monorepos with zero skill-bearing packages.

Additional fixes (post-PR #85)

This PR also addresses issues introduced or not covered by #85:

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes

    • Fixed monorepo workspace detection so validate, stale, setup-github-actions, edit-package-json and related workflows work from repo roots and package directories and no longer produce false packaging warnings or broken labels/paths.
  • New Features

    • Support for pnpm, npm/yarn/bun and Deno workspace patterns when deriving skill and watch globs; workflows now derive accurate globs from workspace config.
  • Tests

    • Added tests for workspace discovery, nested workspace resolution, and workflow generation.

@changeset-bot
Copy link

changeset-bot bot commented Mar 16, 2026

🦋 Changeset detected

Latest commit: 6f1a802

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

This PR includes changesets to release 1 package
Name Type
@tanstack/intent 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

@coderabbitai
Copy link

coderabbitai bot commented Mar 16, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f6a7621c-9ee8-4147-bf70-ed14eff91963

📥 Commits

Reviewing files that changed from the base of the PR and between 2a0580b and 552265f.

📒 Files selected for processing (2)
  • packages/intent/src/setup.ts
  • packages/intent/tests/setup.test.ts

📝 Walkthrough

Walkthrough

Centralizes and fixes workspace/monorepo detection (pnpm, package.json workspaces, deno), resolves nested workspace globs, exposes workspace helpers, and makes template variable derivation (WORKSPACE_SKILL_GLOBS, WATCH_PATHS, SRC_PATH) monorepo-aware so setup-github-actions, validate, stale, and related workflows work from repo roots or package dirs.

Changes

Cohort / File(s) Summary
Monorepo detection & setup
packages/intent/src/setup.ts
Adds workspace pattern parsing (pnpm/package.json/deno), JSONC readers, workspace normalization helpers, resolveWorkspacePackages, findWorkspaceRoot, buildWorkspaceSkillGlobs, and MonorepoTemplateContext; integrates workspace context into detectVars and template substitution; exports new helpers and runEditPackageJsonAll.
Workflow template
packages/intent/meta/templates/workflows/validate-skills.yml
Replaces ad-hoc skill discovery with WORKSPACE_SKILL_GLOBS iteration, adds globstar support and FOUND flag, and prints skip message when no skills found.
Scanner & library
packages/intent/src/scanner.ts, packages/intent/src/library-scanner.ts
Converts async scanners to synchronous APIs, centralizes package.json reads via readPkgJsonFile, applies normalizeRepoUrl to repo fields, and adjusts Dirent typing/imports.
Utilities
packages/intent/src/utils.ts
Adds readPkgJsonFile and normalizeRepoUrl exports, converts Dirent to type-only import, and minor loop refactor.
Commands & validation
packages/intent/src/commands/validate.ts
Removes inline monorepo heuristic, threads explicit isMonorepo into collectPackagingWarnings, and determines monorepo status via setup helpers.
Staleness
packages/intent/src/staleness.ts
Removes a non-null assertion when assigning sources_sha (no behavioral change).
Tests & changeset
packages/intent/tests/..., .changeset/fix-monorepo-workspace-detection.md
Adds comprehensive tests for pnpm/npm/deno workspace parsing, nested patterns, workflow generation, monorepo scenarios, and a changeset documenting the fix.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as "User CLI (setup/validate/stale)"
    participant Finder as "findWorkspaceRoot"
    participant Reader as "readWorkspacePatterns"
    participant Resolver as "resolveWorkspacePackages"
    participant Vars as "detectVars / buildWatchPaths"
    participant Template as "Template Renderer / Workflow Writer"

    User->>CLI: run setup-github-actions / validate / stale (cwd)
    CLI->>Finder: findWorkspaceRoot(cwd)
    Finder-->>CLI: workspaceRoot or null
    CLI->>Reader: readWorkspacePatterns(workspaceRoot)
    Reader-->>CLI: workspace patterns (pnpm/json/deno)
    CLI->>Resolver: resolveWorkspacePackages(workspaceRoot, patterns)
    Resolver-->>CLI: package directories (resolved globs)
    CLI->>Vars: detectVars(cwd, MonorepoContext(packages, patterns))
    Vars-->>CLI: SRC_PATH, WATCH_PATHS, WORKSPACE_SKILL_GLOBS
    CLI->>Template: render templates with derived vars
    Template-->>User: write monorepo-aware workflows / run commands across packages
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • tannerlinsley
  • LadyBluenotes

Poem

🐰
I hopped through globs and read each file,
Found nested apps and fixed the style.
From pnpm roots to deno's den,
Workflows sing across the globs again.
Happy hops — CI's fixed, amen!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 34.15% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: hardening monorepo workspace detection and workflow generation across multiple commands.
Description check ✅ Passed The description comprehensively covers changes, references all linked issues (#71, #86, #87, #88), includes complete checklist items, and documents both primary and additional fixes.
Linked Issues check ✅ Passed The PR addresses all coding requirements from linked issues: monorepo detection via workspace config [#71], pnpm-workspace.yaml support [#86], nested pattern support [#88], Deno workspace config [#87], and comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are tightly scoped to workspace detection, monorepo awareness, and workflow generation. No extraneous modifications detected beyond the stated objectives.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 16, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@tanstack/intent@83

commit: 552265f

@WolfieLeader
Copy link
Contributor Author

Let's go all green🫡

Copy link

@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.

🧹 Nitpick comments (2)
.changeset/fix-monorepo-workspace-detection.md (1)

1-5: Consider documenting the API signature changes in the changeset.

The changeset describes the monorepo detection fixes well, but doesn't mention that scanForIntents and scanLibrary changed from async to sync. If these are part of the public API, callers using await will still work (awaiting a non-Promise returns the value), but this behavioral change might be worth documenting for clarity.

If these functions are internal-only, the current changeset is sufficient.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/fix-monorepo-workspace-detection.md around lines 1 - 5, Update
the changeset to document that the functions scanForIntents and scanLibrary
changed from async to synchronous signatures; explicitly state the new return
types and note potential caller impact (e.g., awaiting a non-Promise is benign
but callers should remove unnecessary async/await), and reference the exported
symbols scanForIntents and scanLibrary so consumers can find and adapt their
usage.
packages/intent/src/utils.ts (1)

186-191: Consider edge cases in URL normalization.

The function handles common cases well, but consider these edge cases:

  1. URLs ending with .git.git would become .git after one replacement
  2. SSH URLs like git@github.com:org/repo.git are not normalized to org/repo
  3. Non-GitHub URLs (GitLab, Bitbucket) retain their full path after https:// removal

If these edge cases are acceptable for the current use case (deriving repo identifiers), the implementation is fine. Otherwise, consider more robust URL parsing.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/src/utils.ts` around lines 186 - 191, normalizeRepoUrl
currently only strips a single leading git+ prefix, a single trailing ".git",
and only matches "https://github.com/"; to handle the edge cases update
normalizeRepoUrl to (1) remove repeated ".git" suffixes (e.g. trim all trailing
".git" occurrences), (2) convert SSH style URLs like
"git@github.com:org/repo.git" into "org/repo" by detecting the "git@" pattern
and replacing the "user@host:" prefix with host path, and (3) optionally
generalize host stripping to remove "https?://<host>/" for non-GitHub hosts (or
keep existing behavior if only GitHub is desired); update the function
normalizeRepoUrl accordingly and add unit tests for inputs like
"git+https://github.com/org/repo.git.git", "git@github.com:org/repo.git", and a
non-GitHub https URL to validate the chosen behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.changeset/fix-monorepo-workspace-detection.md:
- Around line 1-5: Update the changeset to document that the functions
scanForIntents and scanLibrary changed from async to synchronous signatures;
explicitly state the new return types and note potential caller impact (e.g.,
awaiting a non-Promise is benign but callers should remove unnecessary
async/await), and reference the exported symbols scanForIntents and scanLibrary
so consumers can find and adapt their usage.

In `@packages/intent/src/utils.ts`:
- Around line 186-191: normalizeRepoUrl currently only strips a single leading
git+ prefix, a single trailing ".git", and only matches "https://github.com/";
to handle the edge cases update normalizeRepoUrl to (1) remove repeated ".git"
suffixes (e.g. trim all trailing ".git" occurrences), (2) convert SSH style URLs
like "git@github.com:org/repo.git" into "org/repo" by detecting the "git@"
pattern and replacing the "user@host:" prefix with host path, and (3) optionally
generalize host stripping to remove "https?://<host>/" for non-GitHub hosts (or
keep existing behavior if only GitHub is desired); update the function
normalizeRepoUrl accordingly and add unit tests for inputs like
"git+https://github.com/org/repo.git.git", "git@github.com:org/repo.git", and a
non-GitHub https URL to validate the chosen behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 639760bb-837c-4af4-9248-1033735b3f73

📥 Commits

Reviewing files that changed from the base of the PR and between 379efa8 and c404d2c.

📒 Files selected for processing (14)
  • .changeset/fix-monorepo-workspace-detection.md
  • packages/intent/meta/templates/workflows/validate-skills.yml
  • packages/intent/src/cli.ts
  • packages/intent/src/intent-library.ts
  • packages/intent/src/library-scanner.ts
  • packages/intent/src/scanner.ts
  • packages/intent/src/setup.ts
  • packages/intent/src/staleness.ts
  • packages/intent/src/utils.ts
  • packages/intent/tests/cli.test.ts
  • packages/intent/tests/library-scanner.test.ts
  • packages/intent/tests/scanner.test.ts
  • packages/intent/tests/setup.test.ts
  • packages/intent/tests/staleness.test.ts

Copy link

@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.

🧹 Nitpick comments (1)
packages/intent/tests/setup.test.ts (1)

255-282: Harden test teardown to avoid leaked temp dirs/mocks on assertion failures.

Several tests clean up only at the end of the test body. If an assertion throws early, teardown is skipped, which can pollute subsequent tests:

  • Lines 255–282: rmSync(monoRoot, ...) at end, unguarded
  • Lines 343–384: rmSync(monoRoot, ...) at end, unguarded
  • Lines 451–524: logSpy.mockRestore() at end, unguarded
  • Lines 526–570: logSpy.mockRestore() at end, unguarded

Wrap each test body in a try/finally block to ensure cleanup always executes:

♻️ Suggested pattern (try/finally guarded teardown)
 it('treats workspace roots without package skills as monorepos', () => {
   const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
+  try {
 
-  writeFileSync(
-    join(metaDir, 'templates', 'workflows', 'validate-skills.yml'),
-    'for dir in {{WORKSPACE_SKILL_GLOBS}}; do\n  echo "$dir"\ndone\n',
-  )
-  // ... test setup/assertions ...
-  logSpy.mockRestore()
+    writeFileSync(
+      join(metaDir, 'templates', 'workflows', 'validate-skills.yml'),
+      'for dir in {{WORKSPACE_SKILL_GLOBS}}; do\n  echo "$dir"\ndone\n',
+    )
+    // ... test setup/assertions ...
+  } finally {
+    logSpy.mockRestore()
+  }
 })
 it('skips !skills/_artifacts in pnpm monorepo packages (pnpm-workspace.yaml)', () => {
   const monoRoot = mkdtempSync(join(tmpdir(), 'pnpm-mono-'))
+  try {
-  const pkgDir = join(monoRoot, 'packages', 'my-lib')
-  mkdirSync(pkgDir, { recursive: true })
-  // ... test setup/assertions ...
-  rmSync(monoRoot, { recursive: true, force: true })
+    const pkgDir = join(monoRoot, 'packages', 'my-lib')
+    mkdirSync(pkgDir, { recursive: true })
+    // ... test setup/assertions ...
+  } finally {
+    rmSync(monoRoot, { recursive: true, force: true })
+  }
 })
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/tests/setup.test.ts` around lines 255 - 282, The tests leak
temp dirs and spies when assertions throw because teardown calls (rmSync on
monoRoot and logSpy.mockRestore()) are at the end of the test bodies; wrap the
relevant test bodies that create monoRoot (where mkdtempSync is used) and those
that set logSpy in a try/finally and move rmSync(monoRoot, { recursive: true,
force: true }) and logSpy.mockRestore() into the finally block so cleanup always
runs; specifically update the test cases that reference monoRoot/mkdtempSync and
the tests that reference logSpy to use try { ... assertions ... } finally {
rmSync(...)/logSpy.mockRestore() } to guarantee teardown even on failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/intent/tests/setup.test.ts`:
- Around line 255-282: The tests leak temp dirs and spies when assertions throw
because teardown calls (rmSync on monoRoot and logSpy.mockRestore()) are at the
end of the test bodies; wrap the relevant test bodies that create monoRoot
(where mkdtempSync is used) and those that set logSpy in a try/finally and move
rmSync(monoRoot, { recursive: true, force: true }) and logSpy.mockRestore() into
the finally block so cleanup always runs; specifically update the test cases
that reference monoRoot/mkdtempSync and the tests that reference logSpy to use
try { ... assertions ... } finally { rmSync(...)/logSpy.mockRestore() } to
guarantee teardown even on failures.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 932e2c26-2f99-466c-8782-fae8c2e371ff

📥 Commits

Reviewing files that changed from the base of the PR and between c404d2c and f9010aa.

📒 Files selected for processing (1)
  • packages/intent/tests/setup.test.ts

WolfieLeader and others added 4 commits March 17, 2026 14:33
Resolve conflicts with PR TanStack#85 (cac CLI migration):
- Accept upstream's cac-based CLI structure
- Keep our enhanced workspace detection (pnpm, deno, nested patterns)
- Port pnpm-aware monorepo detection to commands/validate.ts
- Integrate upstream's isGenericWorkspaceName/deriveWorkspacePackageName
Copy link

@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: 3

🧹 Nitpick comments (3)
packages/intent/tests/setup.test.ts (2)

229-283: Add a workspace-root runEditPackageJson monorepo test

These cases validate package-dir behavior, but not running runEditPackageJson directly at the workspace root. A root-level case would guard against false !skills/_artifacts insertion for monorepos.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/tests/setup.test.ts` around lines 229 - 283, Add a new test
that invokes runEditPackageJson at the monorepo workspace root (not a package
subdir) to ensure the root package.json doesn't get a '!skills/_artifacts'
exclusion; specifically simulate a monorepo root (create package.json with
workspaces or pnpm-workspace.yaml and a packages/* subdir), call
runEditPackageJson(monoRoot), assert result.added contains 'files: "skills"' and
does not contain any string matching '!skills/_artifacts', and assert the
written package.json (JSON.parse(readFileSync(...))) has no '!skills/_artifacts'
in its files array; reuse the existing patterns from the tests that call
runEditPackageJson(pkgDir) so the new test mirrors both npm and pnpm workspace
scenarios.

54-116: Add regression coverage for negated workspace patterns

Current workspace tests cover positive globs but not exclusion globs (!pattern). A test like ['packages/*', '!packages/private/*'] would catch incorrect package inclusion early.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/tests/setup.test.ts` around lines 54 - 116, Add a regression
test to validate that
readWorkspacePatterns/resolveWorkspacePackages/findPackagesWithSkills handle
negated workspace globs (e.g., ['packages/*','!packages/private/*']) by creating
packages/packages/a and packages/private/b, ensure the negated package
(packages/private/b) is excluded from resolveWorkspacePackages(root, patterns)
and findPackagesWithSkills(root), and assert only packages/packages/a is
returned; reference the existing tests that call readWorkspacePatterns,
resolveWorkspacePackages, and findPackagesWithSkills to mirror setup
(writePkg/writeFileSync/mkdirSync) and verify the exclusion behavior.
packages/intent/src/setup.ts (1)

320-320: Avoid hardcoded monorepo docs glob in template vars

Line 320 hardcodes packages/*/docs/** for monorepos. This diverges from workspace-pattern-driven behavior (e.g., nested examples/react/*) and can leak incorrect values into templates that still use {{DOCS_PATH}}.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/intent/src/setup.ts` at line 320, The hardcoded monorepo docs glob
assigned to docsPath when isMonorepo is true should be replaced by deriving docs
globs from the workspace/package patterns instead of "packages/*/docs/**";
update the logic that sets docsPath (the constant docsPath) to map the existing
workspace/package patterns (the same source used for resolving packages) into
corresponding docs globs (e.g., replace trailing "/*" or package placeholder
with "/docs/**" per pattern) so nested patterns like "examples/react/*" produce
"examples/react/docs/**", and ensure the resulting string is used for the
template variable {{DOCS_PATH}}.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/intent/src/commands/validate.ts`:
- Around line 221-223: The monorepo detection misses cases where packageRoot
itself is the workspace root because findWorkspaceRoot is called on
join(packageRoot, '..'); update the check in validate.ts so isMonorepo calls
findWorkspaceRoot with packageRoot (or checks both packageRoot and its parent)
before computing warnings; reference the findWorkspaceRoot import, the
packageRoot variable, the isMonorepo binding, and the subsequent
collectPackagingWarnings(packageRoot, isMonorepo) call when making the change.

In `@packages/intent/src/setup.ts`:
- Around line 121-123: normalizeWorkspacePattern currently leaves leading '!'
untouched but the workspace resolution logic treats negated patterns as literal
paths so excluded workspaces are never removed; update the resolution flow to
detect negated patterns by checking for a leading '!' (you can keep
normalizeWorkspacePattern as-is or adjust it to return both the normalized
pattern and a negation flag), strip the '!' before performing glob/match
operations, collect matches from negated patterns into an excluded set and
subtract that set from the included matches, and ensure the code path that
iterates/filters packages uses this included-minus-excluded result (focus
changes around normalizeWorkspacePattern and the workspace pattern resolution
block that computes included/excluded package lists).
- Line 444: The monorepo detection currently calls findWorkspaceRoot(join(root,
'..')) which misses when root is itself a workspace root; update the check in
the isMonorepo computation to probe the current directory (root) as well as its
parent (e.g., call findWorkspaceRoot(root) and/or fallback to
findWorkspaceRoot(join(root, '..'))), so that isMonorepo uses the result of
findWorkspaceRoot(root) !== null (or an OR of both) to correctly detect
workspace roots when runEditPackageJson runs at the workspace root.

---

Nitpick comments:
In `@packages/intent/src/setup.ts`:
- Line 320: The hardcoded monorepo docs glob assigned to docsPath when
isMonorepo is true should be replaced by deriving docs globs from the
workspace/package patterns instead of "packages/*/docs/**"; update the logic
that sets docsPath (the constant docsPath) to map the existing workspace/package
patterns (the same source used for resolving packages) into corresponding docs
globs (e.g., replace trailing "/*" or package placeholder with "/docs/**" per
pattern) so nested patterns like "examples/react/*" produce
"examples/react/docs/**", and ensure the resulting string is used for the
template variable {{DOCS_PATH}}.

In `@packages/intent/tests/setup.test.ts`:
- Around line 229-283: Add a new test that invokes runEditPackageJson at the
monorepo workspace root (not a package subdir) to ensure the root package.json
doesn't get a '!skills/_artifacts' exclusion; specifically simulate a monorepo
root (create package.json with workspaces or pnpm-workspace.yaml and a
packages/* subdir), call runEditPackageJson(monoRoot), assert result.added
contains 'files: "skills"' and does not contain any string matching
'!skills/_artifacts', and assert the written package.json
(JSON.parse(readFileSync(...))) has no '!skills/_artifacts' in its files array;
reuse the existing patterns from the tests that call runEditPackageJson(pkgDir)
so the new test mirrors both npm and pnpm workspace scenarios.
- Around line 54-116: Add a regression test to validate that
readWorkspacePatterns/resolveWorkspacePackages/findPackagesWithSkills handle
negated workspace globs (e.g., ['packages/*','!packages/private/*']) by creating
packages/packages/a and packages/private/b, ensure the negated package
(packages/private/b) is excluded from resolveWorkspacePackages(root, patterns)
and findPackagesWithSkills(root), and assert only packages/packages/a is
returned; reference the existing tests that call readWorkspacePatterns,
resolveWorkspacePackages, and findPackagesWithSkills to mirror setup
(writePkg/writeFileSync/mkdirSync) and verify the exclusion behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b33fa37d-ae4a-4f9c-996f-bcdadd2f69dc

📥 Commits

Reviewing files that changed from the base of the PR and between f9010aa and e964a89.

📒 Files selected for processing (4)
  • packages/intent/src/commands/validate.ts
  • packages/intent/src/setup.ts
  • packages/intent/tests/cli.test.ts
  • packages/intent/tests/setup.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/intent/tests/cli.test.ts

WolfieLeader and others added 2 commits March 17, 2026 18:42
Negated patterns like !packages/internal (supported by pnpm, npm, yarn)
were silently ignored during resolution and produced invalid paths with
! prefix in generated workflow YAML.

- resolveWorkspacePackages now splits include/exclude, resolves both,
  and subtracts excluded dirs from the result
- buildFallbackWorkspacePaths skips negated patterns
- Added test for negated pattern exclusion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant