Repository navigation
fix(cli): a fresh clone that lists the CLI is told to install its dependencies - #11986
Conversation
…endencies In a project with no CLI installed, the once-a-day hint, doctor and the setup reminder name the command that adds @astryxdesign/cli at the Core's version. In a fresh clone whose package.json already lists the CLI, that command replaced the exact version the project lists with a range (npm writes ^0.7.10 for @0.7.10). There the command is now the package manager's install of the project's dependencies, which installs the CLI the project lists; doctor's fix says so.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec e307698 |
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested. The fresh-clone fix is the right shape and its new assertions are red on main and green here; one state the new branch newly routes needs a condition before this can land.
- A package that names
@astryxdesign/clionly inpeerDependenciestakes the new "declared" branch, so the hint anddoctortell it to run the plain install, which under a package manager that does not install peer dependencies (Yarn 1 and Berry, npm with--legacy-peer-deps, pnpm withauto-install-peers=false) leaves the project with no CLI and the same warning on the next run; for this advice read the declared range fromdependencies,devDependenciesandoptionalDependenciesonly, and keep the add command when the CLI is named only as a peer (packages/cli/foundation/release/notices.mjs:516withpackages/cli/foundation/release/project.mjs:171-186).
Two smaller things, neither blocking: the hint still says "To match" while the command now installs whatever version the project declares, so a project whose declared CLI is not its Core's release is told it will match when it will not, and doctor's lead for the same state says something different; and the JSDoc of noCliHint and noCliHintLine (notices.mjs:524-527, :545-547) still describes the command as the one that adds the CLI at Core's version.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims
- Release note: in a fresh clone that lists the CLI, the hint,
doctorand the setup reminder say to install the project's dependencies rather than add the CLI again — verified (foundation/release/notices.mjs:516,api/doctor/doctor.mjs:396-401,clients/cli/index.mjs:914; new G5 assertions). - Each of the three uses the project's own package manager — verified (the new install map is keyed by the detected manager, as the add map is).
- The project's
package.jsonis left as it is — verified (no changed path writes a manifest). - A project with only Core still gets the add command at Core's version — verified (G5's first assertion, and the yarn project row in
test/global-local.rows-16-39.test.mjs:447). - A folder inside a project whose
package.jsonis not the project's still gets the run-from-the-project advice — verified (that branch returns before the new one; its rows pass). doctor's fix reads "To install the CLI this project declares, run: npm install." — verified (new G5 assertion).- Both new assertions fail on the old code — verified (base tree with this test file: the hint prints the add command, and the fix reads "To match, run: npm install @astryxdesign/[email protected].").
- The listed test selection passes — verified with one caveat: 469 of 472 passed here, and the three failures are in
foundation/release/cache.test.mjsand fail identically on the base in this environment (process-title and /proc reads), so they are not this change. - The record changes describe present behavior (writing rubric R1) and the repository checks pass — verified (
scripts/check-knowledge.mjsexit 0;scripts/check-cli-structure.mjsexit 0; Prettier clean on the changed files; the repository's Lint workflow is green at this head).
Files
.changeset/fresh-clone-install-advice.md— clear (patch for the CLI, house format, accurate text).docs/specs/AST-081-global-mode/spec.md— clear (FR2 sentence and G5 row only; approval lines untouched; approved for this head).packages/cli/foundation/release/notices.mjs— the blocking finding above, plus the stale JSDoc note.packages/cli/api/doctor/doctor.mjs— clear (lead chosen from the new flag; the other wordings unchanged).packages/cli/api/doctor/_adapter.mjs— clear (passes the flag through; internal, no exported surface).packages/cli/assets/docs/tree/who-answers.doc.mjs— clear (the clause matches the new behavior; the example below it is scoped to the Core-only case and stays correct).packages/cli/test/global-local.test.mjs— clear (covers the hint anddoctorfor the declared case; red on the base).
… it installs - A CLI named only in peerDependencies keeps the add command: Yarn, npm with --legacy-peer-deps and pnpm with auto-install-peers=false install no peers, so the plain install would leave the project without its CLI. installsCliPackage reads dependencies, devDependencies and optionalDependencies. - For a listed CLI the hint ends "To install the CLI this project declares, run: <install>", as doctor's fix does: the installed CLI need not match the project's Core, so "To match" no longer fits. - The JSDoc of noCliHint and noCliHintLine names both commands.
|
Thanks for the review. Fixed in the new head:
Local: global-local (G1–G15), rows 16–39, |
|
/approve-spec 7f06172 |
There was a problem hiding this comment.
Approved pending CI. The fresh-clone advice now installs the CLI the project lists, the peer-only case from the last review keeps the add command, and the new G5 assertions fail on main and pass here. CI's test and typecheck jobs did not run on this head because the CI workflow found no room, so it needs a re-run before merge.
Non-blocking, if you touch these files again:
- Miss: the comments at
packages/cli/api/doctor/doctor.mjs:386-391(andclients/cli/index.mjs:889-891,:912-913) still describe only the add command. - The new
INSTALLmap infoundation/release/notices.mjsgives the same commands as the privateinstallAllinapi/theme-edit/_context.mjs; moving that function intofoundation/env/package-manager.mjswould let both share it.
Claims and files checked
Review mode: full; reason: spec-record
Claims
- Release note: in a fresh clone whose
package.jsonlists the CLI, the hint,doctorand the setup reminder say to install the project's dependencies rather than add the CLI again — verified (foundation/release/notices.mjs:518-521,api/doctor/doctor.mjs:396-402,clients/cli/index.mjs:914; G5 and a direct probe of all three). - Release note: adding the CLI again replaced the exact version with a range such as
^0.7.10— verified as npm's behaviour with its default^save prefix, which the base's add command triggers; the registry run itself is not repeated here. - The hint now ends
To install the CLI this project declares, run: npm installanddoctor's fix reads the same with a full stop — verified (test/global-local.test.mjs:178-192). - Each uses the project's own package manager (
pnpm install,yarn install,bun install) — verified (notices.mjs:398-403keyed by the detected manager; probe with pnpm and yarn projects). - The project's
package.jsonstays as it is — verified (the advice is a plain install; no changed path writes a manifest). - A CLI named only in
peerDependencieskeeps the add command — verified (foundation/release/project.mjs:198-204;test/global-local.test.mjs:194-208). cliInstallAdviceis the one place all three read — verified (its only callers arenoCliHint,addCliCommandForfordoctor, and the setup reminder).- A project with only Core still gets the add command at Core's version, and a folder inside a project whose
package.jsonis not the project's still gets the run-from-the-project advice — verified (G5's first assertion, the G28 and tool-folder rows; the moved branch returns first atnotices.mjs:513-515). - The new hint and
doctorassertions fail on the old code — verified (the head's G5 on the base fails at:178; the base'sdoctorfix readsTo match, run: npm install @astryxdesign/[email protected].). - The listed test selection passes (18 files, 472 tests) — verified with one caveat: 469 pass here and the three
foundation/release/cache.test.mjsfailures fail the same way on the base in this environment. - The strict typecheck, knowledge and CLI-structure checks, ESLint and Prettier pass — verified (knowledge and CLI-structure checks exit 0, Prettier clean, the Lint workflow green; the strict typecheck shows no error in a changed file).
- The FR2 sentence and G5 row describe present behaviour — verified.
- Before and after on a real 0.7.10 app — consistent with the probe of both trees; the registry run is not repeated here.
Files
.changeset/fresh-clone-install-advice.md— clear.docs/specs/AST-081-global-mode/spec.md— clear (FR2 sentence and G5 row only; approval lines untouched; approved for this head).packages/cli/foundation/release/notices.mjs— clear; non-blocking note on theINSTALLmap.packages/cli/foundation/release/project.mjs— clear (peer dependencies excluded; release-fact field order unchanged).packages/cli/api/doctor/doctor.mjs— clear; non-blocking note on the comments above the changed lines.packages/cli/api/doctor/_adapter.mjs— clear (passes the flag through; not exported from the package).packages/cli/assets/docs/tree/who-answers.doc.mjs— clear (the clause matches the code; the example below stays scoped to a Core-only project).packages/cli/test/global-local.test.mjs— clear (listed-CLI hint anddoctor, and the peer-only case).
| * The command that installs a project's dependencies, by package manager. | ||
| * @type {Record<string, string>} | ||
| */ | ||
| const INSTALL = { |
There was a problem hiding this comment.
Non-blocking: this map gives the same commands as the private installAll in packages/cli/api/theme-edit/_context.mjs (npm install for npm and the two-lockfile case, <pm> install otherwise). Moving that function into foundation/env/package-manager.mjs, beside getRunPrefix, and calling it here and in theme-edit would leave one place for a new package manager or a change to the fallback.
|
/approve-spec efb8a35 |
There was a problem hiding this comment.
Approved pending CI. The fresh-clone advice installs the CLI the project lists, a peer-only CLI keeps the add command, and the new G5 assertions fail on main and pass here; this head adds only an empty commit to the tree reviewed last time. CI has not finished on this head yet, so it needs to pass before merge.
Non-blocking, if you touch these files again:
- Miss: the comments at
packages/cli/api/doctor/doctor.mjs:386-391(andclients/cli/index.mjs:889-891,:912-913) still describe only the add command. - The new
INSTALLmap infoundation/release/notices.mjsgives the same commands as the privateinstallAllinapi/theme-edit/_context.mjs; moving that function intofoundation/env/package-manager.mjswould let both share it.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims
- Release note: in a fresh clone whose
package.jsonlists the CLI, the hint,doctorand the setup reminder say to install the project's dependencies rather than add the CLI again — verified (foundation/release/notices.mjs:518-521,api/doctor/doctor.mjs:396-402,clients/cli/index.mjs:914-919; G5). - Release note: adding the CLI again replaced the exact version with a range such as
^0.7.10— verified as npm's behaviour with its default^save prefix, which the base's add command triggers; the registry run itself is not repeated here. - Before the change, all three named the add command at Core's version — verified (the base's
cliInstallAdvicealways returns it). - The hint now ends
To install the CLI this project declares, run: npm installanddoctor's fix reads the same with a full stop — verified (test/global-local.test.mjs:178-192). - Each uses the project's own package manager (
pnpm install,yarn install,bun install) — verified (notices.mjs:398-403, keyed by the detected manager; fixture probe with pnpm and yarn projects). - The project's
package.jsonstays as it is — verified (the advice is a plain install; no changed path writes a manifest). - A CLI named only in
peerDependencieskeeps the add command — verified (foundation/release/project.mjs:162-166,:198-204;test/global-local.test.mjs:194-208). cliInstallAdviceis the one place all three read — verified (its only callers arenoCliHint,addCliCommandForfordoctor, and the setup reminder).- A project with only Core still gets the add command at Core's version, and a folder inside a project whose
package.jsonis not the project's still gets the run-from-the-project advice — verified (G5's first assertion at:133, the tool-folder tests; the moved branch returns first atnotices.mjs:513-515). - The new hint and
doctorassertions fail on the old code — verified for the hint (the head's G5 fails on the base at:178); the base'sdoctorfix reads the add command by its code. - The listed test selection passes (18 files, 472 tests) — verified with one caveat: 469 pass here, and the three
foundation/release/cache.test.mjsprocess tests fail the same way on the base in this environment. - The strict typecheck, knowledge and CLI-structure checks, ESLint and Prettier pass — verified (knowledge and CLI-structure checks exit 0, Prettier and ESLint clean on the changed files, the Lint workflow green; the strict typecheck reports no error in a changed file).
- The FR2 sentence and G5 row describe present behaviour — verified.
- Before and after on a real 0.7.10 app — consistent with the fixture probe of both trees; the registry run is not repeated here.
Files
.changeset/fresh-clone-install-advice.md— clear.docs/specs/AST-081-global-mode/spec.md— clear (FR2 sentence and G5 row only; approval lines untouched; approved for this head).packages/cli/foundation/release/notices.mjs— clear; non-blocking note on theINSTALLmap.packages/cli/foundation/release/project.mjs— clear (peer dependencies excluded; release-fact field order unchanged).packages/cli/api/doctor/doctor.mjs— clear; non-blocking note on the comments above the changed lines.packages/cli/api/doctor/_adapter.mjs— clear (passes the flag through; not exported from the package).packages/cli/assets/docs/tree/who-answers.doc.mjs— clear (the clause matches the code).packages/cli/test/global-local.test.mjs— clear (listed-CLI hint anddoctor, and the peer-only case).
User impact
Someone runs Astryx in a fresh clone (a project whose
package.jsonlists@astryxdesign/clibut whose dependencies are not installed yet), with theastryxcommand installed for the computer. The once-a-day hint,doctor, and the setup reminder all say:To match, run: npm install @astryxdesign/[email protected]. Following that advice installs the dependencies, but it also replaces the exact version the project lists,"0.7.10", with the range"^0.7.10". A later install can then bring a CLI from another release than the project's Core.After this change, the hint ends with
To install the CLI this project declares, run: npm install, and doctor's fix readsTo install the CLI this project declares, run: npm install.The setup reminder names the same install. Each uses the project's own package manager:pnpm install,yarn install, orbun install. The project'spackage.jsonstays as it is.Problem and solution fit
npm install <package>@<version>saves the package with npm's default range prefix, so following the advice edits the project's dependency list.When the project's
package.jsonlists the CLI among the packages its install gets (dependencies,devDependencies, oroptionalDependencies), the advice is now the package manager's install of the project's dependencies, which installs the CLI the project lists. A CLI named only inpeerDependencieskeeps the add command, because Yarn, npm with--legacy-peer-deps, and pnpm withauto-install-peers=falseinstall no peers.cliInstallAdvice, the one place all three read, picks the command.Expected behavior and authority
spec:AST-081FR2: in a project with no CLI installed, the hint names "the command [that] adds@astryxdesign/cliat the Core's version with the project's package manager", and doctor names the same command. This PR adds one detail to that rule, decided under the CLI's detail rules. When the project'spackage.jsonlists the CLI among the packages its install gets, as a fresh clone's does, the line endsTo install the CLI this project declares, run: <command>, and the command installs the project's dependencies, since adding the CLI again would replace the version it lists. A CLI named only as a peer keeps the add command. The FR2 sentence and the G5 row say so.Smallest restoration
foundation/release/notices.mjs:cliInstallAdvicereturns the package manager's install command, withdeclared: true, wheninstallsCliPackage(inproject.mjs) finds the CLI in a field that an install gets. Otherwise it returns the add command, as before. For a listed CLI, the hint ends "To install the CLI this project declares, run:", because that CLI need not match the project's Core.api/doctor/doctor.mjs(with_adapter.mjs): for a listed CLI, the fix starts "To install the CLI this project declares". The other wordings are unchanged.assets/docs/tree/who-answers.doc.mjs: one clause for the listed case.spec:AST-081: the FR2 sentence and the G5 row.Evidence
"@astryxdesign/cli": "0.7.10", withnode_modulesremoved and the current canary installed for the computer. The hint saidTo match, run: npm install @astryxdesign/[email protected], and doctor said the same. Running that command left"@astryxdesign/cli": "^0.7.10"inpackage.json.run: npm install, and doctor saysTo install the CLI this project declares, run: npm install.Running it left"0.7.10"unchanged. In both cases the project's CLI 0.7.10 then answers.package.jsonis not the project's still gets the run-from-the-project advice.Scope
Components: CLI (global mode: the once-a-day hint,
doctor, the setup reminder)Writing rubric results
Testing
vitest run --project nodeovertest/global-local.test.mjs,global-local.rows-16-39,global-local.rows-40-58,foundation/release,api/doctor,test/global-mode-docs.test.mjs, andtest/global-mode-notes.test.mjs: 18 files, 472 passed.tsc --project tsconfig.strict.jsonaftersync-api-types,scripts/check-knowledge.mjs,scripts/check-cli-structure.mjs, ESLint, and Prettier on the changed files.