Skip to content

Add OnlineWardleyMaps (OWM) syntax validation for generated Wardley artefacts #436

@tractorjuice

Description

@tractorjuice

Problem

ArcKit Wardley commands (/arckit:wardley, /arckit:wardley.value-chain, /arckit:wardley.doctrine, /arckit:wardley.gameplay, /arckit:wardley.climate) emit OnlineWardleyMaps (OWM) DSL inside fenced ```wardley / ```owm blocks. There is no parse-time validation, so syntactically broken maps are written, committed, and indexed by the docs/pages site before anyone notices.

This is the sibling issue to #435 (Mermaid syntax validation). Same hook architecture, different parser.

Why this needs its own validator

The Mermaid validator from #435 covers the Mermaid blocks that appear alongside OWM in the Wardley templates (templates/wardley-map-template.md mixes both languages). It does not cover the OWM blocks themselves — they need an OWM parser.

Concrete failure classes the model produces

  • Out-of-range coordinates — OWM plane is unit square [0, 1]; LLM-generated maps occasionally write 0.45, 1.2 or negative values.
  • Dangling referenceslink A -> B, evolve C 0.7, or pipeline [Foo] referencing components that were never declared (or were renamed earlier in the block).
  • Inertia / evolve syntax mix-upsevolve A 0.7 vs evolve+>> A 0.7 vs trailing inertia.
  • Annotation driftannotation 1 [0.4, 0.5] text where annotation index 1 is reused or annotations [0.6, 0.1] block coordinates outside the plane.
  • Pipeline bracketingpipeline [Foo] with no matching declared component, or coordinates that put pipeline endpoints below visibility 0.
  • Style typosstyle wardely / style handritten / unknown style names.

These all parse cleanly as text but fail when OnlineWardleyMaps actually tries to render them.

Suggested approaches

(Mirroring #435 — pick whichever fits the existing hook architecture.)

  1. PreToolUse:Write hook (owm-block-scanner.mjs) — extract every ```wardley and ```owm block, parse via the OWM parser, block on parse failure with line-anchored error messages. Same JSON-blocking contract as secret-file-scanner.mjs.
  2. Post-generation validation in the Wardley commands — each /arckit:wardley.* command runs its emitted block through the parser before writing.
  3. CI / pre-commit walker — scan projects/**/*.md for OWM blocks and validate.
  4. Template-level guard rails — augment skills/wardley-mapping/references/mapping-examples.md and the wardley template prompts with explicit cautions: declare-before-link, coordinates ∈ [0,1], one annotation index per map.

(1) or (2) gives the fastest feedback loop. (4) is cheap and complementary.

Parser options

  • wardley-script-parser (npm — extracted from OnlineWardleyMaps source) — produces a JSON AST and surfaces parser errors with line numbers.
  • @owm/parser — same upstream, packaged differently.
  • Vendored copy of OnlineWardleyMaps' parser — if avoiding an npm dependency in hooks is preferred.

All three are MIT-compatible.

Scope clarification vs #435

Environment

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions