CLI Tool Reference
The Wire-DSL CLI is a command-line tool for validating, rendering, and managing Wire-DSL projects.
Installation
Section titled “Installation”Option 1: Global Installation (Recommended)
Section titled “Option 1: Global Installation (Recommended)”Install the CLI globally via npm:
npm install -g @wire-dsl/cliThen use the wire command anywhere:
wire validate myfile.wirewire render myfile.wire -o output.svgAdvantages:
- Available from any directory
- Simple command syntax
- Works after single installation
Option 2: From Source
Section titled “Option 2: From Source”For development or building from source:
cd packages/clipnpm installpnpm buildThen run commands using Node directly:
node dist/cli.js validate myfile.wirenode dist/cli.js render myfile.wire -o output.svgAdvantages:
- Test latest changes immediately
- No global installation needed
- Full control over version
Quick Commands
Section titled “Quick Commands”Validate a File
Section titled “Validate a File”Check syntax and semantic validity:
wire validate myfile.wireOutput:
- ✅ Valid file
- ✅ Detailed errors with line numbers
- ✅ Helpful suggestions for fixes
Render to SVG
Section titled “Render to SVG”Convert a .wire file to SVG:
wire render myfile.wire -o output.svgOptions:
-o, --output <path>– Output file path
Render to PDF
Section titled “Render to PDF”Convert a .wire file to PDF:
wire render myfile.wire -pdf -o output.pdfRender to PNG
Section titled “Render to PNG”Convert a .wire file to PNG:
wire render myfile.wire -png -o output.pngCommand Reference
Section titled “Command Reference”All examples use the global wire command. If using from source, replace wire with node dist/cli.js.
validate
Section titled “validate”Validate syntax and semantics of a Wire-DSL file.
Usage:
wire validate <file.wire>From Source:
node dist/cli.js validate <file.wire>Options:
--format <json|text>– Output format (default: text)
Examples:
wire validate dashboard.wirewire validate dashboard.wire --format jsonOutput:
✅ Valid Wire-DSL file - Syntax: OK - Semantics: OK - Components: 23 found - Screens: 2 foundOr with errors:
❌ Syntax Error at line 12, column 5 layout stack { component BadComponent ← Unknown component }
Suggestion: Use one of the 23 built-in componentsrender
Section titled “render”Render a Wire-DSL file to various formats.
Usage:
wire render <file.wire> [options]From Source:
node dist/cli.js render <file.wire> [options]Options:
-o, --output <path>– Output file path (required)-svg– Output as SVG (default)-png– Output as PNG-pdf– Output as PDF--width <pixels>– Canvas width (default: 1280)--height <pixels>– Canvas height (default: 720)
Examples:
# SVG (default)wire render dashboard.wire -o dashboard.svg
# PNG with custom sizewire render dashboard.wire -png -o dashboard.png --width 1920 --height 1080
# PDFwire render dashboard.wire -pdf -o dashboard.pdfFrom Source:
node dist/cli.js render dashboard.wire -o dashboard.svgnode dist/cli.js render dashboard.wire -png -o dashboard.png --width 1920Initialize a new Wire-DSL project (future feature).
wire init my-projectOr from source:
node dist/cli.js init my-projectPackage-Specific Commands
Section titled “Package-Specific Commands”Engine (Parser, Layout, Renderer)
Section titled “Engine (Parser, Layout, Renderer)”cd packages/engine
# Testpnpm testpnpm test:watch
# Buildpnpm build
# Type checkpnpm type-checkExporters (SVG, PNG, PDF)
Section titled “Exporters (SVG, PNG, PDF)”cd packages/exporters
# Testpnpm test
# Buildpnpm buildcd packages/cli
# Buildpnpm build
# Testpnpm test
# Run directly from sourcenode dist/cli.js --helpnode dist/cli.js validate <file.wire>node dist/cli.js render <file.wire> -o output.svg
# Install globally from sourcenpm install -g .wire --helpWeb Editor
Section titled “Web Editor”cd apps/web
# Dev serverpnpm dev
# Buildpnpm build
# Preview production buildpnpm previewMonorepo Commands
Section titled “Monorepo Commands”From the project root:
# Install all dependenciespnpm install
# Start all dev serverspnpm dev
# Build all packagespnpm build
# Run all testspnpm test
# Check TypeScriptpnpm type-check
# Lint codepnpm lint
# Fix linting issuespnpm lint:fix
# Format codepnpm format
# Clean all build artifactspnpm cleanFilter by Package
Section titled “Filter by Package”# Build only enginepnpm build --filter=@wire-dsl/engine
# Test only CLIpnpm test --filter=@wire-dsl/cli
# Run only affected changespnpm build --filter=[HEAD~1]Advanced Options
Section titled “Advanced Options”Show Help
Section titled “Show Help”# Global installationwire --helpwire validate --helpwire render --help
# From sourcenode dist/cli.js --helpnode dist/cli.js validate --helpVerbose Output
Section titled “Verbose Output”# Global installationwire validate myfile.wire --verbosewire render myfile.wire -o output.svg --verbose
# From sourcenode dist/cli.js validate myfile.wire --verbosenode dist/cli.js render myfile.wire -o output.svg --verboseWatch Mode (Engine)
Section titled “Watch Mode (Engine)”cd packages/enginepnpm test:watchContinuously runs tests as files change.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Syntax error in file |
| 3 | Semantic error in file |
| 4 | File not found |
| 5 | Permission denied |
Example
Section titled “Example”wire validate myfile.wireecho $? # Exit codeEnvironment Variables
Section titled “Environment Variables”Debug Mode
Section titled “Debug Mode”DEBUG=wire-dsl:* wire validate myfile.wireShows detailed debug output for troubleshooting.
Scripting
Section titled “Scripting”Batch Processing
Section titled “Batch Processing”Validate all .wire files in a directory:
# Using global installationfor file in *.wire; do wire validate "$file" && echo "✅ $file" || echo "❌ $file"done
# From sourcefor file in *.wire; do node dist/cli.js validate "$file" && echo "✅ $file" || echo "❌ $file"doneAutomated Rendering
Section titled “Automated Rendering”Render all files to SVG:
# Using global installationfor file in *.wire; do name="${file%.wire}" wire render "$file" -o "output/${name}.svg"done
# From sourcefor file in *.wire; do name="${file%.wire}" node dist/cli.js render "$file" -o "output/${name}.svg"doneCI/CD Integration
Section titled “CI/CD Integration”Validate in a pipeline:
# Using global installationwire validate *.wire || exit 1
# From sourcenode dist/cli.js validate *.wire || exit 1# GitHub Actions example- name: Validate Wire-DSL files run: | for file in wireframes/*.wire; do wire validate "$file" --format json doneTroubleshooting
Section titled “Troubleshooting”Command Not Found
Section titled “Command Not Found”If wire command is not found:
# Option 1: Install globally (if not already installed)npm install -g @wire-dsl/cli
# Option 2: Use npx (requires no installation)npx @wire-dsl/cli validate myfile.wire
# Option 3: Use from source (from monorepo)cd packages/clipnpm buildnode dist/cli.js validate myfile.wire
# Option 4: Check if installednpm list -g @wire-dsl/cliFile Not Found
Section titled “File Not Found”Ensure the file path is correct:
# Check if file existsls -la myfile.wire
# Use absolute pathwire validate /full/path/to/file.wire
# Use relative path (from current directory)wire validate ./wireframes/dashboard.wire
# Debug: List all .wire files in current directoryls *.wirePermission Denied
Section titled “Permission Denied”When rendering to a directory without write permissions:
# Check permissionsls -la output/
# Create output directory with proper permissionsmkdir -p outputchmod 755 output
# Render with full path to writable directorywire render myfile.wire -o /tmp/output.svgPort Already in Use (Web Editor)
Section titled “Port Already in Use (Web Editor)”If pnpm dev fails due to port conflicts:
# Use a different portpnpm dev --port 3001Out of Memory
Section titled “Out of Memory”For large renders:
# Increase Node.js memoryNODE_OPTIONS=--max-old-space-size=4096 wire render large.wire -o output.svgPerformance Issues
Section titled “Performance Issues”Profile and debug rendering:
# Debug modeDEBUG=wire-dsl:* wire render myfile.wire -o output.svg
# Check rendering timetime wire render myfile.wire -o output.svgSet permissions
Section titled “Set permissions”chmod 755 output
### Out of Memory
For very large files (10,000+ components):
```bash# Increase Node.js memoryNODE_OPTIONS="--max-old-space-size=4096" wire render huge.wire -o output.svgPerformance Tips
Section titled “Performance Tips”- Validate before rendering to catch errors early
- Keep files under 1,000 components for best performance
- Use the web editor for interactive development
- Batch render with scripts for multiple files
- Profile with
--verboseflag if slow