@actiondock/cli 2.0.4 → 2.0.7

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 CHANGED
@@ -1,17 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
- import { fileURLToPath } from "node:url";
3
+ import { createRequire } from "node:module";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
5
 
5
6
  const isBun = typeof process.versions.bun !== "undefined";
6
7
 
7
8
  if (!isBun && !process.env.ACTIONDOCK_TSX_BOOTSTRAPPED) {
8
9
  const hasTsx =
9
- process.execArgv.some((arg, i) => arg === "--import" && process.execArgv[i + 1] === "tsx") ||
10
+ process.execArgv.some((arg, i) => arg === "--import" && process.execArgv[i + 1]?.includes("tsx")) ||
10
11
  process.execArgv.some((arg) => arg.includes("tsx"));
11
12
  if (!hasTsx) {
13
+ const require = createRequire(import.meta.url);
14
+ let tsxSpecifier = "tsx";
15
+ try {
16
+ tsxSpecifier = pathToFileURL(require.resolve("tsx")).href;
17
+ } catch {
18
+ try {
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
+ }
25
+ }
26
+
12
27
  const res = spawnSync(
13
28
  process.execPath,
14
- ["--import", "tsx", fileURLToPath(import.meta.url), ...process.argv.slice(2)],
29
+ ["--import", tsxSpecifier, fileURLToPath(import.meta.url), ...process.argv.slice(2)],
15
30
  {
16
31
  stdio: "inherit",
17
32
  env: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/cli",
3
- "version": "2.0.4",
3
+ "version": "2.0.7",
4
4
  "description": "ActionDock CLI facade for developing, testing, building, and exporting standalone Agent Actions and Skills",
5
5
  "type": "module",
6
6
  "bin": {
@@ -34,7 +34,8 @@
34
34
  "@actiondock/runtime-cli": "^2.0.0",
35
35
  "@actiondock/runtime-node": "^2.0.0",
36
36
  "@actiondock/sdk": "^2.0.0",
37
- "commander": "^13.1.0"
37
+ "commander": "^13.1.0",
38
+ "tsx": "^4.19.3"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@types/bun": "latest",
@@ -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.4");
24
+ .version("2.0.7");
25
25
 
26
26
  registerInitCommand(program);
27
27
  registerInfoCommand(program);