The Pack and HTML Artefacts — Skills & Instructions Playbook

A single reference for how the Mainframe Consolidation Pack and its self-contained HTML artefacts are built, verified and published. It collects the agent skills that govern the work and the exact instructions, conventions and gotchas discovered while developing them.

Audience: an agent (or a human) who has to re-run, extend or reproduce the pipeline. Everything here is grounded in the live tree under /opt/prodg/markdoc and the skills under /root/.hermes/skills.


1. What the artefacts are

ArtefactPathWhat it is
The pack/opt/prodg/docs/assets/pack/index.htmlOne self-contained interactive reader — multi-tab (nav buttons toggling class="show" on <section>), zero external requests, works offline. ~200 KB.
The form/opt/prodg/docs/assets/pack/answers.htmlThe open-questions questionnaire — parses the same question source, saves answers to localStorage, exports as Markdown or JSON. Built by the same builder so the two can never drift.
Packet diagrams/opt/prodg/docs/assets/diagrams/pack-*.svgFour PlantUML SVGs rendered at build time: pack-objective, pack-components, pack-roadmap, pack-loop.

Published at https://docs.mainframe.prodg.studio/assets/pack/index.html — the docs build already copies content/assets/ verbatim, so no new route or service is needed.

Core principle: the HTML is generated. Prose lives as markdown under markdoc/pack/; a factual correction reaches the published file only by editing a source and re-running the builder. Never hand-edit the HTML.


2. Skills that govern the work

These are the agent skills this pipeline draws on. Load the relevant one before extending the build.

static-site-markdoc-builder (primary)

/root/.hermes/skills/devops/static-site-markdoc-builder/SKILL.md

Covers rendering a markdown vault to a static site with Markdoc, and — most relevant here — section 7 of references/raw-html-and-diagrams.md, "Publishing a standalone generated HTML artefact into the site". That section is the canonical instruction for the pack: keep it dependency-free, publish it under content/assets/<name>/, climb relative paths by the artefact's own depth, autolink during conversion (or it is a dead document), tab-key the reader off data-*, and generate — never hand-edit — the HTML.

Its reference files that matter:

  • references/raw-html-and-diagrams.md — §7 standalone HTML artefact; §6 per-section generated diagrams (isometric + PlantUML, one source of truth for the section list, dark theming, redirect stubs); §8 hand-rolled markdown→HTML block/inline rules; escaping traps across languages.
  • references/plantuml-rendering.md — rendering SVG over HTTP without a browser, the "a render error is served as a valid SVG" trap, shared subject lists, dark theming, verifying through the served domain.
  • references/prodg-markdoc-migration.md — the Quartz→Markdoc worked example on this host.
  • references/deployment-verification-patterns.md — post-deploy checks.

engineering-standards-compliance

/root/.hermes/skills/software-development/engineering-standards-compliance/SKILL.md

The repo constitution. Two laws drive the tooling here:

  • Law 4 forbids Python for first-party scripting — which is why build-pack.py was ported to build-pack.ts and the ad-hoc Python link crawler became check-links.ts.
  • Law 5 requires ASCII output — em dashes, en dashes and status emoji are normalised on the way out (see §6).

The bash standard requires non-trivial scripting to run as bun inside a pinned container, never installed on the host. Full laws and per-language standards are in that skill.

fossflow-isometric-diagrams

/root/.hermes/skills/devops/fossflow-isometric-diagrams/SKILL.md

For the spatial, clickable counterpart to the PlantUML diagrams: embed the FossFLOW read-only route in an <iframe>, link to full size and to the editor. Pair one isometric (spatial) diagram with one PlantUML (text-diffable) per section.

Supporting skills

  • archify / learning-artifacts — the interactive-infographic idioms the reader's styling follows.
  • productivity/document-to-action-items — extracting cited obligations when the pack is used to drive decisions.

3. Source layout

/opt/prodg/markdoc/
├── pack/                       # the pack's markdown sources (edit these)
│   ├── 00-POSITION-BRIEF.md
│   ├── 01-BUSINESS-CASE.md
│   ├── 02-OPEN-QUESTIONS.md
│   ├── 03-ROADMAP.md
│   ├── 04-IMPROVEMENT-PLAN.md
│   ├── 05-BLUEPRINT-mainframe-framework.md
│   ├── 06-COMPONENTS.md
│   ├── 06-DECISIONS.md
│   ├── 07-FINDINGS.md
│   ├── 09-QUESTIONNAIRE.md   # the machine-readable question set (form source)
│   ├── REVIEW.md
│   └── research/             # cited option papers (open-questions-options, graphaware-org)
├── tools/
│   ├── build-pack.ts            # THE builder -> index.html + answers.html  (bun)
│   ├── check-links.ts           # link crawler; exits 1 on any broken link  (bun)
│   ├── generate-pack-diagrams.py# the four pack SVGs via PlantUML server
│   ├── generate-diagrams.py / generate-plantuml.py / ascii-banners.py
│   └── build-pack.py            # retired Python predecessor (law 4)
├── diagrams/sections.json       # shared section list (drift guard)
└── build.mjs                    # the docs-site builder (bun runs the ESM as-is)

