Skip to content

fix(cli): upgrade outside a project names the project, not --from - #12448

Closed
josephfarina wants to merge 2 commits into
mainfrom
josephfarina/upgrade-outside-project-names-project
Closed

josephfarina wants to merge 2 commits into
mainfrom
josephfarina/upgrade-outside-project-names-project

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A person or agent runs astryx upgrade in a folder that is outside a project, with no --from. The CLI said --from was missing. An agent that then adds --from gets a second refusal, because the real problem is the folder: there is no app code to upgrade there. One extra failed run, and a misleading hint about what to fix.

Before:

$ astryx upgrade
Upgrade
Missing required --from. This folder is outside a project; upgrade migrates the code of an app project that installs @astryxdesign/core.
Aborted

$ astryx upgrade --json
{
  "apiVersion": 1,
  "error": "Missing required --from. This folder is outside a project; upgrade migrates the code of an app project that installs @astryxdesign/core.",
  "code": "ERR_INVALID_ARGUMENT"
}

After:

$ astryx upgrade
Upgrade
This folder is outside a project, so there is no code to upgrade. Run upgrade with `--from <old version>` in the folder of the app that installs @astryxdesign/core.
Aborted

$ astryx upgrade --json
{
  "apiVersion": 1,
  "error": "This folder is outside a project, so there is no code to upgrade. Run upgrade with `--from <old version>` in the folder of the app that installs @astryxdesign/core.",
  "code": "ERR_INVALID_ARGUMENT"
}

Problem and solution fit

  • Why does it happen? The outside-project branch of the missing---from check kept the in-project lead, "Missing required --from".
  • Why does it harm the task? The first words name the wrong fix, so the reader adds --from and fails again in the same folder.
  • Why does that matter? Agents act on the first sentence of an error. The message must lead with the real reason and say what to do.

The fix rewrites only that message: it leads with the folder being outside a project, then says to run upgrade with --from <old version> in the app's folder.

Expected behavior and authority

  • spec:AST-081 FR4 (current): upgrade is own outside a project, and a released command keeps its refusal code. The code stays ERR_INVALID_ARGUMENT and the JSON shape does not change.
  • AST-081 FR5: no surface spells a command name of its own. The folder of the app is unknown here, so the message names no command and says "run upgrade with --from <old version>".
  • The placeholder <old version> matches the one the agent docs print.

Smallest restoration

One string in packages/cli/api/upgrade/upgrade.mjs. Inside a project, nothing changes: the message, code, and printed command stay the same. No spec, doc page, or API changes.

Evidence

  • Reproduction before the change: in an empty temporary folder, CI=1 node packages/cli/clients/cli/bin/astryx.mjs upgrade and ... upgrade --json print the "Missing required --from" text above.
  • Result after the change: the same commands print the new text above, exit 1, with ERR_INVALID_ARGUMENT.
  • Representative unchanged path: inside a project with an installed Core, upgrade without --from still says "Missing required --from. Install the target version first, then run <command> upgrade --from <old-version>." The existing tests for that path pass unchanged.
  • Regression test: packages/cli/api/upgrade/upgrade.test.mjs asserts the exact outside-project message and code from the API; packages/cli/clients/cli/commands/upgrade.test.mjs asserts the exact --json envelope. Both fail on the old text.

Scope

Components: cli (upgrade)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

CI=1 vitest run --project node packages/cli/api/upgrade/upgrade.test.mjs packages/cli/clients/cli/commands/upgrade.test.mjs packages/cli/foundation/agent-docs/agent-docs.test.mjs
# 3 files, 203 tests passed
prettier --check on the changed files

Outside a project, `astryx upgrade` without `--from` asked for `--from`, and adding it got a second refusal. The message now says the folder is outside a project and to run upgrade with `--from <old version>` in the app's folder. The error code and JSON shape do not change.
@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 17, 2026 10:53pm UTC

Request Review

@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 17, 2026, 11:08 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 17, 2026
@josephfarina
josephfarina marked this pull request as ready for review November 17, 2026 21:44
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · d338487

