feat(setup): detect npm/yarn workspace monorepos + brief stack fallback#170
Merged
Merged
Conversation
…ectStack in brief Fixes #160. Three gaps closed: - `loadPackageContexts()` now reads npm/yarn `workspaces` (array and object forms) from root package.json and expands each glob via the existing `expandWorkspacePackageJsonGlob` helper, so workspace packages are included in detection alongside pnpm workspaces. - `detectStack()` monorepo flag now also fires when the root package.json carries a `workspaces` field (catches single-package workspace roots before any sub-packages are loaded). - `generateBrief()` in context.ts now calls `detectStack(loadPackageContexts())` as a final fallback when stack remains 'unknown' after config + ADF resolution, surfacing the correct preset automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
loadPackageContexts()now reads npm/yarnworkspaces(array and{ packages: [...] }object forms) from the rootpackage.jsonand expands each glob using the existingexpandWorkspacePackageJsonGlobhelper — workspace packages are included in detection alongside pnpm workspacesdetectStack()monorepoflag now also fires when the rootpackage.jsoncarries aworkspacesfield (catches workspace roots even before sub-packages are loaded)generateBrief()(context.ts) callsdetectStack(loadPackageContexts())as a final fallback whenstackremains'unknown'after config + ADF resolution, so npm/yarn monorepos surface the correct preset automaticallyCloses #160.
Test plan
loadPackageContexts + detectStack (npm workspaces) > discovers packages listed via npm workspaces array globloadPackageContexts + detectStack (npm workspaces) > discovers packages via npm workspaces object form { packages: [...] }loadPackageContexts + detectStack (npm workspaces) > sets monorepo=true and detects correct preset for npm workspace repopnpm vitest run)🤖 Generated with Claude Code