Development Guide
This guide covers setting up Wire-DSL for development and contributing to the project.
Project Overview
Section titled “Project Overview”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
Prerequisites
Section titled “Prerequisites”- 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)
Initial Setup
Section titled “Initial Setup”1. Clone the Repository
Section titled “1. Clone the Repository”git clone https://github.com/wire-dsl/wire-dsl.gitcd wire-dsl2. Install Dependencies
Section titled “2. Install Dependencies”pnpm installThis installs all workspace dependencies and uses Turbo for intelligent caching.
3. Verify Installation
Section titled “3. Verify Installation”pnpm lintpnpm testMonorepo Commands
Section titled “Monorepo Commands”Build All Packages
Section titled “Build All Packages”pnpm buildCompiles TypeScript, bundles outputs. Uses Turbo cache for speed.
Development Mode (Watch)
Section titled “Development Mode (Watch)”pnpm devStarts all watch tasks simultaneously. Changes auto-rebuild.
Run Tests
Section titled “Run Tests”pnpm testRuns Vitest across all packages. Filter with --filter:
pnpm test --filter @wire-dsl/engineLint Code
Section titled “Lint Code”pnpm lintpnpm lint:fixUses ESLint. Fix automatically or review violations.
Format Code
Section titled “Format Code”pnpm formatUses Prettier to format all files.
Package-Specific Development
Section titled “Package-Specific Development”Core Engine (@wire-dsl/engine)
Section titled “Core Engine (@wire-dsl/engine)”Directory: packages/engine/
Start Development:
cd packages/enginepnpm devKey Files:
src/parser/– Chevrotain grammar and lexersrc/ir/– IR structure and generationsrc/layout/– Layout calculation enginesrc/renderer/– SVG and PNG renderingsrc/index.ts– Public API exports
Test Engine:
pnpm test --filter @wire-dsl/engineWeb Editor (@wire-dsl/web)
Section titled “Web Editor (@wire-dsl/web)”Directory: apps/web/
Start Dev Server:
cd apps/webpnpm devOpens at http://localhost:5173
Key Files:
src/components/– Editor UI componentssrc/hooks/– React hooks (useEditor, useTheme, etc.)src/pages/– Route pagessrc/layout/– Main editor layout
Features:
- Monaco code editor on left
- Live preview on right
- Theme/component reference on top right
- Keyboard shortcuts (
Ctrl+Enterto preview)
CLI (@wire-dsl/cli)
Section titled “CLI (@wire-dsl/cli)”Directory: packages/cli/
Test CLI:
pnpm cli validate examples/simple-dashboard.wirepnpm cli render-svg examples/simple-dashboard.wire output.svgKey Commands:
validate– Check syntax and semanticsrender-svg– Generate SVG outputrender-png– Generate PNG output (requires Playwright)render-pdf– Generate PDF output (requires Playwright)
File Organization
Section titled “File Organization”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 configCommon Development Tasks
Section titled “Common Development Tasks”Adding a New Component
Section titled “Adding a New Component”-
Define in Engine (
packages/engine/src/parser/grammar.ts)// Add to component typesexport type ComponentType = "Button" | "Input" | "YourNewComponent"; -
Add SVG Renderer (
packages/engine/src/renderer/components/)export function renderYourNewComponent(node: ComponentNode): string {// SVG rendering logic} -
Test Parsing & Rendering
Terminal window pnpm test --filter @wire-dsl/engine -
Update Documentation (
docs/COMPONENTS-REFERENCE.md)
Adding a CLI Command
Section titled “Adding a CLI Command”- Define Command (
packages/cli/src/commands/) - Register in CLI (
packages/cli/src/index.ts) - Test
Terminal window pnpm cli your-command --help
Updating the Web Editor
Section titled “Updating the Web Editor”- Modify Component (
apps/web/src/components/) - Test Live
Terminal window pnpm dev --filter @wire-dsl/web - Test Build
Terminal window pnpm build --filter @wire-dsl/web
Testing
Section titled “Testing”Run All Tests
Section titled “Run All Tests”pnpm testRun Specific Package
Section titled “Run Specific Package”pnpm test --filter @wire-dsl/engineWatch Mode
Section titled “Watch Mode”pnpm test -- --watchCoverage Report
Section titled “Coverage Report”pnpm test -- --coverageTests use Vitest. Key test locations:
packages/engine/tests/packages/cli/tests/
Code Quality
Section titled “Code Quality”Type Checking
Section titled “Type Checking”pnpm typecheckChecks all TypeScript files. Project uses strict mode.
Linting
Section titled “Linting”pnpm lintpnpm lint:fixUses ESLint with TypeScript support. Rules in .eslintrc.json.
Formatting
Section titled “Formatting”pnpm formatUses Prettier. Config in prettier.config.js.
Git Workflow
Section titled “Git Workflow”Creating a Feature Branch
Section titled “Creating a Feature Branch”git checkout -b feature/my-featureBranch naming: feature/, fix/, docs/, chore/
Before Committing
Section titled “Before Committing”pnpm lint:fixpnpm formatpnpm testEnsures quality before pushing.
Creating a Pull Request
Section titled “Creating a Pull Request”- Push your branch
- Open PR against
main - Provide clear description
- Link any related issues
- Ensure CI passes
- Request review
Performance Tips
Section titled “Performance Tips”Turbo Cache
Section titled “Turbo Cache”Turbo caches build results. To clear cache:
pnpm turbo cleanSelective Builds
Section titled “Selective Builds”Build only changed packages:
pnpm build --filter=[HEAD^]Filter to Specific Package
Section titled “Filter to Specific Package”pnpm test --filter @wire-dsl/enginepnpm dev --filter @wire-dsl/webTroubleshooting
Section titled “Troubleshooting”Dependencies Won’t Install
Section titled “Dependencies Won’t Install”rm -rf node_modules pnpm-lock.yamlpnpm installBuild Fails
Section titled “Build Fails”pnpm cleanpnpm installpnpm buildTests Timeout
Section titled “Tests Timeout”Increase timeout in test file:
describe("My Tests", { timeout: 10000 }, () => { // ...});Port Already in Use
Section titled “Port Already in Use”If 5173 is taken:
pnpm dev --filter @wire-dsl/web -- --port 3000Documentation Updates
Section titled “Documentation Updates”All documentation source files are in docs/:
DSL-SYNTAX.md– Language grammarCOMPONENTS-REFERENCE.md– All componentsARCHITECTURE.md– System design- See DOCUMENTATION-INDEX.md for full list
When changing behavior, update corresponding doc.
Creating Issues and PRs
Section titled “Creating Issues and PRs”Before Opening an Issue
Section titled “Before Opening an Issue”- Search existing issues (may be duplicate)
- Check ROADMAP.md for planned work
- Provide detailed reproduction steps
PR Requirements
Section titled “PR Requirements”- Clear, descriptive title
- Link related issues
- Describe changes
- Ensure tests pass
- Update docs if needed
Architecture Overview
Section titled “Architecture Overview”Wire-DSL processes wireframes through 7 layers:
- Lexer – Tokenization
- Parser – AST generation
- IR Generator – Semantic structure
- Validation – Syntax & semantic checks
- Layout Engine – Size calculation
- SVG Renderer – Vector output
- Exporters – PNG/PDF conversion
See Architecture for details.
Getting Help
Section titled “Getting Help”- Check Development Guide (this file)
- Review Architecture
- Search existing issues
- Read MONOREPO.md for project structure
- Check package-specific
README.mdfiles
Next Steps
Section titled “Next Steps”- Review the Architecture Guide
- Read the DSL Syntax
- Explore example files
- Start with good first issues