Skip to content

feat(cli): theme add installs a shared theme from a folder, a .tgz, or a URL in one command - #12436

Merged
josephfarina merged 3 commits into
mainfrom
theme-add-shared
Nov 18, 2026
Merged

josephfarina merged 3 commits into
mainfrom
theme-add-shared

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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 add now also takes a shared theme instead of a slug: a path to the theme's folder, a .tgz archive of it, or an https URL to a .tgz. In one command it:

  • Checks before writing: finds the one theme folder in what it was given (the folder with a typed theme descriptor, <name>Theme.doc.mjs, whose default export has type: '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.
  • Copies it: into the app's local themes root, src/themes/<name>, through the same copy theme eject uses for a local theme (so the copy is discoverable and marked maintained: false).
  • Runs nothing of the theme: the theme is read, never imported or built. A theme shared without its built files is refused before anything is copied.
  • Installs its base: the @astryxdesign/* packages the theme imports that the app lacks (its base theme package; a package counts as installed when its folder is in a node_modules the 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.
  • Records it: in the generated app module, as the default, so an app already wired to the module shows it at once. On a first add, the one-time wiring lines print as for any first add.
  • Reports everything it changed: every file written (the copy, its receipt, the generated module, and package.json with the lockfile the install rewrites, a workspace root's included) and the record and dependency it changed.
  • Is undoable: the copy keeps a receipt (read back only for files inside the copy and Astryx packages) of the files it wrote and the packages it installed. 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 with theme use <it>.
  • Keeps a slug a slug: theme add <slug> is unchanged. A bare word is always a slug; only a value with a folder separator, a leading dot, a .tgz ending, or an http(s):// prefix is read as a shared theme.

Current specification

This PR amends spec:AST-050 for 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 remove undoes 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, where theme eject writes) 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.
  • JSON:
    • theme.app gains an optional data.copy for a shared theme: from, folder, outputDir, files, installed, installCommand, installError, installRetryCommand, previousDefault, written and config.
    • A remove of such a theme gains data.undo: removed, kept, uninstalled and uninstallError.
    • All other fields are unchanged; both changes are additive only.
  • Never replaces a file it did not write: a folder of the same name that another theme holds is refused, as is the add's own earlier copy with files changed since. The same shared theme added again over its own unchanged copy replaces it, which is how a shared theme is updated. Files the builder added to the copy stay; one the update also ships is refused before anything moves; and if the update fails, the old copy is put back.
  • Refusals (nothing is written in any of these cases):
    • a theme shared without its built module and stylesheet;
    • a file that is not gzip/tar, or an archive entry that is a link or would land outside the archive's folder;
    • a plain http:// URL, or an https URL that redirects through any http hop (each redirect is followed and checked before it is requested);
    • a source with no theme folder, or more than one;
    • --package with a shared theme.
  • Rollback: if recording the copy fails, the copied folder is removed, an old copy goes back, and a package the add installed is uninstalled. Package manager runs have a 5-minute limit.
  • Install failure: the Astryx install runs once. If it fails, the theme is still added, and installError with installRetryCommand names the command to run; installCommand stays for the other packages only.

Before:

tar -xzf ocean-theme.tgz
cp -r ocean-theme/app-copy src/themes/ocean
npm install @astryxdesign/theme-neutral
npx astryx theme add ocean

After:

npx astryx theme add ./ocean-theme.tgz

Design and alternatives

  • Rejected: editing the app's root component to wire the theme. AST-050 DEC-2 keeps the CLI out of app code. The add instead makes the theme the default in the generated module, which an app wired once already renders.
  • Rejected: requiring the archive to contain only the theme folder. Shared bundles often carry notes and editor state beside the app copy. The command finds the one folder with a theme descriptor, and refuses when there are two.
  • Rejected: a new top-level command. Adding a theme is what theme add does; the argument form tells the cases apart, and a bare word stays a slug.
  • Rejected: building a theme shared without its built files, or renaming one to fit a taken name. Both run the theme's code during an add. A shared theme arrives built, and a name another theme holds is refused.
  • Receipt beside the copy: the copy keeps .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, so theme remove can undo exactly that without a configuration field (spec:AST-017/FR19). Discovery ignores dotfiles.
  • Archive reading: uses Node's zlib with a small tar reader that takes only plain files and folders and rejects links and escaping paths, so there is no new dependency.

Evidence

  • No-context agent test: a fresh Vite + React app with Core installed and no theme, plus a shared bundle (a theme editor's saved state, notes, and its 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.
    • It ran astryx theme add <the .tgz> once. The command copied app-copy/ into src/themes/bootstrap, installed @astryxdesign/theme-neutral at Core's version, and recorded the theme as the default.
    • The agent added the printed wiring to main.tsx, and npm run build and tsc passed.
    • In Chrome the built app renders under data-astryx-theme="bootstrap" (primary button rgb(0, 100, 205), 4px radius, Helvetica Neue), with no page errors.
  • Real add and remove: in a fresh npm app with Core 0.7.16, 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 bootstrap then deleted those 8 files and the folders the add made, and uninstalled the package; the app tree (outside node_modules) matched its starting state byte for byte.
  • add-shared.test.mjs (23 tests, in temporary folders outside the repository) covers:
    • adding from a folder and from a nested .tgz;
    • nothing of the theme runs: its entry and built module write a marker if anything imports them, and the marker stays absent;
    • the Astryx base is installed at Core's version with --ignore-scripts, while another imported package (left-pad) is only named;
    • every written file and the record and dependency change are reported;
    • a theme without built files is refused before anything is copied or installed;
    • a folder it did not write is refused, its own unchanged copy is replaced, and its own copy with a change is refused;
    • theme remove undoes the add (the app tree matches the start, the install is uninstalled), keeping a changed file;
    • theme remove keeps a package another recorded theme imports;
    • a hand-edited receipt naming a file outside the copy (../../../vite.config.ts, an absolute path) or a non-Astryx package (react) deletes and uninstalls nothing of them;
    • an update keeps a file the builder added to the copy, and one the update also ships is refused with the tree unchanged;
    • an install in a pnpm workspace member that declares its package manager runs pnpm add and reports the workspace root's lockfile;
    • an update that cannot be recorded puts the old copy back, with the tree unchanged;
    • install scripts are off in the form each package manager's verb takes (--ignore-scripts; --config.ignore-scripts=true for pnpm remove; --mode=skip-build on Yarn 2 and later);
    • a base installed but not declared is not installed again;
    • Yarn 1 versus Yarn 2+ is read by the same check the CLI's other commands use (a Yarn 1 app with a .yarnrc.yml gets --ignore-scripts, and a Yarn 2+ app known by its lockfile gets --mode=skip-build);
    • a built module that does not export the theme is refused before anything is copied;
    • a failed Astryx install is reported apart from the packages it never installs;
    • https redirects are followed one hop at a time, and an http hop is refused before it is requested;
    • refused archives (an escaping entry, a link, no theme, not gzip), a plain http URL, and two themes;
    • a slug still read as a slug.
  • Existing tests: theme add and theme remove tests pass unchanged. The command manifest golden gains the new example.

Scope

Components: cli (theme add)

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

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.
    • The remaining failures are environment-only on the test box: no git index for 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.
  • The four CLI typechecks (strict, json-api, authoring, template-docs) pass.
  • ESLint, Prettier and check:changesets are clean.
  • The no-context agent run and the browser check are described in Evidence.

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.

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 18, 2026 10:04am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@astracat-bot

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 10:12 AM UTC

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · fd047e5

Storybook · Sandbox · built from this PR's head

Package size: @astryxdesign/cli 5.44 MB packed (+13.6 kB); no new dependencies.

API changes: cli +0 · ~1 · −0

1 API change (advisory)
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

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 imports left-pad or 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-node fails because packages/cli/foundation/doc-compiler/doc-loads.test.mjs does not list the adapter's new child_process.spawnSync; add it to the adapter's RUNNERS entry.
  • missingImports and installedVersion duplicate forkNeeds and installedProjectCoreDir, and the copy misses a Core hoisted to the workspace root, so the base theme package is installed with no version there; extend forkNeeds and use installedProjectCoreDir instead.
  • 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 add accepts a theme folder, a .tgz, or an https URL to a .tgz instead 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> with theme 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 @astryxdesign package 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 --name to 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.mjs 21 pass).
  • Claim: --name rebuilds the copy under that name and refuses an entry without defineTheme: verified (test, _fork.mjs refusal).
  • Claim: the JSON gains an optional data.copy and 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.json and 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.

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at 753c3c2:

  • Only @astryxdesign/* packages are installed for a shared theme; any other package it imports is named with its install command and never installed (test with left-pad).
  • doc-loads.test.mjs lists the adapter's child_process.spawnSync and names the install in its runs text.
  • missingImports and installedVersion are gone: forkNeeds now also returns missingAstryx, and the Core version comes from installedProjectCoreDir, so a Core at a workspace root is found.
  • A copy with no built module is built before it is recorded; when that build fails the copy is removed (tests for both).
  • A redirect away from https is refused, and the add.mjs header no longer says copying belongs only to theme eject.
  • The spec question: spec:AST-050 gains FR15 (the shared case) and DEC-11 (a shared theme has no package to import, so it is copied with eject's copy), with a pointer from FR1. These await an engineering owner's /approve-spec.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision (engineering owner, covering this pull request): astryx theme add <folder|tgz|URL> sets up a shared theme in one command. A shared theme has no package to import from, so theme add copies it into the app's themes folder and makes it the default; copying otherwise stays reserved for theme eject, and the CLI never edits app code. Only the Astryx packages the theme needs are installed automatically; any other package is listed with its install command. URL sources are https only, nothing from the theme runs during add (no install scripts), the theme is validated before anything is copied, add never overwrites a file it did not write, it reports every file written and the config change, and theme remove undoes it cleanly, with a test for each. spec:AST-050 FR15 and DEC-11 state this.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 753c3c2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 during theme 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 the theme build command, 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 remove refuses 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 covers http:// or redirect refusal, the theme running nothing, or theme remove after a shared add.
  • spec:AST-050 still contradicts the new FR15 in its Intent, FR13 ("No surface teaches copying as the way to use a theme"), the FR12 verification row ("plain theme add copies") 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 results section that a pull request changing a record reports.
  • After a failed install the text calls npm install @astryxdesign/theme-neutral@… a package that theme add "does not install", and data.copy.installCommand then holds that Astryx command although theme.type.mjs documents it as the other packages only; report the failed command in the [!] Not installed line 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 add accepts a theme folder, a .tgz, or an https URL to a .tgz instead 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> with theme 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.mjs 21 pass).
  • Claim: --name rebuilds the copy under that name and refuses an entry it cannot rename: verified (test, a run against an entry with no defineTheme).
  • Claim: the JSON gains only an optional data.copy: verified (theme.type.mjs, API comparison), though installCommand misstates 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, --package with a shared theme and --name with 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.json and 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:changesets pass: verified for the suites run here, the typechecks, ESLint, Prettier and check: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 --name suggestion 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.

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread docs/specs/AST-050-app-themes/spec.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Round 3 at 90662f1, one test per condition (add-shared.test.mjs):

  • https only: a plain http:// URL is refused, as is a redirect away from https (test: http URL, nothing written).
  • Nothing of the theme runs: the theme is read, never imported or built. Its entry and built module write a marker if anything imports them, and the marker stays absent. The Astryx install runs with --ignore-scripts. Because a build would run the theme's code, building an unbuilt theme and --name (which needed a rebuild) are gone.
  • Checked before copying: a theme shared without its built module and stylesheet is refused before any copy or install (test: tree unchanged, no install).
  • Never overwrites a file it did not write: a folder it did not write is refused byte-identical, and so is its own earlier copy with a changed file. Its own unchanged copy is replaced, which is how a shared theme is updated.
  • Reports every file written and the config change: data.copy.written lists the copy, its receipt, the generated module, and package.json with its lockfile when it installed. data.copy.config gives the module, the default and the dependencies added. The text output prints both.
  • theme remove undoes it fully: the copy keeps a receipt (.astryx-shared.json: files with hashes, installed packages, whether it made the themes root). Remove deletes the unchanged files and the folders the add made, keeps and names a changed file, and uninstalls the installed packages no other local theme imports (data.undo). In the test, the app tree matches its start; in a real npm app with the Bootstrap archive, the tree matched byte for byte after remove.

AST-050 FR15 and DEC-11 are updated to match.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 90662f1

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the shared-theme direction is approved for this head, but five problems need fixing first.

  • theme remove of a shared theme uninstalls a package that another theme in the app's record still imports (for example @astryxdesign/theme-neutral after theme 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: download checks only the final URL, so an https URL that redirects through a plain http:// 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 any location that is not https, and add the redirect test.
  • spec:AST-050 still contradicts FR15 in clauses this pull request leaves unamended: Intent (line 38), FR12 migration item 2, which forbids the CLI to delete a theme add copy (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, which architecture:knowledge-contracts requires 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.installCommand carries 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

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread docs/specs/AST-050-app-themes/spec.md Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at de55fc2:

  • theme remove keeps every package a theme still in the record is owned by or imports, and any package the generated module or another local theme imports (test: two shared themes on the same base; removing one uninstalls nothing).
  • Downloads follow redirects themselves (redirect: 'manual', at most 5 hops), and a non-https location is refused before it is requested (test: an https → http hop is refused after one request; https → https → archive works). The body is read up to the 50 MB cap, with content-length checked first.
  • AST-050 carries the FR15 exception in Intent, FR12 migration item 2, FR13 and its Verification row, the FR12 row, and DEC-2. FR15 has a Verification row and a Current-state impact line. DEC-11's rejected alternatives are one line each.
  • The description has ## Writing rubric results.
  • A failed Astryx install keeps its own installRetryCommand (shown in the [!] Not installed line), and installCommand stays for the other packages only (test).
  • Non-blocking: the receipt names previousDefault, and the printed undo starts with theme use <previous default> (test).

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec de55fc2

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ejectThemeFiles can refuse, so an update that ships a file the person added to the copy (for example notes.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.written and the Wrote: line leave out the workspace root's lockfile that the install rewrites, because lockfileNames looks only in the app folder (packages/cli/api/theme/_adapter.mjs:1982-1990); report the lockfile of the folder that chose the package manager, through decidePackageManagerIn, and test a workspace app.
  • undoSharedTheme hard-codes the generated module's homes (packages/cli/api/theme/_adapter.mjs:2069-2071) instead of calling themeModuleCandidates from packages/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 written list (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

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at d79bd25:

  • Re-adding over its own copy checks for clashes before anything moves. A file you added to the copy that the update also ships is refused with the tree unchanged, and one it doesn't ship stays beside the new copy (test). The old copy is set aside and put back on any failure, a recording failure included.
  • written and the Wrote: line name the lockfiles of the folder that chose the package manager, walking up to the workspace root through decidePackageManagerIn (test: a pnpm workspace app runs pnpm add and reports ../../pnpm-lock.yaml).
  • The undo reads the generated module through themeModuleCandidates.
  • Non-blocking: a recording failure after an install uninstalls what that add installed, and package manager runs have a 5-minute limit.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec d79bd25

@github-actions github-actions Bot added needs:spec-owner-review Current knowledge records await owner approval and removed needs:spec-owner-review Current knowledge records await owner approval labels Nov 18, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: forkNeeds treats an Astryx base package as missing whenever require.resolve('<name>/package.json') throws, which it always does for @astryxdesign/* packages because their exports omit ./package.json, so an app that already has @astryxdesign/theme-neutral installed but not declared gets it installed again by theme add and uninstalled by theme remove; use findInstalledPackage(projectDir, name) from foundation/fs/paths.mjs and 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 .tgz or 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.mjs MAX_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 installCommand covers only the other packages — verified (test).
  • Claim: theme remove deletes 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.mjs has 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.

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at e381a61, rebased onto main as one feature commit plus this fix (forkNeeds keeps main's installGuidance):

  • An Astryx base counts as installed when its folder is in a node_modules the app reaches (resolveInstalledPackageDir), so an installed but undeclared @astryxdesign/theme-neutral is not installed again. The tests now run in temporary folders outside the repository, so the repository's own installs don't count for the test app.
  • Non-blocking: a workspace member that declares its own packageManager reports the root lockfile of that package manager (the workspace test now declares [email protected] in the member), and the restore-on-failure path has a test (an update whose built module no longer exports the theme leaves the tree unchanged).

@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at f6166f3:

  • yarnBerry is gone. package-manager.mjs exports isYarnClassicAt(dir) (isYarnClassic over explainPackageManager), and scriptsOff calls it. Test: a Yarn 1 app with a .yarnrc.yml gets --ignore-scripts, and a Yarn 2+ app known only by its __metadata: lockfile gets --mode=skip-build.
  • Non-blocking: installRetryCommand and the rollback's "run it to finish" command carry the scripts-off flag. A built module that does not export the theme is now refused before anything is copied, so no message points at a removed folder (test). The restore-on-failure test now stops the record with a folder it cannot write.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec f6166f3

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, .tgz or 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 --package are refused, writing nothing — verified (tests).
  • Claim: theme remove undoes 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.copy and data.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).

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 273c6b1

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: two blocking findings in the shared-theme undo and archive paths, both with small fixes.

  • Miss: theme remove deletes every path and uninstalls every package that a theme folder's .astryx-shared.json lists without confining them (packages/cli/api/theme/_adapter.mjs:2172-2176 and :2220), so a hand-copied theme folder with a crafted receipt made theme remove delete the app's root vite.config.ts and uninstall react; resolve each key with assertWithin against 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 calling assertWithin from packages/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, .tgz or 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; ejectThemeFiles writes 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 --package are refused, writing nothing — verified (tests).
  • Claim: theme remove undoes 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's vite.config.ts deleted, react uninstalled); verified for one it wrote (tests).
  • Claim: theme remove keeps 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.copy and data.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).

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at c006707:

  • The receipt is read back confined. Each file entry must pass assertWithin against the copy, have its real parent inside the copy's real folder (no link on the way), and be a regular file; the copy's folder and the receipt itself are never entries. Only @astryxdesign/* names are kept from installed, since an add installs nothing else. Test: a hand-edited receipt naming ../../../vite.config.ts, an absolute path and react leaves the file in place and uninstalls nothing of them.
  • The archive reader checks each entry with assertWithin (and refuses a drive-letter path anywhere), mapping its error to the existing "would land outside the archive's folder" refusal. The escaping-entry test still passes.
  • Not changed in this push (non-blocking): an integration's installGuidance for the packages the shared install names.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec c006707

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts the placeholder hash 'x', so theme remove keeps 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, .tgz or 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_modules the 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 --package are refused, writing nothing — verified (tests).
  • Claim: theme remove undoes 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.copy and data.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 with assertWithin).
  • 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).

Automated review (maintainer link)

@josephfarina

Copy link
Copy Markdown
Contributor Author

Owner decision update (engineering owner, covering this pull request at its current head): the shared-theme decision is recorded as spec:AST-050 DEC-12 (DEC-11 is the doctor warning decision already on main), and FR15 cites DEC-12. The decision itself is unchanged.

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 66453e1

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to main'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) duplicates removeEmptyFolder in packages/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 a foundation/fs module and call it from the rollback and undoSharedTheme.

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 .tgz or 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_modules 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 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 .tgz ending 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.copy and data.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 --package are 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: removeEmptyFolders duplicates 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).

Automated review (maintainer link)

Comment thread docs/specs/AST-050-app-themes/spec.md Resolved
Comment thread packages/cli/api/theme/_adapter.mjs Resolved
…n; empty folders are taken back by one shared helper
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed at 131c779:

  • AST-050's FR12 Verification row says "copies a theme given by its slug" again, and the FR13 row "other than a shared one (FR15)"; the rebase had reset both to main's text.
  • removeEmptyFolder moves from api/theme-edit/_palette.mjs into foundation/fs/empty-folder.mjs. The theme editor (_parts.mjs, _settings.mjs), the shared add's rollback and undoSharedTheme all call it; the adapter's own copy is gone.
  • Non-blocking: the hand-edited receipt test now gives each escaping entry the real hash of what it names (the app's vite.config.ts, and an absolute path to a file outside the app), so only the confinement keeps them.
  • Not changed in this push: an integration's installGuidance. It's built as its own follow-up PR on this branch's behavior and opens once this merges.

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 131c779

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 18, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 own readdirSync/rmdirSync block, which repeats removeEmptyFolder(root) from packages/cli/foundation/fs/empty-folder.mjs; replace it with if (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 .tgz or 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 .tgz ending 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.copy and data.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 --package are 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 repeats removeEmptyFolder.
  • 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).

Automated review (maintainer link)

Comment thread packages/cli/api/theme/_adapter.mjs Resolved
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec fd047e5

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .tgz or 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 .tgz ending 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.copy and data.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 --package are 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 calls removeEmptyFolder for 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).

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 2910a14 into main Nov 18, 2026
81 checks passed
@github-actions
github-actions Bot deleted the theme-add-shared branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — fd047e59 Deployed Nov 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant