copperflow 0.3.1 → 0.3.3
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/README.md +4 -1
- package/dist/app/assets/{NewPartDialog-Qb7NwhBb.js → NewPartDialog-B_cnPuI-.js} +38 -38
- package/dist/app/assets/{index-C_TXwo-N.js → index-CjN3tctq.js} +1 -1
- package/dist/app/index.html +1 -1
- package/dist/cli-commands.d.ts +3 -0
- package/dist/cli-commands.js +25 -2
- package/dist/cli-commands.js.map +1 -1
- package/dist/core/fabrication.d.ts +6 -0
- package/dist/core/fabrication.js +1 -1
- package/dist/core/fabrication.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/render.d.ts +45 -0
- package/dist/core/render.js +57 -0
- package/dist/core/render.js.map +1 -0
- package/dist/engine/footprints/file.d.ts +33 -0
- package/dist/engine/footprints/file.js +13 -5
- package/dist/engine/footprints/file.js.map +1 -1
- package/dist/mcp/compact.js +17 -5
- package/dist/mcp/compact.js.map +1 -1
- package/dist/mcp/create-part.d.ts +3 -3
- package/dist/mcp/create-part.js +5 -3
- package/dist/mcp/create-part.js.map +1 -1
- package/dist/mcp/guide.js +1 -0
- package/dist/mcp/guide.js.map +1 -1
- package/dist/mcp/render-tool.d.ts +30 -0
- package/dist/mcp/render-tool.js +33 -0
- package/dist/mcp/render-tool.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +5 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/render/render.js +2005 -0
- package/dist/skill-install.d.ts +3 -2
- package/dist/skill-install.js +27 -12
- package/dist/skill-install.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -2
- package/skills/copperflow/SKILL.md +9 -9
- package/skills/copperflow/references/copper.md +2 -0
- package/skills/copperflow/references/planning.md +143 -0
- package/skills/copperflow-plan/SKILL.md +25 -0
package/dist/skill-install.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export interface InstallSkillOptions {
|
|
|
7
7
|
home?: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Copies the copperflow
|
|
11
|
-
*
|
|
10
|
+
* Copies the copperflow skills into `.claude/skills` of the project (or of the home folder), where an agent that
|
|
11
|
+
* reads skills finds them, and answers with one line saying where. Files of an earlier copy are replaced; other
|
|
12
|
+
* skills in that folder are left alone. Every target is checked before anything is copied.
|
|
12
13
|
*/
|
|
13
14
|
export declare function installSkill(options: InstallSkillOptions): Promise<string>;
|
package/dist/skill-install.js
CHANGED
|
@@ -2,27 +2,42 @@ import { cp, lstat, mkdir, readdir } from "node:fs/promises";
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
/** The
|
|
6
|
-
const
|
|
5
|
+
/** The skills as they ship: `skills/` beside `dist` in the package (and beside `src` in the source tree). */
|
|
6
|
+
const SHIPPED = fileURLToPath(new URL("../skills", import.meta.url));
|
|
7
|
+
/** The skills by folder name: how to work in a project, and how to plan a board before the first circuit file. */
|
|
8
|
+
const SKILLS = ["copperflow", "copperflow-plan"];
|
|
7
9
|
/** How many files are under `folder`. */
|
|
8
10
|
async function countFiles(folder) {
|
|
9
11
|
const entries = await readdir(folder, { withFileTypes: true, recursive: true });
|
|
10
12
|
return entries.filter((entry) => entry.isFile()).length;
|
|
11
13
|
}
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
* that reads skills finds it, and answers with one line saying where. Files of an earlier copy are replaced.
|
|
15
|
-
*/
|
|
16
|
-
export async function installSkill(options) {
|
|
17
|
-
const base = options.global ? (options.home ?? homedir()) : options.cwd;
|
|
18
|
-
const target = join(base, ".claude", "skills", "copperflow");
|
|
14
|
+
/** Whether `target` is already a skill folder; a link or a file in its place is refused. */
|
|
15
|
+
async function alreadyThere(target) {
|
|
19
16
|
const there = await lstat(target).catch(() => undefined);
|
|
20
17
|
if (there?.isSymbolicLink())
|
|
21
18
|
throw new Error(`${target} is a link; remove it and run this again`);
|
|
22
19
|
if (there && !there.isDirectory())
|
|
23
20
|
throw new Error(`${target} is a file; remove it and run this again`);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
return there !== undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Copies the copperflow skills into `.claude/skills` of the project (or of the home folder), where an agent that
|
|
25
|
+
* reads skills finds them, and answers with one line saying where. Files of an earlier copy are replaced; other
|
|
26
|
+
* skills in that folder are left alone. Every target is checked before anything is copied.
|
|
27
|
+
*/
|
|
28
|
+
export async function installSkill(options) {
|
|
29
|
+
const base = options.global ? (options.home ?? homedir()) : options.cwd;
|
|
30
|
+
const folder = join(base, ".claude", "skills");
|
|
31
|
+
const before = [];
|
|
32
|
+
for (const name of SKILLS)
|
|
33
|
+
before.push(await alreadyThere(join(folder, name)));
|
|
34
|
+
let files = 0;
|
|
35
|
+
for (const name of SKILLS) {
|
|
36
|
+
await mkdir(join(folder, name), { recursive: true });
|
|
37
|
+
await cp(join(SHIPPED, name), join(folder, name), { recursive: true, force: true });
|
|
38
|
+
files += await countFiles(join(SHIPPED, name));
|
|
39
|
+
}
|
|
40
|
+
const verb = before.some(Boolean) ? "Updated" : "Installed";
|
|
41
|
+
return `${verb} the copperflow skills (${SKILLS.join(", ")}; ${files} files) in ${folder}. Start a new agent session to load them.`;
|
|
27
42
|
}
|
|
28
43
|
//# sourceMappingURL=skill-install.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-install.js","sourceRoot":"","sources":["../src/skill-install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI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CAAA;AACrI,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.3.
|
|
1
|
+
export declare const VERSION = "0.3.3";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "0.3.
|
|
1
|
+
export const VERSION = "0.3.3";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copperflow",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Design circuits in code with a human and an AI agent editing the same files.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Eren Kürpe",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"NOTICE"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "tsc -p tsconfig.build.json && vite build --config studio/vite.config.ts",
|
|
37
|
+
"build": "tsc -p tsconfig.build.json && node scripts/build-render.mjs && vite build --config studio/vite.config.ts",
|
|
38
38
|
"typecheck": "tsc --noEmit && tsc --noEmit -p studio/tsconfig.json",
|
|
39
39
|
"test": "vitest run",
|
|
40
40
|
"test:perf": "vitest run --mode perf --no-file-parallelism --silent=false",
|
|
@@ -62,5 +62,8 @@
|
|
|
62
62
|
"typescript": "7.0.2",
|
|
63
63
|
"vite": "8.3.5",
|
|
64
64
|
"vitest": "5.1.0"
|
|
65
|
+
},
|
|
66
|
+
"optionalDependencies": {
|
|
67
|
+
"@napi-rs/canvas": "1.1.1"
|
|
65
68
|
}
|
|
66
69
|
}
|
|
@@ -44,8 +44,8 @@ first line of its answer. The worked example is in
|
|
|
44
44
|
means, `replace`, refused pins and the export's warnings are in
|
|
45
45
|
[references/writing-circuits.md](references/writing-circuits.md).
|
|
46
46
|
|
|
47
|
-
1. **
|
|
48
|
-
|
|
47
|
+
1. **Plan.** A new board starts with [references/planning.md](references/planning.md): every
|
|
48
|
+
question for the person in one message, blocks with ports, a sub-agent per block. Then `set_project`
|
|
49
49
|
`{ intent, blocks: [{ name, does, status }], open }` writes PROJECT.md:
|
|
50
50
|
`Change c0001: Intent, Blocks, Open written to PROJECT.md`. `intent` is a string of at most
|
|
51
51
|
2000 characters, `blocks` an array of at most 50 objects, `open` an array of at most 50
|
|
@@ -78,9 +78,9 @@ means, `replace`, refused pins and the export's warnings are in
|
|
|
78
78
|
Unused inputs of a chip: tie them off as the datasheet says and `note_decision` it, or flag
|
|
79
79
|
them with `set_props` `{ part: "U1", props: { noConnect: "pin4,pin5" } }` (null removes), or
|
|
80
80
|
give `noConnect` in the part's `props` in `new_circuit`.
|
|
81
|
-
3. **Blocks first.**
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
3. **Blocks first.** Every block of the plan is a sub-sheet with ports, also a block used once;
|
|
82
|
+
only a small board (about fifteen parts, nothing repeated) is written flat, its blocks named in
|
|
83
|
+
PROJECT.md's Blocks and later placed together with `autoplace { parts: [...] }`.
|
|
84
84
|
`new_circuit` `{ file, parts, nets, sheets, instances, place: false }` writes the circuit and
|
|
85
85
|
each `<name>.sheet.tsx`: `Change c0002: wrote main.circuit.tsx, Channel.sheet.tsx`, then the
|
|
86
86
|
counts, one line per instance (`CH1 Channel base 100: IN=AIN1 GND=GND`), `N nets, M traces`
|
|
@@ -120,12 +120,12 @@ means, `replace`, refused pins and the export's warnings are in
|
|
|
120
120
|
8. **Board shape and connectors.** `fit_board` `{ file, margin? }`:
|
|
121
121
|
`Change c0010: board 42 × 28 mm (margin 2 mm)`; or `autoplace` with `fit: true`.
|
|
122
122
|
Mounting holes with `add_hole` `{ file, x, y, diameter }`.
|
|
123
|
-
9. **Fine tuning.** `board_summary` `{ file }`
|
|
123
|
+
9. **Fine tuning.** `board_summary` `{ file }` reads the board: `main.circuit.tsx: Board 42 × 28 mm,
|
|
124
124
|
2 layers, courtyards use 38%; 24 parts, 18 nets`, one line per part
|
|
125
125
|
(`U1 MCP2515 soic18w @(12.0, 8.5) r90 top [LOCKED]`), the ten longest connections with both pads' places,
|
|
126
|
-
`Courtyards overlap (n):`, `Off the board (n):`, `Pours:` and `Unrouted: N connections`.
|
|
127
|
-
a
|
|
128
|
-
|
|
126
|
+
`Courtyards overlap (n):`, `Off the board (n):`, `Pours:` and `Unrouted: N connections`. `render` `{ file }`
|
|
127
|
+
is your eyes, a PNG of the board as the person sees it: look after `autoplace` and after `autoroute`; `parts` zooms.
|
|
128
|
+
Move a part with `set_props` `{ pcbX, pcbY, pcbRotation }` only for a reason, never one the human placed unless asked.
|
|
129
129
|
10. **Pours.** `add_pour` `{ file, net: "GND", layer: "top" }` on the layer the parts sit on:
|
|
130
130
|
`Change …: added copperpour:1 (GND, top)` and `copperpour:1 GND top: … mm², joins N pads`.
|
|
131
131
|
On a two-layer board pour GND on both layers (`top` and `bottom`) before `autoroute`.
|
|
@@ -19,6 +19,8 @@ it is across with its load capacitors on its far side, and a pull-up or an LED's
|
|
|
19
19
|
the pin it serves. After `autoplace`, read `board_summary`'s longest connections: a part far
|
|
20
20
|
from the pin it serves shows there with both pads' places. Move it with `set_props`
|
|
21
21
|
`{ pcbX, pcbY, pcbRotation }`; it then has a position, and `autoplace` leaves it alone.
|
|
22
|
+
Look at the board with `render` `{ file }` after `autoplace` and again after `autoroute`: it is the
|
|
23
|
+
Studio's own drawing, what the person sees; `parts: ["U1", "C3"]` zooms to those parts.
|
|
22
24
|
|
|
23
25
|
Connectors are placed last, into the edge room the other parts left, so on a tight board a
|
|
24
26
|
connector can land far from the part it serves. If `board_summary` or `copper_summary` shows a
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Planning a board: questions, blocks, sub-agents
|
|
2
|
+
|
|
3
|
+
Read this before the first circuit file of a new board. The plan comes before parts and nets: what
|
|
4
|
+
the person wants, the board as a tree of blocks with named ports, and who designs each block. A
|
|
5
|
+
block that is used eight times is designed once and placed eight times; that is what keeps a
|
|
6
|
+
large board small enough to think about.
|
|
7
|
+
|
|
8
|
+
## 1. Ask everything first
|
|
9
|
+
|
|
10
|
+
Ask in one message, numbered and grouped as below, so the person can answer by number. Leave out
|
|
11
|
+
what the brief already answers. Give each question the answer you would take by default, so that
|
|
12
|
+
"defaults" is a complete reply. A question the person leaves open goes into PROJECT.md's `Open`
|
|
13
|
+
with the default you assumed; do not come back later with a question you could have asked here.
|
|
14
|
+
|
|
15
|
+
1. **Purpose.** What the board does, where it is used, how many will be made.
|
|
16
|
+
2. **Counts.** How many of everything that repeats: inputs, outputs, channels, relays, sensors,
|
|
17
|
+
LEDs, motor drivers. Ask for a number, not "a few": each repeated function becomes one block
|
|
18
|
+
placed that many times, and the count sets the connectors and the pins of the controller.
|
|
19
|
+
3. **Power.** Each source and its voltage range, the largest current, battery or not, the
|
|
20
|
+
protection wanted (reverse polarity, fuse, ESD on outside pins), the rails the parts need.
|
|
21
|
+
4. **Outside connections.** For each one: its signals, the connector (type and pitch, or "any
|
|
22
|
+
header"), the board edge it sits on, what is at the other end of the cable.
|
|
23
|
+
5. **Parts.** Part numbers the person insists on (the controller, a radio, a sensor) and which
|
|
24
|
+
are free to choose; the smallest package (0402, 0603, hand soldered or assembled by the fab);
|
|
25
|
+
whether parts must come from one supplier's catalogue.
|
|
26
|
+
6. **Signals that set rules.** Bus speeds (USB, CAN bit rate, SPI clock), analog accuracy,
|
|
27
|
+
currents in power paths, isolation, lengths that matter.
|
|
28
|
+
7. **The board.** Size or shape limits, layers (two unless said), mounting holes, height limits,
|
|
29
|
+
the enclosure.
|
|
30
|
+
8. **Bring-up.** Programming or debug connector, test points, status LEDs, buttons.
|
|
31
|
+
9. **Conditions.** Temperature range, automotive or industrial supply, what a standard requires.
|
|
32
|
+
10. **Later.** What the person wants to decide later.
|
|
33
|
+
|
|
34
|
+
## 2. The block tree
|
|
35
|
+
|
|
36
|
+
Split the board into blocks before choosing a single part.
|
|
37
|
+
|
|
38
|
+
- A block does one job and has **ports**: the nets that cross its edge. Name every port and say
|
|
39
|
+
what it carries: `VIN 7 to 24 V in`, `V3_3 3.3 V 300 mA out`, `IN 0 to 24 V from the field`,
|
|
40
|
+
`OUT 3.3 V logic to the controller`. Names are letters, digits and `_`, not starting with a digit.
|
|
41
|
+
- A function that repeats is **one block and a count**: `Input x8`. Nothing inside it may depend
|
|
42
|
+
on which of the eight it is; what differs between them arrives through a port.
|
|
43
|
+
- A block of more than about fifteen parts is two blocks.
|
|
44
|
+
- Power first: write the supply tree (which block feeds which rail, with currents) before the
|
|
45
|
+
signal blocks, so every block's supply port has a source.
|
|
46
|
+
- The top level holds only what joins blocks: connectors shared by several blocks and the nets
|
|
47
|
+
between ports. Each of those nets is named once, here: `IN1` to `IN8` from the terminal to the
|
|
48
|
+
input blocks, `DI1` to `DI8` from the input blocks to the controller.
|
|
49
|
+
- A small board (about fifteen parts, nothing repeated) is one flat circuit: its blocks are named
|
|
50
|
+
in the plan and written at the top level. Every larger board is written as sheets, one per
|
|
51
|
+
block, also for a block used once.
|
|
52
|
+
|
|
53
|
+
Write the plan with `set_project`, each block's `does` carrying its job, its count and its ports:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
set_project {
|
|
57
|
+
intent: "Eight 24 V digital inputs read by an STM32G030 and reported over RS-485; 24 V in, 3.3 V rail.",
|
|
58
|
+
blocks: [
|
|
59
|
+
{ name: "Power", does: "24 V to 3.3 V 300 mA buck; ports VIN, V3_3, GND", status: "planned" },
|
|
60
|
+
{ name: "Input", does: "x8: 24 V input with divider, clamp and RC filter; ports IN, OUT, V3_3, GND", status: "planned" },
|
|
61
|
+
{ name: "Controller", does: "STM32G030 with decoupling and SWD header; ports V3_3, GND, DI1 to DI8, TX, RX, DE", status: "planned" },
|
|
62
|
+
{ name: "Bus", does: "RS-485 transceiver with termination jumper; ports V3_3, GND, TX, RX, DE, A, B", status: "planned" }
|
|
63
|
+
],
|
|
64
|
+
open: ["assumed: 0603 parts, assembled by the fab", "approval of the plan", "blocks, then the board"]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then show the person the block list, the supply tree and what you assumed, and ask whether to go
|
|
69
|
+
on. Wait for a yes and `note_decision` it. Changing the split is cheap now and costly later.
|
|
70
|
+
|
|
71
|
+
## 3. One sub-agent per block
|
|
72
|
+
|
|
73
|
+
When your client can start sub-agents, give each block to one, several at a time. A repeated
|
|
74
|
+
block goes to one sub-agent, once. Without sub-agents, do the same yourself, one block after
|
|
75
|
+
another, in the same shape: finish a block before you start the next.
|
|
76
|
+
|
|
77
|
+
The brief is all a sub-agent knows. Give it:
|
|
78
|
+
|
|
79
|
+
- the board in one or two lines (from the Intent);
|
|
80
|
+
- the block: its job, every port with what it carries, and the limits from the answers (packages,
|
|
81
|
+
supplier, parts the person fixed);
|
|
82
|
+
- the tools: `guide` for how to work, `list_parts`, `part_info`, `create_part` and
|
|
83
|
+
`attach_datasheet` for parts. **It writes no circuit file**: no `new_circuit`, `edit_circuit`,
|
|
84
|
+
`place_part` or `connect_nets`. Only you write the circuit, once, in step 4;
|
|
85
|
+
- what to send back, below.
|
|
86
|
+
|
|
87
|
+
A sub-agent sends back the block as one sheet in the shape `new_circuit` takes, and a few lines:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Input: {
|
|
91
|
+
parts: [ { name: "R1", kind: "resistor", value: "10k", footprint: "0603" },
|
|
92
|
+
{ name: "R2", kind: "resistor", value: "1.5k", footprint: "0603" },
|
|
93
|
+
{ name: "C1", kind: "capacitor", value: "100nF", footprint: "0603" },
|
|
94
|
+
{ name: "R3", kind: "resistor", value: "1k", footprint: "0603" } ],
|
|
95
|
+
nets: { IN: ["R1.pin1"], DIV: ["R1.pin2", "R2.pin1", "R3.pin1"],
|
|
96
|
+
OUT: ["R3.pin2", "C1.pin1"], GND: ["R2.pin2", "C1.pin2"] },
|
|
97
|
+
ports: ["IN", "OUT", "GND"] }
|
|
98
|
+
parts created: none
|
|
99
|
+
decisions: 10k over 1.5k gives 3.1 V at 24 V in; the 1k and 100 nF filter at 1.6 kHz
|
|
100
|
+
questions: V3_3 is not needed by this block; drop the port?
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- Designators are local and start at 1 in every block (R1, C1, U1); each use gets its own on the
|
|
104
|
+
board (R101, R201).
|
|
105
|
+
- Every port is a net of the block, and no net leaves the block except through a port.
|
|
106
|
+
- Parts are chosen in the order of SKILL.md step 2. A chip that is not in the library is created
|
|
107
|
+
with `create_part` from its datasheet, which the sub-agent finds and reads with its own web
|
|
108
|
+
access; `attach_datasheet` records the link and the page. It reports each created part and
|
|
109
|
+
that it is not verified.
|
|
110
|
+
|
|
111
|
+
## 4. Put the blocks together
|
|
112
|
+
|
|
113
|
+
1. Check each block against the plan: its ports are the plan's ports, every `part:` id is in
|
|
114
|
+
`list_parts`, and its nets name only its own parts. Settle the sub-agents' questions, with the
|
|
115
|
+
person where the answer is theirs, and update the plan when a port changes.
|
|
116
|
+
2. Write the board with **one** `new_circuit`: the blocks as `sheets`, one entry in `instances`
|
|
117
|
+
for each use, and at the top level only the shared connectors and their nets. A port is
|
|
118
|
+
connected to a top-level net in `connections`:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
new_circuit {
|
|
122
|
+
file: "io.circuit.tsx", place: false,
|
|
123
|
+
sheets: { Input: { … }, Power: { … }, Controller: { … }, Bus: { … } },
|
|
124
|
+
instances: [
|
|
125
|
+
{ sheet: "Power", name: "PS1", connections: { VIN: "V24", V3_3: "V3_3", GND: "GND" } },
|
|
126
|
+
{ sheet: "Input", name: "CH1", connections: { IN: "IN1", OUT: "DI1", GND: "GND" } },
|
|
127
|
+
{ sheet: "Input", name: "CH2", connections: { IN: "IN2", OUT: "DI2", GND: "GND" } },
|
|
128
|
+
… one line for each of the eight …
|
|
129
|
+
{ sheet: "Controller", name: "MCU1", connections: { V3_3: "V3_3", GND: "GND", DI1: "DI1", DI2: "DI2", … } }
|
|
130
|
+
],
|
|
131
|
+
parts: [ { name: "J1", kind: "pinheader", props: { pinCount: 10 } } ],
|
|
132
|
+
nets: { V24: ["J1.pin1"], GND: ["J1.pin2"], IN1: ["J1.pin3"], IN2: ["J1.pin4"], … }
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
An instance name and a net name are different words (`CH1`, not `IN1`).
|
|
137
|
+
3. `check_circuit` once. An error inside a block is the block's: correct the sheet and write the
|
|
138
|
+
board again with `replace: true`, so every use gets the correction.
|
|
139
|
+
4. `set_project` with each block's status `designed`, then go on with SKILL.md at "Ask the
|
|
140
|
+
person before the PCB". On the board, place block by block: `autoplace` `{ file, instance }`.
|
|
141
|
+
|
|
142
|
+
One more input later is one more instance (`edit_circuit` with `add_instance`), not eight more
|
|
143
|
+
parts.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: copperflow-plan
|
|
3
|
+
description: Plan a new circuit board in a copperflow project before any circuit file is written. Use when the person asks for a new board, circuit, PCB or module, or a new block on one. Asks the person every question the design needs, splits the board into blocks with named ports (a repeated function is one block and a count), and gives each block to a sub-agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Planning a copperflow board
|
|
7
|
+
|
|
8
|
+
Do this before the first `new_circuit`, also when the request looks simple.
|
|
9
|
+
|
|
10
|
+
The whole method is in the copperflow skill's planning reference: read
|
|
11
|
+
[../copperflow/references/planning.md](../copperflow/references/planning.md) (or call the
|
|
12
|
+
copperflow server's `guide` tool with `{ topic: "planning" }`) and follow it in order:
|
|
13
|
+
|
|
14
|
+
1. **Ask everything first**, in one numbered message with your defaults: purpose, counts of
|
|
15
|
+
everything that repeats, power, outside connections, parts, signals that set rules, the board,
|
|
16
|
+
bring-up, conditions.
|
|
17
|
+
2. **The block tree.** Each block does one job and has named ports; a repeated function is one
|
|
18
|
+
block and a count; power first. Write it with `set_project` and get the person's yes.
|
|
19
|
+
3. **One sub-agent per block**, which sends back the block as one sheet (`parts`, `nets`,
|
|
20
|
+
`ports`) and writes no circuit file.
|
|
21
|
+
4. **Put the blocks together** with one `new_circuit` (`sheets` and `instances`), then
|
|
22
|
+
`check_circuit`.
|
|
23
|
+
|
|
24
|
+
After the plan, go on with the copperflow skill's design workflow at "Ask the person before the
|
|
25
|
+
PCB".
|