@actiondock/cli 2.10.0 → 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.
Files changed (64) hide show
  1. package/README.md +2 -2
  2. package/bin/ad.js +225 -5
  3. package/dist/commands/action/create.d.ts +1 -1
  4. package/dist/commands/action/create.js +6 -14
  5. package/dist/commands/add.js +1 -1
  6. package/dist/commands/config/delete.js +3 -1
  7. package/dist/commands/config/env.js +2 -1
  8. package/dist/commands/config/get.js +3 -1
  9. package/dist/commands/config/list.js +6 -5
  10. package/dist/commands/config/set.js +3 -1
  11. package/dist/commands/describe.js +2 -3
  12. package/dist/commands/export.js +34 -16
  13. package/dist/commands/index.d.ts +37 -24
  14. package/dist/commands/index.js +326 -48
  15. package/dist/commands/mcp.js +0 -1
  16. package/dist/commands/playbook.js +15 -35
  17. package/dist/commands/profile.js +2 -1
  18. package/dist/commands/remove.js +1 -1
  19. package/dist/commands/run.d.ts +2 -1
  20. package/dist/commands/run.js +4 -56
  21. package/dist/commands/runs.d.ts +6 -1
  22. package/dist/commands/runs.js +274 -11
  23. package/dist/commands/serve.js +5 -2
  24. package/dist/commands/state.js +84 -15
  25. package/dist/index.d.ts +10 -2
  26. package/dist/index.js +15 -12
  27. package/dist/prompt.d.ts +3 -0
  28. package/dist/prompt.js +6 -14
  29. package/dist/renderer.d.ts +7 -137
  30. package/dist/renderer.js +6 -438
  31. package/dist/renderers/action.d.ts +51 -0
  32. package/dist/renderers/action.js +112 -0
  33. package/dist/renderers/config.d.ts +31 -0
  34. package/dist/renderers/config.js +93 -0
  35. package/dist/renderers/playbook.d.ts +19 -0
  36. package/dist/renderers/playbook.js +42 -0
  37. package/dist/renderers/project.d.ts +45 -0
  38. package/dist/renderers/project.js +196 -0
  39. package/dist/renderers/runs.d.ts +15 -0
  40. package/dist/renderers/runs.js +47 -0
  41. package/dist/renderers/state.d.ts +4 -0
  42. package/dist/renderers/state.js +19 -0
  43. package/dist/services/config-merge.js +1 -2
  44. package/dist/services/index.d.ts +1 -0
  45. package/dist/services/index.js +1 -0
  46. package/dist/services/run-watch.d.ts +156 -0
  47. package/dist/services/run-watch.js +395 -0
  48. package/dist/utils/cert.js +1 -1
  49. package/dist/utils/index.d.ts +1 -1
  50. package/dist/utils/index.js +1 -1
  51. package/dist/utils/input.d.ts +2 -1
  52. package/dist/utils/input.js +2 -1
  53. package/dist/utils/target.d.ts +6 -2
  54. package/dist/utils/target.js +4 -4
  55. package/dist/utils/utils.js +3 -11
  56. package/dist/utils/warning.d.ts +4 -0
  57. package/dist/utils/warning.js +4 -0
  58. package/package.json +5 -5
  59. package/dist/commands/state-list.d.ts +0 -24
  60. package/dist/commands/state-list.js +0 -81
  61. package/dist/standalone/index.d.ts +0 -12
  62. package/dist/standalone/index.js +0 -13
  63. package/dist/utils/duration.d.ts +0 -1
  64. package/dist/utils/duration.js +0 -1
@@ -1,8 +1,8 @@
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
  */
@@ -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 = resolvePackageRoot(targetPackage) || (targetPackage ? null : findProjectRoot());
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 = packageOption ? resolvePackageRoot(packageOption) : findProjectRoot();
113
+ const root = resolveLocalPackageRoot(packageOption);
122
114
  if (!root) {
123
115
  if (packageOption) {
124
116
  throw packageNotFoundError(packageOption);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 实验性特性警告静默函数(统一对齐 @actiondock/core/warning 单一事实源)。
3
+ */
4
+ export { suppressExperimentalWarnings } from "@actiondock/core/warning";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 实验性特性警告静默函数(统一对齐 @actiondock/core/warning 单一事实源)。
3
+ */
4
+ export { suppressExperimentalWarnings } from "@actiondock/core/warning";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@actiondock/cli",
3
- "version": "2.10.0",
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.10.0",
38
- "@actiondock/core": "^2.10.0",
39
- "@actiondock/mcp": "^2.10.0",
40
- "@actiondock/sdk": "^2.10.0",
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";
@@ -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";
@@ -1 +0,0 @@
1
- export { parseDuration } from "@actiondock/core/project";
@@ -1 +0,0 @@
1
- export { parseDuration } from "@actiondock/core/project";