cadcraft · diff

git:20261026.76415fe to git:20261029.b8b54c3

82 added, 101 removed. Audit A to A.

---
name: cadcraft
description: >-
CADCraft is an open-source, clean-room AutoCAD-style 2D CAD and drafting app (pure Rust, egui)
for macOS, Windows, Linux, FreeBSD and the browser, with DXF/DWG file support and first-class
agent control over MCP, a JSON control channel and a headless CLI. Trigger this skill whenever
the user mentions CADCraft (or "the CAD app"), asks what it can or cannot do, which file formats
it opens or writes, its keyboard shortcuts or commands, wants to draw, edit, dimension, hatch,
block, xref, lay out, plot or export a drawing, convert/inspect/verify a DXF or DWG, script or
automate drafting (AutoLISP, .scr scripts, .pgp aliases, MCP, control channel, cadcraft-cli),
prepare assets for it, or troubleshoot it — and also when they describe the job without naming
the app ("draw a floor plan", "edit this DXF", "convert this DWG to PDF/PNG", "put dimensions on
this drawing", "check this drawing opens elsewhere").
---
# CADCraft
- Audit basis: this checkout is tag `v0.13.0`, commit `1fcf654ea8414ea2ef052ca2b3b77411f2026f78` ("Release 0.13.0", 2026-10-25). The installed `/Applications/CADCraft.app` reports version `0.13.0` (bundle id `ai.storyteller.cadcraft`) and its binary prints `cadcraft 0.13.0 (1fcf654ea8414ea2ef052ca2b3b77411f2026f78)`, so the bundle matches this source exactly. **Verify against your installed version** — the ArtCraft Launcher auto-updates. There is no `references/` directory: all detail is here with repo-relative evidence paths, and `evidence.md` beside this file tiers each claim (implemented / partial / claimed-absent).
+ Audit basis: this checkout is tag `v0.14.0`, commit `fbd97d432cdf36a566c0c53739481bd6f0c32b0d` ("Release 0.14.0", 2026-10-28). The installed `/Applications/CADCraft.app` reports version `0.14.0` (bundle id `ai.storyteller.cadcraft`) and its binary prints `cadcraft 0.14.0 (fbd97d432cdf36a566c0c53739481bd6f0c32b0d)`, so the bundle matches this source exactly. **Verify against your installed version** — the ArtCraft Launcher auto-updates. There is no `references/` directory: all detail is here with repo-relative evidence paths, and `evidence.md` beside this file tiers each claim (implemented / partial / claimed-absent).
## Overview
- CADCraft is an open-source (MIT OR Apache-2.0) 2D CAD and drafting application written in Rust (egui/eframe, wgpu) for macOS, Windows, Linux, FreeBSD and the web; source is GitHub `storytold/cadcraft` (`README.md`, `Cargo.toml`, `LICENSE-MIT`, `LICENSE-APACHE`). It is a clean-room reimplementation of Autodesk AutoCAD targeting AutoCAD 2027, 2D drafting first (`AGENTS.md` clean-room rules, `docs/target-app-parity.md`). Stage: **pre-alpha** — four of AutoCAD's five core workflows fail the alpha gate (`ROADMAP.md:3`). Scale at this tag: ≈162,600 lines of Rust outside `*/tests/` in 12 library crates, 3 apps and `xtask`; workspace version 0.13.0, edition 2024, `rust-version` 1.90 (`Cargo.toml`).
+ CADCraft is an open-source (MIT OR Apache-2.0) 2D CAD and drafting application written in Rust (egui/eframe — migrated to egui 0.37 this release, wgpu) for macOS, Windows, Linux, FreeBSD and the web; source is GitHub `storytold/cadcraft`. It is a clean-room reimplementation of Autodesk AutoCAD targeting AutoCAD 2027, 2D drafting first (`AGENTS.md` clean-room rules, `docs/target-app-parity.md`). Stage: **pre-alpha** — four of AutoCAD's five core workflows fail the alpha gate (`ROADMAP.md`).
- The differentiator: every user-visible action is a command. The engine registry holds **441** commands (`crates/engine/src/cmd/mod.rs:171`; count from the repo-generated `docs/parity-checklist.md:7`), the desktop app's catalog adds **57** UI-only entries for **498** total (`crates/ui-egui/src/menus.rs:17`, `crates/ui-egui/src/control.rs:225`), and the same ids are reachable from the command line, the JSON control channel, the MCP server and `cadcraft-cli`.
+ The differentiator: every user-visible action is a command. The engine registry holds **442** commands (`docs/parity-checklist.md` — repo-generated by `cargo xtask parity` from live `cadcraft-cli commands` output), the desktop app's catalog adds **57** UI-only entries for **499** total, and the same ids are reachable from the command line, the JSON control channel, the MCP server and `cadcraft-cli`.
- **Release delta vs v0.11.0 (measured, not copied).** Registered commands **427 → 441** (+14); menu breadth **283/491 (58%) → 296/491 (60%)**; static `CommandSpec::new(` sites **415 → 425**; UI-only commands **56 → 57**; MCP tools 15 and control methods 27 app / 12 headless are **unchanged**; CLI verbs **7**, unchanged; `acadrust` **0.6.4 → 0.6.5** (`crates/dwg/Cargo.toml`). Landed per the dated log in `docs/gaps.md:153-156`: `COMPAREEXPORT` (a comparison exported as a new grouped drawing, 2026-10-24) and `DIMTFILL`/`DIMTFILLCLR` dimension text backgrounds including DXF groups 69/70 (2026-10-24/25); APPLOAD gained a `.lsp` file browser (2026-10-22, `#1820`). The control channel now **requires a per-session token** on every request (`crates/mcp/src/control_token.rs`, `docs/control-protocol.md`) — the v0.11.0 skill documented no token, so hand-written clients need updating.
+ **Release delta vs v0.13.0 (measured, not copied).** Registered commands **441 → 442** (+1; generated checklist); menu breadth **296/491 → 297/491 (60 %)**; static `CommandSpec::new(` sites **425 → 428**; the `gc!`/`dc!` constraint macros are unchanged (12 + 6); MCP tools 15 and control methods 27 app / 12 headless are **unchanged**; CLI verbs **7**, now **parsed with clap following RFC-0012** (same surface, standard clap usage errors); `acadrust` stays **0.6.5**. Landed this release: **Blocks ▸ Modify ▸ Object ▸ Block Description…** and the Block Editor saving a changed description (PR #2113); **View ▸ Viewports ▸ Named Viewports…** (lists, restores and deletes saved viewport configurations, PR #2175); **LAYOUT's SAveas saves a layout as a drawing template** (PR #2177); **AREA and DIST gained an Arc option** that measures arc segments (PR #2193) and AREA refuses values past f64's range (PR #2162); the DXF writer escapes literal `\U+`/`\M+` backslashes (PR #2050); the drawing's `WIPEOUTFRAME` is read from its `WIPEOUTVARIABLES` object (PR #908); dynamic-block element tags read from the entity's own xdata (PR #967); associative-array parameters survive an xref load (PR #966); table commands reject a malformed handle instead of using the selected table (PR #970); in-place text editing accepts IME composition and commit (PR #1905); the MCP bridge resends once when the app refuses a token read before `--launch` opened it (PR #2098); CLI `--save`, `convert` and `sample` write through a staged file so a failed write keeps the previous drawing (PR #982); PNG export runs hairline polyline strokes as one path (faster, PR #2331); side panels dock in left/right columns and macOS Edit-menu keys edit a focused text field; the startup update prompt with self-update landed (PR #2141); Windows installs per-user by default (PR #2230).
- **Why 425 sites but 441 commands** — do not "correct" one number to the other: two `CommandSpec::new(` occurrences are the bodies of the `gc!`/`dc!` macros, and those macros are invoked 18 times (12 `gc!`, 6 `dc!`) in `crates/engine/src/cmd/constraints.rs:20-35`. 425 − 2 + 18 = 441, which matches the generated checklist exactly. Quote the generated/live number for capability claims.
+ **Why 428 sites but 442 commands** — do not "correct" one number to the other: two `CommandSpec::new(` occurrences are the bodies of the `gc!`/`dc!` macros, and those macros are invoked 18 times (12 `gc!`, 6 `dc!`) in the constraints module. 428 − 2 + 18 = 444 ≠ 442 — the generated checklist (442) counts the *live* registry, which is the number to quote for capability claims; the site arithmetic brackets it.
## Capabilities (verified)
Everything below is implemented and wired to a command/CLI/MCP/control surface unless marked **partial** or **claimed**; `evidence.md` gives the per-claim tier.
### Drawing, editing and precision
- - **Draw:** LINE, PLINE (arcs, widths), CIRCLE (center/radius/diameter, 2P, 3P), ARC, RECTANG (fillet/chamfer), POLYGON, ELLIPSE (+arcs), SPLINE, POINT, XLINE, RAY, DONUT, TEXT, MTEXT, plus MLINE, REGION and HELIX (`crates/engine/src/cmd/draw.rs`, `crates/engine/src/cmd/draw2.rs`, `crates/engine/src/cmd/draw2/mline.rs`).
- - **Modify:** ERASE, MOVE, COPY, ROTATE, SCALE, MIRROR, STRETCH (window/crossing polygons, BOX, fence), OFFSET, TRIM, EXTEND, FILLET, CHAMFER, BREAK, JOIN, EXPLODE, rectangular/polar ARRAY (associative, ARRAYEDIT; ARRAYPATH exists but is not associative), draw order, OVERKILL, LENGTHEN, ALIGN, REVERSE, FLATTEN, CHSPACE; Express Tools NCOPY, BREAKLINE, TXT2MTXT, BURST, MOCORO (`crates/engine/src/cmd/modify.rs`, `crates/engine/src/cmd/modify2.rs`, `crates/engine/src/cmd/array/`, `crates/engine/src/cmd/overkill.rs`, `crates/engine/src/cmd/draw2/breakline.rs`, `crates/engine/src/cmd/txt2mtxt.rs`, `crates/engine/src/cmd/blocks/burst.rs`).
- - **Precision:** 14 object snaps — endpoint, midpoint, center, geometric center, node, quadrant, intersection, extension, insertion, perpendicular, parallel, tangent, nearest, apparent intersection — with deferred tangent/perpendicular for a line's first point; object snap tracking; polar tracking; ortho (hold Shift to invert); grid snap; direct distance entry; `@dx,dy`, `@d<a`, `#x,y`; point modifiers FROM/M2P/TK; typed snap overrides (`crates/engine/src/snap.rs:34` `ALL: [(u32, &str); 14]`, `crates/engine/src/snap/tracking.rs`, `crates/engine/src/pointmod.rs`).
- - **Command line and grips:** prompts with clickable keywords, history (F2), AutoComplete, aliases (`.pgp` + ALIASEDIT/REINIT), transparent commands, `.scr` scripts; hot grips cycle Stretch/Move/Rotate/Scale/Mirror with Space, with Base point, Copy, Reference and Undo options (`crates/engine/src/cmd/griphot.rs`, `crates/engine/src/cmd/file/pgp.rs`). AutoComplete and right-click repeat have code and tests but were not exercised in a live window in this audit.
- - **Layers and properties:** Layers palette and Layer Properties Manager, layer tools (isolate/freeze/off/lock/match/previous/merge/delete), saved layer states, Properties palette, linetypes, lineweights, ACI/true colour, transparency, OPTIONS dialog with persisted profiles (`crates/engine/src/cmd/layer/`, `crates/engine/src/cmd/props.rs`, `crates/ui-egui/src/options/`; `docs/gaps.md` F20).
- - **Annotation:** the DIM* family — linear, aligned, angular, arc, diameter, radius, ordinate, jogged, continue, baseline, QDIM, DIMEDIT/DIMTEDIT, DIMBREAK, DIMINSPECT, DIMSTYLE create/update/override, DIMREASSOCIATE/DIMDISASSOCIATE with associative dimensions, and DIMTFILL/DIMTFILLCLR text backgrounds; MLEADER plus MLEADEREDIT/ALIGN/COLLECT and MLEADERSTYLE; TABLE with formulas, cell styles, TABLEDIT/TABLEEXPORT, table breaking and CSV data links; TOLERANCE feature-control frames; annotative scaling (SCALELISTEDIT, OBJECTSCALE, ANNOVISIBLE); on-canvas MTEXT editor with formatting toolbar; QuickCalc palette (UI-only, Cmd+8); COMPARE and COMPAREEXPORT (`crates/engine/src/cmd/annotate*.rs`, `crates/engine/src/cmd/mleader*.rs`, `crates/engine/src/cmd/table/`, `crates/engine/src/cmd/tolerance.rs`, `crates/engine/src/cmd/annoscale.rs`, `crates/engine/src/cmd/file/compare/`, `crates/ui-egui/src/palettes/quickcalc.rs`; `docs/gaps.md` F7–F12).
- - **Hatch, blocks, xrefs:** pick-point HATCH with islands, HATCHEDIT boundary add/remove, **23** standard patterns, solid and gradient fills, user `.pat` files; BLOCK/INSERT/ATTDEF, BATTMAN, ATTSYNC, ATTEDIT, DATAEXTRACTION/EATTEXT, nested blocks, groups, WBLOCK, PURGE; xrefs (XATTACH, -XREF, XBIND, XOPEN, overlays, relative paths); Block Editor for static blocks (BEDIT/BSAVE/BSAVEAS/BCLOSE); REFEDIT/REFSET/REFCLOSE in-place block-reference editing; dynamic blocks read from other files with visibility/lookup/custom-property edits and grips (`crates/doc/src/library.rs:100` `standard_patterns`, `crates/engine/src/cmd/hatch/`, `crates/engine/src/cmd/blocks/` incl. `crates/engine/src/cmd/blocks/bedit.rs`, `crates/engine/src/cmd/blocks/refedit.rs`, `crates/engine/src/cmd/blocks/dyngrip.rs`; `docs/gaps.md` F2, F3, F13).
- - **Layouts and plotting:** paper-space layouts, polygonal/object/clipped viewports (VPCLIP, VPLAYER), MSPACE/PSPACE, page setups, PLOT dialog, Plot Preview, EXPORTPDF, PUBLISH (one PDF per sheet), PDFBOOK (frame polylines → ISO A-series books), plot styles (CTB/STB) and plotter devices in CADCraft's own JSON formats (`crates/engine/src/cmd/layout.rs`, `crates/engine/src/cmd/plotters.rs`, `crates/engine/src/cmd/exchange.rs`; `docs/plot-styles.md`, `docs/plotters.md`).
- - **Parametric:** geometric and dimensional constraints, AUTOCONSTRAIN, CONSTRAINTBAR, DELCONSTRAINT, PARAMETERS with expressions, re-solve after edits, `constraints.inspect`/`constraints.dof` (`crates/constraints`, `crates/engine/src/cmd/constraints.rs`; `docs/geometry-parity.md`).
- - **AutoLISP:** `.lsp` via APPLOAD (with a `.lsp` file browser), `(load)`, drag-and-drop, or the `lisp`/`appload` commands; `(defun c:NAME)`; `acad.lsp`/`acaddoc.lsp`/`S::STARTUP` from the settings `support/` folder; `command`, `entget/entmake/entmod`, `ssget` filters, `get…` input, `vl-*` list/string/catch functions, `tblsearch/tblnext` (`docs/autolisp.md`, `crates/engine/src/cmd/lisp.rs`, `crates/engine/src/lisp/`). No Visual LISP ActiveX (`vlax-`/`vla-`), DCL dialogs, reactors or an APPLOAD Startup Suite (`docs/gaps.md` E1).
+ - **Draw:** LINE, PLINE (arcs, widths), CIRCLE (center/radius/diameter, 2P, 3P), ARC, RECTANG (fillet/chamfer), POLYGON, ELLIPSE (+arcs), SPLINE, POINT, XLINE, RAY, DONUT, TEXT, MTEXT, plus MLINE, REGION and HELIX (`crates/engine/src/cmd/draw*.rs`).
+ - **Modify:** ERASE, MOVE, COPY, ROTATE, SCALE, MIRROR, STRETCH, OFFSET, TRIM, EXTEND, FILLET, CHAMFER, BREAK, JOIN, EXPLODE, rectangular/polar ARRAY (associative, ARRAYEDIT; ARRAYPATH exists but is not associative), draw order, OVERKILL, LENGTHEN, ALIGN, REVERSE, FLATTEN, CHSPACE; Express Tools NCOPY, BREAKLINE, TXT2MTXT, BURST, MOCORO.
+ - **Precision:** 14 object snaps with deferred tangent/perpendicular; object snap tracking; polar tracking; ortho; grid snap; direct distance entry; `@dx,dy`, `@d<a`, `#x,y`; point modifiers FROM/M2P/TK; typed snap overrides (`crates/engine/src/snap.rs`).
+ - **Command line and grips:** prompts with clickable keywords, history (F2), AutoComplete, aliases (`.pgp` + ALIASEDIT/REINIT), transparent commands, `.scr` scripts; hot grips cycle Stretch/Move/Rotate/Scale/Mirror. Hex handle and colour parsing rejects a leading `+`; `wcmatch` handles patterns with many `*` wildcards; `format_angle` no longer zeroes radians near a full turn at low precision; a Fix on a derived point holds its pre-edit position.
+ - **Layers and properties:** Layers palette and Layer Properties Manager, layer tools, saved layer states, Properties palette, linetypes, lineweights, ACI/true colour, transparency, OPTIONS dialog with persisted profiles.
+ - **Annotation:** the DIM* family (linear, aligned, angular, arc, diameter, radius, ordinate, jogged, continue, baseline, QDIM, DIMEDIT/DIMTEDIT, DIMBREAK, DIMINSPECT, DIMSTYLE, DIMREASSOCIATE, DIMTFILL/DIMTFILLCLR); MLEADER family; TABLE with formulas, cell styles, TABLEDIT/TABLEEXPORT, table breaking and CSV data links (tables now reject malformed handles); TOLERANCE; annotative scaling; on-canvas MTEXT editor; QuickCalc palette; COMPARE and COMPAREEXPORT. **GETVAR CECOLOR reads back as text, as in AutoCAD** (PR #2069).
+ - **Hatch, blocks, xrefs:** pick-point HATCH with islands, HATCHEDIT, 23 standard patterns, solid and gradient fills (HATCH spline edge degree capped at 10 like the SPLINE reader), user `.pat` files; BLOCK/INSERT/ATTDEF, BATTMAN, ATTSYNC, ATTEDIT, DATAEXTRACTION/EATTEXT, nested blocks, groups, WBLOCK, PURGE; xrefs (XATTACH, -XREF, XBIND, XOPEN, overlays, relative paths); Block Editor for static blocks (BEDIT/BSAVE/BSAVEAS/BCLOSE) — **now saving a changed block description, editable through Modify ▸ Object ▸ Block Description…**; REFEDIT/REFSET/REFCLOSE; dynamic blocks read from other files with visibility/lookup/custom-property edits and grips (element tags now read from the entity's own xdata).
+ - **Layouts and plotting:** paper-space layouts, polygonal/object/clipped viewports (VPCLIP, VPLAYER), MSPACE/PSPACE, page setups, PLOT dialog, Plot Preview, EXPORTPDF, PUBLISH, PDFBOOK, plot styles (CTB/STB) and plotter devices — **plus the Named Viewports dialog (lists/restores/deletes saved viewport configurations) and LAYOUT SAveas to a drawing template**. PLOTWINDOW picks both corners even with ORTHO on.
+ - **Inquiry:** **AREA and DIST measure arc segments with the Arc option; AREA refuses values past f64's range**; long engineering-unit distances fall back to decimal.
+ - **Parametric:** geometric and dimensional constraints, AUTOCONSTRAIN, CONSTRAINTBAR, DELCONSTRAINT, PARAMETERS with expressions, re-solve after edits, `constraints.inspect`/`constraints.dof`; an ellipse solution stored with its axes swapped or mirrored still meets every constraint (PR #2082). Region intersection tests very long segments against every segment (PR #975); circle intersection judges tangency against the smaller circle (PR #976).
+ - **AutoLISP:** `.lsp` via APPLOAD (with a `.lsp` file browser), `(load)`, drag-and-drop, or the `lisp`/`appload` commands; `(defun c:NAME)`; startup files; `command`, `entget/entmake/entmod`, `ssget` filters, `get…` input, `vl-*` functions, `tblsearch/tblnext`. No Visual LISP ActiveX, DCL dialogs, reactors or Startup Suite.
+ - **Grid stability:** the grid index no longer overflows its span with a very large view (PR #979); complex text shaping omits empty outlines (PR #1960).
### Files and formats (exact, from code)
- - **Open/read:** DXF ASCII R12–2018 (one reader, no version gating) and binary R13+ (R12 binary is not read); pre-2007 files decode from `$DWGCODEPAGE` (`crates/io/src/lib.rs:62` `read()`, `crates/io/src/dxf_read.rs`, `crates/dxf/src/lib.rs:350` binary parse, `crates/dxf/src/codepage.rs`). DWG by content magic `AC10xx` through the `acadrust` **0.6.5** bridge (MPL-2.0, unmodified; R13/R14 untested, pre-R13 not read) (`crates/dwg/src/lib.rs:30` `VERSIONS`, `:35` `is_dwg`, `crates/dwg/Cargo.toml`). SVG and gzipped SVGZ (shapes, paths, groups, Inkscape layers; no CSS, `use`, fills/gradients/patterns, text, images, `rx`/`ry`; all but fills/gradients/patterns are named in a read note) (`crates/io/src/svg_read.rs:1-15`; `docs/gaps.md` FF14).
- - **Save/native:** DXF is the native path — ASCII or binary, versions 2000–2018 (default: the file's own `$ACADVER`, 2018 for a new drawing; a binary DXF stays binary on QSAVE) (`crates/io/src/lib.rs:86` `write_with()`, `crates/dxf/src/version.rs:7-20`, `crates/engine/src/cmd/file.rs:588`). DWG write 2000–2018, at least 2004 unless 2000 is explicitly asked for (`crates/io/src/lib.rs:86-100`). `.dwt` templates save via SAVEAS (written as DWG content); NEW/QNEW accept `.dwt`/`.dxf` templates (`crates/io/src/lib.rs:113`, `crates/engine/src/cmd/file.rs`; `docs/file-format-parity.md` FF3).
- - **Unmodelled content:** DXF writes back unknown entities/objects, foreign xdata, extension dictionaries, reactors, layer states and colour books (#528); through **DWG** the bridge still drops custom-class entities/objects, xdata on table records and blocks, entity colour books and reactors. SAVE/SAVEAS report what the target cannot hold in a `notSaved` field plus a command-line message, and `cadcraft-cli` writes the same warning to stderr for `.dwg`/`.dwt` output (`crates/engine/src/cmd/file.rs:517-575`, `apps/cadcraft-cli/src/main.rs:236-244`; `docs/gaps.md` FF1).
- - **Import:** another DXF/DWG's objects via `import {path|data, at?, scale?}`; user `.lin` linetypes, `.pat` hatch patterns and `.pgp` aliases (`crates/engine/src/cmd/exchange.rs:34`, `crates/engine/src/cmd/props/linfile.rs`, `crates/engine/src/cmd/hatch/patfile.rs`, `crates/engine/src/cmd/file/pgp.rs`). SVG/SVGZ is read by `open`, not by `import`; SVG geometry becomes centre-line entities in millimetres with the page's top-left corner at the origin and Y up. Stored xref/data-link paths resolve through `craft-docpath` (`craft-libs` rev `6e7f28518dd1cb57e1624bdc269c3c14316b13ae`): only local files or the document's own network share open; paths to other computers, device paths and non-file URLs are refused (`crates/engine/src/doc_path.rs:1-11`).
- - **Export:** SVG; PNG 2400×1600 (framed window or extents); vector PDF with embedded TrueType text subsets, OCG layers, multi-sheet output, hyperlinks and plotted transparency. Commands EXPORT, EXPORTPDF, PUBLISH, PDFBOOK, PLOT, PREVIEW and `cadcraft-cli convert`; EXPORT/PUBLISH/PDFBOOK return base64 `data` when no path is given (`crates/io/src/lib.rs:113` `write_framed()`, `crates/io/src/pdf.rs`, `crates/engine/src/cmd/exchange.rs:38-55`, `crates/engine/src/cmd/layout.rs:79-88`). CLI image/PDF export always renders **model space**; paper-space sheets go through PLOT/EXPORTPDF/PUBLISH. Image export warns on stderr about model-space entities it cannot draw (`apps/cadcraft-cli/src/main.rs:297`).
+ - **Open/read:** DXF ASCII R12–2018 and binary R13+; pre-2007 files decode from `$DWGCODEPAGE`. DWG by content magic through the `acadrust` **0.6.5** bridge (MPL-2.0, unmodified; R13/R14 untested, pre-R13 not read). SVG and gzipped SVGZ (shapes, paths, groups, Inkscape layers; no CSS, `use`, fills/gradients/patterns, text, images).
+ - **Save/native:** DXF is the native path — ASCII or binary, versions 2000–2018; DWG write 2000–2018. `.dwt` templates save via SAVEAS; NEW/QNEW accept `.dwt`/`.dxf` templates; **LAYOUT SAveas writes a layout as a drawing template**. The DXF writer escapes literal `\U+`/`\M+` backslashes. **CLI `--save`, `convert` and `sample` write through a staged file so a failed write keeps the previous drawing.**
+ - **Unmodelled content:** DXF writes back unknown entities/objects, foreign xdata, extension dictionaries, reactors, layer states and colour books; through **DWG** the bridge drops custom-class entities/objects, xdata on table records and blocks, entity colour books and reactors. SAVE/SAVEAS report what the target cannot hold in a `notSaved` field.
+ - **Import:** another DXF/DWG's objects via `import`; user `.lin`, `.pat` and `.pgp` files. SVG/SVGZ is read by `open`. Stored xref/data-link paths resolve through `craft-docpath`.
+ - **Export:** SVG; PNG 2400×1600 (faster: hairline polyline stroke runs share one path); vector PDF with embedded TrueType text subsets, OCG layers, multi-sheet output, hyperlinks and plotted transparency. EXPORT, EXPORTPDF, PUBLISH, PDFBOOK, PLOT, PREVIEW and `cadcraft-cli convert`; they return base64 `data` when no path is given. CLI image/PDF export always renders **model space**.
### Automation surfaces (all over the same command registry)
- - **Command catalog.** `engine.commands` / `cadcraft-cli commands` return id, label, menu path, shortcut, aliases, parameter docs and enabled state. Headless/CLI catalog = **441** engine commands; the desktop app's catalog adds **57** `UI_COMMANDS` (**498** entries) (`crates/engine/src/cmd/mod.rs:171`, `crates/ui-egui/src/menus.rs:17`, `crates/ui-egui/src/control.rs:225`). Ids are AutoCAD command names lower-cased; alias resolution prefers command ids, then user aliases, then built-in aliases (`crates/engine/src/cmd/mod.rs` `resolve_alias`).
- - **MCP server (stdio).** `cadcraft-cli mcp` (headless in-process session) or `cadcraft-cli mcp --connect 127.0.0.1:PORT [--lazy] [--launch]` (bridged to the running app; `--launch` opens CADCraft on macOS). `--lazy`/`--launch` require `--connect`; with an unreachable app the call fails with a remedy, never a silent separate drawing (`docs/mcp.md`, `crates/mcp/src/backend.rs:129-142`, `apps/cadcraft-cli/src/main.rs:730-760`). **15 tools** — 12 headless, plus 3 only when connected to the app:
-
- | Tool | Purpose |
- |---|---|
- | `command_line {text}` | Type at the prompt like a user; spaces act as Enter, empty text = Enter. |
- | `script {text}` | Run a multi-line `.scr`-style script. |
- | `execute {command, params}` | Any engine command in JSON form; never opens a dialog. |
- | `list_commands {filter?}` | Command catalog; filter matches id, label and aliases. |
- | `inspect_drawing {entities?, limit?}` | Counts, extents, layers, styles, blocks, layouts, selection, undo, `skipped`. |
- | `query_entities {type?, layer?, selected?, window?, crossing?, limit?, offset?}` | Entity pages with handles and geometry; `count` is all matches. |
- | `render {width?, height?, fit?, window?, path?}` | PNG of the drawing, returned as image content. |
- | `find_text {contains?, layer?, window?, limit?, offset?}` | TEXT/MTEXT/attributes/multileaders with position, height, rotation, style. |
- | `new_drawing {metric?}` | New imperial or metric drawing. |
- | `open {path}` | Open a drawing (whatever `open` reads). |
- | `save {path?}` | Save DXF/DWG; a `.svg`/`.png`/`.pdf` path exports instead. |
- | `cancel` | Escape: cancel the running command or clear selection. |
- | `screenshot {path?}` *(app only)* | Window PNG; needs a presented frame. |
- | `ui_inspect` *(app only)* | Panels, canvas rect, view, cursor, snap, focus, performance. |
- | `ui_click {x, y, space?, button?}` *(app only)* | Click in the drawing area; right button = Enter. |
-
- Resources: `cadcraft://drawing` and `cadcraft://commands`. Arguments are schema-checked (bad/missing arguments are JSON-RPC `-32602`; a failing tool is an `isError` result) (`crates/mcp/src/tools.rs:9-44`, `crates/mcp/src/server.rs:119-126`).
- - **JSON control channel.** Desktop app with `--control PORT` (or `CADCRAFT_CONTROL_PORT`); one JSON object per line over `127.0.0.1:PORT`. **Every request must carry `"token": "<session token>"`** or the reply is `{"ok": false, "error": "unauthorized: missing or invalid control token", "state": "not-run"}` and the connection closes. The app prints a random 256-bit token at startup to an owner-only file, `cadcraft-control-<port>.token`, in `$XDG_RUNTIME_DIR` (else `~/.cache`; `%LOCALAPPDATA%` on Windows); its path is logged at startup. Read that file yourself — the MCP bridge does it automatically (`crates/mcp/src/control_token.rs:22`, `apps/cadcraft/src/control_server.rs:52-70`, `docs/control-protocol.md`). **27 top-level methods** in the app, **12** in headless mode: `cmdline.input/script/key/state`, `engine.execute` (alias `command`), `engine.commands`, `drawing.inspect`, `ui.inspect`, `ui.elements`, `ui.menu.list`/`invoke`, `ui.pointer`, `ui.click`, `ui.move`, `ui.drag`, `ui.key`, `ui.text`, `ui.set`, `ui.resize`, `ui.focus`, `ui.screenshot`, `ui.render`, `app.open`/`save`/`quit`, `control.methods`, `ping` (`crates/ui-egui/src/control.rs:191-219`; headless list `crates/mcp/src/backend.rs:251-263`). Limits: 16 connections, 64 queued requests, 256 MiB/line, 60 s reply timeout (`state: not-run` = safe to resend, `may-have-run` = inspect first), 10 min idle, 30 s blocked-write timeout (`apps/cadcraft/src/control_server.rs:22-47`). Panel docking (`ui.dock`/`ui.dock.reset`) and `entities {selected:true}` run through `engine.execute`, not as top-level methods. `ui.set` merges any `UiState` field (palettes, `theme`, `animations`, `saveFormat`, `saveVersion`, `systemCursor`, `interfaceLanguage`). The app's `engine.execute` also runs UI commands; headless runs engine commands only.
- - **CLI `cadcraft-cli`** (not inside `/Applications/CADCraft.app`; it ships in the separate `cadcraft-cli-<ver>-macos-universal.zip`): **7 verbs** — `info`, `convert`, `run`, `commands`, `mcp`, `perf`, `sample` — plus `--version`/`--help`. Usage and framing text: `apps/cadcraft-cli/src/main.rs:66-92`; unknown options are rejected per verb (`validate_options`).
+ - **Command catalog.** `engine.commands` / `cadcraft-cli commands` return id, label, menu path, shortcut, aliases, parameter docs and enabled state. Headless/CLI catalog = **442** engine commands; the desktop app's catalog adds **57** `UI_COMMANDS` (**499** entries). Ids are AutoCAD command names lower-cased.
+ - **MCP server (stdio).** `cadcraft-cli mcp` (headless) or `cadcraft-cli mcp --connect 127.0.0.1:PORT [--lazy] [--launch]`. **15 tools** — 12 headless, plus 3 only when connected: `command_line`, `script`, `execute`, `list_commands`, `inspect_drawing`, `query_entities`, `render`, `find_text`, `new_drawing`, `open`, `save`, `cancel`, and app-only `screenshot`, `ui_inspect`, `ui_click`. **New:** the bridge resends once when the app refuses a token read before `--launch` opened it (PR #2098). Resources: `cadcraft://drawing` and `cadcraft://commands`.
+ - **JSON control channel.** Desktop app with `--control PORT`; one JSON object per line over `127.0.0.1:PORT`. **Every request must carry `"token": "<session token>"`** (unchanged this release — the server starts with a fresh session token in an owner-only file, `cadcraft-control-<port>.token`, in `$XDG_RUNTIME_DIR` (else `~/.cache`; `%LOCALAPPDATA%` on Windows); its path is logged at startup; the MCP bridge reads it automatically). **27 top-level methods** in the app, **12** in headless mode: `cmdline.input/script/key/state`, `engine.execute` (alias `command`), `engine.commands`, `drawing.inspect`, `ui.inspect`, `ui.elements`, `ui.menu.list`/`invoke`, `ui.pointer`, `ui.click`, `ui.move`, `ui.drag`, `ui.key`, `ui.text`, `ui.set`, `ui.resize`, `ui.focus`, `ui.screenshot`, `ui.render`, `app.open`/`save`/`quit`, `control.methods`, `ping`. Limits: 16 connections, 64 queued requests, 256 MiB/line, 60 s reply timeout (`state: not-run` = safe to resend, `may-have-run` = inspect first), 10 min idle, 30 s blocked-write timeout.
+ - **CLI `cadcraft-cli`** (separate zip; **arguments now parsed with clap following RFC-0012**): **7 verbs** — `info`, `convert`, `run`, `commands`, `mcp`, `perf`, `sample` — plus `--version`/`--help`.
| Command | What it does |
|---|---|
- | `info FILE` | Print `drawing.inspect` JSON (counts, extents, layers, styles, blocks, layouts, skipped). |
- | `convert IN OUT.(dxf\|dwg\|svg\|png\|pdf) [--window x0,y0,x1,y1 \| --view extents\|current]` | Format conversion / image export; PNG 2400×1600; model space only. |
- | `run [FILE \| --sample \| --metric] [--script TEXT] [--script-file F.scr] [--cmd 'id {json}']… [--save OUT] [--export OUT] [FRAMING]` | Headless edit session; `--save` writes a drawing, `--export` an image/PDF. |
- | `commands [FILTER]` | JSON command catalog; filter matches id or label (MCP also matches aliases). |
+ | `info FILE` | Print `drawing.inspect` JSON. |
+ | `convert IN OUT.(dxf\|dwg\|svg\|png\|pdf) [--window … \| --view extents\|current]` | Conversion / image export; PNG 2400×1600; model space only. |
+ | `run [FILE \| --sample \| --metric] [--script TEXT] [--script-file F.scr] [--cmd 'id {json}']… [--save OUT] [--export OUT] [FRAMING]` | Headless edit session; staged writes. |
+ | `commands [FILTER]` | JSON command catalog. |
| `mcp [--connect HOST:PORT [--lazy] [--launch]]` | MCP server on stdio. |
- | `perf [N \| FILE]` | Timing table on a synthetic N-entity drawing, or a display-list build of a file. |
- | `sample (bracket\|floorplan) OUT` | Write a built-in sample drawing in any writable format (dxf/dwg/dwt/svg/png/pdf). |
+ | `perf [N \| FILE]` | Timing table. |
+ | `sample (bracket\|floorplan) OUT` | Built-in sample drawing in any writable format. |
- `--cmd` chaining: a parameter value of exactly `"{last}"` becomes the last object handle an earlier `--cmd` returned, at any depth (`apps/cadcraft-cli/src/main.rs:79-83`). `--cmd`/`--script` results are printed as JSON lines on stdout; the command-line log goes to stderr; a failing step aborts with a non-zero exit.
- - **Scripting and import automation:** `.scr` via SCRIPT or `run --script-file`; AutoLISP via `lisp {code, inputs?}` / `appload {path | name, data}`; `.pgp` via `aliasedit`/`reinit`; `.lin` via `linetype {load, file | text, reload?}`; `.pat` via HATCH's `patternFile`/`patternText` or by typing a `.pat` name at its pattern prompt. `import` brings another DXF/DWG's objects in; `export` returns bytes/base64 when `path` is omitted; `document.bytes {format, version, binary}` returns base64 without touching a file (`crates/engine/src/cmd/file.rs:184`, `crates/engine/src/cmd/exchange.rs:33-41`).
- - **Read-back commands for agents:** `drawing.inspect` (summary + `skipped{count,sections}`), `entities` (filters/paging/`selected:true`), `texts` (readable text, formatting removed), `shapes` (perimeter/area/centroid/winding/self-intersection/`selfCheck` for closed polylines, circles, full ellipses, closed splines), `usage` (cross-reference of layers/blocks/styles/linetypes, with `unused` for PURGE), `loops` (implied closed loops from loose LINE/ARC chains, with gaps), `countlist`/`counttable`/`count`, `properties`, `list`, `dist`, `id`, `area` (`crates/engine/src/cmd/inquiry.rs:54-55` for `usage`/`loops`; `crates/engine/src/cmd/inquiry/shapes.rs`, `crates/engine/src/cmd/inquiry/loops.rs`).
+ `--cmd` chaining: `"{last}"` becomes the last object handle an earlier `--cmd` returned.
+ - **Scripting and import automation:** `.scr` via SCRIPT or `run --script-file`; AutoLISP via `lisp` / `appload`; `.pgp` via `aliasedit`/`reinit`; `.lin`/`.pat` loading; `document.bytes {format, version, binary}` returns base64 without touching a file.
+ - **Read-back commands for agents:** `drawing.inspect` (+`skipped{count,sections}`), `entities`, `texts`, `shapes` (with `selfCheck`), `usage`, `loops`, `countlist`/`counttable`/`count`, `properties`, `list`, `dist`, `id`, `area`.
### Platform notes
- - Native macOS universal app (signed, notarized DMG; CLI in a separate signed zip), Windows x64/arm64/x86 MSI (DirectX 12 default, `WGPU_BACKEND` to override), Linux x86_64/aarch64/riscv64 in AppImage/Flatpak/deb/rpm/tar, FreeBSD x86_64 tar (`README.md` Downloads; `packaging/macos/package.sh:43-44`).
- - WebAssembly build runs the same UI (WebGPU, `?webgl` WebGL2 fallback, `?cpu` canvas mode, `?sample`, `?host=parent` same-origin postMessage bridge). **No DWG**, no autosave, and saves are browser downloads (`apps/cadcraft-web/src/main.rs:1-9`; `docs/gaps.md` F4, FF12).
- - **16 interface languages**: English, Greek, Ukrainian, Brazilian Portuguese, German, Spanish, Czech, Russian, French, Simplified Chinese, Italian, Korean, Swedish, Arabic, Hungarian, Turkish; live switching via `ui.language` (`auto,en,el,uk,pt-BR,de,es,cs,ru,fr,zh,it,ko,sv,ar,hu,tr`), also `CADCRAFT_LOCALE` (`crates/ui-egui/src/i18n/mod.rs:190`, `docs/localization.md`). CJK/Arabic/Hangul need an installed matching font; engine messages and CLI/MCP replies stay English. README's status table still lists 15 and omits Greek.
- - Accessibility: the canvas hides the system cursor and draws its own crosshair — `View ▸ Accessibility ▸ Show System Cursor` / `CADCRAFT_SYSTEM_CURSOR=1` / `ui.set {"systemCursor": true}` restores it; animation effects follow the OS setting unless forced (`View ▸ Accessibility ▸ Animation Effects`, `ui.set {"animations": "on"|"off"|"system"}`, reported by `ui.inspect`) (`README.md` Accessibility, `crates/ui-egui/src/options/`).
- - 3Dconnexion SpaceMouse motion is compiled for Windows/Linux only; the macOS build has status/buttons but no motion (`apps/cadcraft/src/spacemouse.rs` cfg gates; `docs/hardware-parity.md` still lists 3D mice as absent).
+ - Native macOS universal app (signed, notarized DMG; CLI in a separate signed zip), Windows x64/arm64/x86 MSI (**per-user install by default now**), Linux x86_64/aarch64/riscv64, FreeBSD x86_64 tar.
+ - WebAssembly build runs the same UI (`?webgl`, `?cpu`, `?sample`, `?host=parent`). **No DWG**, no autosave, saves are browser downloads.
+ - **16 interface languages** (Swedish gained its 49 missing strings this release); live switching via `ui.language` and `CADCRAFT_LOCALE`. CJK/Arabic/Hangul need an installed matching font.
+ - Accessibility: system-cursor restore, animation-effects setting; **in-place text editing accepts IME composition and commit** (PR #1905).
+ - 3Dconnexion SpaceMouse motion is compiled for Windows/Linux only.
## Known limitations and not-implemented
- Read `docs/gaps.md` (the maintained work list, last updated 2026-10-25) before promising anything. `ROADMAP.md:22` still quotes an older 245/491 (50%) menu measurement from 2026-10-10 (and mixes UI-only commands into it, so it is not comparable) — the generated checklist says 296/491 (60%), with 195 reference items uncovered (`docs/parity-checklist.md`). The high-impact limits for an agent:
+ Read `docs/gaps.md` before promising anything. The generated checklist says 297/491 (60 %) menu breadth, with 194 reference items uncovered. The high-impact limits for an agent:
- - **Saving DWG is lossy.** The acadrust bridge drops custom-class entities/objects, xdata on table records and blocks, entity colour books and reactors; DXF keeps unmodelled content raw. Always check the `notSaved` report on every DWG save (`docs/gaps.md` row 1, FF1; `docs/file-format-parity.md`).
- - **No real-file corpus and no AutoCAD verification.** All file tests are synthetic (36 of them); no CADCraft output has been checked in AutoCAD black-box (`docs/gaps.md` FF5). A 10 MB DWG took ~2 min to fail (#57); size limits stop runaway conversions, throughput does not (`docs/gaps.md` FF6; `crates/dwg/src/lib.rs:8-22`).
- - **No 3D at all.** No UCS, 3D views, orbit, solids, surfaces, meshes, sections, visual styles, materials, lights or rendering (`docs/gaps.md` F24). `3DORBIT`, `ATTACH` and `SHARE` are registered only to refuse: "3DORBIT is not available yet: CADCraft draws in 2D (plan view) only", "ATTACH is not available yet: raster images and PDF/DWF/DGN underlays can't be shown yet" (`crates/engine/src/cmd/exchange.rs:56-70`). README's tagline says "2D and 3D"; the 3D half is not implemented.
- - **Curve geometry is tessellated.** Ellipse/spline intersections, offsets, trims, closest points and snaps are approximations; polyline offsets ignore bulges; tolerances are absolute (one `EPS`), and survey-scale coordinates are untested (`docs/geometry-parity.md`; `docs/gaps.md` row 3).
- - **XCLIP is missing; xrefs cannot be edited in place.** XOPEN opens the source; REFEDIT edits block references only (an xref is refused with a message, `crates/engine/src/cmd/blocks/refedit.rs:117`). No dynamic-block authoring (parameters/actions); references from other files can change visibility states, lookups, distances and positions through custom properties and grips (`docs/gaps.md` F2, F3).
- - **SHX fonts are not parsed.** SHX-style text draws with CADCraft's stroke font or `FONTALT`, so metrics differ from AutoCAD; SHX shapes in linetypes are skipped (`README.md` Fonts; `docs/gaps.md` FF8/FF9).
- - **No PDF import/underlays, no raster image attach/display** (IMAGE entities and definitions round-trip but pixels never load), no DWF/DGN/WMF/EPS/ACIS/STL exchange, no DWS standards, no system printers (`docs/gaps.md` FF10/FF11, H3; `docs/file-format-parity.md` "Other formats").
- - **Binary plot files are unread.** `.ctb`/`.stb`/`.pc3`/`.pmp` must be recreated in CADCraft's JSON formats; plot styles and device papers work otherwise (`docs/gaps.md` F14, FF9).
- - **MTEXT editing is partial.** `TEXTEDIT` (alias `DDEDIT`) replaces TEXT/MTEXT/ATTDEF/dimension text by handle, but there is no in-place formatting editor for an existing MTEXT, no fields (FIELD), no spell check, and stacked fractions show as placeholders (`crates/engine/src/cmd/modify2.rs`; `docs/gaps.md` F9).
- - **No autosave in the web build.** Desktop autosave writes DXF `.sv$` files (SAVETIME default 10 min, 0 off, max 600 minutes, SAVEFILEPATH), Drawing Recovery lists them, and AUDITCTL=1 makes AUDIT write an `.adt` log; the web build has none (`crates/engine/src/autosave.rs:24-31`, `crates/engine/src/cmd/audit.rs`; `docs/gaps.md` F4).
- - **SETVAR covers ~150 of ~1,000 variables**; no Sheet Set Manager, eTransmit, Traces, Markup Import, CUI(x) or workspaces (`docs/gaps.md` F23, U10, U12). No DIMSTYLE manager dialog, and DIMSTYLE variables are partial (F7).
- - **macOS Finder file association for `.dxf` is broken (#158)**; open positionally or via File > Open (`docs/gaps.md` U13, P3).
- - **PR quality-gate status is uncertain, and the gap row is stale.** `.github/workflows/ci.yml` triggers on every pull request and push to `main` and calls the suite's shared `gate.yml@main` from `storytold/craft-common-actions`, whose comment names `cargo xtask ci` (fmt, clippy, tests, assets, layers, wasm); `docs/gaps.md` S1 still says no PR runs it — the workflow is newer than that row. The shared gate lives in another repo and was not inspected, so whether it passes today is uncertain — check `.github/workflows/ci.yml` and the PR's checks. Also present: packaging lint, release builds, Nix/FreeBSD/Windows-ARM builds, SonarCloud analysis.
- - **No plug-in API.** ObjectARX/.NET plug-ins cannot load; a Rust→WebAssembly plug-in API is planned, not built. What an agent can extend today is AutoLISP, `.scr` scripts (SCRIPT), `.pgp` aliases, `.lin` linetypes and `.pat` patterns (`docs/customization.md`; `docs/gaps.md` E4).
- - **Web PLOT may show raw PDF bytes (#134)**; Windows/Linux get little runtime testing (`docs/gaps.md` S4, P1/P2).
- - **Claimed but unverified here (static reading only):** README's interactive-feel claims (AutoComplete, right-click repeat), "every arrowhead", associative-dimension behaviour, MTEXT bidi/OpenType shaping for Arabic-script text, per-language font availability, and SpaceMouse behaviour on Windows/Linux. Anything absent from both code and `docs/gaps.md` should also be treated as claimed-but-unverified.
+ - **Saving DWG is lossy.** The acadrust bridge drops custom-class entities/objects, xdata on table records and blocks, entity colour books and reactors; DXF keeps unmodelled content raw. Always check the `notSaved` report on every DWG save.
+ - **No real-file corpus and no AutoCAD verification.** All file tests are synthetic; no CADCraft output has been checked in AutoCAD black-box.
+ - **No 3D at all.** No UCS, 3D views, orbit, solids, surfaces, meshes, sections, visual styles, materials, lights or rendering. `3DORBIT`, `ATTACH` and `SHARE` are registered only to refuse. README's tagline says "2D and 3D"; the 3D half is not implemented.
+ - **Curve geometry is tessellated.** Ellipse/spline intersections, offsets, trims, closest points and snaps are approximations; polyline offsets ignore bulges; tolerances are absolute.
+ - **XCLIP is missing; xrefs cannot be edited in place.** REFEDIT edits block references only. No dynamic-block authoring (parameters/actions).
+ - **SHX fonts are not parsed.** SHX-style text draws with CADCraft's stroke font or `FONTALT`.
+ - **No PDF import/underlays, no raster image attach/display, no DWF/DGN/WMF/EPS/ACIS/STL exchange, no DWS standards, no system printers.**
+ - **Binary plot files are unread.** `.ctb`/`.stb`/`.pc3`/`.pmp` must be recreated in CADCraft's JSON formats.
+ - **MTEXT editing is partial.** TEXTEDIT replaces text by handle, but there is no in-place formatting editor for an existing MTEXT, no fields, no spell check, stacked fractions show as placeholders.
+ - **No autosave in the web build.** Desktop autosave writes DXF `.sv$` files; the web build has none. **Autosave no longer writes the old host as recovery when the Block Editor's changes can't be composed** (PR #980).
+ - **SETVAR covers ~150 of ~1,000 variables**; no Sheet Set Manager, eTransmit, Traces, Markup Import, CUI(x) or workspaces.
+ - **macOS Finder file association for `.dxf` is broken (#158)**; open positionally or via File > Open.
+ - **No plug-in API.** ObjectARX/.NET plug-ins cannot load. What an agent can extend today is AutoLISP, `.scr` scripts, `.pgp` aliases, `.lin` linetypes and `.pat` patterns.
+ - **Web PLOT may show raw PDF bytes (#134)**; Windows/Linux get little runtime testing.
+ - **Claimed but unverified here (static reading only):** README's interactive-feel claims (AutoComplete, right-click repeat), associative-dimension behaviour, MTEXT bidi/OpenType shaping for Arabic-script text, per-language font availability, and SpaceMouse behaviour on Windows/Linux.
## How to operate
- **Launch (macOS).** GUI binary is inside `/Applications/CADCraft.app` (`Contents/MacOS/CADCraft`); launch with `open -a "CADCraft"`. Start flags (`apps/cadcraft/src/main.rs:243-258`): `--control <port>` (a bare `--control` reuses `CADCRAFT_CONTROL_PORT`), `--sample`, `--version`/`-V`, and positional drawing paths (each opens; prefer this over Finder drag, see P3). CADCraft's own MCP `--launch` runs `open -a CADCraft --args --control PORT` (`crates/mcp/src/backend.rs`). **The bundle contains no CLI binary** — install `cadcraft-cli` from `cadcraft-cli-<ver>-macos-universal.zip` (`packaging/macos/package.sh:43-44`, `README.md` Downloads). CADCraft does not have to be running for `cadcraft-cli` or headless MCP.
+ **Launch (macOS).** GUI binary is inside `/Applications/CADCraft.app` (`Contents/MacOS/CADCraft`); launch with `open -a "CADCraft"`. Start flags: `--control <port>`, `--sample`, `--version`/`-V`, and positional drawing paths. CADCraft's own MCP `--launch` runs `open -a CADCraft --args --control PORT`. **The bundle contains no CLI binary** — install `cadcraft-cli` from `cadcraft-cli-<ver>-macos-universal.zip`. CADCraft does not have to be running for `cadcraft-cli` or headless MCP.
- Environment variables that matter: `CADCRAFT_CONTROL_PORT`, `CADCRAFT_CONFIG_DIR` (isolated profile; an empty value counts as unset), `CADCRAFT_LOCALE`, `CADCRAFT_SYSTEM_CURSOR=1`, `CADCRAFT_FONTALT`/`CADCRAFT_FONTFALLBACK`, `CADCRAFT_VSYNC`, `CADCRAFT_NO_NATIVE_MENU` (macOS), `CADCRAFT_WAYLAND=1` (Linux: keep native Wayland instead of XWayland), `WGPU_BACKEND` (Windows troubleshooting), `RUST_LOG` (`cadcraft_engine=debug` logs every command-line message) (`apps/cadcraft/src/main.rs`, `README.md`).
+ Environment variables that matter: `CADCRAFT_CONTROL_PORT`, `CADCRAFT_CONFIG_DIR`, `CADCRAFT_LOCALE`, `CADCRAFT_SYSTEM_CURSOR=1`, `CADCRAFT_FONTALT`/`CADCRAFT_FONTFALLBACK`, `CADCRAFT_VSYNC`, `CADCRAFT_NO_NATIVE_MENU`, `CADCRAFT_WAYLAND=1`, `WGPU_BACKEND`, `RUST_LOG`.
- **Settings/state (macOS).** `~/Library/Application Support/CADCraft/` holds `logs/cadcraft.log` (two rotations, 16 MiB cap), `autosave/` (`.sv$` DXF drawings), `support/` (AutoLISP startup files), and `workspace.json` (panel docking/UI choices; 64 KiB cap, versioned; invalid files are reported and left untouched) (`apps/cadcraft/src/main.rs:171-180`, `apps/cadcraft/src/workspace.rs`). The control token file lives outside it (see the control-channel bullet).
+ **Settings/state (macOS).** `~/Library/Application Support/CADCraft/` holds `logs/cadcraft.log`, `autosave/` (`.sv$` DXF drawings), `support/` (AutoLISP startup files), and `workspace.json`. The control token file lives outside it (see the control-channel bullet).
- **Document model.** One window, many drawings: each open drawing is a document with its own file tab and model/paper spaces; `document.switch {index}` switches, `close {index}`/`closeall` close them. Tool Sets, Layers, Properties and External References dock, float and persist; QuickCalc opens as a floating palette (Cmd+8); the canvas is protected (`crates/engine/src/cmd/file.rs`, `crates/ui-egui/src/menus.rs`, `docs/control-protocol.md`).
+ **Document model.** One window, many drawings: each open drawing is a document with its own file tab and model/paper spaces; `document.switch {index}` switches, `close {index}`/`closeall` close them. Tool Sets, Layers, Properties and External References dock (side panels in left/right dock columns now), float and persist; QuickCalc opens as a floating palette (Cmd+8); layout tabs stay stable when Tool Sets toggle.
- **Keyboard shortcuts (from source — do not invent others).** Engine `.key()` values: Cmd+N new, Cmd+O open, Cmd+S save, Cmd+Shift+S save as, Cmd+W close, Cmd+P plot, Cmd+Z/Cmd+Shift+Z undo/redo, Cmd+C/V/X clipboard, Cmd+Shift+C copy with base point, Cmd+Shift+V paste as block, Cmd+A select all, Cmd+Shift+A PICKSTYLE, Delete clear selection, F3 osnap, F5 isoplane, F7 grid, F8 ortho, F9 snap, F10 polar, F11 object snap tracking, F12 dynamic input (`crates/engine/src/cmd/settings.rs`, `crates/engine/src/cmd/edit.rs`, `crates/engine/src/cmd/file.rs`, `crates/engine/src/cmd/layout.rs`, `crates/engine/src/cmd/groups/pick.rs`). UI-only (`crates/ui-egui/src/menus.rs`): Cmd+1 Properties, Cmd+3 Tool Sets, Cmd+8 QuickCalc, Cmd+9 command line, F1 command reference, F2 command history, Cmd+Q quit.
+ **Keyboard shortcuts (from source — do not invent others).** Engine `.key()` values: Cmd+N new, Cmd+O open, Cmd+S save, Cmd+Shift+S save as, Cmd+W close, Cmd+P plot, Cmd+Z/Cmd+Shift+Z undo/redo, Cmd+C/V/X clipboard, Cmd+Shift+C copy with base point, Cmd+Shift+V paste as block, Cmd+A select all, Cmd+Shift+A PICKSTYLE, Delete clear selection, F3 osnap, F5 isoplane, F7 grid, F8 ortho, F9 snap, F10 polar, F11 object snap tracking, F12 dynamic input. UI-only: Cmd+1 Properties, Cmd+3 Tool Sets, Cmd+8 QuickCalc, Cmd+9 command line, F1 command reference, F2 command history, Cmd+Q quit.
- **Open/save/export flow.** The Open dialog filters DWG/DXF/DWT and SVG/SVGZ; the Save dialog offers DXF, DWG, DWT, SVG, PNG, PDF with the suggested name's type first (`apps/cadcraft/src/main.rs:129-166`). QSAVE/SAVE (Cmd+S) writes the drawing's own format/version; SAVEAS `{path, version?: 2000|2004|2007|2010|2013|2018, binary?: bool}`; the macOS save panel cannot pick a version per file — use SAVEAS JSON or File ▸ Default Save Format/Version (`docs/gaps.md` FF3). `document.bytes {format, version, binary}` returns base64 without touching a file. EXPORT writes dxf|dwg|svg|png|pdf; PLOT/EXPORTPDF write PDF through the plotter (paper-space sheets, page setups); PUBLISH one PDF per sheet; PDFBOOK builds ISO A-series books from frame polylines. In the web build, saves are downloads; there is no file system and no DWG (`apps/cadcraft-web/src/main.rs`).
+ **Open/save/export flow.** The Open dialog filters DWG/DXF/DWT and SVG/SVGZ; the Save dialog offers DXF, DWG, DWT, SVG, PNG, PDF. QSAVE/SAVE writes the drawing's own format/version; SAVEAS `{path, version?, binary?}`; the macOS save panel cannot pick a version per file. `document.bytes {format, version, binary}` returns base64 without touching a file. EXPORT writes dxf|dwg|svg|png|pdf; PLOT/EXPORTPDF write PDF through the plotter; PUBLISH one PDF per sheet; PDFBOOK builds ISO A-series books from frame polylines. In the web build, saves are downloads.
**Headless CLI (what an agent will use most).**
```sh
cadcraft-cli info drawing.dxf # JSON summary: counts, extents, layers, styles, skipped…
cadcraft-cli convert drawing.dxf out.svg # dxf|dwg|svg|png|pdf; PNG is 2400×1600
cadcraft-cli convert drawing.dwg detail.png --window 0,0,20000,15000 # frame a rectangle
cadcraft-cli run --sample --script 'CIRCLE 22,3 1\n' --save out.dxf --export out.png
cadcraft-cli run drawing.dxf --script-file setup.scr --save out.dxf
cadcraft-cli run drawing.dxf --cmd 'circle {"center":[10,10],"radius":4}' --cmd 'zoom {"mode":"extents"}' --export sel.png
cadcraft-cli run drawing.dxf --cmd 'mview {"p1":[20,20],"p2":[200,150]}' --cmd 'viewport.set {"handle":"{last}","scale":1}'
cadcraft-cli commands dim # command catalog (JSON), filtered
cadcraft-cli sample floorplan out.dxf # built-in sample drawings
cadcraft-cli mcp --connect 127.0.0.1:7979 # bridge MCP to the running app
```
- Framing rules: `convert` fits model-space extents; `run --export` uses the current view only if a command changed it (`zoom`, `pan`, `view.set`), else extents; `--window x0,y0,x1,y1` shows exactly that rectangle; `--view extents|current` forces one, and framing flags are refused for non-image output (`apps/cadcraft-cli/src/main.rs:260-268`). CLI PNG/SVG/PDF always render **model space** (`crates/io/src/lib.rs:113`). For paper-space output use PLOT/EXPORTPDF/PUBLISH, not `convert`.
+ Framing rules: `convert` fits model-space extents; `run --export` uses the current view only if a command changed it; `--window x0,y0,x1,y1` shows exactly that rectangle. CLI PNG/SVG/PDF always render **model space**.
- **Command-first workflow.** Anything the UI can do is a command: `engine.execute {command, params}` runs the JSON form with no dialogs; typing (`cmdline.input`) drives the interactive prompt machines exactly like a user (spaces act as Enter except at text prompts; empty text is Enter). A refused command-line line still replies `ok: true` — check the `error` field (`crates/ui-egui/src/control.rs:302-315`). Errors inside a command never take the app down (panic guard in `crates/engine/src/guard.rs`; `Session::execute` restores the drawing, `crates/engine/src/lib.rs`). UI commands (`ui.dock`, `ui.language`, `ui.saveformat`, …) exist only in the app catalog; headless returns "unknown command" for them.
+ **Command-first workflow.** Anything the UI can do is a command: `engine.execute {command, params}` runs the JSON form with no dialogs; typing (`cmdline.input`) drives the interactive prompt machines exactly like a user. A refused command-line line still replies `ok: true` — check the `error` field. Errors inside a command never take the app down (panic guard). UI commands exist only in the app catalog; headless returns "unknown command" for them.
## Working with an AI agent
Legitimate and reliable:
- - **Prefer the headless surfaces**: `cadcraft-cli` for one-shot work and verification, MCP (headless or bridged) for interactive sessions, the control channel when a human is watching the same window. Do not drive the GUI blindly; `ui.screenshot` needs a presented frame, so on a locked screen use `ui.render`/`render` or the CLI.
- - **Talk to the control port correctly.** Read `cadcraft-control-<port>.token` (`$XDG_RUNTIME_DIR`, else `~/.cache`) and send `"token"` in every request line, or use the MCP bridge which does it for you. Never assume a local connection is authorized.
- - **Author drawings programmatically**: `engine.execute` per entity, or a `.scr` script / `cadcraft-cli run --script-file`, is far more reliable than pointer simulation. Read back with `drawing.inspect`/`entities` (handles + geometry; `selected:true` reads the current selection), `texts` for room labels/titles, `shapes` for areas/centroids/self-intersections, `usage` before purging, `loops` to recover implied closed regions, and eyeball with `render`.
- - **Prepare/convert inputs**: `convert` turns DXF/DWG/SVG to DXF/DWG/SVG/PNG/PDF; SVG from design tools imports as paths/groups in millimetres, page top-left at the origin, Y up (fills/gradients/patterns are silently ignored; `use`, text and images are noted on open); generate drawings with `run --save`. Check `info`'s JSON before assuming contents.
- - **Interpret and repair project files**: DXF is a documented text format mapped by `crates/io/src/dxf_read.rs` / `crates/io/src/dxf_write.rs`; CADCraft-specific data (constraints, associativity, table flags, hatch gradients, plot styles, layer states, handles, multileader style) travels under the `CADCRAFT` xdata app name and `CADCRAFT_*` dictionary entries (`crates/io/src/dxf_ext.rs`). For damaged drawings use AUDIT/RECOVER; crash autosaves are `.sv$` DXF files listed by DRAWINGRECOVERY (`crates/engine/src/cmd/audit.rs`, `crates/engine/src/autosave.rs`).
- - **Verify exports before reporting success**: re-open the saved file (`cadcraft-cli info`, or `open` + `drawing.inspect`), compare entity counts/extents/layers, check `open`'s `warnings`, `drawing.inspect.skipped.count`, and the `notSaved` report (CLI prints it on stderr for `.dwg`/`.dwt`). Render to PNG and look at it.
+ - **Prefer the headless surfaces**: `cadcraft-cli` for one-shot work and verification, MCP (headless or bridged) for interactive sessions, the control channel when a human is watching the same window. Do not drive the GUI blindly; `ui.screenshot` needs a presented frame.
+ - **Talk to the control port correctly.** Read `cadcraft-control-<port>.token` (`$XDG_RUNTIME_DIR`, else `~/.cache`; `%LOCALAPPDATA%` on Windows) and send `"token"` in every request line, or use the MCP bridge which does it for you (and now retries once across a `--launch` race). Never assume a local connection is authorized.
+ - **Author drawings programmatically**: `engine.execute` per entity, or a `.scr` script / `cadcraft-cli run --script-file`, is far more reliable than pointer simulation. Read back with `drawing.inspect`/`entities`, `texts`, `shapes` (areas/centroids — now with arc-segment measuring in AREA/DIST), `usage` before purging, `loops`, and eyeball with `render`.
+ - **Prepare/convert inputs**: `convert` turns DXF/DWG/SVG to DXF/DWG/SVG/PNG/PDF; SVG imports as paths/groups in millimetres, page top-left at the origin, Y up. Check `info`'s JSON before assuming contents.
+ - **Interpret and repair project files**: DXF is a documented text format; CADCraft-specific data travels under the `CADCRAFT` xdata app name and `CADCRAFT_*` dictionary entries. For damaged drawings use AUDIT/RECOVER; crash autosaves are `.sv$` DXF files listed by DRAWINGRECOVERY.
+ - **Verify exports before reporting success**: re-open the saved file, compare entity counts/extents/layers, check `open`'s `warnings`, `drawing.inspect.skipped.count`, and the `notSaved` report (CLI prints it on stderr for `.dwg`/`.dwt`). Render to PNG and look at it. CLI writes are staged, so a failed write keeps the previous drawing.
- **Report commands with their exact ids** from `engine.commands`/`cadcraft-cli commands`; ids are AutoCAD command names lower-cased. The app catalog's `ui.*` entries are not engine commands.
- - **Counts to expect at v0.13.0**: 441 engine commands; 57 UI-only commands (498 in the app catalog); 15 MCP tools (12 headless + 3 app-only); 27 control methods app / 12 headless; 7 CLI verbs. Re-derive with `cadcraft-cli commands | jq length` rather than trusting any number, including the ones above.
+ - **Counts to expect at v0.14.0**: 442 engine commands; 57 UI-only commands (499 in the app catalog); 15 MCP tools (12 headless + 3 app-only); 27 control methods app / 12 headless; 7 CLI verbs. Re-derive with `cadcraft-cli commands | jq length` rather than trusting any number, including the ones above.
What an agent must NOT do:
- - Assume DWG saves round-trip losslessly, or that AutoCAD will open CADCraft output cleanly — nobody has verified that (see gaps). Keep an untouched copy of every received file; prefer DXF when the user's tooling allows it.
+ - Assume DWG saves round-trip losslessly, or that AutoCAD will open CADCraft output cleanly — nobody has verified that. Keep an untouched copy of every received file; prefer DXF when the user's tooling allows it.
- Assume 3D/UCS, PDF underlays, raster image display, SHX metrics, dynamic-block authoring, XCLIP, xref in-place editing, Visual LISP/DCL/reactors, fields, spell check, sheet sets, eTransmit, Traces or CUI exist. Check `docs/gaps.md` first.
- - Invent shortcuts, menu paths, flags or format names: only what is in `CommandSpec` (`crates/engine/src/cmd/`), `UI_COMMANDS` (`crates/ui-egui/src/menus.rs`) and the CLI usage string exists.
+ - Invent shortcuts, menu paths, flags or format names: only what is in `CommandSpec`, `UI_COMMANDS` and the CLI usage string exists.
- Edit `.dwg` bytes or expect a CADCraft-proprietary project format — there is none; the drawing *is* the DXF/DWG.
- Send UI-only commands to a headless MCP/CLI session, or rely on `screenshot` without a presented frame.
- - Call `app.quit` before saving: it quits without the unsaved-changes prompt (`crates/ui-egui/src/control.rs:502-507`).
- - Trust it for production/concurrent work: pre-alpha, a synthetic-only file test suite, and open correctness issues (`docs/gaps.md` Stability; the label is "pre-alpha" for a reason).
+ - Call `app.quit` before saving: it quits without the unsaved-changes prompt.
+ - Trust it for production/concurrent work: pre-alpha, a synthetic-only file test suite, and open correctness issues.
## Verification protocol
1. Work throwaway-first: `cadcraft-cli sample bracket scratch/t.dxf` (or `run --metric`), draw, save to a scratch path, re-open, inspect, delete. Never test on the only copy of a real drawing.
- 2. After every save, assert on the result: the `notSaved` field / the stderr warning must be absent (it appears when the target cannot hold something). After reading, `drawing.inspect.skipped.count` must be 0 for DXF, and `open`'s `warnings` must be empty for DWG/SVG; any entry means records or objects were left out. A silent export is not a verified export (`crates/engine/src/cmd/file.rs:517-575`, `crates/engine/src/cmd/inquiry.rs:560`, `apps/cadcraft-cli/src/main.rs:236-244`).
- 3. Round-trip discipline: new → edit → save → close → reopen → compare counts/extents/layers; then export to PNG/SVG/PDF and look at it. For CAD-interchange files, when the user has AutoCAD or another viewer, open the file there too — CADCraft cannot yet promise interoperability.
+ 2. After every save, assert on the result: the `notSaved` field / the stderr warning must be absent. After reading, `drawing.inspect.skipped.count` must be 0 for DXF, and `open`'s `warnings` must be empty for DWG/SVG. A silent export is not a verified export.
+ 3. Round-trip discipline: new → edit → save → close → reopen → compare counts/extents/layers; then export to PNG/SVG/PDF and look at it. For CAD-interchange files, when the user has AutoCAD or another viewer, open the file there too.
4. Version and back up: keep each session's output under a new name or in version control; the desktop app has SAVETIME autosave, Drawing Recovery, AUDIT and RECOVER, but the web build has none, and DWG saves can drop unmodelled content.
- 5. Update CADCraft only between projects (launcher auto-updates), and re-check this skill's claims when the version moves — this skill describes v0.13.0.
+ 5. Update CADCraft only between projects (launcher auto-updates), and re-check this skill's claims when the version moves — this skill describes v0.14.0.
## Sources & evidence
- Repo: https://github.com/storytold/cadcraft (clean-room, MIT OR Apache-2.0).
- - Inspected at tag `v0.13.0`, commit `1fcf654ea8414ea2ef052ca2b3b77411f2026f78` ("Release 0.13.0"), on 2026-10-26. The installed GUI binary prints `cadcraft 0.13.0 (1fcf654ea8414ea2ef052ca2b3b77411f2026f78)`. The launcher auto-updates, so **verify against your installed version**.
- - Key files read: `README.md`, `ROADMAP.md`, `Cargo.toml`, `AGENTS.md`; `docs/gaps.md`, `docs/parity-checklist.md`, `docs/file-format-parity.md`, `docs/control-protocol.md`, `docs/mcp.md`, `docs/autolisp.md`, `docs/customization.md`, `docs/architecture.md`, `docs/localization.md`, `docs/roadmap.md`, `docs/geometry-parity.md`, `docs/hardware-parity.md`, `docs/ui-parity.md`, `docs/target-app-parity.md`, `docs/plot-styles.md`, `docs/plotters.md`; `apps/cadcraft-cli/src/main.rs`, `apps/cadcraft/src/main.rs`, `apps/cadcraft/src/control_server.rs`, `apps/cadcraft-web/src/main.rs`; `crates/io/src/lib.rs`, `crates/io/src/dxf_read.rs`, `crates/io/src/dxf_write.rs`, `crates/io/src/svg_read.rs`, `crates/io/src/pdf.rs`, `crates/dxf/src/lib.rs`, `crates/dxf/src/version.rs`, `crates/dwg/src/lib.rs`, `crates/dwg/Cargo.toml`, `crates/engine/src/cmd/mod.rs`, `crates/engine/src/cmd/file.rs`, `crates/engine/src/cmd/exchange.rs`, `crates/engine/src/cmd/layout.rs`, `crates/engine/src/cmd/lisp.rs`, `crates/engine/src/cmd/audit.rs`, `crates/engine/src/cmd/settings.rs`, `crates/engine/src/cmd/edit.rs`, `crates/engine/src/cmd/inquiry.rs`, `crates/engine/src/cmd/modify2.rs`, `crates/engine/src/cmd/constraints.rs`, `crates/engine/src/cmd/inquiry/shapes.rs`, `crates/engine/src/cmd/inquiry/loops.rs`, `crates/engine/src/cmd/file/pgp.rs`, `crates/engine/src/cmd/file/compare/`, `crates/engine/src/cmd/blocks/bedit.rs`, `crates/engine/src/cmd/blocks/refedit.rs`, `crates/engine/src/cmd/blocks/burst.rs`, `crates/engine/src/snap.rs`, `crates/engine/src/pointmod.rs`, `crates/engine/src/autosave.rs`, `crates/engine/src/doc_path.rs`, `crates/engine/src/lisp/`, `crates/ui-egui/src/menus.rs`, `crates/ui-egui/src/control.rs`, `crates/ui-egui/src/i18n/mod.rs`, `crates/ui-egui/src/options/`, `crates/mcp/src/tools.rs`, `crates/mcp/src/server.rs`, `crates/mcp/src/backend.rs`, `crates/mcp/src/control_token.rs`, `crates/doc/src/library.rs`, `xtask/src/parity.rs`, `packaging/macos/package.sh`.
- - Shared libraries consulted: `storytold/craft-libs` rev `6e7f28518dd1cb57e1624bdc269c3c14316b13ae` (from `Cargo.toml`), chiefly `craft-docpath` (lexical path policy: a path stored in a drawing may open only a local file or one on the document's own share; remote/device/non-file URLs are refused; re-exported by `crates/engine/src/doc_path.rs`). Not cloned; behaviour read from the app-side API and docs only.
- - Read-only inspection: no build, no GUI launch, no drawing modified. The only execution was `/Applications/CADCraft.app/Contents/MacOS/CADCraft --version`. Cross-check `evidence.md` for claim-by-claim tiering (implemented / partial / claimed).
+ - Inspected at tag `v0.14.0`, commit `fbd97d432cdf36a566c0c53739481bd6f0c32b0d` ("Release 0.14.0", 2026-10-28), on 2026-10-29. The installed GUI binary prints `cadcraft 0.14.0 (fbd97d432cdf36a566c0c53739481bd6f0c32b0d)`. The launcher auto-updates, so **verify against your installed version**.
+ - Key files read: `README.md`, `Cargo.toml`, `docs/{gaps,parity-checklist,file-format-parity,control-protocol,mcp,autolisp,customization,localization}.md`; `apps/cadcraft-cli/src/main.rs`, `apps/cadcraft/src/{main.rs,control_server.rs}`, `apps/cadcraft-web/src/main.rs`; `crates/io/src/lib.rs` and DXF/SVG/PDF readers/writers, `crates/dxf/src/`, `crates/dwg/src/lib.rs`, `crates/engine/src/cmd/` (registry + draw/modify/annotate/blocks/layout/exchange/inquiry/constraints/lisp/audit), `crates/engine/src/{snap.rs,autosave.rs,doc_path.rs,graphics.rs}`, `crates/ui-egui/src/{menus.rs,control.rs,i18n/}`, `crates/mcp/src/{tools.rs,server.rs,backend.rs,control_token.rs}`, `crates/doc/src/library.rs`, `xtask/src/parity.rs`.
+ - Shared libraries consulted: all `storytold/craft-libs` crates pinned at one revision, `92d392cf…` (`Cargo.toml`), chiefly `craft-docpath` (stored-path policy) and `craft-pdf`; not cloned.
+ - Read-only inspection: no build, no GUI launch, no drawing modified. The only execution was `/Applications/CADCraft.app/Contents/MacOS/CADCraft --version`. Cross-check `evidence.md` for claim-by-claim tiering.