@huaqiu/dsh-hqsch 0.4.8
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 +21 -0
- package/README.md +43 -0
- package/cordis.patch.yml +13 -0
- package/lib/index.d.mts +98 -0
- package/lib/index.mjs +159 -0
- package/package.json +40 -0
- package/skills/hqsch-scenario-b/AGENTS.md +209 -0
- package/skills/hqsch-scenario-b/CLAUDE.md +209 -0
- package/skills/hqsch-scenario-b/INSTALL.md +140 -0
- package/skills/hqsch-scenario-b/SKILL.md +107 -0
- package/skills/hqsch-scenario-b/SYSTEM-PROMPT.md +209 -0
- package/skills/hqsch-scenario-b/docs/circuit-pattern-layout.md +304 -0
- package/skills/hqsch-scenario-b/docs/editing-a-circuit.md +167 -0
- package/skills/hqsch-scenario-b/docs/part-search.md +244 -0
- package/skills/hqsch-scenario-b/docs/placement-conventions.md +714 -0
- package/skills/hqsch-scenario-b/docs/property-conventions.md +225 -0
- package/skills/hqsch-scenario-b/docs/quickstart.md +99 -0
- package/skills/hqsch-scenario-b/docs/reading-a-circuit.md +317 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-auto-connect-objects-by-id.md +98 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-delete-objects-by-ids.md +94 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-find-object-by-property.md +101 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-list-wire-segments.md +94 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-mirror-objects-by-ids.md +96 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-rotate-objects-by-ids.md +94 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-set-object-property.md +99 -0
- package/skills/hqsch-scenario-b/docs/rpc/canvas-zoom-all.md +92 -0
- package/skills/hqsch-scenario-b/docs/rpc/find-find-object.md +96 -0
- package/skills/hqsch-scenario-b/docs/rpc/kernel-get-snapshot.md +104 -0
- package/skills/hqsch-scenario-b/docs/rpc/netlist-get-active-page-net-list.md +87 -0
- package/skills/hqsch-scenario-b/docs/rpc/netlist-get-port-pairing.md +34 -0
- package/skills/hqsch-scenario-b/docs/rpc/obj-place-place-pin-stub-wire-and-net-alias.md +114 -0
- package/skills/hqsch-scenario-b/docs/rpc/pattern-layout-apply-circuit-pattern.md +125 -0
- package/skills/hqsch-scenario-b/docs/rpc/pattern-layout-get-page-occupancy.md +100 -0
- package/skills/hqsch-scenario-b/docs/rpc/pattern-layout-list-circuit-patterns.md +97 -0
- package/skills/hqsch-scenario-b/docs/rpc/placement-list-part-libraries.md +94 -0
- package/skills/hqsch-scenario-b/docs/rpc/placement-list-symbol-libraries.md +94 -0
- package/skills/hqsch-scenario-b/docs/rpc/placement-place-kicad-symbol.md +105 -0
- package/skills/hqsch-scenario-b/docs/rpc/placement-place-part-from-library.md +106 -0
- package/skills/hqsch-scenario-b/docs/rpc/placement-place-symbol-from-library.md +108 -0
- package/skills/hqsch-scenario-b/docs/rpc/project-get-active-project.md +96 -0
- package/skills/hqsch-scenario-b/docs/rpc/project-list-open-projects.md +99 -0
- package/skills/hqsch-scenario-b/docs/rpc-availability.md +97 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/canvas.md +81 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/find.md +36 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/kernel.md +36 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/netlist.md +38 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/obj-place.md +76 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/pattern-layout.md +38 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/placement.md +48 -0
- package/skills/hqsch-scenario-b/docs/rpc-index/project.md +47 -0
- package/skills/hqsch-scenario-b/docs/serialization.md +60 -0
- package/skills/hqsch-scenario-b/docs/skill-dependencies.md +93 -0
- package/skills/hqsch-scenario-b/skill.json +13 -0
- package/skills/hqsch-scenario-b/template/package.json +16 -0
- package/skills/hqsch-scenario-b/template/scripts/edit-property-by-ref.ts +44 -0
- package/skills/hqsch-scenario-b/template/scripts/fix-designators.ts +52 -0
- package/skills/hqsch-scenario-b/template/scripts/hello.ts +46 -0
- package/skills/hqsch-scenario-b/template/scripts/read-circuit.ts +357 -0
- package/skills/hqsch-scenario-b/template/scripts/replace-part-by-ref.ts +44 -0
- package/skills/hqsch-scenario-b/template/scripts/rewire-pin-by-ref.ts +42 -0
- package/skills/hqsch-scenario-b/template/tsconfig.json +11 -0
- package/src/config.ts +25 -0
- package/src/index.ts +186 -0
- package/src/paths.ts +48 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eda-pattern-layout
|
|
3
|
+
metadata:
|
|
4
|
+
category: pattern-layout
|
|
5
|
+
description: >-
|
|
6
|
+
Pattern Layout operations for Huaqiu EDA. Use this skill when you need to work with pattern-layout-related operations including apply circuit pattern, get page occupancy, list circuit patterns.
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
vendor: Huaqiu Electronics
|
|
9
|
+
tags:
|
|
10
|
+
- eda
|
|
11
|
+
- huaqiu
|
|
12
|
+
- pattern-layout
|
|
13
|
+
entry: "@huaqiu/hqeda"
|
|
14
|
+
manifest: "@huaqiu/hqeda/skill.json"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Pattern Layout Skills
|
|
18
|
+
|
|
19
|
+
Pattern Layout operations for Huaqiu EDA. Use this skill when you need to work with pattern-layout-related operations including apply circuit pattern, get page occupancy, list circuit patterns.
|
|
20
|
+
|
|
21
|
+
## Available Capabilities
|
|
22
|
+
|
|
23
|
+
Total: **3** skills in the **pattern-layout** domain.
|
|
24
|
+
|
|
25
|
+
| Skill | Description | Streaming |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| [`apply-circuit-pattern`](apply-circuit-pattern/SKILL.md) | Lay out and wire one circuit pattern. plan_only = true is the dry-run. | no |
|
|
28
|
+
| [`get-page-occupancy`](get-page-occupancy/SKILL.md) | Bounding boxes of what is already on the page, for floorplanning / avoidance. | no |
|
|
29
|
+
| [`list-circuit-patterns`](list-circuit-patterns/SKILL.md) | Self-describing catalog — keeps the skill docs from drifting away from the
|
|
30
|
+
implementation. Call it | no |
|
|
31
|
+
|
|
32
|
+
## See Also
|
|
33
|
+
|
|
34
|
+
- [All EDA skills](../SKILL.md)
|
|
35
|
+
- [quickstart.md](../references/quickstart.md)
|
|
36
|
+
- [serialization.md](../references/serialization.md)
|
|
37
|
+
- [`@huaqiu/hqeda` npm package](https://www.npmjs.com/package/@huaqiu/hqeda) — shared runtime + capability registry
|
|
38
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eda-placement
|
|
3
|
+
metadata:
|
|
4
|
+
category: placement
|
|
5
|
+
description: >-
|
|
6
|
+
Placement operations for Huaqiu EDA. Invoke when placing parts, symbols, or blocks on a schematic — R/C/Q/U via PlaceKicadSymbol (online), GND/VCC/port via PlaceSymbolFromLibrary, local fallback via PlacePartFromLibrary.
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
vendor: Huaqiu Electronics
|
|
9
|
+
tags:
|
|
10
|
+
- eda
|
|
11
|
+
- huaqiu
|
|
12
|
+
- placement
|
|
13
|
+
entry: "@huaqiu/hqeda"
|
|
14
|
+
manifest: "@huaqiu/hqeda/skill.json"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Placement Skills
|
|
18
|
+
|
|
19
|
+
Placement operations for Huaqiu EDA. Invoke when placing parts, symbols, or blocks on a schematic — R/C/Q/U via PlaceKicadSymbol (online), GND/VCC/port via PlaceSymbolFromLibrary, local fallback via PlacePartFromLibrary.
|
|
20
|
+
|
|
21
|
+
## Available Capabilities
|
|
22
|
+
|
|
23
|
+
Total: **14** skills in the **placement** domain.
|
|
24
|
+
|
|
25
|
+
| Skill | Description | Streaming |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| [`cancel-block-draw`](cancel-block-draw/SKILL.md) | Cancel Block Draw via ComponentPlaceService.CancelBlockDraw | no |
|
|
28
|
+
| [`clear-net-alias-attach-obj`](clear-net-alias-attach-obj/SKILL.md) | Clear Net Alias Attach Obj via ComponentPlaceService.ClearNetAliasAttachObj | no |
|
|
29
|
+
| [`handle-block-draw-click`](handle-block-draw-click/SKILL.md) | Handle Block Draw Click via ComponentPlaceService.HandleBlockDrawClick | no |
|
|
30
|
+
| [`handle-part-draw-click`](handle-part-draw-click/SKILL.md) | Handle Part Draw Click via ComponentPlaceService.HandlePartDrawClick | no |
|
|
31
|
+
| [`handle-symbol-draw-click`](handle-symbol-draw-click/SKILL.md) | Handle Symbol Draw Click via ComponentPlaceService.HandleSymbolDrawClick | no |
|
|
32
|
+
| [`list-part-libraries`](list-part-libraries/SKILL.md) | Fallback listing for local/builtin part libraries — agents prefer online part-search (searchParts → | no |
|
|
33
|
+
| [`list-symbol-libraries`](list-symbol-libraries/SKILL.md) | Agent path: list global/power/gnd, port, off-page symbols — call before PlaceSymbolFromLibrary | no |
|
|
34
|
+
| [`place-block`](place-block/SKILL.md) | block | no |
|
|
35
|
+
| [`place-kicad-symbol`](place-kicad-symbol/SKILL.md) | Place R/C/Q/U from online KiCad symbol URL (SCH_PlaceKicadSymbolFromResource). Invoke after part-sea | no |
|
|
36
|
+
| [`place-part`](place-part/SKILL.md) | INTERNAL: low-level part placement — requires engine-native JSON; agents use PlaceKicadSymbol (onlin | no |
|
|
37
|
+
| [`place-part-from-library`](place-part-from-library/SKILL.md) | Place a part from local/builtin library (discrete, etc.). Invoke when online part-search has no matc | no |
|
|
38
|
+
| [`place-symbol`](place-symbol/SKILL.md) | INTERNAL: low-level symbol placement — requires engine-native JSON; agents use PlaceSymbolFromLibrar | no |
|
|
39
|
+
| [`place-symbol-from-library`](place-symbol-from-library/SKILL.md) | Place GND/VCC/power, port, or off-page symbol from symbol libraries. Invoke for power symbols and co | no |
|
|
40
|
+
| [`set-net-alias-attach-obj`](set-net-alias-attach-obj/SKILL.md) | net alias attach | no |
|
|
41
|
+
|
|
42
|
+
## See Also
|
|
43
|
+
|
|
44
|
+
- [All EDA skills](../SKILL.md)
|
|
45
|
+
- [quickstart.md](../references/quickstart.md)
|
|
46
|
+
- [serialization.md](../references/serialization.md)
|
|
47
|
+
- [`@huaqiu/hqeda` npm package](https://www.npmjs.com/package/@huaqiu/hqeda) — shared runtime + capability registry
|
|
48
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: eda-project
|
|
3
|
+
metadata:
|
|
4
|
+
category: project
|
|
5
|
+
description: >-
|
|
6
|
+
Project operations for Huaqiu EDA. Invoke when opening, saving, or navigating project pages and schematics.
|
|
7
|
+
version: 0.1.0
|
|
8
|
+
vendor: Huaqiu Electronics
|
|
9
|
+
tags:
|
|
10
|
+
- eda
|
|
11
|
+
- huaqiu
|
|
12
|
+
- project
|
|
13
|
+
entry: "@huaqiu/hqeda"
|
|
14
|
+
manifest: "@huaqiu/hqeda/skill.json"
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Project Skills
|
|
18
|
+
|
|
19
|
+
Project operations for Huaqiu EDA. Invoke when opening, saving, or navigating project pages and schematics.
|
|
20
|
+
|
|
21
|
+
## Available Capabilities
|
|
22
|
+
|
|
23
|
+
Total: **10** skills in the **project** domain.
|
|
24
|
+
|
|
25
|
+
| Skill | Description | Streaming |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| [`activate-page-in-project`](activate-page-in-project/SKILL.md) | Switch active workspace and open the target page canvas. | no |
|
|
28
|
+
| [`add-page-to-project`](add-page-to-project/SKILL.md) | Add a VxPage to an existing VxSchematic in an opened project (does not open canvas).
|
|
29
|
+
See AddPageToP | no |
|
|
30
|
+
| [`close-project`](close-project/SKILL.md) | Closes an opened project. | no |
|
|
31
|
+
| [`create-project`](create-project/SKILL.md) | Create a new project/design at directory/file_name and open it.
|
|
32
|
+
A default schematic (typically SCHE | no |
|
|
33
|
+
| [`get-active-project`](get-active-project/SKILL.md) | Returns the project currently active in the editor UI. | no |
|
|
34
|
+
| [`get-project`](get-project/SKILL.md) | Returns one opened project. | no |
|
|
35
|
+
| [`list-open-projects`](list-open-projects/SKILL.md) | Returns all projects currently opened in this HQ EDA process.
|
|
36
|
+
Use response.projects[].name as proje | no |
|
|
37
|
+
| [`list-project-tree`](list-project-tree/SKILL.md) | List schematic/page tree (VxSchematic::m_strName → VxPage::m_strName[]) for an opened project. | no |
|
|
38
|
+
| [`open-project`](open-project/SKILL.md) | Opens a project into the current HQ EDA editor process. | no |
|
|
39
|
+
| [`save-project`](save-project/SKILL.md) | Persists an opened project. | no |
|
|
40
|
+
|
|
41
|
+
## See Also
|
|
42
|
+
|
|
43
|
+
- [All EDA skills](../SKILL.md)
|
|
44
|
+
- [quickstart.md](../references/quickstart.md)
|
|
45
|
+
- [serialization.md](../references/serialization.md)
|
|
46
|
+
- [`@huaqiu/hqeda` npm package](https://www.npmjs.com/package/@huaqiu/hqeda) — shared runtime + capability registry
|
|
47
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Serializing Protobuf Responses
|
|
2
|
+
|
|
3
|
+
Skill responses are protobuf message objects from `@bufbuild/protobuf`. **Do not use `JSON.stringify()` directly** on RPC results — it throws on `BigInt` fields and produces empty objects for oneof ADT fields.
|
|
4
|
+
|
|
5
|
+
## Recommended helpers (RPC responses)
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { toJson, toJsonString } from "@huaqiu/hqeda";
|
|
9
|
+
// Also available from @huaqiu/huaqiu-client in this package's template.
|
|
10
|
+
|
|
11
|
+
// Plain JSON object (BigInts → strings)
|
|
12
|
+
const jsonObj = toJson(result);
|
|
13
|
+
|
|
14
|
+
// Formatted JSON string
|
|
15
|
+
const jsonStr = toJsonString(result, { prettySpaces: 2 });
|
|
16
|
+
|
|
17
|
+
// Include zero-valued fields
|
|
18
|
+
const full = toJsonString(result, { alwaysEmitImplicit: true });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
These helpers handle:
|
|
22
|
+
|
|
23
|
+
- **BigInt fields** — converted to strings (protobuf JSON convention)
|
|
24
|
+
- **oneof fields** — serialized as `{ case, value }` ADT objects
|
|
25
|
+
- **Well-known types** — `Timestamp` → ISO string, `Duration` → `"Ns"` format, `Struct` → plain object
|
|
26
|
+
- **bytes fields** — base64-encoded strings
|
|
27
|
+
- **Zero-value omission** — empty fields excluded by default (protobuf default)
|
|
28
|
+
|
|
29
|
+
## Common mistake (protobuf messages)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// Wrong — throws "Do not know how to serialize a BigInt"
|
|
33
|
+
JSON.stringify(result);
|
|
34
|
+
|
|
35
|
+
// Correct
|
|
36
|
+
toJsonString(result);
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Snapshot / position BigInt (raw traversal)
|
|
40
|
+
|
|
41
|
+
Even after you pull fields out of a snapshot (e.g. `pin.position.x/y`), those
|
|
42
|
+
coordinates are still **`bigint`**. If you build a plain object and call
|
|
43
|
+
`JSON.stringify` without a replacer, you hit:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
TypeError: Do not know how to serialize a BigInt
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use a replacer whenever you stringify **extracted** snapshot data (not only
|
|
50
|
+
whole RPC messages):
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
const bigIntSafe = (_k: string, v: unknown) =>
|
|
54
|
+
typeof v === "bigint" ? String(v) : v;
|
|
55
|
+
|
|
56
|
+
console.log(JSON.stringify(row, bigIntSafe, 2));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Prefer `toJsonString` for full RPC responses; use the replacer for hand-built
|
|
60
|
+
summaries from `GetSnapshot` fields.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Cross-Skill Dependencies
|
|
2
|
+
|
|
3
|
+
Common prerequisite chains when composing multi-step Agent workflows.
|
|
4
|
+
|
|
5
|
+
## Obtaining projectId
|
|
6
|
+
|
|
7
|
+
Required by: `bom-get-bom`, `bom-watch-bom`, `netlist-*`, and most project-scoped operations.
|
|
8
|
+
|
|
9
|
+
| Step | Skill | Purpose |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| 1 | [`project-get-active-project`](../project/get-active-project/SKILL.md) | Read the currently active project |
|
|
12
|
+
| alt | [`project-list-open-projects`](../project/list-open-projects/SKILL.md) | List all open projects when none is active |
|
|
13
|
+
|
|
14
|
+
## Building context
|
|
15
|
+
|
|
16
|
+
Required by: canvas, selection, project save/open, and most editor-mutating RPCs.
|
|
17
|
+
|
|
18
|
+
| Context type | How to build | Used by |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| Editor context | `client.createEditorContext()` after `connect()` | Project listing, discovery |
|
|
21
|
+
| Project context | `client.createProjectContext(projectId)` | Canvas ops, selection, placement |
|
|
22
|
+
|
|
23
|
+
See [quickstart.md](quickstart.md) for the full connect chain.
|
|
24
|
+
|
|
25
|
+
## Typical workflows
|
|
26
|
+
|
|
27
|
+
### Read BOM for active project
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
connect → project-get-active-project → bom-get-bom
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Select object then query property
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
connect → project-get-active-project → selection-set-selection → canvas-get-object-property
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Run ERC then show findings
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
connect → project-get-active-project → erc-run-checks → erc-show-findings
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Place symbol on canvas
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
connect → project-get-active-project → placement-list-symbol-libraries → placement-place-kicad-symbol
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Apply a circuit pattern (decoupling / pull / I2C / SPI / crystal)
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
connect → project-get-active-project
|
|
55
|
+
→ pattern-layout-list-circuit-patterns
|
|
56
|
+
→ pattern-layout-get-page-occupancy
|
|
57
|
+
→ placement-place-kicad-symbol (or placement-place-symbol-from-library)
|
|
58
|
+
→ pattern-layout-apply-circuit-pattern (plan_only=true)
|
|
59
|
+
→ pattern-layout-apply-circuit-pattern (plan_only=false)
|
|
60
|
+
→ kernel-get-snapshot / netlist-get-active-page-net-list
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
| Step | Skill | Purpose |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| 1 | [`pattern-layout-list-circuit-patterns`](../pattern-layout/list-circuit-patterns/SKILL.md) | Roles, terminals, options, typical_size |
|
|
66
|
+
| 2 | [`pattern-layout-get-page-occupancy`](../pattern-layout/get-page-occupancy/SKILL.md) | Floorplan / pick a free `anchor` |
|
|
67
|
+
| 3 | [`placement-place-kicad-symbol`](../placement/place-kicad-symbol/SKILL.md) | Place bound parts (position may be rough) |
|
|
68
|
+
| 4 | [`pattern-layout-apply-circuit-pattern`](../pattern-layout/apply-circuit-pattern/SKILL.md) | Dry-run then execute; book-keep `occupied_box` |
|
|
69
|
+
|
|
70
|
+
Guide: [circuit-pattern-layout.md](../../hqeda/guides/circuit-pattern-layout.md).
|
|
71
|
+
|
|
72
|
+
### Connect distant pins via stub + Net Alias
|
|
73
|
+
|
|
74
|
+
Use when Manhattan > **400** (cross-part), estimated L-route > **500**, crossings ≥ 3,
|
|
75
|
+
or connecting **different parts** on the same net (SPI default). Full heuristics:
|
|
76
|
+
[placement-conventions.md](../../hqeda/guides/placement-conventions.md#stub--net-alias-long-distance--many-crossings).
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
connect → project-get-active-project → kernel-get-snapshot (or canvas-list-wire-segments)
|
|
80
|
+
→ [agent: distance / crossing check]
|
|
81
|
+
→ per pin end (same netName at both ends): place-pin-stub-wire-and-net-alias
|
|
82
|
+
→ kernel-get-snapshot or netlist-get-active-page-net-list (verify)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Step | Skill | Purpose |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| 1 | [`project-get-active-project`](../project/get-active-project/SKILL.md) | Build `ProjectContext` |
|
|
88
|
+
| 2 | [`kernel-get-snapshot`](../kernel/get-snapshot/SKILL.md) or [`canvas-list-wire-segments`](../canvas/list-wire-segments/SKILL.md) | Pin positions, existing wires (crossing check) |
|
|
89
|
+
| 3 | [`obj-place-place-pin-stub-wire-and-net-alias`](../obj-place/place-pin-stub-wire-and-net-alias/SKILL.md) | Per pin (`objectId`+`pinNum`): new stub unless wire **endpoint** at that pin; verify via NetAlias/netlist, not `wireSegments.netName` |
|
|
90
|
+
|
|
91
|
+
## Domain index
|
|
92
|
+
|
|
93
|
+
Browse all domains from the [top-level skill index](../SKILL.md).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://schema.huaqiu.com/skills/v1/skill.schema.json",
|
|
3
|
+
"id": "hqeda-scenario-b",
|
|
4
|
+
"name": "HQ EDA Scenario B — Coding Agent + Local Scripts",
|
|
5
|
+
"vendor": "Huaqiu Electronics",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"description": "Self-contained skill for Work Buddy, Codex, and Claude: schematic placement, circuit patterns, routing, netlist check, zoom-all. Agent auto-runs TypeScript via @huaqiu/huaqiu-client.",
|
|
8
|
+
"skillMarkdown": "./SKILL.md",
|
|
9
|
+
"resources": {
|
|
10
|
+
"guides": "./docs",
|
|
11
|
+
"prompts": "./SYSTEM-PROMPT.md"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hqeda-scenario-b",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"hello": "tsx scripts/hello.ts"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@huaqiu/huaqiu-client": "^0.1.7",
|
|
10
|
+
"@huaqiu/hqeda": "^0.2.7"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"tsx": "^4.19.0",
|
|
14
|
+
"typescript": "^5.7.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow C 配方:按位号改属性
|
|
3
|
+
* REF=C201 PROP=Value NEW="1 µF" CONFIRM=1 npx tsx scripts/edit-property-by-ref.ts
|
|
4
|
+
*/
|
|
5
|
+
import { connect } from "@huaqiu/huaqiu-client";
|
|
6
|
+
|
|
7
|
+
const REF = process.env.REF;
|
|
8
|
+
const PROP = process.env.PROP ?? "Value";
|
|
9
|
+
const NEW = process.env.NEW;
|
|
10
|
+
const CONFIRM = process.env.CONFIRM === "1";
|
|
11
|
+
|
|
12
|
+
async function main() {
|
|
13
|
+
if (!REF || NEW === undefined) throw new Error("需要 REF= 与 NEW=");
|
|
14
|
+
const client = await connect({ instanceId: process.env.HQ_INSTANCE_ID });
|
|
15
|
+
const active = await client.project.getActiveProject({ context: client.createEditorContext() });
|
|
16
|
+
const projectId = active.project?.projectId;
|
|
17
|
+
if (!projectId) throw new Error("请先打开工程");
|
|
18
|
+
const ctx = client.createProjectContext(projectId);
|
|
19
|
+
console.log("projectId:", projectId);
|
|
20
|
+
|
|
21
|
+
const found = await client.canvasOps.findObjectByProperty({ context: ctx, propKey: "Reference", propValue: REF });
|
|
22
|
+
const id = found.objectIds?.[0];
|
|
23
|
+
if (!id) throw new Error(`找不到 ${REF}`);
|
|
24
|
+
|
|
25
|
+
let oldVal = "";
|
|
26
|
+
try {
|
|
27
|
+
const g = await client.canvasOps.getObjectProperty({ context: ctx, objectId: id, propKey: PROP });
|
|
28
|
+
oldVal = String(g.propValue ?? "");
|
|
29
|
+
} catch { oldVal = "(未知)"; }
|
|
30
|
+
|
|
31
|
+
console.log(`\n计划修改: ${REF} ${PROP}: "${oldVal}" → "${NEW}" objectId=${id}`);
|
|
32
|
+
if (!CONFIRM) { console.log("未执行。设 CONFIRM=1 后重跑。"); return; }
|
|
33
|
+
|
|
34
|
+
await client.canvasOps.setObjectProperty({ context: ctx, objectId: id, propKey: PROP, propValue: NEW, op: 1, commitUndo: true });
|
|
35
|
+
console.log("✓ 已写入");
|
|
36
|
+
|
|
37
|
+
const snap = await client.kernel.getSnapshot({ context: ctx });
|
|
38
|
+
const sym = (snap.snapshot as { symbolInstances?: Array<{ designator?: string; metadata?: { properties?: Array<{ key: string; value: unknown }> } }> })
|
|
39
|
+
.symbolInstances?.find((s) => s.designator === REF);
|
|
40
|
+
const v = sym?.metadata?.properties?.find((p) => p.key === PROP);
|
|
41
|
+
console.log("快照验收:", PROP, "=", v ? String(Object.values(v.value as object)[0] ?? v.value) : NEW);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
main().catch((e) => { console.error("❌", e.message); process.exit(1); });
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 修正位号与参数值:
|
|
3
|
+
* C1 → C_IN (10 μF), C2 → C_IN_BYPASS (0.1 μF)
|
|
4
|
+
* C3 → C_OUT1 (10 μF), C4 → C_OUT2 (0.1 μF)
|
|
5
|
+
*/
|
|
6
|
+
import { connect } from "@huaqiu/huaqiu-client";
|
|
7
|
+
|
|
8
|
+
const RENAMES: Array<[string, string, string]> = [
|
|
9
|
+
// [oldRef, newRef, value]
|
|
10
|
+
["C1", "C_IN", "10 μF"],
|
|
11
|
+
["C2", "C_IN_BYPASS", "0.1 μF"],
|
|
12
|
+
["C3", "C_OUT1", "10 μF"],
|
|
13
|
+
["C4", "C_OUT2", "0.1 μF"],
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
async function main() {
|
|
17
|
+
const client = await connect();
|
|
18
|
+
const active = await client.project.getActiveProject({ context: client.createEditorContext() });
|
|
19
|
+
const projectId = active.project?.projectId;
|
|
20
|
+
if (!projectId) throw new Error("no project");
|
|
21
|
+
const ctx = client.createProjectContext(projectId);
|
|
22
|
+
|
|
23
|
+
for (const [oldRef, newRef, value] of RENAMES) {
|
|
24
|
+
const found = await client.canvasOps.findObjectByProperty({
|
|
25
|
+
context: ctx, propKey: "Reference", propValue: oldRef,
|
|
26
|
+
});
|
|
27
|
+
const id = found.objectIds?.[0];
|
|
28
|
+
if (!id) { console.log(` ⚠ 找不到 ${oldRef}`); continue; }
|
|
29
|
+
|
|
30
|
+
await client.canvasOps.setObjectProperty({
|
|
31
|
+
context: ctx, objectId: id,
|
|
32
|
+
propKey: "Part Reference", propValue: newRef, op: 1, commitUndo: true,
|
|
33
|
+
});
|
|
34
|
+
await client.canvasOps.setObjectProperty({
|
|
35
|
+
context: ctx, objectId: id,
|
|
36
|
+
propKey: "Value", propValue: value, op: 1, commitUndo: true,
|
|
37
|
+
});
|
|
38
|
+
console.log(` ✓ ${oldRef} → ${newRef} (${value}) id=${id}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 验证
|
|
42
|
+
console.log("\n验证:");
|
|
43
|
+
for (const [, newRef] of RENAMES) {
|
|
44
|
+
const r = await client.canvasOps.findObjectByProperty({
|
|
45
|
+
context: ctx, propKey: "Reference", propValue: newRef,
|
|
46
|
+
});
|
|
47
|
+
console.log(` ${newRef}: ${(r.objectIds?.length ?? 0) > 0 ? "✓" : "✗"}`);
|
|
48
|
+
}
|
|
49
|
+
await client.canvasOps.zoomAll({ context: ctx });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
main().catch((e) => { console.error("错误:", e.message); process.exit(1); });
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scenario B smoke test — verify HQ EDA connectivity before circuit automation.
|
|
3
|
+
*
|
|
4
|
+
* npm install
|
|
5
|
+
* npx tsx scripts/hello.ts
|
|
6
|
+
*
|
|
7
|
+
* Optional: HQ_INSTANCE_ID=<id> when multiple editors are open (run listEditors first).
|
|
8
|
+
*/
|
|
9
|
+
import { connect, listEditors, toJsonString } from "@huaqiu/huaqiu-client";
|
|
10
|
+
|
|
11
|
+
const INSTANCE = process.env.HQ_INSTANCE_ID;
|
|
12
|
+
|
|
13
|
+
async function main() {
|
|
14
|
+
const editors = await listEditors();
|
|
15
|
+
console.log("editors:", toJsonString(editors, { prettySpaces: 2 }));
|
|
16
|
+
|
|
17
|
+
const client = INSTANCE
|
|
18
|
+
? await connect({ instanceId: INSTANCE })
|
|
19
|
+
: await connect();
|
|
20
|
+
|
|
21
|
+
console.log("connected:", client.info.instanceId);
|
|
22
|
+
|
|
23
|
+
const editorCtx = client.createEditorContext();
|
|
24
|
+
const active = await client.project.getActiveProject({ context: editorCtx });
|
|
25
|
+
const projectId = active.project?.projectId;
|
|
26
|
+
if (!projectId) {
|
|
27
|
+
throw new Error("No active project — open a schematic in HQ EDA first");
|
|
28
|
+
}
|
|
29
|
+
console.log("active project:", active.project?.name, projectId);
|
|
30
|
+
|
|
31
|
+
const ctx = client.createProjectContext(projectId);
|
|
32
|
+
const snap = await client.kernel.getSnapshot({ context: ctx });
|
|
33
|
+
const parts = snap.symbolInstances?.length ?? 0;
|
|
34
|
+
const wires = snap.wireSegments?.length ?? 0;
|
|
35
|
+
console.log(`snapshot: ${parts} symbols, ${wires} wire segments on active page`);
|
|
36
|
+
|
|
37
|
+
await client.canvasOps.zoomAll({ context: ctx });
|
|
38
|
+
console.log("zoomAll: OK");
|
|
39
|
+
|
|
40
|
+
console.log("OK — ready for LLM-generated placement scripts");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
main().catch((e) => {
|
|
44
|
+
console.error(e);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|