@actiondock/cli 2.3.0 → 2.4.0

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,7 +1,14 @@
1
1
  import type { Command } from "commander";
2
2
  import type { CliContext } from "../../types.js";
3
3
  /**
4
- * 注册 action 命令组(action create, action new)。
4
+ * 解析用户通过命令行传入的字段定义字符串(如 name:string, count?:number)。
5
+ */
6
+ export declare function parseSchemaFields(rawFields?: string[] | string): {
7
+ properties: Record<string, any>;
8
+ required: string[];
9
+ } | null;
10
+ /**
11
+ * 注册 action 命令组(action create, action list, action describe, action run, action validate)。
5
12
  *
6
13
  * @param program Commander 根程序对象
7
14
  * @param context 命令行上下文
@@ -1,10 +1,68 @@
1
1
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
2
- import { isAbsolute, join, resolve } from "node:path";
3
- import { assertPathWithinRoot, checkGeneratedTypes, findProjectRoot, getPackageSlug, loadManifest, loadProjectConfig, saveManifest, writeActionTypes, } from "@actiondock/core";
2
+ import { dirname, isAbsolute, join, relative, resolve } from "node:path";
3
+ import { assertPathWithinRoot, findProjectRoot, getPackageSlug, loadManifest, loadProjectConfig, saveManifest, writeActionTypes, } from "@actiondock/core";
4
4
  import { ExecutionError } from "../../errors.js";
5
5
  import { writeStdout } from "../../renderer.js";
6
+ import { attachDescribeCommand } from "../describe.js";
7
+ import { attachListCommand } from "../list.js";
8
+ import { attachRunCommand } from "../run.js";
9
+ import { attachValidateCommand } from "../validate.js";
6
10
  /**
7
- * 注册 action 命令组(action create, action new)。
11
+ * 解析用户通过命令行传入的字段定义字符串(如 name:string, count?:number)。
12
+ */
13
+ export function parseSchemaFields(rawFields) {
14
+ if (!rawFields)
15
+ return null;
16
+ const items = Array.isArray(rawFields) ? rawFields : [rawFields];
17
+ const tokens = items
18
+ .flatMap((item) => item.split(/[, ]+/))
19
+ .map((t) => t.trim())
20
+ .filter(Boolean);
21
+ if (tokens.length === 0)
22
+ return null;
23
+ const properties = {};
24
+ const required = [];
25
+ for (const token of tokens) {
26
+ const colonIdx = token.indexOf(":");
27
+ let rawKey = colonIdx > -1 ? token.slice(0, colonIdx).trim() : token.trim();
28
+ const rawType = colonIdx > -1 ? token.slice(colonIdx + 1).trim().toLowerCase() : "string";
29
+ let isOptional = false;
30
+ if (rawKey.endsWith("?")) {
31
+ isOptional = true;
32
+ rawKey = rawKey.slice(0, -1).trim();
33
+ }
34
+ if (!rawKey)
35
+ continue;
36
+ let schemaType = "string";
37
+ const extraProps = {};
38
+ if (rawType === "number" || rawType === "int" || rawType === "integer") {
39
+ schemaType = "number";
40
+ }
41
+ else if (rawType === "boolean" || rawType === "bool") {
42
+ schemaType = "boolean";
43
+ }
44
+ else if (rawType === "array" || rawType === "list") {
45
+ schemaType = "array";
46
+ extraProps.items = { type: "string" };
47
+ }
48
+ else if (rawType === "object" || rawType === "json") {
49
+ schemaType = "object";
50
+ }
51
+ else {
52
+ schemaType = "string";
53
+ }
54
+ properties[rawKey] = {
55
+ type: schemaType,
56
+ ...extraProps,
57
+ };
58
+ if (!isOptional) {
59
+ required.push(rawKey);
60
+ }
61
+ }
62
+ return { properties, required };
63
+ }
64
+ /**
65
+ * 注册 action 命令组(action create, action list, action describe, action run, action validate)。
8
66
  *
9
67
  * @param program Commander 根程序对象
10
68
  * @param context 命令行上下文
@@ -12,16 +70,21 @@ import { writeStdout } from "../../renderer.js";
12
70
  export function registerActionCommands(program, context) {
13
71
  const actionCmd = program
14
72
  .command("action")
15
- .description("Manage Action definitions (create, scaffold)");
73
+ .description("Manage Action definitions and lifecycle (create, list, describe, run, validate)");
16
74
  actionCmd
17
75
  .command("create <id>")
18
- .alias("new")
19
76
  .description("Scaffold a new Action definition file")
20
77
  .option("-d, --desc <description>", "Action description")
21
78
  .option("-f, --file <filePath>", "Target file path relative to actions dir")
79
+ .option("-i, --input <fields...>", "Input schema fields (e.g. name:string, count?:number)")
80
+ .option("-o, --output <fields...>", "Output schema fields (e.g. message:string, success:boolean)")
22
81
  .action(async (id, options) => {
23
82
  await handleActionCreate(id, options, context);
24
83
  });
84
+ attachListCommand(actionCmd, context);
85
+ attachDescribeCommand(actionCmd, context);
86
+ attachRunCommand(actionCmd, context);
87
+ attachValidateCommand(actionCmd, context);
25
88
  }
26
89
  export async function handleActionCreate(id, options, context) {
27
90
  const root = findProjectRoot();
@@ -44,29 +107,79 @@ export async function handleActionCreate(id, options, context) {
44
107
  if (existsSync(targetFullFile)) {
45
108
  throw new ExecutionError(`Target action file already exists at ${targetFullFile}`);
46
109
  }
110
+ const targetDir = dirname(targetFullFile);
111
+ if (!existsSync(targetDir)) {
112
+ mkdirSync(targetDir, { recursive: true });
113
+ }
114
+ const generatedTypesTarget = resolve(root, ".actiondock", "generated", "actions");
115
+ let typesImportPath = relative(targetDir, generatedTypesTarget).replace(/\\/g, "/");
116
+ if (!typesImportPath.startsWith("./") && !typesImportPath.startsWith("../")) {
117
+ typesImportPath = `./${typesImportPath}`;
118
+ }
119
+ const parsedInput = parseSchemaFields(options.input);
120
+ const parsedOutput = parseSchemaFields(options.output);
121
+ const inputSchema = parsedInput
122
+ ? {
123
+ type: "object",
124
+ properties: parsedInput.properties,
125
+ required: parsedInput.required,
126
+ }
127
+ : {
128
+ type: "object",
129
+ properties: {
130
+ exampleParam: {
131
+ type: "string",
132
+ description: "Example parameter description",
133
+ },
134
+ },
135
+ required: [],
136
+ };
137
+ const outputSchema = parsedOutput
138
+ ? {
139
+ type: "object",
140
+ properties: parsedOutput.properties,
141
+ required: parsedOutput.required,
142
+ }
143
+ : {
144
+ type: "object",
145
+ properties: {
146
+ success: { type: "boolean" },
147
+ },
148
+ required: ["success"],
149
+ };
150
+ // 纯粹根据 outputSchema 的字段类型生成中性占位值,杜绝业务语义假设与虚假字段访问
151
+ const propEntries = Object.entries(outputSchema.properties || {});
152
+ let returnBody;
153
+ if (propEntries.length === 0) {
154
+ returnBody = " return {};";
155
+ }
156
+ else {
157
+ const returnLines = propEntries.map(([k, prop]) => {
158
+ const safeKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(k) ? k : JSON.stringify(k);
159
+ let defaultVal = '"done"';
160
+ if (prop.type === "number" || prop.type === "integer")
161
+ defaultVal = "0";
162
+ else if (prop.type === "boolean")
163
+ defaultVal = "true";
164
+ else if (prop.type === "array")
165
+ defaultVal = "[]";
166
+ else if (prop.type === "object")
167
+ defaultVal = "{}";
168
+ return ` ${safeKey}: ${defaultVal},`;
169
+ });
170
+ returnBody = ` return {\n${returnLines.join("\n")}\n };`;
171
+ }
47
172
  const desc = options.desc || `Action ${id}`;
48
173
  const template = `import { defineAction } from "@actiondock/sdk";
174
+ import type { ActionInput, ActionOutput } from "${typesImportPath}";
49
175
 
50
- export interface Input {
51
- exampleParam?: string;
52
- }
53
-
54
- export interface Output {
55
- success: boolean;
56
- result?: unknown;
57
- }
176
+ export type Input = ActionInput<"${id}">;
177
+ export type Output = ActionOutput<"${id}">;
58
178
 
59
179
  export default defineAction<Input, Output>(async (input, ctx) => {
60
180
  ctx.log.info("Running ${id}", input);
61
181
 
62
- // Access config: ctx.config.get("MY_CONFIG")
63
- // Access state: await ctx.state.get("my_key") / await ctx.state.set("my_key", val)
64
- // Call action: await ctx.actions.invoke(otherAction, input)
65
-
66
- return {
67
- success: true,
68
- result: input.exampleParam || "done",
69
- };
182
+ ${returnBody}
70
183
  });
71
184
  `;
72
185
  writeFileSync(targetFullFile, template, "utf-8");
@@ -81,36 +194,35 @@ export default defineAction<Input, Output>(async (input, ctx) => {
81
194
  manifest.actions[id] = {
82
195
  entry: join(config.actionsDir || "actions", targetRelFile).replace(/\\/g, "/"),
83
196
  description: desc,
84
- inputSchema: {
85
- type: "object",
86
- properties: {
87
- exampleParam: {
88
- type: "string",
89
- description: "Example parameter description",
90
- },
91
- },
92
- required: [],
93
- },
94
- outputSchema: {
95
- type: "object",
96
- properties: {
97
- success: { type: "boolean" },
98
- result: {},
99
- },
100
- required: ["success"],
101
- },
197
+ inputSchema,
198
+ outputSchema,
102
199
  uses: [],
103
200
  tags: [],
104
201
  };
105
202
  saveManifest(root, manifest);
106
- // 若当前项目已存在类型生成文件,则同步自动刷新类型声明
107
- const typeCheck = checkGeneratedTypes(root, manifest);
108
- if (typeCheck.exists) {
109
- writeActionTypes(root, manifest);
203
+ // 始终自动生成或更新类型声明文件,确保单一事实源即时生效
204
+ writeActionTypes(root, manifest);
205
+ let sampleInputStr = "{}";
206
+ const inputEntries = Object.entries(inputSchema.properties || {});
207
+ if (inputEntries.length > 0) {
208
+ const sampleObj = {};
209
+ for (const [k, prop] of inputEntries) {
210
+ if (prop.type === "number" || prop.type === "integer")
211
+ sampleObj[k] = 42;
212
+ else if (prop.type === "boolean")
213
+ sampleObj[k] = true;
214
+ else if (prop.type === "array")
215
+ sampleObj[k] = ["item"];
216
+ else if (prop.type === "object")
217
+ sampleObj[k] = {};
218
+ else
219
+ sampleObj[k] = "hello";
220
+ }
221
+ sampleInputStr = JSON.stringify(sampleObj);
110
222
  }
111
223
  writeStdout(`[OK] Created Action '${id}' at ${targetFullFile}`, context);
112
224
  writeStdout(`\nTo run this action:`, context);
113
- writeStdout(` ad run ${id} --input '{"exampleParam": "hello"}'`, context);
225
+ writeStdout(` ad run ${id} --input '${sampleInputStr}'`, context);
114
226
  }
115
227
  catch (err) {
116
228
  if (err instanceof ExecutionError)
@@ -0,0 +1 @@
1
+ export * from "./create.js";
@@ -0,0 +1 @@
1
+ export * from "./create.js";
@@ -1,5 +1,12 @@
1
1
  import { Command } from "commander";
2
2
  import type { CliContext } from "../types.js";
3
+ /**
4
+ * 挂载 describe 子命令至指定 Commander 节点。
5
+ *
6
+ * @param parent 目标 Commander 命令节点
7
+ * @param context 命令行上下文
8
+ */
9
+ export declare function attachDescribeCommand(parent: Command, context?: CliContext): Command;
3
10
  /**
4
11
  * 注册顶层统一 describe 命令:查询指定 Action 的规范结构与模式定义。
5
12
  *
@@ -2,13 +2,13 @@ import { ArgumentError, ExecutionError } from "../errors.js";
2
2
  import { renderActionDetail, renderResult } from "../renderer.js";
3
3
  import { getEffectiveOptions, resolveLocalPackageRoot, withTarget, } from "../utils/index.js";
4
4
  /**
5
- * 注册顶层统一 describe 命令:查询指定 Action 的规范结构与模式定义。
5
+ * 挂载 describe 子命令至指定 Commander 节点。
6
6
  *
7
- * @param program Commander 根程序对象
7
+ * @param parent 目标 Commander 命令节点
8
8
  * @param context 命令行上下文
9
9
  */
