fix(cli): wrap fs.Parse with reorderFlagsBeforePositional in 7 commands#25
Merged
nnemirovsky merged 1 commit intomainfrom Apr 11, 2026
Merged
fix(cli): wrap fs.Parse with reorderFlagsBeforePositional in 7 commands#25nnemirovsky merged 1 commit intomainfrom
nnemirovsky merged 1 commit intomainfrom
Conversation
…g commands
Seven CLI subcommands called fs.Parse(args) directly instead of going
through reorderFlagsBeforePositional, so any positional argument before
a flag stopped flag parsing and silently fell through to flag defaults.
For commands that take a --db flag this is a production hazard. Running
sluice binding remove 2 --db /custom/path
stopped at "2", missed --db, and operated on the default
data/sluice.db instead of the requested path. The same shape applies to
cred remove, policy remove, policy import, mcp remove, channel update,
and channel remove.
Wrap each fs.Parse call with reorderFlagsBeforePositional like the other
sibling subcommands already do, and add a regression test per command
that exercises the positional-before-flags ordering.
Also fix the cred dispatcher's usage line to mention the "update"
subcommand that was added in v0.8.0.
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
Seven CLI subcommands called `fs.Parse(args)` directly instead of going through `reorderFlagsBeforePositional`, so any positional argument appearing before a flag stopped flag parsing and silently fell through to flag defaults. For commands that take a `--db` flag this is a production hazard:
```
sluice binding remove 2 --db /custom/path
```
stopped at `2`, never saw `--db`, and operated on the default `data/sluice.db` instead of the requested path. The same shape applies to `cred remove`, `policy remove`, `policy import`, `mcp remove`, `channel update`, and `channel remove`. Each command gets the same one-line wrap that all the other working subcommands already use. A regression test per command exercises the positional-before-flags ordering so this cannot recur silently.
Also fixes a small cosmetic bug from v0.8.0: the `sluice cred` dispatcher's usage line still listed `[add|list|remove]` and never mentioned the `update` subcommand.
Test plan