Repository navigation
feat(cli): theme add installs a shared theme from a folder, a .tgz, or a URL in one command - #12436
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| ~ | cli |
./api · Types · type ThemeAppResponse |
data: { themes: ThemeAppEntry[]; default: string; modulePath: string; change: { action: "add" | "remove" | "use"; slug: string; changed: boolean; firstAdd: boolean; w … #15688414 → data: { themes: ThemeAppEntry[]; default: string; modulePath: string; change: { action: "add" | "remove" | "use"; slug: string; changed: boolean; firstAdd: boolean; w … #b074f881 |
import type {ThemeAppResponse} from '@astryxdesign/cli/api'; const x: ThemeAppResponse = {data: …} |
Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Changes requested: four defects need fixing whatever the direction decision below.
installMissing(packages/cli/api/theme/_adapter.mjs:1869-1908) runs the app's package manager on every package a shared theme's files import, so a theme that importsleft-pador any other name gets it installed with its install scripts; install only the@astryxdesign/*packages automatically and print the command for the rest.- CI's
test-nodefails becausepackages/cli/foundation/doc-compiler/doc-loads.test.mjsdoes not list the adapter's newchild_process.spawnSync; add it to the adapter'sRUNNERSentry. missingImportsandinstalledVersionduplicateforkNeedsandinstalledProjectCoreDir, and the copy misses a Core hoisted to the workspace root, so the base theme package is installed with no version there; extendforkNeedsand useinstalledProjectCoreDirinstead.- A shared theme with no built module runs the install and is then refused with a
theme build src/themes/<name>/…command for the folder the same run removed; build the copy when it is not built, or refuse before copying and installing.
Approval also needs an engineering owner's decision, because spec:AST-050 DEC-1 gives source copying to theme eject and no current record covers downloading a theme, running an install, or making the added theme the default. An engineering owner either amends spec:AST-050 (DEC-1, FR1, FR12, FR13, DEC-2) for theme add and records it with /approve-spec <full head SHA>, which the author may do as an engineering owner, or routes the shared copy through theme eject. Two smaller points: an https URL that redirects to http:// is followed, and the add.mjs header still says copying belongs only to theme eject.
Claims and files checked
Review mode: full; reason: over-500-lines
- Claim:
theme addaccepts a theme folder, a.tgz, or an https URL to a.tgzinstead of a slug: verified (add-shared.test.mjs, a CLI run, a local https download). - Claim: it copies the one theme folder it finds, up to four folders deep, into
src/themes/<name>withtheme eject's copy, marked not maintained: verified (_shared-source.mjs:254-291,_adapter.mjs:492-504, tests). - Claim: it installs the packages the theme imports that the app lacks with the app's package manager and says what it installed: verified (test, CLI run), but it installs every imported package (first finding).
- Claim: an
@astryxdesignpackage is installed at the version of the app's installed Core: false when Core is installed at a workspace root (third finding). - Claim: the theme is recorded as the app's default: verified (test; an app on another default switches to it).
- Claim: a name another theme or folder takes is refused with the
--nameto use, and a bad archive, a link or outside path, no theme, or several themes are refused, writing nothing: verified (tests, CLI run). - Claim: if recording or building the copy fails, the copied folder is removed: verified (test), though the install is not undone (fourth finding).
- Claim: if the install fails, the theme is still added and the result names the command: verified (CLI run).
- Claim: a bare word is always a slug, and
theme add <slug>is unchanged: verified (_shared-source.mjs:41-49,add.test.mjs21 pass). - Claim:
--namerebuilds the copy under that name and refuses an entry withoutdefineTheme: verified (test,_fork.mjsrefusal). - Claim: the JSON gains an optional
data.copyand nothing else changes: verified (theme.type.mjs, API comparison). - Claim: the archive reader takes only plain files and folders and adds no dependency: verified (tests, code).
- Claim: the command never edits app code and adds no configuration: verified for app source and configuration; the install writes
package.jsonand the lockfile. - Claim: the new and existing tests, the golden manifest, the four CLI typechecks, ESLint and changesets pass: verified; the description's test run did not include
doc-loads.test.mjs, which fails (second finding). - File
.changeset/theme-add-shared-theme.md: clear. - File
packages/cli/api/theme/_adapter.mjs: first to fourth findings. - File
packages/cli/api/theme/_shared-source.mjs: non-blocking (redirect to http, whole body read before the size cap). - File
packages/cli/api/theme/add/add-shared.test.mjs: non-blocking (no https or long-name tests). - File
packages/cli/api/theme/add/add.mjs: non-blocking (header sentence). - File
packages/cli/api/theme/theme.type.mjs: clear. - File
packages/cli/api/theme/themeAdd.doc.mjs: clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs: clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs: third finding (the Core-version sentence). - File
packages/cli/clients/cli/commands/theme.mjs: clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json: clear.
|
Addressed at 753c3c2:
|
|
Owner decision (engineering owner, covering this pull request): |
|
/approve-spec 753c3c2 |
There was a problem hiding this comment.
Changes requested: the direction is approved for this head, but five problems need fixing first.
- A shared theme with no built module, or one added under
--name, has its own TypeScript run on the person's machine duringtheme add, because the add builds it (packages/cli/api/theme/_adapter.mjs:1804-1807), which the owner decision on this pull request rules out; refuse such a copy and name thetheme buildcommand, or state in FR15, DEC-11 and the help that adding it runs its source. - The owner decision's other guarantees do not hold yet:
theme removerefuses a just-added shared theme because it is the default and afterwards leaves its copy and installed package, the receipt leaves out the files the build writes, and no test covershttp://or redirect refusal, the theme running nothing, ortheme removeafter a shared add. spec:AST-050still contradicts the new FR15 in its Intent, FR13 ("No surface teaches copying as the way to use a theme"), the FR12 verification row ("plaintheme addcopies") and DEC-2 ("changes only files the CLI generates"), and FR15 has no Verification row or Current-state impact line; give each the FR15 exception as FR1 now does.- The description needs the
## Writing rubric resultssection that a pull request changing a record reports. - After a failed install the text calls
npm install @astryxdesign/theme-neutral@…a package thattheme add"does not install", anddata.copy.installCommandthen holds that Astryx command althoughtheme.type.mjsdocuments it as the other packages only; report the failed command in the[!] Not installedline instead.
The four defects from the earlier revision are fixed, and a redirect from https to http is now refused. Smaller points: the download reads the whole body before its size check, and the install runs with no time limit.
Claims and files checked
Review mode: full; reason: spec-record
- Claim:
theme addaccepts a theme folder, a.tgz, or an https URL to a.tgzinstead of a slug: verified (tests, a CLI run, a local https download). - Claim: it finds the one folder with a typed theme descriptor, up to four folders in: verified (
_shared-source.mjs:261-298, tests). - Claim: it copies that folder into
src/themes/<name>withtheme eject's copy, discoverable and marked not maintained: verified (_adapter.mjs:1787-1791, tests). - Claim: it installs the Astryx packages the theme imports that the app neither declares nor has installed, with the app's package manager, at the installed Core's version, a workspace root included: verified (test, a workspace with Core hoisted to its root).
- Claim: any other imported package is never installed and is named with its install command: verified (test with
left-pad). - Claim: the result says what it installed: verified on success; false after a failed install (fifth finding).
- Claim: a copy shared without its built module, or added under another name, is built before it is recorded: verified (tests, a real build), and that build runs the theme's source (first finding).
- Claim: the theme is recorded as the default, and a first add prints the wiring: verified (tests, CLI run).
- Claim: a bare word is always a slug, and
theme add <slug>is unchanged: verified (_shared-source.mjs:41-49,add.test.mjs21 pass). - Claim:
--namerebuilds the copy under that name and refuses an entry it cannot rename: verified (test, a run against an entry with nodefineTheme). - Claim: the JSON gains only an optional
data.copy: verified (theme.type.mjs, API comparison), thoughinstallCommandmisstates its contents after a failed install (fifth finding). - Claim: a name clash, a file that is not gzip and tar, a link or escaping entry, no theme or several,
--packagewith a shared theme and--namewith a slug are refused, writing nothing: verified (tests). - Claim: if building or recording the copy fails, the copied folder is removed: verified (test); the install is not undone.
- Claim: if the install fails, the theme is still added and the result names the command: verified (CLI run), with the wrong wording (fifth finding).
- Claim: downloads are https only, and a redirect away from https is refused: verified (local https and redirect runs); no test (second finding).
- Claim: the archive reader takes only plain files and folders, rejects links and escaping paths, and adds no dependency: verified (code, tests).
- Claim: the command never edits app code and adds no configuration or persisted field: verified for app source and configuration; the install writes
package.jsonand the lockfile (third finding). - Claim: the record gains FR15, DEC-11 and a pointer from FR1, awaiting an engineering owner's approval: verified; approved for this head.
- Claim: the theme suites, the four CLI typechecks, ESLint, Prettier and
check:changesetspass: verified for the suites run here, the typechecks, ESLint, Prettier andcheck:changesets. - Claim: a no-context agent run and a browser check succeeded: not repeated here.
- File
.changeset/theme-add-shared-theme.md: clear. - File
docs/specs/AST-050-app-themes/spec.md: third and fourth findings. - File
packages/cli/api/theme/_adapter.mjs: first, second and fifth findings; non-blocking (no time limit, shell on Windows, the--namesuggestion for the app's own folder). - File
packages/cli/api/theme/_shared-source.mjs: non-blocking (whole body read before the size check, no long-name test). - File
packages/cli/api/theme/add/add-shared.test.mjs: second finding. - File
packages/cli/api/theme/add/add.mjs: clear. - File
packages/cli/api/theme/theme.type.mjs: fifth finding. - File
packages/cli/api/theme/themeAdd.doc.mjs: clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs: clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs: third finding (teaches copying, against FR13). - File
packages/cli/clients/cli/commands/theme.mjs: fifth finding. - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json: clear.
|
Round 3 at 90662f1, one test per condition (
AST-050 FR15 and DEC-11 are updated to match. |
|
/approve-spec 90662f1 |
There was a problem hiding this comment.
Changes requested: the shared-theme direction is approved for this head, but five problems need fixing first.
theme removeof a shared theme uninstalls a package that another theme in the app's record still imports (for example@astryxdesign/theme-neutralaftertheme add neutral), so the generated module's imports break (packages/cli/api/theme/_adapter.mjs:2017-2030); keep every package a recorded theme owns or imports, and test that case.- Miss:
downloadchecks only the final URL, so an https URL that redirects through a plainhttp://hop to another https URL is downloaded, against FR15's "a URL MUST be https, redirects included" (packages/cli/api/theme/_shared-source.mjs:146-152); follow redirects yourself, refuse anylocationthat is not https, and add the redirect test. spec:AST-050still contradicts FR15 in clauses this pull request leaves unamended: Intent (line 38), FR12 migration item 2, which forbids the CLI to delete atheme addcopy (lines 327-328), FR13 and its Verification row (lines 353 and 443), the FR12 Verification row (line 442) and DEC-2 (lines 468-469), and FR15 has no Verification row or Current-state impact line.- The description has no
## Writing rubric results, whicharchitecture:knowledge-contractsrequires of a pull request that changes a record. - After a failed install, the text lists the Astryx package that just failed under "packages the app lacks, which theme add does not install for it", and
data.copy.installCommandcarries it against its documented meaning (packages/cli/api/theme/_adapter.mjs:2118-2124,packages/cli/clients/cli/commands/theme.mjs:825-830).
One non-blocking point: in an app that already had a theme, the printed "theme remove <name> undoes this add" fails because the added theme is now the default, so print the theme use step first.
Claims and files checked
Review mode: full; reason: over-500-lines
Claims:
- Shared theme accepted as a folder, a .tgz, or an https URL to a .tgz: verified (source-form check in the shared-source helper; tests)
- Finds the one theme folder up to four levels in; refuses none or two: verified (tests)
- Refuses a theme without its built module and stylesheet before writing: verified (test: tree unchanged, no install)
- Nothing of the theme runs during the add: verified (test; a probe whose theme code would write a marker with resolvable imports)
- Copies with eject's copy, marked not maintained: verified (adapter copy call; tests list the files)
- Installs only the Astryx packages at the installed Core's version with install scripts off, and names any other package: verified (test)
- Records the theme as the default and prints the first-add wiring: verified (test; CLI run)
- Reports every file written and the record and dependency changed: verified (test; CLI run)
- Never replaces a file it did not write, and replaces its own unchanged copy: verified (test)
- Theme remove deletes the files the add wrote and keeps changed ones: verified (test)
- Theme remove uninstalls the packages the add installed: false in one case, it uninstalls a package another recorded theme imports (finding 1)
- A plain http URL and an https URL that redirects to http are refused: partly false, a redirect chain through http is accepted (finding 2)
- Archives with links, escaping entries or no gzip are refused: verified (tests)
- The package option with a shared theme is refused, and a bare word stays a slug: verified (test)
- A copy whose recording fails is removed: verified (adapter rollback)
- A failed install still adds the theme and names the command: verified, but the text mislabels it (finding 5)
- No new dependency for archive reading: verified (Node zlib and a local tar reader)
- Existing add and remove tests pass unchanged, and the manifest golden gains the example: verified (suites run)
Files:
- .changeset/theme-add-shared-theme.md: finding 1 (its uninstall claim)
- docs/specs/AST-050-app-themes/spec.md: finding 3
- packages/cli/api/theme/_adapter.mjs: findings 1 and 5
- packages/cli/api/theme/_shared-source.mjs: finding 2
- packages/cli/api/theme/add/add-shared.test.mjs: no redirect test (finding 2)
- packages/cli/api/theme/add/add.mjs: clear
- packages/cli/api/theme/theme.type.mjs: finding 5
- packages/cli/api/theme/themeAdd.doc.mjs: clear
- packages/cli/api/theme/themeRemove.doc.mjs: clear
- packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs: clear
- packages/cli/clients/cli/commands/theme-add.doc.mjs: clear
- packages/cli/clients/cli/commands/theme-remove.doc.mjs: clear
- packages/cli/clients/cli/commands/theme.mjs: finding 5; the printed undo command (non-blocking)
- packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear
- packages/cli/test/golden/no-icon-set/manifest.json: clear
|
Addressed at de55fc2:
|
|
/approve-spec de55fc2 |
There was a problem hiding this comment.
Changes requested: the shared-theme direction is approved for this head and the five problems from the last review are fixed, but three remain.
- Miss: re-adding a shared theme over its own copy deletes that copy before
ejectThemeFilescan refuse, so an update that ships a file the person added to the copy (for examplenotes.css) leaves only that file while the record keeps the theme as the default, which breaks the app's build and every retry (packages/cli/api/theme/_adapter.mjs:1887-1896); run the checks that can refuse before deleting anything, or restore the old copy on any failure, and add that test. - Miss: in a pnpm or npm workspace app,
data.copy.writtenand theWrote:line leave out the workspace root's lockfile that the install rewrites, becauselockfileNameslooks only in the app folder (packages/cli/api/theme/_adapter.mjs:1982-1990); report the lockfile of the folder that chose the package manager, throughdecidePackageManagerIn, and test a workspace app. undoSharedThemehard-codes the generated module's homes (packages/cli/api/theme/_adapter.mjs:2069-2071) instead of callingthemeModuleCandidatesfrompackages/cli/foundation/config/theme-state.mjs, so the two lists can drift and the undo could uninstall a package the module still imports; call the shared function.
Two non-blocking points: a recording failure after a successful install leaves the installed package in package.json, and the install and uninstall runs have no time limit.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Accepts a theme folder, a .tgz, or an https URL to one, and a bare word stays a slug: verified (source-form check in the shared-source helper; tests)
- Finds the one theme folder up to four levels in and refuses none or two: verified (tests)
- Refuses a theme without its built module and stylesheet before writing: verified (test: tree unchanged, no install)
- Nothing of the theme runs during the add: verified (test; a probe whose theme code would write a marker, with imports that resolve, across add, re-add and remove)
- Copies with eject's copy, marked not maintained: verified (adapter copy call; tests)
- Installs only the Astryx base at the installed Core's version with install scripts off, and names any other package: verified (test; CLI run)
- Finds Core where the app resolves it, a workspace root included: verified (shared Core lookup reused)
- Records the theme as the default and prints the first-add wiring: verified (CLI run)
- Reports every file written, including package.json and its lockfile: false in a workspace app (finding 2)
- Never replaces a file it did not write, and replaces its own unchanged copy: verified (test)
- Refusals write nothing: false for a re-add whose update collides with a file added to the copy (finding 1)
- https only, with every redirect hop checked before it is requested: verified (test; probe with real fetch over loopback https and http)
- Archives with links, escaping entries or no gzip are refused: verified (tests)
- The package option is refused with a shared theme: verified (test)
- A copy whose recording fails is removed: verified, but a re-add also loses the earlier copy (finding 1)
- A failed install still adds the theme and names its retry command apart from the other packages: verified (test; CLI run)
- Theme remove undoes the add, keeps changed files, and uninstalls only packages no remaining theme owns or imports: verified (tests; probe with a recorded package theme)
- The previous default is named and the printed undo starts with theme use: verified (test; text output code)
- No new dependency for reading archives: verified (Node zlib and a local tar reader)
- The new suite has 15 tests, existing add and remove tests pass, and the manifest golden gains the example: verified (suites run)
- Typechecks, ESLint and Prettier are clean: verified for ESLint and Prettier on the changed files and three typechecks; the strict typecheck needs built theme packages and passes in CI
- Changeset (one-command shared add, nothing runs, other packages named, undo by theme remove): verified; it says remove uninstalls what the add installed, and the code also keeps packages still in use
Files:
- .changeset/theme-add-shared-theme.md: clear
- docs/specs/AST-050-app-themes/spec.md: clear
- packages/cli/api/theme/_adapter.mjs: findings 1, 2 and 3
- packages/cli/api/theme/_shared-source.mjs: clear
- packages/cli/api/theme/add/add-shared.test.mjs: no re-add collision or workspace test (findings 1 and 2)
- packages/cli/api/theme/add/add.mjs: clear
- packages/cli/api/theme/theme.type.mjs: the documented
writtenlist (finding 2) - packages/cli/api/theme/themeAdd.doc.mjs: clear
- packages/cli/api/theme/themeRemove.doc.mjs: clear
- packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs: clear
- packages/cli/clients/cli/commands/theme-add.doc.mjs: clear
- packages/cli/clients/cli/commands/theme-remove.doc.mjs: clear
- packages/cli/clients/cli/commands/theme.mjs: clear
- packages/cli/foundation/doc-compiler/doc-loads.test.mjs: clear
- packages/cli/test/golden/no-icon-set/manifest.json: clear
|
Addressed at d79bd25:
|
|
/approve-spec d79bd25 |
There was a problem hiding this comment.
Changes requested: the shared-theme direction is approved for this head and the three problems from the last review are fixed, but one more needs fixing.
- Miss:
forkNeedstreats an Astryx base package as missing wheneverrequire.resolve('<name>/package.json')throws, which it always does for@astryxdesign/*packages because theirexportsomit./package.json, so an app that already has@astryxdesign/theme-neutralinstalled but not declared gets it installed again bytheme addand uninstalled bytheme remove; usefindInstalledPackage(projectDir, name)fromfoundation/fs/paths.mjsand add a test with the base installed but undeclared (packages/cli/api/theme/_adapter.mjs:950-959).
The branch also conflicts with main in forkNeeds, which main's install-guidance change edits, so it needs a rebase. Two non-blocking notes are inline: a workspace app that declares its own packageManager leaves the root lockfile out of written, and the restore-on-failure path has no test yet.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: one command installs a shared theme given as a folder, a
.tgzor an https URL — verified (add.mjs:51-56, tests). - Claim: the one theme folder found is checked as complete and built before anything is written — verified (
_adapter.mjs:1830-1860, test). - Claim: the folder is found up to four folders deep — verified (
_shared-source.mjsMAX_DEPTH). - Claim: the copy goes into
src/themes/<name>through eject's copy, discoverable and marked unmaintained — verified (ejectThemeFiles, test). - Claim: nothing of the theme runs — verified (marker test).
- Claim: only the Astryx packages the app lacks are installed, at the version of the Core the app resolves, with install scripts off — false for a package installed but undeclared, which is installed again (finding); version and scripts verified (test).
- Claim: any other imported package is named with its install command, never installed — verified (test).
- Claim: the theme becomes the default, and a first add prints the wiring lines — verified (
makeDefault, unchanged receipt). - Claim: the result lists every file written, the lockfile included, and the record and dependency changed — verified, with one narrow workspace gap (inline note).
- Claim: a file it did not write is never replaced; its own unchanged copy is replaced — verified (test).
- Claim: files the builder added survive an update, a clashing one is refused before anything moves, and a failed update puts the old copy back — verified (test, probe).
- Claim: refusals for a theme without built files, a non-gzip or non-tar file, a link or escaping entry, an http URL or http redirect hop, no theme or two themes, and
--package— verified (tests). - Claim: a failed recording removes the copy, restores an old copy and uninstalls what the add installed — verified (probe).
- Claim: package manager runs have a 5-minute limit — verified (
PACKAGE_MANAGER_MS). - Claim: a failed Astryx install keeps its own retry command, and
installCommandcovers only the other packages — verified (test). - Claim:
theme removedeletes the unchanged files it wrote, keeps and names changed ones, and uninstalls what it installed unless a recorded theme owns or imports it — verified (tests); also uninstalls a package the app had before, through the finding above. - Claim: the receipt names the previous default and the printed undo starts with
theme use— verified (theme.mjs, test). - Claim: a bare word is always a slug — verified (
isSharedThemeSource, test). - Claim: no new flag and no new dependency; the receipt is a dotfile discovery ignores — verified.
- Claim:
add-shared.test.mjshas 17 tests for the listed cases, and the existing theme tests pass with the manifest golden gaining the example — verified (all pass). - Claim: ESLint and Prettier are clean — verified; the four typechecks were not rerun.
- Claim: the record gains FR15 and DEC-11 and the same exception in Intent, FR1, FR12, FR13, DEC-2 and the Verification rows — verified.
- Claim: the author's agent run and real app add and remove — stated by the author; consistent with the tests and probes.
- File
.changeset/theme-add-shared-theme.md— the "that the app lacks" wording is false for an installed but undeclared package (finding). - File
docs/specs/AST-050-app-themes/spec.md— clear. - File
packages/cli/api/theme/_adapter.mjs— blocking finding at:950-959; non-blocking note at:2030-2038. - File
packages/cli/api/theme/_shared-source.mjs— clear. - File
packages/cli/api/theme/add/add-shared.test.mjs— no test for an installed but undeclared base or for the restore path. - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear. - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear.
d79bd25 to
e381a61
Compare
|
Addressed at e381a61, rebased onto main as one feature commit plus this fix (
|
|
Addressed at f6166f3:
|
|
/approve-spec f6166f3 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head (its run stopped because CI was full), so re-run CI before this merges.
The previous blocking finding is fixed: the shared install now reads Yarn's line through the CLI's shared check, so a Yarn 1 app with a .yarnrc.yml gets --ignore-scripts and a Yarn 2+ app known only by its lockfile gets --mode=skip-build. Both earlier non-blocking notes are fixed too: a built module that does not export the theme is refused before anything is copied, and the retry and rollback commands keep the scripts-off flag.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: one command adds a shared folder,
.tgzor https URL theme — verified (tests; CLI run). - Claim: it finds the one theme folder up to four levels deep by its typed descriptor and checks its built module and stylesheet before writing — verified (tests).
- Claim: a built module that does not export the theme is refused before anything is copied — verified (test, which fails on the previous revision).
- Claim: it copies into
src/themes/<name>with eject's copy, marked not maintained — verified (test). - Claim: nothing of the theme runs, and a theme without built files is refused — verified (marker test; static export check).
- Claim: missing Astryx packages install at the installed Core's version, found where the app resolves it — verified (tests).
- Claim: install scripts are off in the form each package manager's verb takes, and Yarn 1 versus Yarn 2+ is read by the CLI's shared check — verified (tests; CLI run with stub npm, pnpm, Yarn and bun).
- Claim: an installed but undeclared base is not installed again — verified (test).
- Claim: any other imported package is only named with its install command — verified (test; CLI run).
- Claim: the theme becomes the default, first-add wiring prints, and the printed undo starts with the previous default — verified (tests; CLI run).
- Claim: every file written is reported, a workspace root's lockfile included — verified (tests).
- Claim: it never replaces a file it did not write; a re-add replaces its own unchanged copy, keeps added files, refuses a clash and restores the old copy on failure — verified (tests).
- Claim: bad archives, links, escaping entries, plain http, an http redirect hop, no theme, two themes and
--packageare refused, writing nothing — verified (tests). - Claim:
theme removeundoes the add, keeps changed files and keeps packages a recorded theme owns or imports — verified (tests; CLI run). - Claim: a failed recording removes the copy, restores an old copy and uninstalls what the add installed; package manager runs have a 5-minute limit — verified (test; code).
- Claim: a failed Astryx install still adds the theme, with its own retry command that keeps scripts off — verified (test).
- Claim: a bare word stays a slug; no new flag, configuration field or dependency — verified (diff; test).
- Claim: the JSON gains only
data.copyanddata.undo, additively — verified (type definition). - Claim: the record gains FR15 and DEC-11 and the exception in Intent, FR1, FR12, FR13 and DEC-2, with verification and impact lines — verified (diff).
- Claim: the receipt sits in the theme folder, discovery ignores dotfiles, and archive reading adds no dependency — verified (diff; tests).
- Claim: 22 new tests and the existing theme add and remove tests pass, and the manifest golden gains the example — verified (run).
- Claim: ESLint, Prettier and the changeset check are clean — verified (run).
- Claim: the four CLI typechecks pass — three verified (run); the strict one reports only missing build output of a theme package in two unchanged template pages here, and CI's typecheck has not run on this head.
- Claim: the full node test run passes — not repeatable here and not yet run by CI on this head; the theme, package-manager, doc-load and golden tests pass.
- Claim: the no-context agent run and the real npm app run — not repeatable here; consistent with the CLI run.
- Changeset: the same claims as above — verified.
- File
.changeset/theme-add-shared-theme.md— clear. - File
docs/specs/AST-050-app-themes/spec.md— clear (approved for this head). - File
packages/cli/api/theme/_adapter.mjs— clear (previous blocker and both earlier notes fixed). - File
packages/cli/api/theme/_shared-source.mjs— clear. - File
packages/cli/api/theme/add/add-shared.test.mjs— clear (new tests fail on the previous revision). - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear. - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/foundation/env/package-manager.mjs— clear (shared Yarn check exported; formatting reflow). - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear (matches the new example).
|
/approve-spec 273c6b1 |
There was a problem hiding this comment.
Changes requested: two blocking findings in the shared-theme undo and archive paths, both with small fixes.
- Miss:
theme removedeletes every path and uninstalls every package that a theme folder's.astryx-shared.jsonlists without confining them (packages/cli/api/theme/_adapter.mjs:2172-2176and:2220), so a hand-copied theme folder with a crafted receipt madetheme removedelete the app's rootvite.config.tsand uninstallreact; resolve each key withassertWithinagainst the copy, skip any that escape, and uninstall only@astryxdesign/*names. - Miss: the archive reader checks each entry's path with its own code (
packages/cli/api/theme/_shared-source.mjs:270-280) instead of callingassertWithinfrompackages/cli/foundation/fs/path-safety.mjs, which already owns that check for every output path; call it and map its error to the existing "would land outside the archive's folder" refusal.
The rest of the shared add matches the approved FR15, and the focused suites pass on this head. One earlier non-blocking note still stands: the shared install line ignores an integration's installGuidance.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: One command adds a shared folder,
.tgzor https URL theme — verified (tests; head test run). - Claim: It finds the one theme folder up to four levels deep by its typed descriptor and checks its built module and stylesheet before writing — verified (tests).
- Claim: A built module that does not export the theme is refused before anything is copied — verified (test).
- Claim: It copies into
src/themes/<name>with eject's copy, marked not maintained — verified (test;ejectThemeFileswrites the local descriptor). - Claim: Nothing of the theme runs, and a theme without built files is refused — verified (marker test; static export and descriptor reads).
- Claim: Missing Astryx packages install at the installed Core's version, found where the app resolves it — verified (tests).
- Claim: Install scripts are off in the form each package manager's verb takes, and Yarn 1 versus Yarn 2+ is read by the CLI's shared check — verified (tests).
- Claim: An installed but undeclared base is not installed again — verified (test).
- Claim: Any other imported package is only named with its install command — verified (test).
- Claim: The theme becomes the default, first-add wiring prints, and the printed undo starts with the previous default — verified (tests; code).
- Claim: Every file written is reported, a workspace root's lockfile included — verified (tests).
- Claim: It never replaces a file it did not write; a re-add replaces its own unchanged copy, keeps added files, refuses a clash and restores the old copy on failure — verified (tests).
- Claim: Bad archives, links, escaping entries, plain http, an http redirect hop, no theme, two themes and
--packageare refused, writing nothing — verified (tests). - Claim:
theme removeundoes the add: the files it wrote go, changed files stay, and only packages it installed are uninstalled — false for a receipt the add did not write (probe: the app'svite.config.tsdeleted,reactuninstalled); verified for one it wrote (tests). - Claim:
theme removekeeps packages a recorded theme owns or imports — verified (test). - Claim: A failed recording removes the copy, restores an old copy and uninstalls what the add installed; package manager runs have a 5-minute limit — verified (test; code).
- Claim: A failed Astryx install still adds the theme, with its own retry command that keeps scripts off — verified (test).
- Claim: A bare word stays a slug; no new flag, configuration field or dependency — verified (test; diff).
- Claim: The JSON gains only
data.copyanddata.undo, additively — verified (type definition). - Claim: The record gains FR15 and DEC-11 and the exception in Intent, FR1, FR12, FR13 and DEC-2, with verification and impact lines — verified (diff).
- Claim: The receipt sits in the theme folder, discovery ignores dotfiles, and archive reading adds no dependency — verified (diff; tests).
- Claim: 22 new tests and the existing theme add and remove tests pass, and the manifest golden gains the example — verified (head test run).
- Claim: ESLint, Prettier, the changeset check and the four CLI typechecks are clean — verified (CI lint and typecheck pass at this head).
- Claim: The full node test run passes apart from environment-only failures — not repeatable here; CI's first two node shards pass at this head and the rest were still running, and the focused theme, eject, package-manager, doc-load, golden and manifest suites pass.
- Claim: The no-context agent run and the real npm app run — not repeatable here.
- Claim: Changeset: the same claims as above — verified, except its undo sentence, false as above.
- File
.changeset/theme-add-shared-theme.md— clear. - File
docs/specs/AST-050-app-themes/spec.md— clear (owner-approved for this head). - File
packages/cli/api/theme/_adapter.mjs— finding: the receipt-driven undo is not confined. - File
packages/cli/api/theme/_shared-source.mjs— finding: the archive reader does not use assertWithin. - File
packages/cli/api/theme/add/add-shared.test.mjs— clear (no test for a receipt the add did not write). - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear. - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/foundation/env/package-manager.mjs— clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear (matches the new example).
|
Addressed at c006707:
|
|
/approve-spec c006707 |
There was a problem hiding this comment.
Approved pending CI: required CI has not finished on this head yet.
Both earlier blocking findings are fixed: theme remove now reads back only receipt entries inside the copy (checked with assertWithin and a real-path check) and only @astryxdesign/* package names, and the archive reader confines every entry with assertWithin. The shared add matches the approved FR15 and DEC-11, and the focused theme suites pass on this head.
- Non-blocking: the new receipt test gives
../../../vite.config.tsthe placeholder hash'x', sotheme removekeeps that entry as a changed file whether or not it is confined; with the file's real sha256 (and a key behind a linked folder in the copy) the test would catch a regression. - Non-blocking, carried: the shared install line still ignores an integration's
installGuidance.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: One command adds a shared folder,
.tgzor https URL theme — verified (tests). - Claim: It finds the one theme folder up to four levels deep by its typed descriptor and checks its built module and stylesheet before writing — verified (tests; code).
- Claim: A built module that does not export the theme is refused before anything is copied — verified (test).
- Claim: It copies into
src/themes/<name>with eject's copy, marked not maintained — verified (test; code). - Claim: Nothing of the theme runs, and a theme without built files is refused — verified (marker test; static reads only).
- Claim: Missing Astryx packages install at the installed Core's version, found where the app resolves it — verified (tests; code).
- Claim: A base counts as installed when its folder is in a
node_modulesthe app reaches — verified (test). - Claim: Install scripts are off in the form each package manager's verb takes, and Yarn 1 versus Yarn 2+ is read by the CLI's shared check — verified (tests).
- Claim: Any other imported package is only named with its install command — verified (test).
- Claim: The theme becomes the default, first-add wiring prints, and the printed undo starts with the previous default — verified (tests; code).
- Claim: Every file written is reported, a workspace root's lockfile included — verified (tests).
- Claim: It never replaces a file it did not write; a re-add replaces its own unchanged copy, keeps added files, refuses a clash and restores the old copy on failure — verified (tests).
- Claim: Bad archives, links, escaping entries, plain http, an http redirect hop, no theme, two themes and
--packageare refused, writing nothing — verified (tests). - Claim:
theme removeundoes the add: unchanged files go, changed files stay, and installed packages are uninstalled unless a recorded theme owns or imports them — verified (tests). - Claim: A hand-edited receipt naming a file outside the copy, an absolute path or a non-Astryx package deletes and uninstalls nothing of them — verified (test; a probe with the file's real hash and one through a linked folder).
- Claim: A failed recording removes the copy, restores an old copy and uninstalls what the add installed; package manager runs have a 5-minute limit — verified (test; code).
- Claim: A failed Astryx install still adds the theme, with its own retry command that keeps scripts off — verified (test).
- Claim: A bare word stays a slug; no new flag, configuration field or dependency — verified (test; diff).
- Claim: The JSON gains only
data.copyanddata.undo, additively — verified (type definition). - Claim: The record gains FR15 and DEC-11 and the exception in Intent, FR1, FR12, FR13 and DEC-2, with verification and impact lines — verified (diff).
- Claim: The receipt sits in the theme folder, discovery ignores dotfiles, and archive reading adds no dependency — verified (code; diff).
- Claim: 23 new tests and the existing theme add and remove tests pass, and the manifest golden gains the example — verified (head test run).
- Claim: ESLint, Prettier and the changeset check are clean — verified (run at this head).
- Claim: The four CLI typechecks pass — three verified at this head; the strict one could not complete here because the theme packages were not built (its only errors are two unchanged templates importing the unbuilt base theme).
- Claim: The full node test run passes apart from environment-only failures — not repeatable here; the focused theme, eject, package-manager and doc-load suites pass.
- Claim: The no-context agent run and the real npm app run — not repeatable here.
- Claim: Changeset: the same claims as above — verified.
- File
.changeset/theme-add-shared-theme.md— clear. - File
docs/specs/AST-050-app-themes/spec.md— clear (owner-approved for this head). - File
packages/cli/api/theme/_adapter.mjs— clear (receipt read-back now confined). - File
packages/cli/api/theme/_shared-source.mjs— clear (entries checked withassertWithin). - File
packages/cli/api/theme/add/add-shared.test.mjs— non-blocking: the receipt test's placeholder hash does not guard the file confinement. - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear. - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/foundation/env/package-manager.mjs— clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear (matches the new example).
…r an https URL in one command
c006707 to
66453e1
Compare
|
Owner decision update (engineering owner, covering this pull request at its current head): the shared-theme decision is recorded as |
|
/approve-spec 66453e1 |
There was a problem hiding this comment.
Changes requested: two blocking findings. Both need small edits; the rest of the shared-theme add matches the approved FR15 and DEC-12, and the focused theme suites pass on this head.
spec:AST-050's FR12 and FR13 Verification rows (docs/specs/AST-050-app-themes/spec.md:459-460) are back tomain's text, so they fail the shared-theme copy FR15 requires while the description says they carry its exception; restore "copies a theme given by its slug" and "other than a shared one (FR15)", then approve the record again at the new head.- Miss:
removeEmptyFolders(packages/cli/api/theme/_adapter.mjs:2186) duplicatesremoveEmptyFolderinpackages/cli/api/theme-edit/_palette.mjs:233, which already takes back a copy and the themes root it made (_parts.mjs:731); move that helper into afoundation/fsmodule and call it from the rollback andundoSharedTheme.
Non-blocking: the hand-edited receipt test still gives the escaping entries the hash 'x', so it does not guard the confinement, and the shared install line still ignores an integration's installGuidance.
Claims and files checked
Review mode: full; reason: rebase
- Claim: one command adds a shared theme given as a folder, a
.tgzor an https URL — verified (tests). - Claim: it finds the one theme folder up to four levels deep by its typed descriptor and checks the built module and stylesheet before writing, writing nothing on a failed check — verified (tests; code).
- Claim: it copies into
src/themes/<name>with eject's copy, discoverable and marked not maintained — verified (test; code). - Claim: nothing of the theme runs, and a theme shared without built files is refused before copying — verified (marker test; static reads only).
- Claim: missing Astryx packages install at the installed Core's version, found where the app resolves it, with install scripts off in each package manager's form; a base already in a reachable
node_modulesis not installed again — verified (tests). - Claim: any other imported package is only named with its install command — verified (test).
- Claim: the theme becomes the default and first-add wiring prints; the printed undo starts with the previous default — verified (tests; code).
- Claim: every written file is reported, the workspace root's lockfile included, with the record and dependency change — verified (tests).
- Claim: the receipt is read back only for files inside the copy and Astryx packages, and remove deletes unchanged files, keeps changed ones and uninstalls what no recorded theme owns or imports — verified (tests).
- Claim: a bare word stays a slug; only a separator, a leading dot, a
.tgzending or an http(s) prefix reads as a shared theme — verified (test; code). - Claim: the record gains FR15 and DEC-12 and the exception in Intent, FR1, FR12 migration item 2, FR13 and DEC-2, with FR15's verification row and current-state line — verified (diff).
- Claim: the FR12 and FR13 verification rows carry the same exception — false (both rows read as on
main). - Claim: no new flag, configuration or persisted field; the JSON gains only
data.copyanddata.undo— verified (diff; type definition). - Claim: it never replaces a file it did not write; a re-add replaces its own unchanged copy, keeps added files, refuses a clash before anything moves and restores the old copy on failure — verified (tests).
- Claim: bad archives, links, escaping entries, plain http, an http redirect hop, no theme, two themes and
--packageare refused, writing nothing — verified (tests). - Claim: a failed recording removes the copy, restores an old copy and uninstalls what the add installed; package manager runs have a 5-minute limit — verified (test; code).
- Claim: a failed Astryx install still adds the theme, with its own retry command, and the install command stays for the other packages — verified (test).
- Claim: the receipt sits in the theme folder, discovery ignores dotfiles, and archive reading adds no dependency — verified (code; diff).
- Claim: the 23 new tests and the existing theme add and remove tests pass, and the manifest golden gains the example — verified (run at this head).
- Claim: ESLint, Prettier and the changeset check are clean — verified (run at this head).
- Claim: the four CLI typechecks pass — three verified; the strict one could not complete here because the theme packages were not built (its only errors are in two unchanged templates).
- Claim: the full node run passes apart from environment-only failures, and the no-context agent and real npm app runs — not repeatable here.
- Claim: the changeset — verified (same claims as above).
- File
.changeset/theme-add-shared-theme.md— clear. - File
docs/specs/AST-050-app-themes/spec.md— blocking: the FR12 and FR13 verification rows lack the shared-theme exception. - File
packages/cli/api/theme/_adapter.mjs— blocking:removeEmptyFoldersduplicates the theme editor's helper. - File
packages/cli/api/theme/_shared-source.mjs— clear. - File
packages/cli/api/theme/add/add-shared.test.mjs— non-blocking: placeholder hash in the receipt test. - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear (plus a formatting-only rewrap). - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/foundation/env/package-manager.mjs— clear (plus a formatting-only rewrap). - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear (matches the new example).
…n; empty folders are taken back by one shared helper
|
Addressed at 131c779:
|
|
/approve-spec 131c779 |
There was a problem hiding this comment.
Changes requested: one blocking finding, with a one-line fix. The other earlier findings are fixed at this head: the FR12 and FR13 Verification rows carry the shared-theme exception, removeEmptyFolder lives in foundation/fs, and the receipt test uses real hashes.
undoSharedTheme(packages/cli/api/theme/_adapter.mjs:2213-2219) still takes back the themes root with its ownreaddirSync/rmdirSyncblock, which repeatsremoveEmptyFolder(root)frompackages/cli/foundation/fs/empty-folder.mjs; replace it withif (receipt.madeRoot) removeEmptyFolder(root);.
Non-blocking: the shared install line still ignores an integration's installGuidance, which the planned follow-up covers. Required CI passes on this head.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: one command adds a shared theme given as a folder, a
.tgzor an https URL — verified (tests; real CLI run with npm stubbed). - Claim: it finds the one theme folder up to four levels deep by its typed descriptor and checks the built module and stylesheet before writing, writing nothing on a failed check — verified (tests; code).
- Claim: it copies into
src/themes/<name>with eject's copy, discoverable and marked not maintained — verified (test; code). - Claim: nothing of the theme runs, and a theme shared without built files is refused before copying — verified (marker test; static reads only).
- Claim: missing Astryx packages install at the installed Core's version, found where the app resolves it, with install scripts off in each package manager's form; an installed base is not installed again — verified (tests).
- Claim: any other imported package is only named with its install command — verified (test).
- Claim: the theme becomes the default, first-add wiring prints, and the printed undo starts with the previous default — verified (tests; CLI run).
- Claim: every written file is reported, the workspace root's lockfile included, with the record and dependency change — verified (tests).
- Claim: the receipt is read back only for files inside the copy and Astryx packages, and remove deletes unchanged files, keeps changed ones and uninstalls what no recorded theme owns or imports — verified (tests, now with real hashes).
- Claim: a bare word stays a slug; only a separator, a leading dot, a
.tgzending or an http(s) prefix reads as a shared theme — verified (test; code). - Claim: the record gains FR15 and DEC-12 and the exception in Intent, FR1, FR12 migration item 2, FR13 and DEC-2, with FR15's verification row and current-state line, plus the FR12 and FR13 rows — verified (diff).
- Claim: no new flag, configuration or persisted field; the JSON gains only
data.copyanddata.undo— verified (diff; type definition). - Claim: it never replaces a file it did not write; a re-add replaces its own unchanged copy, keeps added files, refuses a clash before anything moves and restores the old copy on failure — verified (tests).
- Claim: bad archives, links, escaping entries, plain http, an http redirect hop, no theme, two themes and
--packageare refused, writing nothing — verified (tests). - Claim: a failed recording removes the copy, restores an old copy and uninstalls what the add installed; package manager runs have a 5-minute limit — verified (test; code).
- Claim: a failed Astryx install still adds the theme, with its own retry command, and the install command stays for the other packages — verified (test).
- Claim: the receipt sits in the theme folder, discovery ignores dotfiles, and archive reading adds no dependency — verified (code; no manifest change).
- Claim: the 23 new tests and the existing theme add and remove tests pass, and the manifest golden gains the example — verified (run at this head).
- Claim: ESLint, Prettier and the changeset check are clean — verified (the lint job passed at this head).
- Claim: the four CLI typechecks pass — verified (three run here; the strict one by CI's typecheck job at this head).
- Claim: the full node run passes apart from environment-only failures — verified (CI's node test shards pass at this head); the no-context agent and real npm app runs — not repeatable here.
- Claim: the changeset — verified (same claims as above).
- File
.changeset/theme-add-shared-theme.md— clear. - File
docs/specs/AST-050-app-themes/spec.md— clear. - File
packages/cli/api/theme-edit/_palette.mjs— clear. - File
packages/cli/api/theme-edit/_parts.mjs— clear. - File
packages/cli/api/theme-edit/_settings.mjs— clear. - File
packages/cli/api/theme/_adapter.mjs— blocking: the undo's inline root removal repeatsremoveEmptyFolder. - File
packages/cli/api/theme/_shared-source.mjs— clear. - File
packages/cli/api/theme/add/add-shared.test.mjs— clear. - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear (plus a formatting-only rewrap). - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/foundation/env/package-manager.mjs— clear (plus a formatting-only rewrap). - File
packages/cli/foundation/fs/empty-folder.mjs— clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear (matches the new example).
|
/approve-spec fd047e5 |
There was a problem hiding this comment.
Approved pending CI: required CI is still running on this head.
The last blocking finding is fixed: the undo now takes back the themes folder it made with the shared removeEmptyFolder helper, and the add-and-remove test and a real CLI run both leave the app as it started. Every change to the app-themes record has an engineering owner's approval for this head.
Non-blocking: the shared install line still ignores an integration's installGuidance, which becomes required once the draft dependency-guidance requirement is current.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim: one command adds a shared theme given as a folder, a
.tgzor an https URL — verified (tests; CLI run at this head). - Claim: it finds the one theme folder up to four levels deep by its typed descriptor and checks the built module and stylesheet before writing, writing nothing on a failed check — verified (the theme folder walk; tests).
- Claim: it copies into
src/themes/<name>with eject's copy, discoverable and marked not maintained — verified (test lists it as a local theme; code). - Claim: nothing of the theme runs, and a theme shared without built files is refused before copying — verified (marker test; refusal test).
- Claim: missing Astryx packages install at the installed Core's version, found where the app resolves it, with install scripts off in each package manager's form; an installed but undeclared base is not installed again — verified (tests).
- Claim: any other imported package is only named with its install command — verified (test).
- Claim: the theme becomes the default, first-add wiring prints, and the printed undo starts with the previous default — verified (tests; CLI run; printer code).
- Claim: every written file is reported, a workspace root's lockfile included, with the record and dependency change — verified (tests).
- Claim: the receipt is read back only for files inside the copy and Astryx packages, and remove deletes unchanged files, keeps and names changed ones, and uninstalls what no recorded theme owns or imports — verified (tests).
- Claim: a bare word stays a slug; only a separator, a leading dot, a
.tgzending or an http(s) prefix reads as a shared theme — verified (code; test). - Claim: the record gains the shared-theme requirement and decision, with the exception in its intent, import, migration, docs and generated-module clauses, its verification rows and its current-state line — verified (diff).
- Claim: no new flag, configuration or persisted setting; the JSON gains only
data.copyanddata.undo— verified (command doc options unchanged; type definition). - Claim: it never replaces a file it did not write; a re-add replaces its own unchanged copy, keeps added files, refuses a clash before anything moves and restores the old copy on failure — verified (tests).
- Claim: bad archives, links, escaping entries, plain http, an http redirect hop, no theme, two themes and
--packageare refused, writing nothing — verified (tests). - Claim: a failed recording removes the copy, restores an old copy and uninstalls what the add installed; package manager runs have a 5-minute limit — verified (test; code).
- Claim: a failed Astryx install still adds the theme with its own retry command, and the install command stays for the other packages — verified (test).
- Claim: the receipt sits in the theme folder, discovery ignores dot entries, and archive reading adds no dependency — verified (discovery's dot-entry rule; no manifest change).
- Claim: the 23 new tests and the existing theme add and remove tests pass, and the manifest golden gains the example — verified (run at this head).
- Claim: ESLint, Prettier and the changeset check are clean — verified (run on the changed files here; the lint job passed at this head).
- Claim: the four CLI typechecks pass — verified (three run here; CI's typecheck job passed at this head).
- Claim: the broad node run passes apart from environment-only failures — partly verified (the touched suites pass here; CI's node shards 1-3 passed and 4-9 were still running).
- Claim: the no-context agent run and the real npm app run — the author's evidence, not repeatable here; the CLI run with npm stubbed matches the described add and remove.
- Claim: the changeset — verified (same claims as above).
- File
.changeset/theme-add-shared-theme.md— clear. - File
docs/specs/AST-050-app-themes/spec.md— clear. - File
packages/cli/api/theme-edit/_palette.mjs— clear. - File
packages/cli/api/theme-edit/_parts.mjs— clear. - File
packages/cli/api/theme-edit/_settings.mjs— clear. - File
packages/cli/api/theme/_adapter.mjs— clear (the undo now callsremoveEmptyFolderfor the themes folder). - File
packages/cli/api/theme/_shared-source.mjs— clear. - File
packages/cli/api/theme/add/add-shared.test.mjs— clear. - File
packages/cli/api/theme/add/add.mjs— clear. - File
packages/cli/api/theme/theme.type.mjs— clear. - File
packages/cli/api/theme/themeAdd.doc.mjs— clear. - File
packages/cli/api/theme/themeRemove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/experimental-theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-add.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme-remove.doc.mjs— clear. - File
packages/cli/clients/cli/commands/theme.mjs— clear (plus a formatting-only rewrap). - File
packages/cli/foundation/doc-compiler/doc-loads.test.mjs— clear. - File
packages/cli/foundation/env/package-manager.mjs— clear (plus a formatting-only rewrap). - File
packages/cli/foundation/fs/empty-folder.mjs— clear. - File
packages/cli/test/__golden__/no-icon-set/manifest.json— clear (matches the new example).
User need
When someone shares a theme they made (with the theme editor, or by hand), the person receiving it has to know where an app's local themes live, copy the right folder from the bundle into it, find and install the base theme package its built module imports, and then record it with
theme add <slug>. Each of these steps is easy to get wrong: copying the wrong folder from the bundle, putting it in a folder the CLI doesn't read, or forgetting the base package gives a broken build. Installing a shared theme should take one command.Problem and solution fit
astryx theme addnow also takes a shared theme instead of a slug: a path to the theme's folder, a.tgzarchive of it, or an https URL to a.tgz. In one command it:<name>Theme.doc.mjs, whose default export hastype: 'theme'), at any depth up to four folders in. It then checks that this is a complete theme with its built module and stylesheet. A failed check writes nothing.src/themes/<name>, through the same copytheme ejectuses for a local theme (so the copy is discoverable and markedmaintained: false).@astryxdesign/*packages the theme imports that the app lacks (its base theme package; a package counts as installed when its folder is in anode_modulesthe app reaches) are installed with the app's own package manager, with install scripts off (in the form each package manager's verb takes). They install at the version of the app's installed Core, found where the app resolves it, a workspace root included. Any other package the theme imports is never installed for it; the result names it with the command to install it.package.jsonwith the lockfile the install rewrites, a workspace root's included) and the record and dependency it changed.theme remove <name>then undoes the add: the files it wrote go, any you changed since stay and are named, and the packages it installed are uninstalled unless a theme still in the record is owned by or imports them. When the app had another default before, the receipt names it, and the printed undo starts withtheme use <it>.theme add <slug>is unchanged. A bare word is always a slug; only a value with a folder separator, a leading dot, a.tgzending, or anhttp(s)://prefix is read as a shared theme.Current specification
This PR amends
spec:AST-050for the shared case:FR15: a shared theme installs in one command, nothing of it runs, it never replaces a file it did not write, and
theme removeundoes it.DEC-12: a shared theme is copied, because it has no package to import.
The same exception in Intent, FR1, FR12 migration item 2, FR13, and DEC-2.
FR15's Verification row and Current-state impact line, plus the FR12 and FR13 rows.
spec:AST-050(app themes): the local themes root (src/themes, wheretheme ejectwrites) and the generated module as the app's theme record (DEC-3).The command never edits app code (DEC-2). For an app not yet wired, it prints the same wiring lines as any first add.
No new configuration or persisted field (AST-017 FR19).
Public delta and caller burden
theme add <folder | .tgz | https URL>: new accepted argument forms. There is no new flag.theme.appgains an optionaldata.copyfor a shared theme:from,folder,outputDir,files,installed,installCommand,installError,installRetryCommand,previousDefault,writtenandconfig.data.undo:removed,kept,uninstalledanduninstallError.http://URL, or an https URL that redirects through any http hop (each redirect is followed and checked before it is requested);--packagewith a shared theme.installErrorwithinstallRetryCommandnames the command to run;installCommandstays for the other packages only.Before:
After:
Design and alternatives
theme adddoes; the argument form tells the cases apart, and a bare word stays a slug..astryx-shared.json, listing the files written (with their hashes) and the packages installed. The theme folder is the only place that says what the add did, sotheme removecan undo exactly that without a configuration field (spec:AST-017/FR19). Discovery ignores dotfiles.Evidence
app-copy/folder in a.tgz). The agent was told only to make the app use the shared theme, learning from the CLI's own help.astryx theme add <the .tgz>once. The command copiedapp-copy/intosrc/themes/bootstrap, installed@astryxdesign/theme-neutralat Core's version, and recorded the theme as the default.main.tsx, andnpm run buildandtscpassed.data-astryx-theme="bootstrap"(primary buttonrgb(0, 100, 205), 4px radius, Helvetica Neue), with no page errors.theme add <the Bootstrap .tgz>copied 8 files and installed@astryxdesign/[email protected]. It reported every file written and the module and dependency change.theme remove bootstrapthen deleted those 8 files and the folders the add made, and uninstalled the package; the app tree (outsidenode_modules) matched its starting state byte for byte.add-shared.test.mjs(23 tests, in temporary folders outside the repository) covers:.tgz;--ignore-scripts, while another imported package (left-pad) is only named;theme removeundoes the add (the app tree matches the start, the install is uninstalled), keeping a changed file;theme removekeeps a package another recorded theme imports;../../../vite.config.ts, an absolute path) or a non-Astryx package (react) deletes and uninstalls nothing of them;pnpm addand reports the workspace root's lockfile;--ignore-scripts;--config.ignore-scripts=trueforpnpm remove;--mode=skip-buildon Yarn 2 and later);.yarnrc.ymlgets--ignore-scripts, and a Yarn 2+ app known by its lockfile gets--mode=skip-build);theme addandtheme removetests pass unchanged. The command manifest golden gains the new example.Scope
Components: cli (theme add)
Testing
CI=1 vitest run --project node packages/cli/api/theme packages/cli/clients/cli/commands/theme* packages/cli/clients/cli/commands/experimental-theme* packages/cli/test: 6,532 pass.runner-commands, no browser for one render case, and an unreachable package download in one global-mode case and two theme editor real-base cases.strict,json-api,authoring,template-docs) pass.check:changesetsare clean.Writing rubric results
R1 narration: none; FR15, DEC-12 and the amended clauses state what the system does.
R2 research: none in the record.
R3 evidence: the FR15 Verification row names tests and states, no pull request.
R4 rejected alternatives: three in DEC-12, one line each.
R5 change references: none.
R6 open questions: none added.
R7 project status: none.