10
- export function registerDescribeCommand(program, context) {
11
- program
10
+ export function attachDescribeCommand(parent, context) {
11
+ return parent
12
12
  .command("describe <id>")
13
13
  .alias("show")
14
14
  .description("Show action definition, schema, and description")
@@ -66,3 +66,12 @@ export function registerDescribeCommand(program, context) {
66
66
  }, { localRoot: targetPackageRoot || undefined, scanLinkedPackages: true });
67
67
  });
68
68
  }
69
+ /**
70
+ * 注册顶层统一 describe 命令:查询指定 Action 的规范结构与模式定义。
71
+ *
72
+ * @param program Commander 根程序对象
73
+ * @param context 命令行上下文
74
+ */
75
+ export function registerDescribeCommand(program, context) {
76
+ attachDescribeCommand(program, context);
77
+ }
@@ -1,6 +1,6 @@
1
1
  import { Command } from "commander";
2
2
  import type { CliContext } from "../types.js";
3
- import { registerActionCommands } from "./action/create.js";
3
+ import { registerActionCommands } from "./action/index.js";
4
4
  import { registerAddCommand } from "./add.js";
5
5
  import { registerBuildCommand } from "./build.js";
6
6
  import { registerConfigCommands } from "./config/index.js";
@@ -13,7 +13,6 @@ import { registerInitCommand } from "./init.js";
13
13
  import { registerLinkCommands } from "./link.js";
