Skip to content

Isometric line figures that answer the pointer. For React and for anything with a DOM.

Skill: step 0 reads an SVG the person brought, and source.md says how to read it into an object and its parts

Lucas Marques6d66674b9f9f
diff --git a/packages/hairline/test/skill/shape.test.ts b/packages/hairline/test/skill/shape.test.ts
index b7016a4..33c73d4 100644
--- a/packages/hairline/test/skill/shape.test.ts
+++ b/packages/hairline/test/skill/shape.test.ts
@@ -7,10 +7,10 @@ import { expect, it } from "vitest";
/** The skill folder is what an agent installs: these hold its shape. */
const SKILL = fileURLToPath(new URL("../../../../skills/hairline-create/", import.meta.url));
-const FILES = ["SKILL.md", "bench.html", "build.mjs", "concepts.md", "examples/riffle.js", "examples/terrain.js", "kernel.js", "look.md", "look.mjs", "rules.md", "validate.mjs"];
+const FILES = ["SKILL.md", "bench.html", "build.mjs", "concepts.md", "examples/riffle.js", "examples/terrain.js", "kernel.js", "look.md", "look.mjs", "read.mjs", "rules.md", "source.md", "validate.mjs"];
const text = (p: string) => readFileSync(SKILL + p, "utf8");
-it("holds exactly its eleven files", () => {
+it("holds exactly its thirteen files", () => {
const found = (readdirSync(SKILL, { recursive: true, withFileTypes: true }) as import("node:fs").Dirent[])
.filter((e) => e.isFile())
.map((e) => (e.parentPath + "/" + e.name).slice(SKILL.length).replace(/^\//, ""));
@@ -106,3 +106,27 @@ it("concepts.md says how to draw an empty state and how to draw from a mark, and
expect(look).toMatch(/^13\. \*\*An empty state says something is missing\.\*\*/m);
expect(text("SKILL.md").split("\n").length).toBeLessThan(120);
});
+
+it("SKILL.md has a step 0 that reads an SVG the person brought, and source.md says how to read the card", () => {
+ const skill = text("SKILL.md");
+ expect(skill).toMatch(/^## 0\. Source$/m);
+ const step0 = skill.split("## 0. Source")[1].split("\n## ")[0];
+ expect(step0).toContain("`node read.mjs <file.svg>`");
+ expect(step0).toContain("`source.md`");
+ expect(step0).toMatch(/every concept in step 1 keeps them/);
+ /* with a source the concepts vary in the gesture, or in the form and the read-out when the gesture was given */
+ const step1 = skill.split("## 1. Concept")[1].split("\n## ")[0];
+ expect(step1).toMatch(/With a source \(step 0\), every concept keeps the object and its parts: they differ in the gesture, or, when the gesture came with the request, in the form and the read-out\./);
+ /* the look is told about the source */
+ expect(skill.split("## 3. Check")[1].split("\n## ")[0]).toContain("`--source <file.svg>`");
+ /* the two habits */
+ expect(skill).toMatch(/\| tracing a path from the SVG, or copying its coordinates \| build the part as a solid with the proportions the card gives \(`source\.md`\) \|/);
+ expect(skill).toMatch(/\| keeping a part of the SVG that is decoration \| drop it: two or three parts make the object \|/);
+ const source = text("source.md");
+ expect(source).toMatch(/\*\*The SVG gives the identity, not the paths\./);
+ expect(source).toMatch(/Never trace a path\./);
+ for (const q of ["What is the object?", "Which parts make it that object?", "Which proportions must survive?", "What is decoration?", "What does the object answer?"]) expect(source, q).toContain(`**${q}**`);
+ expect(source).toContain("Six answers already proven");
+ expect(source).toContain("the picture wins");
+ expect(skill.split("\n").length).toBeLessThan(120);
+});
diff --git a/skills/hairline-create/SKILL.md b/skills/hairline-create/SKILL.md
index c5faccf..7145c4e 100644
--- a/skills/hairline-create/SKILL.md
+++ b/skills/hairline-create/SKILL.md
@@ -12,6 +12,10 @@ You write one thing: the figure. The engine (`kernel.js`) and the page (`bench.h
Every file named below is in this skill's folder. The figure and the page are written in the person's working directory: run `build.mjs`, `validate.mjs` and `look.mjs` from there, by their path in this folder.
+## 0. Source
+
+Only when the request came with an `.svg` file. Run `node read.mjs <file.svg>`: it writes the SVG as a picture and a card of what it measured, both in the working directory. Then read `source.md` and answer its questions. The object and its parts are now fixed: every concept in step 1 keeps them.
+
## 1. Concept
Read `concepts.md`. It has a section for an empty state and one for a figure drawn from a mark. Then offer two or three concepts, one line each:
@@ -20,6 +24,8 @@ Read `concepts.md`. It has a section for an empty state and one for a figure dra
Wait for the person to pick. Skip this step only when they arrived with the object and the gesture already chosen. If there is nobody to ask, take the concept with the strongest rest pose and say which you took.
+With a source (step 0), every concept keeps the object and its parts: they differ in the gesture, or, when the gesture came with the request, in the form and the read-out.
+
One figure, one idea. A concept that needs a label to be understood is not a concept yet.
## 2. Build
@@ -37,7 +43,7 @@ One figure, one idea. A concept that needs a label to be understood is not a con
## 3. Check
-1. `node look.mjs <name>.js --answer x,y,z --edge x,y,z`, the points being world points of your figure, as `look.md` says. It builds the page, validates it, takes the eight pictures on one sheet, `hairline-<name>-look.png`, and checks the frame, the read-out and the console. Fix every line it prints as failed, and run it again until it exits 0.
+1. `node look.mjs <name>.js --answer x,y,z --edge x,y,z`, and `--source <file.svg>` when there is one, the points being world points of your figure, as `look.md` says. It builds the page, validates it, takes the eight pictures on one sheet, `hairline-<name>-look.png`, and checks the frame, the read-out and the console. Fix every line it prints as failed, and run it again until it exits 0.
2. Read `look.md`, then the sheet, and answer its questions. Fix what fails, then go back to 1.
`look.mjs` needs a browser and installs `playwright-core` once, outside this folder. Without one, check with `node validate.mjs hairline-<name>.html` after each build and do the look as `look.md` says under "Without a browser". Without Node, read the list of checks at the top of `validate.mjs` and answer each one from your code.
@@ -74,3 +80,5 @@ When the person asks for a change, edit only `<name>.js`, then run `look.mjs` ag
| editing the kernel or the bench to make something work | the figure is wrong; change the figure |
| making the tour visit every part in turn | three stops that each show a different answer, then a leave: a lap is a sentence, not an inventory |
| letting in a second idea | cut it: one figure, one idea |
+| tracing a path from the SVG, or copying its coordinates | build the part as a solid with the proportions the card gives (`source.md`) |
+| keeping a part of the SVG that is decoration | drop it: two or three parts make the object |
diff --git a/skills/hairline-create/source.md b/skills/hairline-create/source.md
new file mode 100644
index 0000000..19b7af9
--- /dev/null
+++ b/skills/hairline-create/source.md
@@ -0,0 +1,23 @@
+# From a drawing the person already has
+
+`read.mjs` wrote two files: `hairline-<name>-source.png`, the SVG as it looks, and `hairline-<name>-source.txt`, the card: its viewBox, title and ids, the ink's box, and one line per painted shape with its box, centre, paint and its relation to the shape it sits in or touches. Look at the picture. Read the card. Then answer these, in order, before any concept is written.
+
+**The SVG gives the identity, not the paths. The figure is rebuilt as solids, with the source's proportions, in the kernel's style. Never trace a path.** The person will know their object by its parts and its proportions, not by its coordinates.
+
+1. **What is the object?** One word, from the picture, before reading the card. Then check it against the `title`, the ids and the card. When the picture and the card disagree, the picture wins: ids are what the author typed, the picture is what they drew.
+2. **Which parts make it that object?** Two or three, each pointing at card lines: `#1 the body, #3 and #4 the fins, #5 the flame`. This is step 2 of `concepts.md`, "find what gives it away", now with evidence. Keep the list: the figure draws from it, and the look (`look.md`, item 14) checks the rest pose against it.
+3. **Which proportions must survive?** The ink box's ratio, and the two or three relations between parts that weigh most: the fins at the base, each as wide as a third of the body; the flame below, a third of the body's height. These are the numbers that go into `rings` and `prism`. Everything else is yours to decide in the kernel's terms.
+4. **What is decoration?** Shadows, glows, double outlines, the small shapes the card counted, anything that is there for colour. It stays out. A figure has one stroke in four weights (rule 04): what the SVG said with colour, the figure says with one bright mark.
+5. **What does the object answer?** If the request named the gesture, it is fixed: the concepts keep it and differ in the form the object takes and in what the read-out says. If it did not, ask what a hand would do with this object. The table "Six answers already proven" in `concepts.md` is the menu, and each concept takes a different answer from it.
+
+Then write the concepts as step 1 of `SKILL.md` says, all with the same object and the same parts.
+
+## What the card cannot say
+
+- **Depth.** The SVG is flat. You decide what stands up and what lies down: a rocket stands on its fins, a card lies on its tray. The rest pose (rule 05) is where that decision shows.
+- **Which part answers.** The card lists parts; it does not know which one a hand would reach for. Prefer the concept whose answering part is also the one that gives the object away.
+- **Whose it is.** A mark that belongs to someone else is theirs to publish or not: say so at hand-over, as "From a mark" in `concepts.md` says.
+
+## Without a browser
+
+The card is reduced to the viewBox, the title, the ids, the counts and what was not read, and there is no picture. Read the SVG's own text for the rest: each shape's attributes give its box well enough for proportions. Say at hand-over, in these words, that the source was **not seen in a browser**.