feat(draw): wire the drawing card into the conversation — end to end (T-318)

The last wire: a DrawingMessage conversation item + the Claude-extension
subscriber on the `draw` channel (buildSvgDocument → inject), the
conversation renderer (DrawingCard), the fold/summary switches, the i18n
`drawing` label, and registering `clide draw` at boot (empty template
registry for now — primitive SVG works; d2/icon/compare/image handlers
plug in as they land). `clide draw --file doc.json` now renders a card in
the conversation. Render widget-tested; analyze + format clean across the
repo. Templates + per-object overlay remain; the CHANGELOG entry lands
with the user-complete feature.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 22:18:53 +02:00
co-authored by Claude Opus 4.8
parent a5529577f2
commit 7acea8baa0
9 changed files with 110 additions and 1 deletions
+19
View File
@@ -39,6 +39,7 @@ import 'package:clide/builtin/claude/src/account_registry.dart';
import 'package:clide/clide.dart' show clideVersion;
import 'package:clide/src/daemon/claude_account_commands.dart';
import 'package:clide/src/daemon/dispatcher.dart';
import 'package:clide/src/daemon/draw_commands.dart';
import 'package:clide/src/daemon/editor_commands.dart';
import 'package:clide/src/daemon/files_commands.dart';
import 'package:clide/src/daemon/git_commands.dart';
@@ -361,6 +362,24 @@ Future<void> main() async {
return file.existsSync() ? file.absolute.path : null;
},
);
// `clide draw --file <doc>` — drive a drawing card into the Claude
// conversation (T-318, drive-half of D-6). Reads the JSON doc relative to
// workRoot, lowers it to SVG via the template registry (primitive svg now;
// d2/icon/compare/image handlers register as they land), then publishes a
// 'draw' message the Claude extension injects.
registerDrawCommands(
dispatcher,
() => kernelMessages?.publish,
registry: DrawingRegistry(),
readFile: (path) async {
final file = File(path.startsWith('/') ? path : '${workRoot.path}/$path');
try {
return file.existsSync() ? await file.readAsString() : null;
} catch (_) {
return null;
}
},
);
// `clide claude account …` — manage per-repo Claude accounts (T-480, epic
// T-476). Registry reads/writes go through the user-scope SettingsStore;
// side-effects (respawn, login pane, --purge) are published on