Skip to content

Development Guide

This guide covers setting up Wire-DSL for development and contributing to the project.

Wire-DSL is a monorepo using Turbo, TypeScript, and pnpm. It consists of:

  • @wire-dsl/engine – Parser, IR generator, layout engine, SVG renderer
  • @wire-dsl/exporters – PNG, PDF, SVG export (uses Playwright)
  • @wire-dsl/cli – Command-line tool for rendering wireframes
  • @wire-dsl/editor-ui – Reusable React component library
  • @wire-dsl/web – Web editor (React + Monaco)
  • apps/docs – Astro Starlight documentation site
  • apps/web – Web editor application

  • Node.js 20.x or later (check with node --version)
  • pnpm 8.x or later (install with npm install -g pnpm)
  • Git for version control
  • A code editor (VS Code recommended)

Terminal window
git clone https://github.com/wire-dsl/wire-dsl.git
cd wire-dsl
Terminal window
pnpm install

This installs all workspace dependencies and uses Turbo for intelligent caching.

Terminal window
pnpm lint
pnpm test

Terminal window
pnpm build

Compiles TypeScript, bundles outputs. Uses Turbo cache for speed.

Terminal window
pnpm dev

Starts all watch tasks simultaneously. Changes auto-rebuild.

Terminal window
pnpm test

Runs Vitest across all packages. Filter with --filter:

Terminal window
pnpm test --filter @wire-dsl/engine
Terminal window
pnpm lint
pnpm lint:fix

Uses ESLint. Fix automatically or review violations.

Terminal window
pnpm format

Uses Prettier to format all files.


Directory: packages/engine/

Start Development:

Terminal window
cd packages/engine
pnpm dev

Key Files:

  • src/parser/ – Chevrotain grammar and lexer
  • src/ir/ – IR structure and generation
  • src/layout/ – Layout calculation engine
  • src/renderer/ – SVG and PNG rendering
  • src/index.ts – Public API exports

Test Engine:

Terminal window
pnpm test --filter @wire-dsl/engine

Directory: apps/web/

Start Dev Server:

Terminal window
cd apps/web
pnpm dev

Opens at http://localhost:5173

Key Files:

  • src/components/ – Editor UI components
  • src/hooks/ – React hooks (useEditor, useTheme, etc.)
  • src/pages/ – Route pages
  • src/layout/ – Main editor layout

Features:

  • Monaco code editor on left
  • Live preview on right
  • Theme/component reference on top right
  • Keyboard shortcuts (Ctrl+Enter to preview)

Directory: packages/cli/

Test CLI:

Terminal window
pnpm cli validate examples/simple-dashboard.wire
pnpm cli render-svg examples/simple-dashboard.wire output.svg

Key Commands:

  • validate – Check syntax and semantics
  • render-svg – Generate SVG output
  • render-png – Generate PNG output (requires Playwright)
  • render-pdf – Generate PDF output (requires Playwright)

Wire-DSL/
├── .ai/ # AI development guidance
├── .github/ # GitHub workflows, templates
├── docs/ # Public documentation sources
├── specs/ # Technical specifications
│ ├── IR-CONTRACT-EN.md
│ ├── LAYOUT-ENGINE-EN.md
│ └── VALIDATION-RULES-EN.md
├── examples/ # Example .wire files
├── packages/
│ ├── engine/ # Core parser, IR, layout, renderer
│ │ ├── src/
│ │ │ ├── parser/
│ │ │ ├── ir/
│ │ │ ├── layout/
│ │ │ └── renderer/
│ │ ├── tests/
│ │ └── package.json
│ ├── cli/ # Command-line interface
│ │ ├── src/
│ │ └── tests/
│ ├── web/ # Web editor
│ │ ├── src/
│ │ └── package.json
│ ├── editor-ui/ # Reusable UI components
│ │ ├── src/
│ │ └── package.json
│ └── exporters/ # PNG, PDF export
├── apps/
│ ├── docs/ # Astro Starlight docs
│ └── web/ # Web editor app
├── package.json # Root workspace
├── pnpm-workspace.yaml # Monorepo config
└── turbo.json # Turbo build config

  1. Define in Engine (packages/engine/src/parser/grammar.ts)

    // Add to component types
    export type ComponentType = "Button" | "Input" | "YourNewComponent";
  2. Add SVG Renderer (packages/engine/src/renderer/components/)

    export function renderYourNewComponent(node: ComponentNode): string {
    // SVG rendering logic
    }
  3. Test Parsing & Rendering

    Terminal window
    pnpm test --filter @wire-dsl/engine
  4. Update Documentation (docs/COMPONENTS-REFERENCE.md)

  1. Define Command (packages/cli/src/commands/)
  2. Register in CLI (packages/cli/src/index.ts)
  3. Test
    Terminal window
    pnpm cli your-command --help
  1. Modify Component (apps/web/src/components/)
  2. Test Live
    Terminal window
    pnpm dev --filter @wire-dsl/web
  3. Test Build
    Terminal window
    pnpm build --filter @wire-dsl/web

Terminal window
pnpm test
Terminal window
pnpm test --filter @wire-dsl/engine
Terminal window
pnpm test -- --watch
Terminal window
pnpm test -- --coverage

Tests use Vitest. Key test locations:

  • packages/engine/tests/
  • packages/cli/tests/

Terminal window
pnpm typecheck

Checks all TypeScript files. Project uses strict mode.

Terminal window
pnpm lint
pnpm lint:fix

Uses ESLint with TypeScript support. Rules in .eslintrc.json.

Terminal window
pnpm format

Uses Prettier. Config in prettier.config.js.


Terminal window
git checkout -b feature/my-feature

Branch naming: feature/, fix/, docs/, chore/

Terminal window
pnpm lint:fix
pnpm format
pnpm test

Ensures quality before pushing.

  1. Push your branch
  2. Open PR against main
  3. Provide clear description
  4. Link any related issues
  5. Ensure CI passes
  6. Request review

Turbo caches build results. To clear cache:

Terminal window
pnpm turbo clean

Build only changed packages:

Terminal window
pnpm build --filter=[HEAD^]
Terminal window
pnpm test --filter @wire-dsl/engine
pnpm dev --filter @wire-dsl/web

Terminal window
rm -rf node_modules pnpm-lock.yaml
pnpm install
Terminal window
pnpm clean
pnpm install
pnpm build

Increase timeout in test file:

describe("My Tests", { timeout: 10000 }, () => {
// ...
});

If 5173 is taken:

Terminal window
pnpm dev --filter @wire-dsl/web -- --port 3000

All documentation source files are in docs/:

  • DSL-SYNTAX.md – Language grammar
  • COMPONENTS-REFERENCE.md – All components
  • ARCHITECTURE.md – System design
  • See DOCUMENTATION-INDEX.md for full list

When changing behavior, update corresponding doc.


  1. Search existing issues (may be duplicate)
  2. Check ROADMAP.md for planned work
  3. Provide detailed reproduction steps
  • Clear, descriptive title
  • Link related issues
  • Describe changes
  • Ensure tests pass
  • Update docs if needed

Wire-DSL processes wireframes through 7 layers:

  1. Lexer – Tokenization
  2. Parser – AST generation
  3. IR Generator – Semantic structure
  4. Validation – Syntax & semantic checks
  5. Layout Engine – Size calculation
  6. SVG Renderer – Vector output
  7. Exporters – PNG/PDF conversion

See Architecture for details.