resolveQueryArgv only expanded `init.execute-phase` → `init execute-phase` when the tokens array had length 1. Argv like `init.execute-phase 1` has length 2, skipped the expansion, and resolved to no registered handler. All 50+ workflow files use the dotted form with arguments, so this broke every non-argless query route (`init.execute-phase`, `state.update`, `phase.add`, `milestone.complete`, etc.) at runtime. Rename `expandSingleDottedToken` → `expandFirstDottedToken`: split only the first token on its dots (guarding against `--` flags) and preserve the tail as positional args. Identity comparison at the call site still detects "no expansion" since we return the input array unchanged. Adds regression tests for the three failure patterns reported: `init.execute-phase 1`, `state.update status X`, `phase.add desc`. Closes #2597
This commit is contained in:
@@ -178,4 +178,31 @@ describe('resolveQueryArgv', () => {
|
||||
args: [],
|
||||
});
|
||||
});
|
||||
|
||||
// Regression: #2597 — dotted command token followed by positional args.
|
||||
// Before the fix, argv like ['init.execute-phase', '1'] returned null because
|
||||
// expansion only ran for single-token input.
|
||||
it('matches a dotted command token when positional args follow (#2597)', () => {
|
||||
const registry = createRegistry();
|
||||
expect(resolveQueryArgv(['init.execute-phase', '1'], registry)).toEqual({
|
||||
cmd: 'init.execute-phase',
|
||||
args: ['1'],
|
||||
});
|
||||
});
|
||||
|
||||
it('matches dotted state.update with trailing args (#2597)', () => {
|
||||
const registry = createRegistry();
|
||||
expect(resolveQueryArgv(['state.update', 'status', 'X'], registry)).toEqual({
|
||||
cmd: 'state.update',
|
||||
args: ['status', 'X'],
|
||||
});
|
||||
});
|
||||
|
||||
it('matches dotted phase.add with trailing args (#2597)', () => {
|
||||
const registry = createRegistry();
|
||||
expect(resolveQueryArgv(['phase.add', 'desc'], registry)).toEqual({
|
||||
cmd: 'phase.add',
|
||||
args: ['desc'],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user