@actiondock/cli 2.0.11-beta.0 → 2.0.12
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/README.md +15 -2
- package/bin/ad.js +13 -2
- package/dist/commands/action/create.d.ts +2 -0
- package/dist/commands/action/index.d.ts +16 -0
- package/dist/commands/action/list.d.ts +5 -0
- package/dist/commands/action/run.d.ts +4 -0
- package/dist/commands/action/show.d.ts +5 -0
- package/dist/commands/action/sync.d.ts +2 -0
- package/dist/commands/action/validate.d.ts +5 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/export.d.ts +2 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/info.d.ts +2 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/link.d.ts +2 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/playbook.d.ts +6 -0
- package/dist/commands/profile.d.ts +2 -0
- package/dist/commands/runs.d.ts +2 -0
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/state.d.ts +2 -0
- package/dist/commands/test.d.ts +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +745 -65708
- package/{src/utils/bytes.ts → dist/utils/bytes.d.ts} +0 -1
- package/{src/utils/filter.ts → dist/utils/filter.d.ts} +0 -1
- package/package.json +20 -15
- package/src/commands/action/create.ts +0 -129
- package/src/commands/action/index.ts +0 -27
- package/src/commands/action/list.ts +0 -247
- package/src/commands/action/run.ts +0 -197
- package/src/commands/action/show.ts +0 -128
- package/src/commands/action/sync.ts +0 -76
- package/src/commands/action/validate.ts +0 -102
- package/src/commands/build.ts +0 -56
- package/src/commands/config.ts +0 -583
- package/src/commands/doctor.ts +0 -84
- package/src/commands/export.ts +0 -196
- package/src/commands/index.ts +0 -75
- package/src/commands/info.ts +0 -537
- package/src/commands/init.ts +0 -24
- package/src/commands/link.ts +0 -73
- package/src/commands/mcp.ts +0 -195
- package/src/commands/playbook.ts +0 -566
- package/src/commands/profile.ts +0 -296
- package/src/commands/runs.ts +0 -452
- package/src/commands/serve.ts +0 -132
- package/src/commands/state.ts +0 -590
- package/src/commands/test.ts +0 -48
- package/src/index.ts +0 -58
- /package/{src/commands/action.ts → dist/commands/action.d.ts} +0 -0
- /package/{src/utils/duration.ts → dist/utils/duration.d.ts} +0 -0
package/src/commands/mcp.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { findProjectRoot, loadProjectConfig } from "@actiondock/core";
|
|
3
|
-
import { startMcpHttpServer, startMcpStdio } from "@actiondock/mcp";
|
|
4
|
-
import { Command } from "commander";
|
|
5
|
-
import { ExecutionError } from "@actiondock/runtime-cli";
|
|
6
|
-
import { parseByteSize } from "../utils/bytes";
|
|
7
|
-
import { parseDuration } from "../utils/duration";
|
|
8
|
-
|
|
9
|
-
function parseListOption(val: string, prev: string[] = []): string[] {
|
|
10
|
-
const parts = val.split(",").map((s) => s.trim()).filter(Boolean);
|
|
11
|
-
return [...prev, ...parts];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function registerMcpCommands(program: Command): void {
|
|
15
|
-
const mcpCommand = program
|
|
16
|
-
.command("mcp")
|
|
17
|
-
.description("Model Context Protocol (MCP) server for ActionDock Actions (STDIO default)")
|
|
18
|
-
.option(
|
|
19
|
-
"-d, --dir <path>",
|
|
20
|
-
"Project root directory or directories (can be specified multiple times or comma-separated)",
|
|
21
|
-
parseListOption,
|
|
22
|
-
[]
|
|
23
|
-
)
|
|
24
|
-
.option(
|
|
25
|
-
"--package <package-id>",
|
|
26
|
-
"Specific linked package ID(s) to serve (can be specified multiple times or comma-separated)",
|
|
27
|
-
parseListOption,
|
|
28
|
-
[]
|
|
29
|
-
)
|
|
30
|
-
.option("--all", "Serve all linked packages from global registry")
|
|
31
|
-
.option("--timeout <duration>", "Execution timeout (e.g. 30s, 5m, 500ms)")
|
|
32
|
-
.action(async (options) => {
|
|
33
|
-
// Default: stdio mode
|
|
34
|
-
let timeoutMs: number | undefined;
|
|
35
|
-
if (options.timeout) {
|
|
36
|
-
try {
|
|
37
|
-
timeoutMs = parseDuration(options.timeout);
|
|
38
|
-
} catch (err: any) {
|
|
39
|
-
throw new ExecutionError(err.message);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const projectRoots =
|
|
44
|
-
options.dir && options.dir.length > 0
|
|
45
|
-
? options.dir.map((d: string) => resolve(d))
|
|
46
|
-
: undefined;
|
|
47
|
-
const packageIds =
|
|
48
|
-
options.package && options.package.length > 0 ? options.package : undefined;
|
|
49
|
-
const all = Boolean(options.all);
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
await startMcpStdio({
|
|
53
|
-
projectRoots,
|
|
54
|
-
packageIds,
|
|
55
|
-
all,
|
|
56
|
-
timeoutMs,
|
|
57
|
-
});
|
|
58
|
-
} catch (err: any) {
|
|
59
|
-
throw new ExecutionError(`Failed to start MCP STDIO server: ${err.message}`);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
mcpCommand
|
|
64
|
-
.command("serve")
|
|
65
|
-
.description("Start the ActionDock MCP server over HTTP transport")
|
|
66
|
-
.option("-p, --port <port>", "Port to listen on (default: 5178)", "5178")
|
|
67
|
-
.option("-H, --host <host>", "Host address to bind to (default: 127.0.0.1)", "127.0.0.1")
|
|
68
|
-
.option("-t, --token <token>", "Authentication token for securing the endpoint (or set ACTIONDOCK_TOKEN)")
|
|
69
|
-
.option("--token-env <env>", "Environment variable name containing the authentication token")
|
|
70
|
-
.option("--allow-insecure-no-auth", "Allow non-loopback host binding without authentication token (INSECURE)")
|
|
71
|
-
.option(
|
|
72
|
-
"--cors-origin <origin>",
|
|
73
|
-
"Allowed CORS origin (can be specified multiple times)",
|
|
74
|
-
(val: string, prev: string[] = []) => [...prev, val],
|
|
75
|
-
[]
|
|
76
|
-
)
|
|
77
|
-
.option("--max-body <size>", "Maximum allowed JSON request body size (e.g. 1mb, 500kb)", "1mb")
|
|
78
|
-
.option(
|
|
79
|
-
"-d, --dir <path>",
|
|
80
|
-
"Project root directory or directories (can be specified multiple times or comma-separated)",
|
|
81
|
-
parseListOption,
|
|
82
|
-
[]
|
|
83
|
-
)
|
|
84
|
-
.option(
|
|
85
|
-
"--package <package-id>",
|
|
86
|
-
"Specific linked package ID(s) to serve (can be specified multiple times or comma-separated)",
|
|
87
|
-
parseListOption,
|
|
88
|
-
[]
|
|
89
|
-
)
|
|
90
|
-
.option("--all", "Serve all linked packages from global registry")
|
|
91
|
-
.option("--timeout <duration>", "Execution timeout (e.g. 30s, 5m, 500ms)")
|
|
92
|
-
.action(async (options) => {
|
|
93
|
-
const port = parseInt(options.port, 10) || 5178;
|
|
94
|
-
const host = options.host || "127.0.0.1";
|
|
95
|
-
const token =
|
|
96
|
-
options.token ||
|
|
97
|
-
(options.tokenEnv ? process.env[options.tokenEnv] : undefined) ||
|
|
98
|
-
process.env.ACTIONDOCK_TOKEN;
|
|
99
|
-
const allowInsecureNoAuth = Boolean(options.allowInsecureNoAuth);
|
|
100
|
-
const corsOrigins =
|
|
101
|
-
options.corsOrigin && options.corsOrigin.length > 0 ? options.corsOrigin : undefined;
|
|
102
|
-
|
|
103
|
-
let maxBodyBytes: number | undefined;
|
|
104
|
-
if (options.maxBody) {
|
|
105
|
-
try {
|
|
106
|
-
maxBodyBytes = parseByteSize(options.maxBody);
|
|
107
|
-
} catch (err: any) {
|
|
108
|
-
throw new ExecutionError(err.message);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
let timeoutMs: number | undefined;
|
|
113
|
-
if (options.timeout) {
|
|
114
|
-
try {
|
|
115
|
-
timeoutMs = parseDuration(options.timeout);
|
|
116
|
-
} catch (err: any) {
|
|
117
|
-
throw new ExecutionError(err.message);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const projectRoots =
|
|
122
|
-
options.dir && options.dir.length > 0
|
|
123
|
-
? options.dir.map((d: string) => resolve(d))
|
|
124
|
-
: undefined;
|
|
125
|
-
const packageIds =
|
|
126
|
-
options.package && options.package.length > 0 ? options.package : undefined;
|
|
127
|
-
const all = Boolean(options.all);
|
|
128
|
-
|
|
129
|
-
let targetDescription = "ActionDock MCP Server";
|
|
130
|
-
if (all) {
|
|
131
|
-
targetDescription = "All Linked Packages (Global Registry Mode)";
|
|
132
|
-
} else if (packageIds && packageIds.length > 1) {
|
|
133
|
-
targetDescription = `Packages: ${packageIds.join(", ")}`;
|
|
134
|
-
} else if (projectRoots && projectRoots.length > 1) {
|
|
135
|
-
targetDescription = `Directories: ${projectRoots.join(", ")}`;
|
|
136
|
-
} else if (projectRoots && projectRoots.length === 1) {
|
|
137
|
-
try {
|
|
138
|
-
const config = loadProjectConfig(projectRoots[0]);
|
|
139
|
-
targetDescription = `${config.name} (${config.id})`;
|
|
140
|
-
} catch {
|
|
141
|
-
targetDescription = projectRoots[0];
|
|
142
|
-
}
|
|
143
|
-
} else if (packageIds && packageIds.length === 1) {
|
|
144
|
-
targetDescription = `Package: ${packageIds[0]}`;
|
|
145
|
-
} else {
|
|
146
|
-
const currentRoot = findProjectRoot(process.cwd());
|
|
147
|
-
if (currentRoot) {
|
|
148
|
-
try {
|
|
149
|
-
const config = loadProjectConfig(currentRoot);
|
|
150
|
-
targetDescription = `${config.name} (${config.id})`;
|
|
151
|
-
} catch {
|
|
152
|
-
targetDescription = currentRoot;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
try {
|
|
158
|
-
const server = startMcpHttpServer({
|
|
159
|
-
port,
|
|
160
|
-
host,
|
|
161
|
-
token,
|
|
162
|
-
allowInsecureNoAuth,
|
|
163
|
-
corsOrigins,
|
|
164
|
-
maxBodyBytes,
|
|
165
|
-
projectRoots,
|
|
166
|
-
packageIds,
|
|
167
|
-
all,
|
|
168
|
-
timeoutMs,
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
console.log(`\n======================================================`);
|
|
172
|
-
console.log(` ActionDock 2.0 MCP HTTP Server`);
|
|
173
|
-
console.log(`======================================================`);
|
|
174
|
-
console.log(` * Listening on: http://${host}:${server.port}`);
|
|
175
|
-
console.log(` * MCP Endpoint: http://${host === "0.0.0.0" ? "127.0.0.1" : host}:${server.port}/mcp`);
|
|
176
|
-
console.log(` * Target: ${targetDescription}`);
|
|
177
|
-
console.log(` * Authentication: ${token ? "Bearer Token Enabled" : "Disabled (Local)"}`);
|
|
178
|
-
console.log(` * CORS Origins: ${corsOrigins ? corsOrigins.join(", ") : "Disabled (Default)"}`);
|
|
179
|
-
console.log(`======================================================\n`);
|
|
180
|
-
console.log(`Press Ctrl+C to terminate.\n`);
|
|
181
|
-
|
|
182
|
-
process.on("SIGINT", () => {
|
|
183
|
-
console.log("\nStopping MCP HTTP server...");
|
|
184
|
-
server.stop();
|
|
185
|
-
process.exit(0);
|
|
186
|
-
});
|
|
187
|
-
process.on("SIGTERM", () => {
|
|
188
|
-
server.stop();
|
|
189
|
-
process.exit(0);
|
|
190
|
-
});
|
|
191
|
-
} catch (err: any) {
|
|
192
|
-
throw new ExecutionError(`Failed to start ActionDock MCP HTTP server: ${err.message}`);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}
|