Storybook · Sandbox · built from this PR's head

Current run: The current CI run concluded cancelled. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

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

Requesting changes: the new error text and its tests are right, but the release note and one description claim misstate the before and after.

  • The changeset says the message "now says that the folder is outside a project" and that before "it asked only for --from", but the old message already said "This folder is outside a project", so reword it to say the message now leads with that reason instead of "Missing required --from" and adds where to run upgrade.
  • The description says <old version> matches the placeholder that the agent docs and help print, but astryx upgrade --help prints --from <version>, so say it matches the agent docs or drop "and help".

The error code, exit status and JSON shape stay the same, and both new tests fail on the old text and pass here. No code change is needed.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Changeset: outside a project, upgrade without --from now says the folder is outside a project. False as a change: the old message already said it (old line 117 of upgrade.mjs).
  • Changeset: it now says to run upgrade with --from <old version> in the app's folder. Verified (upgrade.mjs:117, upgrade.test.mjs:553-560).
  • Changeset: before, it asked only for --from. False: the old message also said the folder is outside a project.
  • Changeset: adding --from got a second refusal. Verified (run/run.mjs:600-605, ERR_VERSION_DETECT).
  • Changeset: a patch [fix] for the CLI. Verified: error prose is outside the CLI's compatibility contract.
  • Description: the before and after text and JSON. Verified by running the CLI in an empty folder on both revisions.
  • Description: the cause is the outside-project branch keeping the in-project lead. Verified (old upgrade.mjs:117).
  • Description: the code stays ERR_INVALID_ARGUMENT and the JSON shape does not change. Verified (upgrade.test.mjs:556, commands/upgrade.test.mjs:142-147).
  • Description: upgrade declares own outside a project. Verified (commands/upgrade.doc.mjs:110).
  • Description: the message names no command because the app's folder is unknown. Verified (upgrade.mjs:117).
  • Description: <old version> matches the agent docs and help. True for the agent docs (agent-docs.mjs:743), false for help (commands/upgrade.doc.mjs:31).
  • Description: one string changes, and inside a project the message, code and printed command stay the same. Verified (upgrade.mjs:118 unchanged).
  • Description: no spec, doc page or API changes. Verified from the file list.
  • Description: the in-project path still says "Missing required --from. Install the target version first…" and its tests pass. Verified (upgrade.test.mjs:541-551, commands/upgrade.test.mjs:131-138).
  • Description: both new tests fail on the old text. Verified: each fails on the old code and passes here.
  • Description: the three test files pass with 203 tests. Verified (23 + 18 + 162).
  • Description: Prettier on the changed files. Verified for the added lines; the warning on commands/upgrade.test.mjs comes from older lines, and the repository's formatting check does not cover .mjs files.
  • File .changeset/upgrade-outside-project-names-project.md: finding (wording, above).
  • File packages/cli/api/upgrade/upgrade.mjs: clear.
  • File packages/cli/api/upgrade/upgrade.test.mjs: clear.
  • File packages/cli/clients/cli/commands/upgrade.test.mjs: clear.

Automated review (maintainer link)

@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 run its build and tests on this head, because it found no room on the runners, so re-run all jobs.

