ai-project-manage-cli 4.0.12 → 4.0.14

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/dist/index.js CHANGED
@@ -164,7 +164,11 @@ var requestConfig = {
164
164
  method: "POST",
165
165
  path: "/space-workflows/ai-confirm-node"
166
166
  }
167
- )
167
+ ),
168
+ aiFailNode: defineEndpoint({
169
+ method: "POST",
170
+ path: "/space-workflows/ai-fail-node"
171
+ })
168
172
  }
169
173
  };
170
174
 
@@ -247,11 +251,9 @@ var KIND_MAP = {
247
251
  clarify: "CLARIFY",
248
252
  difficulty: "DIFFICULTY",
249
253
  business: "BUSINESS",
250
- coordination: "COORDINATION",
251
254
  CLARIFY: "CLARIFY",
252
255
  DIFFICULTY: "DIFFICULTY",
253
- BUSINESS: "BUSINESS",
254
- COORDINATION: "COORDINATION"
256
+ BUSINESS: "BUSINESS"
255
257
  };
256
258
  var STANCE_VALUES = /* @__PURE__ */ new Set(["frontend", "backend", "fullstack"]);
257
259
  function asRecord(value) {
@@ -273,8 +275,13 @@ function parseKind(raw, index) {
273
275
  const key = String(raw ?? "").trim();
274
276
  const kind = KIND_MAP[key] ?? KIND_MAP[key.toLowerCase()];
275
277
  if (!kind) {
278
+ if (key.toLowerCase() === "coordination" || key === "COORDINATION") {
279
+ throw new Error(
280
+ `items[${index}].kind \u4E0D\u518D\u652F\u6301 coordination\uFF08\u8054\u8C03\u4F9D\u8D56\uFF09\uFF1B\u8BF7\u52FF\u8F93\u51FA\u63A5\u53E3/\u8054\u8C03\u7C7B\u8BC4\u5BA1\u6761\u76EE`
281
+ );
282
+ }
276
283
  throw new Error(
277
- `items[${index}].kind \u65E0\u6548\uFF0C\u5E94\u4E3A clarify | difficulty | business | coordination`
284
+ `items[${index}].kind \u65E0\u6548\uFF0C\u5E94\u4E3A clarify | difficulty | business`
278
285
  );
279
286
  }
280
287
  return kind;
@@ -307,9 +314,6 @@ function parseStructuredReviewYaml(raw, cliModel) {
307
314
  if (!body) {
308
315
  throw new Error(`items[${index}].body \u4E0D\u80FD\u4E3A\u7A7A`);
309
316
  }
310
- if (kind === "COORDINATION" && item.reply != null && String(item.reply).trim()) {
311
- throw new Error(`items[${index}] \u8054\u8C03\u4F9D\u8D56\uFF08coordination\uFF09\u4E0D\u5141\u8BB8 reply`);
312
- }
313
317
  return {
314
318
  startLine: anchor.start,
315
319
  endLine: anchor.end,
@@ -837,13 +841,19 @@ function runConnect(opts) {
837
841
  });
838
842
  const session = new EventSession(payload.prompt);
839
843
  const run = await agent.send(payload.prompt);
844
+ let agentRunFailed = false;
845
+ let agentFailReason = "";
840
846
  for await (const event of run.stream()) {
841
847
  if (event.type === "status") {
842
848
  console.log(`[Status]`, event.message || event.status);
843
849
  if (event.status === "ERROR") {
844
- console.log("===============================================");
845
- console.log(JSON.stringify(event, null, 2));
846
- console.log("===============================================");
850
+ agentRunFailed = true;
851
+ agentFailReason = event.message?.trim() ?? "";
852
+ console.error(
853
+ "[apm] Agent \u6267\u884C\u5931\u8D25:",
854
+ agentFailReason || "(\u65E0\u5931\u8D25\u539F\u56E0)"
855
+ );
856
+ break;
847
857
  }
848
858
  continue;
849
859
  }
@@ -881,8 +891,17 @@ function runConnect(opts) {
881
891
  requirementId: payload.requirementId,
882
892
  status: "IDLE"
883
893
  });
884
- console.log("[Done]");
885
894
  session.writeToFile(payload.cwd, payload.requirementId, run.agentId);
895
+ if (agentRunFailed) {
896
+ const failResult = await api.spaceWorkflow.aiFailNode({
897
+ requirementId: payload.requirementId,
898
+ nodeId: payload.nodeId,
899
+ error: agentFailReason
900
+ });
901
+ console.log("[apm] \u5DE5\u4F5C\u6D41\u8282\u70B9\u72B6\u6001:", failResult.nodeStatus);
902
+ return;
903
+ }
904
+ console.log("[Done]");
886
905
  try {
887
906
  await runUploadArtifact(payload.requirementId, apmRoot);
888
907
  } catch (pullErr) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "4.0.12",
3
+ "version": "4.0.14",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,
@@ -39,7 +39,7 @@ description: 根据需求 ID 读取 prd.md 与 reviews.xml,润色为简短、
39
39
  | 属性 / 节点 | 含义 |
40
40
  | --------------- | --------------------------------------------------------------------------------------- |
41
41
  | `start` / `end` | 锚定 `prd.md` 行号(1-based,闭区间),合并时优先据此定位段落 |
42
- | `kind` | `clarify` / `difficulty` / `business` / `coordination`;**仅处理含非空 `reply` 的条目** |
42
+ | `kind` | `clarify` / `difficulty` / `business`;**仅处理含非空 `reply` 的条目**(历史 `coordination` reply,忽略) |
43
43
  | `body` | 评审意见(辅助理解,不作为正文来源) |
44
44
  | `reply` | 产品回复,**并入正文**的权威补充 |
45
45
 
@@ -47,7 +47,7 @@ description: 根据需求 ID 读取 prd.md 与 reviews.xml,润色为简短、
47
47
 
48
48
  1. **正文 = 需求原文 + 已拍板补充**:将各 `<item>` 中非空 `reply` 并入 `prd.md` 对应行区间(或该行所在需求点);未回复的评审本次不处理。
49
49
  2. **定位**:优先按 `start`–`end` 行号找到段落;行号区间与章节标题不一致时,以**业务语义**归入最近的需求点,**不要**机械插入到错误章节。
50
- 3. **冲突**:`reply` 与原文冲突时以 `reply` 为准;`coordination` 类条目通常无 `reply`,润色时忽略。
50
+ 3. **冲突**:`reply` 与原文冲突时以 `reply` 为准;无 `reply` 的条目(含历史联调类)润色时忽略。
51
51
  4. **同一议题只写一处**;合并后篇幅短于或接近原文。
52
52
  5. **图片**:原文图片语法原样保留;理解图片后把规则写入对应需求点的文字描述。
53
53
 
@@ -31,7 +31,7 @@ description: 结合本仓库上下文对需求做结构化评审,只有当用
31
31
 
32
32
  **去重规则**(按立场选用):
33
33
 
34
- - **前端立场**:只写界面与交互侧待澄清,不写落库/API 契约类问题(联调诉求用 `kind: coordination`)。
34
+ - **前端立场**:只写界面与交互侧待澄清,不写落库/API 契约类问题。
35
35
  - **后端立场**:只写流程、规则与数据侧待澄清,不写控件选型、Tab 布局等纯 UI 问题。
36
36
  - **全栈立场**:同一业务点合并为一条 `clarify`,**不要**拆成两句意思重复的问题。
37
37
 
@@ -42,15 +42,25 @@ description: 结合本仓库上下文对需求做结构化评审,只有当用
42
42
  3. **锚定 PRD**:每条 `items[]` 必须写 **`anchor: { start, end }`**,与 Read 读到的 `prd.md` 行号一致;**不**在 `body` 里复述该段需求原文。
43
43
  4. **问题 = 文档缺口**:只写 PRD **未写清**且**影响本端理解边界**的点。已写清楚的规则不要重复质疑。
44
44
 
45
- ## 不在「待澄清」里写的内容
45
+ ## 禁止输出的内容(不要写入 items)
46
46
 
47
- 以下不得使用 `kind: clarify`,若需记录则用 **`kind: coordination`**(且必须有行号锚定):
47
+ 以下内容**一律跳过**,不得创建任何评审条目(**禁止**使用已废弃的 `coordination` 类型):
48
48
 
49
- - 接口字段名、请求体结构、子表编码
50
- - 前后端谁传哪个参数、现有 edit 接口是否够用
51
- - 与现网代码实现对齐的改造方案
49
+ - 接口字段名、请求体结构、子表编码、API 路径
50
+ - 前后端谁传哪个参数、与现网实现对齐的改造方案
51
+ - 「联调依赖」「需与后端/前端对齐接口」类事项
52
52
 
53
- `coordination` **不用产品回复**,仅作记录,待技术评审阶段处理。若同一行区间既要澄清又要联调,**拆成两条** `items`。
53
+ 上述问题属于**技术评审**范畴,由研发在技术评审阶段处理,本产品评审只面向产品经理可回答的业务澄清。
54
+
55
+ ## 允许的 kind
56
+
57
+ 仅可使用以下三种(YAML 小写):
58
+
59
+ | `kind` | 含义 | 何时使用 |
60
+ | ------------ | ---------- | -------------------------------- |
61
+ | `clarify` | 待澄清 | 文档未写清、影响本端理解边界 |
62
+ | `difficulty` | 实现难度高 | 仅改造面大或业务逻辑影响大时 |
63
+ | `business` | 业务合理性 | 仅方案与业务目标明显冲突或非较优 |
54
64
 
55
65
  ## 评审原则
56
66
 
@@ -75,14 +85,14 @@ description: 结合本仓库上下文对需求做结构化评审,只有当用
75
85
  ### 步骤 3:评审与提交
76
86
 
77
87
  1. **锁定立场**,填入 YAML `reviewer.stance`(`frontend` / `backend` / `fullstack`)。
78
- 2. **拆条**:每条对应 `prd.md` 连续行号;按需设置 `kind`(`clarify` / `difficulty` / `business` / `coordination`)与 `body`。
88
+ 2. **拆条**:每条对应 `prd.md` 连续行号;按需设置 `kind`(`clarify` / `difficulty` / `business`)与 `body`。
79
89
  3. **成文**:按 **[output-template.md](./output-template.md)** 写 YAML。
80
90
  4. 使用 **Write** 写入临时文件(建议 `/tmp/apm-review-<需求ID>.yaml`)。
81
91
  5. **自检**:
82
92
  - 每条均有 `anchor`,且无全篇评审;
83
93
  - `stance` 与立场一致;
84
94
  - `clarify` 均为产品可回答的业务问题;
85
- - `coordination` `reply` 字段;
95
+ - **未**出现 `coordination` 或联调/API 契约类条目;
86
96
  - 无重复语义的条目。
87
97
  6. 在项目根目录执行:
88
98
 
@@ -29,11 +29,6 @@ items:
29
29
  kind: difficulty
30
30
  body: |
31
31
  - 用产品语言说明改造面:涉及哪些页面/流程/规则,为何面大
32
-
33
- - anchor: { start: 44, end: 55 }
34
- kind: coordination
35
- body: |
36
- - 需与后端对齐的接口/字段诉求(不用产品回复)
37
32
  ```
38
33
 
39
34
  ## kind 与技能表述
@@ -43,17 +38,18 @@ items:
43
38
  | `clarify` | 待澄清 | 文档未写清、影响本端理解边界 |
44
39
  | `difficulty` | 实现难度高 | 仅改造面大或业务逻辑影响大时 |
45
40
  | `business` | 业务合理性 | 仅方案明显不合理时 |
46
- | `coordination` | 联调依赖 | **禁止** `reply`;待技术评审 |
41
+
42
+ **禁止**使用 `coordination`(联调依赖已废弃):接口/联调类事项不要写入评审。
47
43
 
48
44
  ## 字段规则
49
45
 
50
- | 字段 | 规则 |
51
- | ----------------- | ---------------------------------------------------------------- |
52
- | `reviewer.stance` | 必填:`frontend` / `backend` / `fullstack` |
53
- | `reviewer.model` | 建议填写;可被 CLI `--model` 覆盖 |
46
+ | 字段 | 规则 |
47
+ | ----------------- | ---------------------------------------------------------- |
48
+ | `reviewer.stance` | 必填:`frontend` / `backend` / `fullstack` |
49
+ | `reviewer.model` | 建议填写;可被 CLI `--model` 覆盖 |
54
50
  | `anchor` | 必填 `{ start, end }`,1-based 闭区间,与 Read `prd.md` 行号一致 |
55
- | `body` | 必填;产品语言;**禁止**全篇评审(必须有行号) |
56
- | 同区间多类型 | 拆成多条 `items`(例如同时 `clarify` 与 `coordination` 各一条) |
51
+ | `body` | 必填;产品语言;**禁止**全篇评审(必须有行号) |
52
+ | 同区间多类型 | 可拆成多条 `items`(例如同时 `clarify` 与 `difficulty`) |
57
53
 
58
54
  ## 提交命令
59
55