Skip to content

jrag: reject --count + --exists together (argparse mutex) #429

Description

@HumanBean17

Surfaced by the 4-reviewer fan-out on PR #422 (issue #376). Deferred as a Minor — current behavior is correct and documented.

Current behavior

--count and --exists are both accepted together (both live on _common_parser). --exists wins via the documented precedence chain in render() (exists > count > fields > detail) and _emit's exit-code check:

$ jrag find Foo --count --exists
true          # --exists output; exit 0/2 on hit/miss

No warning, no error — a user who passes both almost certainly meant only one.

Proposal

Make them mutually exclusive at parse time:

shape = common.add_mutually_exclusive_group()
shape.add_argument("--count", action="store_true", ...)
shape.add_argument("--exists", action="store_true", ...)

Related

--fields is also a no-op when combined with --count/--exists (it shapes node projection, which those bypass). As of #422 that's documented in --help and the skill/agent docs, but not enforced. A mutex can't cover --fields (it's a different axis — a normal-projection override), so it stays a documented no-op.

Priority

Low — defer unless a user actually trips over it. Filing so it's tracked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions