Skip to content

Single source of truth via assemble.sh splicer#2

Open
jtotty wants to merge 1 commit into
mainfrom
feat/assemble-script-single-source
Open

Single source of truth via assemble.sh splicer#2
jtotty wants to merge 1 commit into
mainfrom
feat/assemble-script-single-source

Conversation

@jtotty
Copy link
Copy Markdown
Owner

@jtotty jtotty commented Jun 1, 2026

What

The locked theme now lives in exactly one place and is stamped into each explainer at generation time, instead of being hand-pasted (and kept in sync by discipline) inside every template.

  • Templates become marker skeletons. Each templates/template.html drops its ~580-line inline core.css and ~160-line inline core.js, keeping the structure, component markup, the Mermaid + Prism CDN tags, and two markers: <!-- @core:css --> / <!-- @core:js -->.
  • skills/visual-explainer-core/scripts/assemble.sh splices the canonical core.css/core.js into a filled draft at the markers to produce the final self-contained HTML. Zero install — awk + bash only, no Node/Python, no toolchain.
  • Drift is now impossible by construction: there is only one copy of the theme, so there is nothing to keep in sync.

How it works

bash skills/visual-explainer-core/scripts/assemble.sh <filled-draft.html> <output.html>

The script self-locates core.css/core.js relative to itself, reads them verbatim via awk getline (byte-exact, no regex-escaping of CSS), and fails loudly if a marker is missing or {{…}} placeholders are left unfilled.

Verification

  • Round-trip is byte-identical. Stripping each template to markers and re-running assemble.sh reproduces the previous output exactly (diff → identical) for both skills.
  • Domain CSS preserved. code-option-comparison has a second, comparison-specific <style> block; only the core block was stripped — its domain styles are untouched.
  • Templates shrank 1064 → 326 and 1210 → 472 lines; net +80 / −1535.

Docs

visual-explainer-core / software-visual-explainer / code-option-comparison SKILL.md, CLAUDE.md, and README.md updated to describe the one-step assembly and to remove the now-obsolete "manual sync" discipline.

Trade-offs (unchanged by design)

Each explainer is a self-contained snapshot — editing the theme later doesn't retroactively change already-generated files. Output still loads Mermaid + Prism from CDN at view time (same as before).

🤖 Generated with Claude Code

Replace the hand-synced inline theme copies with a zero-install splice step.
Templates become marker skeletons (<!-- @core:css --> / <!-- @core:js -->);
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 <style>; re-assembly round-trips byte-identical to the prior output
- Update core/software/comparison SKILL.md, CLAUDE.md, README to describe the
  one-step assembly and drop the now-removed "manual sync" discipline

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jtotty jtotty self-assigned this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant