Skip to content

feat: add Mockup node type with AI-generated low-fi wireframes - #83

Merged
tomasz-zajac-oss merged 3 commits into
mainfrom
feature/mockup-node
Sep 23, 2026
Merged

tomasz-zajac-oss merged 3 commits into
mainfrom
feature/mockup-node

Conversation

@tomasz-zajac-oss

@tomasz-zajac-oss tomasz-zajac-oss commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This adds a mockup node type to the C4 + DDD + Governance preset. The model can already describe how the system is built (C4) and what it must do (requirements, scenarios). A mockup adds a view of what the user sees. A mockup can be:

  • a link to an external design (Figma, Penpot, …), or
  • a low-fidelity SVG wireframe that AI generates from the requirements and scenarios the screen illustrates.

Metamodel changes (types/metamodel/presets/governance.ts)

  • New mockup node type with three fields: description, screen (screen name or route) and link (design link). It has its own Table View tab. There is deliberately no status field.
  • New relation illustrates: mockup → requirement / scenario.
  • New relation presented-by: mockup → webapp / container / component / system.
  • New relation navigates-to: mockup → mockup, for screen flow.
  • Existing documents on the built-in preset get the new type automatically on load, because built-in presets are rebuilt at startup.

Wireframe generation (ai/mockupWireframe.ts)

  • One adapter call with no tools, the same pattern as forgeClarify. It uses the user's configured generation model.
  • The prompt is built from the model around the mockup:
    • its description and route
    • the EARS requirements and Gherkin scenarios it illustrates
    • the container that presents it
    • the screens it navigates to
  • The SVG is extracted from the response and sanitized:
    • <script>, <foreignObject>, on* handlers and non-fragment hrefs are stripped
    • output over 20 KB is rejected
  • The wireframe is only ever displayed through an <img> data URI. That context never runs scripts or loads external resources.

UI changes

  • New MockupNode on the canvas. It shows the wireframe thumbnail if there is one, otherwise the design link or a placeholder.
  • New Wireframe section in the properties panel, with a preview and these buttons:
    • Generate / Regenerate, which can be cancelled
    • Remove
    • Open design, which opens only http/https links
  • New "UX" group in the palette. In the Wiki view, mockups are listed with the governance items.

Storage trade-off
The wireframe is stored on the node as a wireframe string. In md-folder documents it is written into the frontmatter as a multi-line block scalar; a test covers the round-trip. This needs no persistence changes. The downside is that wireframes load eagerly with the rest of the frontmatter. Now that lazy node bodies (#82) have landed, a follow-up could move them to a lazily loaded sidecar file.

Type of change

  • New feature
  • Tests

Test plan

  • npm run typecheck passes
  • npm test passes: 384/384 tests in 37 files, including the new tests/mockupWireframe.test.ts, which covers:
    • the metamodel types and relation inference
    • prompt construction from the linked model context
    • SVG extraction and sanitizing
    • the oversize cap
    • the md-folder round-trip of a multi-line wireframe
  • Manual check in the app, not done yet:
    • create a mockup and link it with Illustrates to a requirement and a scenario
    • generate a wireframe with a real provider
    • check the canvas thumbnail and the properties preview
    • check Open design and Remove
    • save and reopen as md-folder and as JSON

🤖 Generated with Claude Code

Tomasz Zajac and others added 3 commits September 23, 2026 18:33
Adds a `mockup` node type to the C4 + DDD + Governance preset so the model
can show what the user-facing product looks like, not just how it is built
and what it must do. A mockup is either a link to an external design
(Figma, Penpot, ...) or a low-fidelity SVG wireframe generated by AI.

Metamodel:
- mockup node type (description, screen / route, design link), with its
  own Table View tab
- illustrates:   mockup -> requirement / scenario
- presented-by:  mockup -> webapp / container / component / system
- navigates-to:  mockup -> mockup (screen flow)

Wireframe generation (ai/mockupWireframe.ts) is a single tool-less adapter
call, like forgeClarify. The prompt is built from the model around the
mockup: its description and route, the EARS requirements and Gherkin
scenarios it illustrates, the container presenting it and the screens it
navigates to. The returned SVG is extracted and sanitised (scripts,
foreignObject, on* handlers and external hrefs stripped, 20 KB cap) and is
only ever rendered through an <img> data URI, so it can never run code or
fetch anything.

UI: MockupNode renders the wireframe thumbnail on the canvas (or the link /
a placeholder), and the properties panel gets a Wireframe section with a
preview plus Generate / Regenerate (cancellable), Remove and Open design
(http/https only). New "UX" palette group; mockups listed with governance
items in the Wiki view.

The wireframe is stored on the node as a `wireframe` string, so in
md-folder documents it lands in the frontmatter as a multi-line block
scalar (round-trip covered by a test). That means it loads eagerly with the
rest of the frontmatter; moving it to a lazily-loaded sidecar file is a
possible follow-up once lazy node bodies land.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
deserializeFromMdFolder now returns { data, bodyPaths? } since #82.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tomasz-zajac-oss
tomasz-zajac-oss merged commit 99c863d into main Sep 23, 2026
2 checks passed
@tomasz-zajac-oss
tomasz-zajac-oss deleted the feature/mockup-node branch September 23, 2026 16:38
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