@actiondock/cli 2.9.1 → 2.11.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 +3 -3
- package/bin/ad.js +225 -5
- package/dist/commands/action/create.d.ts +1 -1
- package/dist/commands/action/create.js +6 -14
- package/dist/commands/add.js +1 -1
- package/dist/commands/config/delete.js +3 -1
- package/dist/commands/config/env.js +2 -1
- package/dist/commands/config/get.js +3 -1
- package/dist/commands/config/list.js +6 -5
- package/dist/commands/config/schema.js +16 -10
- package/dist/commands/config/set.js +3 -1
- package/dist/commands/describe.js +6 -4
- package/dist/commands/export.js +34 -16
- package/dist/commands/index.d.ts +37 -24
- package/dist/commands/index.js +346 -48
- package/dist/commands/info.js +34 -9
- package/dist/commands/list.js +13 -2
- package/dist/commands/mcp.js +0 -1
- package/dist/commands/playbook.js +67 -52
- package/dist/commands/profile.js +2 -1
- package/dist/commands/remove.js +1 -1
- package/dist/commands/run.d.ts +2 -1
- package/dist/commands/run.js +19 -56
- package/dist/commands/runs.d.ts +6 -1
- package/dist/commands/runs.js +274 -11
- package/dist/commands/serve.js +5 -2
- package/dist/commands/state.js +84 -15
- package/dist/errors.d.ts +5 -3
- package/dist/errors.js +23 -7
- package/dist/index.d.ts +10 -2
- package/dist/index.js +15 -12
- package/dist/prompt.d.ts +3 -0
- package/dist/prompt.js +6 -14
- package/dist/renderer.d.ts +8 -151
- package/dist/renderer.js +17 -375
- package/dist/renderers/action.d.ts +51 -0
- package/dist/renderers/action.js +112 -0
- package/dist/renderers/config.d.ts +31 -0
- package/dist/renderers/config.js +93 -0
- package/dist/renderers/playbook.d.ts +19 -0
- package/dist/renderers/playbook.js +42 -0
- package/dist/renderers/project.d.ts +45 -0
- package/dist/renderers/project.js +196 -0
- package/dist/renderers/runs.d.ts +15 -0
- package/dist/renderers/runs.js +47 -0
- package/dist/renderers/state.d.ts +4 -0
- package/dist/renderers/state.js +19 -0
- package/dist/services/config-merge.js +1 -2
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.js +1 -0
- package/dist/services/run-watch.d.ts +156 -0
- package/dist/services/run-watch.js +395 -0
- package/dist/types.d.ts +37 -0
- package/dist/utils/cert.js +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/input.d.ts +2 -1
- package/dist/utils/input.js +2 -1
- package/dist/utils/target.d.ts +6 -2
- package/dist/utils/target.js +4 -4
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +4 -12
- package/dist/utils/warning.d.ts +4 -0
- package/dist/utils/warning.js +4 -0
- package/package.json +5 -5
- package/dist/commands/state-list.d.ts +0 -24
- package/dist/commands/state-list.js +0 -81
- package/dist/standalone/index.d.ts +0 -12
- package/dist/standalone/index.js +0 -13
- package/dist/utils/duration.d.ts +0 -1
- package/dist/utils/duration.js +0 -1
package/dist/utils/target.d.ts
CHANGED
|
@@ -47,9 +47,9 @@ export declare function resolveTargetFromOptions(options: TargetResolutionOption
|
|
|
47
47
|
* 回调获得创建好的 service 与解析后的目标拓扑信息;无论回调成功或抛出,
|
|
48
48
|
* 都保证 service 资源被正确释放,业务异常原样透传。
|
|
49
49
|
*
|
|
50
|
-
* 默认旁观打开:内部创建的本地 Host
|
|
50
|
+
* 默认旁观打开:内部创建的本地 Host 以非收割模式打开存储(显式指定 recoverOrphans: false),
|
|
51
51
|
* 供 ad state / ad runs / ad config 等查询命令与运行中的 serve 进程并发访问同一库;
|
|
52
|
-
* 需要持有者语义的执行命令通过 localOptions.ownDataDir
|
|
52
|
+
* 需要持有者语义的执行命令通过 localOptions.ownDataDir 显式声明启用收割。
|
|
53
53
|
*
|
|
54
54
|
* @param options 命令选项视图(profile/server/token/package/dataDir/insecure/allowInsecureHttp)
|
|
55
55
|
* @param context CLI 上下文
|
|
@@ -67,6 +67,10 @@ export declare function withService(options: TargetResolutionOptions, context: C
|
|
|
67
67
|
* 保持缺省 false,避免误收割并发 serve 进程的在途运行记录。
|
|
68
68
|
*/
|
|
69
69
|
ownDataDir?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 是否显式指定孤儿运行收割策略;缺省依据 ownDataDir 决策(仅 ownDataDir 为 true 时启用收割,查询旁观模式显式关闭)
|
|
72
|
+
*/
|
|
73
|
+
recoverOrphans?: boolean;
|
|
70
74
|
/**
|
|
71
75
|
* 是否强制要求远端目标:true 时 local 分支直接抛 ArgumentError(如 ad runs cancel),
|
|
72
76
|
* 替代原 withRemoteService 的专用实现。
|
package/dist/utils/target.js
CHANGED
|
@@ -42,9 +42,9 @@ export function resolveTargetFromOptions(options, context) {
|
|
|
42
42
|
* 回调获得创建好的 service 与解析后的目标拓扑信息;无论回调成功或抛出,
|
|
43
43
|
* 都保证 service 资源被正确释放,业务异常原样透传。
|
|
44
44
|
*
|
|
45
|
-
* 默认旁观打开:内部创建的本地 Host
|
|
45
|
+
* 默认旁观打开:内部创建的本地 Host 以非收割模式打开存储(显式指定 recoverOrphans: false),
|
|
46
46
|
* 供 ad state / ad runs / ad config 等查询命令与运行中的 serve 进程并发访问同一库;
|
|
47
|
-
* 需要持有者语义的执行命令通过 localOptions.ownDataDir
|
|
47
|
+
* 需要持有者语义的执行命令通过 localOptions.ownDataDir 显式声明启用收割。
|
|
48
48
|
*
|
|
49
49
|
* @param options 命令选项视图(profile/server/token/package/dataDir/insecure/allowInsecureHttp)
|
|
50
50
|
* @param context CLI 上下文
|
|
@@ -62,6 +62,7 @@ export async function withService(options, context, fn, localOptions) {
|
|
|
62
62
|
findProjectRoot() ??
|
|
63
63
|
undefined
|
|
64
64
|
: undefined;
|
|
65
|
+
const recoverOrphans = localOptions?.recoverOrphans ?? (localOptions?.ownDataDir === true);
|
|
65
66
|
const service = resolved.type === "remote"
|
|
66
67
|
? await connectActionDock({
|
|
67
68
|
serverUrl: resolved.serverUrl,
|
|
@@ -77,12 +78,11 @@ export async function withService(options, context, fn, localOptions) {
|
|
|
77
78
|
platform: createNodePlatform({
|
|
78
79
|
customHome: context?.customHome,
|
|
79
80
|
dataDir: options.dataDir || context?.dataDir,
|
|
80
|
-
rootDir: localRoot,
|
|
81
81
|
}),
|
|
82
82
|
...(localOptions?.scanLinkedPackages !== undefined
|
|
83
83
|
? { scanLinkedPackages: localOptions.scanLinkedPackages }
|
|
84
84
|
: undefined),
|
|
85
|
-
|
|
85
|
+
recoverOrphans,
|
|
86
86
|
});
|
|
87
87
|
try {
|
|
88
88
|
await fn(service, resolved);
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type ActionDockManifest, type ProjectTransaction } from "@actiondock/co
|
|
|
3
3
|
/**
|
|
4
4
|
* 「未显式指定包且当前目录无工程」的统一补救提示(单一事实源)。
|
|
5
5
|
*/
|
|
6
|
-
export declare const PACKAGE_HINT_MESSAGE = "
|
|
6
|
+
export declare const PACKAGE_HINT_MESSAGE = "Hint: Run 'ad init' to start a new project, specify '-P <id|path>' for an existing package, or run 'ad link <path>' to register it.";
|
|
7
7
|
/**
|
|
8
8
|
* 远端目标拓扑的最小字段视图(与 core 的 ResolvedTarget 远端分支兼容)。
|
|
9
9
|
*/
|
package/dist/utils/utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { resolvePackageRoot, } from "@actiondock/core/registry";
|
|
2
1
|
import { findProjectRoot, loadProjectConfig, } from "@actiondock/core";
|
|
3
2
|
import { loadManifest, } from "@actiondock/core/project";
|
|
4
3
|
import { resolve } from "node:path";
|
|
5
4
|
import { ArgumentError, ExecutionError, notInProjectError, packageNotFoundError, wrapAsExecutionError } from "../errors.js";
|
|
5
|
+
import { resolveLocalPackageRoot } from "./target.js";
|
|
6
6
|
/**
|
|
7
7
|
* 「未显式指定包且当前目录无工程」的统一补救提示(单一事实源)。
|
|
8
8
|
*/
|
|
9
|
-
export const PACKAGE_HINT_MESSAGE = "
|
|
9
|
+
export const PACKAGE_HINT_MESSAGE = "Hint: Run 'ad init' to start a new project, specify '-P <id|path>' for an existing package, or run 'ad link <path>' to register it.";
|
|
10
10
|
/**
|
|
11
11
|
* 拼接远端目标标题后缀(单一事实源)。
|
|
12
12
|
*
|
|
@@ -106,19 +106,11 @@ export function getTargetRoot(packageOption, keyHint) {
|
|
|
106
106
|
targetPackage = keyHint.slice(0, slashIdx);
|
|
107
107
|
effectiveKey = keyHint.slice(slashIdx + 1);
|
|
108
108
|
}
|
|
109
|
-
const root =
|
|
110
|
-
if (!root) {
|
|
111
|
-
if (targetPackage) {
|
|
112
|
-
throw packageNotFoundError(targetPackage);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
throw notInProjectError(PACKAGE_HINT_MESSAGE);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
109
|
+
const { root } = requirePackageRoot(targetPackage);
|
|
118
110
|
return { root, key: effectiveKey };
|
|
119
111
|
}
|
|
120
112
|
export function requirePackageRoot(packageOption, options) {
|
|
121
|
-
const root =
|
|
113
|
+
const root = resolveLocalPackageRoot(packageOption);
|
|
122
114
|
if (!root) {
|
|
123
115
|
if (packageOption) {
|
|
124
116
|
throw packageNotFoundError(packageOption);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actiondock/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.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,10 +34,10 @@
|
|
|
34
34
|
"test": "node ../../scripts/run-tests.ts"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@actiondock/builder": "^2.
|
|
38
|
-
"@actiondock/core": "^2.
|
|
39
|
-
"@actiondock/mcp": "^2.
|
|
40
|
-
"@actiondock/sdk": "^2.
|
|
37
|
+
"@actiondock/builder": "^2.11.0",
|
|
38
|
+
"@actiondock/core": "^2.11.0",
|
|
39
|
+
"@actiondock/mcp": "^2.11.0",
|
|
40
|
+
"@actiondock/sdk": "^2.11.0",
|
|
41
41
|
"commander": "^13.1.0",
|
|
42
42
|
"selfsigned": "^5.5.0"
|
|
43
43
|
},
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type ActionDockService } from "@actiondock/core";
|
|
2
|
-
import type { CliContext } from "../types.js";
|
|
3
|
-
/**
|
|
4
|
-
* 状态键列表渲染参数视图。
|
|
5
|
-
*/
|
|
6
|
-
export interface StateListRenderArgs {
|
|
7
|
-
service: ActionDockService;
|
|
8
|
-
actionId: string;
|
|
9
|
-
prefix: string;
|
|
10
|
-
options: any;
|
|
11
|
-
effectiveIntent?: string;
|
|
12
|
-
shouldFallback: boolean;
|
|
13
|
-
context?: CliContext;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* 渲染单个项目作用域的状态键列表(含 --detail JSON 明细分支)。
|
|
17
|
-
*/
|
|
18
|
-
export declare function renderProjectScopedStateList(args: StateListRenderArgs & {
|
|
19
|
-
targetRoot: string;
|
|
20
|
-
}): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* 渲染全部链接包聚合的状态键列表(跳过磁盘失效与清单损坏的链接项)。
|
|
23
|
-
*/
|
|
24
|
-
export declare function renderLinkedPackagesStateList(args: StateListRenderArgs): Promise<void>;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { loadProjectConfig, } from "@actiondock/core";
|
|
2
|
-
import { filterWithFallbackInfo, } from "@actiondock/core/project";
|
|
3
|
-
import { listLinkedPackages, } from "@actiondock/core/registry";
|
|
4
|
-
import { existsSync } from "node:fs";
|
|
5
|
-
import { NO_PROJECT_NO_LINKED_MESSAGE } from "../errors.js";
|
|
6
|
-
import { renderResult, renderStateList } from "../renderer.js";
|
|
7
|
-
/**
|
|
8
|
-
* 渲染单个项目作用域的状态键列表(含 --detail JSON 明细分支)。
|
|
9
|
-
*/
|
|
10
|
-
export async function renderProjectScopedStateList(args) {
|
|
11
|
-
const { service, targetRoot, actionId, prefix, options, effectiveIntent, shouldFallback, context } = args;
|
|
12
|
-
const projConfig = loadProjectConfig(targetRoot);
|
|
13
|
-
const allKeys = (await service.management?.state.list(projConfig.id, actionId, {
|
|
14
|
-
namespace: options.namespace !== undefined ? options.namespace : null,
|
|
15
|
-
prefix,
|
|
16
|
-
})) ?? [];
|
|
17
|
-
if (options.detail && options.json) {
|
|
18
|
-
const entries = [];
|
|
19
|
-
for (const k of allKeys) {
|
|
20
|
-
const entry = await service.management?.state.get(projConfig.id, actionId, k, {
|
|
21
|
-
namespace: options.namespace,
|
|
22
|
-
detail: true,
|
|
23
|
-
});
|
|
24
|
-
if (entry) {
|
|
25
|
-
entries.push(entry);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const filterRes = filterWithFallbackInfo(entries, effectiveIntent, [(e) => e.fullKey, (e) => e.key, (e) => e.namespace], shouldFallback);
|
|
29
|
-
renderResult(filterRes.items, {
|
|
30
|
-
json: true,
|
|
31
|
-
context,
|
|
32
|
-
});
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const filterRes = filterWithFallbackInfo(allKeys, effectiveIntent, [(k) => k], shouldFallback);
|
|
36
|
-
renderResult(filterRes.items, {
|
|
37
|
-
json: options.json,
|
|
38
|
-
humanFormatter: () => renderStateList(filterRes.items, `${projConfig.name} (${projConfig.id})`, filterRes.isFallback, effectiveIntent),
|
|
39
|
-
context,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 渲染全部链接包聚合的状态键列表(跳过磁盘失效与清单损坏的链接项)。
|
|
44
|
-
*/
|
|
45
|
-
export async function renderLinkedPackagesStateList(args) {
|
|
46
|
-
const { service, actionId, prefix, options, effectiveIntent, shouldFallback, context } = args;
|
|
47
|
-
// 扫描所有链接的包状态
|
|
48
|
-
const linked = listLinkedPackages();
|
|
49
|
-
if (linked.length === 0) {
|
|
50
|
-
renderResult([], {
|
|
51
|
-
json: options.json,
|
|
52
|
-
humanFormatter: () => NO_PROJECT_NO_LINKED_MESSAGE,
|
|
53
|
-
context,
|
|
54
|
-
});
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const aggregatedKeys = [];
|
|
58
|
-
for (const pkg of linked) {
|
|
59
|
-
if (!existsSync(pkg.path))
|
|
60
|
-
continue;
|
|
61
|
-
try {
|
|
62
|
-
const config = loadProjectConfig(pkg.path);
|
|
63
|
-
const keys = (await service.management?.state.list(config.id, actionId, {
|
|
64
|
-
namespace: options.namespace !== undefined ? options.namespace : null,
|
|
65
|
-
prefix,
|
|
66
|
-
})) ?? [];
|
|
67
|
-
for (const k of keys) {
|
|
68
|
-
aggregatedKeys.push(`${config.id}/${k}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
// 单个链接包清单损坏或状态读取失败时跳过,继续聚合其余包
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
const filterRes = filterWithFallbackInfo(aggregatedKeys, effectiveIntent, [(k) => k], shouldFallback);
|
|
76
|
-
renderResult(filterRes.items, {
|
|
77
|
-
json: options.json,
|
|
78
|
-
humanFormatter: () => renderStateList(filterRes.items, "Linked Packages State Store", filterRes.isFallback, effectiveIntent),
|
|
79
|
-
context,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type InvocationControl } from "@actiondock/core/server";
|
|
2
|
-
import type { StandaloneOptions } from "../types.js";
|
|
3
|
-
export { type InvocationControl };
|
|
4
|
-
/**
|
|
5
|
-
* 运行独立二进制参数解析分发器并返回退出状态码(委托 Core 统一实现)。
|
|
6
|
-
*/
|
|
7
|
-
export declare function runStandaloneCli(argv: string[] | undefined, options: StandaloneOptions, control?: InvocationControl): Promise<number>;
|
|
8
|
-
/**
|
|
9
|
-
* 独立二进制进程入口适配器(事实源位于 core 包,此处 re-export 维持既有导入路径兼容)。
|
|
10
|
-
* 仅在命令行可执行入口调用,负责全局 SIGINT 监听与退出状态码写入。
|
|
11
|
-
*/
|
|
12
|
-
export { runStandaloneProcess } from "@actiondock/core/server";
|
package/dist/standalone/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StandaloneDispatcher as CoreStandaloneDispatcher, } from "@actiondock/core/server";
|
|
2
|
-
/**
|
|
3
|
-
* 运行独立二进制参数解析分发器并返回退出状态码(委托 Core 统一实现)。
|
|
4
|
-
*/
|
|
5
|
-
export async function runStandaloneCli(argv = process.argv.slice(2), options, control) {
|
|
6
|
-
const dispatcher = new CoreStandaloneDispatcher(options);
|
|
7
|
-
return dispatcher.dispatch(argv, control);
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* 独立二进制进程入口适配器(事实源位于 core 包,此处 re-export 维持既有导入路径兼容)。
|
|
11
|
-
* 仅在命令行可执行入口调用,负责全局 SIGINT 监听与退出状态码写入。
|
|
12
|
-
*/
|
|
13
|
-
export { runStandaloneProcess } from "@actiondock/core/server";
|
package/dist/utils/duration.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { parseDuration } from "@actiondock/core/project";
|
package/dist/utils/duration.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { parseDuration } from "@actiondock/core/project";
|