@actiondock/cli 2.9.0 → 2.9.1
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 +1 -1
- package/dist/commands/run.js +31 -0
- package/dist/commands/runs.js +41 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -174,7 +174,7 @@ $data | ConvertTo-Json -Depth 100 | ad run complex-action --input-file -
|
|
|
174
174
|
| `ad playbook list` / `show` | 查看智能体操作规程 Playbook |
|
|
175
175
|
| `ad config list` / `get` / `set` | 管理包运行时配置与环境变量绑定 |
|
|
176
176
|
| `ad state list` / `get` / `set` / `delete` / `clear` | 查看与维护 SQLite 持久化状态 |
|
|
177
|
-
| `ad runs list` / `show` |
|
|
177
|
+
| `ad runs list` / `show` / `clear` | 查询任务执行历史与追踪记录,或按时间与数量策略清理历史数据 |
|
|
178
178
|
| `ad test` | 执行快速单元测试 |
|
|
179
179
|
| `ad build` | 构建 Node.js 目录交付产物(支持 `--vendor-deps` 与 `--archive`) |
|
|
180
180
|
| `ad pack` | 打包为标准 npm tarball(`.tgz`),支持 `--dry-run` |
|
package/dist/commands/run.js
CHANGED
|
@@ -216,6 +216,36 @@ export async function executeAction(id, options, context, flatArgs, control) {
|
|
|
216
216
|
throw err;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
+
const RUN_HELP_AFTER_TEXT = `
|
|
220
|
+
Introspection & Guidance:
|
|
221
|
+
If uncertain about an action's inputs or schemas:
|
|
222
|
+
ad describe <id> Inspect action schema, required fields, and assignment examples
|
|
223
|
+
If handling multi-step tasks or complex workflows:
|
|
224
|
+
ad playbook list List available Standard Operating Procedures (SOPs)
|
|
225
|
+
ad playbook show <id> View step-by-step procedure and execution rules
|
|
226
|
+
|
|
227
|
+
Flat Input Syntax & Examples:
|
|
228
|
+
Standard invocation syntax:
|
|
229
|
+
ad run <id> [control-options] [-- <assignments...>]
|
|
230
|
+
|
|
231
|
+
Flat parameter assignments:
|
|
232
|
+
# String assignment (= keeps raw string, no type coercion)
|
|
233
|
+
ad run <id> -- key="value" path="src/index.ts"
|
|
234
|
+
|
|
235
|
+
# Typed / JSON assignment (:= parses numbers, booleans, arrays, objects)
|
|
236
|
+
ad run <id> -- count:=10 enabled:=true timeoutMs:=5000
|
|
237
|
+
|
|
238
|
+
# Sequential array indexing (zero-indexed, consecutive)
|
|
239
|
+
ad run <id> -- paths.0="src" paths.1="docs"
|
|
240
|
+
# Or direct JSON array
|
|
241
|
+
ad run <id> -- paths:='["src", "docs"]'
|
|
242
|
+
|
|
243
|
+
# Nested object properties
|
|
244
|
+
ad run <id> -- user.name="alice" user.age:=30
|
|
245
|
+
|
|
246
|
+
Complex or multiline inputs:
|
|
247
|
+
# Pass via JSON file with --input-file to avoid shell escaping issues
|
|
248
|
+
ad run <id> --input-file input.json`;
|
|
219
249
|
/**
|
|
220
250
|
* 挂载 run 子命令至指定 Commander 节点。
|
|
221
251
|
*
|
|
@@ -236,6 +266,7 @@ export function attachRunCommand(parent, context) {
|
|
|
236
266
|
.option("--async", "Execute asynchronously in background (requires remote server or profile)")
|
|
237
267
|
.option("--data-dir <path>", "Custom database directory")
|
|
238
268
|
.option("--json", "Output as JSON")
|
|
269
|
+
.addHelpText("after", RUN_HELP_AFTER_TEXT)
|
|
239
270
|
.action(async (id, params, rawOptions, cmd) => {
|
|
240
271
|
let flatArgs;
|
|
241
272
|
let effectiveRawOptions = rawOptions;
|
package/dist/commands/runs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findProjectRoot, loadProjectConfig, } from "@actiondock/core";
|
|
1
|
+
import { findProjectRoot, loadProjectConfig, parseDuration, } from "@actiondock/core";
|
|
2
2
|
import { filterWithFallbackInfo, } from "@actiondock/core/project";
|
|
3
3
|
import { listLinkedPackages, resolvePackageRoot, } from "@actiondock/core/registry";
|
|
4
4
|
import { ArgumentError, ExecutionError, NO_PROJECT_NO_LINKED_MESSAGE, packageNotFoundError, } from "../errors.js";
|
|
@@ -177,7 +177,10 @@ export function registerRunsCommands(program, context) {
|
|
|
177
177
|
.command("clear")
|
|
178
178
|
.description("Clear execution run records")
|
|
179
179
|
.option("-P, --package <id>", "Target package ID or path")
|
|
180
|
-
.option("-a, --action <actionId>", "Filter by action ID")
|
|
180
|
+
.option("-a, --action <actionId>", "Filter by action ID")
|
|
181
|
+
.option("--status <status>", "Filter by run status (e.g. success, failed)")
|
|
182
|
+
.option("--older-than <duration>", "Only clear runs older than specified duration (e.g. 14d, 7d, 24h, 30m)")
|
|
183
|
+
.option("--keep <count>", "Keep the most recent N runs and clear older ones"))
|
|
181
184
|
.option("--data-dir <path>", "Custom database storage directory")
|
|
182
185
|
.option("--json", "Output as JSON")
|
|
183
186
|
.action(async (rawOptions, cmd) => {
|
|
@@ -193,16 +196,49 @@ export function registerRunsCommands(program, context) {
|
|
|
193
196
|
// 清单损坏时保留原始 -P 参数作为包标识
|
|
194
197
|
}
|
|
195
198
|
}
|
|
199
|
+
let olderThanMs;
|
|
200
|
+
if (options.olderThan) {
|
|
201
|
+
try {
|
|
202
|
+
olderThanMs = parseDuration(options.olderThan);
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
throw new ArgumentError(`Invalid --older-than argument: ${err.message}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
let keep;
|
|
209
|
+
if (options.keep !== undefined) {
|
|
210
|
+
const parsed = parseInt(String(options.keep), 10);
|
|
211
|
+
if (isNaN(parsed) || parsed < 0) {
|
|
212
|
+
throw new ArgumentError("Invalid --keep argument: must be a non-negative integer");
|
|
213
|
+
}
|
|
214
|
+
keep = parsed;
|
|
215
|
+
}
|
|
196
216
|
await withService(options, context, async (service, resolved) => {
|
|
197
217
|
const count = service.runs.clear
|
|
198
|
-
? await service.runs.clear({
|
|
218
|
+
? await service.runs.clear({
|
|
219
|
+
packageId,
|
|
220
|
+
actionId: options.action,
|
|
221
|
+
status: options.status,
|
|
222
|
+
olderThanMs,
|
|
223
|
+
keep,
|
|
224
|
+
})
|
|
199
225
|
: 0;
|
|
226
|
+
const filters = [];
|
|
227
|
+
if (options.action)
|
|
228
|
+
filters.push(`action='${options.action}'`);
|
|
229
|
+
if (options.status)
|
|
230
|
+
filters.push(`status='${options.status}'`);
|
|
231
|
+
if (options.olderThan)
|
|
232
|
+
filters.push(`older than ${options.olderThan}`);
|
|
233
|
+
if (keep !== undefined)
|
|
234
|
+
filters.push(`keeping newest ${keep}`);
|
|
235
|
+
const filterDesc = filters.length > 0 ? ` (${filters.join(", ")})` : "";
|
|
200
236
|
const payload = { ok: true, clearedCount: count };
|
|
201
237
|
renderResult(payload, {
|
|
202
238
|
json: options.json,
|
|
203
239
|
humanFormatter: () => resolved.type === "remote"
|
|
204
|
-
? `Cleared ${count} execution run(s) on remote server.`
|
|
205
|
-
: `Cleared ${count} execution run(s) in package '${packageId}'.`,
|
|
240
|
+
? `Cleared ${count} execution run(s) on remote server${filterDesc}.`
|
|
241
|
+
: `Cleared ${count} execution run(s) in package '${packageId}'${filterDesc}.`,
|
|
206
242
|
context,
|
|
207
243
|
});
|
|
208
244
|
}, { localRoot: targetPackageRoot });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actiondock/cli",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.1",
|
|
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.9.
|
|
38
|
-
"@actiondock/core": "^2.9.
|
|
39
|
-
"@actiondock/mcp": "^2.9.
|
|
40
|
-
"@actiondock/sdk": "^2.9.
|
|
37
|
+
"@actiondock/builder": "^2.9.1",
|
|
38
|
+
"@actiondock/core": "^2.9.1",
|
|
39
|
+
"@actiondock/mcp": "^2.9.1",
|
|
40
|
+
"@actiondock/sdk": "^2.9.1",
|
|
41
41
|
"commander": "^13.1.0",
|
|
42
42
|
"selfsigned": "^5.5.0"
|
|
43
43
|
},
|