@actiondock/cli 2.0.10 → 2.0.11
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/dist/index.js +1204 -299
- package/package.json +7 -7
- package/src/commands/export.ts +138 -12
- package/src/commands/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actiondock/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "ActionDock CLI facade for developing, testing, building, and exporting standalone Agent Actions and Skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"build": "bun build ./src/index.ts --outdir ./dist --target bun"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@actiondock/builder": "^2.0.
|
|
32
|
-
"@actiondock/core": "^2.0.
|
|
33
|
-
"@actiondock/mcp": "^2.0.
|
|
34
|
-
"@actiondock/runtime-cli": "^2.0.
|
|
35
|
-
"@actiondock/runtime-node": "^2.0.
|
|
36
|
-
"@actiondock/sdk": "^2.0.
|
|
31
|
+
"@actiondock/builder": "^2.0.11",
|
|
32
|
+
"@actiondock/core": "^2.0.11",
|
|
33
|
+
"@actiondock/mcp": "^2.0.11",
|
|
34
|
+
"@actiondock/runtime-cli": "^2.0.11",
|
|
35
|
+
"@actiondock/runtime-node": "^2.0.11",
|
|
36
|
+
"@actiondock/sdk": "^2.0.11",
|
|
37
37
|
"commander": "^13.1.0",
|
|
38
38
|
"tsx": "^4.19.3"
|
|
39
39
|
},
|
package/src/commands/export.ts
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { exportCompositeSkill, exportSkill, exportSkillBatch } from "@actiondock/builder";
|
|
4
|
+
import { discoverProjects, findProjectRoot, listLinkedPackages, resolvePackageRoot } from "@actiondock/core";
|
|
3
5
|
import { ExecutionError } from "@actiondock/runtime-cli";
|
|
4
6
|
import { Command } from "commander";
|
|
5
7
|
|
|
8
|
+
function parseListOption(val: string, prev: string[] = []): string[] {
|
|
9
|
+
const parts = val.split(",").map((s) => s.trim()).filter(Boolean);
|
|
10
|
+
return [...prev, ...parts];
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
export function registerExportCommand(program: Command): void {
|
|
7
14
|
const exportCmd = program
|
|
8
15
|
.command("export")
|
|
@@ -11,7 +18,18 @@ export function registerExportCommand(program: Command): void {
|
|
|
11
18
|
exportCmd
|
|
12
19
|
.command("skill")
|
|
13
20
|
.description("Export Skill directory for AI Agents (default: source skill; use -s/--standalone for pre-built standalone binary)")
|
|
14
|
-
.option(
|
|
21
|
+
.option(
|
|
22
|
+
"-P, --package <id...>",
|
|
23
|
+
"Target package ID(s) or path(s) (can be specified multiple times or comma-separated)",
|
|
24
|
+
parseListOption,
|
|
25
|
+
[]
|
|
26
|
+
)
|
|
27
|
+
.option("--workspace", "Export all packages discovered in current workspace")
|
|
28
|
+
.option("--all", "Export all linked packages from global registry")
|
|
29
|
+
.option(
|
|
30
|
+
"--bundle [name]",
|
|
31
|
+
"Export multiple packages as a unified composite Skill bundle (defaults to workspace directory name if omitted)"
|
|
32
|
+
)
|
|
15
33
|
.option("-s, --standalone", "Export pre-compiled standalone binary skill (for environments without ActionDock runtime)")
|
|
16
34
|
.option("-t, --target <target>", "Target compilation platform for standalone mode (e.g. host, linux-x64, darwin-arm64, windows-x64)")
|
|
17
35
|
.option("-o, --out <path>", "Output skill directory")
|
|
@@ -22,23 +40,126 @@ export function registerExportCommand(program: Command): void {
|
|
|
22
40
|
.option("--bytecode", "Compile JavaScript to bytecode in standalone mode (default: true)", true)
|
|
23
41
|
.option("--no-bytecode", "Disable bytecode compilation in standalone mode")
|
|
24
42
|
.option("-z, --archive", "Create a .zip archive of the exported skill")
|
|
43
|
+
.option("--skill-md <path>", "Use specified existing SKILL.md file instead of auto-generating")
|
|
25
44
|
.action(async (options) => {
|
|
26
|
-
const
|
|
27
|
-
? resolvePackageRoot(options.package)
|
|
28
|
-
: findProjectRoot();
|
|
45
|
+
const isStandalone = Boolean(options.standalone);
|
|
29
46
|
|
|
30
|
-
if (
|
|
31
|
-
if (options.package) {
|
|
32
|
-
throw new ExecutionError(`Package '${options.package}' not found in linked packages or path`);
|
|
33
|
-
}
|
|
47
|
+
if (options.bundle && isStandalone) {
|
|
34
48
|
throw new ExecutionError(
|
|
35
|
-
"
|
|
49
|
+
"Composite Skill export (--bundle) currently only supports source mode. Please remove --standalone to export as a composite workspace Skill."
|
|
36
50
|
);
|
|
37
51
|
}
|
|
38
52
|
|
|
39
|
-
const
|
|
53
|
+
const sourceCount =
|
|
54
|
+
(options.all ? 1 : 0) +
|
|
55
|
+
(options.workspace ? 1 : 0) +
|
|
56
|
+
(options.package && options.package.length > 0 ? 1 : 0);
|
|
57
|
+
if (sourceCount > 1) {
|
|
58
|
+
throw new ExecutionError(
|
|
59
|
+
"Options -P/--package, --workspace, and --all are mutually exclusive. Please specify only one package selection mode."
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let roots: string[] = [];
|
|
64
|
+
|
|
65
|
+
if (options.all) {
|
|
66
|
+
const linked = listLinkedPackages();
|
|
67
|
+
roots = linked.map((p) => p.path).filter((p) => existsSync(p));
|
|
68
|
+
if (roots.length === 0) {
|
|
69
|
+
throw new ExecutionError("No linked packages found in global registry.");
|
|
70
|
+
}
|
|
71
|
+
} else if (options.workspace) {
|
|
72
|
+
const cwd = process.cwd();
|
|
73
|
+
const discovered = discoverProjects(cwd);
|
|
74
|
+
roots = discovered.length > 0 ? discovered : (findProjectRoot(cwd) ? [findProjectRoot(cwd)!] : []);
|
|
75
|
+
if (roots.length === 0) {
|
|
76
|
+
throw new ExecutionError(
|
|
77
|
+
`No ActionDock packages found in workspace '${cwd}'.\nMake sure child directories contain actiondock.json.`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
} else if (options.package && options.package.length > 0) {
|
|
81
|
+
for (const pkgIdOrPath of options.package) {
|
|
82
|
+
const root = resolvePackageRoot(pkgIdOrPath);
|
|
83
|
+
if (!root) {
|
|
84
|
+
throw new ExecutionError(`Package '${pkgIdOrPath}' not found in linked packages or path`);
|
|
85
|
+
}
|
|
86
|
+
if (!roots.includes(root)) {
|
|
87
|
+
roots.push(root);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
const root = findProjectRoot();
|
|
92
|
+
if (root) {
|
|
93
|
+
roots.push(root);
|
|
94
|
+
} else {
|
|
95
|
+
throw new ExecutionError(
|
|
96
|
+
"Not in an ActionDock project (actiondock.json not found).\nPlease specify -P, --package <id>, --workspace, --all, or cd into a project directory."
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (roots.length > 1 && (options.actions || options.playbook)) {
|
|
102
|
+
throw new ExecutionError(
|
|
103
|
+
"Filtering options (--actions, --playbook) can only be used when exporting a single package."
|
|
104
|
+
);
|
|
105
|
+
}
|
|
40
106
|
|
|
41
107
|
try {
|
|
108
|
+
if (options.bundle !== undefined) {
|
|
109
|
+
const bundleName =
|
|
110
|
+
typeof options.bundle === "string" && options.bundle.trim()
|
|
111
|
+
? options.bundle.trim()
|
|
112
|
+
: basename(process.cwd());
|
|
113
|
+
console.log(`Exporting composite Skill bundle '${bundleName}' (${roots.length} package${roots.length > 1 ? "s" : ""})...`);
|
|
114
|
+
const result = await exportCompositeSkill({
|
|
115
|
+
bundleName,
|
|
116
|
+
projectRoots: roots,
|
|
117
|
+
outDir: options.out,
|
|
118
|
+
archive: options.archive,
|
|
119
|
+
workspaceRoot: options.workspace ? process.cwd() : undefined,
|
|
120
|
+
skillMdPath: options.skillMd,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
console.log(`[OK] Successfully exported Composite Skill: ${result.bundleName}`);
|
|
124
|
+
console.log(` Packages: ${result.packagesCount}`);
|
|
125
|
+
console.log(` Actions: ${result.actionsCount}`);
|
|
126
|
+
console.log(` Playbooks: ${result.playbooksCount}`);
|
|
127
|
+
console.log(` Skill Dir: ${result.skillDir}`);
|
|
128
|
+
if (result.usedExistingSkillMd) {
|
|
129
|
+
console.log(` SKILL.md: Reused existing file from ${result.usedExistingSkillMd}`);
|
|
130
|
+
}
|
|
131
|
+
if (result.archivePath) {
|
|
132
|
+
console.log(` Archive: ${result.archivePath}`);
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (roots.length > 1) {
|
|
138
|
+
console.log(`Batch exporting ${roots.length} Skill packages...`);
|
|
139
|
+
const batchRes = await exportSkillBatch({
|
|
140
|
+
projectRoots: roots,
|
|
141
|
+
mode: isStandalone ? "standalone" : "source",
|
|
142
|
+
standalone: isStandalone,
|
|
143
|
+
target: options.target,
|
|
144
|
+
outDir: options.out,
|
|
145
|
+
archive: options.archive,
|
|
146
|
+
playbooks: options.playbook,
|
|
147
|
+
actions: options.actions,
|
|
148
|
+
minify: options.minify,
|
|
149
|
+
bytecode: options.bytecode,
|
|
150
|
+
skillMdPath: options.skillMd,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
console.log(`[OK] Successfully batch exported ${batchRes.results.length} Skill packages to: ${batchRes.outDir}`);
|
|
154
|
+
for (const res of batchRes.results) {
|
|
155
|
+
console.log(` - ${res.packageId} (v${res.version}): ${res.actionsCount} actions, ${res.playbooksCount} playbooks -> ${res.skillDir}`);
|
|
156
|
+
}
|
|
157
|
+
console.log(` Total Actions: ${batchRes.totalActions}`);
|
|
158
|
+
console.log(` Total Playbooks: ${batchRes.totalPlaybooks}`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const root = roots[0];
|
|
42
163
|
console.log(`Exporting ${isStandalone ? "standalone binary" : "source"} Skill artifact...`);
|
|
43
164
|
const result = await exportSkill({
|
|
44
165
|
projectRoot: root,
|
|
@@ -51,6 +172,7 @@ export function registerExportCommand(program: Command): void {
|
|
|
51
172
|
actions: options.actions,
|
|
52
173
|
minify: options.minify,
|
|
53
174
|
bytecode: options.bytecode,
|
|
175
|
+
skillMdPath: options.skillMd,
|
|
54
176
|
});
|
|
55
177
|
|
|
56
178
|
console.log(`[OK] Successfully exported ${result.mode === "standalone" ? "Standalone" : "Source"} Skill: ${result.packageId} (v${result.version})`);
|
|
@@ -58,6 +180,9 @@ export function registerExportCommand(program: Command): void {
|
|
|
58
180
|
console.log(` Actions: ${result.actionsCount}`);
|
|
59
181
|
console.log(` Playbooks: ${result.playbooksCount}`);
|
|
60
182
|
console.log(` Skill Dir: ${result.skillDir}`);
|
|
183
|
+
if (result.usedExistingSkillMd) {
|
|
184
|
+
console.log(` SKILL.md: Reused existing file from ${result.usedExistingSkillMd}`);
|
|
185
|
+
}
|
|
61
186
|
if (result.archivePath) {
|
|
62
187
|
console.log(` Archive: ${result.archivePath}`);
|
|
63
188
|
}
|
|
@@ -68,3 +193,4 @@ export function registerExportCommand(program: Command): void {
|
|
|
68
193
|
}
|
|
69
194
|
|
|
70
195
|
|
|
196
|
+
|
package/src/commands/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ export function createCliProgram(): Command {
|
|
|
40
40
|
program
|
|
41
41
|
.name("ad")
|
|
42
42
|
.description("ActionDock (ad) 2.0 - Toolchain for building and shipping standalone AI Agent Actions & Skills")
|
|
43
|
-
.version("2.0.
|
|
43
|
+
.version("2.0.11", "-v, --version");
|
|
44
44
|
|
|
45
45
|
program.option("-V", "output the version number");
|
|
46
46
|
program.on("option:V", () => {
|