Skip to content

feat(pipeline): InDesign output generator — FSE patterns, templates & theme.json writer (#65)#92

Merged
PAMulligan merged 1 commit into
mainfrom
65-indesign-pipeline-output-generator-fse-block-patterns-templates-and-themejson-writer
May 30, 2026
Merged

feat(pipeline): InDesign output generator — FSE patterns, templates & theme.json writer (#65)#92
PAMulligan merged 1 commit into
mainfrom
65-indesign-pipeline-output-generator-fse-block-patterns-templates-and-themejson-writer

Conversation

@PAMulligan
Copy link
Copy Markdown
Collaborator

Sub-issue of #61. Implements stage 4 of the InDesign-to-WordPress pipeline: take the parsed IR (#62/#63) and mapped design tokens (#64) and emit the actual WordPress artifacts — a complete, installable Flavian-compatible FSE theme.

What it does

generateTheme(ir, options) → a full theme directory (pure & deterministic, no fs/clock/randomness in the core):

  • Patterns — one block pattern per spread, filed under an InDesign Imports category. Frames map to core blocks:
  • Template partsheader.html / footer.html derived from master-spread chrome (web-appropriate defaults when no usable master)
  • Templatesindex.html (stitches the spread patterns between header/footer), page.html, 404.html
  • theme.json — the token mapper's merged base + partial (already schema-valid)
  • Media — deterministic staged-asset plan + bin/import-media.sh; optional bin/seed-content.sh (--seed-content)
  • Reportindesign-pipeline-report.md enumerating produced files, unmapped IR nodes, and manual follow-ups

Exposed via a new flavian-generate-theme CLI that composes with the parser CLIs or parses .idml/.pdf directly. Image URLs resolve through get_theme_file_uri() (pattern-first — no broken src="").

Acceptance criteria

  • End-to-end on a fixture .idml produces a theme dir that loads in the Site Editor without PHP errors
  • ≥1 pattern per spread appears under the "InDesign Imports" category (registered in functions.php)
  • theme.json round-trips through validation (it's the mapper's already-validated merged output; a test also asserts every slug referenced in patterns exists in theme.json)
  • Generation report enumerates produced files and unmapped IR nodes
  • Snapshot tests cover generated markup for a text-heavy and an image-heavy spread (tests/indesign/__snapshots__/)
  • Patterns are deterministic given the same IR (byte-identical reruns — covered by a test)

Tests

pnpm --filter @flavian/pipeline test99 passing (88 prior + 11 new). Snapshots re-record with UPDATE_SNAPSHOTS=1.

Notes

  • Layout lives in packages/pipeline/src/indesign/generate/; docs in docs/pipeline/indesign-output-generator.md.
  • Also registered the existing-but-unregistered flavian-map-tokens bin alongside the new one.
  • ajv/ajv-formats (pipeline devDeps) were materialized via pnpm install (lockfile unchanged) so the mapper's schema-validation tests run.

🤖 Generated with Claude Code

Add the output generator — stage 4 of the InDesign-to-WordPress pipeline.
It takes a parsed IR (#62/#63) plus the mapped design tokens (#64) and
emits a complete, installable Flavian-compatible FSE theme:

- one block pattern per spread under an "InDesign Imports" category
- frames → core blocks (heading/paragraph/group, image/cover, columns)
  referencing token slugs, never inline values
- header/footer parts derived from master-spread chrome (web defaults
  otherwise), index/page/404 templates, the merged theme.json
- staged-asset plan + bin/import-media.sh (+ optional bin/seed-content.sh)
- indesign-pipeline-report.md enumerating files, unmapped nodes, follow-ups

generateTheme() is pure and deterministic — same IR yields byte-identical
files, so reruns never churn. Exposed via the new flavian-generate-theme
CLI (composes with the parser CLIs or parses .idml/.pdf directly).

Tests: schema-valid theme.json, one pattern per spread, token references
resolve, deterministic reruns, and markup snapshots for a text-heavy and
an image-heavy spread. Also registers the existing flavian-map-tokens bin.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan merged commit d7586bd into main May 30, 2026
4 checks passed
@PAMulligan PAMulligan deleted the 65-indesign-pipeline-output-generator-fse-block-patterns-templates-and-themejson-writer branch May 30, 2026 07:55
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.

[InDesign pipeline] Output generator: FSE block patterns, templates, and theme.json writer

1 participant