feat(spec): select a subcommand from argv0 when multicall - #1028
Conversation
clap's busybox-style applets: `multicall #true` treats argv[0]'s basename as the first word unless it is the dispatcher (`name` or `bin`). usage-lib sees argv0 and rewrites after pop_front. usage-argv, the derive `parse()`, and Go take argv without the program name, so they rewrite at process entry (`parse_from` / `Parse` stay unchanged). Path components and a trailing `.exe` are stripped. Corpus `12-multicall.json` carries optional `argv0`. clap's `is_multicall_set` reaches the spec. Co-authored-by: jeff <jeff@jdx.dev>
|
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 ⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
The iterator helper needed an explicit lifetime, and the round-trip fixture had a subcommand without metadata. Use the same name-then-bin checks usage-argv does, and emit `multicall` from an empty root. Co-authored-by: jeff <jeff@jdx.dev>
Instruction countsNothing was compared, and so nothing was gated. No series appears on both sides: either the base has no measurements recorded, or the two were measured on different runner classes, which are deliberately not comparable — counts shift between machine types by more than a real regression does. New, nothing to compare against: Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes. Shadow comparisonParsing
|
<!-- CURSOR_AGENT_PR_BODY_BEGIN --> `external_subcommand` (#1021) and `default_if` (#1023) are in the parser, the derive, and the corpus. PLAN.md still listed them as open clap gaps. This ticks those items, drops them from the fleet table, and splits `multicall` from `no_binary_name` so the next PR can close one without pretending the other landed. `no_binary_name` stays out of scope until a fleet CLI needs it. Also stops quoting a corpus vector count in PLAN.md and `go/README.md`, matching the argv grammar page (#1024): agreement is measured on each run rather than asserted as "154". Stacked next: #1028 (`multicall`). _This comment was generated by Claude Code._ <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-4de7e59e-aa2e-4ad0-a1d0-1c2e69c166db?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-4de7e59e-aa2e-4ad0-a1d0-1c2e69c166db&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added BusyBox-style multicall support, selecting subcommands from the executable name. * Added support for paths, Windows `.exe` suffixes, dispatcher names, symlink-style invocations, and external subcommands. * Added aliases, hidden choices, and optional case-insensitive value matching. * Added multicall configuration across supported integrations and generated specifications. * **Bug Fixes** * Added validation for invalid multicall configurations and clearer unknown-applet behavior. * **Documentation** * Documented multicall behavior, value choices, supported invocation patterns, and conformance status. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Stacked on #1027. Adds clap's
Command::multicallas spec-levelmulticall #true.Semantics
argv[0]'s basename is a word unless it is the dispatcher (
nameorbin). A symlinkls -> busyboxis parsed as if the first token werels.busybox lsstill selectsls: the dispatcher name is skipped. Path components and a trailing.exeare stripped so/usr/bin/lsandls.exeagree.An unknown applet is an unmatched word: it errors, is forwarded when the root declares
external_subcommand, or is caught bydefault_subcommand. Invoking the dispatcher with no further words stays at the root.Where argv0 is rewritten
parseincludes the program name. Afterpop_front, a non-dispatcher basename is pushed back.parse_from/ GoParsetake argv without the program name.parse()and the corpus adapters rewrite at process entry;parse_fromstays unchanged because the caller already decided the words.multicall_basename/multicall_appletin usage-lib and usage-argv; GoRewriteMulticall.Surfaces
is_multicall_set#[usage(multicall)]on the root (refused below it, and without subcommands)multicall,argv.RewriteMulticall12-multicall.json(argv0onVector; absent means the spec'sbin)usage lintreportsmulticall-no-subcommandsmulticallfor both usage and clap dialectsno_binary_namestays out of scope.This comment was generated by Claude Code.