Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.
Python agent-skillsarchitecturearchitecture-diagramasyncapibpmnc4-modelclaude-codediagramdiagrams-as-codedrawioflowchartgithub-actionsgraphqlimage-to-diagramkubernetesmcp-serverprotobufsysmlterraformuml
Fix AI icon variant family grouping (#50)
nb2132385ef247e18
diff --git a/skills/drawio-skill/scripts/aiicons.py b/skills/drawio-skill/scripts/aiicons.pyindex 67f3781..425831a 100644--- a/skills/drawio-skill/scripts/aiicons.py+++ b/skills/drawio-skill/scripts/aiicons.py@@ -33,7 +33,7 @@ import urllib.requestMANIFEST = os.path.join(os.path.dirname(__file__), "..", "data", "lobe-icons.json")STYLE = ("shape=image;html=1;imageAspect=0;aspect=fixed;""verticalLabelPosition=bottom;verticalAlign=top;image=")-_VARIANT = re.compile(r"-(color|text)$")+_VARIANT = re.compile(r"-(?:color|text(?:-[a-z]{2})?|brand(?:-color)?)$")# Common RAG/LLM data stores that lobe-icons lacks, mapped to simple-icons# slugs (https://simpleicons.org, CC0). Served from the simple-icons CDN. Each@@ -114,9 +114,9 @@ def search_supplement(query):def pick_variant(base, variants, prefer):- order = {"color": ["-color", "", "-text"],- "mono": ["", "-color", "-text"],- "text": ["-text", "-color", ""]}[prefer]+ order = {"color": ["-color", "-brand-color", "", "-brand", "-text", "-text-cn"],+ "mono": ["", "-brand", "-color", "-brand-color", "-text", "-text-cn"],+ "text": ["-text", "-text-cn", "-brand", "-brand-color", "-color", ""]}[prefer]for suffix in order:cand = base + suffixif cand in variants:diff --git a/tests/test_scripts.py b/tests/test_scripts.pyindex 837da17..d09a889 100644--- a/tests/test_scripts.py+++ b/tests/test_scripts.py@@ -84,16 +84,31 @@ class TestAiIcons(unittest.TestCase):def test_families_group_variants(self):self.assertIn("claude", self.fam)self.assertIn("claude-color", self.fam["claude"])+ self.assertIn("googlecloud-brand", self.fam["googlecloud"])+ self.assertIn("alibabacloud-text-cn", self.fam["alibabacloud"])+ self.assertNotIn("googlecloud-brand", self.fam)+ self.assertNotIn("alibabacloud-text-cn", self.fam)def test_search_matches_brand(self):self.assertEqual(self.m.search(self.fam, "claude", 1)[0], "claude")# token matching: a brand word inside a phrase still matchesself.assertEqual(self.m.search(self.fam, "use the openai logo", 1)[0], "openai")+ self.assertEqual(self.m.search(self.fam, "Atlas Cloud", 1)[0], "atlascloud")++ def test_search_does_not_return_variant_brands(self):+ matches = self.m.search(self.fam, "google cloud", 8)+ self.assertIn("googlecloud", matches)+ self.assertNotIn("googlecloud-brand", matches)+ matches = self.m.search(self.fam, "alibaba cloud", 8)+ self.assertIn("alibabacloud", matches)+ self.assertNotIn("alibabacloud-text-cn", matches)def test_variant_preference(self):# claude has a colour variant; openai is mono-only -> falls back.self.assertEqual(self.m.pick_variant("claude", self.fam["claude"], "color"), "claude-color")self.assertEqual(self.m.pick_variant("openai", self.fam["openai"], "color"), "openai")+ self.assertEqual(self.m.pick_variant("googlecloud", self.fam["googlecloud"], "text"),+ "googlecloud-brand")def test_unknown_brand(self):self.assertEqual(self.m.search(self.fam, "definitelynotabrand", 3), [])