create-rulecad 0.1.1 → 0.1.2
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/package.json +1 -1
- package/template/AGENTS.md +56 -0
- package/template/CLAUDE.md +1 -0
- package/template/README.md +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Designing with rulecad: notes for AI agents
|
|
2
|
+
|
|
3
|
+
This project designs physical things with the `cad` command (rulecad). Every measurement is a variable, and every
|
|
4
|
+
variable says which rule it comes from. Follow these steps; they're what makes a design traceable and printable.
|
|
5
|
+
(`npx cad help` lists the commands; the full guide is @rulecad/cad's README.)
|
|
6
|
+
|
|
7
|
+
## A new part
|
|
8
|
+
1. **Rules first.** Find the facts the part depends on: standards, the thing it fits, the printer. Put shared ones in
|
|
9
|
+
`rules/<set>.json` with `kind`, `source` and `checked`. Research them, don't guess. Ask the person to measure what
|
|
10
|
+
can't be looked up, and record it as `"kind": "measured"`; something nobody has published goes in as
|
|
11
|
+
`"kind": "estimate"`, and the check will flag it.
|
|
12
|
+
2. `npx cad new <project>/<object>`, then write the variables in the .json and the shape in the .js. No numbers in
|
|
13
|
+
the .js other than 0, 1 and 2: `cad check` fails on any other.
|
|
14
|
+
3. `npx cad check`, then `npx cad preview`, and **look at the preview image** before saying it's done. Check the views
|
|
15
|
+
from below for anything that fits onto something else.
|
|
16
|
+
4. Mark the variables that matter to the person `show` (six at most, short `label`s), and the ones other parts depend
|
|
17
|
+
on `interface` (versions follow them). Give sensible `tweak` ranges to the ones they may want to change.
|
|
18
|
+
5. `npx cad export` for printing; `npx cad link --md` for a link to share.
|
|
19
|
+
|
|
20
|
+
## Changing a design
|
|
21
|
+
1. `npx cad history <project>/<object>` first: read the print log. A failed print is the reason for most changes:
|
|
22
|
+
fix the rule or variable it points at (a measured fit beats a community rule).
|
|
23
|
+
2. Change, then check, preview and look, as for a new part.
|
|
24
|
+
3. `npx cad release <project>/<object> -m "what changed, for the person" --dry-run` shows the bump and why. If it's
|
|
25
|
+
major, tell the person which interface values changed: earlier prints may no longer fit.
|
|
26
|
+
4. Release only when the person agrees. Don't use `--force` without asking.
|
|
27
|
+
|
|
28
|
+
## Shapes
|
|
29
|
+
- Z is up, the bed is z = 0: model the part in its print orientation, and describe it in `orientation`.
|
|
30
|
+
- Walls are whole numbers of print lines (`x1c.line * 3`, or your printer's set), heights whole numbers of layers.
|
|
31
|
+
- Holes and slots get the printer's hole compensation; parts that slide together get its fit clearance. Chamfer
|
|
32
|
+
bottom edges.
|
|
33
|
+
- An overhang warning means supports: say so in `orientation`, or change the shape or orientation.
|
|
34
|
+
- Something printed under the part and removed afterwards is a named `support` part (`return { cap, pillar }`, both
|
|
35
|
+
described in the .json's `parts`), not part of the shape. Look at `cad preview --explode` too.
|
|
36
|
+
|
|
37
|
+
## Alternatives, layouts, colours
|
|
38
|
+
- To try an alternative, add a **variant** (named inputs in the .json) rather than a copy of the object; `cad compare`
|
|
39
|
+
shows two side by side. Remove trial variants before a release.
|
|
40
|
+
- What differs key by key on a keyboard belongs in a **layout file**, read through `per`. `cad import-kle` brings
|
|
41
|
+
one in from keyboard-layout-editor.com.
|
|
42
|
+
- A part in another colour is a part with a `filament` from `project.json`: the 3MF puts it on its own AMS slot.
|
|
43
|
+
- Fine detail a screen doesn't need goes in `display` settings (fewer segments, no legends).
|
|
44
|
+
|
|
45
|
+
## Fits
|
|
46
|
+
- To check how parts go together, make a `fit` assembly with the thing it fits as a `reference` object, and `fits`
|
|
47
|
+
with ranges from rules. An overlap or gap outside its range is a finding: report it with the numbers, and never
|
|
48
|
+
widen a range to make it pass without saying why.
|
|
49
|
+
- Build bigger things from checked assemblies used as items, rather than placing their objects again.
|
|
50
|
+
|
|
51
|
+
## Talking to the person
|
|
52
|
+
- Give links as one labelled line (`npx cad link <project>/<object> --md`), never a raw URL. If it says
|
|
53
|
+
"(not a release)", say so.
|
|
54
|
+
- Say what the checks found, with numbers. Ask before anything that leaves the computer: releases with `--push`,
|
|
55
|
+
ordering boards, publishing.
|
|
56
|
+
- Designs are code: only run designs you or the person trust. Links and rule files are data and never run.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
package/template/README.md
CHANGED
|
@@ -17,3 +17,5 @@ npx cad new home/hook # your own design
|
|
|
17
17
|
printer and correct them: every design that uses them follows.
|
|
18
18
|
- `cad.config.json` names the printer. For another printer, copy `rules/x1c.json` under a new name and change the
|
|
19
19
|
values.
|
|
20
|
+
- `AGENTS.md` tells an AI agent (Claude Code and others) how to design here: rules first, look at the preview,
|
|
21
|
+
report fits with numbers. `CLAUDE.md` includes it.
|