Output: /opt/prodg/docs/assets/pack/{index.html,answers.html} and /opt/prodg/docs/assets/diagrams/pack-*.svg. The served tree is /opt/prodg/data/docs/public/.


4. Build instructions

Run the tooling as bun inside a pinned container — never install bun on the host:

# the pack reader + the answering form
docker run --rm -v /opt/prodg:/opt/prodg -w /opt/prodg/markdoc \
  oven/bun:1-alpine bun tools/build-pack.ts

# the four pack diagrams (needs the local PlantUML server, see §5)
python3 tools/generate-pack-diagrams.py

# gate: every relative href/src resolves on disk, or exit 1
docker run --rm -v /opt/prodg:/opt/prodg -w /opt/prodg/markdoc \
  oven/bun:1-alpine bun tools/check-links.ts

# publish the docs site (build output is just files -> rsync)
# The interfaces registry lives outside /opt/prodg so it MUST be mounted: the
# build aborts when a registry asset is unreachable rather than publishing a
# Registries section full of broken links.
docker run --rm -v /opt/prodg:/opt/prodg -v /root/interfaces:/root/interfaces:ro \
  -w /opt/prodg/markdoc \
  oven/bun:1-alpine bun build.mjs
rsync -a --delete /opt/prodg/markdoc/public/ /opt/prodg/data/docs/public/

The builder prints a per-section byte report and aborts if the questionnaire parsed zero questions (a sign the source format drifted) or if any required source file is missing.

Notes:

  • build.mjs is ESM; bun build.mjs executes it unchanged — a working pipeline does not need porting, only tools written in a banned language do.
  • Deploy stays plain rsync; the package manager's build target was the only piece replaced.
  • Update the rebuild/sync wrapper that calls the site build so it also runs build-pack.ts first — otherwise a site rebuild can leave the pack (and its companion form) stale.

5. Diagrams (PlantUML)

