Skip to content

feat(parse): add argument subcommand conflicts - #1104

Merged
jdx merged 1 commit into
agent/remaining-command-policyfrom
agent/args-conflict-subcommands
Aug 20, 2026
Merged

feat(parse): add argument subcommand conflicts#1104
jdx merged 1 commit into
agent/remaining-command-policyfrom
agent/args-conflict-subcommands

Conversation

@jdx

@jdx jdx commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • add args_conflicts_with_subcommands across KDL, typed Rust, usage-lib, the clap bridge, generated Go, and Go runtime lowering
  • reject selecting a child after its parent has bound a flag or positional while leaving child-owned arguments unchanged
  • document the policy and remove its obsolete clap fidelity warning

Verification

  • cargo test --all --all-features
  • cargo clippy --all --all-features -- -D warnings
  • go test ./... (from go/)

AI-generated pull request.


Note

Medium Risk
Core argv routing changes in Rust and Go parsers, but the behavior is opt-in per command and covered by cross-layer tests; wrong enforcement would mainly affect CLIs that enable the flag.

Overview
Implements args_conflicts_with_subcommands, matching clap: when enabled on a command, binding any parent flag or positional makes a later child subcommand name an error; subcommands alone still work.

The change threads a new command flag through KDL/spec, usage-lib (including default-subcommand routing), usage-argv and Go parsers (command_arg_found / CodeSubcommandConflict), derive (#[command(args_conflicts_with_subcommands)]), generated Go, clap bridge, and styled diagnostics. clap_usage no longer reports this setting as a fidelity loss.

PLAN.md and migration/compatibility docs mark the policy as portable; tests cover Rust argv, usage-lib, Go, facade derive, and clap bridge preservation.

Reviewed by Cursor Bugbot for commit 7e0931d. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

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

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e49e7e9f-ac30-4217-9790-2c17febd6903

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

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

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

Comment thread argv/src/lib.rs
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from 3c22f71 to 722733c Compare August 20, 2026 04:48

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 722733c. Configure here.

Comment thread lib/src/parse.rs
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from 722733c to 5d5d7dd Compare August 20, 2026 04:53
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from 5d5d7dd to 59edb6f Compare August 20, 2026 04:55
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch 2 times, most recently from 4974d24 to ae910b3 Compare August 20, 2026 05:14
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from ae910b3 to 98680be Compare August 20, 2026 05:37
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Instruction counts

Nothing 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: markdown on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1, startup on bamboo-v2-ubuntu24.04-x64-30vcpu-24gb-rust1.97.1

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 comparison

Parsing mise use -g node@20 against a shadow of mise's committed spec.
Reported, not gated: the shadow grows as the derive learns to express more, so
what to watch is the ratio rather than either column.

framework instructions, cold parse vs usage
usage 4265
argh 6292 1.5x
clap 5893652 1381x
bpaf 21917954 5139x
                                              min       p01       p10    median
usage-rs: argv -> struct                      188       191       193       198  ns
argh: argv -> struct                          280       286       293       303  ns
clap: build tree + parse -> struct         480560    481890    484601    493720  ns
bpaf: build parser + parse -> struct      1620140   1620140   1627450   1655290  ns

usage: argv -> struct                             197 ns      0.20 µs
clap: build tree + parse -> struct             485161 ns    485.16 µs
clap: parse -> struct, tree reused              23428 ns     23.43 µs
clap: build tree only                          300856 ns    300.86 µs

adb30558cc01 vs 1d8566ea1393 · measured on the runner, not pushed to the history.

@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from 98680be to 8479be7 Compare August 20, 2026 05:50
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from 8479be7 to a61a34b Compare August 20, 2026 05:52
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from a61a34b to 52c723e Compare August 20, 2026 05:54
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from 52c723e to cb2b16c Compare August 20, 2026 07:05
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from cb2b16c to adb3055 Compare August 20, 2026 07:17
@jdx
jdx force-pushed the agent/args-conflict-subcommands branch from adb3055 to 7e0931d Compare August 20, 2026 07:53
@jdx
jdx merged commit 6917d1c into main Aug 20, 2026
8 of 11 checks passed
@jdx
jdx deleted the agent/args-conflict-subcommands branch August 20, 2026 10:50
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.

1 participant