@autocodeflow/cli 1.9.1 → 1.10.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 +28 -1
- package/dist/client.d.ts +11 -1
- package/dist/client.js +12 -2
- package/dist/commands/apps.js +6 -3
- package/dist/commands/mutex.d.ts +2 -0
- package/dist/commands/mutex.js +194 -0
- package/dist/help.js +18 -1
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,7 +114,9 @@ acf task delete <id> -y # 非交互下唯一被接受的确认方式
|
|
|
114
114
|
|
|
115
115
|
## 任务参数注入(params → AUTOFLOW_\*)
|
|
116
116
|
|
|
117
|
-
`task create`/`update` 的 `body.params` 在每次执行时注入为 `AUTOFLOW_<KEY>`
|
|
117
|
+
`task create`/`update` 的 `body.params` 在每次执行时注入为 `AUTOFLOW_<KEY>` 环境变量(键名转大写)。**字符串按裸值注入**(`"nightly"` → `AUTOFLOW_TARGET=nightly`,直接读即可,不加引号);数字/布尔/对象/数组为 JSON 字面量(`3`、`true`、`["a",1]`)。需要精确类型时另读 `AUTOFLOW_PARAMS_JSON`(整个参数的 JSON 对象,协议 v5 起注入)——逐键通道的值恒为字符串,无法区分字符串 `"true"` 与布尔 `true`(两执行器契约向量见 contract-fixtures 的 `executorEnvSerializationV2`)。
|
|
118
|
+
|
|
119
|
+
> ⚠️ 2026-10-02 ~ 10-14 期间发布的执行器(A-11)会把**字符串也加一对首尾双引号**(`AUTOFLOW_TARGET='"nightly"'`),空串变成 `'""'`(真值)。该行为已在协议 v5 修复——若目标执行器仍是旧版,脚本需容错剥离首尾引号。
|
|
118
120
|
|
|
119
121
|
- **按 run 覆盖参数**:`acf task trigger <id> --params '{"KEY":"value"}'` 覆盖任务默认 params(TriggerTaskDto 同 webhook 面;缺省不发 body,用任务默认值)。block-strategy 闸(N-14)按生效参数判重。
|
|
120
122
|
- **按名/描述搜任务**:`acf task list --search <kw>` 走 `q` 参数(name OR description,控制台搜索框同款);`-k/--keyword` 仍只搜 name(向后兼容通道)。
|
|
@@ -138,6 +140,31 @@ acf task delete <id> -y # 非交互下唯一被接受的确认方式
|
|
|
138
140
|
语言按扩展名推断(`.js/.mjs/.cjs` → `javascript`),或 `--language
|
|
139
141
|
python|javascript|shell` 显式指定(执行器运行时白名单);空脚本本地即拒。
|
|
140
142
|
|
|
143
|
+
## 应用互斥组(MUTEX-01,2026-10 补齐 CLI 面)
|
|
144
|
+
|
|
145
|
+
同一组内的应用在**同一台设备上永不并发**(组内并发数默认 1 = 串行)——典型场景
|
|
146
|
+
是独占型资源:浏览器实例、单点登录账号(顶号)、GPU 槽位。后端 `mutex-groups`
|
|
147
|
+
四端点自 MUTEX-01 起就存在且中台在用,此前 CLI 零接入。
|
|
148
|
+
|
|
149
|
+
- `acf mutex list`:拉取可选组(**与中台应用表单下拉同源**),列出 `id` / 名称 /
|
|
150
|
+
每设备并发 / 作用域 / 已挂应用数。挂应用时用这里的 `id`。
|
|
151
|
+
- `acf mutex create --name <name> [--max-concurrent N] [--scope device|global] [--description <text>]`
|
|
152
|
+
:建组。`--max-concurrent` 取值 1-100(与后端 `@Min/@Max` 同界);
|
|
153
|
+
`--scope` 两档语义差别很大:
|
|
154
|
+
- `device`(默认):**单机串行、跨设备并发**——每台设备上同时最多 N 条;
|
|
155
|
+
- `global`:**全平台串行**——整平台同时最多 N 条(单点登录顶号类场景)。
|
|
156
|
+
- `acf mutex update <groupId> [--name] [--max-concurrent] [--scope] [--description]`:
|
|
157
|
+
改组。至少给一个字段(空 patch 本地即拒,退出码 2——服务端会「成功但什么都没改」,
|
|
158
|
+
容易被误读为已生效)。`--scope` 可即时收紧,在途 WAITING 执行由 sweep 重派自愈。
|
|
159
|
+
- `acf mutex delete <groupId> [-f|--force] [-y|--yes]`:删组。组上仍挂应用时服务端
|
|
160
|
+
返回 409 并告知挂载数量;确认后用 `--force` 放行(挂载应用经 FK `SET NULL`
|
|
161
|
+
自动回到「不参与互斥」)。属破坏性操作,非交互场景必须显式 `-y`。
|
|
162
|
+
- **把应用挂进组**(沿用既有 `app update`,字段此前未在帮助里列出):
|
|
163
|
+
`acf app update <appId> --body '{"mutexGroupId":"<acf mutex list 的 id>"}'`;
|
|
164
|
+
传 `null` 摘组。`acf app get <appId> --json` 可读出当前挂的组(表格视图不显示)。
|
|
165
|
+
组不存在时服务端 404(`assertMutexGroupExists` 前置校验)。
|
|
166
|
+
- 写面(create/update/delete)要求 **ADMIN** 角色;`list` 任意登录用户可读。
|
|
167
|
+
|
|
141
168
|
## 开发
|
|
142
169
|
|
|
143
170
|
```bash
|
package/dist/client.d.ts
CHANGED
|
@@ -32,7 +32,17 @@ export declare function get<T>(path: string, params?: Record<string, string | nu
|
|
|
32
32
|
export declare function post<T>(path: string, body?: unknown, timeoutMs?: number): Promise<T>;
|
|
33
33
|
export declare function put<T>(path: string, body?: unknown): Promise<T>;
|
|
34
34
|
export declare function patch<T>(path: string, body?: unknown): Promise<T>;
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* DELETE。可选 `params` 与 get() 同形——把查询串交给 axios 序列化,而不是
|
|
37
|
+
* 在调用点手工拼 `?a=b`。
|
|
38
|
+
*
|
|
39
|
+
* 为什么不让调用点拼:`del(\`/mutex-groups/${id}${opts.force ? '?force=true' : ''}\`)`
|
|
40
|
+
* 这种写法会让 consumer-routes 守卫(scripts/check-consumer-routes.mjs)误判
|
|
41
|
+
* ——它按 `?` 切分后再归一路径,字面量里的 `?` 会把路径截成
|
|
42
|
+
* `/mutex-groups/{}${opts.force ` 而报「路由不在 openapi 中」。守卫的判据是
|
|
43
|
+
* 「用到的每条路由都必须在 openapi 里」,故路径字面量必须保持干净可解析。
|
|
44
|
+
*/
|
|
45
|
+
export declare function del<T>(path: string, params?: Record<string, string | number | undefined>): Promise<T>;
|
|
36
46
|
/**
|
|
37
47
|
* Error class taxonomy shared by the whole CLI. Classification is done ONCE,
|
|
38
48
|
* here at the HTTP-client layer (the only place that knows axios shapes), so
|
package/dist/client.js
CHANGED
|
@@ -173,8 +173,18 @@ export async function patch(path, body) {
|
|
|
173
173
|
const r = await getClient().patch(path, body);
|
|
174
174
|
return unwrap(r.data);
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
/**
|
|
177
|
+
* DELETE。可选 `params` 与 get() 同形——把查询串交给 axios 序列化,而不是
|
|
178
|
+
* 在调用点手工拼 `?a=b`。
|
|
179
|
+
*
|
|
180
|
+
* 为什么不让调用点拼:`del(\`/mutex-groups/${id}${opts.force ? '?force=true' : ''}\`)`
|
|
181
|
+
* 这种写法会让 consumer-routes 守卫(scripts/check-consumer-routes.mjs)误判
|
|
182
|
+
* ——它按 `?` 切分后再归一路径,字面量里的 `?` 会把路径截成
|
|
183
|
+
* `/mutex-groups/{}${opts.force ` 而报「路由不在 openapi 中」。守卫的判据是
|
|
184
|
+
* 「用到的每条路由都必须在 openapi 里」,故路径字面量必须保持干净可解析。
|
|
185
|
+
*/
|
|
186
|
+
export async function del(path, params) {
|
|
187
|
+
const r = await getClient().delete(path, { params });
|
|
178
188
|
return unwrap(r.data);
|
|
179
189
|
}
|
|
180
190
|
// ---------------------------------------------------------------------------
|
package/dist/commands/apps.js
CHANGED
|
@@ -112,7 +112,8 @@ export function appsCommand() {
|
|
|
112
112
|
//(task 侧先改,app 侧本轮补齐——--json 在其余命令都是「输出 JSON」布尔
|
|
113
113
|
// 旗标,载荷语义的 --json 是历史包袱,下一大版本收敛为布尔。)
|
|
114
114
|
cmd.command('create')
|
|
115
|
-
.description('Create an application (JSON payload via --body or --file; required: name, version, runtime)'
|
|
115
|
+
.description('Create an application (JSON payload via --body or --file; required: name, version, runtime). ' +
|
|
116
|
+
'Optional: mutexGroupId (uuid from `acf mutex list` to join a mutex group), approvalRequired (gate deploys behind a second person).')
|
|
116
117
|
.option('--body <json>', 'Application body as JSON string (required unless --file is given)')
|
|
117
118
|
.option('--json <body>', 'DEPRECATED (renamed to --body): Application body as JSON string. In the next major version --json becomes a boolean output flag')
|
|
118
119
|
.option('--file <path>', 'Read application body from a JSON file (overrides --body/--json)')
|
|
@@ -195,8 +196,10 @@ export function appsCommand() {
|
|
|
195
196
|
// acf app update <id>
|
|
196
197
|
cmd.command('update <id>')
|
|
197
198
|
.description('Update an application (JSON payload via --body or --file). ' +
|
|
198
|
-
'Accepted fields: description, version, runtime, status, gitRepo, gitBranch, gitCommit, manifest, env, entrypoint, packageUrl, webhookSecret
|
|
199
|
-
'
|
|
199
|
+
'Accepted fields: description, version, runtime, status, gitRepo, gitBranch, gitCommit, manifest, env, entrypoint, packageUrl, webhookSecret, ' +
|
|
200
|
+
'approvalRequired, mutexGroupId. ' +
|
|
201
|
+
'NOTE: the backend UpdateApplicationDto has no `name` field — renaming is not supported. ' +
|
|
202
|
+
'mutexGroupId takes a group uuid from `acf mutex list` (null detaches); `acf mutex` also manages the groups themselves.')
|
|
200
203
|
.option('--body <json>', 'Application patch body as JSON string (required unless --file is given)')
|
|
201
204
|
.option('--json <body>', 'DEPRECATED (renamed to --body): Application patch body as JSON string. In the next major version --json becomes a boolean output flag')
|
|
202
205
|
.option('--file <path>', 'Read application patch body from a JSON file (overrides --body/--json)')
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Command, InvalidArgumentError } from 'commander';
|
|
2
|
+
import Table from 'cli-table3';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { get, post, put, del } from '../client.js';
|
|
6
|
+
import { emitError, emitUsageError, confirmDestructive } from '../ui.js';
|
|
7
|
+
/**
|
|
8
|
+
* 组作用域(后端 MUTEX_GROUP_SCOPES 的镜像)。本地预检只为报错快一点,
|
|
9
|
+
* 服务端 @IsIn 仍是权威;与 apikeys.ts 的 SCOPES 同一纪律。
|
|
10
|
+
*/
|
|
11
|
+
const SCOPES = ['device', 'global'];
|
|
12
|
+
/** 组内并发上界(后端 MUTEX_GROUP_MAX_CONCURRENT_CEILING 的镜像)。 */
|
|
13
|
+
const MAX_CONCURRENT_CEILING = 100;
|
|
14
|
+
/** `--scope` 解析:非法值在 commander 层就报错(退出码 2),不发请求。 */
|
|
15
|
+
function parseScope(v) {
|
|
16
|
+
if (!SCOPES.includes(v)) {
|
|
17
|
+
throw new InvalidArgumentError(`must be one of: ${SCOPES.join(' | ')}`);
|
|
18
|
+
}
|
|
19
|
+
return v;
|
|
20
|
+
}
|
|
21
|
+
/** `--max-concurrent` 解析:1..100 的整数(与后端 @Min/@Max 同界)。 */
|
|
22
|
+
function parseMaxConcurrent(v) {
|
|
23
|
+
const n = Number.parseInt(v, 10);
|
|
24
|
+
if (!Number.isInteger(n) || n < 1 || n > MAX_CONCURRENT_CEILING) {
|
|
25
|
+
throw new InvalidArgumentError(`must be an integer between 1 and ${MAX_CONCURRENT_CEILING}`);
|
|
26
|
+
}
|
|
27
|
+
return n;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* scope 的人类可读注解。两种作用域的语义差别很大(一个管单机串行、一个管
|
|
31
|
+
* 全平台单点登录顶号),只打 "device"/"global" 用户看不懂,故列表里带注解。
|
|
32
|
+
*/
|
|
33
|
+
function scopeText(scope) {
|
|
34
|
+
if (scope === 'global')
|
|
35
|
+
return chalk.yellow('global') + chalk.gray(' (全平台串行)');
|
|
36
|
+
if (scope === 'device')
|
|
37
|
+
return chalk.cyan('device') + chalk.gray(' (单机串行)');
|
|
38
|
+
return scope;
|
|
39
|
+
}
|
|
40
|
+
export function mutexCommand() {
|
|
41
|
+
const cmd = new Command('mutex').description('Manage application mutex groups (apps in one group never run concurrently on the same device)');
|
|
42
|
+
// acf mutex list
|
|
43
|
+
cmd
|
|
44
|
+
.command('list')
|
|
45
|
+
.description('List mutex groups (the same options the console shows in the app form dropdown)')
|
|
46
|
+
.option('--json', 'Emit raw JSON (CI-consumable, no table)')
|
|
47
|
+
.action(async (opts) => {
|
|
48
|
+
const spinner = ora('Fetching mutex groups…').start();
|
|
49
|
+
try {
|
|
50
|
+
const groups = await get('/mutex-groups');
|
|
51
|
+
spinner.stop();
|
|
52
|
+
if (opts.json) {
|
|
53
|
+
console.log(JSON.stringify(groups ?? []));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!groups?.length) {
|
|
57
|
+
console.log(chalk.gray('No mutex groups yet.'));
|
|
58
|
+
console.log(chalk.gray("Create one with: acf mutex create --name <name>"));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const table = new Table({
|
|
62
|
+
head: ['ID', 'Name', 'Max/Device', 'Scope', 'Apps', 'Description'],
|
|
63
|
+
colWidths: [38, 22, 12, 26, 6, 30],
|
|
64
|
+
style: { head: ['cyan'] },
|
|
65
|
+
});
|
|
66
|
+
for (const g of groups) {
|
|
67
|
+
table.push([
|
|
68
|
+
g.id,
|
|
69
|
+
g.name,
|
|
70
|
+
String(g.maxConcurrentPerDevice),
|
|
71
|
+
scopeText(g.scope),
|
|
72
|
+
g.applicationCount === undefined ? '-' : String(g.applicationCount),
|
|
73
|
+
g.description ?? '-',
|
|
74
|
+
]);
|
|
75
|
+
}
|
|
76
|
+
console.log(table.toString());
|
|
77
|
+
console.log(chalk.gray('Attach an app with: acf app update <appId> --body \'{"mutexGroupId":"<ID>"}\''));
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
emitError('Failed to list mutex groups', e, { spinner });
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// acf mutex create
|
|
84
|
+
cmd
|
|
85
|
+
.command('create')
|
|
86
|
+
.description('Create a mutex group (ADMIN)')
|
|
87
|
+
.requiredOption('--name <name>', 'Group name (unique, max 64 chars)')
|
|
88
|
+
.option('--max-concurrent <n>', `Concurrent runs allowed per device (1-${MAX_CONCURRENT_CEILING}, default 1 = serial)`, parseMaxConcurrent)
|
|
89
|
+
.option('--scope <scope>', 'device = serial per device, cross-device concurrent (default) | global = serial platform-wide (e.g. single-sign-on takeover)', parseScope)
|
|
90
|
+
.option('--description <text>', 'What the group is for (max 500 chars)')
|
|
91
|
+
.option('--json', 'Emit raw JSON (CI-consumable)')
|
|
92
|
+
.action(async (opts) => {
|
|
93
|
+
const spinner = ora('Creating mutex group…').start();
|
|
94
|
+
try {
|
|
95
|
+
// CreateMutexGroupDto 白名单:{ name, maxConcurrentPerDevice?, scope?, description? }。
|
|
96
|
+
// 不发送 undefined 键(forbidNonWhitelisted 下无意义)。
|
|
97
|
+
const body = { name: opts.name };
|
|
98
|
+
if (opts.maxConcurrent !== undefined) {
|
|
99
|
+
body.maxConcurrentPerDevice = opts.maxConcurrent;
|
|
100
|
+
}
|
|
101
|
+
if (opts.scope !== undefined)
|
|
102
|
+
body.scope = opts.scope;
|
|
103
|
+
if (opts.description !== undefined)
|
|
104
|
+
body.description = opts.description;
|
|
105
|
+
const group = await post('/mutex-groups', body);
|
|
106
|
+
spinner.stop();
|
|
107
|
+
if (opts.json) {
|
|
108
|
+
console.log(JSON.stringify(group));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
console.log(chalk.green(`✔ Mutex group created: ${group.name}`));
|
|
112
|
+
console.log(' ID :', group.id);
|
|
113
|
+
console.log(' Max/Device :', group.maxConcurrentPerDevice);
|
|
114
|
+
console.log(' Scope :', group.scope);
|
|
115
|
+
console.log(chalk.gray(` Attach an app: acf app update <appId> --body '{"mutexGroupId":"${group.id}"}'`));
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
emitError('Failed to create mutex group', e, { spinner });
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
// acf mutex update <id>
|
|
122
|
+
cmd
|
|
123
|
+
.command('update <id>')
|
|
124
|
+
.description('Update a mutex group (name / max-concurrent / scope / description; ADMIN)')
|
|
125
|
+
.option('--name <name>', 'New group name (unique, max 64 chars)')
|
|
126
|
+
.option('--max-concurrent <n>', `New per-device concurrency (1-${MAX_CONCURRENT_CEILING})`, parseMaxConcurrent)
|
|
127
|
+
.option('--scope <scope>', 'New scope: device | global', parseScope)
|
|
128
|
+
.option('--description <text>', 'New description (max 500 chars)')
|
|
129
|
+
.option('--json', 'Emit raw JSON (CI-consumable)')
|
|
130
|
+
.action(async (id, opts) => {
|
|
131
|
+
// 空 patch(一个字段都没给)在服务端的语义是「什么都不改」却仍算成功,
|
|
132
|
+
// 容易被误读为「已生效」。本地拦下并给出可操作提示(退出码 2)。
|
|
133
|
+
if (opts.name === undefined &&
|
|
134
|
+
opts.maxConcurrent === undefined &&
|
|
135
|
+
opts.scope === undefined &&
|
|
136
|
+
opts.description === undefined) {
|
|
137
|
+
emitUsageError('Nothing to update — pass at least one of: --name, --max-concurrent, --scope, --description');
|
|
138
|
+
}
|
|
139
|
+
const spinner = ora('Updating mutex group…').start();
|
|
140
|
+
try {
|
|
141
|
+
const body = {};
|
|
142
|
+
if (opts.name !== undefined)
|
|
143
|
+
body.name = opts.name;
|
|
144
|
+
if (opts.maxConcurrent !== undefined) {
|
|
145
|
+
body.maxConcurrentPerDevice = opts.maxConcurrent;
|
|
146
|
+
}
|
|
147
|
+
if (opts.scope !== undefined)
|
|
148
|
+
body.scope = opts.scope;
|
|
149
|
+
if (opts.description !== undefined)
|
|
150
|
+
body.description = opts.description;
|
|
151
|
+
const group = await put(`/mutex-groups/${id}`, body);
|
|
152
|
+
spinner.stop();
|
|
153
|
+
if (opts.json) {
|
|
154
|
+
console.log(JSON.stringify(group));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
console.log(chalk.green(`✔ Mutex group updated: ${group.name}`));
|
|
158
|
+
console.log(' ID :', group.id);
|
|
159
|
+
console.log(' Max/Device :', group.maxConcurrentPerDevice);
|
|
160
|
+
console.log(' Scope :', group.scope);
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
emitError('Failed to update mutex group', e, { spinner });
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
// acf mutex delete <id>
|
|
167
|
+
cmd
|
|
168
|
+
.command('delete <id>')
|
|
169
|
+
.description('Delete a mutex group (ADMIN) — attached apps become ungrouped; refuses with 409 while apps are still attached unless --force')
|
|
170
|
+
.option('-f, --force', 'Delete even when apps are still attached (they silently lose the constraint)', false)
|
|
171
|
+
.option('-y, --yes', 'Skip confirmation prompt', false)
|
|
172
|
+
.action(async (id, opts) => {
|
|
173
|
+
// 破坏性动作:先要交互确认(非 TTY 且无 --yes 时由 confirmDestructive
|
|
174
|
+
// 以退出码 2 拒绝,不会静默假绿)。
|
|
175
|
+
const warning = opts.force
|
|
176
|
+
? `Delete mutex group ${id}? Attached apps will lose the mutual-exclusion constraint (--force given).`
|
|
177
|
+
: `Delete mutex group ${id}?`;
|
|
178
|
+
const proceed = await confirmDestructive(warning, { yes: opts.yes });
|
|
179
|
+
if (!proceed)
|
|
180
|
+
return;
|
|
181
|
+
const spinner = ora('Deleting mutex group…').start();
|
|
182
|
+
try {
|
|
183
|
+
// 服务端:组上仍挂应用时返回 409,需显式 force=true 才放行。
|
|
184
|
+
// 查询串交给 del() 的 params(不在路径字面量里拼 `?`)——见 client.ts
|
|
185
|
+
// 的 del() 注释:手工拼串会让 consumer-routes 守卫无法静态解析该路由。
|
|
186
|
+
await del(`/mutex-groups/${id}`, opts.force ? { force: 'true' } : undefined);
|
|
187
|
+
spinner.succeed(`Mutex group ${id} deleted`);
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
emitError('Failed to delete mutex group', e, { spinner });
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return cmd;
|
|
194
|
+
}
|
package/dist/help.js
CHANGED
|
@@ -46,7 +46,7 @@ export const EXAMPLES = {
|
|
|
46
46
|
'task create': [
|
|
47
47
|
'acf task create --file task.json # required: name, triggerType (runtime is optional server-side)',
|
|
48
48
|
"acf task create --body '{\"name\":\"nightly\",\"runtime\":\"node\",\"triggerType\":\"cron\",\"cronExpression\":\"0 2 * * *\"}' # note: there is NO `version` field on the task body — use `currentVersion` if you need one",
|
|
49
|
-
"acf task create --body '{\"name\":\"sync\",\"runtime\":\"python\",\"triggerType\":\"cron\",\"cronExpression\":\"0 8 * * *\",\"params\":{\"REPLACE_EXISTING\":true,\"retries\":3,\"target\":\"nightly\"}}' # params inject as AUTOFLOW_<KEY> env vars
|
|
49
|
+
"acf task create --body '{\"name\":\"sync\",\"runtime\":\"python\",\"triggerType\":\"cron\",\"cronExpression\":\"0 8 * * *\",\"params\":{\"REPLACE_EXISTING\":true,\"retries\":3,\"target\":\"nightly\"}}' # params inject as AUTOFLOW_<KEY> env vars: strings bare ('nightly', no quotes), numbers/booleans/containers as JSON ('3','true','[\"a\",1]'); read AUTOFLOW_PARAMS_JSON for exact types",
|
|
50
50
|
],
|
|
51
51
|
'task update': ['acf task update <taskId> --file patch.json'],
|
|
52
52
|
'task delete': ['acf task delete <taskId> -y'],
|
|
@@ -151,6 +151,23 @@ export const EXAMPLES = {
|
|
|
151
151
|
],
|
|
152
152
|
'approval reject': ['acf approval reject <deploymentId> --note "wrong version"'],
|
|
153
153
|
'approval cancel': ['acf approval cancel <deploymentId> # withdraw your own pending request'],
|
|
154
|
+
'mutex list': [
|
|
155
|
+
'acf mutex list # the same options the console shows in the app-form dropdown (id + attached app count)',
|
|
156
|
+
'acf mutex list --json',
|
|
157
|
+
],
|
|
158
|
+
'mutex create': [
|
|
159
|
+
'acf mutex create --name ziniao-browser # default: 1 concurrent per device (serial on one device)',
|
|
160
|
+
'acf mutex create --name sso-account --scope global # platform-wide serial (single-sign-on takeover)',
|
|
161
|
+
'acf mutex create --name browser --max-concurrent 2 --description "2 browser slots per device"',
|
|
162
|
+
],
|
|
163
|
+
'mutex update': [
|
|
164
|
+
'acf mutex update <groupId> --max-concurrent 3',
|
|
165
|
+
'acf mutex update <groupId> --scope global # tighten immediately; waiting executions are re-dispatched',
|
|
166
|
+
],
|
|
167
|
+
'mutex delete': [
|
|
168
|
+
'acf mutex delete <groupId> # refuses (409) while apps are attached — lists how many',
|
|
169
|
+
'acf mutex delete <groupId> --force -y # attached apps silently lose the constraint',
|
|
170
|
+
],
|
|
154
171
|
'config show': ['acf config show', 'acf config show --json'],
|
|
155
172
|
'config set-url': ['acf config set-url http://localhost:3105'],
|
|
156
173
|
// 刻意**不**演示 `set-token <明文>`:命令行 token 会进 shell history 与进程列表。
|
package/dist/index.js
CHANGED
|
@@ -47,6 +47,7 @@ import { sopCommand } from './commands/sop.js';
|
|
|
47
47
|
import { agentCommand } from './commands/agent.js';
|
|
48
48
|
import { apikeysCommand } from './commands/apikeys.js';
|
|
49
49
|
import { approvalCommand } from './commands/approval.js';
|
|
50
|
+
import { mutexCommand } from './commands/mutex.js';
|
|
50
51
|
import { showConfig, setApiUrl, setToken } from './config.js';
|
|
51
52
|
import { applyExamples } from './help.js';
|
|
52
53
|
import { EXIT_CODES, interruptExit } from './ui.js';
|
|
@@ -129,6 +130,7 @@ program.addCommand(sopCommand());
|
|
|
129
130
|
program.addCommand(agentCommand());
|
|
130
131
|
program.addCommand(apikeysCommand());
|
|
131
132
|
program.addCommand(approvalCommand());
|
|
133
|
+
program.addCommand(mutexCommand());
|
|
132
134
|
// acf config show / set
|
|
133
135
|
const configCmd = new Command('config').description('View or update CLI configuration');
|
|
134
136
|
configCmd
|