Skip to content

feat(plan-canvas): freeform figma-style prototyping surface + resilient parsing#70

Open
Legacynnn wants to merge 1 commit into
mainfrom
Legacynnn/canvas-live-figma-prototyping
Open

feat(plan-canvas): freeform figma-style prototyping surface + resilient parsing#70
Legacynnn wants to merge 1 commit into
mainfrom
Legacynnn/canvas-live-figma-prototyping

Conversation

@Legacynnn

Copy link
Copy Markdown
Owner

What

Two related changes to the plan viewer, landing together on this branch.

1. Figma-style plan canvas

Reworks <PlanCanvas> from an auto-laid-out mind-map into a freeform, pan/zoom prototyping surface:

  • Agent-positioned frames (x/y/w/h) embedding live previews, greyscale wireframes, and sticky notes.
  • Labeled user-flow arrows via <CanvasFlow> and section grouping via <CanvasGroup>.
  • Heavy reuse of the existing Preview + Wireframe renderers; MiniMap, themed Controls, and fitView.
  • Back-compat: legacy connects=-only plans still render through an auto-layout (Dagre) fallback, so nothing breaks.

New modules: auto-layout, frame-kinds, theme-modes, flow-edge, design-toolbar, and frames/ (preview/wireframe/note/group + shared chrome). Old node-kinds / layout / canvas-node removed.

2. Resilient plan parsing (bugfix)

A canvas-heavy plan was rendering as plain text — the canvas never loaded. Root cause: the plan file contained a leaked agent tool-call wrapper tag (a stray trailing </content></invoke> from a Write call). remark-mdx throws on a closing tag with no opener, and the existing recovery tiers can't isolate stray lowercase tags, so the whole plan fell back to plain Markdown and every component (incl. <PlanCanvas>) degraded to prose.

Fix: a new strip-leaked-tags pre-pass removes whole-line leaked wrapper tags (<invoke>, <content>, <parameter>, <function_calls>, namespaced variants) outside fenced code before parsing. Clean plans are byte-identical (returns null).

Tests

  • New strip-leaked-tags.test.ts (7 cases) + integration case in parse.test.ts.
  • build-graph / auto-layout / frame-kinds / theme-modes / preview-frame / plan-canvas-render unit + render tests.
  • Verified against the real failing plan: before → 0 components (blank); after → <PlanCanvas> + 6 CanvasNodes parse and render.
  • typecheck, biome, and cargo clippy clean. Pre-existing unrelated failures in editor/ and terminal/ tests are untouched by this branch.

…nt parsing

Rework <PlanCanvas> from an auto-laid mind-map into a pan/zoom figma board:
agent-positioned frames embedding live previews, greyscale wireframes, and
sticky notes, wired with labeled <CanvasFlow> arrows and grouped via
<CanvasGroup>. Legacy connects=-only plans still render via auto-layout.

Also harden plan MDX parsing: strip leaked agent tool-call wrapper tags
(e.g. a stray trailing </content></invoke> from a Write call) before parsing,
so one stray closing tag no longer drops the whole plan to plain Markdown and
blanks the canvas.
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