copperhead 0.3.0
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/LICENSE +201 -0
- package/README.md +87 -0
- package/dist/agent/filetools.js +118 -0
- package/dist/agent/filetools.js.map +1 -0
- package/dist/agent/ledger.js +43 -0
- package/dist/agent/ledger.js.map +1 -0
- package/dist/agent/loop.js +279 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/prompts.js +47 -0
- package/dist/agent/prompts.js.map +1 -0
- package/dist/agent/providers/anthropic.js +78 -0
- package/dist/agent/providers/anthropic.js.map +1 -0
- package/dist/agent/providers/openai.js +74 -0
- package/dist/agent/providers/openai.js.map +1 -0
- package/dist/agent/tools.js +439 -0
- package/dist/agent/tools.js.map +1 -0
- package/dist/agent/transcript.js +60 -0
- package/dist/agent/transcript.js.map +1 -0
- package/dist/agent/types.js +2 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/cli.js +185 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/check.js +64 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/create.js +91 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/sync.js +144 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/config.js +64 -0
- package/dist/config.js.map +1 -0
- package/dist/kicad/cli.js +91 -0
- package/dist/kicad/cli.js.map +1 -0
- package/dist/kicad/report.js +48 -0
- package/dist/kicad/report.js.map +1 -0
- package/dist/kicad/sexp.js +291 -0
- package/dist/kicad/sexp.js.map +1 -0
- package/dist/memory/constraints.js +43 -0
- package/dist/memory/constraints.js.map +1 -0
- package/dist/memory/drift.js +81 -0
- package/dist/memory/drift.js.map +1 -0
- package/dist/memory/scaffold.js +215 -0
- package/dist/memory/scaffold.js.map +1 -0
- package/dist/openspec/cli.js +31 -0
- package/dist/openspec/cli.js.map +1 -0
- package/dist/util/env.js +68 -0
- package/dist/util/env.js.map +1 -0
- package/dist/util/git.js +53 -0
- package/dist/util/git.js.map +1 -0
- package/dist/util/paths.js +25 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/redact.js +21 -0
- package/dist/util/redact.js.map +1 -0
- package/dist/util/retry.js +27 -0
- package/dist/util/retry.js.map +1 -0
- package/package.json +73 -0
- package/src/agent/filetools.ts +136 -0
- package/src/agent/ledger.ts +71 -0
- package/src/agent/loop.ts +320 -0
- package/src/agent/prompts.ts +58 -0
- package/src/agent/providers/anthropic.ts +81 -0
- package/src/agent/providers/openai.ts +80 -0
- package/src/agent/tools.ts +481 -0
- package/src/agent/transcript.ts +78 -0
- package/src/agent/types.ts +32 -0
- package/src/cli.ts +188 -0
- package/src/commands/check.ts +85 -0
- package/src/commands/create.ts +125 -0
- package/src/commands/sync.ts +182 -0
- package/src/config.ts +77 -0
- package/src/kicad/cli.ts +106 -0
- package/src/kicad/report.ts +81 -0
- package/src/kicad/sexp.ts +327 -0
- package/src/memory/constraints.ts +73 -0
- package/src/memory/drift.ts +97 -0
- package/src/memory/scaffold.ts +241 -0
- package/src/openspec/cli.ts +43 -0
- package/src/util/env.ts +65 -0
- package/src/util/git.ts +63 -0
- package/src/util/paths.ts +25 -0
- package/src/util/redact.ts +20 -0
- package/src/util/retry.ts +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# copperhead
|
|
2
|
+
|
|
3
|
+
**Cursor for circuit boards.** An AI agent that designs, documents, and validates real PCBs from a prompt, working directly on existing KiCad repositories.
|
|
4
|
+
|
|
5
|
+
> **Status: early (v0.1).** Phase 1 is implemented and the CLI runs. The [technical specification](openspec/specs/SPEC.md) is the source of truth; expect the surface to move before 1.0.
|
|
6
|
+
|
|
7
|
+
## What it is
|
|
8
|
+
|
|
9
|
+
An AI product-development agent for hardware: from a product brief to manufacturable files, firmware, and a build plan.
|
|
10
|
+
|
|
11
|
+
- **`copperhead create`**: full pipeline from a natural-language brief: spec, architecture, part selection, schematic, first-draft layout, then gerbers, firmware scaffold, and dev plan.
|
|
12
|
+
- **`copperhead do "<change>"`**: operates on an existing KiCad repo the way a coding agent operates on a codebase.
|
|
13
|
+
|
|
14
|
+
It reads and edits real `.kicad_sch` / `.kicad_pcb` files (s-expression text), maintains markdown design docs as memory, propagates every change across all artifacts that reference it, and verifies its own work by running `kicad-cli` ERC/DRC until the checks pass.
|
|
15
|
+
|
|
16
|
+
## How it works
|
|
17
|
+
|
|
18
|
+
It's a loop, and it looks a lot like pair-programming, except the codebase is a circuit board.
|
|
19
|
+
|
|
20
|
+
1. **Start from the docs.** Every decision lives in the design docs, so the agent reads those first and knows the whole design, not just the part in front of it.
|
|
21
|
+
2. **Talk through the change.** Describe what you want ("add an external key jack", "cut the sleep current"). The agent proposes the parts and circuit; you push back until the reasoning holds up.
|
|
22
|
+
3. **Edit the real files.** The agent writes changes straight into the KiCad schematic and the design docs, using the same part names and net names everywhere so nothing drifts.
|
|
23
|
+
4. **Propagate.** Change one value, like a charge current or a pin, and it carries across every doc and schematic that references it. The boring, easy-to-get-wrong step is the one the agent is best at.
|
|
24
|
+
5. **Check the work.** The agent runs ERC/DRC, reads the errors back, and fixes them. Nothing is "done" until the tools agree.
|
|
25
|
+
6. **Write down why.** Every real decision gets a one-line reason next to it, so the next change doesn't quietly undo it.
|
|
26
|
+
|
|
27
|
+
Two invariants make this trustworthy:
|
|
28
|
+
|
|
29
|
+
1. **Nothing starts without a spec.** The agent cannot touch a KiCad file until a validated change proposal exists; the edit tools are structurally unavailable until it does. Every edit is traceable to a documented intent.
|
|
30
|
+
2. **Nothing is "done" until the tools agree.** Every file mutation is followed by an ERC/DRC run before the agent reports success.
|
|
31
|
+
|
|
32
|
+
Spec-gated in, verification-gated out: the design can't drift from its requirements, because drift is a build failure.
|
|
33
|
+
|
|
34
|
+
## CLI
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
copperhead init [--path hardware/] # scaffold docs/ from an existing schematic; idempotent
|
|
38
|
+
copperhead do "<change request>" # the core loop: propose, edit, verify, propagate, commit
|
|
39
|
+
copperhead check # ERC + DRC + doc-drift + spec validation; no LLM calls (alias: verify)
|
|
40
|
+
copperhead sync [--dry-run] # verify the whole design state, resolve drift
|
|
41
|
+
copperhead create --brief brief.md # brief → full output package
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Global flags: `--repo <path>` (default: cwd) and `--json` for machine-readable output. `do` and `create` take `--model` and `--interactive`; `do` also takes `--dry-run`, `--max-turns`, and `--allow-dirty`.
|
|
45
|
+
|
|
46
|
+
Nothing is a black box: decisions land in an append-only `docs/DECISIONS.md`, every run writes a human-readable summary next to its transcript, and a per-run `docs/CHANGELOG.md` narrates the design history.
|
|
47
|
+
|
|
48
|
+
## What it is not
|
|
49
|
+
|
|
50
|
+
- **Not an autorouter.** Routing stays human or delegated; copperhead produces the DRC-clean draft that layout tools optimize from.
|
|
51
|
+
- **Not a new editor.** No walled garden; your KiCad install remains the editor.
|
|
52
|
+
- **Not the engineer of record.** A human signs off; the agent never claims a design is fab-ready beyond "ERC/DRC clean".
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install -g copperhead # or: npx copperhead check
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Requirements
|
|
61
|
+
|
|
62
|
+
- Node.js ≥ 20
|
|
63
|
+
- [KiCad](https://www.kicad.org/) ≥ 8 with `kicad-cli` on PATH
|
|
64
|
+
- An OpenAI or Anthropic API key (env var only), except for `check`, which never calls an LLM
|
|
65
|
+
|
|
66
|
+
## Maturity
|
|
67
|
+
|
|
68
|
+
Honest read of where v0.1 stands, so you can calibrate before pointing this at a board you care about:
|
|
69
|
+
|
|
70
|
+
- **Solid.** `init` and `check`/`verify` are deterministic, LLM-free, and covered by the offline test suite against a real KiCad fixture: scaffolding, ERC/DRC, the s-expression reader, drift detection, and fab export all run green in CI.
|
|
71
|
+
- **Implemented, not yet proven.** The agent loop (`do`, `sync --resolve`, `create`) is complete and structurally gated, but its acceptance tests need a live model and have not been observed passing end to end. Expect rough edges.
|
|
72
|
+
- **Always.** Every mutation runs inside a git snapshot and rolls back if verification fails, so the worst case is a no-op commit, not a mangled schematic. Work on a branch anyway.
|
|
73
|
+
|
|
74
|
+
## Open source
|
|
75
|
+
|
|
76
|
+
The entire tool (agent core, prompts, tools) is public under Apache-2.0, built on an open stack (KiCad, kicad-cli, [OpenSpec](https://github.com/Fission-AI/OpenSpec)). Everything it produces is plain markdown and JSON in your own repo: no proprietary formats, no lock-in. This is a Chouhan Industries project, and the same commitment that puts every hardware schematic in public applies to the tool that designs them.
|
|
77
|
+
|
|
78
|
+
## Project layout
|
|
79
|
+
|
|
80
|
+
- [`src/`](src/): CLI ([`cli.ts`](src/cli.ts), [`commands/`](src/commands/)), the provider-agnostic agent loop ([`agent/`](src/agent/)), the `kicad-cli` wrapper and s-expression reader ([`kicad/`](src/kicad/)), and doc/constraint memory ([`memory/`](src/memory/))
|
|
81
|
+
- [`test/`](test/): offline suite plus [`fixtures/`](test/fixtures/), a tiny known-good KiCad project
|
|
82
|
+
- [`openspec/specs/SPEC.md`](openspec/specs/SPEC.md): the full technical specification, including binary acceptance criteria
|
|
83
|
+
- [`openspec/changes/build-copperhead-phase-1/`](openspec/changes/build-copperhead-phase-1/): the implementation plan with proposal, design decisions, capability specs, and task checklist
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
[Apache-2.0](LICENSE)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { readFile, writeFile, mkdir, readdir, stat } from 'node:fs/promises';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { resolveInRepo, isKicadFile } from '../util/paths.js';
|
|
5
|
+
export async function toolReadFile(repoRoot, p, startLine, endLine) {
|
|
6
|
+
const abs = resolveInRepo(repoRoot, p);
|
|
7
|
+
const text = await readFile(abs, 'utf8');
|
|
8
|
+
if (startLine === undefined)
|
|
9
|
+
return text;
|
|
10
|
+
const lines = text.split('\n');
|
|
11
|
+
const from = Math.max(1, startLine);
|
|
12
|
+
const to = Math.min(lines.length, endLine ?? lines.length);
|
|
13
|
+
return lines
|
|
14
|
+
.slice(from - 1, to)
|
|
15
|
+
.map((l, i) => `${from + i}: ${l}`)
|
|
16
|
+
.join('\n');
|
|
17
|
+
}
|
|
18
|
+
/** New files only; refuses to overwrite anything and to create KiCad files (SPEC §4.2). */
|
|
19
|
+
export async function toolWriteFile(repoRoot, p, content) {
|
|
20
|
+
const abs = resolveInRepo(repoRoot, p);
|
|
21
|
+
if (isKicadFile(abs)) {
|
|
22
|
+
throw new Error(`write_file refuses KiCad files (${p}); use edit_file with anchors instead`);
|
|
23
|
+
}
|
|
24
|
+
if (existsSync(abs)) {
|
|
25
|
+
throw new Error(`write_file refuses to overwrite existing file ${p}; use edit_file`);
|
|
26
|
+
}
|
|
27
|
+
await mkdir(path.dirname(abs), { recursive: true });
|
|
28
|
+
await writeFile(abs, content, 'utf8');
|
|
29
|
+
return `wrote ${p}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Exact-match anchored replace; fails with an actionable error unless unique.
|
|
33
|
+
* `replaceAll` replaces every occurrence (the rename case, AC-3.1) while still
|
|
34
|
+
* being a surgical text edit on the s-expression source.
|
|
35
|
+
*/
|
|
36
|
+
export async function toolEditFile(repoRoot, p, oldString, newString, replaceAll = false) {
|
|
37
|
+
const abs = resolveInRepo(repoRoot, p);
|
|
38
|
+
const text = await readFile(abs, 'utf8');
|
|
39
|
+
const first = text.indexOf(oldString);
|
|
40
|
+
if (first === -1) {
|
|
41
|
+
throw new Error(`edit_file: anchor not found in ${p}; re-read the file and use an exact excerpt`);
|
|
42
|
+
}
|
|
43
|
+
const count = text.split(oldString).length - 1;
|
|
44
|
+
if (replaceAll) {
|
|
45
|
+
await writeFile(abs, text.split(oldString).join(newString), 'utf8');
|
|
46
|
+
return `edited ${p} (${count} occurrence(s) replaced)`;
|
|
47
|
+
}
|
|
48
|
+
if (count > 1) {
|
|
49
|
+
throw new Error(`edit_file: anchor matched ${count} times in ${p}; widen the anchor with surrounding lines until it is unique, or pass replace_all: true to replace every occurrence`);
|
|
50
|
+
}
|
|
51
|
+
await writeFile(abs, text.slice(0, first) + newString + text.slice(first + oldString.length), 'utf8');
|
|
52
|
+
return `edited ${p}`;
|
|
53
|
+
}
|
|
54
|
+
const SKIP_DIRS = new Set(['.git', 'node_modules', 'dist', '.copperhead']);
|
|
55
|
+
export function globToRegex(glob) {
|
|
56
|
+
let out = '';
|
|
57
|
+
for (let i = 0; i < glob.length; i++) {
|
|
58
|
+
if (glob.startsWith('**/', i)) {
|
|
59
|
+
out += '(?:.*/)?'; // zero or more directories
|
|
60
|
+
i += 2;
|
|
61
|
+
}
|
|
62
|
+
else if (glob.startsWith('**', i)) {
|
|
63
|
+
out += '.*';
|
|
64
|
+
i += 1;
|
|
65
|
+
}
|
|
66
|
+
else if (glob[i] === '*') {
|
|
67
|
+
out += '[^/]*';
|
|
68
|
+
}
|
|
69
|
+
else if (glob[i] === '?') {
|
|
70
|
+
out += '.';
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
out += glob[i].replace(/[.+^${}()|[\]\\]/, '\\$&');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return new RegExp(`^${out}$`);
|
|
77
|
+
}
|
|
78
|
+
/** ripgrep-style regex search implemented natively (no rg dependency). */
|
|
79
|
+
export async function toolSearch(repoRoot, pattern, glob, maxMatches = 200) {
|
|
80
|
+
const re = new RegExp(pattern);
|
|
81
|
+
const globRe = glob ? globToRegex(glob) : null;
|
|
82
|
+
const matches = [];
|
|
83
|
+
async function walk(dir) {
|
|
84
|
+
if (matches.length >= maxMatches)
|
|
85
|
+
return;
|
|
86
|
+
for (const entry of await readdir(dir)) {
|
|
87
|
+
if (SKIP_DIRS.has(entry))
|
|
88
|
+
continue;
|
|
89
|
+
const abs = path.join(dir, entry);
|
|
90
|
+
const rel = path.relative(repoRoot, abs);
|
|
91
|
+
const st = await stat(abs);
|
|
92
|
+
if (st.isDirectory()) {
|
|
93
|
+
await walk(abs);
|
|
94
|
+
}
|
|
95
|
+
else if (st.size < 5_000_000 && (!globRe || globRe.test(rel))) {
|
|
96
|
+
let text;
|
|
97
|
+
try {
|
|
98
|
+
text = await readFile(abs, 'utf8');
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (text.includes('\u0000'))
|
|
104
|
+
continue; // binary
|
|
105
|
+
const lines = text.split('\n');
|
|
106
|
+
for (let i = 0; i < lines.length && matches.length < maxMatches; i++) {
|
|
107
|
+
if (re.test(lines[i]))
|
|
108
|
+
matches.push({ file: rel, line: i + 1, text: lines[i].trim() });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (matches.length >= maxMatches)
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
await walk(repoRoot);
|
|
116
|
+
return matches;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=filetools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filetools.js","sourceRoot":"","sources":["../../src/agent/filetools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,I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C,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;oBACrE,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC;wBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAC3F,CAAC;YACH,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,IAAI,UAAU;gBAAE,OAAO;QAC3C,CAAC;IACH,CAAC;IACD,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export class ObligationsLedger {
|
|
2
|
+
open = [];
|
|
3
|
+
add(kind, detail, openedBy) {
|
|
4
|
+
if (!this.open.some((o) => o.kind === kind && o.detail === detail)) {
|
|
5
|
+
this.open.push({ kind, detail, openedBy });
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
clear(kind, detail) {
|
|
9
|
+
this.open = this.open.filter((o) => !(o.kind === kind && (detail === undefined || o.detail === detail)));
|
|
10
|
+
}
|
|
11
|
+
/** A KiCad edit re-opens verification obligations even if previously cleared. */
|
|
12
|
+
onKicadEdit(file) {
|
|
13
|
+
this.add('erc', 'ERC must pass after schematic edits', file);
|
|
14
|
+
if (file.endsWith('.kicad_pcb'))
|
|
15
|
+
this.add('drc', 'DRC must pass after board edits', file);
|
|
16
|
+
this.add('drift', 'check_drift must run clean after KiCad edits', file);
|
|
17
|
+
this.add('changelog', 'CHANGELOG.md entry for this run', file);
|
|
18
|
+
}
|
|
19
|
+
onDocEdit(file) {
|
|
20
|
+
this.add('drift', 'check_drift must run clean after doc edits', file);
|
|
21
|
+
}
|
|
22
|
+
onConstraintChange(constraintKey, affects) {
|
|
23
|
+
this.add('constraint-dual-write', constraintKey, constraintKey);
|
|
24
|
+
for (const item of affects) {
|
|
25
|
+
this.add('affects-revisit', `${constraintKey} affects ${item}`, constraintKey);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
onDecision(summary) {
|
|
29
|
+
this.add('decision-log', summary, 'decision');
|
|
30
|
+
}
|
|
31
|
+
get openObligations() {
|
|
32
|
+
return this.open;
|
|
33
|
+
}
|
|
34
|
+
get isClear() {
|
|
35
|
+
return this.open.length === 0;
|
|
36
|
+
}
|
|
37
|
+
describe() {
|
|
38
|
+
if (this.isClear)
|
|
39
|
+
return 'all sync obligations satisfied';
|
|
40
|
+
return this.open.map((o) => `- [${o.kind}] ${o.detail} (opened by ${o.openedBy})`).join('\n');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../src/agent/ledger.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,iBAAiB;IACpB,IAAI,GAAiB,EAAE,CAAC;IAEhC,GAAG,CAAC,IAAoB,EAAE,MAAc,EAAE,QAAgB;QACxD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,EAAE,CAAC;YACnE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAoB,EAAE,MAAe;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAC1B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,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