tools/generate-pack-diagrams.py renders each source to SVG through the local PlantUML server (PLANTUML_SERVER, default http://127.0.0.1:8092) and writes /opt/prodg/docs/assets/diagrams/pack-<slug>.svg.

  • Use the official server image — it bundles Graphviz, which PlantUML needs for most diagram types (a bare plantuml.jar does not).
  • Theme to the site. PlantUML defaults to a white background that glows on the dark reader. Prepend skinparams (backgroundColor #0b1017, defaultFontColor, ArrowColor, rectangleBackgroundColor/BorderColor, …) at render time so the .puml sources stay clean and the theme changes in one place.
  • One source of truth for the section list. The docs-section drift guard asserts DIAGRAMS == diagrams/sections.json; the pack's own diagram builder is kept in a separate file precisely so that guard stays strict. Two generators that must agree are equal only by duplication — put the shared list in one data file and make each generator abort on mismatch.
  • A PlantUML render error can be served as a valid SVG — verify the SVG actually contains the expected diagram, not just that the request returned 200.

6. Builder internals (build-pack.ts)

The builder is dependency-free: it uses the built-in Bun.markdown.html() renderer (no markdown library to pin, and it retires the whole bug class a hand-rolled pass accumulates).

Section table. A SECTIONS array maps each tab id → label → source file, with optional diagram (slug + caption) and callout. Paths starting with / are absolute (e.g. the standards and registry-methodology docs); the rest are relative to pack/. Order in the array is nav order; the first section gets class="show".

ASCII normalisation (law 5). normalizeAscii() maps em dashes, curly quotes, ellipses, non-breaking space, arrows and status glyphs (red/amber/green/planned/check/cross/warning) to ASCII before the markdown pass, then strips any remaining astral-plane pictographs rather than render tofu. Assert it: grep -c $'\u2014' out.html → 0.

Markdown→HTML post-processing, in order:

  1. Bun.markdown.html(normalizeAscii(md))
  2. rewrite document-relative asset paths (../assets/diagrams/ → ../diagrams/) because the pack lives one level deeper, at assets/pack/
  3. unwrap .md cross-references — text becomes plain text, since a single-file artefact has no sibling pages
  4. autolink bare URLs — wrap https?://… in anchors, guarding against re-wrapping one already inside an href/src. A reader with 86 links and one with 0 look identical; count them.

Figures. figure(slug, caption) emits <figure class="fig"><img src="../diagrams/<slug>.svg" …> — relative to the artefact's own depth, computed, not hard-coded.

The reader. Nav buttons data-t="<id>" toggle class="show" on <section id="<id>">; the first section is shown, switching scrolls to top and sets location.hash, and the hash deep-links on load.

The form. parseQuestions() reads 09-QUESTIONNAIRE.md: ## headings are themes; numbered items match ^(N)\. \*\*(.+?)\*\* (.*)$; a trailing *Default: … * clause becomes the fallback and is stripped from the detail. The parsed list is injected as JSON into answers.html, which renders fieldsets per theme, persists to localStorage, and exports Markdown/JSON. Because both artefacts come from build-pack.ts, the reader and its form cannot drift.


7. Authoring standards for the pack sources

  • Questionnaire format is a contract. Keep the numbered N. **Question** detail *Default: x.* format — the parser reads it. A change that makes it parse zero questions aborts the build.
  • Tables: header row, then | --- | separator, then rows. Reversing them renders the block as literal text.
  • No emoji, no em-dash, no decorative unicode in sources. Use [x]/[ ] for checklists and a plain hyphen. The renderer normalises anyway, but correct sources keep diffs readable.
  • Bullet lists stop at three items; past three, switch to a numbered list restarting at 1 per section.
  • Facts drift. Re-verify every claim (OS version, cluster topology, which components are up) against the live host before repeating or changing it — including when the correction comes from a review, which can be half-right.
  • Never add a companion artefact by hand. If the pack needs a second output (a form, an index), emit it from the same source the pack renders, in the same builder.

8. Verification (must pass before declaring done)

HTTP 200 proves only that an HTML file was served — a reader whose every diagram is missing and whose every link is dead still returns 200. Assert on structure:

# zero broken relative links across the served tree
docker run --rm -v /opt/prodg:/opt/prodg -w /opt/prodg/markdoc \
  oven/bun:1-alpine bun tools/check-links.ts \
  # -> "PASS: no broken links", exit 0

# no stray emphasis in PROSE (glob patterns like **/*.sh inside <code> are legitimate,
# so scope the check to text outside code spans)
grep -c '&lt;p ' /opt/prodg/docs/assets/pack/index.html   # -> 0 (no escaped raw HTML)
grep -c $'\u2014' /opt/prodg/docs/assets/pack/index.html  # -> 0 (ASCII-only, law 5)
grep -c '<b>[^<]*<i>[^<]*</b></i>' /opt/prodg/docs/assets/pack/index.html  # -> 0 (no mis-nested emphasis)

# the artefact is live, not just built
curl -sk -o /dev/null -w '%{http_code}\n' \
  https://docs.mainframe.prodg.studio/assets/pack/index.html
curl -sk -o /dev/null -w '%{http_code}\n' \
  https://docs.mainframe.prodg.studio/assets/pack/answers.html

In the DOM (not a screenshot — vendored/async content can be captured before layout settles, and a scrolled viewport hides below-the-fold failures):

({
  visible: [...document.querySelectorAll('main section.show')].map(s => s.id), // exactly one
  broken:  [...document.images].filter(i => i.complete && i.naturalWidth === 0)
             .map(i => i.getAttribute('src')),                                 // 0 = every diagram loaded
  links:   document.querySelectorAll('a[href]').length,                        // 0 means nothing clickable
})

Also run the full rebuild pipeline end-to-end (pack → diagrams → link check → site build → rsync), not just the pack builder, and confirm the served mtimes changed.


9. Pitfalls (condensed)

SymptomCauseFix
Build reports "parsed zero questions"Questionnaire format drifted from N. **Q** …Restore the numbered format
A regex/transform silently does nothingWritten against assumed markupBuild once, grep -o '<pre[^>]*>' out.html, write against real output
Escaping works in JS, fails after a port to Python\\s in a Python raw string is "literal backslash + s"Write \s in raw strings; grep the output for the effect, not the code
Prose breaks mid-sentence; ** shows literallyHand-rolled md pass emits one <p> per lineBuffer soft-wrapped lines; absorb list continuation lines (§8 of the reference)
Emphasis renders <b>…<i>…</b></i>Bold/italic regexes mis-pair across tags***x*** first, non-greedy .+?, exclude < from italic content
Reader looks finished but nothing is clickableURLs/paths left as inert textAutolink scheme'd URLs and bare hostnames; count hrefs
Form drifts from the packForm authored separatelyEmit both from the same source in the same builder
A decorated file loses its banner on rebuildDecoration applied by a separate passEmit it from the generator's own template
Sibling-doc links 404.md cross-refs not rewrittenUnwrap to plain text (single-file artefact)
A docs route returns a JSON error bodyRoot-absolute hrefs colliding with a proxy path routeEmit page-relative hrefs, never root-absolute
Targeted patch rewrites the wrong passageFuzzy matching a non-verbatim old_stringConfirm exact text first; re-read after bulk edits

10. Reuse checklist

  1. Load static-site-markdoc-builder (and engineering-standards-compliance for the constitution).
  2. Put prose sources in pack/*.md; keep the questionnaire in the numbered format.
  3. Add/relabel a tab by editing the SECTIONS array — never the HTML.
  4. Render diagrams through the local PlantUML server with the dark skinparams; keep one shared section list.
  5. Build with bun in the pinned oven/bun:1-alpine container; deploy with rsync.
  6. Gate on check-links.ts, assert the grep checks, then verify the live URLs and the DOM.
  7. Wire build-pack.ts into the rebuild wrapper so a site rebuild can't leave the pack stale.