Repository navigation
Pass --ref and --skill-max-depth through to scan/install subcommands - #64
Merged
Merged
Conversation
Both options are registered on the root program and on the scan/install subcommands. With Commander's default parsing the root consumed them even when they followed the subcommand name, so `install <url> --ref <sha>` silently cloned the default branch HEAD and recorded no requestedRef. Enable positional options so options after a subcommand name reach the subcommand, and reject root-level --ref/--skill-max-depth placed before a subcommand instead of dropping them. Regression tests drive the CLI against a local Git repository mapped to an HTTPS URL via url.insteadOf. Fixes #63 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review feedback on the misplaced-option guard: derive the guarded set from the root's own CLI-sourced options so --list-length is covered too, and only suggest moving a flag after the subcommand when that subcommand actually accepts it. Refs #63 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #63.
install <https-url> --ref <sha>andscan --ref <sha>silently ignored--refand used the remote's default branch HEAD.The cause:
--refand--skill-max-depthare registered on the root program and on thescan/installsubcommands. With Commander's default parsing, the root program took these options even when they came after the subcommand name.Changes
program.enablePositionalOptions()so options after a subcommand name reach the subcommand. This also fixes--skill-max-depthonscan/installand--list-lengthonlist, which had the same bug.agent-installer --ref X install ...) now fails with an error instead of being silently ignored. The error suggests moving the flag after the subcommand name only when that subcommand accepts it. Interactive mode (agent-installer <url> --ref X) is unchanged.Tests
The regression tests in
tests/cli-json.test.tsrun the real CLI against a local two-commit Git repository.url.insteadOfmaps that repository to an HTTPS URL, so the tests go through the real clone/fetch path without network access. They check that:install --refrecordsrequestedRef, setsresolvedCommitto the requested commit, and installs that commit's contentscan --refreports the same provenancescan --refon a local source is rejected--skill-max-depthafterscanis applied--list-length, and the error never suggests a flag the subcommand does not acceptVerified locally:
pnpm typecheck,pnpm test(190 passed),pnpm build,pnpm test:package.🤖 Generated with Claude Code