The outside-project upgrade error now leads with the real reason and says where to run upgrade, with the same exit status, error code and JSON shape. Both earlier points are fixed: the changeset now says the message leads with that reason instead of "Missing required --from", and the description no longer says help prints <old version>. Nothing else is needed in the code or text.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Changeset: the message now leads with the reason, that the folder is outside a project. Verified (upgrade.mjs:117; a run in an empty folder).
  • Changeset: it says to run upgrade with --from <old version> in the app's folder. Verified (upgrade.mjs:117, upgrade.test.mjs:557-559).
  • Changeset: before, it led with "Missing required --from". Verified (old upgrade.mjs:117; a run of the old code).
  • Changeset: adding --from in the same folder got a second refusal. Verified (run/run.mjs:599-606; a run with --from).
  • Changeset: a patch fix for the CLI. Verified: error wording is outside the CLI's compatibility contract.
  • Description: the before and after text and JSON. Verified by runs in an empty folder on both revisions.
  • Description: the cause is the outside-project branch keeping the in-project lead. Verified (old upgrade.mjs:117).
  • Description: the fix rewrites only that message. Verified (one changed line in upgrade.mjs).
  • Description: upgrade has its own outside-project behavior, keeps its refusal code, and the JSON shape does not change. Verified (commands/upgrade.doc.mjs:110, upgrade.test.mjs:556, commands/upgrade.test.mjs:142-147).
  • Description: the message names no command because the app's folder is unknown. Verified (upgrade.mjs:117).
  • Description: <old version> matches the agent docs. Verified (foundation/agent-docs/agent-docs.mjs:743).
  • Description: inside a project the message, code and printed command stay the same. Verified (upgrade.mjs:118 unchanged; upgrade.test.mjs:541-551 and commands/upgrade.test.mjs:131-138 pass).
  • Description: no spec, doc page or API changes. Verified from the file list.
  • Description: both new tests fail on the old text. Verified: exactly those two fail with the old code.
  • Description: the three test files pass with 203 tests. Verified (23 + 18 + 162).
  • Description: Prettier on the changed files. Verified for the added lines; the remaining warning in commands/upgrade.test.mjs is on older lines, and the old copy of that file fails the same way.
  • Description: one defect, no tagalong, no hidden API or interaction change, no internal context. Verified.
  • File .changeset/upgrade-outside-project-names-project.md: clear.
  • File packages/cli/api/upgrade/upgrade.mjs: clear.
  • File packages/cli/api/upgrade/upgrade.test.mjs: clear.
  • File packages/cli/clients/cli/commands/upgrade.test.mjs: clear.

Automated review (maintainer link)

josephfarina added a commit that referenced this pull request Nov 19, 2026
- #12252 docs(cli): agent docs name the prop names that differ from other libraries
  Author: Joey Farina <[email protected]>
- #12154 fix(core): a numeric typography weight builds through an extended base's adaptation rules
  Author: Joey <[email protected]>
- #12092 fix(cli): theme build reads the Core it builds with for variant declarations, and names the build command alone
  Author: Joey Farina <[email protected]>
- #12316 fix(core): a shorthand never follows its own longhand in one style merge
  Author: josephfarina <[email protected]>
- #12357 fix(core): a Table stays the scroll region when a host scrolls every table's parent
  Author: Joey Farina <[email protected]>
- #12349 fix(core): end a mouse drag a sandboxed frame never saw released
  Author: josephfarina <[email protected]>
- #12425 fix(cli): use a stored doc parse only with the zod release that made it
  Author: Joey <[email protected]>
- #12396 fix(AppShell): with the standard width points, a server-rendered shell hides its inline side nav on a phone before its script runs
  Author: Joey <[email protected]>
- #12438 fix(charts): end dots draw whole and a thinned axis keeps its last label
  Author: Joey Farina <[email protected]>
- #12448 fix(cli): upgrade outside a project names the project, not --from
  Author: Joey Farina <[email protected]>
- #12459 fix(templates): the dashboard scorecard fits a phone screen
  Author: Joey Farina <[email protected]>
- #12428 fix(core): Field labels draw in a bolder face than their description
  Author: Joey Farina <[email protected]>
- #12435 fix(theme-matcha): dark menus, popovers and muted fills take the theme's deep gray neutral
  Author: Joey <[email protected]>
- #12432 fix(templates): dashboard chart labels show whole instead of clipped by the chart edge
  Author: Joey Farina <[email protected]>
- #12441 fix(cli): mark icon-set generated calls pure so apps drop unused icons
  Author: Joey Farina <[email protected]>
- #12472 fix(MetadataListItem): a value breaks only a word longer than its line
  Author: Joey <[email protected]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Landed in #12718.

@github-actions
github-actions Bot deleted the josephfarina/upgrade-outside-project-names-project branch November 19, 2026 06:05

This branch was successfully deployed

1 active deployment
Preview — d3384876 Deployed Nov 17, 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