Skip to content

fix(cli): report an unknown install target as an argument error - #3604

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/dx-20260811-r2-11
Aug 12, 2026
Merged

kojiwakayama merged 1 commit into
mainfrom
fix/dx-20260811-r2-11

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Scope after rebase

This branch originally carried two things: the positional tool id for
veryfront install <tool>, and the exit code for an unknown tool id. The
positional fix landed on main independently as #3609, so only the exit-code
correction remains here.
The branch has been rebased onto main and the diff
is now four files in cli/commands/install/.

Symptom

$ veryfront install not-a-tool
  ✗ [unknown-error] Unknown/unclassified error
EXIT=1

A typo in the tool id exited 1, the code AGENTS.md reserves for a runtime or
command error. A caller — a script, CI, or a person reading the exit status —
could not tell a malformed argument from an installation that genuinely failed
partway through.

Root cause

parseInstallArgs accepted target as an arbitrary string. The value was only
checked later, inside installCommand, where parseTargetFlag throws an
ordinary runtime error. By then the CLI is past argument parsing, so the
router's usage path — the one that produces exit 2 — is no longer in play.

Fix

cli/commands/install/handler.ts — validate target while parsing arguments,
via a refine on the schema. The failure now goes through parseArgsOrThrow
and the router's Invalid ... usage path, and the message names the valid
targets:

$ veryfront install not-a-tool --force --no-input
  Detail: Invalid install arguments: unknown tool. Valid targets: cursor, claude-code, skill, copilot, windsurf, agents, all
EXIT=2

--target not-a-tool takes the same path and also exits 2. uninstall shares
the parser, so it is covered too.

cli/commands/install/install.ts — export isValidTargetSpec and
VALID_TARGET_VALUES so the check and the message both come from the single
tool registry rather than a second hand-maintained list. parseTargetFlag
keeps its own check as a guard for programmatic callers.

AGENTS.md contract

Exit code Meaning
1 Runtime or command error
2 Usage or argument error

Tests

  • install.integration.test.ts — the end-to-end case fix(cli): accept a bare tool name for veryfront install #3609 added for an
    unknown positional asserted exit 1; it now asserts exit 2 and that the output
    names the valid targets. A sibling case covers --target. Both still assert
    that no integration file is written.
  • handler.test.ts — two parser-level cases: an unknown positional and an
    unknown --target both fail argument validation.

Changing the existing assertion from 1 to 2 is the behaviour change this PR
owns, so that test is red on main by construction.

Review

Raised by codex as a P2 on the original branch. The finding was correct and is
fixed rather than argued with.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@kojiwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3a924d61-4398-4cb7-b4ea-3feb3ca905ac

📥 Commits

Reviewing files that changed from the base of the PR and between 263321a and 26ead02.

📒 Files selected for processing (4)
  • cli/commands/install/handler.test.ts
  • cli/commands/install/handler.ts
  • cli/commands/install/install.integration.test.ts
  • cli/commands/install/install.ts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7190ab56ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cli/commands/install/handler.ts
`veryfront install not-a-tool` exited 1. The target was only checked inside
`installCommand`, where `parseTargetFlag` throws a plain runtime error, so a
typo was indistinguishable from an installation failure. AGENTS.md reserves
exit 1 for runtime errors and exit 2 for usage and argument errors.

Validate the target while parsing arguments instead, so the failure goes
through `parseArgsOrThrow` and the router's "Invalid ..." usage path and the
message names the valid targets. `--target not-a-tool` takes the same path and
also exits 2 now. `parseTargetFlag` keeps its own check for programmatic
callers.

The positional-target fix this branch originally carried landed on main in
#3609, so only the exit-code correction remains here. The end-to-end case
#3609 added for an unknown positional asserted exit 1 and is updated to 2.
@kojiwakayama
kojiwakayama force-pushed the fix/dx-20260811-r2-11 branch from 9e731b3 to 26ead02 Compare August 12, 2026 04:02
@kojiwakayama kojiwakayama changed the title fix(cli): accept the documented positional tool id for install/uninstall fix(cli): report an unknown install target as an argument error Aug 12, 2026
@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit 0ee21e6 Aug 12, 2026
81 of 87 checks passed
@kojiwakayama
kojiwakayama deleted the fix/dx-20260811-r2-11 branch August 12, 2026 04:37
@kwakayama kwakayama added needs-human-input Maintainer action required and removed needs-human-input Maintainer action required labels Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants