Skip to content

feat(cli): Process --tool/--no-tool flags left-to-right#513

Merged
JeanMertz merged 2 commits intomainfrom
prr82
Apr 4, 2026
Merged

feat(cli): Process --tool/--no-tool flags left-to-right#513
JeanMertz merged 2 commits intomainfrom
prr82

Conversation

@JeanMertz
Copy link
Copy Markdown
Collaborator

@JeanMertz JeanMertz commented Apr 4, 2026

Previously, --tool and --no-tools values were collected into
separate vecs and applied in a fixed order: disable-all > enable-all >
enable-named > disable-named. The position of flags on the command line had no effect, making interleaved usage like --tool=write --no-tools --tool=read surprising and unexpressive.

This implements RFD-008 by introducing a ToolDirective enum and a ToolDirectives struct that preserves flag order using ArgMatches::indices_of. apply_enable_tools now iterates directives sequentially, enabling precise tool composition:

# Start from nothing, add only what you need
jp q --no-tools --tool=write

# Start from everything, carve out exceptions
jp q --tools --no-tool=dangerous_tool

The former restriction against combining bare --no-tool with bare --tool is removed, since ordered evaluation makes that well-defined.

Previously, `--tool` and `--no-tools` values were collected into
separate vecs and applied in a fixed order: disable-all > enable-all >
enable-named > disable-named. The position of flags on the command line
had no effect, making interleaved usage like `--tool=write --no-tools
--tool=read` surprising and unexpressive.

This implements RFD-008 by introducing a `ToolDirective` enum and a
`ToolDirectives` struct that preserves flag order using
`ArgMatches::indices_of`. `apply_enable_tools` now iterates directives
sequentially, enabling precise tool composition:

    # Start from nothing, add only what you need
    jp q --no-tool --tool=write

    # Start from everything, carve out exceptions
    jp q --tool --no-tool=dangerous_tool

The former restriction against combining bare `--no-tool` with bare
`--tool` is removed, since ordered evaluation makes that well-defined.

BREAKING CHANGE: `--no-tools` renamed to `--no-tool`

The long form `--no-tools` has been renamed to `--no-tool` to match the
singular `--tool` flag. The short form `-T` is unchanged. Update any
scripts or aliases using `--no-tools` to use `--no-tool` instead.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz changed the title feat(cli, rfd): Process --tool/--no-tool flags left-to-right feat(cli): Process --tool/--no-tool flags left-to-right Apr 4, 2026
@JeanMertz JeanMertz merged commit 9b026f4 into main Apr 4, 2026
23 checks passed
@JeanMertz JeanMertz deleted the prr82 branch April 4, 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