From 2150a85b2f96bb373a1b302aaf653d29905498ec Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Tue, 30 Jun 2026 00:28:28 +0200 Subject: [PATCH] fix(cli): make `clide draw` reachable as an umbrella command (T-318) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- lib/src/cli/argv_to_request.dart | 2 +- test/cli/argv_to_request_test.dart | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/cli/argv_to_request.dart b/lib/src/cli/argv_to_request.dart index 28a54f93..72d5449b 100644 --- a/lib/src/cli/argv_to_request.dart +++ b/lib/src/cli/argv_to_request.dart @@ -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 _umbrellaCommands = {'status', 'tail', 'events', 'version', 'ping', 'capabilities', 'instance'}; +const Set _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. diff --git a/test/cli/argv_to_request_test.dart b/test/cli/argv_to_request_test.dart index d151ea2c..e653706b 100644 --- a/test/cli/argv_to_request_test.dart +++ b/test/cli/argv_to_request_test.dart @@ -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', () {