Repository navigation
fix(cli): doctor tells a fresh clone to install its dependencies for a missing Core or theme package - #12038
Conversation
…a missing Core or theme package In a project that lists @astryxdesign/core and a theme package but has not installed its dependencies, doctor's core-installed fix added Core with no version, and its theme-owners fix added the theme package at the latest release, then added the theme again from the CLI's copy. Following them replaced the versions the project lists: an app pinned to 0.7.10 ended with Core ^0.7.10 and theme-neutral ^0.7.16. When the project lists the package among those its install gets, both fixes are now the package manager's install of the project's dependencies, and the theme resolver's message says so. A package named only as a peer, and a folder inside the project with its own package.json, keep the current advice.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
|
/approve-spec ee80aa4 |
|
/approve-spec 2e6660f |
There was a problem hiding this comment.
Changes requested. The fresh-clone advice is the right repair, and an engineering owner has approved the core-installed change for this head, but two problems in the theme path remain.
- With two or more listed package themes that are not installed,
theme-ownersjoins one identical fix per theme with a space, so it printsnpm install npm install(packages/cli/api/doctor/theme-checks.mjs:1433-1443), which npm runs as adding packages namednpmandinstall; dedupe the fixes and messages before joining, and add a two-theme case to the fresh-clone test. - The theme resolver repeats the listed-package install decision without the nested-folder check that
dependencyInstallForapplies (packages/cli/foundation/discovery/theme-imports.mjs:173-187), so in a folder with its ownpackage.jsonthetheme-ownersmessage andtheme addsay to run the project's install while the fix still names the add, contrary to the description; put the decision in one foundation helper thatcliInstallAdvice,dependencyInstallForand the resolver all call.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0)
- Claim: on the base, doctor names add commands for a missing Core and theme in a fresh clone: verified (base
doctor.mjscore fix, baserefreshThemeCommand). - Claim:
core-installednow names the project's install when the project lists Core: verified (doctor.mjs:331-349,doctor.test.mjs:301-338). - Claim:
theme-ownersand the resolver message now name the project's install for a listed theme package: verified for one theme (theme-checks.mjs:119-125,theme-imports.mjs:173-187,theme-checks.test.mjs:984-1033); false for two or more themes (first finding). - Claim: following the fixes keeps every version the project lists: verified for one theme; false with several themes (first finding).
- Claim: a Core named only as a peer keeps the add command: verified (
project.mjs:192-203,doctor.test.mjs). - Claim: a folder inside the project with its own
package.jsonkeeps the current advice: true for thecore-installedandtheme-ownersfixes; false for the theme message andtheme addsuggestions (second finding). - Claim: an installed but stale theme package keeps its refresh fix: verified (
theme-checks.mjs:122). - Claim:
installsPackage,projectListsPackage,installDependenciesCommandanddependencyInstallForbehave as described, andcliInstallAdviceis unchanged: verified. - Claim:
theme addshows the same message and still suggests the add: verified (theme-imports.mjs:176-185). - Claim: no record changes: verified.
- Claim: the new tests fail on the old code: verified (both fail on the base with these tests).
- Claim: the real-app reproduction and the agent trial: author-reported, not reproduced (they need the public registry).
- Changeset: doctor says to install the project's dependencies for a missing Core and theme package: verified for Core and one theme; with several themes the install repeats (first finding).
- File
.changeset/fresh-clone-doctor-fixes.md: first finding. - File
packages/cli/api/doctor/_adapter.mjs: clear (one of the three decision sites, second finding). - File
packages/cli/api/doctor/doctor.mjs: clear. - File
packages/cli/api/doctor/doctor.test.mjs: clear. - File
packages/cli/api/doctor/theme-checks.mjs: first finding. - File
packages/cli/api/doctor/theme-checks.test.mjs: clear; a two-theme case belongs with the first fix. - File
packages/cli/foundation/discovery/theme-imports.mjs: second finding. - File
packages/cli/foundation/env/package-manager.mjs: clear. - File
packages/cli/foundation/release/notices.mjs: clear (one of the three decision sites, second finding). - File
packages/cli/foundation/release/project.mjs: clear.
… names one fix once
|
/approve-spec c9a955e |
There was a problem hiding this comment.
Changes requested. The shared listedPackageInstall helper now keeps doctor, the theme resolver and the CLI advice in step, and two listed themes print one install, but two problems remain.
theme-ownersstill joins each theme's fix with a space (packages/cli/api/doctor/theme-checks.mjs:1437-1449), so a listed theme's bare install swallows the next theme's fix, as innpm install npm install @astryxdesign/theme-stone@latest; …for an app that lists theme-neutral but not theme-stone; join the distinct fixes with;and add that case to the fresh-clone test.- The description still says
foundation/release/project.mjsgainsprojectListsPackage, which this head removed; describelistedPackageInstallinfoundation/release/notices.mjs, whichcliInstallAdvice,dependencyInstallForand the theme resolver now share.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0)
- Claim (changeset): in a fresh clone doctor now says to install the project's dependencies for a missing Core and theme package: verified (
doctor.mjs:331-349,theme-checks.mjs:119-125, the new tests). - Claim (changeset): before, the fixes added Core with no version and the theme at the latest release: verified (base
core-installedfix andrefreshThemeCommand; probe on the base). - Claim: on the base, doctor prints the two add fixes the description quotes: verified (base code; probe).
- Claim: following them rewrote a 0.7.10 app to
^0.7.10Core and^0.7.16theme: author-reported, not reproduced (needs the registry). - Claim: after the change both checks name the project's install, with the quoted theme message: verified (
doctor.test.mjs:301-336,theme-checks.test.mjs:984-1049). - Claim: a package in
dependencies,devDependenciesoroptionalDependenciesgets the install, a peer-only one keeps the add: verified (project.mjs:163-167,project.mjs:199-203, the peer case indoctor.test.mjs). - Claim: a folder with its own
package.jsonkeeps the current advice: verified (notices.mjs:477-482,theme-imports.test.mjs:54-76). - Claim: the theme-app record's doctor check 1 and the global-mode record's CLI rule govern the change, and no record changes: verified (both records read; no record file in the diff).
- Claim: the CLI's version-alignment advice follows the same rule for a listed CLI: verified (
notices.mjs:520-530). - Claim:
project.mjsgeneralizesinstallsCliPackagetoinstallsPackage: verified; and addsprojectListsPackage: false (removed at this head). - Claim:
installDependenciesCommandmoves topackage-manager.mjsfromnotices.mjs, which uses it: verified (package-manager.mjs:331-350). - Claim:
dependencyInstallForgives the install when the project lists the package and the folder is the project's: verified (_adapter.mjs:733-735). - Claim:
core-installedandrefreshThemeCommanduse it: verified (doctor.mjs:334-336,theme-checks.mjs:122-125). - Claim: the resolver's message names the install, and
theme addshows it and still suggests the add: verified (theme-imports.mjs:166-183,api/theme/_adapter.mjs:926-939). - Claim: an installed Core passes and an installed but stale listed theme keeps its refresh: verified (
doctor.mjs:329-344,theme-checks.mjs:122-123). - Claim: the regression tests fail on the old code: verified (all three new tests fail on the base code and pass on the head).
- Claim: the stated test runs (427 and 1984 passed): not reproduced as stated; the five changed or nearest test files pass at this head (270 passed, 2 skipped).
- Claim: four agents ran
npm cibefore doctor: author-reported, not reproduced. - File
.changeset/fresh-clone-doctor-fixes.md: clear. - File
packages/cli/api/doctor/_adapter.mjs: clear. - File
packages/cli/api/doctor/doctor.mjs: clear. - File
packages/cli/api/doctor/doctor.test.mjs: clear. - File
packages/cli/api/doctor/theme-checks.mjs: the space join (first finding). - File
packages/cli/api/doctor/theme-checks.test.mjs: clear; lacks the mixed case the first finding asks for. - File
packages/cli/foundation/discovery/theme-imports.mjs: clear. - File
packages/cli/foundation/discovery/theme-imports.test.mjs: clear. - File
packages/cli/foundation/env/package-manager.mjs: clear. - File
packages/cli/foundation/release/notices.mjs: clear. - File
packages/cli/foundation/release/project.mjs: clear; the description misnames its change (second finding).
|
/approve-spec 4a6f785 |
There was a problem hiding this comment.
Approved pending CI: some test-node shards have not finished on this head yet.
astryx doctor in a fresh clone now names the project's own install for a listed Core or theme package, and both points from the last review are fixed: distinct theme fixes are separated by ; , and the description matches the code. The new tests fail without the change and pass with it, and nothing else is needed from you.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
Claims:
- The changeset's fresh-clone claim, that doctor now says to install the project's dependencies for a missing Core and theme package: verified (
doctor.mjs:348,theme-checks.mjs:119-125, new tests). - The changeset's "before" claim, that the fixes added Core with no version and the theme at the latest release: verified (base
doctor.mjs:340andrefreshThemeCommand). - The old fixes the description quotes: verified on base sources; the old message's version comes from the CLI's own dependency ranges, which the canary publish pins to its release: verified (
template-needs.mjs:240-265, the release workflow). - The reproduction in an app on 0.7.10 that ended at
^0.7.10and^0.7.16, and the four-agent trial: author-reported, not reproducible here without the registry. - The new fixes and the new resolver message text: verified (
doctor.mjs:348,theme-imports.mjs:173). - Listed means
dependencies,devDependenciesoroptionalDependencies, and a peer-only package keeps the add: verified (project.mjs:163-166,project.mjs:199-203,doctor.test.mjs:316-336). - A folder with its own
package.jsonkeeps the current advice: verified (notices.mjs:478,theme-imports.test.mjs:66-76). - Each module change listed under the smallest restoration: verified (
project.mjs:199,notices.mjs:477-482and526-528,package-manager.mjs:331-350,_adapter.mjs:733-735,doctor.mjs:334-336,theme-checks.mjs:119-125and1416-1449,theme-imports.mjs:166-184). theme addshows the same message and still suggests the add: verified (theme-imports.mjs:175-182,api/theme/_adapter.mjs:934-938).- An installed but stale listed theme still gets its refresh: verified (
theme-checks.mjs:122-127). - The regression tests fail on the old code: verified (all four new tests fail on base sources; the other 165 pass).
- No record changes: verified (no file under
docs/changes). - Lint and typecheck pass: verified (both green on this head).
Files:
.changeset/fresh-clone-doctor-fixes.md: clearpackages/cli/api/doctor/_adapter.mjs: clearpackages/cli/api/doctor/doctor.mjs: clearpackages/cli/api/doctor/doctor.test.mjs: clearpackages/cli/api/doctor/theme-checks.mjs: clearpackages/cli/api/doctor/theme-checks.test.mjs: clearpackages/cli/foundation/discovery/theme-imports.mjs: clearpackages/cli/foundation/discovery/theme-imports.test.mjs: clearpackages/cli/foundation/env/package-manager.mjs: clearpackages/cli/foundation/release/notices.mjs: clearpackages/cli/foundation/release/project.mjs: clear
User impact
Someone runs
astryx doctorin a fresh clone of an Astryx app. The clone'spackage.jsonlists@astryxdesign/coreand a theme package such as@astryxdesign/theme-neutral, but nothing is installed yet. A new checkout, a CI machine, and an agent sandbox all start this way. Doctor fails two checks and gives these fixes:core-installed:Install the design system: `npm install @astryxdesign/core` (or yarn/pnpm/bun).theme-owners:npm install @astryxdesign/theme-neutral@latest; npx @astryxdesign/cli@<answering version> theme add neutral --package @astryxdesign/cli. Its message suggests installing the theme at the answering CLI's version.Following them changes the project. In an app that pins Core and the theme to 0.7.10, running these commands left Core at
^0.7.10and the theme at^0.7.16: a theme from another release beside the project's Core, although each theme names the exact Core release it works with. Onenpm installwould have installed what the project lists.After this change, both checks say to install the project's dependencies, with the project's package manager:
core-installedfixes withInstall the project's dependencies: `npm install`., andtheme-ownerswithnpm install. Its message readsTheme package "@astryxdesign/theme-neutral" is not installed, though this project lists it: install the project's dependencies withnpm install.Following them keeps every version the project lists.Problem and solution fit
package.json.When the project lists the package among those its install gets (
dependencies,devDependencies, oroptionalDependencies), the fix is now the package manager's install of the project's dependencies. A package named only as a peer keeps the add command, because some package managers do not install peers. A folder inside the project whosepackage.jsonis not the project's also keeps the current advice, because an install there would install that folder's own packages.Expected behavior and authority
spec:AST-050FR11 check 1: every added theme's owner is installed, and its module and stylesheet resolve. The check's fix should restore that state without changing which theme the record names.spec:AST-081FR2 and the G5 row (a fresh clone): with nothing installed, advice says to install the project's dependencies (theERR_VERSIONS_UNAVAILABLEmessage already does). The CLI's version-alignment fix follows the same rule for a CLI the project lists.No record changes.
Smallest restoration
foundation/release/project.mjs:installsPackage(dir, name)generalizesinstallsCliPackage.foundation/release/notices.mjs:listedPackageInstall(cwd, name), the one place that decides it: the project's install command when the projectcwdbelongs to listsname; null outside a project, in a folder inside it whosepackage.jsonis not the project's, and when the project does not listname.cliInstallAdviceuses it for the CLI.foundation/env/package-manager.mjs:installDependenciesCommand(dir), the package manager's install command. It moves here fromnotices.mjs, which uses it.api/doctor/_adapter.mjs:dependencyInstallFor(cwd, name)returnslistedPackageInstall's answer.api/doctor/doctor.mjs:core-installeduses it.api/doctor/theme-checks.mjs:refreshThemeCommandreturns it for a listed theme package that is not installed.theme-ownersnames a fix that several themes share once, and separates different fixes with;.foundation/discovery/theme-imports.mjs: the resolver's message for a listed, uninstalled theme package comes fromlistedPackageInstalltoo, so it says what doctor's fix does, in a tool folder with its ownpackage.jsonincluded.theme addshows the same message, and still suggests the add once the package is installed.Evidence
node_modulesremoved, and the current canary installed for the computer. Doctor printed the fixes above. Running every install command it named left"@astryxdesign/core": "^0.7.10"and"@astryxdesign/theme-neutral": "^0.7.16".npm install. Running it kept"0.7.10"for Core, the theme, and the CLI. Doctor then had 0 failures.npm cibefore doctor, in both arms. None saw or followed the old advice, and every build passed. This change helps whoever runs doctor before installing: a person, or an agent that runs doctor first.core-installedas before, and a package named only as a peer keeps the add command. When a listed theme package is installed but stale, the fix names its refresh, as before.core-installedin a project that lists Core (Yarn) and in one that only peer-depends on it, andtheme-ownersin a fresh clone that lists the theme package (pnpm). Both fail on the old code.Scope
Components: CLI (
doctor:core-installedandtheme-owners; the theme import resolver's message)Testing
vitest run --project nodeoverapi/doctor,foundation/discovery/theme-imports,foundation/release/notices.test.mjs,foundation/env/package-manager.test.mjs,test/global-local.test.mjs,api/theme/add, and the theme command tests: 14 files, 427 passed, 2 skipped.vitest run --project nodeoverapi/doctor,foundation/discovery/theme-imports,foundation/release,test/global-local.test.mjsandapi/theme/add: 18 files, 441 passed; thenapi/doctor,theme-importsand global-local after the;join: 8 files, 285 passed. New tests: two listed themes give one install; one listed and one unlisted givepnpm install;and then the other theme's steps; the resolver in a tool folder with its ownpackage.jsonnames the add.vitest run --project nodeoverfoundation/release,foundation/discovery,foundation/fs,api/doctor, the global-local row tests, the global-mode docs and notes tests, andsetup-nudge: 88 files, 1984 passed. Three timing-sensitive tests infoundation/discoveryandfoundation/fsfailed under that load and pass when run alone; this change touches neither behavior.tsc --project tsconfig.strict.jsonaftersync-api-types, ESLint, and Prettier on the changed files.