@actiondock/cli 2.0.7 → 2.0.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/bin/ad.js +28 -28
- package/package.json +1 -1
- package/src/commands/index.ts +1 -1
package/bin/ad.js
CHANGED
|
@@ -5,38 +5,38 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
5
5
|
|
|
6
6
|
const isBun = typeof process.versions.bun !== "undefined";
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
// 本进程是否已挂载 tsx 引导器。execArgv 不会被子进程继承,必须逐进程检测;
|
|
9
|
+
// 严禁改用环境变量判断:Action 内嵌套调度的 ad 子进程会继承父进程环境变量,
|
|
10
|
+
// 却不继承 --import,误判为已引导后会直接 import node_modules 下的 TS 源码,
|
|
11
|
+
// 触发 ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING。
|
|
12
|
+
// 注意也不能依赖 Node 原生类型剥离:它拒绝 node_modules 下的文件,且不支持源码中的目录导入。
|
|
13
|
+
const hasTsx =
|
|
14
|
+
process.execArgv.some((arg, i) => arg === "--import" && process.execArgv[i + 1]?.includes("tsx")) ||
|
|
15
|
+
process.execArgv.some((arg) => arg.includes("tsx"));
|
|
16
|
+
|
|
17
|
+
if (!isBun && !hasTsx) {
|
|
18
|
+
const require = createRequire(import.meta.url);
|
|
19
|
+
let tsxSpecifier = "tsx";
|
|
20
|
+
try {
|
|
21
|
+
tsxSpecifier = pathToFileURL(require.resolve("tsx")).href;
|
|
22
|
+
} catch {
|
|
15
23
|
try {
|
|
16
|
-
|
|
24
|
+
const runtimeNodePkg = require.resolve("@actiondock/runtime-node/package.json");
|
|
25
|
+
const runtimeReq = createRequire(runtimeNodePkg);
|
|
26
|
+
tsxSpecifier = pathToFileURL(runtimeReq.resolve("tsx")).href;
|
|
17
27
|
} catch {
|
|
18
|
-
|
|
19
|
-
const runtimeNodePkg = require.resolve("@actiondock/runtime-node/package.json");
|
|
20
|
-
const runtimeReq = createRequire(runtimeNodePkg);
|
|
21
|
-
tsxSpecifier = pathToFileURL(runtimeReq.resolve("tsx")).href;
|
|
22
|
-
} catch {
|
|
23
|
-
// 回退为裸模块名
|
|
24
|
-
}
|
|
28
|
+
// 回退为裸模块名
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
const res = spawnSync(
|
|
28
|
-
process.execPath,
|
|
29
|
-
["--import", tsxSpecifier, fileURLToPath(import.meta.url), ...process.argv.slice(2)],
|
|
30
|
-
{
|
|
31
|
-
stdio: "inherit",
|
|
32
|
-
env: {
|
|
33
|
-
...process.env,
|
|
34
|
-
ACTIONDOCK_TSX_BOOTSTRAPPED: "1",
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
process.exit(res.status ?? (res.signal ? 1 : 0));
|
|
39
30
|
}
|
|
31
|
+
|
|
32
|
+
const res = spawnSync(
|
|
33
|
+
process.execPath,
|
|
34
|
+
["--import", tsxSpecifier, fileURLToPath(import.meta.url), ...process.argv.slice(2)],
|
|
35
|
+
{
|
|
36
|
+
stdio: "inherit",
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
process.exit(res.status ?? (res.signal ? 1 : 0));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const { main } = await import("../src/index.ts");
|
package/package.json
CHANGED
package/src/commands/index.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function createCliProgram(): Command {
|
|
|
21
21
|
program
|
|
22
22
|
.name("ad")
|
|
23
23
|
.description("ActionDock (ad) 2.0 - Toolchain for building and shipping standalone AI Agent Actions & Skills")
|
|
24
|
-
.version("2.0.
|
|
24
|
+
.version("2.0.8");
|
|
25
25
|
|
|
26
26
|
registerInitCommand(program);
|
|
27
27
|
registerInfoCommand(program);
|