circuit-weaver 0.10.1__tar.gz
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.
- circuit_weaver-0.10.1/LICENSE +21 -0
- circuit_weaver-0.10.1/PKG-INFO +504 -0
- circuit_weaver-0.10.1/README.md +470 -0
- circuit_weaver-0.10.1/pyproject.toml +50 -0
- circuit_weaver-0.10.1/setup.cfg +4 -0
- circuit_weaver-0.10.1/src/circuit_weaver/__init__.py +8 -0
- circuit_weaver-0.10.1/src/circuit_weaver/__main__.py +19 -0
- circuit_weaver-0.10.1/src/circuit_weaver/allocator.py +417 -0
- circuit_weaver-0.10.1/src/circuit_weaver/api.py +588 -0
- circuit_weaver-0.10.1/src/circuit_weaver/autoroute.py +199 -0
- circuit_weaver-0.10.1/src/circuit_weaver/component_db.py +1557 -0
- circuit_weaver-0.10.1/src/circuit_weaver/cost_bom.py +188 -0
- circuit_weaver-0.10.1/src/circuit_weaver/design_ir.py +471 -0
- circuit_weaver-0.10.1/src/circuit_weaver/design_logger.py +233 -0
- circuit_weaver-0.10.1/src/circuit_weaver/diff_renderer.py +448 -0
- circuit_weaver-0.10.1/src/circuit_weaver/easyeda_api.py +339 -0
- circuit_weaver-0.10.1/src/circuit_weaver/easyeda_parser.py +495 -0
- circuit_weaver-0.10.1/src/circuit_weaver/exporters.py +414 -0
- circuit_weaver-0.10.1/src/circuit_weaver/generator.py +2615 -0
- circuit_weaver-0.10.1/src/circuit_weaver/helpers/__init__.py +42 -0
- circuit_weaver-0.10.1/src/circuit_weaver/helpers/impedance.py +118 -0
- circuit_weaver-0.10.1/src/circuit_weaver/helpers/placement.py +171 -0
- circuit_weaver-0.10.1/src/circuit_weaver/helpers/silkscreen.py +446 -0
- circuit_weaver-0.10.1/src/circuit_weaver/jlcpcb_export.py +216 -0
- circuit_weaver-0.10.1/src/circuit_weaver/kicad_lib.py +813 -0
- circuit_weaver-0.10.1/src/circuit_weaver/library.py +218 -0
- circuit_weaver-0.10.1/src/circuit_weaver/mvp.py +2209 -0
- circuit_weaver-0.10.1/src/circuit_weaver/parser.py +709 -0
- circuit_weaver-0.10.1/src/circuit_weaver/parts_lookup.py +488 -0
- circuit_weaver-0.10.1/src/circuit_weaver/pcb_export.py +423 -0
- circuit_weaver-0.10.1/src/circuit_weaver/placer.py +1522 -0
- circuit_weaver-0.10.1/src/circuit_weaver/preparser.py +134 -0
- circuit_weaver-0.10.1/src/circuit_weaver/primitives.py +1513 -0
- circuit_weaver-0.10.1/src/circuit_weaver/project_spec.py +616 -0
- circuit_weaver-0.10.1/src/circuit_weaver/report.py +256 -0
- circuit_weaver-0.10.1/src/circuit_weaver/scorer.py +362 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/__init__.py +27 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/adc.py +595 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/audio_amplifier.py +348 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/base.py +680 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/battery_charger.py +298 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/battery_monitor.py +357 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/boost.py +335 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/buck.py +372 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/buck_boost.py +461 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/can_transceiver.py +327 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/charge_pump.py +269 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/clock.py +474 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/crystal_oscillator.py +260 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/current_sense.py +515 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/dac.py +517 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/display_driver.py +461 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/driver.py +325 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/ethernet.py +526 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/i2c_bus.py +432 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/ldo.py +287 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/led_driver.py +476 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/mosfet_switch.py +368 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/motor_driver.py +556 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/opamp.py +345 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/power_mux.py +378 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/protection.py +136 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/relay_driver.py +451 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/rs485_transceiver.py +303 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/sensor_frontend.py +390 -0
- circuit_weaver-0.10.1/src/circuit_weaver/subcircuits/usb.py +644 -0
- circuit_weaver-0.10.1/src/circuit_weaver/validator.py +732 -0
- circuit_weaver-0.10.1/src/circuit_weaver.egg-info/PKG-INFO +504 -0
- circuit_weaver-0.10.1/src/circuit_weaver.egg-info/SOURCES.txt +80 -0
- circuit_weaver-0.10.1/src/circuit_weaver.egg-info/dependency_links.txt +1 -0
- circuit_weaver-0.10.1/src/circuit_weaver.egg-info/entry_points.txt +2 -0
- circuit_weaver-0.10.1/src/circuit_weaver.egg-info/requires.txt +18 -0
- circuit_weaver-0.10.1/src/circuit_weaver.egg-info/top_level.txt +1 -0
- circuit_weaver-0.10.1/tests/test_autoroute.py +192 -0
- circuit_weaver-0.10.1/tests/test_bootstrap.py +109 -0
- circuit_weaver-0.10.1/tests/test_cost_bom.py +213 -0
- circuit_weaver-0.10.1/tests/test_easyeda_import.py +518 -0
- circuit_weaver-0.10.1/tests/test_helpers.py +27 -0
- circuit_weaver-0.10.1/tests/test_import_pipeline.py +395 -0
- circuit_weaver-0.10.1/tests/test_presentation.py +222 -0
- circuit_weaver-0.10.1/tests/test_sprint3.py +146 -0
- circuit_weaver-0.10.1/tests/test_template_structure.py +544 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matt Painter
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: circuit-weaver
|
|
3
|
+
Version: 0.10.1
|
|
4
|
+
Summary: Programmatic circuit design, validation, and KiCad artifact generation
|
|
5
|
+
Author: Matt Painter
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: kicad,eda,schematic,pcb,automation,circuit
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Provides-Extra: api
|
|
21
|
+
Requires-Dist: fastapi>=0.110; extra == "api"
|
|
22
|
+
Requires-Dist: uvicorn>=0.29; extra == "api"
|
|
23
|
+
Requires-Dist: python-multipart>=0.0.7; extra == "api"
|
|
24
|
+
Provides-Extra: yaml
|
|
25
|
+
Requires-Dist: PyYAML>=6.0; extra == "yaml"
|
|
26
|
+
Provides-Extra: lookup
|
|
27
|
+
Requires-Dist: requests>=2.31; extra == "lookup"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: circuit-weaver[api,lookup,yaml]; extra == "all"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="assets/circuit-weaver-banner.svg" alt="Circuit Weaver — KiCad automation engine and workflow toolkit" width="100%">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://github.com/mattpainter701/kicad_automations/actions/workflows/ci.yml">
|
|
41
|
+
<img src="https://img.shields.io/github/actions/workflow/status/mattpainter701/kicad_automations/ci.yml?branch=main&label=CI&style=flat-square" alt="CI">
|
|
42
|
+
</a>
|
|
43
|
+
<img src="https://img.shields.io/badge/python-3.10%2B-0b1320?logo=python&logoColor=ffd43b&style=flat-square" alt="Python 3.10+">
|
|
44
|
+
<img src="https://img.shields.io/badge/KiCad-10-0ea5e9?style=flat-square" alt="KiCad 10">
|
|
45
|
+
<img src="https://img.shields.io/badge/FastAPI-ready-0f766e?style=flat-square" alt="FastAPI">
|
|
46
|
+
<img src="https://img.shields.io/badge/license-MIT-1f2937?style=flat-square" alt="MIT">
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
<p align="center">
|
|
50
|
+
<strong>KiCad automation for people building real hardware.</strong><br>
|
|
51
|
+
Programmatic schematic generation, strict validation, BOM + sourcing workflows, and a clean API surface<br>
|
|
52
|
+
that takes you from design intent all the way to quote-ready KiCad outputs.
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## What It Is
|
|
58
|
+
|
|
59
|
+
Circuit Weaver has two layers that work together:
|
|
60
|
+
|
|
61
|
+
| Layer | What it is | Use it for |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| **`circuit_weaver`** package | Python library + FastAPI server | Canonical design IR, transactional patching, strict validation, KiCad artifact generation |
|
|
64
|
+
| **`skills/`, `project-skills/`, `agents/`, `rules/`** | Workflow layer | BOM auditing, part sourcing, KiCad analysis, placement, manufacturing, AI/operator playbooks |
|
|
65
|
+
|
|
66
|
+
It is designed for:
|
|
67
|
+
|
|
68
|
+
- Engineers who want KiCad-native automation without giving up real schematic outputs
|
|
69
|
+
- AI/agent workflows that need a strict, machine-readable contract instead of ad hoc script chains
|
|
70
|
+
- Downstream hardware projects that want a reusable engine instead of maintaining a custom generator forever
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Why Circuit Weaver
|
|
75
|
+
|
|
76
|
+
Most hardware automation lands at one of two bad extremes:
|
|
77
|
+
|
|
78
|
+
- A pile of one-off scripts only the original author can operate
|
|
79
|
+
- A flashy design layer disconnected from actual KiCad deliverables
|
|
80
|
+
|
|
81
|
+
Circuit Weaver sits in the useful middle:
|
|
82
|
+
|
|
83
|
+
| Property | What it means |
|
|
84
|
+
|---|---|
|
|
85
|
+
| **Canonical spec first** | YAML / Design IR is the single source of truth |
|
|
86
|
+
| **KiCad-native outputs** | Generates real `.kicad_sch` files, reports, and review SVGs |
|
|
87
|
+
| **Strict validity gates** | Structural, electrical, implementation, and presentation checks — not just "did it export" |
|
|
88
|
+
| **Agent-compatible** | Patch, validate, diff, generate, and feed PCB constraints back in predictable, machine-readable flows |
|
|
89
|
+
| **Downstream-friendly** | The engine is generic; each hardware project owns its own design assets |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 🎬 Demo Commands
|
|
94
|
+
|
|
95
|
+
**Record a live demo using asciinema** — see the complete CLI workflow in action:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
asciinema rec demo.cast # Start recording
|
|
99
|
+
# Then run the commands in docs/DEMO_COMMANDS.md step-by-step
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Workflow overview:**
|
|
103
|
+
|
|
104
|
+
1. **List templates** — `circuit-weaver list-templates` (30+ circuit templates)
|
|
105
|
+
2. **Scaffold** — Create initial design: `circuit-weaver scaffold --template buck --ref U1`
|
|
106
|
+
3. **Apply patches** — Add components: `circuit-weaver apply-patch design.yaml patch.json`
|
|
107
|
+
4. **Validate** — Check electrical rules: `circuit-weaver validate design.yaml`
|
|
108
|
+
5. **Generate** — Create KiCad schematic: `circuit-weaver generate design.yaml -o ./output`
|
|
109
|
+
6. **Cost BOM** — Estimate at qty breaks: `circuit-weaver cost-bom design.yaml --qty 1,10,100`
|
|
110
|
+
7. **Export** — JLCPCB assembly files: `circuit-weaver export-jlcpcb design.yaml -o ./jlcpcb`
|
|
111
|
+
|
|
112
|
+
**Time to fabrication:** ~5 minutes (YAML → validated schematic → JLCPCB-ready files)
|
|
113
|
+
|
|
114
|
+
See [**docs/DEMO_COMMANDS.md**](docs/DEMO_COMMANDS.md) for complete step-by-step guide.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## How It Works
|
|
119
|
+
|
|
120
|
+
<p align="center">
|
|
121
|
+
<img src="assets/circuit-weaver-pipeline.svg" alt="Circuit Weaver — full hardware workflow from requirements to quote-ready outputs" width="720">
|
|
122
|
+
</p>
|
|
123
|
+
|
|
124
|
+
### The flow in plain English
|
|
125
|
+
|
|
126
|
+
**1 — Requirements capture**
|
|
127
|
+
Start with block intent, interfaces, power rails, buses, and constraints. Codex, OpenCode, Kilo, or Claude + the engineer define the system without hand-drawing every schematic page from scratch.
|
|
128
|
+
|
|
129
|
+
**2 — Part sourcing**
|
|
130
|
+
The `digikey`, `mouser`, and `lcsc` workflow skills turn vague component choices into concrete MPNs, package decisions, datasheets, and purchasing options.
|
|
131
|
+
|
|
132
|
+
**3 — Build the canonical spec**
|
|
133
|
+
`circuit_weaver` assembles part bindings, block topology, support-circuit requirements, and all overrides into a single machine-readable YAML design IR. This is the contract everything else reads from.
|
|
134
|
+
|
|
135
|
+
**4 — Generate schematics and validate**
|
|
136
|
+
The engine emits `.kicad_sch` files, placement hints, review SVGs, and a design report. It also auto-generates common support passives and runs four grouped validation checks: **structural**, **electrical**, **implementation**, and **presentation**.
|
|
137
|
+
|
|
138
|
+
**5 — KiCad review + human polish**
|
|
139
|
+
Generated schematics are typically around **~90% complete** for serious hardware work. The last pass is still human: page aesthetics, net label readability, and the editorial judgment that is still inherently design-specific.
|
|
140
|
+
|
|
141
|
+
**6 — PCB update and route**
|
|
142
|
+
Pull the schematic into KiCad PCB, place parts, route critical nets manually, and use autoroute / Freerouting for non-critical nets where it actually helps.
|
|
143
|
+
|
|
144
|
+
**7 — Quote-ready package**
|
|
145
|
+
The result is a clean path to BOMs and outputs ready to hand to PCBWay, JLCPCB, or your preferred fabrication vendor.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Quick Start
|
|
150
|
+
|
|
151
|
+
### Installation (Automated)
|
|
152
|
+
|
|
153
|
+
**Windows (PowerShell):**
|
|
154
|
+
|
|
155
|
+
```powershell
|
|
156
|
+
git clone https://github.com/mattpainter701/kicad_automations.git
|
|
157
|
+
cd kicad_automations
|
|
158
|
+
.\install.ps1
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Mac/Linux (Bash):**
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
git clone https://github.com/mattpainter701/kicad_automations.git
|
|
165
|
+
cd kicad_automations
|
|
166
|
+
./install.sh
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
This will:
|
|
170
|
+
1. ✅ Install the `circuit-weaver` Python package
|
|
171
|
+
2. ✅ Add to your PATH (Windows only)
|
|
172
|
+
3. ✅ Register `/circuit-weaver` skill with Claude Code (globally available in any project)
|
|
173
|
+
|
|
174
|
+
Verify installation:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
circuit-weaver --version
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Use in Claude Code
|
|
181
|
+
|
|
182
|
+
Open **Claude Code in any project** and type:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
/circuit-weaver
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The skill will guide you through designing a circuit with automated IC research, passive generation, and manufacturing export.
|
|
189
|
+
|
|
190
|
+
### Or: Use the Offline CLI Wizard
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
circuit-weaver design-wizard
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Interactive guide that works completely offline (no agents or APIs). Generates a YAML spec you can then validate and generate.
|
|
197
|
+
|
|
198
|
+
### Validate a design
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
circuit-weaver validate src/circuit_weaver/examples/iot_sensor.yaml
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Generate KiCad artifacts
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
circuit-weaver generate src/circuit_weaver/examples/iot_sensor.yaml --output out/iot_sensor
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Run a Sample Design
|
|
211
|
+
|
|
212
|
+
To test the complete workflow without using the skill:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# 1. Validate a sample design
|
|
216
|
+
py -m circuit_weaver validate samples/iot_sensor_node/iot_sensor_node.yaml
|
|
217
|
+
|
|
218
|
+
# 2. Generate schematic and report
|
|
219
|
+
py -m circuit_weaver generate samples/iot_sensor_node/iot_sensor_node.yaml -o ./output
|
|
220
|
+
|
|
221
|
+
# 3. Export for JLCPCB
|
|
222
|
+
py -m circuit_weaver export-jlcpcb samples/iot_sensor_node/iot_sensor_node.yaml -o ./jlcpcb
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Generated files (schematic, BOM, CPL, design report) ready for review or ordering.
|
|
226
|
+
|
|
227
|
+
### Use the Python API
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
from circuit_weaver.mvp import (
|
|
231
|
+
validate_design,
|
|
232
|
+
apply_design_patch,
|
|
233
|
+
generate_artifacts,
|
|
234
|
+
diff_designs,
|
|
235
|
+
ingest_pcb_feedback,
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
# Validate a canonical design spec
|
|
239
|
+
report = validate_design(spec)
|
|
240
|
+
|
|
241
|
+
# Apply a transactional patch and re-validate
|
|
242
|
+
result = apply_design_patch(spec, patch)
|
|
243
|
+
|
|
244
|
+
# Generate the full KiCad artifact bundle
|
|
245
|
+
bundle = generate_artifacts(spec, output_dir="out/design")
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Run the HTTP API
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
uvicorn circuit_weaver.api:app --host 0.0.0.0 --port 5000
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
| Endpoint | Description |
|
|
255
|
+
|---|---|
|
|
256
|
+
| `GET /health` | Service health check |
|
|
257
|
+
| `GET /templates` | Available subcircuit templates |
|
|
258
|
+
| `POST /generate` | YAML spec → ZIP of `.kicad_sch` files + report |
|
|
259
|
+
| `POST /generate/from-bom` | CSV BOM upload → ZIP of schematics |
|
|
260
|
+
| `POST /validate` | YAML spec → validation results JSON |
|
|
261
|
+
| `POST /mvp/validate` | Canonical spec → grouped `mvp_strict` validation |
|
|
262
|
+
| `POST /mvp/generate` | Canonical spec → full KiCad artifact ZIP |
|
|
263
|
+
| `POST /mvp/apply-patch` | Transactional patch + re-validation |
|
|
264
|
+
| `POST /mvp/diff` | Semantic diff between two specs |
|
|
265
|
+
| `POST /mvp/pcb-feedback` | Merge PCB feedback back into the design spec |
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Python Package Surface
|
|
270
|
+
|
|
271
|
+
### Core transaction flow
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
spec → normalize → validate → patch → revalidate → generate KiCad artifacts
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Public API functions
|
|
278
|
+
|
|
279
|
+
| Function | What it does |
|
|
280
|
+
|---|---|
|
|
281
|
+
| `validate_design(spec)` | Strict grouped validation — returns a `ValidationReport` |
|
|
282
|
+
| `apply_design_patch(spec, patch)` | In-memory mutation with reject-on-failure |
|
|
283
|
+
| `generate_artifacts(spec, output_dir)` | Emits the full KiCad bundle + report |
|
|
284
|
+
| `diff_designs(old_spec, new_spec)` | Semantic change report between two specs |
|
|
285
|
+
| `ingest_pcb_feedback(spec, feedback)` | Feeds layout constraints back into the design spec |
|
|
286
|
+
|
|
287
|
+
### Validation model
|
|
288
|
+
|
|
289
|
+
`mvp_strict` checks are grouped into four categories:
|
|
290
|
+
|
|
291
|
+
| Group | Checks |
|
|
292
|
+
|---|---|
|
|
293
|
+
| `structural` | Topology, connections, hierarchy |
|
|
294
|
+
| `electrical` | Power, ground, net integrity |
|
|
295
|
+
| `implementation` | Part bindings, footprint assignments |
|
|
296
|
+
| `presentation` | Labels, pin numbers, sheet readability |
|
|
297
|
+
|
|
298
|
+
"The schematic generated" is not enough — the output also needs to be loadable, internally coherent, and reviewable.
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Repo Layout
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
kicad_automations/
|
|
306
|
+
├─ AGENTS.md # Cross-agent repo instructions
|
|
307
|
+
├─ opencode.json # OpenCode/Kilo project config
|
|
308
|
+
├─ .agents/skills/ # Repo-local skill entrypoints for OpenCode/Kilo
|
|
309
|
+
├─ .opencode/agents/ # OpenCode/Kilo subagent definitions
|
|
310
|
+
├─ src/circuit_weaver/ # Core engine: IR, MVP, validators, exporters, helpers
|
|
311
|
+
│ ├─ api.py # FastAPI HTTP server
|
|
312
|
+
│ ├─ mvp.py # Public-facing workflow functions
|
|
313
|
+
│ ├─ design_ir.py # Canonical design intermediate representation
|
|
314
|
+
│ ├─ generator.py # KiCad schematic generator
|
|
315
|
+
│ ├─ validator.py # Validation check runner
|
|
316
|
+
│ ├─ subcircuits/ # Reusable circuit template library
|
|
317
|
+
│ └─ helpers/ # Impedance, placement, silkscreen utilities
|
|
318
|
+
├─ tests/ # Package-level regression coverage
|
|
319
|
+
├─ skills/ # Global KiCad / BOM / sourcing / vendor skills
|
|
320
|
+
├─ project-skills/ # Project workflow templates (kicad_gen, autoroute, sim…)
|
|
321
|
+
├─ agents/ # Hardware reviewer AI personas
|
|
322
|
+
├─ rules/ # Repo-native KiCad workflow policy
|
|
323
|
+
└─ assets/ # README visuals and branding
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## Agent Platforms
|
|
329
|
+
|
|
330
|
+
Circuit Weaver now ships repo-native support for Claude Code, Codex, OpenCode, and Kilo.
|
|
331
|
+
|
|
332
|
+
| Platform | What this repo provides |
|
|
333
|
+
|---|---|
|
|
334
|
+
| Claude Code | Global/project installs via `.claude/skills` |
|
|
335
|
+
| Codex | Root `AGENTS.md` guidance plus global skill installs to `~/.codex/skills` |
|
|
336
|
+
| OpenCode | `AGENTS.md`, `opencode.json`, `.opencode/agents`, and `.agents/skills` compatibility shims |
|
|
337
|
+
| Kilo | Same repo assets as OpenCode; Kilo consumes the shared `opencode.json` / `.opencode` config surface |
|
|
338
|
+
|
|
339
|
+
Platform-specific install paths, naming rules, and downstream examples live in [docs/agent-platforms.md](docs/agent-platforms.md).
|
|
340
|
+
Installers require an explicit target selection. There is no implicit Claude-only default anymore.
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Workflow Skills
|
|
345
|
+
|
|
346
|
+
### Global skills (install via `./install.sh` or `./install.ps1`)
|
|
347
|
+
|
|
348
|
+
- `circuit-weaver` — master orchestrator skill (agent-driven IC research via Perplexity, fastest path)
|
|
349
|
+
- `design_wizard` — manual step-by-step design guide (human-in-the-loop)
|
|
350
|
+
- `kicad` — schematic, PCB, and Gerber analysis
|
|
351
|
+
- `bom` — BOM management, auditing, and export
|
|
352
|
+
- `digikey`, `mouser`, `lcsc` — part sourcing and datasheet sync
|
|
353
|
+
- `jlcpcb`, `pcbway` — manufacturing file prep and quoting
|
|
354
|
+
- `ee` — general electrical engineering helpers
|
|
355
|
+
- `vivado` — FPGA design integration
|
|
356
|
+
|
|
357
|
+
**Or use the CLI directly:**
|
|
358
|
+
- `circuit-weaver design-wizard` — interactive offline wizard (no agents/APIs, works standalone)
|
|
359
|
+
|
|
360
|
+
### Project skill templates (install into downstream repos)
|
|
361
|
+
|
|
362
|
+
- `kicad_gen` — project-local schematic generation playbook
|
|
363
|
+
- `kicad_hierarchy` — hierarchical sheet management
|
|
364
|
+
- `kicad_validate` — project validation runner
|
|
365
|
+
- `kicad_pinmap` — pin mapping and netlist management
|
|
366
|
+
- `kicad_pcb_place` — guided part placement
|
|
367
|
+
- `autoroute` — Freerouting integration
|
|
368
|
+
- `sim` — simulation setup helpers
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
# Bash: install global skills for Claude, Codex, OpenCode, and Kilo
|
|
372
|
+
./install.sh --platform all
|
|
373
|
+
|
|
374
|
+
# PowerShell: same install on Windows
|
|
375
|
+
./install.ps1 -Platform all
|
|
376
|
+
|
|
377
|
+
# Install downstream project templates into the shared open-agent directory
|
|
378
|
+
./install.sh --project-platform agents
|
|
379
|
+
./install.ps1 -ProjectPlatform agents
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
OpenCode, Kilo, and `.agents/skills` targets require kebab-case skill IDs. The installers convert source template names like `kicad_gen` into installed IDs like `kicad-gen` automatically.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Downstream Boundary
|
|
387
|
+
|
|
388
|
+
Keep **upstream** in `kicad_automations`:
|
|
389
|
+
|
|
390
|
+
- `circuit_weaver` package code and helpers
|
|
391
|
+
- Generic skills and project-skill templates
|
|
392
|
+
- Repo-native agents and rules
|
|
393
|
+
|
|
394
|
+
Keep **downstream** in each hardware project:
|
|
395
|
+
|
|
396
|
+
- Project wrappers like `generate_via_engine.py`
|
|
397
|
+
- Project-specific BOMs and pin maps
|
|
398
|
+
- Local symbol and footprint libraries
|
|
399
|
+
- Generated KiCad artifacts
|
|
400
|
+
- Project-local integration tests
|
|
401
|
+
|
|
402
|
+
This boundary keeps the engine generic while each hardware program owns its actual design assets.
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
406
|
+
## Example: Buck Converter Workflow
|
|
407
|
+
|
|
408
|
+
<details>
|
|
409
|
+
<summary><strong>End-to-end worked example</strong></summary>
|
|
410
|
+
|
|
411
|
+
### Analyze the schematic
|
|
412
|
+
|
|
413
|
+
```bash
|
|
414
|
+
python3 skills/kicad/scripts/analyze_schematic.py buck.kicad_sch --output buck_analysis.json
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### Find missing sourcing data
|
|
418
|
+
|
|
419
|
+
```bash
|
|
420
|
+
python3 skills/bom/scripts/bom_manager.py analyze buck.kicad_sch --json
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Pull datasheets and vendor metadata
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
python3 skills/digikey/scripts/sync_datasheets_digikey.py buck.kicad_sch
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Export manufacturing BOMs
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
python3 skills/bom/scripts/bom_manager.py export buck.kicad_sch -o bom/bom.csv
|
|
433
|
+
python3 skills/bom/scripts/bom_manager.py order bom/bom.csv --boards 3 --spares 2
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Review PCB quality
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
python3 skills/kicad/scripts/analyze_pcb.py buck.kicad_pcb
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
</details>
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Template Reference
|
|
447
|
+
|
|
448
|
+
See **[docs/templates.md](docs/templates.md)** for the full parameter reference of all 30 subcircuit templates (auto-generated from `param_schema`).
|
|
449
|
+
|
|
450
|
+
Quick discovery from CLI:
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
# List all templates
|
|
454
|
+
circuit-weaver list-templates
|
|
455
|
+
|
|
456
|
+
# Detailed params for each template
|
|
457
|
+
circuit-weaver list-templates --verbose
|
|
458
|
+
|
|
459
|
+
# Generate a scaffold YAML for a buck converter
|
|
460
|
+
circuit-weaver scaffold --template buck --ref U1
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## Development
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# Run linting
|
|
469
|
+
python -m ruff check src tests
|
|
470
|
+
|
|
471
|
+
# Run tests
|
|
472
|
+
python -m pytest tests -q
|
|
473
|
+
|
|
474
|
+
# Install in editable mode from another repo
|
|
475
|
+
pip install -e /path/to/kicad_automations
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
## Status
|
|
481
|
+
|
|
482
|
+
**Working now**
|
|
483
|
+
- Standalone `circuit_weaver` package (v0.7.0)
|
|
484
|
+
- Full MVP API surface (`validate`, `patch`, `generate`, `diff`, `pcb-feedback`)
|
|
485
|
+
- FastAPI HTTP server with all endpoints
|
|
486
|
+
- Package-level tests and CI (123 tests passing)
|
|
487
|
+
- Subcircuit template library (30 templates, all with contract validation)
|
|
488
|
+
- Helper extraction (placement, silkscreen, impedance)
|
|
489
|
+
- **10-check validation pipeline**: feedback dividers, RC/LC filters, crystal load caps, decoupling coverage, inductor selection, capacitor voltage ratings, net connectivity, enable pin detection, bus completeness (I2C/SPI/UART), pin-type conflict ERC
|
|
490
|
+
- **Pin-type-aware circuit generation**: floating power pins → errors, floating inputs → warnings, explicit no-connects for intentional NC pins, PWR_FLAG auto-generation
|
|
491
|
+
- **Electrical quality scorer**: 0–100 score with A–F grade for generated designs
|
|
492
|
+
- **`--strict` mode** for production designs (warnings = errors)
|
|
493
|
+
- **Design checklist generator** for pre-fabrication review
|
|
494
|
+
|
|
495
|
+
**Active next steps**
|
|
496
|
+
- Continue polishing downstream package consumption
|
|
497
|
+
- Deepen workflow asset extraction and cleanup
|
|
498
|
+
- Expand acceptance fixtures beyond current example designs
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## License
|
|
503
|
+
|
|
504
|
+
MIT. See [LICENSE](LICENSE).
|