Skip to content

fix(vis): answer --help of the package-manager commands from the manifest - #253

Merged
prisis merged 6 commits into
nextfrom
fix/native-help-route-parity
Nov 25, 2026
Merged

prisis merged 6 commits into
nextfrom
fix/native-help-route-parity

Conversation

@prisis

@prisis prisis commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

What

vis exec|pm|remove|dedupe|link|unlink|outdated|why --help (and -h) did not print vis's help. The native route table gave the package-manager rows Help::Entry, so the entry saw the flag as one of its own arguments and passed it to the package manager. The Node CLI prints vis's own help for the command and exits 0.

Reproduced with the native binary against dist/bin.js in a project with a pnpm-lock.yaml:

command native before Node (reference)
exec the manager's exec help, exit 0 vis help, exit 0
pm the manager's help (12 KB), exit 0 vis help, exit 0
remove, unlink, outdated, why pnpm <cmd> --help text, exit 0 vis help, exit 0
dedupe ran pnpm dedupe ("Already up to date"), exit 0 vis help, exit 0
link ran pnpm link with no arguments, ERR_PNPM_LINK_BAD_PARAMS, exit 1 vis help, exit 0

So the guard was unintended, and for dedupe and link it ran the package manager on a help request.

Fix

The Node CLI is the reference, and the binary renders the identical help from its manifest, so these eight rows now use Help::Manifest. A help request before a -- falls to the surface: byte-identical to Node at 80/120 columns, with and without colour, and no package manager is started. After a -- the flag is still the tool's (vis exec -- --help runs the tool, same output in both engines). x keeps Help::Entry: Node takes --help after x for a file name; its only stderr difference from Node is a stack-trace path.

bin/route.mjs needed no routing change (the launcher already sends all eight to the binary); it gains a comment. The shared routing fixture gets cases for all eight with --help / -h, a tool argument before the flag, exec -- --help, x --help and two win32 cases.

Tests (written first, red before the fix)

  • Rust route tests: package_manager_commands_leave_help_to_the_manifest, x_keeps_its_help_flag, and the regenerated native-routes.snap (56 changed lines, 2 new).
  • cli.rs: package_manager_commands_answer_help_without_running_the_manager replaces the old test that asserted the old behaviour; stub managers leave a marker and the test fails if one runs.
  • __tests__/native/package-manager-help-parity.test.ts: native vs Node stdout, stderr and exit status for the eight commands, 133 cases.
  • golden.rs: TOOL_FLAG_COMMANDS shrinks to x.

Found, not changed

  • With an invalid argument next to a help flag (vis dedupe tool --help, vis dedupe --json -h) Node errors with "unknown argument" (exit 1) while the binary prints help. vis clean tool --help and vis list tool --help diverge the same way, so this is the existing help-surface behaviour, not part of this change.
  • vis why -- --help prints nothing natively where Node runs the manager's help. This was already the case and is outside this change.

Base branch

next does not compile at its tip (crate::sort_package_json::json is private after the module split); the first commit is the same two-line import fix as #252, so it merges cleanly with it and can be dropped once #252 lands.

Verification: cargo fmt --check, cargo clippy --all-targets (no warnings), cargo test -p vis-cli (all pass), vitest run __tests__/native (all pass; hook-list-parity and run-all-hit-parity timed out once under full-suite load and pass on their own).

🤖 Generated with Claude Code

prisis and others added 3 commits November 25, 2026 12:04
…ty list

`sort_package_json` now imports `json` privately, so the two other users
of the codec no longer compile. Import it from `crate::json`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…fest

`vis exec|pm|remove|dedupe|link|unlink|outdated|why --help` (and `-h`) went to
the command's own entry, which handed the flag to the package manager. The Node
CLI prints vis's help for the command and exits 0, so the two disagreed:

- `why`, `remove`, `unlink`, `outdated`, `pm`, `exec` printed the manager's help;
- `dedupe --help` ran `<pm> dedupe`, which can rewrite the lockfile;
- `link --help` ran `<pm> link` with no arguments and exited 1.

These rows now leave a help request before a `--` to the manifest, like every
other command, so the binary prints the same help as Node and never starts a
package manager. After a `--` the flag stays the tool's. `x` keeps its entry:
Node takes `--help` after `x` for a file name.

The route snapshot, the shared routing fixture, the binary's integration test and
a native-versus-Node parity test pin the new routes; the launcher already sent
all of these to the binary, so `bin/route.mjs` only gains a comment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eading flag

Run the native-versus-Node help comparison at 80 and 120 columns with and
without colour, add `-v <command> -h`, and cover the flag after `--`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo did not review this PR because this workspace reached its daily trial limit of 100 reviews. Reviews start again at 00:00 UTC. Choose a plan to continue now.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b57c6497-11d0-4344-b2dc-cd5c33408d45

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions github-actions Bot added package: vis vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list. size:M Size of the change, tests and generated files excluded. labels Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@prisis
prisis deployed to benchmarks November 25, 2026 11:53 — with GitHub Actions Active
CI sets FORCE_COLOR, so the help heading arrives with colour sequences
between `vis` and the command name and the plain-text assertion failed on
Linux only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@codspeed

codspeed Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

🆕 3 new benchmarks
⏩ 113 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 transform/transform_ts[470] N/A 355.3 µs N/A
🆕 transform/transform_ts[47000] N/A 16 ms N/A
🆕 transform/transform_ts[9400] N/A 3.3 ms N/A

Comparing fix/native-help-route-parity (5e6de0a) with next (1078fa9)2

Open in CodSpeed

Footnotes

  1. 113 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on next (b2ddc1c) during the generation of this report, so 65c051d was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@prisis
prisis deployed to benchmarks November 25, 2026 11:58 — with GitHub Actions Active
@prisis
prisis merged commit b99a286 into next Nov 25, 2026
33 checks passed

This branch was successfully deployed

1 active deployment
benchmarks — 5e6de0a7 Deployed Nov 25, 2026 by prisis via Bench native (vis) #427
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vis size:M Size of the change, tests and generated files excluded. vouch:trusted PR author is a collaborator, a bot or on the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant