feat(icon): icon.show handler + variadic positional schema (T-313)

icon.show resolves Phosphor glyphs by name (injected resolver) or a 0xNNNN
codepoint, reads a --file JSON array of {icon,label,description,color}
entries, validates colors via parseSvgColor (hex or CSS name), and
publishes on the `icon` bus channel. Honest userError on an unknown glyph,
a bad color, or a malformed payload. A trailing stringList positional is
now variadic so `icon show gear folder gauge` collects every token.
Flutter-free, dart-tested. Card widget + wiring next.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-29 13:04:44 +02:00
co-authored by Claude Opus 4.8
parent f0fb5a5134
commit 9a2b4e9eca
6 changed files with 446 additions and 2 deletions
+9 -2
View File
@@ -156,8 +156,15 @@ class CommandSchema {
final out = <String, Object?>{};
final pos = raw['positional'];
if (pos is List) {
for (var i = 0; i < pos.length && i < positional.length; i++) {
out[positional[i]] = pos[i];
for (var i = 0; i < positional.length; i++) {
final name = positional[i];
// A trailing stringList positional is variadic: it absorbs ALL the
// remaining tokens (e.g. `icon show gear folder gauge`), not just one.
if (i == positional.length - 1 && args[name]?.type == ArgType.stringList) {
out[name] = i < pos.length ? pos.sublist(i) : const <Object?>[];
break;
}
if (i < pos.length) out[name] = pos[i];
}
}
final flags = raw['flags'];