From 59332fde81ca95a6fbe86bfd972c74645d12408d Mon Sep 17 00:00:00 2001 From: jtotty Date: Mon, 1 Jun 2026 14:33:52 +0700 Subject: [PATCH] Single source of truth via assemble.sh splicer Replace the hand-synced inline theme copies with a zero-install splice step. Templates become marker skeletons ( / ); assemble.sh stamps the canonical core.css/core.js into each draft at generation time, so the theme lives in exactly one place and can't drift. - Add skills/visual-explainer-core/scripts/assemble.sh (awk/bash, no Node/Python) - Strip the inlined core from both templates, preserving the comparison skill's domain + +
@@ -900,165 +321,6 @@

Out of scope

- + diff --git a/skills/visual-explainer-core/SKILL.md b/skills/visual-explainer-core/SKILL.md index baeed0f..7e4b7b8 100644 --- a/skills/visual-explainer-core/SKILL.md +++ b/skills/visual-explainer-core/SKILL.md @@ -15,33 +15,37 @@ theme variation. ## What lives here -`SKILL.md` at the root; the theme itself in `assets/`. There is **no build step** — diagrams and -code render in the browser from a CDN. +`SKILL.md` at the root; the theme in `assets/`; the splicer in `scripts/`. | Path | Responsibility | |---|---| | `assets/core.css` | All shared CSS: `:root` tokens, typography, primitives, the Prism code-token palette, a11y, print. | | `assets/core.js` | Copy buttons, tabs (+keyboard), sliders, TOC scroll-spy, back-to-top, diagram zoom — plus the locked `mermaid.initialize` and `Prism.highlightAll`. | +| `scripts/assemble.sh` | Stamps `core.css`/`core.js` into a marker-based draft to produce the final HTML. Zero install (awk/bash); the only "build" there is. | ## How a domain skill uses the core -Each domain `templates/template.html` is **fully self-contained**: it embeds an inline copy of -`core.css` and `core.js`, and loads Mermaid + Prism from a CDN. To produce an explainer: +Each domain `templates/template.html` is a **marker skeleton**: structure and component markup, the +Mermaid + Prism CDN tags, and two markers — `` / `` — where the +shared theme is stamped in. To produce an explainer: -1. Start from `templates/template.html` (already self-contained — nothing to wire up). +1. Copy `templates/template.html` to a working draft. 2. Fill in content: Mermaid as `.mermaid` blocks, code as `
`. Replace
-   `{{LANGUAGE}}` in the Prism `
+#
+# Zero install: uses only awk + coreutils, present on macOS & Linux.
+# Usage: bash assemble.sh  
+set -euo pipefail
+
+src=${1:?usage: bash assemble.sh  }
+out=${2:?usage: bash assemble.sh  }
+dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+css="$dir/../assets/core.css"
+js="$dir/../assets/core.js"
+
+for f in "$src" "$css" "$js"; do
+  [ -r "$f" ] || { echo "assemble: cannot read $f" >&2; exit 1; }
+done
+
+awk -v cssfile="$css" -v jsfile="$js" '
+  index($0, "") {
+    print "  "; css_done = 1; next
+  }
+  index($0, "") {
+    print "  "; js_done = 1; next
+  }
+  { print }
+  END {
+    if (!css_done || !js_done) {
+      print "assemble: a  marker is missing from the template" > "/dev/stderr"
+      exit 2
+    }
+  }
+' "$src" > "$out.tmp"
+mv "$out.tmp" "$out"
+
+grep -q "{{" "$out" && echo "assemble: warning — unfilled {{...}} placeholders remain in $out" >&2
+echo "assembled → $out"