CLI Reference
cadspec <command> [options]
Project lifecycle
| Command | Description |
|---|---|
cadspec new <name> | Create a new project with multi-layer scaffold |
cadspec init | Initialize cadspec in the current directory |
cadspec build | Compile project to DXF |
cadspec build --check | Validate project and constraints without generating DXF |
cadspec build --output <path> | Compile to custom output path |
cadspec build --layer <name> | Compile a specific layer only |
cadspec watch | Auto-rebuild on file changes (300 ms debounce) |
Preview
| Command | Description |
|---|---|
cadspec serve | Live preview server (background) — browser auto-reloads on save |
cadspec serve --open --port <p> | Open browser automatically on a custom port |
cadspec serve --foreground | Stay attached: stream logs, stop with Ctrl+C |
cadspec serve --stop | Stop the background server running for this project |
cadspec preview | Faithful PNG render + preview.meta.json |
cadspec preview --format svg | Vector SVG preview (same renderer) |
cadspec preview --format all | Both PNG and SVG in one pass |
cadspec preview --3d | Axonometric 3D view (extrusions + solids) |
cadspec preview --format gltf | Export the 3D solids to scene.gltf (interactive 3D / interchange) |
cadspec preview --highlight <ids> | Amber markers around specific entities |
cadspec preview --width <w> -H <h> | Custom resolution |
cadspec preview --layer <name> | Preview a specific layer only |
cadspec preview --plano <name> | Render a named drawing sheet ([[plano]] in project.toml) |
cadspec view | Open the project in the configured viewer |
cadspec view --layer <name> | Open only one layer in the viewer |
Inspection & quality
| Command | Description |
|---|---|
cadspec check | Validate with project metadata and layer colors |
cadspec check --json | Machine-readable validation report |
cadspec layers | List layers with entity counts and colors |
cadspec layers --json | Machine-readable layer listing |
cadspec schema | Print the full .cf language reference (markdown) |
cadspec fmt | Format .cf files (normalize whitespace) |
cadspec fmt --check | Check formatting without modifying (CI) |
Import & config
| Command | Description |
|---|---|
cadspec import <file.dxf> | Import DXF into .cf layers + project.toml |
cadspec import <file.dxf> --layer <name> | Import only one DXF layer |
cadspec import <file.dxf> --output <dir> | Import into a specific directory |
cadspec config set <key> <value> | Set global defaults (author, units) |
cadspec config show | Show global defaults |
Output files
| File | Description |
|---|---|
output.dxf | Default build output |
preview.png / preview.svg | Preview renders |
scene.gltf | 3D scene export (glTF 2.0, self-contained) |
preview.meta.json | Per-entity bounding boxes (world + pixel coordinates) |