Skip to content

feat(cli): install once, run anywhere — every copy hands a project's run to the release its Core matches - #7649

Merged
josephfarina merged 64 commits into
mainfrom
josephfarina/cli-command-name
Oct 21, 2026
Merged

josephfarina merged 64 commits into
mainfrom
josephfarina/cli-command-name

Conversation

@josephfarina

@josephfarina josephfarina commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Landing order: merge the spec first (#7601, AST-081 Global mode), then this PR. This PR implements that spec and nothing else.

What this does

Install the CLI once for your computer and astryx works in any folder, while every project keeps running its own version of Astryx.

npm i -g @astryxdesign/cli
  • Inside a project, the project's version answers. A project that installs its own CLI is answered by it, whatever its version, as before: the global copy, npx, or a typed version hands the run to it, keeping arguments, folder, standard streams, and exit status. A project with no CLI of its own (only @astryxdesign/core, or a fresh clone) is answered by the copy you started, as before; when that copy isn't the Core's release, a one-line hint after the command, at most once a day per project, prints the command that adds the CLI at Core's version, and JSON reports copy: "starting". Only a project whose own CLI can't start gets the CLI release equal to its Core, installed once into a per-user cache. doctor warns on either mismatch and prints the command that aligns them. In text mode, one astryx: answered by … line on standard error says who answered; every --json result carries meta.answeredBy (cli, core, copy).
  • Outside a project, the global copy answers with its own release, as a new project would, reading the Core of that release, which it downloads into the cache in the background after a run (never in CI), so component reads work offline after one online run.
  • Nothing that worked before breaks. When the matched release cannot be obtained (offline, a registry without it, an unwritable cache), the copy you started answers, as before global mode, with one warning line and meta.answeredBy.copy: "fallback". A failed install is retried after 2 minutes, then after 10 once it fails again, so offline runs don't start npm every time. ERR_VERSIONS_UNAVAILABLE is kept for runs nothing can answer.
  • Updates notify, never self-update. At most once a day, after a command that succeeds, a two-line notice names the newer version and the exact command: the global copy's own package manager (npm, pnpm, yarn, bun, or Volta), into a custom npm prefix when it was installed under one; inside a project, an install of Core and the CLI together, then astryx upgrade. CI and NO_UPDATE_NOTIFIER turn the check off.
  • Every coding agent on the computer knows Astryx. The global copy writes one short (13-line), version-free skill file at ~/.agents/skills/astryx/SKILL.md on its first run and refreshes it after each upgrade, in the background. Agents that read only their own folder get a folder link to it (Claude Code always; Kiro, Windsurf, Letta, Xcode's coding assistant, and ~/.config/agents/skills when present); Continue, whose scanner skips links, gets a managed copy. Nothing Astryx did not create is replaced; astryx init --user writes it now, and --remove-agents removes the file, its links, and the copy.
  • Integrations installed globally apply outside projects, never inside one; doctor says which a project could add.
  • Discoverable. astryx --help has one line, and the manifest a globalMode field, pointing to astryx docs global (the hand-off, the daily check, the skill writes).
  • Every command declares what it does outside a project (same, refuse, or own), published by astryx manifest, stated in its "In global mode" note, and checked by running every command in an empty folder.
  • Docs. astryx docs global is a top-level docs section and one docsite page (Global mode, under Guide, introduced and linked from Getting Started; the old CLI global pages redirect to it): project, global, or both; install; which version runs; updates; the agent guide; integrations; monorepos; CI and containers; troubleshooting; uninstall; and a reference. Integration authors get a checklist. The docsite shows npx @astryxdesign/cli … (a bare npx astryx reaches an unrelated package), and plain astryx … on the Global Mode page.

Safety

  • npm is started from its own entry file with the running Node, never through a shell; a project's declared Core range is used only when it is a plain version range.
  • A stale install lock ends the process it records only when that process is exactly this CLI's install of that release: npm, or node running npm-cli.js, with install @astryxdesign/cli@<version>, started after the lock was taken (read from /proc, else ps or PowerShell). Otherwise the lock is just taken over. The guard removes the record when it ends npm.
  • No install outlives the run that started it; locks are renewed and taken over safely, including on a shared cache.
  • Writes outside a project go only to the per-user cache, the per-user settings and state files, and the agent skill file with its links, as the spec lists.
  • Environment access in init --user and doctor (files, search path, release facts) goes through their adapters.

Records this changes

  • AST-081 Global mode (new; the spec PR).
  • architecture:cli-surface: the release-choice stage before dispatch, INV2 (meta.answeredBy), INV3 (the new error codes), INV7 (outsideProject), INV10 (the per-user writes outside a project), INV12 (the run-level standard-error lines), INV13 (the computer-level text's single source), INV14 (computer-level integrations beside autolinking), and INV22 (the picker's command name in hints).
  • spec:AST-048 (its platform support prints FR5's command name) and spec:AST-051 (FR6 admits a door's sources; FR11's official list ships with each release).
  • spec:AST-017: additive response fields (FR13) and discoverability (FR14).

How it is tested

  • A table of every way global and project copies meet (rows G1–G57 in the spec), each with a test that installs real packed releases into temporary computers: package managers, workspaces, nested folders, read-only homes, unwritable caches, offline runs, custom npm prefixes, old copies first on the PATH, and the agent skill and its links.
  • Every command run in an empty folder against its declared behavior and its note; every terminal line the docs show checked against the CLI's own strings; docs search checked for the global-mode pages.
  • The full CLI suite, typecheck, lint, README, structure, knowledge, and docsite checks.

Follow-up (next minor, breaking)

  • The release equal to a project's Core answers even when the project's own CLI is a different release, and answers a project with only Core instead of the copy you started. This changes what an existing install answers, so it waits for the next minor release; until then doctor and the daily hint flag the mismatch.

Compatibility

A project's own CLI run directly (npx astryx, package scripts) answers exactly as before, and so does a project with no CLI of its own. The one route that changes: a global install or npx @astryxdesign/cli@<version> started inside a project that installs its own CLI of another release now hands the run to that CLI, so it answers what the project's own command does. No documented route uses that, and the JSON shape is unchanged; commands for the computer (init --user, docs global) still answer from the copy you started.

Why one pull request

Global mode is one feature with one record (spec:AST-081). A CLI installed once for the computer hands each folder to the release that folder needs: the project's own CLI, the release equal to its Core, or the starting copy with its carried Core outside a project. The parts work only together, and each depends on the others:

  • choosing the release and handing the run off (FR2, FR9);
  • the carried Core outside a project (FR3);
  • the command-name picker every printed command goes through (FR5);
  • the background update check and its notices (FR6, FR10);
  • the computer-level skill and integrations (FR8, FR12);
  • the doctor and docs pages that describe all of it.

Landing a part alone leaves main half-done. A hand-off with no picker prints commands that start the wrong release. A carried Core with no hand-off answers a project from a release it never installed. Notices with no hand-off tell a project to upgrade a CLI that is not the one answering it. Any split leaves main with behavior AST-081 does not describe for a release or more.

Of the 22,936 changed lines against main, 11,439 are tests: the global/local table (G1–G58), the release, cache, hand-off, and notice tests, and the fork smoke. 2,882 are docs and records, and 8,615 are code.

Why the update notices, the computer-level skill and computer-level integrations stay in this pull request

All three are parts of the hand-off, not features beside it. Each one asks the same two questions the hand-off answers, "which copy answered this run" and "what command reaches it from here", and each prints or installs the answer through the one command-name picker.

  • Update notices print an upgrade line. Which line depends on who answered: a project with its own CLI gets pnpm add @astryxdesign/[email protected] @astryxdesign/[email protected], then pnpm exec astryx upgrade --from 0.7.2 --apply; a fresh clone answered by a global copy gets the version its lockfile records, not the global copy's; a host's door gets the host's own upgrade command.
  • The computer-level skill names the bare astryx command, which only works once the hand-off sends that command to the right release in every folder. The global copy refreshes the skill on its own release, so the skill follows each upgrade of that copy.
  • Computer-level integrations load from the answering copy's install folder outside a project. Inside a project they are only offered, with the project's own install command (FR12). Both halves need the hand-off's inside/outside decision.

Landed apart, main ships a hand-off whose output disagrees with itself. A notice that is not yet hand-off-aware tells a fresh clone to upgrade from 0.7.3 (the global copy) while doctor and the next run say 0.7.1 (its Core). A skill shipped before the hand-off tells agents to run bare astryx, which in a project starts the global release instead of the project's. Integrations shipped without the inside/outside rule load a computer copy's components into a project that never installed them, and that project's build fails. The follow-up pull requests would each change behavior that the first one already shipped, so the release in between would do something spec:AST-081 does not describe.

@vercel

vercel Bot commented Oct 16, 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 Oct 21, 2026 9:10am UTC

Request Review

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

astracat-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟡 Reviewed (for maintainers only) Oct 21, 2026, 9:34 AM UTC

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

40 of 486 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 20 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

…ase its Core matches

Install the CLI once for the computer and run it in any folder (spec
AST-081 FR2–FR9).

- Core decides the release. In a project, the release equal to the
  project's Core answers: the project's own CLI when it matches, otherwise
  the matched release (from the installed Core, else the lockfile, else the
  declared range), installed once into the per-user cache through npm.
  Every copy hands the run over before loading anything the project
  provides, at most once, keeping argv, folder, stdio, and the exit status,
  with one stderr line in text mode and none with --json.
- Outside a project, the copy installed for the computer answers with the
  newest release it keeps in the cache, checked at most hourly in a
  detached background process, verified, with the previous release kept as
  the last good one. Commands that read Core use the answering release's
  Core, installed when first needed; doctor, swizzle, and upgrade never
  read it.
- A release that cannot be installed fails the run before any write with
  the new ERR_VERSIONS_UNAVAILABLE.
- Every command declares outsideProject (same, refuse, own) in its command
  doc and the manifest; doctor checks the computer outside a project and
  reports the newest known release; project-only advice is not printed
  outside a project. New code ERR_PROJECT_REQUIRED.
- Every successful JSON result carries meta.answeredBy {cli, core, copy}.
- The picker's guess reaches the release that answered: the project's run
  prefix for its own CLI, `astryx` for the global copy outside a project,
  otherwise the CLI package pinned to the answering version.
- Docs: `astryx docs cli/install-once`, README, error codes, command docs.
@josephfarina josephfarina changed the title feat(cli): an integration can set the command printed hints start with (cliCommand) feat(cli): install once, run anywhere — every copy hands a project's run to the release its Core matches Oct 17, 2026
… CLI

- `astryx init --user` writes the computer-level agent text (spec AST-081
  FR8, DEC-12): one skill file named `astryx` in `~/.agents/skills/` and
  `~/.claude/skills/`, from the same source as the project block, with no
  version, telling agents to follow a project's own agent docs inside that
  project. `--remove-agents` removes it. It never overwrites or removes a
  file Astryx did not write and never follows a link in its place, and no
  other command writes it. New `init.user` receipt. Doctor outside a
  project reports whether the text is present and current (info only).
- A CLI installed for the computer with pnpm 11 or later
  (`<pnpm home>/global/v11/<id>`) is a global copy, so it follows `latest`
  like npm, Yarn, and Bun installs.
- A workspace's own CLI package (beside its Core package, outside
  node_modules) counts as the project's CLI, so it prints no who-answered
  line.
- Registry requests for releases retry once and time out after 30 seconds,
  and installs prefer npm's offline cache, so a run with no network fails
  quickly with ERR_VERSIONS_UNAVAILABLE.
- The docsite sidebar test lists the new `cli/install-once` guide.
- A lock records the run that holds it; a lock whose run has gone (stopped
  with Ctrl-C, killed, or its terminal closed) is taken over at once
  instead of making later runs wait. A run stopped mid-install clears its
  lock and scratch folder, and the next install clears any it finds.
- A cached release's marker records the bytes of the CLI's and Core's
  package.json and the CLI's entry file. A release whose marker is broken or
  whose files no longer match counts as absent and is replaced the next time
  a run needs it, instead of failing for good or answering with nothing.
- A cache folder that cannot be written gives ERR_VERSIONS_UNAVAILABLE that
  says so, never a stack trace, and the JSON envelope stays intact.
- `manifest --json`, `--json`, `--version --json`, and `--help --json` carry
  meta.answeredBy like every other successful result.
…ill frontmatter

- A slow but moving install is never ended by the CLI stopping itself. The
  time limit is 15 minutes and ends npm outright (npm defers SIGTERM), so no
  install process outlives it; reaching it is ERR_VERSIONS_UNAVAILABLE with
  a reason, never an empty answer. Only a Ctrl-C, a closed terminal, or a
  termination request the run itself received stops it.
- A text-mode run prints one line while it installs a release, or while it
  waits for another run installing it; JSON runs print none. A live install
  on this computer is waited for however long it takes (up to a 30-minute
  hard bound); another computer's lock in a shared cache expires after 20
  minutes.
- `astryx init --user` acts on the computer, not the folder, so it is never
  handed to a project's (possibly older) CLI: it is chosen as outside a
  project wherever it runs, and its line says it answered for the computer.
- A cached release records the number and total size of its CLI's and
  Core's files, so a deleted or truncated module marks the release damaged
  and it is installed again; each release is checked once per run.
- The skill file `init --user` writes quotes its description, so its
  frontmatter is valid YAML and agent tools with a strict parser load it.
- Every command one run prints starts with the stem of the release that
  answered the run, whichever folder the line names (a doctor fix for a
  project beyond the read reach printed another stem).
- The guide says what happens in a Yarn Plug'n'Play project: the release
  equal to the project's Core answers from the cache, because seeing the
  project's own CLI needs the project's loader.
npm now runs under a small guard (foundation/release/npm-guard.mjs) that
gives it a process group of its own and ends that group when the time limit
passes, when the run that started it goes away (even killed outright, as
agent and CI tools' timeouts do), or when the run receives Ctrl-C, a closed
terminal, or a termination request. npm defers those signals and would keep
the run's output pipes open, so the group is ended outright.

The release lock records npm's process id. A run that takes over a lock
whose run has gone ends that recorded install first (when it is still
running and is npm), then clears the scratch folder and installs.
- The install guide no longer says the answer is the same whichever copy
  you start: inside a project the project's release answers; outside one
  the copy installed for the computer answers with the newest release it
  keeps, and a package runner's copy or a typed version answers as exactly
  that release.
- The guide and the README say a text run prints its who-answered line
  unless the project's own CLI was started and answered directly; a run
  another copy hands to the project's CLI prints one too.
- The README and the CLI command guide say printed commands reach the
  release that answered: the project's runner for its own CLI, `astryx`
  outside a project for the copy installed for the computer, otherwise the
  CLI package pinned to that release.
The install guide's who-answered section names the one exception to 'a run the project's own CLI answers directly prints no line': astryx init --user always answers for the computer and says so, and its example shows that line.
…d links it

Joey's call (10-20): global mode lives under Guide, and Getting Started
writes about it and links it.
- DocsShell.tsx is back to main's version: no top-level sidebar item; the
  Global mode page lists under Guide.
- Getting Started: a new section after Install, "Install once, use
  everywhere": the astryx command in any folder, for you and any coding
  agent; inside a project the project's own version still answers; the one
  install command; links to project, global, or both and to the global mode
  guide. The docs system cannot embed another doc's section (only token
  tables), so it links. It replaces the closing "In global mode" section and
  the Install section's one-line pointer.
- The route test checks the page under Guide again and that Getting Started's
  section carries the install command and a link that opens /docs/global;
  the changeset and PR text say so.

@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.

Approval waits on a maintainer decision: this pull request implements spec:AST-081, which is still a draft in #7601, and it intentionally changes current architecture:cli-surface, spec:AST-048 and spec:AST-051 claims, so a maintainer needs to land that spec with those amendments or name the spec that governs global mode.

That decision also needs to settle two current architecture:cli-surface claims that #7601 leaves unchanged: INV31, which forbids writing agent docs into a settings folder of the home folder outside a project (the default ~/.agents/skills/astryx/SKILL.md write and its ~/.claude/skills/astryx link), and INV1, which forbids TTY detection (the Windows terminal check before the background Core download). Independently of that decision, split update notices, the home-folder agent skill, computer-level integrations and cliCommand into their own pull requests, since together the change is 22,214 authored lines. The earlier point about SIGINT sent to the starting copy is fixed.

[Automated review]

Comment on lines +274 to +277
interactive = Boolean(process.stdout.isTTY && process.stderr.isTTY),
}) {
if (isCi(env) || !isReleaseVersion(release.version)) return false;
if (platform === 'win32' && !interactive) return false;

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.

Current architecture:cli-surface INV1 says: "No prompt, no TTY detection, no read of stdin for control flow. A non-TTY environment is the only supported condition, not a fallback." Here the background Core download on Windows depends on process.stdout.isTTY && process.stderr.isTTY, so a run whose output an agent reads never starts it and its first component read installs Core in the foreground. #7601 describes this condition but does not amend INV1, so the spec decision needs to cover it.

Comment on lines +496 to +497
fs.mkdirSync(folder, {recursive: true});
writeNoFollow(file, expected);

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.

Current architecture:cli-surface INV31 says: "No mode writes agent docs into the home folder, or into a settings folder in it, a folder of the home folder whose name starts with a dot, outside a project." This writes the skill file, inside the Astryx markers, into ~/.agents/skills/astryx, and the loop below links it into ~/.claude/skills/astryx, by default from the global copy's background step and from init --user. #7601 amends INV10 and INV13 for this file but leaves INV31's text unchanged, so the spec decision needs to cover INV31 too.

…5-second interrupt grace

- Docs the CLI shows write commands bare (`astryx <command>`): the CLI
  prefixes each one when it prints a doc, and the docsite with
  `npx @astryxdesign/cli`. working-with-ai, getting-started's prompts,
  check-the-props, check-your-docs, single-component, troubleshooting,
  project-global-or-both, and Core's Indicator and DropdownMenu docs. The
  examples of what a project's runner prints use `pnpm exec astryx` /
  `yarn astryx`, never the unscoped name through npx (cli-command,
  who-answers, add-a-topic, the integration `cliCommand` docs); updates
  quotes the pnpm form of the CLI's notice. READMEs use
  `npx @astryxdesign/cli …`; code comments that named the unscoped form now
  describe it. CHANGELOGs, tests, the package-manager helpers and template
  demo strings are untouched.
- RUNNER_COMMAND_ALLOWLIST (foundation/discovery/runner-allowlist.mjs): the
  files never scanned and the docs that show a runner on purpose, with why;
  for the Doctor lane's runner check to import. test/runner-commands.test.mjs:
  no unscoped name through a download runner anywhere outside the skips, and
  no runner before an astryx command in a doc except the named pages
  (TODO: switch to the Doctor check's matcher when it lands).
- INV1: the background Core install never runs on Windows (no terminal
  check); a component read there installs Core on first need. G52 skips
  Windows; G55 expects no step there. Docs and the changeset say so.
- b31 / INV1: SIGINT is forwarded only if the handed-off CLI is still running
  5 seconds later (no /proc terminal check): an agent's kill('SIGINT') stops
  the run, and a group interrupt reaches a CLI that stops in time exactly
  once. G58 covers both, plus a CLI that dies by the signal.

@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.

Approval waits on a maintainer decision: this pull request implements spec:AST-081, which is still a draft in #7601, and it intentionally changes current architecture:cli-surface, spec:AST-048 and spec:AST-051 claims, so a maintainer needs to land that spec with those amendments or name the spec that governs global mode. Independently of that decision, these points need changes:

  • Split update notices, the home-folder agent skill, computer-level integrations and cliCommand into their own pull requests, since together the change is 22,372 authored lines.
  • Compute the skill link's relative target from the real folder that holds it (packages/cli/foundation/agent-docs/computer-agent-text.mjs:450), because under a symlinked ~/.claude or ~/.config the link dangles while astryx init --user and astryx doctor report it linked.

The earlier point about the Windows terminal check (cli-surface INV1) is fixed.

[Automated review]

if (process.platform === 'win32') {
fs.symlinkSync(folder, at, 'junction');
} else {
fs.symlinkSync(path.relative(path.dirname(at), folder), at, 'dir');

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.

The relative target is computed from the logical folder of the link, but the system resolves a relative link from the real folder that holds it. With ~/.claude linked to ~/dotfiles/.claude (a common dotfiles setup), ../../.agents/skills/astryx resolves to ~/dotfiles/.agents/skills/astryx, so the link dangles; pointsAt (line 357) resolves it logically, so init --user reports it linked and doctor lists it under "Linked into". Computing the target from fs.realpathSync(path.dirname(at)), judging links by fs.realpathSync(at) as the test helper does, and adding a case with a symlinked ~/.claude would fix it.

…olves under a linked ~/.claude

- state.json `noticeSkips[key] = {reason, at}` records why a notice did not
  print: already-shown, no-newer, lock-timeout, state-unwritable.
  Diagnostic only, not part of any contract; recorded at most once an hour
  per reason, and only into a state file that already exists. `astryx
  doctor`'s newest-release line names the last skip, and the holder of the
  state file's lock when one holds it now.
- The macOS smoke accepts the update pair on whichever of the first two text
  runs printed it (the check the first run starts can finish before that run
  exits) and requires exactly one pair across them, and none after.
- The computer-level skill link's relative target is computed from the
  folder the link really sits in (absolute with no common base), so a
  ~/.claude linked to a dotfiles folder gets a link that resolves. Link
  checks follow the target the way the system does: a link whose text names
  the skill folder only from the link's path (as 0.7.x made under a linked
  ~/.claude) is reported dangling, and init --user remakes it.
- Tests: notice skips (already-shown throttle, no-newer, lock-timeout and
  lock holder, nothing written without a state file), doctor's line, a
  linked ~/.claude, a 0.7.x-style dangling link repaired, a linked
  ~/.continue copy.
Conflicts, both sides kept: foundation/env/package-manager.mjs and its test, api/upgrade/upgrade.doc.mjs, clients/cli/commands/upgrade.doc.mjs; README.md regenerated on the merged tree.
…ade prints; name it among the runner examples

---
 packages/cli/foundation/discovery/runner-allowlist.mjs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/packages/cli/foundation/discovery/runner-allowlist.mjs b/packages/cli/foundation/discovery/runner-allowlist.mjs
index 07bcca9..be76828 100644
--- a/packages/cli/foundation/discovery/runner-allowlist.mjs
+++ b/packages/cli/foundation/discovery/runner-allowlist.mjs
@@ -47,5 +47,7 @@ export const RUNNER_COMMAND_ALLOWLIST = Object.freeze({
       'compares running the CLI with npx to installing it, and is found by searching for that command',
     'packages/cli/assets/docs/tree/install-once.doc.mjs':
       'names a pinned release, `npx @astryxdesign/cli@<version>`, which answers as that version',
+    'packages/cli/clients/cli/commands/upgrade.doc.mjs':
+      'quotes the command upgrade prints when the CLI is older than Core, pinned to the matching release',
   }),
 });
