@actiondock/cli 2.15.0 → 2.17.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.
- package/README.md +8 -5
- package/dist/commands/config/delete.js +19 -8
- package/dist/commands/config/env.js +2 -3
- package/dist/commands/config/get.js +17 -10
- package/dist/commands/config/list.js +16 -10
- package/dist/commands/config/schema.js +6 -7
- package/dist/commands/config/set.js +34 -12
- package/dist/commands/describe.js +9 -6
- package/dist/commands/export.js +12 -4
- package/dist/commands/info.js +18 -97
- package/dist/commands/list.js +16 -16
- package/dist/commands/playbook.js +105 -148
- package/dist/commands/run.js +20 -7
- package/dist/commands/serve.js +2 -1
- package/dist/commands/state.js +2 -19
- package/dist/renderers/project.d.ts +0 -4
- package/dist/renderers/project.js +0 -16
- package/dist/renderers/runs.js +3 -0
- package/dist/services/inspect.d.ts +1 -14
- package/dist/services/inspect.js +12 -54
- package/dist/utils/target.d.ts +4 -94
- package/dist/utils/target.js +26 -304
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -77,13 +77,16 @@ ad test
|
|
|
77
77
|
ad mcp
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
- 导出为便携式 Agent Skill
|
|
80
|
+
- 导出为便携式 Agent Skill 资产:
|
|
81
81
|
```bash
|
|
82
|
-
#
|
|
82
|
+
# 默认源码模式浅导出(保留 uses 逻辑契约)
|
|
83
83
|
ad export skill
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
ad export skill --
|
|
85
|
+
# 独立自包含 Node.js 目录型导出(免全局 ad 命令行)
|
|
86
|
+
ad export skill --standalone --vendor-deps
|
|
87
|
+
|
|
88
|
+
# 显式物化外部依赖导出(展开为微型工作区)
|
|
89
|
+
ad export skill --bundle-deps
|
|
87
90
|
```
|
|
88
91
|
|
|
89
92
|
- 构建 Node.js 目录交付产物:
|
|
@@ -188,7 +191,7 @@ $data | ConvertTo-Json -Depth 100 | ad run complex-action --input-file -
|
|
|
188
191
|
| `ad test` | 执行快速单元测试 |
|
|
189
192
|
| `ad build` | 构建 Node.js 目录交付产物(支持 `--vendor-deps` 与 `--archive`) |
|
|
190
193
|
| `ad pack` | 打包为标准 npm tarball(`.tgz`),支持 `--dry-run` |
|
|
191
|
-
| `ad export skill` | 导出 Agent Skill
|
|
194
|
+
| `ad export skill` | 导出 Agent Skill 资产(默认单包源码浅导出,支持 `--standalone` 免全局工具自包含导出与 `--bundle-deps` 物化依赖) |
|
|
192
195
|
| `ad link` / `unlink` | 注册或注销工作区全局路由与符号链接 |
|
|
193
196
|
| `ad profile` | 管理远程执行节点凭证与环境配置 |
|
|
194
197
|
| `ad serve` | 启动远程 HTTP/HTTPS 执行调度微服务(支持 `-P` 包白名单与 `-A` 动作白名单细粒度权限控制,原生支持 `--https` 自签名与生产证书) |
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { loadProjectConfig, } from "@actiondock/core";
|
|
2
|
+
import { resolvePackageRoot, } from "@actiondock/core/registry";
|
|
3
|
+
import { ArgumentError, packageNotFoundError } from "../../errors.js";
|
|
2
4
|
import { writeStdout } from "../../renderer.js";
|
|
3
|
-
import { applyTargetOptions, getEffectiveOptions,
|
|
5
|
+
import { applyTargetOptions, getEffectiveOptions, withService } from "../../utils/index.js";
|
|
4
6
|
/**
|
|
5
7
|
* 注册 config delete 子命令:删除配置项。
|
|
6
8
|
*
|
|
@@ -20,22 +22,31 @@ export function registerConfigDeleteCommand(configCmd, context) {
|
|
|
20
22
|
if (!key) {
|
|
21
23
|
throw new ArgumentError("Configuration key is required");
|
|
22
24
|
}
|
|
23
|
-
const
|
|
25
|
+
const root = resolvePackageRoot(options.package);
|
|
24
26
|
await withService(options, context, async (service, resolved) => {
|
|
25
27
|
if (resolved.type === "remote") {
|
|
26
|
-
await service.management?.config.delete(
|
|
28
|
+
await service.management?.config.delete(options.package || "", key);
|
|
27
29
|
writeStdout(`[OK] Configuration '${key}' deleted from remote server`, context);
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
30
|
-
if (options.global
|
|
32
|
+
if (options.global) {
|
|
31
33
|
await service.management?.config.delete("global", key);
|
|
32
34
|
writeStdout(`[OK] Global configuration '${key}' deleted`, context);
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
if (!root) {
|
|
38
|
+
if (options.package) {
|
|
39
|
+
throw packageNotFoundError(options.package);
|
|
40
|
+
}
|
|
41
|
+
await service.management?.config.delete("global", key);
|
|
42
|
+
writeStdout(`[OK] Global configuration '${key}' deleted`, context);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const projConfig = loadProjectConfig(root);
|
|
46
|
+
await service.management?.config.delete(projConfig.id, key);
|
|
47
|
+
writeStdout(`[OK] Configuration '${key}' deleted for package '${projConfig.id}'`, context);
|
|
37
48
|
},
|
|
38
49
|
// 按实际查询范围打开存储:显式包寻址结果作为本地根目录传递
|
|
39
|
-
{ localRoot:
|
|
50
|
+
{ localRoot: root || undefined });
|
|
40
51
|
});
|
|
41
52
|
}
|
|
@@ -2,7 +2,7 @@ import { resolveEnvValue } from "@actiondock/core";
|
|
|
2
2
|
import { fetchRemoteConfigEnv } from "@actiondock/core/profile";
|
|
3
3
|
import { isSecretConfigKey, } from "@actiondock/core/project";
|
|
4
4
|
import { renderConfigEnv, renderResult } from "../../renderer.js";
|
|
5
|
-
import { applyTargetOptions,
|
|
5
|
+
import { applyTargetOptions, getEffectiveOptions, requirePackageRoot, resolveTargetFromOptions } from "../../utils/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* 注册 config env 子命令:诊断环境变量对声明配置的满足率。
|
|
8
8
|
*
|
|
@@ -18,7 +18,7 @@ export function registerConfigEnvCommand(configCmd, context) {
|
|
|
18
18
|
.action(async (identifier, rawOptions, cmd) => {
|
|
19
19
|
const options = getEffectiveOptions(rawOptions, cmd);
|
|
20
20
|
const targetPkg = identifier || options.package;
|
|
21
|
-
//
|
|
21
|
+
// 远端服务分支直接查询远端配置环境诊断接口
|
|
22
22
|
const target = resolveTargetFromOptions(options, context);
|
|
23
23
|
if (target.type === "remote") {
|
|
24
24
|
const res = await fetchRemoteConfigEnv(target.serverUrl, target.token, targetPkg, {
|
|
@@ -37,7 +37,6 @@ export function registerConfigEnvCommand(configCmd, context) {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
// 本地项目分支
|
|
40
|
-
assertNotCompositeSkill(targetPkg);
|
|
41
40
|
const { root, projConfig } = requirePackageRoot(targetPkg, {
|
|
42
41
|
loadConfig: true,
|
|
43
42
|
hint: "Usage: ad config env [package-id] or cd into a project directory.",
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { fetchRemoteConfig, } from "@actiondock/core/profile";
|
|
2
2
|
import { isSecretConfigKey, maskSecretValue, } from "@actiondock/core/project";
|
|
3
3
|
import { loadProjectConfig, } from "@actiondock/core";
|
|
4
|
-
import {
|
|
4
|
+
import { resolvePackageRoot, } from "@actiondock/core/registry";
|
|
5
|
+
import { ArgumentError, packageNotFoundError } from "../../errors.js";
|
|
5
6
|
import { renderResult } from "../../renderer.js";
|
|
6
7
|
import { resolveMergedConfigEntry } from "../../services/config-merge.js";
|
|
7
|
-
import { applyTargetOptions, getEffectiveOptions,
|
|
8
|
+
import { applyTargetOptions, getEffectiveOptions, resolveTargetFromOptions, withService, } from "../../utils/index.js";
|
|
8
9
|
/**
|
|
9
10
|
* 注册 config get 子命令:查询指定配置键的生效值。
|
|
10
11
|
*
|
|
@@ -26,11 +27,12 @@ export function registerConfigGetCommand(configCmd, context) {
|
|
|
26
27
|
throw new ArgumentError("Configuration key is required");
|
|
27
28
|
}
|
|
28
29
|
const reveal = Boolean(options.reveal || options.showSecrets);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
// 远端服务分支不经过 Target 门面,直接查询远端配置接口
|
|
31
|
+
const target = resolveTargetFromOptions(options, context);
|
|
32
|
+
if (target.type === "remote") {
|
|
33
|
+
const res = await fetchRemoteConfig(target.serverUrl, target.token, options.package, {
|
|
32
34
|
allowInsecureHttp: Boolean(options.allowInsecureHttp),
|
|
33
|
-
insecure:
|
|
35
|
+
insecure: target.insecure,
|
|
34
36
|
});
|
|
35
37
|
const val = res.values?.[key];
|
|
36
38
|
const isSecret = isSecretConfigKey(key, res.declared?.[key]);
|
|
@@ -48,8 +50,13 @@ export function registerConfigGetCommand(configCmd, context) {
|
|
|
48
50
|
});
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
53
|
+
// 本地分支
|
|
54
|
+
const root = resolvePackageRoot(options.package);
|
|
51
55
|
await withService(options, context, async (service) => {
|
|
52
|
-
if (options.global || !
|
|
56
|
+
if (options.global || !root) {
|
|
57
|
+
if (!options.global && options.package && !root) {
|
|
58
|
+
throw packageNotFoundError(options.package);
|
|
59
|
+
}
|
|
53
60
|
const confView = await service.management?.config.get("global", key);
|
|
54
61
|
const val = confView?.value;
|
|
55
62
|
const isSecret = confView?.secret ?? isSecretConfigKey(key);
|
|
@@ -67,10 +74,10 @@ export function registerConfigGetCommand(configCmd, context) {
|
|
|
67
74
|
});
|
|
68
75
|
return;
|
|
69
76
|
}
|
|
70
|
-
const projConfig =
|
|
77
|
+
const projConfig = loadProjectConfig(root);
|
|
71
78
|
const declaredItem = projConfig.config?.[key];
|
|
72
79
|
// 合并优先级链单一事实源:项目包级 > 全局持久化 > 环境变量 > 声明默认值
|
|
73
|
-
const { value: displayValue, source, secret: isSecret } = await resolveMergedConfigEntry(key,
|
|
80
|
+
const { value: displayValue, source, secret: isSecret } = await resolveMergedConfigEntry(key, projConfig.id, declaredItem, service, reveal);
|
|
74
81
|
const payload = {
|
|
75
82
|
key,
|
|
76
83
|
value: displayValue,
|
|
@@ -84,6 +91,6 @@ export function registerConfigGetCommand(configCmd, context) {
|
|
|
84
91
|
});
|
|
85
92
|
},
|
|
86
93
|
// 按实际查询范围打开存储:显式包寻址结果作为本地根目录传递
|
|
87
|
-
{ localRoot:
|
|
94
|
+
{ localRoot: root || undefined });
|
|
88
95
|
});
|
|
89
96
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fetchRemoteConfig, } from "@actiondock/core/profile";
|
|
2
2
|
import { loadProjectConfig, } from "@actiondock/core";
|
|
3
3
|
import { filterWithFallbackInfo, isSecretConfigKey, maskSecretValue, } from "@actiondock/core/project";
|
|
4
|
+
import { packageNotFoundError } from "../../errors.js";
|
|
4
5
|
import { renderConfigList, renderResult } from "../../renderer.js";
|
|
5
6
|
import { buildMergedConfigEntries } from "../../services/config-merge.js";
|
|
6
|
-
import { applyTargetOptions, getEffectiveOptions, remoteTargetLabel, resolveFallbackStrategy, resolveIntent,
|
|
7
|
+
import { applyTargetOptions, getEffectiveOptions, remoteTargetLabel, resolveFallbackStrategy, resolveIntent, resolveLocalPackageRoot, resolveTargetFromOptions, withService, } from "../../utils/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* 构造单条配置项的展示视图(含掩码决策,reveal 为假且为敏感键时打码)。
|
|
9
10
|
* 掩码决策收敛于命令层,renderer 仅负责值的字符串格式化。
|
|
@@ -41,24 +42,29 @@ export function registerConfigListCommand(configCmd, context) {
|
|
|
41
42
|
const effectiveIntent = resolveIntent(options.intent, patterns);
|
|
42
43
|
const { shouldFallback } = resolveFallbackStrategy(options);
|
|
43
44
|
const reveal = Boolean(options.reveal || options.showSecrets);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
// 远端服务分支不经过 Target 门面,直接查询远端配置接口
|
|
46
|
+
const remoteTargetInfo = resolveTargetFromOptions(options, context);
|
|
47
|
+
if (remoteTargetInfo.type === "remote") {
|
|
48
|
+
const res = await fetchRemoteConfig(remoteTargetInfo.serverUrl, remoteTargetInfo.token, options.package, {
|
|
47
49
|
allowInsecureHttp: Boolean(options.allowInsecureHttp),
|
|
48
|
-
insecure:
|
|
50
|
+
insecure: remoteTargetInfo.insecure,
|
|
49
51
|
});
|
|
50
52
|
const entries = Object.entries(res.values || {}).map(([k, v]) => toDisplayEntry(k, v, "remote", isSecretConfigKey(k, res.declared?.[k]), reveal, res.declared?.[k]?.description || ""));
|
|
51
53
|
renderResult(entries, {
|
|
52
54
|
json: options.json,
|
|
53
|
-
humanFormatter: () => renderConfigList(entries, remoteTargetLabel(
|
|
55
|
+
humanFormatter: () => renderConfigList(entries, remoteTargetLabel(remoteTargetInfo), false, effectiveIntent),
|
|
54
56
|
context,
|
|
55
57
|
});
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
// 本地分支(通过 Service 门面统一访问):显式包寻址结果作为本地根目录传递(仅 local 分支求值)
|
|
59
61
|
await withService(options, context, async (service) => {
|
|
62
|
+
const root = resolveLocalPackageRoot(options.package) || undefined;
|
|
60
63
|
// 全局作用域分支:显式 --global 或无工程回退时仅列举全局配置
|
|
61
|
-
if (options.global || !
|
|
64
|
+
if (options.global || !root) {
|
|
65
|
+
if (!options.global && options.package) {
|
|
66
|
+
throw packageNotFoundError(options.package);
|
|
67
|
+
}
|
|
62
68
|
const all = (await service.management?.config.list("global")) ?? [];
|
|
63
69
|
const entries = all.map((item) => toDisplayEntry(item.key, item.value, "global", item.secret || isSecretConfigKey(item.key), reveal));
|
|
64
70
|
const filterRes = filterWithFallbackInfo(entries, effectiveIntent, [(c) => c.key, (c) => c.value], shouldFallback);
|
|
@@ -69,9 +75,9 @@ export function registerConfigListCommand(configCmd, context) {
|
|
|
69
75
|
});
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
72
|
-
const projConfig =
|
|
78
|
+
const projConfig = loadProjectConfig(root);
|
|
73
79
|
// 跨作用域合并视图单一事实源:项目包级 > 全局持久化 > 环境变量 > 声明默认值
|
|
74
|
-
const merged = await buildMergedConfigEntries(
|
|
80
|
+
const merged = await buildMergedConfigEntries(root, service, reveal);
|
|
75
81
|
const filterRes = filterWithFallbackInfo(merged, effectiveIntent, [(c) => c.key, (c) => c.value, (c) => c.description, (c) => c.source], shouldFallback);
|
|
76
82
|
renderResult(filterRes.items, {
|
|
77
83
|
json: options.json,
|
|
@@ -79,7 +85,7 @@ export function registerConfigListCommand(configCmd, context) {
|
|
|
79
85
|
context,
|
|
80
86
|
});
|
|
81
87
|
}, {
|
|
82
|
-
localRoot:
|
|
88
|
+
localRoot: () => resolveLocalPackageRoot(options.package) || undefined,
|
|
83
89
|
});
|
|
84
90
|
});
|
|
85
91
|
}
|
|
@@ -2,7 +2,7 @@ import { isSecretConfigKey, } from "@actiondock/core/project";
|
|
|
2
2
|
import { notInProjectError } from "../../errors.js";
|
|
3
3
|
import { renderConfigSchema, renderResult } from "../../renderer.js";
|
|
4
4
|
import { buildMergedConfigEntries } from "../../services/config-merge.js";
|
|
5
|
-
import { applyTargetOptions,
|
|
5
|
+
import { applyTargetOptions, getEffectiveOptions, requirePackageRoot, withService } from "../../utils/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* 注册 config schema 子命令:检查声明配置的解析状态。
|
|
8
8
|
*
|
|
@@ -25,18 +25,17 @@ export function registerConfigSchemaCommand(configCmd, context) {
|
|
|
25
25
|
.option("--json", "Output as JSON")
|
|
26
26
|
.action(async (identifier, rawOptions, cmd) => {
|
|
27
27
|
const options = getEffectiveOptions(rawOptions, cmd);
|
|
28
|
-
// 远端目标显式拒绝:schema 状态推导依赖本地工程声明与环境变量解析,
|
|
29
|
-
// 远端作用域无法获得等价视图,静默落到本地会误导调用方
|
|
30
|
-
if (options.profile || options.server) {
|
|
31
|
-
throw notInProjectError("'ad config schema' only supports local projects. Remote targets are not supported for schema inspection.");
|
|
32
|
-
}
|
|
33
28
|
const targetPkg = identifier || options.package;
|
|
34
|
-
assertNotCompositeSkill(targetPkg);
|
|
35
29
|
const { root, projConfig } = requirePackageRoot(targetPkg, {
|
|
36
30
|
loadConfig: true,
|
|
37
31
|
hint: "Usage: ad config schema [package-id] or cd into a project directory.",
|
|
38
32
|
});
|
|
39
33
|
const declared = projConfig.config || {};
|
|
34
|
+
// 远端目标显式拒绝:schema 状态推导依赖本地工程声明与环境变量解析,
|
|
35
|
+
// 远端作用域无法获得等价视图,静默落到本地会误导调用方
|
|
36
|
+
if (options.profile || options.server) {
|
|
37
|
+
throw notInProjectError("'ad config schema' only supports local projects. Remote targets are not supported for schema inspection.");
|
|
38
|
+
}
|
|
40
39
|
// 跨作用域合并视图单一事实源:与 config list 共享同一条优先级链
|
|
41
40
|
await withService(options, context, async (service) => {
|
|
42
41
|
const merged = await buildMergedConfigEntries(root, service, true);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isSecretConfigKey, } from "@actiondock/core/project";
|
|
2
|
-
import {
|
|
2
|
+
import { loadProjectConfig, } from "@actiondock/core";
|
|
3
|
+
import { resolvePackageRoot, } from "@actiondock/core/registry";
|
|
4
|
+
import { ArgumentError, packageNotFoundError } from "../../errors.js";
|
|
3
5
|
import { writeStdout } from "../../renderer.js";
|
|
4
|
-
import { applyTargetOptions, getEffectiveOptions,
|
|
6
|
+
import { applyTargetOptions, getEffectiveOptions, withService } from "../../utils/index.js";
|
|
5
7
|
import { resolveConfigValueInput } from "../../prompt.js";
|
|
6
8
|
/**
|
|
7
9
|
* 注册 config set 子命令:写入配置值(支持标准输入与安全提示)。
|
|
@@ -22,8 +24,22 @@ export function registerConfigSetCommand(configCmd, context) {
|
|
|
22
24
|
if (!key) {
|
|
23
25
|
throw new ArgumentError("Configuration key is required");
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
let root = null;
|
|
28
|
+
let projConfig = null;
|
|
29
|
+
let declaredDef;
|
|
30
|
+
if (!options.global && !options.profile && !options.server) {
|
|
31
|
+
root = resolvePackageRoot(options.package);
|
|
32
|
+
if (root) {
|
|
33
|
+
try {
|
|
34
|
+
projConfig = loadProjectConfig(root);
|
|
35
|
+
declaredDef = projConfig.config?.[key];
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
// 清单损坏时必须让错误可见:静默忽略会导致写入错误的作用域
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
27
43
|
const isSecret = isSecretConfigKey(key, declaredDef);
|
|
28
44
|
let effectiveValueStr = rawVal;
|
|
29
45
|
if (effectiveValueStr === undefined || options.stdin) {
|
|
@@ -44,21 +60,27 @@ export function registerConfigSetCommand(configCmd, context) {
|
|
|
44
60
|
// 目标解析与写入(远端分支直接写远端作用域,本地分支按全局/项目作用域写入)
|
|
45
61
|
await withService(options, context, async (service, resolved) => {
|
|
46
62
|
if (resolved.type === "remote") {
|
|
47
|
-
await service.management?.config.set(
|
|
63
|
+
await service.management?.config.set(options.package || "", key, parsedVal);
|
|
48
64
|
writeStdout(`[OK] Configuration '${key}' updated on remote server`, context);
|
|
49
65
|
return;
|
|
50
66
|
}
|
|
51
|
-
if (options.global
|
|
67
|
+
if (options.global) {
|
|
68
|
+
await service.management?.config.set("global", key, parsedVal);
|
|
69
|
+
writeStdout(`[OK] Global configuration '${key}' updated`, context);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!root) {
|
|
73
|
+
if (options.package) {
|
|
74
|
+
throw packageNotFoundError(options.package);
|
|
75
|
+
}
|
|
52
76
|
await service.management?.config.set("global", key, parsedVal);
|
|
53
|
-
writeStdout(
|
|
54
|
-
? `[OK] Global configuration '${key}' updated (no project in current directory)`
|
|
55
|
-
: `[OK] Global configuration '${key}' updated`, context);
|
|
77
|
+
writeStdout(`[OK] Global configuration '${key}' updated (no project in current directory)`, context);
|
|
56
78
|
return;
|
|
57
79
|
}
|
|
58
|
-
await service.management?.config.set(
|
|
59
|
-
writeStdout(`[OK] Configuration '${key}' updated for package '${
|
|
80
|
+
await service.management?.config.set(projConfig.id, key, parsedVal);
|
|
81
|
+
writeStdout(`[OK] Configuration '${key}' updated for package '${projConfig.id}'`, context);
|
|
60
82
|
},
|
|
61
83
|
// 按实际查询范围打开存储:显式包寻址结果作为本地根目录传递
|
|
62
|
-
{ localRoot:
|
|
84
|
+
{ localRoot: root || undefined });
|
|
63
85
|
});
|
|
64
86
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ACTION_NOT_FOUND, PACKAGE_NOT_FOUND, NOT_FOUND, } from "@actiondock/core";
|
|
2
2
|
import { buildActionDescribePayload, } from "@actiondock/core/project";
|
|
3
|
-
import { ArgumentError, ExecutionError } from "../errors.js";
|
|
3
|
+
import { ArgumentError, ExecutionError, packageNotFoundError } from "../errors.js";
|
|
4
4
|
import { formatActionDetail, renderResult } from "../renderer.js";
|
|
5
|
-
import { applyTargetOptions, getEffectiveOptions,
|
|
5
|
+
import { applyTargetOptions, getEffectiveOptions, resolveLocalPackageRoot, withService, } from "../utils/index.js";
|
|
6
6
|
/**
|
|
7
7
|
* 挂载 describe 子命令至指定 Commander 节点。
|
|
8
8
|
*
|
|
@@ -22,9 +22,12 @@ export function attachDescribeCommand(parent, context) {
|
|
|
22
22
|
if (!id) {
|
|
23
23
|
throw new ArgumentError("Action ID is required for describe");
|
|
24
24
|
}
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
// 目标拓扑解析(仅 local 分支需要包寻址)
|
|
26
|
+
const targetPackageRoot = resolveLocalPackageRoot(options.package);
|
|
27
|
+
if (options.package && !targetPackageRoot) {
|
|
28
|
+
throw packageNotFoundError(options.package);
|
|
29
|
+
}
|
|
30
|
+
const targetRef = id;
|
|
28
31
|
// 通过 Service 门面统一查询 Action 规范
|
|
29
32
|
await withService(options, context, async (service) => {
|
|
30
33
|
let spec;
|
|
@@ -47,7 +50,7 @@ export function attachDescribeCommand(parent, context) {
|
|
|
47
50
|
humanFormatter: () => formatActionDetail(payload),
|
|
48
51
|
context,
|
|
49
52
|
});
|
|
50
|
-
}, { localRoot:
|
|
53
|
+
}, { localRoot: targetPackageRoot || undefined, scanLinkedPackages: true });
|
|
51
54
|
});
|
|
52
55
|
}
|
|
53
56
|
/**
|
package/dist/commands/export.js
CHANGED
|
@@ -17,6 +17,8 @@ export function registerExportCommand(program, context) {
|
|
|
17
17
|
.option("--all", "Export all linked packages from global registry")
|
|
18
18
|
.option("--bundle [name]", "Export multiple packages as a unified composite Skill bundle (defaults to workspace directory name if omitted)")
|
|
19
19
|
.option("-m, --mode <mode>", "Skill export mode ('source' or 'node')", "source")
|
|
20
|
+
.option("--bundle-deps", "Materialize and bundle external package dependencies into the exported skill")
|
|
21
|
+
.option("--standalone", "Export self-contained Node.js directory that does not require global ad CLI (alias for --mode node)")
|
|
20
22
|
.option("-o, --out <path>", "Output skill directory")
|
|
21
23
|
.option("-p, --playbook <playbooks...>", "Only export specific playbook(s) and their dependent actions", parseListOption)
|
|
22
24
|
.option("-a, --actions <actions...>", "Only export specific action(s)", parseListOption)
|
|
@@ -29,8 +31,8 @@ export function registerExportCommand(program, context) {
|
|
|
29
31
|
.option("--require-reproducible", "Require reproducible build and fail if install scripts must run")
|
|
30
32
|
.action(async (rawOptions, cmd) => {
|
|
31
33
|
const options = getEffectiveOptions(rawOptions, cmd);
|
|
32
|
-
const mode = options.mode === "node" ? "node" : "source";
|
|
33
|
-
if (options.bundle && mode === "node") {
|
|
34
|
+
const mode = options.standalone || options.mode === "node" ? "node" : "source";
|
|
35
|
+
if (options.bundle !== undefined && (options.standalone || mode === "node")) {
|
|
34
36
|
throw new ExecutionError("Composite Skill export (--bundle) currently only supports source mode. Please use '--mode source' to export as a composite workspace Skill.");
|
|
35
37
|
}
|
|
36
38
|
if (options.skillMdOnly && options.bundle === undefined) {
|
|
@@ -78,8 +80,8 @@ export function registerExportCommand(program, context) {
|
|
|
78
80
|
throw notInProjectError("Please specify -P, --package <id>, --workspace, --all, or cd into a project directory.");
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
|
-
if (roots.length > 1 && (options.actions || options.playbook)) {
|
|
82
|
-
throw new ExecutionError("Filtering options (--actions, --playbook)
|
|
83
|
+
if ((roots.length > 1 || options.bundle !== undefined) && (options.actions || options.playbook)) {
|
|
84
|
+
throw new ExecutionError("Filtering options (--actions, --playbook) cannot be combined with composite bundle export (--bundle) or multiple packages.");
|
|
83
85
|
}
|
|
84
86
|
const isMachine = Boolean(options.json);
|
|
85
87
|
try {
|
|
@@ -100,6 +102,8 @@ export function registerExportCommand(program, context) {
|
|
|
100
102
|
skillMdPath: options.skillMd,
|
|
101
103
|
customMdPath: options.customMd,
|
|
102
104
|
skillMdOnly: options.skillMdOnly,
|
|
105
|
+
bundleDeps: Boolean(options.bundleDeps),
|
|
106
|
+
standalone: Boolean(options.standalone),
|
|
103
107
|
});
|
|
104
108
|
renderResult(result, {
|
|
105
109
|
json: isMachine,
|
|
@@ -148,6 +152,8 @@ export function registerExportCommand(program, context) {
|
|
|
148
152
|
vendorDeps: options.vendorDeps,
|
|
149
153
|
allowInstallScripts: options.allowInstallScripts,
|
|
150
154
|
requireReproducible: options.requireReproducible,
|
|
155
|
+
bundleDeps: Boolean(options.bundleDeps),
|
|
156
|
+
standalone: Boolean(options.standalone),
|
|
151
157
|
});
|
|
152
158
|
results.push(res);
|
|
153
159
|
}
|
|
@@ -190,6 +196,8 @@ export function registerExportCommand(program, context) {
|
|
|
190
196
|
vendorDeps: options.vendorDeps,
|
|
191
197
|
allowInstallScripts: options.allowInstallScripts,
|
|
192
198
|
requireReproducible: options.requireReproducible,
|
|
199
|
+
bundleDeps: Boolean(options.bundleDeps),
|
|
200
|
+
standalone: Boolean(options.standalone),
|
|
193
201
|
});
|
|
194
202
|
renderResult(result, {
|
|
195
203
|
json: isMachine,
|
package/dist/commands/info.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { isExplicitPath, } from "@actiondock/core";
|
|
2
|
-
import { filterWithFallbackInfo, } from "@actiondock/core/project";
|
|
3
1
|
import { fetchRemoteInfo, } from "@actiondock/core/profile";
|
|
2
|
+
import { filterWithFallbackInfo, } from "@actiondock/core/project";
|
|
4
3
|
import { getRegistryStatus, resolvePackageRoot, } from "@actiondock/core/registry";
|
|
5
|
-
import {
|
|
6
|
-
import { projectDetailToJson, renderAggregatedPackages,
|
|
7
|
-
import {
|
|
8
|
-
import { applyTargetOptions, getEffectiveOptions,
|
|
4
|
+
import { ExecutionError, NO_PROJECT_NO_LINKED_MESSAGE, packageNotFoundError } from "../errors.js";
|
|
5
|
+
import { projectDetailToJson, renderAggregatedPackages, renderProjectDetail, renderRegistryTree, renderResult, } from "../renderer.js";
|
|
6
|
+
import { getProjectDetailInfo, scanLocalAggregatedPackages } from "../services/index.js";
|
|
7
|
+
import { applyTargetOptions, getEffectiveOptions, resolveFallbackStrategy, resolveIntent, resolveTargetFromOptions, } from "../utils/index.js";
|
|
9
8
|
/**
|
|
10
9
|
* 将远端信息响应归一为本地工程详情视图。
|
|
11
10
|
*/
|
|
@@ -52,49 +51,9 @@ function remoteInfoToDetail(remoteInfo) {
|
|
|
52
51
|
* 渲染工程详情输出(机器模式输出视图转换结果,人类模式渲染详情)。
|
|
53
52
|
*/
|
|
54
53
|
function renderProjectDetailOutput(detail, options) {
|
|
55
|
-
|
|
56
|
-
if (matchedCount === 0 && !isFallback) {
|
|
57
|
-
if (options.isMachine) {
|
|
58
|
-
renderResult({ root: detail.projectRoot, packages: [], matchedCount: 0, isFallback: false }, options);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
throw new ExecutionError(`No packages matched intent '${options.effectiveIntent}'`);
|
|
62
|
-
}
|
|
63
|
-
renderResult({
|
|
64
|
-
...projectDetailToJson(detail),
|
|
65
|
-
...(options.effectiveIntent ? { matchedCount, isFallback } : {}),
|
|
66
|
-
}, {
|
|
67
|
-
json: options.json,
|
|
68
|
-
humanFormatter: () => (isFallback ? `(No packages matched intent '${options.effectiveIntent}', showing selected package)\n\n` : "") +
|
|
69
|
-
renderProjectDetail(detail),
|
|
70
|
-
context: options.context,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* 渲染复合技能整体输出(机器模式输出聚合结构,人类模式渲染各子包卡片)。
|
|
75
|
-
*/
|
|
76
|
-
function renderCompositeSkillOutput(root, details, options) {
|
|
77
|
-
const outOpts = { json: options.json, context: options.context };
|
|
78
|
-
const { items: filteredDetails, isFallback, matchedCount } = filterProjectDetails(details, options.effectiveIntent, Boolean(options.shouldFallback));
|
|
79
|
-
if (options.effectiveIntent && matchedCount === 0 && !isFallback) {
|
|
80
|
-
if (options.isMachine) {
|
|
81
|
-
renderResult({ root, packages: [], matchedCount: 0, isFallback: false }, outOpts);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
throw new ExecutionError(`No packages matched intent '${options.effectiveIntent}' in skill directory`);
|
|
85
|
-
}
|
|
86
|
-
if (options.isMachine) {
|
|
87
|
-
const machineResult = {
|
|
88
|
-
root,
|
|
89
|
-
packages: filteredDetails.map(projectDetailToJson),
|
|
90
|
-
...(options.effectiveIntent ? { matchedCount, isFallback } : {}),
|
|
91
|
-
};
|
|
92
|
-
renderResult(machineResult, outOpts);
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
renderResult(filteredDetails, {
|
|
54
|
+
renderResult(projectDetailToJson(detail), {
|
|
96
55
|
json: options.json,
|
|
97
|
-
humanFormatter: () =>
|
|
56
|
+
humanFormatter: () => renderProjectDetail(detail),
|
|
98
57
|
context: options.context,
|
|
99
58
|
});
|
|
100
59
|
}
|
|
@@ -118,25 +77,18 @@ export function registerInfoCommand(program, context) {
|
|
|
118
77
|
.option("--data-dir <path>", "Custom database storage directory")
|
|
119
78
|
.action(async (patterns = [], rawOptions, cmd) => {
|
|
120
79
|
const options = getEffectiveOptions(rawOptions, cmd);
|
|
121
|
-
// 唯一显式路径位置参数属于寻址目标,必须先于远端与树状图分支裁决。
|
|
122
|
-
if (!options.package && !options.intent && patterns.length === 1 && isExplicitPath(patterns[0])) {
|
|
123
|
-
options.package = patterns[0];
|
|
124
|
-
patterns = [];
|
|
125
|
-
}
|
|
126
80
|
const effectiveIntent = resolveIntent(options.intent, patterns);
|
|
127
81
|
const { isMachine, shouldFallback } = resolveFallbackStrategy(options);
|
|
128
82
|
const outOpts = { json: options.json, context };
|
|
129
|
-
const detailOpts = { ...outOpts, effectiveIntent, shouldFallback, isMachine };
|
|
130
|
-
// info 仅查询单包清单,复合目录仍保留封闭集合校验。
|
|
131
|
-
const target = resolveCommandTarget(options, context, { metadataOnly: true });
|
|
132
83
|
// 远端服务目标分支
|
|
133
|
-
|
|
134
|
-
|
|
84
|
+
const target = resolveTargetFromOptions(options, context);
|
|
85
|
+
if (target.type === "remote") {
|
|
86
|
+
const remoteInfo = await fetchRemoteInfo(target.serverUrl, target.token, {
|
|
135
87
|
intent: effectiveIntent,
|
|
136
88
|
package: options.package,
|
|
137
89
|
tree: Boolean(options.tree),
|
|
138
90
|
allowInsecureHttp: Boolean(options.allowInsecureHttp),
|
|
139
|
-
insecure: target.
|
|
91
|
+
insecure: target.insecure,
|
|
140
92
|
});
|
|
141
93
|
if (isMachine) {
|
|
142
94
|
renderResult(remoteInfo, outOpts);
|
|
@@ -164,11 +116,8 @@ export function registerInfoCommand(program, context) {
|
|
|
164
116
|
});
|
|
165
117
|
return;
|
|
166
118
|
}
|
|
167
|
-
//
|
|
119
|
+
// 本地注册表树状图分支
|
|
168
120
|
if (options.tree) {
|
|
169
|
-
if (options.package || target.localSkill) {
|
|
170
|
-
throw new ArgumentError("Tree view (--tree) is not supported with explicit skill directories or packages; use 'ad info -P <path>' without --tree.");
|
|
171
|
-
}
|
|
172
121
|
const status = getRegistryStatus(context?.customHome);
|
|
173
122
|
renderResult(status, {
|
|
174
123
|
json: options.json,
|
|
@@ -177,30 +126,12 @@ export function registerInfoCommand(program, context) {
|
|
|
177
126
|
});
|
|
178
127
|
return;
|
|
179
128
|
}
|
|
180
|
-
//
|
|
181
|
-
if (target.localSkill?.type === "composite") {
|
|
182
|
-
const details = await buildCompositeDetails(target.localSkill);
|
|
183
|
-
renderCompositeSkillOutput(target.localSkill.root, details, {
|
|
184
|
-
json: options.json,
|
|
185
|
-
context,
|
|
186
|
-
effectiveIntent,
|
|
187
|
-
shouldFallback,
|
|
188
|
-
isMachine,
|
|
189
|
-
});
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
// 显式单包技能分支
|
|
193
|
-
if (target.localSkill?.type === "single") {
|
|
194
|
-
const pkg = target.localSkill.packages[0];
|
|
195
|
-
const detail = await getProjectDetailInfo(pkg.packageRoot);
|
|
196
|
-
renderProjectDetailOutput(detail, detailOpts);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
// 显式指定 Package 参数分支(普通包 ID 或路径)
|
|
129
|
+
// 显式指定 Package 参数分支
|
|
200
130
|
if (options.package) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
131
|
+
const directRoot = resolvePackageRoot(options.package);
|
|
132
|
+
if (directRoot) {
|
|
133
|
+
const detail = await getProjectDetailInfo(directRoot);
|
|
134
|
+
renderProjectDetailOutput(detail, outOpts);
|
|
204
135
|
return;
|
|
205
136
|
}
|
|
206
137
|
throw packageNotFoundError(options.package);
|
|
@@ -232,18 +163,8 @@ export function registerInfoCommand(program, context) {
|
|
|
232
163
|
}
|
|
233
164
|
// 有关键字过滤场景:单一位置参数且非显式 --intent 时优先尝试包寻址
|
|
234
165
|
if (patterns.length === 1 && !options.intent) {
|
|
235
|
-
const directRoot = resolvePackageRoot(patterns[0]
|
|
166
|
+
const directRoot = resolvePackageRoot(patterns[0]);
|
|
236
167
|
if (directRoot) {
|
|
237
|
-
const directTarget = resolveCommandTarget({ ...options, package: directRoot }, context, { metadataOnly: true });
|
|
238
|
-
if (directTarget.localSkill?.type === "composite") {
|
|
239
|
-
const details = await buildCompositeDetails(directTarget.localSkill);
|
|
240
|
-
renderCompositeSkillOutput(directTarget.localSkill.root, details, {
|
|
241
|
-
...outOpts,
|
|
242
|
-
shouldFallback,
|
|
243
|
-
isMachine,
|
|
244
|
-
});
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
168
|
const detail = await getProjectDetailInfo(directRoot);
|
|
248
169
|
renderProjectDetailOutput(detail, outOpts);
|
|
249
170
|
return;
|