fix(cli): make clide draw reachable as an umbrella command (T-318)
draw is single-token (no verb), so `clide draw --file x` mis-parsed as cmd "draw.--file" — the dispatcher registered draw but the argv parser never learned it was umbrella (unlike icon/image which use subsystem.verb). Found driving the live install; the handler unit tests bypassed the argv path so they missed it. Added draw to _umbrellaCommands + a parse regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,7 +27,7 @@ import 'package:clide/src/ipc/schema_v1.dart';
|
||||
/// split. Match the IDs the dispatcher exposes directly. `tail` and
|
||||
/// `events` are handled by the IPC server itself (streaming / cursor-pull
|
||||
/// event reads, T-129 / T-223) rather than the dispatcher.
|
||||
const Set<String> _umbrellaCommands = {'status', 'tail', 'events', 'version', 'ping', 'capabilities', 'instance'};
|
||||
const Set<String> _umbrellaCommands = {'status', 'tail', 'events', 'version', 'ping', 'capabilities', 'instance', 'draw'};
|
||||
|
||||
/// Sealed result of translating argv. Caller (the IPC server, or the
|
||||
/// C client wrapper in T-126) handles either branch.
|
||||
|
||||
@@ -101,6 +101,14 @@ void main() {
|
||||
expect((req.args['flags'] as Map)['since'], '5');
|
||||
expect((req.args['flags'] as Map)['filter'], 'pane');
|
||||
});
|
||||
|
||||
test('"draw --file card.json" reaches the draw command (T-318)', () {
|
||||
// draw is single-token (no verb) — it must be an umbrella command, else
|
||||
// `clide draw --file x` mis-parses as cmd "draw.--file".
|
||||
final req = _expectOk(parseArgv(['draw', '--file', 'card.json'], requestId: 'd'));
|
||||
expect(req.cmd, 'draw');
|
||||
expect((req.args['flags'] as Map)['file'], 'card.json');
|
||||
});
|
||||
});
|
||||
|
||||
group('parseArgv — errors', () {
|
||||
|
||||
Reference in New Issue
Block a user