SoftForge UI Designer — Architecture
Layers and source tree, the command registry and the one write path, document core, layout and text engines, rendering, host and webview.
| Product | SoftForge UI Designer (SoftForge.softforge-ui-designer) |
| Document | ARC-001 |
| Status | Draft; review decisions applied (D3, D5, D7, D15–D18, D20–D22, D24) |
| Date | 2026-10-10 |
| Owner | Arthur de Araújo Farias |
| Specification | SRS-001 (#1) · FMT-001 file format (#2) · CLI-001 the ud command (#3) · AI-001 agents and skills (#4) · UI-001 editor design (#6) |
UI Designer is one document per .design file. Every way of changing it (the canvas, the panels, the Command
Palette, ud, a use_figma script, an MCP client, the AI panel) runs a command from one registry against one
document core, so a change looks and behaves the same whoever made it, and every change is a signed event in the
file. This document says how the code is cut into layers, what each layer owns, where it runs, and why.
It is written for the engineers who implement and review the extension. Requirement IDs refer to SRS-001. Event names and file layout are illustrative here; FMT-001 is authoritative for anything written to disk.
VS Code window a browser (npm run dev) a terminal / Claude Code
┌──────────────────────────┐ ┌──────────────────────────┐ ┌──────────────────────────────┐
│ src/host/vscode │ │ dev/ │ │ src/cli ud <tool|cmd|verb> │
│ custom editor, commands, │ │ HTTP + event stream, │ │ src/mcp ud mcp (stdio) │
│ LM tools, licensing, AI │ │ stands in for VS Code │ │ src/headless file + lock │
└────────────┬─────────────┘ └────────────┬─────────────┘ └───────┬──────────────┬───────┘
│ Workbench, buffer │ │ no editor │ editor open
▼ ▼ ▼ ▼
┌────────────────────────────────────────────────────────────┐ (in process) src/bridge
│ src/host/controller DesignController: one per document. │◄───────────────────── socket + token
│ command queue, undo groups, merge of external events, │
│ proposals, script worker, deltas to every webview │
└────────────┬──────────────────────────────┬────────────────┘
▼ ▼ events (delta)
┌────────────────────────────┐ ┌───────────────────────────────────────────────┐
│ src/commands registry │ │ media/ webview: custom elements, <canvas> │
│ src/plugin-api figma glob.│ │ media/lib/ the same core, text, layout, │
│ src/core model, events │ │ render and commands compiled to ESM (replica) │
│ src/layout · src/text │ └───────────────────────────────────────────────┘
│ src/render │
└────────────────────────────┘Generated from issue #5 of planning.pb by
scripts/docs-specs.mjs; the board is the source of truth.
Status. Done 2026-10-10. ARC-001 complete with D3, D5, D7, D15–D18, D20–D22, D24 applied; the document now lives in the comments of this issue.
- 1. Goals and constraints
- 2. Layers and source treeThe five layers above the line (core, text, layout, render, commands) are webview-safe: they are compiled a second time with tsconfig.webview.json (lib: ["ES2022", "DOM"], types: []), so an acciden…
- 3. The command registry and the one write pathThis section realises SRS §3.1 layer 3 and CMD-13, CMD-17 to CMD-23, CMD-28 to CMD-30.
- 4. Document coreThe in-memory model is the tree of FMT-001 with every WAL event folded in.
- 5. Layout enginesrc/layout computes every position and size that is not stored (LAY-9, ADR-5).
- 6. Text enginesrc/text shapes and lays out text identically on the host, in the CLI and in the webview on one machine (TXT-5; the exact claim is §6.5).
- 7. Renderingrender/build.ts turns derived data into a display list: a tree of draw items in absolute coordinates.
- 8. Plugin API compatibility layerThis section realises SRS §3.3 (CMD-10 to CMD-16).
- 9. The `ud` CLI and the MCP serverDetails of every command and tool are in CLI-001.
- 10. The VS Code hostsrc/host/vscode/DesignEditorProvider.ts implements vscode.CustomEditorProvider<DesignDocument> for .design (PLT-1), with supportsMultipleEditorsPerDocument: true (a split view shows a second webvie…
- 11. The webviewThe page follows the SoftForge page contract of Project Board (docs/webview.md there): native ES modules, custom elements, no framework, no bundler, no stylesheet, styles set one property per line…
- 12. Performance budgetsEvery number below is a budget on the reference machine: a 2023 mid-range laptop with 4 performance cores, 16 GB of RAM, an integrated GPU and a 1440p display, running the current VS Code.
- 13. Security
- 14. Testing and CIThe headless Chromium runs use Playwright (a development dependency) against the dev server.
- 15. Build and packagingRelative imports in src/ carry .js extensions (required by Node16 resolution), so the ESM output loads in the browser without a bundler.
- 16. Decisions log