14
14
  import { registerListCommand } from "./list.js";
15
15
  import { registerMcpCommands } from "./mcp.js";
16
- import { registerNewCommands } from "./new.js";
17
16
  import { registerPackCommand } from "./pack.js";
18
17
  import { registerPlaybookCommands } from "./playbook.js";
19
18
  import { registerProfileCommands } from "./profile.js";
@@ -29,4 +28,4 @@ import { registerValidateCommand } from "./validate.js";
29
28
  */
30
29
  export declare const CLI_VERSION: string;
31
30
  export declare function createCliProgram(context?: CliContext): Command;
32
- export { registerActionCommands, registerAddCommand, registerBuildCommand, registerConfigCommands, registerDescribeCommand, registerDoctorCommand, registerExportCommand, registerGenerateCommands, registerInfoCommand, registerInitCommand, registerLinkCommands, registerListCommand, registerMcpCommands, registerNewCommands, registerPackCommand, registerPlaybookCommands, registerProfileCommands, registerRemoveCommand, registerRunCommand, registerRunsCommands, registerServeCommand, registerStateCommands, registerTestCommand, registerValidateCommand, };
31
+ export { registerActionCommands, registerAddCommand, registerBuildCommand, registerConfigCommands, registerDescribeCommand, registerDoctorCommand, registerExportCommand, registerGenerateCommands, registerInfoCommand, registerInitCommand, registerLinkCommands, registerListCommand, registerMcpCommands, registerPackCommand, registerPlaybookCommands, registerProfileCommands, registerRemoveCommand, registerRunCommand, registerRunsCommands, registerServeCommand, registerStateCommands, registerTestCommand, registerValidateCommand, };
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { Command } from "commander";
4
- import { registerActionCommands } from "./action/create.js";
4
+ import { registerActionCommands } from "./action/index.js";
5
5
  import { registerAddCommand } from "./add.js";
