From d9ab00c53c1250bb2e681bf7b26044c78888af3b Mon Sep 17 00:00:00 2001
From: Brandon Thomas
Date: Mon, 5 Oct 2026 23:22:25 -0400
Subject: [PATCH] M0: CADCraft skeleton and vertical slice
Workspace (geom, dxf, color, doc, fonts, render, io, engine, ui-egui, mcp; apps cadcraft,
cadcraft-cli, cadcraft-web; xtask), AutoCAD-for-Mac style UI with code-drawn icons, command line
with prompts/keywords/AutoComplete, draw and modify commands, object snaps, polar/ortho,
selection, undo, layers and properties palettes, DXF read/write, SVG/PNG export, MCP server,
JSON control channel, CLI, wasm build, README, ROADMAP, AGENTS.md.
Co-Authored-By: Claude Opus 5.5
---
.gitignore | 11 +-
AGENTS.md | 49 +
ATTRIBUTION.md | 43 +
CLAUDE.md | 49 +
Cargo.lock | 4590 ++++++++++++++++++++++++
Cargo.toml | 64 +
LICENSE-APACHE | 177 +
LICENSE-MIT | 21 +
NOTICE | 18 +
README.md | 220 +-
ROADMAP.md | 52 +
apps/cadcraft-cli/Cargo.toml | 17 +
apps/cadcraft-cli/src/main.rs | 159 +
apps/cadcraft-web/Cargo.toml | 28 +
apps/cadcraft-web/Trunk.toml | 10 +
apps/cadcraft-web/index.html | 19 +
apps/cadcraft-web/src/main.rs | 84 +
apps/cadcraft/Cargo.toml | 29 +
apps/cadcraft/build.rs | 28 +
apps/cadcraft/src/control_server.rs | 62 +
apps/cadcraft/src/main.rs | 143 +
apps/cadcraft/src/native_menu.rs | 98 +
assets/app-icon/cadcraft-1024.png | Bin 0 -> 56907 bytes
assets/app-icon/cadcraft-128.png | Bin 0 -> 7996 bytes
assets/app-icon/cadcraft-16.png | Bin 0 -> 807 bytes
assets/app-icon/cadcraft-256.png | Bin 0 -> 16017 bytes
assets/app-icon/cadcraft-32.png | Bin 0 -> 2246 bytes
assets/app-icon/cadcraft-48.png | Bin 0 -> 3333 bytes
assets/app-icon/cadcraft-512.png | Bin 0 -> 32166 bytes
assets/app-icon/cadcraft-64.png | Bin 0 -> 4190 bytes
assets/app-icon/cadcraft-macos-512.png | Bin 0 -> 33106 bytes
clippy.toml | 4 +
crates/color/Cargo.toml | 12 +
crates/color/src/lib.rs | 265 ++
crates/doc/Cargo.toml | 16 +
crates/doc/src/entity.rs | 897 +++++
crates/doc/src/extents.rs | 126 +
crates/doc/src/header.rs | 146 +
crates/doc/src/lib.rs | 237 ++
crates/doc/src/library.rs | 195 +
crates/doc/src/store.rs | 248 ++
crates/doc/src/tables.rs | 412 +++
crates/doc/src/tests.rs | 108 +
crates/dxf/Cargo.toml | 12 +
crates/dxf/src/lib.rs | 458 +++
crates/engine/Cargo.toml | 20 +
crates/engine/src/cmd/draw.rs | 1406 ++++++++
crates/engine/src/cmd/edit.rs | 274 ++
crates/engine/src/cmd/file.rs | 198 +
crates/engine/src/cmd/helpers.rs | 93 +
crates/engine/src/cmd/inquiry.rs | 450 +++
crates/engine/src/cmd/layer.rs | 315 ++
crates/engine/src/cmd/machines.rs | 101 +
crates/engine/src/cmd/mod.rs | 219 ++
crates/engine/src/cmd/modify.rs | 1887 ++++++++++
crates/engine/src/cmd/props.rs | 459 +++
crates/engine/src/cmd/settings.rs | 167 +
crates/engine/src/cmd/view.rs | 321 ++
crates/engine/src/lib.rs | 871 +++++
crates/engine/src/prompt.rs | 200 ++
crates/engine/src/sample.rs | 271 ++
crates/engine/src/select.rs | 176 +
crates/engine/src/snap.rs | 389 ++
crates/engine/src/sysvars.rs | 157 +
crates/engine/src/tests.rs | 324 ++
crates/engine/src/units.rs | 226 ++
crates/fonts/Cargo.toml | 12 +
crates/fonts/src/lib.rs | 284 ++
crates/fonts/src/mtext.rs | 169 +
crates/fonts/src/stroke.rs | 131 +
crates/geom/Cargo.toml | 12 +
crates/geom/src/bounds.rs | 77 +
crates/geom/src/curve.rs | 516 +++
crates/geom/src/intersect.rs | 101 +
crates/geom/src/lib.rs | 72 +
crates/geom/src/mat.rs | 149 +
crates/geom/src/spline.rs | 226 ++
crates/geom/src/tests.rs | 159 +
crates/geom/src/vec.rs | 199 +
crates/io/Cargo.toml | 17 +
crates/io/src/dxf_read.rs | 791 ++++
crates/io/src/dxf_write.rs | 982 +++++
crates/io/src/lib.rs | 63 +
crates/io/src/svg.rs | 76 +
crates/io/src/tests.rs | 221 ++
crates/mcp/Cargo.toml | 16 +
crates/mcp/src/backend.rs | 188 +
crates/mcp/src/lib.rs | 19 +
crates/mcp/src/server.rs | 133 +
crates/mcp/src/tests.rs | 73 +
crates/mcp/src/tools.rs | 87 +
crates/render/Cargo.toml | 16 +
crates/render/src/dim.rs | 260 ++
crates/render/src/fill.rs | 123 +
crates/render/src/hatch.rs | 95 +
crates/render/src/lib.rs | 564 +++
crates/render/src/linetype.rs | 121 +
crates/render/src/raster.rs | 139 +
crates/render/src/tests.rs | 117 +
crates/ui-egui/Cargo.toml | 21 +
crates/ui-egui/src/canvas.rs | 669 ++++
crates/ui-egui/src/chrome.rs | 353 ++
crates/ui-egui/src/cmdline.rs | 244 ++
crates/ui-egui/src/control.rs | 295 ++
crates/ui-egui/src/dialogs.rs | 228 ++
crates/ui-egui/src/icons.rs | 889 +++++
crates/ui-egui/src/lib.rs | 333 ++
crates/ui-egui/src/menus.rs | 304 ++
crates/ui-egui/src/palettes.rs | 812 +++++
crates/ui-egui/src/theme.rs | 154 +
docs/brand/LICENSE-brand.txt | 42 +
docs/brand/artcraft-logo-white.png | Bin 0 -> 32161 bytes
docs/brand/artcraft-logo-white.svg | 7 +
docs/brand/artcraft-logo.png | Bin 0 -> 31302 bytes
docs/brand/artcraft-logo.svg | 7 +
docs/brand/artcraft-mark-black.png | Bin 0 -> 26793 bytes
docs/brand/artcraft-mark-black.svg | 4 +
docs/brand/artcraft-mark.png | Bin 0 -> 24715 bytes
docs/brand/artcraft-mark.svg | 4 +
docs/control-protocol.md | 34 +
docs/images/ui-bracket.png | Bin 0 -> 407011 bytes
docs/parity.md | 394 ++
rustfmt.toml | 2 +
xtask/Cargo.toml | 9 +
xtask/data/menu-catalog.txt | 560 +++
xtask/src/assets.rs | 55 +
xtask/src/ico.rs | 104 +
xtask/src/layers.rs | 332 ++
xtask/src/main.rs | 205 ++
xtask/src/parity.rs | 96 +
xtask/src/stats.rs | 118 +
xtask/src/version.rs | 152 +
132 files changed, 30261 insertions(+), 5 deletions(-)
create mode 100644 AGENTS.md
create mode 100644 ATTRIBUTION.md
create mode 100644 CLAUDE.md
create mode 100644 Cargo.lock
create mode 100644 Cargo.toml
create mode 100644 LICENSE-APACHE
create mode 100644 LICENSE-MIT
create mode 100644 NOTICE
create mode 100644 ROADMAP.md
create mode 100644 apps/cadcraft-cli/Cargo.toml
create mode 100644 apps/cadcraft-cli/src/main.rs
create mode 100644 apps/cadcraft-web/Cargo.toml
create mode 100644 apps/cadcraft-web/Trunk.toml
create mode 100644 apps/cadcraft-web/index.html
create mode 100644 apps/cadcraft-web/src/main.rs
create mode 100644 apps/cadcraft/Cargo.toml
create mode 100644 apps/cadcraft/build.rs
create mode 100644 apps/cadcraft/src/control_server.rs
create mode 100644 apps/cadcraft/src/main.rs
create mode 100644 apps/cadcraft/src/native_menu.rs
create mode 100644 assets/app-icon/cadcraft-1024.png
create mode 100644 assets/app-icon/cadcraft-128.png
create mode 100644 assets/app-icon/cadcraft-16.png
create mode 100644 assets/app-icon/cadcraft-256.png
create mode 100644 assets/app-icon/cadcraft-32.png
create mode 100644 assets/app-icon/cadcraft-48.png
create mode 100644 assets/app-icon/cadcraft-512.png
create mode 100644 assets/app-icon/cadcraft-64.png
create mode 100644 assets/app-icon/cadcraft-macos-512.png
create mode 100644 clippy.toml
create mode 100644 crates/color/Cargo.toml
create mode 100644 crates/color/src/lib.rs
create mode 100644 crates/doc/Cargo.toml
create mode 100644 crates/doc/src/entity.rs
create mode 100644 crates/doc/src/extents.rs
create mode 100644 crates/doc/src/header.rs
create mode 100644 crates/doc/src/lib.rs
create mode 100644 crates/doc/src/library.rs
create mode 100644 crates/doc/src/store.rs
create mode 100644 crates/doc/src/tables.rs
create mode 100644 crates/doc/src/tests.rs
create mode 100644 crates/dxf/Cargo.toml
create mode 100644 crates/dxf/src/lib.rs
create mode 100644 crates/engine/Cargo.toml
create mode 100644 crates/engine/src/cmd/draw.rs
create mode 100644 crates/engine/src/cmd/edit.rs
create mode 100644 crates/engine/src/cmd/file.rs
create mode 100644 crates/engine/src/cmd/helpers.rs
create mode 100644 crates/engine/src/cmd/inquiry.rs
create mode 100644 crates/engine/src/cmd/layer.rs
create mode 100644 crates/engine/src/cmd/machines.rs
create mode 100644 crates/engine/src/cmd/mod.rs
create mode 100644 crates/engine/src/cmd/modify.rs
create mode 100644 crates/engine/src/cmd/props.rs
create mode 100644 crates/engine/src/cmd/settings.rs
create mode 100644 crates/engine/src/cmd/view.rs
create mode 100644 crates/engine/src/lib.rs
create mode 100644 crates/engine/src/prompt.rs
create mode 100644 crates/engine/src/sample.rs
create mode 100644 crates/engine/src/select.rs
create mode 100644 crates/engine/src/snap.rs
create mode 100644 crates/engine/src/sysvars.rs
create mode 100644 crates/engine/src/tests.rs
create mode 100644 crates/engine/src/units.rs
create mode 100644 crates/fonts/Cargo.toml
create mode 100644 crates/fonts/src/lib.rs
create mode 100644 crates/fonts/src/mtext.rs
create mode 100644 crates/fonts/src/stroke.rs
create mode 100644 crates/geom/Cargo.toml
create mode 100644 crates/geom/src/bounds.rs
create mode 100644 crates/geom/src/curve.rs
create mode 100644 crates/geom/src/intersect.rs
create mode 100644 crates/geom/src/lib.rs
create mode 100644 crates/geom/src/mat.rs
create mode 100644 crates/geom/src/spline.rs
create mode 100644 crates/geom/src/tests.rs
create mode 100644 crates/geom/src/vec.rs
create mode 100644 crates/io/Cargo.toml
create mode 100644 crates/io/src/dxf_read.rs
create mode 100644 crates/io/src/dxf_write.rs
create mode 100644 crates/io/src/lib.rs
create mode 100644 crates/io/src/svg.rs
create mode 100644 crates/io/src/tests.rs
create mode 100644 crates/mcp/Cargo.toml
create mode 100644 crates/mcp/src/backend.rs
create mode 100644 crates/mcp/src/lib.rs
create mode 100644 crates/mcp/src/server.rs
create mode 100644 crates/mcp/src/tests.rs
create mode 100644 crates/mcp/src/tools.rs
create mode 100644 crates/render/Cargo.toml
create mode 100644 crates/render/src/dim.rs
create mode 100644 crates/render/src/fill.rs
create mode 100644 crates/render/src/hatch.rs
create mode 100644 crates/render/src/lib.rs
create mode 100644 crates/render/src/linetype.rs
create mode 100644 crates/render/src/raster.rs
create mode 100644 crates/render/src/tests.rs
create mode 100644 crates/ui-egui/Cargo.toml
create mode 100644 crates/ui-egui/src/canvas.rs
create mode 100644 crates/ui-egui/src/chrome.rs
create mode 100644 crates/ui-egui/src/cmdline.rs
create mode 100644 crates/ui-egui/src/control.rs
create mode 100644 crates/ui-egui/src/dialogs.rs
create mode 100644 crates/ui-egui/src/icons.rs
create mode 100644 crates/ui-egui/src/lib.rs
create mode 100644 crates/ui-egui/src/menus.rs
create mode 100644 crates/ui-egui/src/palettes.rs
create mode 100644 crates/ui-egui/src/theme.rs
create mode 100644 docs/brand/LICENSE-brand.txt
create mode 100644 docs/brand/artcraft-logo-white.png
create mode 100644 docs/brand/artcraft-logo-white.svg
create mode 100644 docs/brand/artcraft-logo.png
create mode 100644 docs/brand/artcraft-logo.svg
create mode 100644 docs/brand/artcraft-mark-black.png
create mode 100644 docs/brand/artcraft-mark-black.svg
create mode 100644 docs/brand/artcraft-mark.png
create mode 100644 docs/brand/artcraft-mark.svg
create mode 100644 docs/control-protocol.md
create mode 100644 docs/images/ui-bracket.png
create mode 100644 docs/parity.md
create mode 100644 rustfmt.toml
create mode 100644 xtask/Cargo.toml
create mode 100644 xtask/data/menu-catalog.txt
create mode 100644 xtask/src/assets.rs
create mode 100644 xtask/src/ico.rs
create mode 100644 xtask/src/layers.rs
create mode 100644 xtask/src/main.rs
create mode 100644 xtask/src/parity.rs
create mode 100644 xtask/src/stats.rs
create mode 100644 xtask/src/version.rs
diff --git a/.gitignore b/.gitignore
index 0807ae54..c2708975 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,10 @@
*~
-plan/
-plans/
+/target
+/plan/
+/plans/
+/dist/
+/log/
+/temp/
+.DS_Store
+*.swp
+/apps/cadcraft-web/dist/
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 00000000..3fb0979f
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,49 @@
+# CADCraft — instructions for agents
+
+CADCraft is a clean-room, open-source, pure-Rust computer-aided design and drafting application targeting Autodesk AutoCAD parity — and superiority (speed, openness, agent control). It runs natively on macOS, Windows, Linux and FreeBSD, and on the web via WASM. Siblings with the same conventions: `../photocraft` (Photoshop-class), `../vectorcraft` (Illustrator), `../filmcraft` (Premiere), `../lightcraft` (Lightroom), `../printcraft` (Acrobat), `../effectcraft` (After Effects), `../designcraft` (InDesign).
+
+Standards and learnings shared across the crafting apps live in `../../craftrules` (or `storytold/craftrules`). Read its `AGENTS.md` at the start of a session, follow its standards, and contribute reusable learnings back there. Never code: repos don't share code.
+
+## Start every session here
+1. Read `plan/STATUS.md` (current milestone, next task), then the task in `plan/execution-plan.md` and the relevant `plan/architecture.md` section. Behaviour reference: `plan/autocad/*` (`01-observed-ui.md` holds measured observations of the running reference app; `04-menu-tree.txt` the menu tree by name).
+2. Library decisions: `plan/adr/0001-geometry-libraries.md` (what we may depend on, what is rejected for licence reasons).
+3. Follow the autonomous operation protocol (`plan/execution-plan.md` §6). Don't stop to ask unless it lists the decision as the owner's.
+
+`plan/` is gitignored (local only).
+
+## Never crash
+People trust CADCraft with their drawings; a crash loses their work. **This outranks feature work.** Standard: [`craftrules/standards/never-crash.md`](https://github.com/storytold/craftrules/blob/main/standards/never-crash.md).
+- **No panics in non-test code:** no `unwrap()`, `expect()`, `panic!`, `unreachable!`, `todo!`, `unimplemented!`; no `unsafe` (`unsafe_code = "forbid"`).
+- **Errors are `Result`** through the crate's error type and `?`. An unfinished feature returns an error or reports "not available yet"; it never panics.
+- **Input-derived numbers are hostile** (DXF/DWG files, command-line text, MCP/control params): `get()` not `[i]`, checked arithmetic, no NaN casts, cap input-sized allocations and loop counts.
+- **Bound recursion** (nested/cyclic block references: `MAX_BLOCK_DEPTH`).
+- **Last-resort guard:** `Session::execute` and interactive command input run under `catch_unwind`; an escaped panic restores the drawing and reports an error.
+- **Prove it:** every crash fix lands with a regression test (see `hostile_params_never_panic`, `hostile_dxf_does_not_panic`).
+- Every production crate root carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`.
+
+## Non-negotiables
+- **Clean-room.** AutoCAD is installed on the dev machine and may be *observed* black-box: run it, use its UI with synthetic drawings, take screenshots (by window id) stored only under `plan/autocad/screenshots/` (never committed). **Never** read, disassemble or copy anything inside the AutoCAD bundle (names/listings only); never copy Autodesk fonts (SHX), hatch patterns (`.pat`), linetypes (`.lin`), templates, CUI/PGP files, icons, artwork or help text; never commit files produced by AutoCAD. File formats come from public specifications (Autodesk's published DXF Reference, the Open Design Alliance's public DWG specification) and our own synthetic tests. Never copy or link GPL/LGPL/AGPL code (LibreDWG, LibreCAD, QCAD, FreeCAD's planegcs, SolveSpace, OpenCASCADE) — don't even read their sources.
+- **Assets — absolutely essential.** CADCraft contains **no Autodesk, Adobe or Avid iconography, images, fonts, patterns or artwork — ever.** Every icon is drawn in code (`crates/ui-egui/src/icons.rs`), every hatch pattern and linetype is our own definition (`crates/doc/src/library.rs`), the drafting font is our own (`crates/fonts/src/stroke.rs`). Any file asset must be original, public domain/CC0, OSI-licensed, or redistributable Creative Commons (or licensed open source by a contributor who made it), and **must have a row in `ATTRIBUTION.md`** with author, source and licence (`cargo xtask assets` enforces it). The only exception is the ArtCraft brand in `docs/brand/` (trademarks, `docs/brand/LICENSE-brand.txt`). Screenshots of Autodesk software are never committed. Breaking this rule is the most serious mistake you can make in this repo.
+- **Fonts live in [`storytold/craft-fonts`](https://github.com/storytold/craft-fonts)**, never in this repo. It is an optional build input (`CRAFT_FONTS_DIR`), never a `Cargo.toml` dependency. Code and tests must work without it.
+- **Shared test corpora** live in separate repos (`storytold/-corpus`); never commit large binary fixtures here.
+- **Everything is a command.** User-visible behaviour = a command in `crates/engine/src/cmd/*` (`CommandSpec`: id = AutoCAD's command name in lower case, label, menu path, shortcut, aliases, params doc, `enabled`, JSON `run`, optional `interactive` prompt machine) + tests. UI-only commands live in `crates/ui-egui/src/menus.rs` (`UI_COMMANDS`). The command line, menus, toolbar, Tool Sets, scripts, CLI, control channel and MCP all reach the same commands.
+- **Programmatic calls never open dialogs.** `engine.execute` runs the JSON form with defaults; only menu/toolbar invocation starts the interactive prompt sequence.
+- **Layering** is enforced by `cargo xtask layers`: L0 `geom`, `dxf` → L1 `color`, `doc` → L2 `fonts`, `render` → L3 `io` → L4 `engine` → L5 `ui-egui`, `mcp` → apps. Nothing below L5 depends on egui/eframe/winit/wgpu/rfd. **The UI crate is swappable.**
+- **The UI is thin**: panels read engine state and act through `app.run(id, params)` / `app.start(id)` / `app.cmdline(text)`. Colours come from `theme::Tokens`.
+- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
+- **Quality gates** before every commit: `cargo xtask ci` (fmt, clippy -D warnings, tests, assets, layers, wasm). Commit after every feature arc that builds, and push to `main`.
+
+## Running and looking at the app
+- `cargo run --release -p cadcraft -- --sample --control PORT` (sample drawing + control channel). Pick a free port; other crafting apps use control ports too.
+- Drive it with JSON lines on `127.0.0.1:PORT`:
+ - `{"id":1,"method":"cmdline.input","params":{"text":"circle 0,0 5"}}` — type at the command line exactly like a user (prompts, keywords, `@dx,dy`, `@d`** through the crate's error type and `?`. An unfinished feature returns an error or reports "not available yet"; it never panics.
+- **Input-derived numbers are hostile** (DXF/DWG files, command-line text, MCP/control params): `get()` not `[i]`, checked arithmetic, no NaN casts, cap input-sized allocations and loop counts.
+- **Bound recursion** (nested/cyclic block references: `MAX_BLOCK_DEPTH`).
+- **Last-resort guard:** `Session::execute` and interactive command input run under `catch_unwind`; an escaped panic restores the drawing and reports an error.
+- **Prove it:** every crash fix lands with a regression test (see `hostile_params_never_panic`, `hostile_dxf_does_not_panic`).
+- Every production crate root carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`.
+
+## Non-negotiables
+- **Clean-room.** AutoCAD is installed on the dev machine and may be *observed* black-box: run it, use its UI with synthetic drawings, take screenshots (by window id) stored only under `plan/autocad/screenshots/` (never committed). **Never** read, disassemble or copy anything inside the AutoCAD bundle (names/listings only); never copy Autodesk fonts (SHX), hatch patterns (`.pat`), linetypes (`.lin`), templates, CUI/PGP files, icons, artwork or help text; never commit files produced by AutoCAD. File formats come from public specifications (Autodesk's published DXF Reference, the Open Design Alliance's public DWG specification) and our own synthetic tests. Never copy or link GPL/LGPL/AGPL code (LibreDWG, LibreCAD, QCAD, FreeCAD's planegcs, SolveSpace, OpenCASCADE) — don't even read their sources.
+- **Assets — absolutely essential.** CADCraft contains **no Autodesk, Adobe or Avid iconography, images, fonts, patterns or artwork — ever.** Every icon is drawn in code (`crates/ui-egui/src/icons.rs`), every hatch pattern and linetype is our own definition (`crates/doc/src/library.rs`), the drafting font is our own (`crates/fonts/src/stroke.rs`). Any file asset must be original, public domain/CC0, OSI-licensed, or redistributable Creative Commons (or licensed open source by a contributor who made it), and **must have a row in `ATTRIBUTION.md`** with author, source and licence (`cargo xtask assets` enforces it). The only exception is the ArtCraft brand in `docs/brand/` (trademarks, `docs/brand/LICENSE-brand.txt`). Screenshots of Autodesk software are never committed. Breaking this rule is the most serious mistake you can make in this repo.
+- **Fonts live in [`storytold/craft-fonts`](https://github.com/storytold/craft-fonts)**, never in this repo. It is an optional build input (`CRAFT_FONTS_DIR`), never a `Cargo.toml` dependency. Code and tests must work without it.
+- **Shared test corpora** live in separate repos (`storytold/-corpus`); never commit large binary fixtures here.
+- **Everything is a command.** User-visible behaviour = a command in `crates/engine/src/cmd/*` (`CommandSpec`: id = AutoCAD's command name in lower case, label, menu path, shortcut, aliases, params doc, `enabled`, JSON `run`, optional `interactive` prompt machine) + tests. UI-only commands live in `crates/ui-egui/src/menus.rs` (`UI_COMMANDS`). The command line, menus, toolbar, Tool Sets, scripts, CLI, control channel and MCP all reach the same commands.
+- **Programmatic calls never open dialogs.** `engine.execute` runs the JSON form with defaults; only menu/toolbar invocation starts the interactive prompt sequence.
+- **Layering** is enforced by `cargo xtask layers`: L0 `geom`, `dxf` → L1 `color`, `doc` → L2 `fonts`, `render` → L3 `io` → L4 `engine` → L5 `ui-egui`, `mcp` → apps. Nothing below L5 depends on egui/eframe/winit/wgpu/rfd. **The UI crate is swappable.**
+- **The UI is thin**: panels read engine state and act through `app.run(id, params)` / `app.start(id)` / `app.cmdline(text)`. Colours come from `theme::Tokens`.
+- **Rust only** (no handwritten JS/TS). **Never break wasm** (`cargo xtask wasm`).
+- **Quality gates** before every commit: `cargo xtask ci` (fmt, clippy -D warnings, tests, assets, layers, wasm). Commit after every feature arc that builds, and push to `main`.
+
+## Running and looking at the app
+- `cargo run --release -p cadcraft -- --sample --control PORT` (sample drawing + control channel). Pick a free port; other crafting apps use control ports too.
+- Drive it with JSON lines on `127.0.0.1:PORT`:
+ - `{"id":1,"method":"cmdline.input","params":{"text":"circle 0,0 5"}}` — type at the command line exactly like a user (prompts, keywords, `@dx,dy`, `@d
+
+
+
+
+
+
+
-By ArtCraft
+
CADCraft
+
+
+ Computer-aided design and drafting; an open-source, clean-room reimplementation of Autodesk AutoCAD, rebuilt in pure Rust.
+
+
+
+ A fast, open-source take on the AutoCAD workflow: the command line, object snaps, layers,
+ dimensions, hatches, blocks and DXF drawings you already know. It runs natively on macOS,
+ Windows, Linux and FreeBSD, and in the browser via WebAssembly.
+ By the ArtCraft team.
+
+
+ Mounting bracket: a two-view part drawing with dimensions, centre lines, hidden lines and an ANSI31 section hatch — drawn, dimensioned and rendered by CADCraft.
+
+
+> [!NOTE]
+> **ArtCraft is a community of artists from all walks of life.** Painters, photographers,
+> filmmakers, illustrators, designers, animators, hobbyists, and people who picked up a pencil
+> last week. If you make things, you're one of us. **[Come say hi on Discord](https://discord.gg/artcraft).**
+
+
+ Our Discord is where artists of every kind hang out: people who paint, shoot, draw, cut film,
+ set type, and people still figuring out what they like to make. Share what you're working on,
+ ask for help, tell us what's broken, or tell us what you wish these tools could do.
+ Whatever your medium and however long you've been at it, you're welcome here.
+
+
+## License and credits
+
+CADCraft is dual-licensed under [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at your option.
+Copyright (c) 2026 ArtCraft Team and the CADCraft contributors. Required notices are in [NOTICE](NOTICE).
+
+Bundled fonts, icons, images and other assets keep their own open licenses; each one is listed
+with its author, source and license in [ATTRIBUTION.md](ATTRIBUTION.md).
+
+CADCraft's icons, its single-stroke drafting font, its hatch patterns and its linetypes are all
+original work, drawn or defined in code. The sample drawings are generated in code too.
+
+The ArtCraft name, wordmark and logos in [`docs/brand/`](docs/brand/) are trademarks of the
+ArtCraft Team and are not covered by this license. They may be used only unmodified, and only as
+part of this repository and CADCraft, under [`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt).
+Forks and modified versions must remove them.
+
+Autodesk, AutoCAD and DWG are trademarks or registered trademarks of Autodesk, Inc. in the United States and/or other countries. CADCraft is an independent, open-source project and is not affiliated with, sponsored by or endorsed by Autodesk, Inc.; these names are used only to describe the workflows and file formats it is compatible with.
+
+