forgecad 0.9.14 → 0.9.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -4
- package/README.md +8 -4
- package/dist/assets/{AdminPage-eWGs2K6H.js → AdminPage-CXvls4-J.js} +2 -2
- package/dist/assets/{BenchmarkPage-CTrLKfpo.js → BenchmarkPage-B27zk8xL.js} +4 -15
- package/dist/assets/{BlogPage-5nPesyds.js → BlogPage-CMAVvgQL.js} +2 -2
- package/dist/assets/{DocsPage-C4Y3nbYc.js → DocsPage-knf4I4h7.js} +9 -3
- package/dist/assets/EditorApp-BHMQlJ-D.js +14686 -0
- package/dist/assets/{EditorApp-BAnckbsk.css → EditorApp-BpjZgzk0.css} +846 -0
- package/dist/assets/{EmbedViewer-C8fB4n5U.js → EmbedViewer-D7ZGlFjx.js} +3 -3
- package/dist/assets/{LandingPageProofDriven-jSz0LaMM.js → LandingPageProofDriven-CnevhTE8.js} +36 -38
- package/dist/assets/LegalPage-BPTUmqeg.js +39 -0
- package/dist/assets/LegalPage-BRlScr9A.css +91 -0
- package/dist/assets/{PricingPage-B83B90zh.js → PricingPage-B0D4goG_.js} +19 -19
- package/dist/assets/{PricingPage-BMedqFef.css → PricingPage-BPF6HKyO.css} +25 -0
- package/dist/assets/{SettingsPage-DY889pcu.js → SettingsPage-CFF-UgjI.js} +2 -2
- package/dist/assets/app-CE3sYcV7.css +3890 -0
- package/dist/assets/{app-bEww1ic4.js → app-T0pDcSX4.js} +3382 -1069
- package/dist/assets/cli/{render-Cho2uKG_.js → render-C5pcIISc.js} +477 -29
- package/dist/assets/{constructionHistoryWorker-HYwzJY4m.js → constructionHistoryWorker-Ba2Hm58b.js} +928 -243
- package/dist/assets/{evalWorker-CjQwJSE-.js → evalWorker-vkx310U2.js} +8883 -6040
- package/dist/assets/{forgecad_geometry-CH2nvuLA.js → forgecad_geometry-Dgceylq9.js} +43 -1
- package/dist/assets/forgecad_geometry_bg-dD4RNQF1.wasm +0 -0
- package/dist/assets/{inspectWorker-DeRnMVv1.js → inspectWorker-BuTJDVX6.js} +1179 -273
- package/dist/assets/{javascript-70-4uGcz.js → javascript-1kQXfVaz.js} +1 -1
- package/dist/assets/{targets-D6PWsv6X.js → jointPose-B_Cgedn9.js} +71 -3
- package/dist/assets/landing-proof-driven-DiGqdtWa.js +18 -0
- package/dist/assets/{landing-proof-driven-oFYW6mjz.css → landing-proof-driven-ORyigZ6p.css} +13 -7
- package/dist/assets/legalContent-ZfFGMmi4.js +251 -0
- package/dist/assets/{manifold-rmfAcdwF.js → manifold-BWgsjmAM.js} +1 -1
- package/dist/assets/{manifold-uRzgk5O8.js → manifold-D6IFSkhH.js} +2 -2
- package/dist/assets/{manifold-CG9Fokx-.js → manifold-rZexZI0G.js} +1 -1
- package/dist/assets/{reportWorker-4cW_ZpoS.js → reportWorker-0AGij1Ru.js} +8659 -12771
- package/dist/assets/{scalar-sampling-budget-CfDiFvh7.js → scalar-sampling-budget-J5cuzxT1.js} +8050 -6203
- package/dist/assets/{scanProxyWorker-Bs2TDgLw.js → scanProxyWorker-Vl4Wxa1y.js} +50 -6
- package/dist/assets/{solver-DuJAO8S6.js → solver-BZ9LPTHs.js} +1 -1
- package/dist/assets/solver_bg-DAHZJ_rw.wasm +0 -0
- package/dist/assets/{vendor-react-Da3A2QmU.js → vendor-react-6j1Kke-Y.js} +6 -5
- package/dist/cli/render.html +1 -1
- package/dist/docs/index.html +2 -2
- package/dist/docs-raw/AI/ai-native-cad.md +50 -0
- package/dist/docs-raw/AI/usage.md +5 -12
- package/dist/docs-raw/CLI.md +34 -10
- package/dist/docs-raw/component-model.md +27 -11
- package/dist/docs-raw/generated/assembly.md +374 -187
- package/dist/docs-raw/generated/concepts.md +245 -237
- package/dist/docs-raw/generated/core.md +283 -6
- package/dist/docs-raw/generated/curves.md +274 -361
- package/dist/docs-raw/generated/lib.md +9 -19
- package/dist/docs-raw/generated/output.md +29 -4
- package/dist/docs-raw/generated/runtime-names.md +49 -0
- package/dist/docs-raw/generated/sdf.md +31 -0
- package/dist/docs-raw/generated/sheet-metal.md +9 -0
- package/dist/docs-raw/generated/sketch.md +44 -1
- package/dist/docs-raw/generated/viewport.md +11 -3
- package/dist/docs-raw/guides/coordinate-system.md +20 -16
- package/dist/docs-raw/guides/geometry-conventions.md +2 -2
- package/dist/docs-raw/guides/inspection-bundles.md +2 -1
- package/dist/docs-raw/guides/joint-design.md +24 -0
- package/dist/docs-raw/guides/positioning.md +13 -3
- package/dist/docs-raw/legal/privacy.md +63 -0
- package/dist/docs-raw/legal/software-license.md +55 -0
- package/dist/docs-raw/legal/terms.md +87 -0
- package/dist/docs-raw/skills/forgecad-3d-reconstruction.md +1 -1
- package/dist/docs-raw/skills/forgecad-blockout-model.md +1 -1
- package/dist/docs-raw/skills/forgecad-component-model.md +11 -2
- package/dist/docs-raw/skills/forgecad-high-level-spec.md +1 -1
- package/dist/docs-raw/skills/forgecad-image-replicator.md +8 -8
- package/dist/docs-raw/skills/forgecad-lld.md +1 -1
- package/dist/docs-raw/skills/forgecad-make-a-model.md +40 -39
- package/dist/docs-raw/skills/forgecad-model-grader.md +2 -2
- package/dist/docs-raw/skills/forgecad-prepare-prompt.md +2 -2
- package/dist/docs-raw/skills/forgecad-project.md +3 -1
- package/dist/docs-raw/skills/forgecad-reconstruction-benchmark.md +1 -1
- package/dist/docs-raw/skills/forgecad-render-inspect.md +4 -2
- package/dist/docs-raw/skills/forgecad-visual-spec.md +1 -1
- package/dist/docs-raw/skills/forgecad.md +4 -3
- package/dist/docs-raw/welcome.md +2 -0
- package/dist/index.html +40 -12
- package/dist/llms.txt +8 -0
- package/dist/site.webmanifest +1 -1
- package/dist/sitemap.xml +49 -13
- package/dist-cli/{check-compiler-U5SOPN7X.js → check-compiler-SYQ2PWOB.js} +1 -2
- package/dist-cli/{check-query-propagation-XOKNSSYU.js → check-query-propagation-HIAGV62W.js} +1 -2
- package/dist-cli/{chunk-EXWGNL6K.js → chunk-SPZE3DUY.js} +20659 -17930
- package/dist-cli/forgecad.js +3568 -1250
- package/dist-cli/{forgecad_geometry-GYVNKPIE.js → forgecad_geometry-QOQIIP53.js} +42 -1
- package/dist-cli/forgecad_geometry_bg.wasm +0 -0
- package/dist-cli/{solver-46FFSK2U.js → solver-OK4HECRH.js} +0 -1
- package/dist-cli/solver_bg.wasm +0 -0
- package/dist-skill/CONTEXT.md +1192 -725
- package/dist-skill/SKILL.md +3 -2
- package/dist-skill/docs/API/core/concepts.md +64 -1
- package/dist-skill/docs/CLI.md +34 -10
- package/dist-skill/docs/generated/assembly.md +339 -213
- package/dist-skill/docs/generated/core.md +283 -6
- package/dist-skill/docs/generated/curves.md +272 -362
- package/dist-skill/docs/generated/lib.md +9 -19
- package/dist-skill/docs/generated/output.md +29 -4
- package/dist-skill/docs/generated/runtime-names.md +40 -0
- package/dist-skill/docs/generated/sdf.md +31 -0
- package/dist-skill/docs/generated/sheet-metal.md +9 -0
- package/dist-skill/docs/generated/sketch.md +44 -2
- package/dist-skill/docs/generated/viewport.md +2 -87
- package/dist-skill/docs/guides/coordinate-system.md +20 -16
- package/dist-skill/docs/guides/geometry-conventions.md +2 -2
- package/dist-skill/docs/guides/inspection-bundles.md +2 -1
- package/dist-skill/docs/guides/joint-design.md +24 -0
- package/dist-skill/docs/guides/positioning.md +13 -3
- package/dist-skill/library/forgecad-component-model/SKILL.md +10 -1
- package/dist-skill/library/forgecad-image-replicator/SKILL.md +6 -6
- package/dist-skill/library/forgecad-image-replicator/scripts/compare_images.py +166 -0
- package/dist-skill/library/forgecad-make-a-model/SKILL.md +39 -38
- package/dist-skill/library/forgecad-model-grader/SKILL.md +1 -1
- package/dist-skill/library/forgecad-prepare-prompt/SKILL.md +1 -1
- package/dist-skill/library/forgecad-project/SKILL.md +2 -0
- package/dist-skill/library/forgecad-render-inspect/SKILL.md +3 -1
- package/examples/api/assembly-kinematics-foundation.forge.js +65 -0
- package/examples/api/assembly-kinematics-four-bar.forge.js +115 -0
- package/examples/api/assembly-kinematics-limb.forge.js +116 -0
- package/examples/api/connector-frame-rig-chain.forge.js +102 -0
- package/examples/api/exact-sheet-shell-assembly.forge.js +0 -2
- package/examples/api/exact-surface-studio.forge.js +6 -8
- package/examples/api/helix-basics.forge.js +8 -8
- package/examples/api/lean-foundations/README.md +12 -0
- package/examples/api/lean-foundations/curve-blend-exact.forge.js +22 -0
- package/examples/api/lean-foundations/curve-fit-interpolation.forge.js +18 -0
- package/examples/api/lean-foundations/curve-helix-canonicalization.forge.js +27 -0
- package/examples/api/lean-foundations/curve-route-canonicalization.forge.js +16 -0
- package/examples/api/lean-foundations/curve-trim-reverse.forge.js +24 -0
- package/examples/api/lean-foundations/exact-curve-arc.forge.js +36 -0
- package/examples/api/mixed-edge-finishes-proof.forge.js +8 -11
- package/examples/api/route3d-elbow.forge.js +71 -0
- package/examples/api/transition-curves.forge.js +44 -15
- package/examples/api/variable-sweep-test.forge.js +3 -1
- package/examples/api/y-blend-corner-showcase.forge.js +0 -2
- package/examples/generative/coral-vase.forge.js +1 -1
- package/examples/nurbs-tube.forge.js +1 -1
- package/package.json +17 -13
- package/dist/assets/EditorApp-lXv53A1m.js +0 -13610
- package/dist/assets/app-CsHnaBWt.css +0 -1789
- package/dist/assets/forgecad_geometry_bg-C5_E9Oa9.wasm +0 -0
- package/dist/assets/solver_bg-CWvv4lnN.wasm +0 -0
- package/dist/docs-raw/API/README.md +0 -16
- package/dist/docs-raw/API/core/concepts.md +0 -118
- package/dist/docs-raw/INDEX.md +0 -138
- package/dist/docs-raw/RELEASING.md +0 -87
- package/dist/docs-raw/agent-native-api.md +0 -27
- package/dist/docs-raw/beta-deployment.md +0 -304
- package/dist/docs-raw/beta-operations.md +0 -325
- package/dist/docs-raw/blueprint-first.md +0 -145
- package/dist/docs-raw/cli-monetization.md +0 -112
- package/dist/docs-raw/coding-best-practices.md +0 -120
- package/dist/docs-raw/coding.md +0 -340
- package/dist/docs-raw/deployment.md +0 -374
- package/dist/docs-raw/guides/skill-maintenance.md +0 -161
- package/dist/docs-raw/guides/surface-members.md +0 -82
- package/dist/docs-raw/harbor-cli.md +0 -854
- package/dist/docs-raw/internals/backend-vocabulary.md +0 -35
- package/dist/docs-raw/internals/compiler.md +0 -307
- package/dist/docs-raw/internals/constraint-solver-quality.md +0 -161
- package/dist/docs-raw/internals/constraint-solver.md +0 -176
- package/dist/docs-raw/internals/shape-from-slices.md +0 -152
- package/dist/docs-raw/internals/sketch-2d-pipeline.md +0 -108
- package/dist/docs-raw/platform/admin.md +0 -45
- package/dist/docs-raw/platform/architecture.md +0 -82
- package/dist/docs-raw/platform/auth.md +0 -139
- package/dist/docs-raw/platform/email.md +0 -67
- package/dist/docs-raw/platform/google-oauth-setup.md +0 -88
- package/dist/docs-raw/platform/observability.md +0 -197
- package/dist/docs-raw/platform/projects.md +0 -111
- package/dist/docs-raw/platform/sharing.md +0 -90
- package/dist/docs-raw/product/README.md +0 -39
- package/dist/docs-raw/product/api-as-product-language.md +0 -13
- package/dist/docs-raw/product/business-model.md +0 -15
- package/dist/docs-raw/product/competitive-positioning.md +0 -17
- package/dist/docs-raw/product/creative-manufacturing.md +0 -15
- package/dist/docs-raw/product/founder-story.md +0 -11
- package/dist/docs-raw/product/manufacturing-workflows.md +0 -15
- package/dist/docs-raw/product/onboarding-first-experience.md +0 -256
- package/dist/docs-raw/product/product-loop.md +0 -17
- package/dist/docs-raw/product/strategic-decisions.md +0 -22
- package/dist/docs-raw/product/user-outreach-email-templates.md +0 -161
- package/dist/docs-raw/product/user-segments.md +0 -15
- package/dist/docs-raw/product/vision.md +0 -26
- package/dist/docs-raw/rl-environments.md +0 -350
- package/dist/docs-raw/runbook.md +0 -611
- package/dist-cli/check-compiler-U5SOPN7X.js.map +0 -1
- package/dist-cli/check-query-propagation-XOKNSSYU.js.map +0 -1
- package/dist-cli/chunk-EXWGNL6K.js.map +0 -1
- package/dist-cli/forgecad.js.map +0 -1
- package/dist-cli/forgecad_geometry-GYVNKPIE.js.map +0 -1
- package/dist-cli/solver-46FFSK2U.js.map +0 -1
- package/dist-skill/SKILL-dev.md +0 -145
- package/dist-skill/docs-dev/API/core/concepts.md +0 -118
- package/dist-skill/docs-dev/CLI.md +0 -677
- package/dist-skill/docs-dev/agent-native-api.md +0 -27
- package/dist-skill/docs-dev/blueprint-first.md +0 -145
- package/dist-skill/docs-dev/coding-best-practices.md +0 -120
- package/dist-skill/docs-dev/coding.md +0 -340
- package/dist-skill/docs-dev/component-model.md +0 -164
- package/dist-skill/docs-dev/generated/assembly.md +0 -794
- package/dist-skill/docs-dev/generated/core.md +0 -2117
- package/dist-skill/docs-dev/generated/curves.md +0 -2583
- package/dist-skill/docs-dev/generated/lib.md +0 -169
- package/dist-skill/docs-dev/generated/output.md +0 -247
- package/dist-skill/docs-dev/generated/sdf.md +0 -446
- package/dist-skill/docs-dev/generated/sheet-metal.md +0 -504
- package/dist-skill/docs-dev/generated/sketch.md +0 -1811
- package/dist-skill/docs-dev/generated/viewport.md +0 -585
- package/dist-skill/docs-dev/generated/wood.md +0 -108
- package/dist-skill/docs-dev/guides/coordinate-system.md +0 -46
- package/dist-skill/docs-dev/guides/geometry-conventions.md +0 -52
- package/dist-skill/docs-dev/guides/inspection-bundles.md +0 -485
- package/dist-skill/docs-dev/guides/joint-design.md +0 -78
- package/dist-skill/docs-dev/guides/modeling-recipes.md +0 -78
- package/dist-skill/docs-dev/guides/positioning.md +0 -161
- package/dist-skill/docs-dev/guides/skill-maintenance.md +0 -161
- package/dist-skill/docs-dev/internals/backend-vocabulary.md +0 -35
- package/dist-skill/docs-dev/internals/compiler.md +0 -307
- package/dist-skill/docs-dev/internals/constraint-solver-quality.md +0 -161
- package/dist-skill/docs-dev/internals/constraint-solver.md +0 -176
- package/dist-skill/docs-dev/internals/sketch-2d-pipeline.md +0 -108
- package/dist-skill/library/forgecad-image-replicator/scripts/compare_images.mjs +0 -289
- package/examples/api/bolted-service-cover.forge.js +0 -17
- package/examples/api/cable-gland-anchor.forge.js +0 -14
- package/examples/api/captured-cartridge-guide.forge.js +0 -14
- package/examples/api/captured-linear-slide.forge.js +0 -13
- package/examples/api/clevis-pin-joint.forge.js +0 -13
- package/examples/api/datum-enclosure.forge.js +0 -16
- package/examples/api/hose-barb-port.forge.js +0 -14
- package/examples/api/knuckled-hinge-assembly.forge.js +0 -15
- package/examples/api/living-hinge-cover.forge.js +0 -14
- package/examples/api/pcb-terminal-block.forge.js +0 -22
- package/examples/api/pinned-lever-pivot-stack.forge.js +0 -14
- package/examples/api/retained-shaft-knob-stack.forge.js +0 -15
- package/examples/api/routed-tube-clip.forge.js +0 -15
- package/examples/api/seated-bearing-stack.forge.js +0 -30
- package/examples/api/snap-latch-cover.forge.js +0 -14
- package/examples/api/thumb-screw-clamp.forge.js +0 -15
package/dist/docs-raw/coding.md
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
skill-group: dev-conventions
|
|
3
|
-
skill-order: 2
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# ForgeCAD Coding Guidelines
|
|
7
|
-
|
|
8
|
-
## Development Workflow
|
|
9
|
-
|
|
10
|
-
### Building & Running
|
|
11
|
-
```bash
|
|
12
|
-
npm install # Install dependencies
|
|
13
|
-
npm link # Install the local forgecad binary
|
|
14
|
-
forgecad studio examples # Start the browser studio (localhost:5173)
|
|
15
|
-
npm run build # Production build
|
|
16
|
-
npm run preview # Preview production build
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### CLI Tools
|
|
20
|
-
```bash
|
|
21
|
-
forgecad export svg examples/constraints/01-fully-constrained-rect.forge.js # Export sketch to SVG
|
|
22
|
-
forgecad render 3d examples/products/cup.forge.js # Render to PNG (Puppeteer + Chrome)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
See [CLI.md](../CLI.md) for full CLI documentation.
|
|
26
|
-
|
|
27
|
-
### Project Structure
|
|
28
|
-
```
|
|
29
|
-
src/
|
|
30
|
-
├── forge/ # Core geometry engine (shared by browser + CLI)
|
|
31
|
-
│ ├── kernel.ts # Manifold WASM wrapper, Shape class, primitives
|
|
32
|
-
│ ├── headless.ts # Single entry point for all contexts (browser + Node CLI)
|
|
33
|
-
│ ├── index.ts # Browser entry point (re-exports from headless.ts)
|
|
34
|
-
│ ├── runner.ts # Script sandbox — executes user scripts and resolves imported .svg assets
|
|
35
|
-
│ ├── params.ts # Parameter system (param() → UI sliders)
|
|
36
|
-
│ ├── library.ts # Part library (lib.boltHole, lib.pipe, etc.)
|
|
37
|
-
│ ├── section.ts # Plane intersection / projection
|
|
38
|
-
│ ├── meshToGeometry.ts # Manifold mesh → Three.js BufferGeometry
|
|
39
|
-
│ ├── sceneBuilder.ts # Three.js scene setup (shared with CLI renderer)
|
|
40
|
-
│ └── sketch/ # 2D sketch system
|
|
41
|
-
│ ├── core.ts # Sketch class
|
|
42
|
-
│ ├── primitives.ts # rect, circle2d, polygon, ngon, etc.
|
|
43
|
-
│ ├── transforms.ts # translate, rotate, scale, mirror
|
|
44
|
-
│ ├── booleans.ts # add, subtract, intersect, union2d
|
|
45
|
-
│ ├── operations.ts # offset, simplify, warp
|
|
46
|
-
│ ├── extrude.ts # extrude, revolve (2D → 3D)
|
|
47
|
-
│ ├── path.ts # PathBuilder, stroke
|
|
48
|
-
│ ├── anchor.ts # attachTo/matchTo positioning
|
|
49
|
-
│ ├── constraints.ts # Constraint solver (18 types)
|
|
50
|
-
│ ├── entities.ts # Point2D, Line2D, Circle2D, Rectangle2D, Constraint helpers
|
|
51
|
-
│ ├── topology.ts # TrackedShape, face/edge naming
|
|
52
|
-
│ ├── patterns.ts # linearPattern, circularPattern, mirrorCopy
|
|
53
|
-
│ ├── fillets.ts # filletEdge, chamferEdge
|
|
54
|
-
│ ├── arcBridge.ts # arcBridgeBetweenRects
|
|
55
|
-
│ └── index.ts # Re-exports everything
|
|
56
|
-
├── components/ # React UI components
|
|
57
|
-
│ ├── Viewport.tsx # 3D viewport (Three.js + R3F)
|
|
58
|
-
│ ├── CodeEditor.tsx # Monaco editor with ForgeCAD types
|
|
59
|
-
│ ├── FileExplorer.tsx # Project file tree
|
|
60
|
-
│ ├── ViewPanel.tsx # Render mode, views, object settings
|
|
61
|
-
│ ├── ParamPanel.tsx # Parameter sliders
|
|
62
|
-
│ └── ExportPanel.tsx # STL export
|
|
63
|
-
├── store/
|
|
64
|
-
│ └── forgeStore.ts # Zustand global state
|
|
65
|
-
├── App.tsx # Main application shell
|
|
66
|
-
└── main.tsx # React entry point
|
|
67
|
-
|
|
68
|
-
cli/
|
|
69
|
-
├── forgecad.ts # Top-level CLI entrypoint and command routing
|
|
70
|
-
├── forge-svg.ts # SVG export (uses real engine via headless.ts)
|
|
71
|
-
├── forge-render.mjs # PNG render launcher (Puppeteer)
|
|
72
|
-
├── render.ts # Headless render entry (loaded in browser by Puppeteer)
|
|
73
|
-
└── render.html # HTML shell for headless render
|
|
74
|
-
|
|
75
|
-
examples/ # Example scripts
|
|
76
|
-
├── *.forge.js # 3D part and 2D sketch examples
|
|
77
|
-
└── constraints/ # Constrained sketch examples
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Coding Standards
|
|
81
|
-
|
|
82
|
-
See [coding-best-practices.md](coding-best-practices.md) for TypeScript, React, state management, and performance best practices.
|
|
83
|
-
|
|
84
|
-
## Agent-Native API Design Standard (Required)
|
|
85
|
-
|
|
86
|
-
ForgeCAD expects AI agents to author serious `.forge.js` models, but agent specialization through documentation is not a substitute for API design. Read [agent-native-api.md](agent-native-api.md) before treating a modeling difficulty as "just a docs problem."
|
|
87
|
-
|
|
88
|
-
If a common modeling task requires agents to reimplement a known CAD concept from recipes, trigonometry, magic numbers, or raw boolean construction, prefer a domain-specific API improvement with clear docs and diagnostics. Documentation should make agents fluent in ForgeCAD's vocabulary; it should not carry missing vocabulary.
|
|
89
|
-
|
|
90
|
-
## Domain Localization Standard (Required)
|
|
91
|
-
|
|
92
|
-
This standard is package-wide for any new user-facing concept or API family.
|
|
93
|
-
|
|
94
|
-
### Contract
|
|
95
|
-
- Each concept family must have a clear primary home in both code and docs.
|
|
96
|
-
- Extend the module that already owns the mental model instead of scattering helpers across unrelated files.
|
|
97
|
-
- When a feature spans multiple layers, pick one domain owner and make the other layers mirror that owner.
|
|
98
|
-
- Keep related runtime code, examples, checks, and docs close to the same domain name whenever practical.
|
|
99
|
-
|
|
100
|
-
### Examples
|
|
101
|
-
- Assembly and kinematics live under `src/forge/assembly.ts` and `docs/permanent/API/assembly/assembly.md`.
|
|
102
|
-
- Sketch constraints live under `src/forge/sketch/constraints.ts` and the sketch/entity API docs.
|
|
103
|
-
- Transform/placement helpers should stay grouped with transform and positioning surfaces, not reappear as ad-hoc helpers in unrelated modules.
|
|
104
|
-
|
|
105
|
-
### Enforcement
|
|
106
|
-
- Before adding a new API, state which domain owns it.
|
|
107
|
-
- If a concept currently has no clean home, create one instead of spreading the first implementation across multiple files.
|
|
108
|
-
|
|
109
|
-
## Backend Compiler Standard (Required)
|
|
110
|
-
|
|
111
|
-
This standard is package-wide for any geometry feature that affects runtime lowering, export-backend coverage, or backend capability routing.
|
|
112
|
-
|
|
113
|
-
Read [compiler.md](../internals/compiler.md) before changing this area.
|
|
114
|
-
For large multi-agent migrations or architecture programs, also read [PROGRAM-LEAD.md](../../processes/PROGRAM-LEAD.md).
|
|
115
|
-
|
|
116
|
-
### Contract
|
|
117
|
-
- Forge semantic intent comes first. Backends are lowerers, not the authoring model.
|
|
118
|
-
- Scene-level capability routing must stay centralized. Do not re-derive export/runtime policy ad hoc in unrelated modules.
|
|
119
|
-
- Public feature APIs must not hide backend-specific behavior directly in their callsites. Backend code belongs in the lowerers.
|
|
120
|
-
- New backend limitations must surface as diagnostics, not silent fallback or silent exactness loss.
|
|
121
|
-
|
|
122
|
-
### Enforcement
|
|
123
|
-
- If a feature is compile-covered, update the canonical compile graph and the scene compiler.
|
|
124
|
-
- If a feature is not yet dual-lowered, add explicit unsupported diagnostics for the missing backend rather than bypassing the compiler.
|
|
125
|
-
- Any geometry feature change must update invariant coverage and the living backend-compiler tracker.
|
|
126
|
-
|
|
127
|
-
## Multi-Agent Program Standard (Required For Large Migrations)
|
|
128
|
-
|
|
129
|
-
For work that spans multiple agent branches or staged dependency waves, the Program Lead role in [PROGRAM-LEAD.md](../../processes/PROGRAM-LEAD.md) is the default operating model.
|
|
130
|
-
|
|
131
|
-
Use it when:
|
|
132
|
-
|
|
133
|
-
- one missing foundation blocks several feature lanes
|
|
134
|
-
- multiple agents need isolated tasks with dependency ordering
|
|
135
|
-
- the repo needs a living task graph and capability tracker to stay truthful
|
|
136
|
-
|
|
137
|
-
The key rule is simple:
|
|
138
|
-
|
|
139
|
-
- solve the deepest shared prerequisite first
|
|
140
|
-
- only then open the parallel wave that builds on top of it
|
|
141
|
-
|
|
142
|
-
## Frame Composition Standard (Required)
|
|
143
|
-
|
|
144
|
-
This standard is package-wide for any code that composes transforms (`Transform`, joints, assemblies, kinematic helpers).
|
|
145
|
-
|
|
146
|
-
### Contract
|
|
147
|
-
- `A.mul(B)` means **apply A, then B**
|
|
148
|
-
- Use `composeChain(...)` for 3+ composed transforms instead of manual `.mul()` chains
|
|
149
|
-
- In assembly/kinematics, always express composition in this canonical order:
|
|
150
|
-
- `local -> childBase -> jointMotion -> jointFrame -> parentWorld`
|
|
151
|
-
|
|
152
|
-
### Why this is mandatory
|
|
153
|
-
Transform order bugs can produce geometry that "looks valid" but is globally wrong (detached mechanism segments, drifting pivots, mirrored motion paths) and often pass casual visual checks.
|
|
154
|
-
|
|
155
|
-
### 5-Why (2026-02 Assembly disconnect incident)
|
|
156
|
-
1. Why were arm segments disconnected?
|
|
157
|
-
Because child world transforms were composed in the wrong order in `assembly.solve()`.
|
|
158
|
-
2. Why was order wrong?
|
|
159
|
-
Because `.mul()` chain semantics (apply self, then other) were interpreted inconsistently with matrix notation.
|
|
160
|
-
3. Why was that ambiguity possible?
|
|
161
|
-
Because there was no single canonical frame equation documented and enforced in code review.
|
|
162
|
-
4. Why didn’t tests catch it immediately?
|
|
163
|
-
Because there was no invariant test comparing assembly-solved frame origins against an analytic kinematic oracle.
|
|
164
|
-
5. Why no invariant test existed?
|
|
165
|
-
Because we had feature-level example checks, but no package-wide transform convention gate.
|
|
166
|
-
|
|
167
|
-
Root cause: **missing, enforced transform/frame composition contract across code + tests.**
|
|
168
|
-
|
|
169
|
-
### Enforcement
|
|
170
|
-
- Any change touching transforms, joints, or assembly solving must run:
|
|
171
|
-
- `npm run check:suite -- --profile smoke`
|
|
172
|
-
- If the change affects user-facing geometry behavior, also run:
|
|
173
|
-
- `forgecad run <affected-example>`
|
|
174
|
-
|
|
175
|
-
## Editor Declaration Parity Standard (Required)
|
|
176
|
-
|
|
177
|
-
This standard is package-wide for any user-facing API exposed to scripts.
|
|
178
|
-
|
|
179
|
-
### Contract
|
|
180
|
-
- Runtime API and editor declarations must ship together:
|
|
181
|
-
- Runtime surface: `src/forge/*` exports + `src/forge/runner.ts` sandbox bindings
|
|
182
|
-
- Editor surface: `src/components/CodeEditor.tsx` `FORGE_TYPES`
|
|
183
|
-
- Docs surface: `docs/permanent/API/**/*.md`
|
|
184
|
-
- If an important feature is missing from editor declarations, you must either:
|
|
185
|
-
- implement declarations in the same change, or
|
|
186
|
-
- create a tracked task in `tasks/` that explicitly names the missing surface and scope.
|
|
187
|
-
|
|
188
|
-
### Enforcement
|
|
189
|
-
- Before merge, verify new/changed script APIs are present in all three surfaces above.
|
|
190
|
-
- Do not ship runtime-only features without either declaration parity or a tracking task.
|
|
191
|
-
|
|
192
|
-
## Multi-File Native Standard (Required)
|
|
193
|
-
|
|
194
|
-
ForgeCAD projects must scale cleanly across multiple files. Complex models should be **expressible as a composition of separate, independently-authored files** — not as a single growing script.
|
|
195
|
-
|
|
196
|
-
### Tenet
|
|
197
|
-
|
|
198
|
-
Every user-facing import mechanism must make multi-file composition a first-class path, not an afterthought:
|
|
199
|
-
|
|
200
|
-
- Any `.forge.js` file (returning a `Shape`, `ShapeGroup`, `Assembly`, or other type) can be imported with `require("./file.forge.js")`.
|
|
201
|
-
- `require()` accepts an optional second argument for parameter overrides: `require("./part.forge.js", { Width: 100 })`.
|
|
202
|
-
- Files can also use `exports.name = value` alongside or instead of `return` for named multi-export.
|
|
203
|
-
- Plain JS helpers and constants belong in regular `.js` modules imported via `require()` or standard `import`.
|
|
204
|
-
|
|
205
|
-
No user should have to choose between "clean file structure" and "full API access". If a new return type or authoring primitive appears, **its import path must ship at the same time or in the same milestone**.
|
|
206
|
-
|
|
207
|
-
### Consequences for API design
|
|
208
|
-
|
|
209
|
-
- New authoring primitives (anything a user might `return` from a `.forge.js` file) are automatically importable via `require()`.
|
|
210
|
-
- Imported objects must expose the same child-access and placement-reference ergonomics that inline objects do.
|
|
211
|
-
- Parameter overrides must be supported via the second argument to `require()` so multi-instance use is natural.
|
|
212
|
-
- If a sub-file feature cannot yet be fully composed (e.g. kinematic merge across file boundaries), document the limitation explicitly and create a tracked task — do not silently downgrade.
|
|
213
|
-
|
|
214
|
-
### Enforcement
|
|
215
|
-
|
|
216
|
-
- When adding a new return-type contract, check: is there an `import*()` function for it?
|
|
217
|
-
- When adding placement-reference or child-access APIs to an object type, check: do imported versions of that type also expose those APIs?
|
|
218
|
-
- Verify with `forgecad run` that a multi-file example using the new feature works end-to-end before merge.
|
|
219
|
-
|
|
220
|
-
## Script API Contract Standard (Required)
|
|
221
|
-
|
|
222
|
-
This standard is package-wide for any API exposed to user scripts.
|
|
223
|
-
|
|
224
|
-
### Contract
|
|
225
|
-
- Collection-shaped script APIs must accept the intuitive collection forms the docs advertise:
|
|
226
|
-
- variadic operands when the operation naturally works on many inputs
|
|
227
|
-
- a single array of operands when that keeps call sites composable
|
|
228
|
-
- Method syntax and function syntax must mirror each other for the same operation family.
|
|
229
|
-
- User-facing APIs must not silently ignore extra arguments. Unsupported arity or operand types must throw a direct runtime error with the API name in the message.
|
|
230
|
-
- If a future API needs configuration, do not smuggle it in as an ambiguous trailing object on an operand list. Use a distinct helper or a clearly named options-bearing API.
|
|
231
|
-
|
|
232
|
-
### Enforcement
|
|
233
|
-
- Any change to user-facing script APIs must run:
|
|
234
|
-
- `npm run check:suite`
|
|
235
|
-
- If the change also affects transforms, dimensions, placement refs, or geometry semantics, run the relevant existing invariant checks too.
|
|
236
|
-
|
|
237
|
-
## Git Workflow
|
|
238
|
-
|
|
239
|
-
### Commit Every Major Change
|
|
240
|
-
Each logical unit of work should be a separate commit:
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
git add <files>
|
|
244
|
-
git commit -m "Add file explorer panel"
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Commit Message Format
|
|
248
|
-
```
|
|
249
|
-
<verb> <what>
|
|
250
|
-
|
|
251
|
-
Examples:
|
|
252
|
-
- Add file explorer panel
|
|
253
|
-
- Fix measure mode toggle
|
|
254
|
-
- Update parameter slider styling
|
|
255
|
-
- Remove unused imports
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
Use present tense verbs: Add, Fix, Update, Remove, Refactor
|
|
259
|
-
|
|
260
|
-
### What Counts as "Major"
|
|
261
|
-
- New feature or component
|
|
262
|
-
- Bug fix
|
|
263
|
-
- Refactoring that changes structure
|
|
264
|
-
- Performance improvement
|
|
265
|
-
- Breaking API change
|
|
266
|
-
|
|
267
|
-
### What to Commit Together
|
|
268
|
-
- Related files for a single feature
|
|
269
|
-
- Tests with the code they test
|
|
270
|
-
- Documentation with the feature it describes
|
|
271
|
-
|
|
272
|
-
### Example Workflow
|
|
273
|
-
```bash
|
|
274
|
-
# Feature: Add file explorer
|
|
275
|
-
git add src/components/FileExplorer.tsx
|
|
276
|
-
git add src/store/forgeStore.ts
|
|
277
|
-
git add src/App.tsx
|
|
278
|
-
git commit -m "Add file explorer panel"
|
|
279
|
-
|
|
280
|
-
# Next feature: Add keyboard shortcuts
|
|
281
|
-
git add src/hooks/useKeyboard.ts
|
|
282
|
-
git add src/App.tsx
|
|
283
|
-
git commit -m "Add keyboard shortcuts for file operations"
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
## Testing
|
|
287
|
-
|
|
288
|
-
### Manual Testing Checklist
|
|
289
|
-
Before committing UI changes:
|
|
290
|
-
- [ ] Test in browser at localhost:5173
|
|
291
|
-
- [ ] Check console for errors
|
|
292
|
-
- [ ] Verify responsive behavior
|
|
293
|
-
- [ ] Test with example scripts
|
|
294
|
-
|
|
295
|
-
### Integration Testing
|
|
296
|
-
- Load example files and verify they render
|
|
297
|
-
- Test parameter sliders update geometry
|
|
298
|
-
- Verify STL export produces valid files
|
|
299
|
-
- Check measure mode calculates correctly
|
|
300
|
-
|
|
301
|
-
## Common Patterns
|
|
302
|
-
|
|
303
|
-
### Adding a New Sketch Primitive
|
|
304
|
-
1. Add function to `src/forge/sketch/primitives.ts`
|
|
305
|
-
2. It's auto-exported via `sketch/index.ts` → `headless.ts` → `index.ts`
|
|
306
|
-
3. Add it to the sandbox in `src/forge/runner.ts` (both the `new Function()` args and the call)
|
|
307
|
-
4. Add TypeScript hints in `src/components/CodeEditor.tsx` (`FORGE_TYPES`)
|
|
308
|
-
5. Update `docs/permanent/API/sketch/primitives.md`
|
|
309
|
-
6. Commit: "Add [primitive] sketch primitive"
|
|
310
|
-
|
|
311
|
-
### Adding a New 3D Primitive
|
|
312
|
-
1. Add function to `src/forge/kernel.ts`
|
|
313
|
-
2. Export from `headless.ts`
|
|
314
|
-
3. Add to runner sandbox in `src/forge/runner.ts`
|
|
315
|
-
4. Add TypeScript hints in `src/components/CodeEditor.tsx`
|
|
316
|
-
5. Commit: "Add [primitive] 3D primitive"
|
|
317
|
-
|
|
318
|
-
### Adding a New CLI Command
|
|
319
|
-
1. Create `cli/your-command.ts`
|
|
320
|
-
2. Import from `../src/forge/headless`
|
|
321
|
-
3. Call `await init()` then use `runScript()`
|
|
322
|
-
4. Add script to `package.json`
|
|
323
|
-
5. Update `docs/permanent/CLI.md`
|
|
324
|
-
6. Commit: "Add [command] CLI command"
|
|
325
|
-
|
|
326
|
-
### Adding UI State
|
|
327
|
-
1. Add to `src/store/forgeStore.ts` interface
|
|
328
|
-
2. Add initial value and actions
|
|
329
|
-
3. Wire up to component
|
|
330
|
-
4. Commit: "Add [feature] UI state"
|
|
331
|
-
|
|
332
|
-
### Adding a Component
|
|
333
|
-
1. Create in `src/components/`
|
|
334
|
-
2. Import and use in `App.tsx` or parent
|
|
335
|
-
3. Commit: "Add [Component] component"
|
|
336
|
-
|
|
337
|
-
### Key Architecture Rule: Single Source of Truth
|
|
338
|
-
All geometry logic lives in `src/forge/`. CLI tools import from `src/forge/headless.ts`.
|
|
339
|
-
**Never** duplicate forge logic in CLI scripts. If you need something in CLI, make sure
|
|
340
|
-
it's exported from `headless.ts` and import it.
|