feat(cli): detect project roots across ecosystems, not just Node - #214
Open
ophiocus wants to merge 1 commit into
Open
feat(cli): detect project roots across ecosystems, not just Node#214ophiocus wants to merge 1 commit into
ophiocus wants to merge 1 commit into
Conversation
`init` proposed checks and provisioning only for a repository-root Node project; anything else — a Poetry monorepo, a PHP service beside a Go worker — started on exactly the empty job site the method doc warns about. Detection now walks the tree for project roots (Node, Python, PHP, Go, Ruby, Rust, Java), absorbs workspace members into their workspace root, skips fixture/sample directories, and proposes per-root provisioning plus a union of root-scoped checks. Node workspace repositories detect identically to before. Closes theam#199 Co-Authored-By: Claude Opus 5 <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.
Closes #199 — and big thanks to @AndreyGritsa, whose nine-Poetry-roots-plus-Next.js layout from the issue thread is now a test case in this PR. That fixture reshaped the design: the fix isn't an adapter table alone, it's multi-root, multi-ecosystem detection, because a repository with no root
package.jsonand independent Python packages beside a frontend was previously invisible toinit.What changed
packages/cli/src/detect.mjs:detectDeploymentProvider: adding an ecosystem is one entry, not a branch. Each adapter only proposes tools the project actually configures (ruff/mypy/pytest frompyproject.toml, phpunit/pest from the files present, and so on).(cd scraper && poetry run pytest)— so a change anywhere in the repository has a gate. Provisioning is per root (poetry installin the touched package), not one repo-wide install, which a layout like Andrey's can't express.runner/agent-clis) are absorbed into their workspace root, whose scripts already fan out to them. This is what keeps existing Node repositories detecting identically to before.test/,fixtures/,samples/,examples/hold manifests on purpose; proposing their checks as repository defaults would be noise (found by running the new detection against claude-dev-kit, wheresamples/phpvolunteered its phpunit as a repo default).test:runfallback whentestis absent — the watch-free vitest convention, and literally the script name in the frontend from the issue thread.detect()also returns two new advisory fields,ecosystemsandroots(path/ecosystem/manager), whichinitcan surface in its summary; existing consumers are untouched.apps/docs/docs/faq.md: the "Does this work for non-Node projects?" answer now describes what detection actually does instead of promising only a marked slot.How it's verified
packages/cli/test/detect.test.mjs, 5 cases: single-root npm unchanged; pnpm workspace absorption incl. the nested-member case; the polyglot no-root-manifest monorepo from Stack detection covers only the Node ecosystem — every other stack starts on an empty job site #199; PHP + Go roots with migration discovery; fixture/sample dirs never become roots.main'sdetect()and this branch'sdetect()against facility's own checkout — every shared output field is identical, byte for byte. CDK's real tree confirms the fixture-skip.@AndreyGritsa — your offer to validate against the real monorepo stands very welcome: this should now discover all nine Poetry roots plus
frontend/, proposepoetry installper touched package, and unionpoetry run pytestwithnpm run test:run. I'd love to hear where it guesses wrong.