Skip to content

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.

feat(icons): add Databricks product icon resolver (dbxicons)

krzysztof-zdeb4b3a5269f93a
diff --git a/skills/drawio-skill/data/databricks-icons.json b/skills/drawio-skill/data/databricks-icons.json
new file mode 100644
index 0000000..b547988
--- /dev/null
+++ b/skills/drawio-skill/data/databricks-icons.json
@@ -0,0 +1,581 @@
+{
+ "source": "https://github.com/oieduardorabelo/databricks-architecture-icons",
+ "hostedBase": "https://oieduardorabelo.github.io/databricks-architecture-icons",
+ "pinnedRef": "6d5419cbb5ad0dbb8ab29a7f95e2b196d836a62a",
+ "canvas": "48x48",
+ "categories": {
+ "platform": {
+ "label": "Platform & Compute",
+ "color": "#FF3621"
+ },
+ "engineering": {
+ "label": "Data Engineering",
+ "color": "#2272B4"
+ },
+ "storage": {
+ "label": "Storage & Databases",
+ "color": "#00875C"
+ },
+ "analytics": {
+ "label": "Analytics & BI",
+ "color": "#1B5162"
+ },
+ "ai": {
+ "label": "AI & Agents",
+ "color": "#98102A"
+ },
+ "governance": {
+ "label": "Governance & Security",
+ "color": "#1B3139"
+ },
+ "sharing": {
+ "label": "Sharing & Collaboration",
+ "color": "#BA7B23"
+ },
+ "devtools": {
+ "label": "Developer Tools & Apps",
+ "color": "#618794"
+ }
+ },
+ "products": [
+ {
+ "slug": "databricks",
+ "name": "Databricks",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "data-intelligence-platform",
+ "name": "Data Intelligence Platform",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "lakehouse",
+ "name": "Lakehouse Architecture",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "apache-spark",
+ "name": "Apache Spark",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "photon",
+ "name": "Photon",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "compute-clusters",
+ "name": "Compute (Clusters)",
+ "aliases": [
+ "Clusters",
+ "All-purpose compute",
+ "Job compute"
+ ],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "serverless-compute",
+ "name": "Serverless Compute",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "databricks-runtime",
+ "name": "Databricks Runtime",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "spark-real-time-mode",
+ "name": "Real-Time Mode for Apache Spark",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "multicloud",
+ "name": "Multicloud Deployment",
+ "aliases": [],
+ "category": "platform",
+ "categoryColor": "#FF3621"
+ },
+ {
+ "slug": "lakeflow",
+ "name": "Lakeflow",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "lakeflow-connect",
+ "name": "Lakeflow Connect",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "zerobus-ingest",
+ "name": "Zerobus Ingest",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "spark-declarative-pipelines",
+ "name": "Apache Spark Declarative Pipelines",
+ "aliases": [
+ "Lakeflow Declarative Pipelines",
+ "Delta Live Tables (DLT)",
+ "DLT",
+ "Delta Live Tables"
+ ],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "lakeflow-jobs",
+ "name": "Lakeflow Jobs",
+ "aliases": [
+ "Databricks Workflows",
+ "Workflows",
+ "Jobs"
+ ],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "lakeflow-designer",
+ "name": "Lakeflow Designer",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "auto-loader",
+ "name": "Auto Loader",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "structured-streaming",
+ "name": "Structured Streaming",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "lakebridge",
+ "name": "Lakebridge",
+ "aliases": [],
+ "category": "engineering",
+ "categoryColor": "#2272B4"
+ },
+ {
+ "slug": "delta-lake",
+ "name": "Delta Lake",
+ "aliases": [],
+ "category": "storage",
+ "categoryColor": "#00875C"
+ },
+ {
+ "slug": "apache-iceberg",
+ "name": "Apache Iceberg",
+ "aliases": [],
+ "category": "storage",
+ "categoryColor": "#00875C"
+ },
+ {
+ "slug": "lakehouse-storage",
+ "name": "Lakehouse Storage (Managed Tables)",
+ "aliases": [
+ "Managed tables",
+ "Delta tables"
+ ],
+ "category": "storage",
+ "categoryColor": "#00875C"
+ },
+ {
+ "slug": "liquid-clustering",
+ "name": "Liquid Clustering",
+ "aliases": [],
+ "category": "storage",
+ "categoryColor": "#00875C"
+ },
+ {
+ "slug": "predictive-optimization",
+ "name": "Predictive Optimization",
+ "aliases": [],
+ "category": "storage",
+ "categoryColor": "#00875C"
+ },
+ {
+ "slug": "lakebase",
+ "name": "Lakebase",
+ "aliases": [
+ "OLTP",
+ "Postgres"
+ ],
+ "category": "storage",
+ "categoryColor": "#00875C"
+ },
+ {
+ "slug": "data-warehousing",
+ "name": "Databricks Lakehouse (Data Warehousing)",
+ "aliases": [],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "databricks-sql",
+ "name": "Databricks SQL",
+ "aliases": [
+ "DBSQL"
+ ],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "sql-warehouse",
+ "name": "SQL Warehouse",
+ "aliases": [],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "lakehouse-rt",
+ "name": "Lakehouse//RT",
+ "aliases": [],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "ai-bi",
+ "name": "Databricks AI/BI",
+ "aliases": [],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "ai-bi-dashboards",
+ "name": "AI/BI Dashboards",
+ "aliases": [],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "lakehouse-federation",
+ "name": "Lakehouse Federation",
+ "aliases": [],
+ "category": "analytics",
+ "categoryColor": "#1B5162"
+ },
+ {
+ "slug": "genie",
+ "name": "Databricks Genie",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "genie-one",
+ "name": "Genie One",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "genie-agents",
+ "name": "Genie Agents",
+ "aliases": [
+ "AI/BI Genie spaces",
+ "Genie spaces",
+ "AI/BI Genie"
+ ],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "genie-code",
+ "name": "Genie Code",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "genie-deep-research",
+ "name": "Genie Deep Research",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "agent-bricks",
+ "name": "Agent Bricks",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "ai-search",
+ "name": "Databricks AI Search",
+ "aliases": [
+ "Databricks Vector Search",
+ "Mosaic AI Vector Search",
+ "Vector Search"
+ ],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "unity-ai-gateway",
+ "name": "Unity AI Gateway",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "document-intelligence",
+ "name": "Document Intelligence",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "model-serving",
+ "name": "Databricks Model Serving",
+ "aliases": [
+ "Mosaic AI Model Serving"
+ ],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "model-training",
+ "name": "Databricks Model Training",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "mlflow",
+ "name": "Managed MLflow",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "feature-store",
+ "name": "Databricks Feature Store",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "ai-functions",
+ "name": "AI Functions",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "automl",
+ "name": "Databricks AutoML",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "customerlake",
+ "name": "CustomerLake",
+ "aliases": [],
+ "category": "ai",
+ "categoryColor": "#98102A"
+ },
+ {
+ "slug": "unity-catalog",
+ "name": "Unity Catalog",
+ "aliases": [
+ "UC"
+ ],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "unity-catalog-semantics",
+ "name": "Unity Catalog Semantics",
+ "aliases": [],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "data-lineage",
+ "name": "Data & AI Lineage",
+ "aliases": [],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "abac",
+ "name": "Attribute-Based Access Control",
+ "aliases": [],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "data-quality-monitoring",
+ "name": "Data Quality Monitoring",
+ "aliases": [
+ "Lakehouse Monitoring"
+ ],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "lakewatch",
+ "name": "Lakewatch",
+ "aliases": [],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "system-tables",
+ "name": "System Tables",
+ "aliases": [],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "enterprise-security",
+ "name": "Enterprise Security",
+ "aliases": [],
+ "category": "governance",
+ "categoryColor": "#1B3139"
+ },
+ {
+ "slug": "delta-sharing",
+ "name": "Delta Sharing",
+ "aliases": [
+ "Data sharing"
+ ],
+ "category": "sharing",
+ "categoryColor": "#BA7B23"
+ },
+ {
+ "slug": "opensharing",
+ "name": "OpenSharing",
+ "aliases": [],
+ "category": "sharing",
+ "categoryColor": "#BA7B23"
+ },
+ {
+ "slug": "marketplace",
+ "name": "Databricks Marketplace",
+ "aliases": [],
+ "category": "sharing",
+ "categoryColor": "#BA7B23"
+ },
+ {
+ "slug": "clean-rooms",
+ "name": "Databricks Clean Rooms",
+ "aliases": [],
+ "category": "sharing",
+ "categoryColor": "#BA7B23"
+ },
+ {
+ "slug": "partner-connect",
+ "name": "Partner Connect",
+ "aliases": [],
+ "category": "sharing",
+ "categoryColor": "#BA7B23"
+ },
+ {
+ "slug": "databricks-apps",
+ "name": "Databricks Apps",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "notebooks",
+ "name": "Databricks Notebooks",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "workspace",
+ "name": "Databricks Workspace",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "git-folders",
+ "name": "Git Folders (Repos)",
+ "aliases": [
+ "Repos"
+ ],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "asset-bundles",
+ "name": "Databricks Asset Bundles",
+ "aliases": [
+ "DAB",
+ "DABs"
+ ],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "databricks-cli",
+ "name": "Databricks CLI",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "databricks-connect",
+ "name": "Databricks Connect",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "ide-integrations",
+ "name": "IDE Integrations",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "rest-api",
+ "name": "REST API & SDKs",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ },
+ {
+ "slug": "terraform-provider",
+ "name": "Databricks Terraform Provider",
+ "aliases": [],
+ "category": "devtools",
+ "categoryColor": "#618794"
+ }
+ ]
+}
diff --git a/skills/drawio-skill/scripts/dbxicons.py b/skills/drawio-skill/scripts/dbxicons.py
new file mode 100644
index 0000000..4b13447
--- /dev/null
+++ b/skills/drawio-skill/scripts/dbxicons.py
@@ -0,0 +1,285 @@
+#!/usr/bin/env python3
+"""Find Databricks product icons (Unity Catalog, Lakeflow, DLT, ...) as draw.io styles.
+
+draw.io's bundled shape libraries have no Databricks shape set, so a lakehouse
+architecture renders as generic boxes. This resolves a Databricks product name
+to a draw.io `image` style that references the matching SVG from the community
+databricks-architecture-icons project
+(https://github.com/oieduardorabelo/databricks-architecture-icons), which
+packages official Databricks artwork on a 48x48 canvas.
+
+ python3 dbxicons.py "unity catalog"
+ python3 dbxicons.py "DLT" --json
+ python3 dbxicons.py "vector search" --variant outline --size 48
+
+Renamed products resolve through aliases: "DLT" and "Delta Live Tables" find
+`spark-declarative-pipelines`, "Workflows" finds `lakeflow-jobs`. Match order:
+exact slug, exact alias, then ranked substring search over slug, name, and
+aliases.
+
+The icon is referenced by URL (data/databricks-icons.json carries names and
+category facts only, not the assets), so draw.io fetches it from the project's
+GitHub Pages site when the diagram is rendered or opened. That means **network
+is required at render time**; an offline export draws a blank box. Use --embed
+to fetch the SVG once (from the pinned commit, immutable) and inline it as a
+self-contained data URI instead (portable, no network at render time).
+
+Variants: `color` (default), `tile`, `outline`. There is no mono variant on
+purpose: the upstream mono SVGs use `currentColor`, which draw.io image shapes
+render as black.
+
+The icons are official Databricks artwork served by the community project. They
+are trademarks of Databricks, Inc., referenced here for identification only —
+the same basis on which draw.io ships AWS/Azure icons. No artwork is bundled.
+
+Usage: python3 dbxicons.py <query> [--limit N] [--variant color|tile|outline]
+ [--size PX] [--embed] [--json] [--list]
+ python3 dbxicons.py --refresh-manifest [--ref REF] (maintainer-facing)
+"""
+import argparse
+import base64
+import json
+import os
+import re
+import sys
+import urllib.request
+
+MANIFEST = os.path.join(os.path.dirname(__file__), "..", "data", "databricks-icons.json")
+STYLE = ("shape=image;html=1;imageAspect=0;aspect=fixed;"
+ "verticalLabelPosition=bottom;verticalAlign=top;image=")
+_VARIANT_DIRS = {"color": "svg", "tile": "svg-tile", "outline": "svg-outline"}
+
+_REPO = "oieduardorabelo/databricks-architecture-icons"
+_SOURCE = f"https://github.com/{_REPO}"
+_HOSTED = "https://oieduardorabelo.github.io/databricks-architecture-icons"
+_RAW = f"https://raw.githubusercontent.com/{_REPO}/"
+_API_COMMIT = f"https://api.github.com/repos/{_REPO}/commits/"
+
+# Curated aliases beyond the upstream catalog's former names ("aka"), for the
+# names people still use after Databricks renamed the product. Source of truth
+# for --refresh-manifest; edit here, then regenerate the manifest.
+EXTRA_ALIASES = {
+ "spark-declarative-pipelines": ["DLT", "Delta Live Tables",
+ "Lakeflow Declarative Pipelines"],
+ "lakeflow-jobs": ["Databricks Workflows", "Workflows", "Jobs"],
+ "ai-search": ["Vector Search", "Mosaic AI Vector Search"],
+ "genie-agents": ["Genie spaces", "AI/BI Genie"],
+ "data-quality-monitoring": ["Lakehouse Monitoring"],
+ "model-serving": ["Mosaic AI Model Serving"],
+ "unity-catalog": ["UC"],
+ "databricks-sql": ["DBSQL"],
+ "compute-clusters": ["Clusters", "All-purpose compute", "Job compute"],
+ "lakehouse-storage": ["Managed tables", "Delta tables"],
+ "asset-bundles": ["DAB", "DABs"],
+ "git-folders": ["Repos"],
+ "mlflow": ["Managed MLflow"],
+ "lakebase": ["OLTP", "Postgres"],
+ "delta-sharing": ["Data sharing"],
+}
+
+
+def squish(s):
+ return re.sub(r"[^a-z0-9]", "", s.lower())
+
+
+def data_uri(svg_bytes):
+ """SVG bytes -> marker-less base64 data URI. draw.io splits style values on
+ ';', so a ';base64,' marker would truncate the image= value (issue #80);
+ draw.io detects base64 by content."""
+ return "data:image/svg+xml," + base64.b64encode(svg_bytes).decode()
+
+
+def icon_path(product, variant):
+ return f"icons/{_VARIANT_DIRS[variant]}/{product['slug']}.svg"
+
+
+def search(products, query, limit):
+ """Rank products against the query (squished + per-token matching) over
+ slug, name, and aliases — the same scoring as aiicons.py."""
+ q = squish(query)
+ tokens = [t for t in re.findall(r"[a-z0-9]+", query.lower()) if t]
+ scored = {}
+ for i, p in enumerate(products):
+ s = 0
+ for key in [p["slug"], p["name"]] + p.get("aliases", []):
+ b = squish(key)
+ if not b:
+ continue
+ if q and q == b:
+ s = max(s, 100)
+ elif q and b.startswith(q):
+ s = max(s, 60)
+ elif q and q in b:
+ s = max(s, 40)
+ for t in tokens:
+ if t == b:
+ s = max(s, 90)
+ elif len(t) >= 3 and b.startswith(t):
+ s = max(s, 50)
+ elif len(t) >= 3 and t in b:
+ s = max(s, 30)
+ if s:
+ scored[i] = s
+ ranked = sorted(scored, key=lambda i: (-scored[i], products[i]["slug"]))
+ return [products[i] for i in ranked[:limit]]
+
+
+def resolve(products, query, limit):
+ """Exact slug, then exact alias/name (case-insensitive), then ranked search."""
+ q = squish(query)
+ for p in products:
+ if squish(p["slug"]) == q:
+ return [p]
+ for p in products:
+ if any(squish(a) == q for a in [p["name"]] + p.get("aliases", [])):
+ return [p]
+ return search(products, query, limit)
+
+
+# ---------------------------------------------------------------- refresh ---
+
+def _fetch(url, accept=None):
+ headers = {"User-Agent": "drawio-skill-dbxicons"}
+ if accept:
+ headers["Accept"] = accept
+ req = urllib.request.Request(url, headers=headers)
+ with urllib.request.urlopen(req, timeout=30) as resp:
+ return resp.read()
+
+
+def parse_aka(aka):
+ """Upstream 'aka' prose -> former-name facts.
+ 'Lakeflow X. Formerly Delta Live Tables (DLT)' -> two names."""
+ names = []
+ for part in re.split(r"[.;]", aka or ""):
+ part = re.sub(r"^\s*formerly\s+", "", part.strip(), flags=re.I)
+ for name in re.split(r"\s+/\s+", part):
+ name = name.strip()
+ if name:
+ names.append(name)
+ return names
+
+
+def build_manifest(catalog, sha):
+ """Upstream icons/catalog.json -> the facts-only manifest (no descriptions,
+ no docs URLs — those stay upstream)."""
+ categories = {key: {"label": val["label"], "color": val["color"]}
+ for key, val in catalog["categories"].items()}
+ products = []
+ for p in catalog["products"]:
+ seen = {squish(p["slug"]), squish(p["name"])}
+ aliases = []
+ for alias in parse_aka(p.get("aka")) + EXTRA_ALIASES.get(p["slug"], []):
+ if squish(alias) not in seen:
+ seen.add(squish(alias))
+ aliases.append(alias)
+ products.append({"slug": p["slug"], "name": p["name"], "aliases": aliases,
+ "category": p["category"],
+ "categoryColor": p["categoryColor"]})
+ return {"source": _SOURCE, "hostedBase": _HOSTED, "pinnedRef": sha,
+ "canvas": catalog.get("canvas", "48x48"),
+ "categories": categories, "products": products}
+
+
+def refresh_manifest(ref):
+ sha = ref if re.fullmatch(r"[0-9a-f]{40}", ref or "") else \
+ _fetch(_API_COMMIT + (ref or "main"), accept="application/vnd.github.sha").decode()
+ catalog = json.loads(_fetch(f"{_RAW}{sha}/icons/catalog.json"))
+
+ slugs = {p["slug"] for p in catalog["products"]}
+ for slug in EXTRA_ALIASES:
+ if slug not in slugs:
+ sys.stderr.write(f"warning: EXTRA_ALIASES key {slug!r} is not in the "
+ f"upstream catalog (renamed upstream?)\n")
+
+ manifest = build_manifest(catalog, sha)
+
+ old = {}
+ if os.path.exists(MANIFEST):
+ with open(MANIFEST, encoding="utf-8") as f:
+ old = {p["slug"]: p for p in json.load(f).get("products", [])}
+ new = {p["slug"]: p for p in manifest["products"]}
+ for slug in sorted(set(new) - set(old)):
+ print(f"added: {slug}")
+ for slug in sorted(set(old) - set(new)):
+ print(f"removed: {slug}")
+ for slug in sorted(set(old) & set(new)):
+ if old[slug]["name"] != new[slug]["name"]:
+ print(f"renamed: {slug}: {old[slug]['name']} -> {new[slug]['name']}")
+
+ with open(MANIFEST, "w", encoding="utf-8", newline="\n") as f:
+ json.dump(manifest, f, indent=1, ensure_ascii=False)
+ f.write("\n")
+ print(f"wrote {os.path.normpath(MANIFEST)}: {len(new)} products, "
+ f"{len(manifest['categories'])} categories, pinned {sha}")
+
+
+# ------------------------------------------------------------------- main ---
+
+def main():
+ ap = argparse.ArgumentParser(
+ description="Find Databricks product icons as draw.io styles (community-hosted official artwork).")
+ ap.add_argument("query", nargs="?", help='product name, e.g. "unity catalog" or "DLT"')
+ ap.add_argument("--limit", type=int, default=8)
+ ap.add_argument("--variant", choices=sorted(_VARIANT_DIRS), default="color",
+ help="icon style (no mono: upstream mono SVGs render black in draw.io)")
+ ap.add_argument("--size", type=int, default=48, help="cell width/height in px (icons are square)")
+ ap.add_argument("--embed", action="store_true",
+ help="inline the SVG as a data URI (fetches it now from the pinned commit; "
+ "portable, no network at render time)")
+ ap.add_argument("--json", action="store_true")
+ ap.add_argument("--list", action="store_true", help="list all products and exit")
+ ap.add_argument("--refresh-manifest", action="store_true",
+ help="maintainer-facing: regenerate data/databricks-icons.json from the upstream catalog")
+ ap.add_argument("--ref", help="git ref for --refresh-manifest (default: remote main HEAD)")
+ args = ap.parse_args()
+
+ if args.refresh_manifest:
+ refresh_manifest(args.ref)
+ return
+
+ if not os.path.exists(MANIFEST):
+ sys.exit(f"error: manifest not found at {MANIFEST}")
+ with open(MANIFEST, encoding="utf-8") as f:
+ manifest = json.load(f)
+ products = manifest["products"]
+
+ if args.list:
+ for p in sorted(products, key=lambda p: p["slug"]):
+ print(f"{p['slug']} {p['name']}")
+ return
+ if not args.query:
+ ap.error("a query is required (or use --list)")
+
+ results = []
+ for p in resolve(products, args.query, args.limit):
+ path = icon_path(p, args.variant)
+ if args.embed:
+ url = f"{_RAW}{manifest['pinnedRef']}/{path}"
+ try:
+ svg = _fetch(url)
+ except Exception as exc: # noqa: BLE001 - report and skip
+ sys.stderr.write(f"warning: could not fetch {url} ({exc})\n")
+ continue
+ image = data_uri(svg)
+ else:
+ image = f"{manifest['hostedBase']}/{path}"
+ results.append({"product": p["slug"], "name": p["name"],
+ "category": p["category"], "categoryColor": p["categoryColor"],
+ "file": path, "w": args.size, "h": args.size,
+ "style": STYLE + image})
+
+ if not results:
+ sys.exit(f"no Databricks product for {args.query!r} — for the bare Databricks "
+ f"logo try aiicons.py 'databricks'; otherwise shapesearch.py {args.query!r}")
+
+ if args.json:
+ print(json.dumps(results, indent=2, ensure_ascii=False))
+ else:
+ for r in results:
+ shown = r["style"] if len(r["style"]) < 160 else r["style"][:157] + "..."
+ print(f"{r['product']} {r['name']} ({r['file']}, {r['w']}x{r['h']})\n {shown}")
+
+
+if __name__ == "__main__":
+ main()