6
6
  import { registerBuildCommand } from "./build.js";
7
7
  import { registerConfigCommands } from "./config/index.js";
@@ -14,7 +14,6 @@ import { registerInitCommand } from "./init.js";
14
14
  import { registerLinkCommands } from "./link.js";
15
15
  import { registerListCommand } from "./list.js";
16
16
  import { registerMcpCommands } from "./mcp.js";
17
- import { registerNewCommands } from "./new.js";
18
17
  import { registerPackCommand } from "./pack.js";
19
18
  import { registerPlaybookCommands } from "./playbook.js";
20
19
  import { registerProfileCommands } from "./profile.js";
@@ -84,7 +83,6 @@ export function createCliProgram(context) {
84
83
  registerInitCommand(program);
85
84
  registerAddCommand(program, context);
86
85
  registerRemoveCommand(program, context);
87
- registerNewCommands(program, context);
88
86
  registerActionCommands(program, context);
89
87
  registerInfoCommand(program, context);
90
88
  registerDoctorCommand(program, context);
@@ -108,4 +106,4 @@ export function createCliProgram(context) {
108
106
  applyCommonOptions(program);
109
107
  return program;
110
108
  }
111
- export { registerActionCommands, registerAddCommand, registerBuildCommand, registerConfigCommands, registerDescribeCommand, registerDoctorCommand, registerExportCommand, registerGenerateCommands, registerInfoCommand, registerInitCommand, registerLinkCommands, registerListCommand, registerMcpCommands, registerNewCommands, registerPackCommand, registerPlaybookCommands, registerProfileCommands, registerRemoveCommand, registerRunCommand, registerRunsCommands, registerServeCommand, registerStateCommands, registerTestCommand, registerValidateCommand, };
109
+ export { registerActionCommands, registerAddCommand, registerBuildCommand, registerConfigCommands, registerDescribeCommand, registerDoctorCommand, registerExportCommand, registerGenerateCommands, registerInfoCommand, registerInitCommand, registerLinkCommands, registerListCommand, registerMcpCommands, registerPackCommand, registerPlaybookCommands, registerProfileCommands, registerRemoveCommand, registerRunCommand, registerRunsCommands, registerServeCommand, registerStateCommands, registerTestCommand, registerValidateCommand, };
@@ -1,5 +1,12 @@
1
1
  import { Command } from "commander";
2
2
  import type { CliContext } from "../types.js";
3
+ /**
4
+ * 挂载 list 子命令至指定 Commander 节点。
5
+ *
6
+ * @param parent 目标 Commander 命令节点
7
+ * @param context 命令行上下文
8
+ */
9
+ export declare function attachListCommand(parent: Command, context?: CliContext): Command;
3
10
  /**
4
11
  * 注册顶层统一 list 命令:列出当前工程、已链接包或远端服务中的可用 Action。
5
12
  *
@@ -3,13 +3,13 @@ import { ArgumentError } from "../errors.js";
3
3
  import { renderActionList, renderResult } from "../renderer.js";
4
4
  import { getEffectiveOptions, resolveFallbackStrategy, resolveIntent, resolveLocalPackageRoot, withTarget } from "../utils/index.js";
5
5
  /**
6
- * 注册顶层统一 list 命令:列出当前工程、已链接包或远端服务中的可用 Action。
6
+ * 挂载 list 子命令至指定 Commander 节点。
7
7
  *
8
- * @param program Commander 根程序对象
8
+ * @param parent 目标 Commander 命令节点
9
9
  * @param context 命令行上下文
10
10
  */
11
- export function registerListCommand(program, context) {
12
- program
11
+ export function attachListCommand(parent, context) {
12
+ return parent
13
13
  .command("list [patterns...]")
14
14
  .description("List actions in current project, linked packages, or remote profile")
15
15
  .option("-i, --intent <pattern>", "Regex or fuzzy intent filter; falls back to full list when no match")
@@ -75,3 +75,12 @@ export function registerListCommand(program, context) {
75
75
  }, { localRoot: targetPackageRoot || undefined, scanLinkedPackages: true });
76
76
  });
