@actiondock/cli 2.5.0 → 2.5.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.
@@ -1,5 +1,6 @@
1
1
  import { resolve } from "node:path";
2
2
  import { findProjectRoot, formatHostForUrl, loadProjectConfig, parseDuration } from "@actiondock/core";
3
+ import { createNodePlatform } from "@actiondock/runtime-node";
3
4
  import { ArgumentError, ExecutionError } from "../errors.js";
4
5
  import { writeStdout } from "../renderer.js";
5
6
  import { getEffectiveOptions, parseByteSize, parseListOption } from "../utils/index.js";
@@ -18,6 +19,7 @@ export function registerMcpCommands(program, context) {
18
19
  .option("--all", "Serve all linked packages from global registry")
19
20
  .option("--timeout <duration>", "Execution timeout (e.g. 30s, 5m, 500ms)")
20
21
  .option("--allow-insecure-http", "Allow insecure HTTP connections with auth token (INSECURE)")
22
+ .option("--data-dir <path>", "Custom database storage directory")
21
23
  .action(async (rawOptions, cmd) => {
22
24
  const options = getEffectiveOptions(rawOptions, cmd);
23
25
  let timeoutMs;
@@ -41,6 +43,8 @@ export function registerMcpCommands(program, context) {
41
43
  packageIds,
42
44
  all,
43
45
  timeoutMs,
46
+ customHome: context?.customHome,
47
+ dataDir: options.dataDir || context?.dataDir,
44
48
  });
45
49
  }
46
50
  catch (err) {
@@ -63,6 +67,7 @@ export function registerMcpCommands(program, context) {
63
67
  .option("--package <package-id>", "Specific linked package ID(s) to serve (can be specified multiple times or comma-separated)", parseListOption, [])
64
68
  .option("--all", "Serve all linked packages from global registry")
65
69
  .option("--timeout <duration>", "Execution timeout (e.g. 30s, 5m, 500ms)")
70
+ .option("--data-dir <path>", "Custom database storage directory")
66
71
  .action(async (rawOptions, cmd) => {
67
72
  const options = getEffectiveOptions(rawOptions, cmd);
68
73
  const port = parseInt(options.port, 10) || 5178;
@@ -132,6 +137,11 @@ export function registerMcpCommands(program, context) {
132
137
  }
133
138
  }
134
139
  try {
140
+ const platform = createNodePlatform({
141
+ customHome: context?.customHome,
142
+ dataDir: options.dataDir || context?.dataDir,
143
+ rootDir: projectRoots?.[0],
144
+ });
135
145
  const { startMcpHttpServer } = await import("@actiondock/mcp");
136
146
  const server = await startMcpHttpServer({
137
147
  port,
@@ -146,6 +156,9 @@ export function registerMcpCommands(program, context) {
146
156
  packageIds,
147
157
  all,
148
158
  timeoutMs,
159
+ customHome: context?.customHome,
160
+ dataDir: options.dataDir || context?.dataDir,
161
+ platform,
149
162
  });
150
163
  const displayHost = formatHostForUrl(host);
151
164
  const actualMcpHost = formatHostForUrl(host === "0.0.0.0" ? "127.0.0.1" : host);
@@ -1,6 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { resolve } from "node:path";
3
- import { findProjectRoot, formatHostForUrl, loadProjectConfig, startActionDockServer, } from "@actiondock/core";
3
+ import { createActionDockTarget, findProjectRoot, formatHostForUrl, loadProjectConfig, startActionDockServer, } from "@actiondock/core";
4
+ import { createNodePlatform } from "@actiondock/runtime-node";
4
5
  import { ArgumentError, ExecutionError } from "../errors.js";
5
6
  import { writeStderr, writeStdout } from "../renderer.js";
6
7
  import { ensureSelfSignedCertificate, getEffectiveOptions, parseByteSize } from "../utils/index.js";
@@ -30,9 +31,11 @@ export function registerServeCommand(program, context) {
30
31
  .option("--tls-ca <path>", "Path to TLS CA certificate file (or set ACTIONDOCK_TLS_CA)")
31
32
  .option("--tls-passphrase <passphrase>", "Passphrase for TLS private key (or set ACTIONDOCK_TLS_PASSPHRASE)")
32
33
  .option("-d, --dir <path>", "Project root directory (default: current working directory)")
34
+ .option("--data-dir <path>", "Custom database storage directory")
33
35
  .action(async (rawOptions, cmd) => {
34
36
  const options = getEffectiveOptions(rawOptions, cmd);
35
- const port = parseInt(options.port, 10) || 5177;
37
+ const parsedPort = parseInt(options.port, 10);
38
+ const port = Number.isNaN(parsedPort) ? 5177 : parsedPort;
36
39
  const host = options.host || "127.0.0.1";
37
40
  const token = options.token || (typeof process !== "undefined" ? process.env?.ACTIONDOCK_TOKEN : undefined);
38
41
  const allowInsecureNoAuth = Boolean(options.allowInsecureNoAuth);
@@ -101,6 +104,19 @@ export function registerServeCommand(program, context) {
101
104
  // 降级处理
102
105
  }
103
106
  }
107
+ const platform = createNodePlatform({
108
+ customHome: context?.customHome,
109
+ dataDir: options.dataDir || context?.dataDir,
110
+ rootDir: projectRoot || undefined,
111
+ });
112
+ const target = await createActionDockTarget({
113
+ type: "local",
114
+ projectRoot: projectRoot || undefined,
115
+ customHome: context?.customHome,
116
+ dataDir: options.dataDir || context?.dataDir,
117
+ platform,
118
+ scanLinkedPackages: !projectRoot,
119
+ });
104
120
  let mcpHandler;
105
121
  const enableMcp = options.mcp !== false;
106
122
  if (enableMcp) {
@@ -112,7 +128,7 @@ export function registerServeCommand(program, context) {
112
128
  ]);
113
129
  const handler = createMcpHandler(() => {
114
130
  return createActionDockMcpServer({
115
- projectRoot: projectRoot || undefined,
131
+ target,
116
132
  });
117
133
  }, {
118
134
  onerror: (err) => {
@@ -124,6 +140,7 @@ export function registerServeCommand(program, context) {
124
140
  };
125
141
  }
126
142
  catch (err) {
143
+ await target.close().catch(() => { });
127
144
  throw new ExecutionError(`Failed to initialize MCP endpoint: ${err?.message || String(err)}`, err);
128
145
  }
129
146
  }
@@ -142,6 +159,7 @@ export function registerServeCommand(program, context) {
142
159
  mcpHandler,
143
160
  tls,
144
161
  projectRoot: projectRoot || undefined,
162
+ target,
145
163
  });
146
164
  const displayHost = formatHostForUrl(host);
147
165
  const actualEndpointHost = formatHostForUrl(host === "0.0.0.0" ? "127.0.0.1" : host);
@@ -180,6 +198,7 @@ export function registerServeCommand(program, context) {
180
198
  process.once("SIGTERM", stopSignalHandler);
181
199
  }
182
200
  catch (err) {
201
+ await target.close().catch(() => { });
183
202
  throw new ExecutionError(`Failed to start ActionDock server: ${err.message}`, err);
184
203
  }
185
204
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/cli",
3
- "version": "2.5.0",
3
+ "version": "2.5.1",
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,11 +34,11 @@
34
34
  "test": "node ../../scripts/run-tests.ts"
35
35
  },
36
36
  "dependencies": {
37
- "@actiondock/builder": "^2.5.0",
38
- "@actiondock/core": "^2.5.0",
39
- "@actiondock/mcp": "^2.5.0",
40
- "@actiondock/runtime-node": "^2.5.0",
41
- "@actiondock/sdk": "^2.5.0",
37
+ "@actiondock/builder": "^2.5.1",
38
+ "@actiondock/core": "^2.5.1",
39
+ "@actiondock/mcp": "^2.5.1",
40
+ "@actiondock/runtime-node": "^2.5.1",
41
+ "@actiondock/sdk": "^2.5.1",
42
42
  "commander": "^13.1.0",
43
43
  "selfsigned": "^5.5.0"
44
44
  },