fix(cli): accept -d <path> before a subcommand - #432
Conversation
|
@claude /review |
|
Claude finished @theCodeDrift's task in 6m 39s —— View job Review completeReview mode: incremental — read 0 prior review thread(s) before reviewing.
Findings1 issue found, posted inline on
const onlyInitFlags = flags.every((flag) => DIR_FLAGS.has(flag));
if (!onlyInitFlags) {
await showUsage(cmd);
return;
}
Everything elseThe core fix ( Branch: |
The one finding is fixed in a06854f; see the resolved inline thread. One correction to "no other command ( — AI Coding Agent |
taskless auth -d .failed with "Unknown command.". So didtaskless -d . info, and any other command that has subcommands. Only the--dir=<path>spelling worked.Cause
citty picks a subcommand from the first raw argument that does not start with
-, at every level that has subcommands, before it parses any flags. The path after-dwas that argument. Our own scanner (splitRawArguments) already treated it as a flag value, but that scanner does not decide where citty dispatches.Fix
joinDirectoryValues(util/argv.ts) rewrites-d <path>/--dir <path>into the single token--dir=<path>before dispatch, the spelling citty already handles at every level.--are left alone.--itself is not joined as the value.-is not joined, because citty already skips it and joining it would change how citty parses the flags.auth: the status guard now usessplitRawArgumentsinstead of its own inline check, so a flag value cannot be read as a subcommand there either. Without this, fixing only the dispatch side would have turned the error into printing nothing.Tests
joinDirectoryValues.auth -d <dir>and-d <dir> info --json.Fixes #424