77
77
  }
78
+ /**
79
+ * 注册顶层统一 list 命令:列出当前工程、已链接包或远端服务中的可用 Action。
80
+ *
81
+ * @param program Commander 根程序对象
82
+ * @param context 命令行上下文
83
+ */
84
+ export function registerListCommand(program, context) {
85
+ attachListCommand(program, context);
86
+ }
@@ -361,10 +361,9 @@ export function registerPlaybookCommands(program, context) {
361
361
  return;
362
362
  }
363
363
  });
364
- // playbook create / new
364
+ // playbook create
365
365
  pbCmd
366
366
  .command("create <id>")
367
- .alias("new")
368
367
  .description("Scaffold a new Playbook markdown file")
369
368
  .option("-d, --desc <description>", "Playbook description")
370
369
  .option("-a, --actions <actions...>", "Referenced action IDs")
@@ -4,6 +4,13 @@ import type { CliContext } from "../types.js";
4
4
  * 统一执行 Action 核心逻辑(使用 ActionDockTarget 门面)。
5
5
  */
6
6
  export declare function executeAction(id: string, options: any, context?: CliContext): Promise<void>;
7
+ /**
8
+ * 挂载 run 子命令至指定 Commander 节点。
9
+ *
10
+ * @param parent 目标 Commander 命令节点
11
+ * @param context 命令行上下文
12
+ */
13
+ export declare function attachRunCommand(parent: Command, context?: CliContext): Command;
7
14
  /**
8
15
  * 注册顶层统一 run 命令:执行指定 Action。
9
16
  *
@@ -117,13 +117,13 @@ export async function executeAction(id, options, context) {
117
117
  }
118
118
  }
119
119
  /**
120
- * 注册顶层统一 run 命令:执行指定 Action。
120
+ * 挂载 run 子命令至指定 Commander 节点。
121
121
  *
122
- * @param program Commander 根程序对象
122
+ * @param parent 目标 Commander 命令节点
123
123
  * @param context 命令行上下文
124
124
  */
