Repository navigation
fix(vis): answer --help of the package-manager commands from the manifest - #253
Conversation
…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 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. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
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>
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>
Merging this PR will not alter performance
Performance Changes
Comparing Footnotes
|
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 rowsHelp::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.jsin a project with apnpm-lock.yaml:execexechelp, exit 0pmremove,unlink,outdated,whypnpm <cmd> --helptext, exit 0dedupepnpm dedupe("Already up to date"), exit 0linkpnpm linkwith no arguments,ERR_PNPM_LINK_BAD_PARAMS, exit 1So the guard was unintended, and for
dedupeandlinkit 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 -- --helpruns the tool, same output in both engines).xkeepsHelp::Entry: Node takes--helpafterxfor a file name; its only stderr difference from Node is a stack-trace path.bin/route.mjsneeded 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 --helpand two win32 cases.Tests (written first, red before the fix)
package_manager_commands_leave_help_to_the_manifest,x_keeps_its_help_flag, and the regeneratednative-routes.snap(56 changed lines, 2 new).cli.rs:package_manager_commands_answer_help_without_running_the_managerreplaces 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_COMMANDSshrinks tox.Found, not changed
vis dedupe tool --help,vis dedupe --json -h) Node errors with "unknown argument" (exit 1) while the binary prints help.vis clean tool --helpandvis list tool --helpdiverge the same way, so this is the existing help-surface behaviour, not part of this change.vis why -- --helpprints nothing natively where Node runs the manager's help. This was already the case and is outside this change.Base branch
nextdoes not compile at its tip (crate::sort_package_json::jsonis 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-parityandrun-all-hit-paritytimed out once under full-suite load and pass on their own).🤖 Generated with Claude Code