@autocodeflow/cli 2.2.0 → 2.3.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 CHANGED
@@ -57,6 +57,7 @@ CLI 的非零退出码按失败类别区分,脚本/CI 可以只按码分支处
57
57
  | 一次性密钥轮换(旧值立即失效) | `executor rotate` / `task webhook enable` / `task webhook rotate` / `task webhook disable` |
58
58
  | 强制终止(KILLED 是终态,无法恢复) | `task kill` |
59
59
  | 全量滚动升级(`--strategy canary` 不加门) | `app upgrade-all` |
60
+ | 停止运行中部署(中断执行器上在跑服务) | `deploy stop` |
60
61
  | 撤销凭据(影响仍在用它的外部系统) | `apikey revoke` |
61
62
 
62
63
  ```bash
@@ -115,7 +115,13 @@ export function deployCommand() {
115
115
  // acf deploy stop <deploymentId>
116
116
  cmd.command('stop <deploymentId>')
117
117
  .description('Stop a running deployment')
118
- .action(async (deploymentId) => {
118
+ .option('-y, --yes', 'Skip confirmation prompt', false)
119
+ .action(async (deploymentId, opts) => {
120
+ // R289-A3:停机会立即中断执行器上正在跑的部署进程,与同文件 deploy remove 及
121
+ // executor rotate / task kill 统一走确认门(非 TTY 缺 --yes → 码 2 且请求不发出)。
122
+ if (!(await confirmDestructive(`Stop running deployment ${deploymentId}? The running process on the executor will be halted until redeployed/upgraded.`, { yes: opts.yes }))) {
123
+ return;
124
+ }
119
125
  const spinner = ora('Stopping deployment…').start();
120
126
  try {
121
127
  // POST /app-deployments/:id/stop — AppDeploymentController.stop
package/dist/help.js CHANGED
@@ -122,7 +122,10 @@ export const EXAMPLES = {
122
122
  ],
123
123
  'executor offline': ['acf executor offline executor-node'],
124
124
  'deploy upgrade': ['acf deploy upgrade <deploymentId>'],
125
- 'deploy stop': ['acf deploy stop <deploymentId>'],
125
+ 'deploy stop': [
126
+ 'acf deploy stop <deploymentId>',
127
+ 'acf deploy stop <deploymentId> -y # skip confirmation prompt (required in non-interactive / CI use)',
128
+ ],
126
129
  'deploy list': [
127
130
  'acf deploy list # same data as: acf app deployments (deployments live under app in the command tree)',
128
131
  'acf deploy list <appId> -n 50 --json',
package/dist/ui.d.ts CHANGED
@@ -46,6 +46,13 @@ export declare function exitCodeFor(e: unknown): number;
46
46
  * P3(本轮):只认**独立选项 token**——① `--opt=value` 是单 token 形态(值不
47
47
  * 会独立成 token,`--json=false` 也因此保持既有「非 JSON 模式」语义);② 取
48
48
  * 值型选项后面的那个 token 是值,跳过。
49
+ *
50
+ * D1(R278):`--json` 是**唯一双义**的取值型选项 —— 它既是「输出 JSON」的布尔
51
+ * 开关,又是 `acf app create|patch --json <body>` 的载荷别名(DEPRECATED)。
52
+ * 故此处对它多判一步:后继 token **不是** JSON 载荷形态(`{…}` / `[…]`)时按开关
53
+ * 处理(返回 true),是载荷形态时按取值处理(跳过、不算 JSON 输出模式)。
54
+ * 反证:去掉这条分支(对 `--json` 无条件跳过)= 回到「`acf task list --json` 也
55
+ * 判成非 JSON 模式」的旧 bug;改成无条件当开关 = D1 要修的那种环境污染。
49
56
  */
50
57
  export declare function isJsonInvocation(argv?: readonly string[]): boolean;
51
58
  /**
package/dist/ui.js CHANGED
@@ -65,12 +65,19 @@ export function exitCodeFor(e) {
65
65
  *
66
66
  * 只列**长**选项与单字母短选项;`--flag=value` 由调用方按 `=` 跳过(见下)。
67
67
  * 新增取值型选项时同步补这里(漏补只会回到旧行为,不会破坏既有调用)。
68
+ *
69
+ * D1(R278 拍板):`--json` 也在这张表里。它在**大多数**命令里是布尔「输出 JSON」
70
+ * 开关,但在 `acf app create|patch --json <body>`(`apps.ts:211`/`:312`,已挂
71
+ * DEPRECATED,下一 major 收敛为布尔)里是**载荷**别名 —— 旧行为会把
72
+ * `--json '{"name":"x"}'` 当成「要 JSON 输出模式」,整条 CLI 的错误面翻成 JSON。
73
+ * 因为同一个 token 有两种语义,这里配一条**反向判据**(见 `looksLikeJsonPayload`):
74
+ * 只有后继 token 确实是 JSON 载荷时才把它当取值跳过,否则仍按开关处理。
68
75
  */
69
76
  const VALUE_TAKING_OPTIONS = new Set([
70
77
  '-a', '-e', '-f', '-k', '-m', '-n', '-o', '-p', '-s',
71
78
  '--action', '--api-url', '--application', '--body', '--code',
72
79
  '--description', '--end-time', '--env', '--executor', '--executors',
73
- '--file', '--from-line', '--ids', '--kind', '--keyword', '--language',
80
+ '--file', '--from-line', '--ids', '--json', '--kind', '--keyword', '--language',
74
81
  '--limit', '--name', '--note', '--output', '--page', '--page-size',
75
82
  '--params', '--password', '--reason', '--resource', '--runtime', '--scope',
76
83
  '--search', '--start-command', '--start-time', '--status', '--strategy',
@@ -87,6 +94,13 @@ const VALUE_TAKING_OPTIONS = new Set([
87
94
  * P3(本轮):只认**独立选项 token**——① `--opt=value` 是单 token 形态(值不
88
95
  * 会独立成 token,`--json=false` 也因此保持既有「非 JSON 模式」语义);② 取
89
96
  * 值型选项后面的那个 token 是值,跳过。
97
+ *
98
+ * D1(R278):`--json` 是**唯一双义**的取值型选项 —— 它既是「输出 JSON」的布尔
99
+ * 开关,又是 `acf app create|patch --json <body>` 的载荷别名(DEPRECATED)。
100
+ * 故此处对它多判一步:后继 token **不是** JSON 载荷形态(`{…}` / `[…]`)时按开关
101
+ * 处理(返回 true),是载荷形态时按取值处理(跳过、不算 JSON 输出模式)。
102
+ * 反证:去掉这条分支(对 `--json` 无条件跳过)= 回到「`acf task list --json` 也
103
+ * 判成非 JSON 模式」的旧 bug;改成无条件当开关 = D1 要修的那种环境污染。
90
104
  */
91
105
  export function isJsonInvocation(argv = process.argv) {
92
106
  const args = argv.slice(2);
@@ -95,6 +109,9 @@ export function isJsonInvocation(argv = process.argv) {
95
109
  if (token.includes('='))
96
110
  continue;
97
111
  if (VALUE_TAKING_OPTIONS.has(token)) {
112
+ // `--json` 后跟 JSON 载荷 ⇒ 这是取值;否则它是布尔开关(见函数头注)。
113
+ if (token === '--json' && !looksLikeJsonPayload(args[i + 1]))
114
+ return true;
98
115
  i += 1; // 跳过该选项的值(即便它字面量是 "--json")
99
116
  continue;
100
117
  }
@@ -103,6 +120,21 @@ export function isJsonInvocation(argv = process.argv) {
103
120
  }
104
121
  return false;
105
122
  }
123
+ /**
124
+ * `--json` 的后继 token 是不是一段**字面量 JSON 载荷**(`{…}` / `[…]`)。
125
+ *
126
+ * 判据刻意取「首尾括号成对」而不是 `JSON.parse`:这是**探针**,不是校验器——
127
+ * 载荷非法时命令自己会以用法错误(码 2)退出,此处只需区分「这段是值」与
128
+ * 「这段是下一个选项/位置参数」。用 JSON.parse 会让 `--json '{坏}'` 落回
129
+ * 「输出 JSON 模式」,恰好是 D1 要消灭的那种误判。
130
+ */
131
+ function looksLikeJsonPayload(token) {
132
+ if (token === undefined)
133
+ return false;
134
+ const t = token.trim();
135
+ return ((t.startsWith('{') && t.endsWith('}')) ||
136
+ (t.startsWith('[') && t.endsWith(']')));
137
+ }
106
138
  /**
107
139
  * 把一行文本**同步**写到 stderr(fd 2,短写自动续写)。
108
140
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autocodeflow/cli",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "AutoCodeFlow CLI — manage tasks, executions and applications from the terminal",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -29,10 +29,10 @@
29
29
  "lint": "eslint src"
30
30
  },
31
31
  "dependencies": {
32
- "axios": "1.21.0",
32
+ "axios": "1.21.1",
33
33
  "chalk": "^6.0.0",
34
34
  "cli-table3": "0.6.5",
35
- "commander": "15.0.0",
35
+ "commander": "15.1.0",
36
36
  "conf": "^15.1.0",
37
37
  "ora": "^10.0.0"
38
38
  },
@@ -50,6 +50,7 @@
50
50
  "_comment_deps": "版本基线(2026-09 依赖审计 + ESM 迁移):本包为 ESM(type: module,NodeNext 产出)。commander 15 / chalk 6 / ora 9 / conf 15 均为 npm 最新;chalk 6 要求 Node >=22,engines 相应抬至 >=22.12.0(commander 15 同要求)。conf 15 保留 configFileMode/defaults/cwd 语义(config.ts 凭据文件 0600 权限与用户目录布局不变)。",
51
51
  "type": "module",
52
52
  "overrides": {
53
- "follow-redirects": "^1.16.2"
53
+ "follow-redirects": "^1.16.2",
54
+ "minimatch": "^11.0.1"
54
55
  }
55
56
  }