125
- export function registerRunCommand(program, context) {
126
- program
125
+ export function attachRunCommand(parent, context) {
126
+ return parent
127
127
  .command("run <id>")
128
128
  .description("Execute an action (from current project, linked packages, or remote profile)")
129
129
  .option("-P, --package <id>", "Target package ID or path")
@@ -144,3 +144,12 @@ export function registerRunCommand(program, context) {
144
144
  await executeAction(id, options, context);
145
145
  });
146
146
  }
147
+ /**
148
+ * 注册顶层统一 run 命令:执行指定 Action。
149
+ *
150
+ * @param program Commander 根程序对象
151
+ * @param context 命令行上下文
152
+ */
153
+ export function registerRunCommand(program, context) {
154
+ attachRunCommand(program, context);
155
+ }
@@ -1,5 +1,12 @@
1
1
  import { Command } from "commander";
2
2
  import type { CliContext } from "../types.js";
3
+ /**
4
+ * 挂载 validate 子命令至指定 Commander 节点。
5
+ *
6
+ * @param parent 目标 Commander 命令节点
7
+ * @param context 命令行上下文
8
+ */
9
+ export declare function attachValidateCommand(parent: Command, context?: CliContext): Command;
3
10
  /**
4
11
  * 注册顶层统一 validate 命令:校验 Action 的 Schema 与方法定义完整性。
5
12
  *
@@ -3,13 +3,13 @@ import { ArgumentError, ExecutionError } from "../errors.js";
3
3
  import { renderActionValidation, renderResult } from "../renderer.js";
4
4
  import { getEffectiveOptions } from "../utils/index.js";
5
5
  /**
6
- * 注册顶层统一 validate 命令:校验 Action 的 Schema 与方法定义完整性。
6
+ * 挂载 validate 子命令至指定 Commander 节点。
7
7
  *
8
- * @param program Commander 根程序对象
8
+ * @param parent 目标 Commander 命令节点
9
9
  * @param context 命令行上下文
10
10
  */
