@rulecad/cad 0.2.0 → 0.2.1
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/AGENTS.md +2 -1
- package/README.md +7 -3
- package/bin/cad.mjs +3 -0
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -62,7 +62,8 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
62
62
|
|
|
63
63
|
## Talking to the person
|
|
64
64
|
- Give links as one labelled line (`npx cad link <project>/<object> --md`), never a raw URL. If it says
|
|
65
|
-
"(not a release)", say so.
|
|
65
|
+
"(not a release)", say so. If it says the link is too long for chat, don't paste it: tell the person, and offer
|
|
66
|
+
short links (a secret Gist), which upload the model, so ask first.
|
|
66
67
|
- Say what the checks found, with numbers. Ask before anything that leaves the computer: releases with `--push`,
|
|
67
68
|
ordering boards, publishing.
|
|
68
69
|
- Designs are code: only run designs you or the person trust. Links and rule files are data and never run.
|
package/README.md
CHANGED
|
@@ -69,9 +69,13 @@ fragment, which never reaches the web host, so the public page can open private
|
|
|
69
69
|
which version it holds (`keyboard/keycap@0.1.0`, or `+changes` if it isn't a release). The page is to become `@rulecad/viewer`;
|
|
70
70
|
`scripts/publish-view.sh "message"` publishes it (only that folder) to the public repo.
|
|
71
71
|
|
|
72
|
-
- **Short links** (`--short`, and the default for `--md`
|
|
73
|
-
|
|
74
|
-
GitHub's API. The same model reuses its Gist
|
|
72
|
+
- **Short links** (`--short`, and the default for `--md`, once `"shorten": "gist"` is in `cad.config.json`'s
|
|
73
|
+
`targets`): the link's data goes in a secret GitHub Gist (unlisted, but anyone with the link can open it) and the
|
|
74
|
+
link carries only its ID: `…/#s=<id>`. The page fetches it from GitHub's API. The same model reuses its Gist
|
|
75
|
+
(`.cache/links.json`). `npm create rulecad` asks which you want. Without it, links carry the model, and `cad link`
|
|
76
|
+
says when one is too long for chat or email (over 8,000 characters).
|
|
77
|
+
- **Boards** travel light: the board drawn from both sides (the page makes the front and back views from its layers)
|
|
78
|
+
and the schematic, with coordinates rounded to what a screen can show.
|
|
75
79
|
- **Parts panel:** the page lists parts by kind (keycap ×9), opening to each copy (key-1-1). Each row shows or hides
|
|
76
80
|
its parts and sets their style (solid, wireframe, x-ray, faint); the view has a mode, an explode slider, and
|
|
77
81
|
switches for supports and references. Click a part in the model to select its copy and see its size.
|
package/bin/cad.mjs
CHANGED
|
@@ -330,8 +330,11 @@ async function shorten(l) {
|
|
|
330
330
|
|
|
331
331
|
// --md: one line of labelled Markdown links, the form agents paste into chat (CLAUDE.md, "Replies with links").
|
|
332
332
|
// Short (a Gist) unless --long; plain output is long (nothing uploaded) unless --short.
|
|
333
|
+
const TOO_LONG = 8000; // characters: past this, chat apps and email cut a link short or refuse it
|
|
333
334
|
async function printLinks(l) {
|
|
334
335
|
if ((opt('md') && !opt('long')) || opt('short')) l = await shorten(l);
|
|
336
|
+
if (!l.short && l.view.length > TOO_LONG) console.error(`this link is ${(l.view.length / 1024).toFixed(0)} KB, too long for chat or email. ${hasTarget('shorten')
|
|
337
|
+
? 'Leave out --long for a short one.' : 'For short links, add "shorten": "gist" to "targets" in cad.config.json: each model you share is then stored in a secret GitHub Gist (needs the gh command, signed in).'}`);
|
|
335
338
|
// One link: the page picks which parts go in a download (all of them, one key, only the case)
|
|
336
339
|
if (opt('md')) return console.log(`**${[l.title, l.version].filter(Boolean).join(' ')}**${l.src.includes('+') ? ' (not a release)' : ''}: [View and download](${l.view})`);
|
|
337
340
|
console.log(`${l.src}, ${l.short ? 'short links (data in a secret Gist)' : `${(l.size / 1024).toFixed(1)} KB links`}${l.src.includes('+') ? ' (not a release: the link shows it)' : ''}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/cad",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "The cad command: JSCAD designs from traceable rules, checked for printing and fit, versioned by what fits, shared as links and exported as Bambu 3MF.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|