@lark-codem/codem-cli 0.1.175 → 0.1.176
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/bin/codem.js +33 -3
- package/package.json +7 -7
package/bin/codem.js
CHANGED
|
@@ -48,10 +48,41 @@ function resolvePlatformBinary() {
|
|
|
48
48
|
return candidates.find((candidate) => fs.existsSync(candidate)) ?? null;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
// spawn 的失败有两条互斥出口:只有 EACCES / EAGAIN / EMFILE / ENFILE / ENOENT
|
|
52
|
+
// 会被 Node 降级成异步 `error` 事件,其余 errno(ENOEXEC / ENOTDIR / EPERM,以及
|
|
53
|
+
// Windows 上杀软 / EDR 拦截 CreateProcessW 时 libuv 报的 UNKNOWN=-4094)在
|
|
54
|
+
// `child_process.spawn()` 里直接 `throw new ErrnoException(err, 'spawn')`。
|
|
55
|
+
// 两条出口必须汇到同一个 reporter:只挂 child.on("error") 的话,后一类失败会以
|
|
56
|
+
// 一段指向 node:internal/child_process 的裸栈抛给用户——codem-cli 的平台二进制是
|
|
57
|
+
// bun --compile 出来的未签名可执行文件,Windows 上被拦截是真实可达路径。
|
|
58
|
+
function reportSpawnFailure(targetPath, error) {
|
|
59
|
+
const code = error?.code ?? "UNKNOWN";
|
|
60
|
+
const errno = error?.errno ?? "unknown";
|
|
61
|
+
const detail = error?.message ?? String(error);
|
|
62
|
+
const lines = [
|
|
63
|
+
`codem: 无法启动 CLI 二进制(${targetPath}):${detail}`,
|
|
64
|
+
`codem: 失败细节 code=${code} errno=${errno} platform=${process.platform}`
|
|
65
|
+
];
|
|
66
|
+
if (process.platform === "win32") {
|
|
67
|
+
lines.push(
|
|
68
|
+
"codem: Windows 上最常见的成因是杀毒软件 / EDR 拦截了进程创建(此时 libuv 只能报 UNKNOWN/-4094)。",
|
|
69
|
+
`codem: 请把该路径加入杀软白名单后重新安装 CodeM CLI;或先在 PowerShell 里直接裸跑 & "${targetPath}" --version,`,
|
|
70
|
+
"codem: 操作系统给出的错误会比这里的 spawn 报错具体得多。"
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
console.error(lines.join("\n"));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
51
77
|
const binaryPath = resolvePlatformBinary();
|
|
52
78
|
|
|
53
79
|
if (binaryPath) {
|
|
54
|
-
|
|
80
|
+
let child;
|
|
81
|
+
try {
|
|
82
|
+
child = spawn(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
83
|
+
} catch (error) {
|
|
84
|
+
reportSpawnFailure(binaryPath, error);
|
|
85
|
+
}
|
|
55
86
|
|
|
56
87
|
// 终端会把 SIGINT/SIGHUP 广播给整个前台进程组,但 execFile timeout、
|
|
57
88
|
// child.kill()、launchd/systemd 等调用方也会只命中 launcher PID。三类终止
|
|
@@ -74,8 +105,7 @@ if (binaryPath) {
|
|
|
74
105
|
}
|
|
75
106
|
|
|
76
107
|
child.on("error", (error) => {
|
|
77
|
-
|
|
78
|
-
process.exit(1);
|
|
108
|
+
reportSpawnFailure(binaryPath, error);
|
|
79
109
|
});
|
|
80
110
|
|
|
81
111
|
child.on("exit", (code, signal) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.176",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CodeM local CLI for Feishu-driven coding sessions",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"@lark-codem/codem-core": "latest"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@lark-codem/codem-cli-darwin-arm64": "0.1.
|
|
33
|
-
"@lark-codem/codem-cli-darwin-x64": "0.1.
|
|
34
|
-
"@lark-codem/codem-cli-linux-arm64": "0.1.
|
|
35
|
-
"@lark-codem/codem-cli-linux-x64": "0.1.
|
|
36
|
-
"@lark-codem/codem-cli-win32-arm64": "0.1.
|
|
37
|
-
"@lark-codem/codem-cli-win32-x64": "0.1.
|
|
32
|
+
"@lark-codem/codem-cli-darwin-arm64": "0.1.176",
|
|
33
|
+
"@lark-codem/codem-cli-darwin-x64": "0.1.176",
|
|
34
|
+
"@lark-codem/codem-cli-linux-arm64": "0.1.176",
|
|
35
|
+
"@lark-codem/codem-cli-linux-x64": "0.1.176",
|
|
36
|
+
"@lark-codem/codem-cli-win32-arm64": "0.1.176",
|
|
37
|
+
"@lark-codem/codem-cli-win32-x64": "0.1.176"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">=18"
|