ee-circuit-draw-simulator 0.2.0 → 0.2.1
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 +11 -1
- package/README.zh-CN.md +13 -2
- package/SKILL.md +3 -1
- package/package.json +3 -3
- package/scripts/circuitlab.mjs +10 -3
- package/scripts/lib/backend.mjs +12 -1
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ Numbers come from the engine, never from a formula the model recalled. Every val
|
|
|
13
13
|
|
|
14
14
|
- Engine: [ExtCircuitJS](https://github.com/blankwy/ExtCircuitJS) — a CircuitJS1 fork with a JSON netlist layer and an MCP bridge, GPL-2.0-or-later
|
|
15
15
|
- Skill: pure Node ≥ 22, no runtime dependencies, one CLI, JSON on stdout
|
|
16
|
+
- CLI on npm: [`ee-circuit-draw-simulator`](https://www.npmjs.com/package/ee-circuit-draw-simulator)
|
|
16
17
|
- Works with any agent that reads `SKILL.md` (Claude Code, Codex CLI, DeepSeek Harness, WorkBuddy, …)
|
|
17
18
|
|
|
18
19
|
## What it answers
|
|
@@ -45,13 +46,22 @@ Measured examples (reproducible with the commands below):
|
|
|
45
46
|
|
|
46
47
|
### 1. Get the skill and its engine
|
|
47
48
|
|
|
49
|
+
**As an agent skill (recommended).** The agent needs the files on disk to read `SKILL.md`, so clone:
|
|
50
|
+
|
|
48
51
|
```bash
|
|
49
52
|
git clone https://github.com/blankwy/ee-circuit-draw-simulator.git ~/ee-circuit-draw-simulator
|
|
50
53
|
cd ~/ee-circuit-draw-simulator
|
|
51
54
|
node scripts/circuitlab.mjs setup
|
|
52
55
|
```
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
**As a plain CLI.** Also published on npm — no clone, good for scripts and CI:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx ee-circuit-draw-simulator@latest setup # engine → ~/.ee-circuit/ExtCircuitJS
|
|
61
|
+
npx ee-circuit-draw-simulator run --circuit lrc --step 0.005 --measure all
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`setup` clones the engine, installs its build dependencies plus the headless-browser driver (`playwright-core`), and builds `dist/`. One time, ~2–4 minutes. With a clone the engine lands in `vendor/ExtCircuitJS`; installed from npm (0.2.1 and later) it goes to `~/.ee-circuit/ExtCircuitJS`, so upgrading the package never throws away a 2-minute build. Already have an engine checkout? Skip both and point at it:
|
|
55
65
|
|
|
56
66
|
```bash
|
|
57
67
|
export EXTCIRCUIT_HOME=/path/to/ExtCircuitJS
|
package/README.zh-CN.md
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
- 引擎:[ExtCircuitJS](https://github.com/blankwy/ExtCircuitJS)(CircuitJS1 二开,JSON 网表层 + MCP 桥,GPL-2.0-or-later)
|
|
17
17
|
- 技能本体:纯 Node ≥ 22,零运行时依赖,一个 CLI,stdout 只出 JSON
|
|
18
|
+
- CLI 也发在 npm:[`ee-circuit-draw-simulator`](https://www.npmjs.com/package/ee-circuit-draw-simulator)
|
|
18
19
|
- 任何会读 `SKILL.md` 的助手都能用(Claude Code、Codex CLI、DeepSeek Harness、WorkBuddy…)
|
|
19
20
|
|
|
20
21
|
## 它能回答什么
|
|
@@ -47,14 +48,24 @@
|
|
|
47
48
|
|
|
48
49
|
### 1. 拿到技能和它的引擎
|
|
49
50
|
|
|
51
|
+
**当技能装(推荐)。** 助手要靠磁盘上的文件读 `SKILL.md`,所以克隆下来:
|
|
52
|
+
|
|
50
53
|
```bash
|
|
51
54
|
git clone https://github.com/blankwy/ee-circuit-draw-simulator.git ~/ee-circuit-draw-simulator
|
|
52
55
|
cd ~/ee-circuit-draw-simulator
|
|
53
56
|
node scripts/circuitlab.mjs setup
|
|
54
57
|
```
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
**当纯 CLI 用。** 也发在 npm 上了,不用克隆,适合脚本和 CI:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx ee-circuit-draw-simulator@latest setup # 引擎装到 ~/.ee-circuit/ExtCircuitJS
|
|
63
|
+
npx ee-circuit-draw-simulator run --circuit lrc --step 0.005 --measure all
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`setup` 会克隆引擎、装构建依赖和无头浏览器驱动(`playwright-core`)、生成 `dist/`。一次性,约 2–4 分钟。
|
|
67
|
+
克隆方式下引擎落在 `vendor/ExtCircuitJS`;从 npm 装时(0.2.1 起)落在 `~/.ee-circuit/ExtCircuitJS`,
|
|
68
|
+
这样升级包版本不会连那 2 分钟的构建一起丢掉。已经有引擎 checkout?两条都跳过,指过去即可:
|
|
58
69
|
|
|
59
70
|
```bash
|
|
60
71
|
export EXTCIRCUIT_HOME=/path/to/ExtCircuitJS
|
package/SKILL.md
CHANGED
|
@@ -9,7 +9,7 @@ allowed-tools:
|
|
|
9
9
|
- Glob
|
|
10
10
|
- Grep
|
|
11
11
|
metadata:
|
|
12
|
-
version: 0.2.
|
|
12
|
+
version: 0.2.1
|
|
13
13
|
homepage: https://github.com/blankwy/ee-circuit-draw-simulator
|
|
14
14
|
engine: ExtCircuitJS (CircuitJS1 fork; real nodal-analysis simulator driven headlessly over an MCP bridge)
|
|
15
15
|
trigger: 电路仿真、波形、元件参数、滤波器/振荡器/放大器、生成电路图、分享可交互电路
|
|
@@ -24,6 +24,8 @@ metadata:
|
|
|
24
24
|
采样 → 参数扫描 → 出 SVG → 出分享链接」全链路,一次进程跑完,stdout 只有 JSON。
|
|
25
25
|
|
|
26
26
|
> 回答用用户的语言;数值、单位、元件名照 CLI 输出原样引用。
|
|
27
|
+
> 本文件里写作 `node <skill>/scripts/circuitlab.mjs`;如果手上只有 npm 包没有技能目录,
|
|
28
|
+
> 换成 `npx ee-circuit-draw-simulator`,参数完全一样。
|
|
27
29
|
|
|
28
30
|
## 一、先决条件(按顺序做,别跳)
|
|
29
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ee-circuit-draw-simulator",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Agent skill for real circuit simulation: draw, simulate, measure, plot and share circuits instead of guessing numbers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"url": "https://github.com/blankwy/ee-circuit-draw-simulator/issues"
|
|
14
14
|
},
|
|
15
15
|
"bin": {
|
|
16
|
-
"ee-circuit-draw-simulator": "
|
|
17
|
-
"circuitlab": "
|
|
16
|
+
"ee-circuit-draw-simulator": "scripts/circuitlab.mjs",
|
|
17
|
+
"circuitlab": "scripts/circuitlab.mjs"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"SKILL.md",
|
package/scripts/circuitlab.mjs
CHANGED
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
defaultEngineDir,
|
|
27
27
|
isEngineRepo,
|
|
28
28
|
hasPlaywrightCore,
|
|
29
|
+
SKILL_IN_NODE_MODULES,
|
|
29
30
|
ENGINE_URL,
|
|
30
31
|
SKILL_DIR,
|
|
31
32
|
} from "./lib/backend.mjs";
|
|
@@ -34,7 +35,8 @@ import { parseValue, fmtEng, round } from "./lib/units.mjs";
|
|
|
34
35
|
|
|
35
36
|
const HELP = `ee-circuit-draw-simulator —— 电子电路绘制仿真助手 CLI
|
|
36
37
|
|
|
37
|
-
用法:
|
|
38
|
+
用法: ee-circuit-draw-simulator <命令> [选项]
|
|
39
|
+
(等价写法:npx ee-circuit-draw-simulator ... / node scripts/circuitlab.mjs ...)
|
|
38
40
|
|
|
39
41
|
命令:
|
|
40
42
|
setup 第一次用:克隆并构建 ExtCircuitJS 引擎(一次就够)
|
|
@@ -51,7 +53,8 @@ const HELP = `ee-circuit-draw-simulator —— 电子电路绘制仿真助手 CL
|
|
|
51
53
|
--out <dir> 产物目录(默认 ./circuit-out)
|
|
52
54
|
|
|
53
55
|
setup 的选项:
|
|
54
|
-
--dir <path> 引擎装到哪(默认 <skill>/vendor/ExtCircuitJS
|
|
56
|
+
--dir <path> 引擎装到哪(默认 <skill>/vendor/ExtCircuitJS;
|
|
57
|
+
npx / 全局安装时默认 ~/.ee-circuit/ExtCircuitJS)
|
|
55
58
|
--url <git url> 换一个 fork(默认 ${ENGINE_URL})
|
|
56
59
|
--skip-install 跳过 core install
|
|
57
60
|
--skip-build 跳过 build(没有 dist 就只能用 dev server)
|
|
@@ -848,9 +851,13 @@ async function cmdProbe(o) {
|
|
|
848
851
|
}
|
|
849
852
|
}
|
|
850
853
|
if (!repo) {
|
|
854
|
+
const how = SKILL_IN_NODE_MODULES
|
|
855
|
+
? "npx ee-circuit-draw-simulator setup"
|
|
856
|
+
: "node <skill>/scripts/circuitlab.mjs setup";
|
|
851
857
|
out.hint = [
|
|
852
858
|
"还没装引擎(ExtCircuitJS)。一条命令搞定:",
|
|
853
|
-
|
|
859
|
+
` ${how}`,
|
|
860
|
+
`引擎会装到:${defaultEngineDir()}`,
|
|
854
861
|
`找过的位置:${tried.slice(0, 5).join(" / ")}`,
|
|
855
862
|
];
|
|
856
863
|
} else if (!out.ok && !out.hint) {
|
package/scripts/lib/backend.mjs
CHANGED
|
@@ -21,9 +21,20 @@ export const SKILL_DIR = path.resolve(HERE, "../..");
|
|
|
21
21
|
/** 官方引擎仓库。setup 命令按它克隆;也可以 --url 换成自己的 fork。 */
|
|
22
22
|
export const ENGINE_URL = "https://github.com/blankwy/ExtCircuitJS.git";
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* 技能目录是不是躺在某个 node_modules 里(npx / -g / 装成依赖)。
|
|
26
|
+
* 那种位置的目录会被升级、`npm cache clean`、临时安装目录回收抹掉。
|
|
27
|
+
*/
|
|
28
|
+
export const SKILL_IN_NODE_MODULES = /[\\/](node_modules|_npx)[\\/]/.test(`${SKILL_DIR}${path.sep}`);
|
|
29
|
+
|
|
24
30
|
/** 技能自带引擎的落点(.gitignore 掉,不进本仓库)。 */
|
|
25
31
|
export function defaultEngineDir() {
|
|
26
|
-
|
|
32
|
+
if (process.env.EE_CIRCUIT_ENGINE_DIR) return process.env.EE_CIRCUIT_ENGINE_DIR;
|
|
33
|
+
// 从 npm 装着跑(npx 最典型)时,包目录是临时/可回收的:引擎放到用户目录,
|
|
34
|
+
// 否则换一次版本就得重下一份引擎、重构建两分钟。
|
|
35
|
+
return SKILL_IN_NODE_MODULES
|
|
36
|
+
? path.join(os.homedir(), ".ee-circuit", "ExtCircuitJS")
|
|
37
|
+
: path.join(SKILL_DIR, "vendor", "ExtCircuitJS");
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
/** 判断一个目录是不是 ExtCircuitJS 仓库根。 */
|