-- 
2.53.0-Meta

@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: spec:AST-081 and its architecture:cli-surface amendments are now on main and cover what this pull request does, so the earlier spec question is settled, but three things still need work.

  • Split the computer-level agent skill, computer-level integrations, cliCommand and the update notices into their own pull requests; with the hand-off they make 22,773 authored lines.
  • Build doctor's align fix, the project update notice and the setup reminder of a project without its own CLI through the command picker, so a declared cliCommand reaches them (AST-081 FR5).
  • Keep doctor's component-replacement checks on the project's own Core, since AST-081 FR3 forbids reading the carried Core there.

[Automated review]

const root = projectRootOf(facts) ?? cwd;
const add = ADD[detectPackageManager(root)] ?? ADD.npm;
if (semverCompare(cli, core) > 0) {
return `${add} @astryxdesign/core@${cli}, then ${getRunPrefix(root)} astryx upgrade --from ${core} --apply`;

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.

This spells <run prefix> astryx itself, so doctor's align fix ignores a loaded integration's cliCommand; AST-081 FR5 lists doctor fixes among the commands the picker names ("No surface spells a command name of its own"). getCliInvocation(root) gives the same output when no command is declared.

// The CLI is always installed beside Core: a project that installed only
// Core gets it too, as recommended, so its version is pinned with Core's.
const install = `${ADD[pm] ?? ADD.npm} @astryxdesign/core@${newest} ${CLI_PACKAGE}@${newest}`;
const stem = `${getRunPrefix(root)} astryx`;

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.

The project update notice's upgrade command skips the picker too; FR10 asks for astryx upgrade --from <current> --apply "with the command name FR5 picks for that release". Taking a declared cliCommand before the run prefix keeps the notice right for projects whose integration sets one.

Comment thread packages/cli/clients/cli/index.mjs Outdated
if (choice.copy === 'starting' && choice.coreVersion && choice.coreVersion !== choice.version) {
const root = projectRootOf(readReleaseFacts(cwd)) ?? cwd;
console.error(
setupNudge(`${getRunPrefix(root)} astryx`, {before: addCliCommand(root, choice.coreVersion)}).trimEnd(),

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.

This branch of the setup reminder drops a declared cliCommand, while the branch at line 653 keeps it through getCliInvocation; FR5 names "the setup reminder wherever it is printed" among the picker's surfaces.

* @returns {string | null}
*/
export function findCoreDir(startDir = process.cwd()) {
return findProjectCoreDir(startDir) ?? carriedCoreFor(startDir).dir;

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.

findCoreDir falls back to the carried Core here, and the Project seam's componentReplacements() uses it, so doctor (through project.issues()) can judge component replacements against the carried Core in a project with no installed Core; FR3 says doctor "MUST NOT read the carried Core". Loading doctor's project with findProjectCoreDir would keep it on the project's own Core.

Conflicts, both sides kept: discover (main's official list, then the computer-level entries after the source entries), the integration checks, the docs-tree pages, doctor, json-contract and response-types; README.md regenerated on the merged tree.
Recording why a notice did not print waited on the same state-file lock,
so a lock held by another run was never recorded and cost the run a second
2-second wait. Skips now go to notice-skips.json beside the state file,
replaced whole with no lock (diagnosis only; the last writer stays). The
reference lists the file. Test: with the lock held, takeNotice waits once
and records lock-timeout.
file-protection.mjs is reached from every run (the CLI registers every
command by importing its module, and upgrade's imports the protection
resolver), so its static import of ignore loaded the package even for
--version. It now loads when a resolver first reads an ignore file.
Importing file-protection.mjs drops from about 14.5 ms to 3.8 ms;
--version no longer loads ignore.
…er; doctor, swizzle and upgrade never read the carried Core

- The commands printed after an install step (the project update notice,
  doctor's CLI/Core alignment, and the setup nudge in a project with no CLI
  of its own) took `<run-prefix> astryx` directly. They now go through the
  one picker, getCliInvocation(root, {installed: true}): an integration's
  declared cliCommand, then a host's door, then the project's own installed
  CLI (spec AST-081 FR5).
- Project.load takes core: 'project', which reads only the project's
  installed Core, never the Core the answering release carries; Project
  exposes coreDir(), and its component, replacement, and docs-input reads use
  it. doctor, swizzle and upgrade load their project that way (spec AST-081
  FR3): in a project with nothing installed, doctor no longer sees Core's
  components through the carried copy.
- Tests: the notice's upgrade step and doctor's alignment line use a
  declared cliCommand and a host's door; the setup nudge names a declared
  cliCommand after installing the CLI; Project core: 'project' reads only an
  installed Core; doctor in a fresh clone reads no carried Core.
…d pack-check messages

After the main merge:
- pack-check prints its theme rebuild commands through the command-name
  picker in the wrapper and drift messages main added too (main's tests
  updated to expect the formatted command, as the other pack-check messages
  do).
- The global/local table filters discover's available list to entries
  other than the official Astryx list, which discover now always reads, so
  G36, G37, G42 and G43 still pin the computer-level entries alone.
- Main's Core-guide quality checks: global-mode passages that repeated
  another guide word for word are reworded (configuration, themes,
  global-integrations, use-a-theme-in-an-app, and the reference and
  integration authoring docs); the commands and monorepos pages are
  tightened above the density floor; problems links {@link namespace:global}
  instead of writing the command.
- The lazy ignore load is listed among the modules that run code outside
  their static imports.
- Project.load's JSDoc lists cwd once.

@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: spec:AST-081 is now current on main and covers what this pull request does, and the earlier command-picker and doctor project-load findings are fixed, but two spec contradictions and the scope remain.

  • astryx doctor can still read, and first install, the carried Core when it checks local theme freshness in a project with no installed Core (themeBuild falls back to fetchCarriedThemeCoreDir in api/theme/build/build.mjs), which AST-081 FR3 forbids; skip that check, or keep it on the project's own Core, when the project's Core is missing.
  • notice-skips.json adds a per-user file that architecture:cli-surface INV10 does not list; keep the skip record in state.json or drop it.
  • At 22,928 authored lines, with the update notices, the computer-level skill, computer-level integrations and cliCommand each shipping their own Changeset, the hand-off should land first with those four stacked on it.

[Automated review]

Comment thread packages/cli/api/theme/build/build.mjs Outdated
Comment on lines +314 to +316
const dir =
findInstalledPackage(cwd, '@astryxdesign/core') ??
fetchCarriedThemeCoreDir(cwd);

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.

With no installed Core this falls back to the carried Core with fetch: true for every caller, including astryx doctor's local-theme freshness check (api/doctor/theme-checks.mjs:820). So doctor, run through a global copy or npx @astryxdesign/cli in a fresh clone, can install the starting copy's release into the per-user cache and judge the project's themes against it, which AST-081 FR3 forbids: “doctor, swizzle, and upgrade judge or change a project and MUST NOT read the carried Core.” Reporting that check as info when the project's Core is missing, or passing a project-only option through themeBuild, would keep doctor on the project's own Core.

* @returns {string}
*/
function skipsFile(stateDir) {
return path.join(stateDir, 'notice-skips.json');

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.

notice-skips.json is a third persistent file in the per-user configuration folder, while architecture:cli-surface INV10 lists only “the settings and state files” there (and AST-081 FR7 only the settings and astryx/state.json). Keeping the skip record inside state.json, or dropping it, keeps the per-user writes to the listed files.

Conflicts, both sides kept: api/component/_adapter.mjs (main's imports plus coreDirOrThrow) and api/integration/authoring-checks.mjs (main's link check, findProjectCoreDir kept); README.md regenerated on the merged tree.
…t a timer

G22's first run starts two background steps, the registry check and the
computer-level agent text, and each records its result under the state
file's lock. The test polled 30 s for latest only, so under load it could
give up before the check finished, or run the project command while the
agent-text step held the lock, which skips the notice. It now waits, up to
the test's limit, for the check's latest with its lock released and the
agent text written for the release. Under 6x CPU oversubscription the old
test failed and the new one passed.
A host's door (runWithCliDoor) holds only inside the call that set it, and
update notices print from the process's exit handler, outside it, so the
notice's upgrade step fell back to the package manager's runner. startRun
keeps the door the run started under and sets it again around the notices.
Test: a host running the CLI inside its door in a Core-only project gets
"then host astryx upgrade --from ..." in the notice.
…d Core

themeBuild fell back to the Core the answering copy carries, fetching it
when needed, for every caller, doctor's freshness check included. AST-081
FR3: doctor never reads the carried Core.
- themeBuild takes ctx.projectCore: only the project's installed Core.
  With none installed it fails with ERR_CORE_NOT_FOUND; it never fetches
  the carried Core, nor uses a global or cached copy's own Core.
- doctor's theme-local-builds check is info, with no build, when the
  project's Core is not installed, and builds with projectCore otherwise.
- Tests: the check in a project with no installed Core, and through a CLI
  installed for the computer in a fresh clone, where nothing is fetched.
cli-surface INV10 and AST-081 FR7 allow two per-user files, settings and
state.json, so the separate notice-skips.json goes. A skip is recorded in
state.json's noticeSkips (diagnostic only, not a contract) inside the lock
that made the notice decision, or under the lock when nothing newer is
known. A lock held past the wait, or a state file that cannot be written,
records nothing; doctor still names a held lock's owner from the lock
itself. The reference says state.json holds this diagnosis.
Tests: a notice the lock kept from printing records nothing and writes no
other file; doctor's skip note.
… npm

G22 failed on devservers: envOf kept http_proxy/https_proxy/all_proxy, so
the background check's npm request for the 127.0.0.1 test registry went to
the proxy; and the runs' search path held only a node link, so where npm is
not beside Node the check could not start it. envOf now drops the proxy
variables, and the private computer's node folder links the runner's npm
entry file too. With the proxies set, the old test fails and this one
passes.
…s why it failed

- npmCommand also takes an npm beside the running Node, or on the search
  path, that links to npm's entry file, as distribution packages install it
  (/usr/bin/npm to /usr/lib/node_modules_22/npm/bin/npm-cli.js).
- resolveLatestRelease names why it returned nothing: npm-missing,
  npm-failed: <npm's error code>, or bad-reply. The check records it in
  state.json's checkFailed (diagnosis only, not a contract), and a check
  that reaches the registry clears it.
- doctor's newest-release check says when the last check did not reach the
  registry and why, noting that npm's registry and proxy settings decide
  where it asks.
Tests: npm found through a link on the search path and beside Node, and
npm started directly when there is none; each failure reason; the record
and its clearing.

@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: spec:AST-081 is current on main and covers what this pull request does, and the doctor theme-freshness and notice-skip findings from the last review are fixed, but two new defects and the scope remain.

  • packages/cli/foundation/xle/validate.mjs now imports the Node-only command picker, which breaks the @astryxdesign/cli/xle browser export: the sandbox's Layout DSL page throws TypeError: k.AsyncLocalStorage is not a constructor when it loads, so keep the validator free of Node imports and prefix the suggestion where the CLI prints it.
  • In a fresh clone (AST-081 row G5), astryx doctor skips the warning FR2 requires and reports the starting copy's version as the project's release, so its upgrade --from differs from the daily notice's; read the project's Core the way the hint and the notice do.
  • At 23,154 authored lines, the update notices, the computer-level skill and computer-level integrations can each land as a follow-up on the hand-off.

[Automated review]

@@ -18,6 +18,7 @@
import {levenshteinDistance} from '../text/levenshtein.mjs';
import {KEY_ALIASES} from './parse.mjs';
import {resolveComponent} from './registry-core.mjs';
import {formatCliCommand} from '../env/package-manager.mjs';

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.

This import pulls the Node-only command picker (cli-command.mjs, run-context.mjs, fs/paths.mjs, release/cache.mjs) into foundation/xle/browser.mjs, the @astryxdesign/cli/xle export that promises it "never pulls in node:fs, so it bundles cleanly for the web". In the sandbox build for this head, the Layout DSL page's chunk runs new k.AsyncLocalStorage on an empty stand-in module at its top level, so the page throws as it loads. Returning the bare astryx template --list --type block and prefixing it where the CLI prints text keeps this module browser-safe; a test that walks browser.mjs's imports for node: would keep it so.

Comment thread packages/cli/api/doctor/_adapter.mjs Outdated
? projectLag({
cwd,
current:
answered.copy === 'starting' && answered.core

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.

In a project with no installed Core (AST-081 row G5), answered.core is the carried Core's version or null, so current becomes the starting copy's version rather than the Core the lockfile records, which the daily notice uses (foundation/release/notices.mjs:556-562). Doctor then prints a different upgrade --from than the notice, against FR10 ("in a project, the project's release beside the newest with the same commands"). coreVersionOf(readReleaseFacts(cwd)) gives the same version the hint and the notice name.

…esh clone names the project's Core

- foundation/xle/validate.mjs imported the command-name picker, which
  pulled node:fs, AsyncLocalStorage and the release modules into
  @astryxdesign/cli/xle, the browser export: the sandbox's Layout DSL page
  failed at load. The validator returns the bare
  `astryx template --list --type block` again, as on main; no CLI command
  prints xle errors as text, so there is nothing to prefix. A test walks
  browser.mjs's import graph and fails on any Node built-in or
  AsyncLocalStorage.
- doctor, in a project with no CLI of its own and no Core installed (G5),
  compared the CLI to nothing and skipped FR2's warning, and named the
  answering CLI's version in its upgrade step. It now uses the Core the
  project installs, locks or declares, as the daily hint and notice do: the
  version-alignment check warns with the lockfile's Core, and the
  newest-release check's upgrade --from matches the notice. Test: a fresh
  clone through a global copy.
astracat-bot[bot]
astracat-bot Bot previously requested changes Oct 21, 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: spec:AST-081 is current on main and covers what this pull request does, and the @astryxdesign/cli/xle browser export and fresh-clone astryx doctor findings are fixed on this revision. What remains is scope: at 23,255 authored lines, the update notices, the computer-level skill and computer-level integrations each build on the hand-off without the hand-off needing them, so they can land as follow-ups once the hand-off is in. The description's section on why they stay in this pull request shows what breaks if they land before the hand-off, not after it.

[Automated review]

@josephfarina

Copy link
Copy Markdown
Contributor Author

Maintainer decision: this pull request lands as one piece of work, global mode (spec:AST-081). The review's remaining request is a size-based split; in this repository a split is a reviewer suggestion, not a requirement, and there are no size-based splits. Every other review item is resolved on b37c606.

This branch was successfully deployed

1 active deployment
Preview — b37c6063 Deployed Oct 21, 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