@agent_forge/forge 2.0.1 → 2.0.2
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/package.json +6 -6
- package/run.js +24 -7
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent_forge/forge",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "AI 开发质量门禁引擎 — 结构化门禁管道,在 AI 生成的代码进入仓库前进行质量锻造",
|
|
5
5
|
"bin": {
|
|
6
6
|
"forge": "run.js"
|
|
7
7
|
},
|
|
8
8
|
"optionalDependencies": {
|
|
9
|
-
"@agent_forge/forge-darwin-arm64": "2.0.
|
|
10
|
-
"@agent_forge/forge-darwin-x64": "2.0.
|
|
11
|
-
"@agent_forge/forge-linux-arm64": "2.0.
|
|
12
|
-
"@agent_forge/forge-linux-x64": "2.0.
|
|
13
|
-
"@agent_forge/forge-win32-x64": "2.0.
|
|
9
|
+
"@agent_forge/forge-darwin-arm64": "2.0.2",
|
|
10
|
+
"@agent_forge/forge-darwin-x64": "2.0.2",
|
|
11
|
+
"@agent_forge/forge-linux-arm64": "2.0.2",
|
|
12
|
+
"@agent_forge/forge-linux-x64": "2.0.2",
|
|
13
|
+
"@agent_forge/forge-win32-x64": "2.0.2"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"run.js",
|
package/run.js
CHANGED
|
@@ -38,19 +38,36 @@ if (!SUPPORTED.has(platKey)) {
|
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// __dirname 是 …/node_modules/@agent_forge/forge
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
// __dirname 是 …/node_modules/@agent_forge/forge。平台子包可能落在两处,都要找:
|
|
42
|
+
// 1) 包内嵌套:…/@agent_forge/forge/node_modules/@agent_forge/forge-<plat>/bin(全局安装实测)
|
|
43
|
+
// 2) 兄弟目录:…/@agent_forge/forge-<plat>/bin(本地安装被 hoist 时的常见形态)
|
|
44
|
+
// 不在此列的位置(祖先 node_modules)刻意不找——那正是 1.42.2 祖先遮蔽的来源。
|
|
45
|
+
const candidates = [
|
|
46
|
+
path.join(__dirname, "node_modules", platformPkg, "bin", exe),
|
|
47
|
+
path.join(__dirname, "..", `forge-${platKey}`, "bin", exe),
|
|
48
|
+
];
|
|
49
|
+
const binaryPath = candidates.find((p) => fs.existsSync(p));
|
|
50
|
+
if (binaryPath === undefined) {
|
|
44
51
|
die(
|
|
45
52
|
`platform package ${platformPkg} is not installed`,
|
|
46
53
|
"重装并保留 optionalDependencies:npm i -g @agent_forge/forge --include=optional(不要带 --omit=optional)。"
|
|
47
54
|
);
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
let child;
|
|
58
|
+
try {
|
|
59
|
+
child = spawn(binaryPath, process.argv.slice(2), {
|
|
60
|
+
stdio: "inherit",
|
|
61
|
+
env: process.env,
|
|
62
|
+
});
|
|
63
|
+
} catch (e) {
|
|
64
|
+
// spawn 也可能同步抛(Windows 上无效 exe 报 spawn UNKNOWN)——不能让它变成
|
|
65
|
+
// 带栈迹的 node 崩溃,更不能用退出码 0 掩盖失败。
|
|
66
|
+
die(
|
|
67
|
+
`spawn failed: ${e.message}`,
|
|
68
|
+
`检查 ${binaryPath} 是否存在且可执行(chmod +x);仍失败则重装:npm i -g @agent_forge/forge --include=optional。`
|
|
69
|
+
);
|
|
70
|
+
}
|
|
54
71
|
|
|
55
72
|
// spawn 失败走 error 事件而非 exit——没有监听器会带栈迹崩溃并把失败说成成功。
|
|
56
73
|
child.on("error", (e) => {
|