11
- export function registerValidateCommand(program, context) {
12
- program
11
+ export function attachValidateCommand(parent, context) {
12
+ return parent
13
13
  .command("validate [id]")
14
14
  .description("Validate action schemas and definitions")
15
15
  .option("-P, --package <id>", "Target package ID or path")
@@ -104,3 +104,12 @@ export function registerValidateCommand(program, context) {
104
104
  }
105
105
  });
106
106
  }
107
+ /**
108
+ * 注册顶层统一 validate 命令:校验 Action 的 Schema 与方法定义完整性。
109
+ *
110
+ * @param program Commander 根程序对象
111
+ * @param context 命令行上下文
112
+ */
113
+ export function registerValidateCommand(program, context) {
114
+ attachValidateCommand(program, context);
115
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/cli",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
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.3.0",
38
- "@actiondock/core": "^2.3.0",
39
- "@actiondock/mcp": "^2.3.0",
40
- "@actiondock/runtime-node": "^2.3.0",
41
- "@actiondock/sdk": "^2.3.0",
37
+ "@actiondock/builder": "^2.4.0",
38
+ "@actiondock/core": "^2.4.0",
39
+ "@actiondock/mcp": "^2.4.0",
40
+ "@actiondock/runtime-node": "^2.4.0",
41
+ "@actiondock/sdk": "^2.4.0",
42
42
  "commander": "^13.1.0"
43
43
  },
44
44
  "devDependencies": {
@@ -1,9 +0,0 @@
1
- import type { Command } from "commander";
2
- import type { CliContext } from "../types.js";
3
- /**
4
- * 注册顶层 new 脚手架命令(new action, new playbook)。
5
- *
6
- * @param program Commander 根程序对象
7
- * @param context 命令行上下文
8
- */
9
- export declare function registerNewCommands(program: Command, context?: CliContext): void;
@@ -1,33 +0,0 @@
1
- import { handleActionCreate } from "./action/create.js";
2
- import { handlePlaybookCreate } from "./playbook.js";
3
- /**
4
- * 注册顶层 new 脚手架命令(new action, new playbook)。
5
- *
6
- * @param program Commander 根程序对象
7
- * @param context 命令行上下文
8
- */
9
- export function registerNewCommands(program, context) {
10
- const newCmd = program
11
- .command("new")
12
- .description("Scaffold a new Action or Playbook in current project");
13
- // new action <id>
14
- newCmd
15
- .command("action <id>")
16
- .alias("create")
17
- .description("Scaffold a new Action definition file")
18
- .option("-d, --desc <description>", "Action description")
19
- .option("-f, --file <filePath>", "Target file path relative to actions dir")
20
- .action(async (id, options) => {
21
- await handleActionCreate(id, options, context);
22
- });
23
- // new playbook <id>
24
- newCmd
25
- .command("playbook <id>")
26
- .description("Scaffold a new Playbook markdown file")
27
- .option("-d, --desc <description>", "Playbook description")
28
- .option("-a, --actions <actions...>", "Referenced action IDs")
29
- .option("-f, --file <filePath>", "Target file path relative to playbooks dir")
30
- .action((id, options) => {
31
- handlePlaybookCreate(id, options, context);
32
- });
33
- }