Skip to content

fix: harden monorepo workspace detection and workflow generation#83

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

fix: harden monorepo workspace detection and workflow generation#83
WolfieLeader wants to merge 12 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 and related workflows work from repo roots and package directories and no longer produce false packaging warnings.
    • Prevented broken paths and incorrect labels in generated workflows for non-standard layouts.
  • New Features

    • Added support for pnpm, npm/yarn/bun and Deno workspace patterns when deriving skill and watch globs.
    • Workflows now derive accurate skill and watch globs from actual workspace configuration.
  • Tests

    • Added tests covering monorepo workspace discovery 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

Warning

Rate limit exceeded

@WolfieLeader has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6be4d711-2ddf-4931-bf81-3f0f88d04b9b

📥 Commits

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

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

Walkthrough

Centralizes monorepo/workspace detection and pattern resolution (pnpm, package.json workspaces, Deno), exposes workspace helpers, and updates template variable derivation so setup-github-actions, validate, stale, and workflow templates behave correctly when run from repo roots or package directories.

Changes

Cohort / File(s) Summary
Monorepo detection & setup
packages/intent/src/setup.ts
Adds workspace pattern parsing (pnpm/package.json/deno), normalize/read JSONC helpers, resolveGlob-based package resolution, MonorepoTemplateContext, WORKSPACE_SKILL_GLOBS and WATCH_PATHS derivation; replaces ad-hoc detection with findWorkspaceRoot and exports workspace helpers.
Scanner & library changes
packages/intent/src/scanner.ts, packages/intent/src/library-scanner.ts
Converts async scanners to synchronous APIs, centralizes package.json reads to readPkgJsonFile, applies repo URL normalization, and updates Dirent typing/imports.
Utilities
packages/intent/src/utils.ts
Adds normalizeRepoUrl and readPkgJsonFile, adjusts Dirent to a type-only import, minor loop refactor.
Commands & validation
packages/intent/src/commands/validate.ts, packages/intent/meta/templates/workflows/validate-skills.yml
Wires monorepo-aware behavior into validate flow (passes isMonorepo to packaging checks). Workflow template now uses {{WORKSPACE_SKILL_GLOBS}}, globstar support, FOUND flag, and skip when none found.
Staleness & small fixes
packages/intent/src/staleness.ts
Removes a non-null assertion when assigning sources_sha (behavior unchanged).
Tests & changeset
packages/intent/tests/..., .changeset/fix-monorepo-workspace-detection.md
Adds tests for pnpm/npm/deno workspace parsing, nested patterns, workflow generation and monorepo scenarios; new CLI test to prevent false artifacts warnings; adds changeset documenting the fix.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as "setup-github-actions / CLI"
    participant Finder as "findWorkspaceRoot"
    participant Parser as "readWorkspacePatterns"
    participant Resolver as "resolveWorkspacePackages"
    participant Vars as "detectVars / TemplateVars"
    participant Template as "Template Rendering / Workflows"

    User->>CLI: run setup-github-actions (cwd)
    CLI->>Finder: findWorkspaceRoot(cwd)
    Finder-->>CLI: workspaceRoot | may be root or cwd
    CLI->>Parser: readWorkspacePatterns(workspaceRoot)
    Parser-->>CLI: workspace patterns (pnpm/npm/deno)
    CLI->>Resolver: resolveWorkspacePackages(workspaceRoot, patterns)
    Resolver-->>CLI: package dirs (resolved globs)
    CLI->>Vars: detectVars(cwd, MonorepoContext(packages, patterns))
    Vars-->>CLI: SRC_PATH, WATCH_PATHS, WORKSPACE_SKILL_GLOBS
    CLI->>Template: render templates with vars
    Template-->>User: monorepo-aware workflows written to target location
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • LadyBluenotes
  • tannerlinsley

Poem

🐰
Hopping through globs and workspace rings,
I fix the paths and mend the strings.
From pnpm roots to Deno's nest,
Templates now build at their best.
Joyful hops — workflows blessed!

🚥 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 clearly and directly summarizes the main change: hardening monorepo workspace detection and workflow generation, which aligns with the PR's primary objective.
Description check ✅ Passed The PR description comprehensively follows the template structure, includes linked issues, detailed change explanations, and complete checklist items.
Linked Issues check ✅ Passed The code changes successfully address all requirements from issue #71: monorepo detection via workspace config, workflow generation anchored to repo root, packaging warnings against target package, workspace pattern support including nested patterns and Deno config, and comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing monorepo workspace detection and workflow generation issues identified in issue #71 and related issues #86, #87, #88. No extraneous changes detected.

✏️ 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: e702792

@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

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