@dtt_siye/atool 1.3.0 → 1.4.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 (47) hide show
  1. package/VERSION +1 -1
  2. package/hooks/doc-sync-reminder +4 -4
  3. package/hooks/hooks-cursor.json +20 -0
  4. package/hooks/hooks.json +21 -1
  5. package/hooks/pre-commit +191 -0
  6. package/hooks/prompt-guard +84 -35
  7. package/hooks/session-start +34 -12
  8. package/hooks/task-state-tracker +145 -0
  9. package/lib/common.sh +36 -23
  10. package/lib/compute-importance.sh +73 -0
  11. package/lib/install-cursor.sh +2 -2
  12. package/lib/install-hooks.sh +64 -0
  13. package/lib/install-skills.sh +19 -0
  14. package/lib/knowledge-graph.sh +483 -81
  15. package/lib/pre-scan.sh +81 -6
  16. package/package.json +1 -1
  17. package/skills/agent-audit/SKILL.md +180 -0
  18. package/skills/architecture-guard/SKILL.md +164 -0
  19. package/skills/architecture-guard/rules/violation-detection.md +90 -0
  20. package/skills/ci-feedback/SKILL.md +165 -0
  21. package/skills/project-analyze/SKILL.md +131 -23
  22. package/skills/project-analyze/phases/phase1-setup.md +15 -1
  23. package/skills/project-analyze/phases/phase2-understand.md +17 -2
  24. package/skills/project-analyze/phases/phase2.5-refine.md +293 -0
  25. package/skills/project-analyze/phases/phase3-graph.md +7 -1
  26. package/skills/project-analyze/phases/phase4-synthesize.md +117 -120
  27. package/skills/project-analyze/phases/phase5-export.md +117 -33
  28. package/skills/project-analyze/prompts/understand-agent.md +17 -0
  29. package/skills/project-analyze/rules/android.md +61 -260
  30. package/skills/project-analyze/rules/devops.md +61 -421
  31. package/skills/project-analyze/rules/generic.md +53 -221
  32. package/skills/project-analyze/rules/go.md +60 -275
  33. package/skills/project-analyze/rules/harmony.md +64 -237
  34. package/skills/project-analyze/rules/java.md +47 -485
  35. package/skills/project-analyze/rules/mobile-flutter.md +57 -292
  36. package/skills/project-analyze/rules/mobile-react-native.md +65 -262
  37. package/skills/project-analyze/rules/mobile-swift.md +58 -303
  38. package/skills/project-analyze/rules/python.md +50 -296
  39. package/skills/project-analyze/rules/rust-tauri.md +51 -217
  40. package/skills/project-analyze/rules/rust.md +50 -274
  41. package/skills/project-analyze/rules/web-nextjs.md +61 -335
  42. package/skills/project-analyze/rules/web-react.md +50 -272
  43. package/skills/project-analyze/rules/web-vue.md +58 -352
  44. package/skills/project-analyze/rules/web.md +55 -347
  45. package/skills/project-query/SKILL.md +681 -120
  46. package/skills/requirements-writer/SKILL.md +48 -1
  47. package/skills/software-architecture/SKILL.md +73 -3
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: ci-feedback
3
+ description: "Use after modifying source files to run local build/test and get automated feedback. 在修改源码后使用 — 运行本地构建/测试获取自动化反馈,失败时自动进入调试流程."
4
+ version: 0.1.0
5
+ category: quality
6
+ ---
7
+
8
+ # CI Feedback — Local Build & Test Automation
9
+
10
+ Automatically runs project build and test commands, parses results, and feeds them back into the AI workflow. Creates a tight feedback loop without requiring CI/CD infrastructure.
11
+
12
+ ## When to Use
13
+
14
+ - After modifying source files (auto-suggested by doc-sync-reminder or task-state-tracker)
15
+ - Before claiming a task complete (invoked by verification-before-completion)
16
+ - When the user says "run the tests" or "check if it builds"
17
+ - When debugging (auto-triggered by systematic-debugging after fix attempts)
18
+
19
+ ## How It Works
20
+
21
+ ### Step 1: Detect Build Commands
22
+
23
+ Read build/test commands from the project's CLAUDE.md `## Build & Run` section. If not found, auto-detect from project files:
24
+
25
+ | Project File | Build Command | Test Command |
26
+ |-------------|---------------|--------------|
27
+ | `pom.xml` | `mvn compile -q` | `mvn test -q` |
28
+ | `build.gradle` / `build.gradle.kts` | `gradle compileJava` | `gradle test` |
29
+ | `package.json` | `npm run build` | `npm test` |
30
+ | `Cargo.toml` | `cargo build` | `cargo test` |
31
+ | `go.mod` | `go build ./...` | `go test ./...` |
32
+ | `pyproject.toml` / `setup.py` | `python -m compileall .` | `pytest` |
33
+ | `pubspec.yaml` | `flutter build` | `flutter test` |
34
+ | `Makefile` | `make build` | `make test` |
35
+
36
+ ### Step 2: Run Build
37
+
38
+ Execute the build command and capture:
39
+ - Exit code (0 = success)
40
+ - stdout (warnings)
41
+ - stderr (errors)
42
+
43
+ ```
44
+ Build Result:
45
+ - Status: PASS / FAIL
46
+ - Duration: {time}
47
+ - Warnings: {count} (list if < 10)
48
+ - Errors: {count} (list all)
49
+ ```
50
+
51
+ If build FAILS → go to Step 4 (Auto-debug).
52
+
53
+ ### Step 3: Run Tests
54
+
55
+ Execute the test command and capture:
56
+ - Exit code
57
+ - Test summary (passed/failed/skipped)
58
+ - Specific failure details
59
+
60
+ ```
61
+ Test Result:
62
+ - Status: PASS / FAIL
63
+ - Tests: {passed} passed, {failed} failed, {skipped} skipped
64
+ - Duration: {time}
65
+ - Failures:
66
+ - {test_name}: {error_message} (file:line)
67
+ ```
68
+
69
+ If tests FAIL → go to Step 4 (Auto-debug).
70
+
71
+ ### Step 4: Auto-debug on Failure
72
+
73
+ When build or tests fail:
74
+
75
+ 1. **Parse the error output** — extract file paths, line numbers, error messages
76
+ 2. **Classify the error**:
77
+ - Compilation error → syntax/type mismatch
78
+ - Test assertion → logic error
79
+ - Missing dependency → configuration error
80
+ - Timeout → performance issue
81
+ 3. **Invoke /systematic-debugging workflow**:
82
+ - Identify root cause (NOT symptoms)
83
+ - Propose targeted fix
84
+ - Re-run only the failed tests (if possible)
85
+ 4. **Track in task-state.json**:
86
+ ```json
87
+ {
88
+ "last_build_status": "FAIL",
89
+ "last_build_errors": 2,
90
+ "auto_debug_attempts": 1,
91
+ "pending_actions": ["fix_build_error", "update_docs"]
92
+ }
93
+ ```
94
+
95
+ ### Step 5: Update Task State
96
+
97
+ On success, update `.claude/task-state.json`:
98
+ ```json
99
+ {
100
+ "verification_passed": true,
101
+ "last_build_status": "PASS",
102
+ "last_test_status": "PASS",
103
+ "pending_actions": ["update_docs"]
104
+ }
105
+ ```
106
+
107
+ On failure, the state tracks retry attempts and remaining errors.
108
+
109
+ ## Integration Points
110
+
111
+ ### With task-state-tracker
112
+ Reads `.claude/task-state.json` to know which files were modified, then runs targeted tests if the framework supports it.
113
+
114
+ ### With verification-before-completion
115
+ `/verification-before-completion` invokes ci-feedback as part of its gate check: "tests pass" is a hard requirement.
116
+
117
+ ### With systematic-debugging
118
+ On build/test failure, automatically enters the systematic-debugging workflow rather than blindly retrying.
119
+
120
+ ### With architecture-guard
121
+ After a successful build, optionally runs architecture-guard to check for structural violations.
122
+
123
+ ## Output Format
124
+
125
+ ```
126
+ ## CI Feedback Report
127
+
128
+ ### Build
129
+ | Metric | Value |
130
+ |--------|-------|
131
+ | Status | PASS |
132
+ | Duration | 3.2s |
133
+ | Warnings | 1 (unused import in UserService.java) |
134
+
135
+ ### Tests
136
+ | Metric | Value |
137
+ |--------|-------|
138
+ | Status | PASS |
139
+ | Total | 47 |
140
+ | Passed | 47 |
141
+ | Failed | 0 |
142
+ | Duration | 12.5s |
143
+
144
+ ### Summary
145
+ All checks passed. Task state updated.
146
+ Remaining: update docs before completion.
147
+ ```
148
+
149
+ ## Retry Strategy
150
+
151
+ When auto-debugging:
152
+ 1. Fix the identified root cause
153
+ 2. Re-run ONLY the failing tests (if framework supports file-specific tests)
154
+ 3. If fix introduces new failures → stop and report to user
155
+ 4. Maximum 3 auto-debug cycles before escalating to user
156
+
157
+ ## Skill 协作
158
+
159
+ | 协作 Skill | 触发条件 | 交互方式 |
160
+ |-----------|---------|---------|
161
+ | verification-before-completion | Before claiming done | 作为验证步骤执行构建+测试 |
162
+ | systematic-debugging | Build/test failure | 自动进入调试流程 |
163
+ | task-state-tracker | State file available | 读取修改文件列表,更新验证状态 |
164
+ | architecture-guard | Build success | 可选执行架构检查 |
165
+ | {stack}-conventions | Test framework detection | 使用栈级测试命令 |
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: project-analyze
3
3
  description: "Deep project analysis v5.0 — 7-phase pipeline with five-dimensional analysis framework, 14 node types, 24 edge types, 5-level granularity zooming, interactive visualization (Cytoscape.js), and query system. 5 depth levels (L1-L5): Discovery → Pre-Scan → Inventory → Deep Analysis → Knowledge Graph → Multi-Dimensional Analysis → Code Quality → Document Synthesis → Validation. Checkpoint/resume, incremental docs, large-module decomposition. Zero-KT standard, Chinese output. 触发:分析项目/生成文档/analyze project/generate docs/project analysis"
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  ---
6
6
 
7
7
  # Project Analyzer v5.0
@@ -75,14 +75,15 @@ Pipeline 中 AI 与 bash 工具的分工遵循核心原则:**确定性操作
75
75
 
76
76
  ## Pipeline Controller
77
77
 
78
- ### 5-Phase 架构
78
+ ### 6-Phase 架构
79
79
 
80
80
  ```
81
81
  Phase 1: SETUP → phases/phase1-setup.md (bash only, no AI, ~30秒)
82
82
  Phase 2: UNDERSTAND → phases/phase2-understand.md (AI sub-agents ≤5并行)
83
+ Phase 2.5: REFINE → phases/phase2.5-refine.md (AI sub-agents ≤5并行,串联 requirements-writer + software-architecture Refine Mode)
83
84
  Phase 3: GRAPH → phases/phase3-graph.md (bash only, no AI, ~30秒)
84
- Phase 4: SYNTHESIZE → phases/phase4-synthesize.md (main agent + sub-agents)
85
- Phase 5: EXPORT → phases/phase5-export.md (bash only, no AI, ~10秒)
85
+ Phase 4: SYNTHESIZE → phases/phase4-synthesize.md (main agent, 聚合模式)
86
+ Phase 5: EXPORT → phases/phase5-export.md (bash + AI, export 单文件)
86
87
  ```
87
88
 
88
89
  ### 执行规则(硬性)
@@ -93,30 +94,52 @@ Phase 5: EXPORT → phases/phase5-export.md (bash only, no AI, ~10秒)
93
94
  4. **Phase 2 并发上限 5 个 sub-agent**,超出部分按 importance 降序分批排队
94
95
  5. **Phase 3 bash 调用失败时**:在 state.json 记录 `phase3_graph: "failed"`,继续 Phase 4(跳过图谱相关文档,Phase 4 检查此标记)
95
96
  6. **断点续传**:先读 state.json,跳过 `status: "completed"` 的 phase
97
+ 7. **Phase 2.5 参数识别**(无需 bash 解析,直接在用户消息中匹配):
98
+ - `--skip-refine`:用户消息中包含此字符串 → Phase 2.5 标记为 "skipped",跳过精炼链,直进 Phase 3
99
+ - `--refine-threshold N`:用户消息中包含此模式 → 提取 N 作为 Gate 1/2/3 门禁阈值(默认 70)
100
+ - 例:用户说"分析项目 --skip-refine"→ 立即检测到 --skip-refine 字符串,跳过 Phase 2.5
96
101
 
97
102
  ### 状态管理(简化版)
98
103
 
99
104
  `analysis-state.json` 最小结构:
100
- ```json
105
+ ```jsonc
101
106
  {
102
- "version": "5.1",
103
- "project_root": "/path/to/project",
107
+ "version": "5.2.0",
108
+ "project": "...",
109
+ "project_root": "...",
104
110
  "stack": "java-spring",
105
111
  "depth": "L2",
106
- "scale": "MEDIUM",
107
- "modules": ["user-service", "order-service"],
108
112
  "phases": {
109
113
  "phase1_setup": "completed",
110
114
  "phase2_understand": "in_progress",
115
+ "phase2_5_refine": "pending",
111
116
  "phase3_graph": "pending",
112
117
  "phase4_synthesize": "pending",
113
118
  "phase5_export": "pending"
114
119
  },
115
120
  "module_status": {
116
- "user-service": { "phase2": "completed" },
117
- "order-service": { "phase2": "in_progress" }
121
+ "{slug}": {
122
+ "phase2": "completed|in_progress|pending",
123
+ "assigned_to": "sub-agent-id"
124
+ }
118
125
  },
119
- "updated_at": "2026-04-04T10:00:00Z"
126
+ "refine_status": {
127
+ "{slug}": {
128
+ "prd_refine": "completed|in_progress|pending",
129
+ "prd_coverage": 82,
130
+ "prd_gate": "passed|failed",
131
+ "arch_refine": "completed|in_progress|pending|skipped",
132
+ "arch_gate": "passed|failed",
133
+ "conventions_loaded": "java-conventions",
134
+ "degraded": false,
135
+ "degraded_reason": null
136
+ }
137
+ },
138
+ "deliverable_status": {
139
+ "project_deliverable_md": "pending",
140
+ "export_single_file": "pending"
141
+ },
142
+ "errors": []
120
143
  }
121
144
  ```
122
145
 
@@ -175,16 +198,56 @@ state.checkpoint = { last_completed_phase, last_completed_module, next_pending_m
175
198
  write analysis-state.json
176
199
  ```
177
200
 
178
- ### Resume Flow
179
- 1. Read `.atool-docs/analysis-state.json`
180
- 2. If no state file → full analysis
181
- 3. If `phases.phase1_setup != "completed"` → execute Phase 1
182
- 4. Detect stale modules (file hash mismatch) → mark for re-analysis
183
- 5. Determine resume point from checkpoint
184
- 6. Execute pending phases, skip completed, rerun stale
185
- 7. Update final state
201
+ ### Resume Flow(断点恢复决策树)
202
+
203
+ **入口**:执行 Phase 1 setup 时自动检测恢复状态
204
+
205
+ ```
206
+ 1. 读取 .atool-docs/analysis-state.json(若不存在)
207
+ └─ 启动全新分析(fresh start)
208
+
209
+ 2. 存在 state.json
210
+ ├─ phases.phase1_setup != "completed"
211
+ │ └─ 执行 Phase 1(重新检测栈 / manifest / importance)
212
+
213
+ ├─ phases.phase1_setup == "completed"
214
+ │ ├─ 检查 phase2_understand 状态
215
+ │ │ ├─ "pending" → 执行 Phase 2(全部模块)
216
+ │ │ ├─ "in_progress" → 恢复到 Phase 2 中断位置(读 state.module_status,跳过已完成)
217
+ │ │ └─ "completed" → 进入 Phase 2.5
218
+ │ │
219
+ │ ├─ 检查 phase2_5_refine 状态
220
+ │ │ ├─ "pending" / "failed" → 执行 Phase 2.5(全部模块)
221
+ │ │ ├─ "in_progress" → 恢复精炼进度(读 state.refine_status,跳过已通过 Gate 3)
222
+ │ │ └─ "completed" / "skipped" → 进入 Phase 3
223
+ │ │
224
+ │ ├─ 检查 phase3_graph 状态
225
+ │ │ ├─ "pending" → 执行 Phase 3(知识图谱生成)
226
+ │ │ ├─ "in_progress" / "failed" → 重新执行 Phase 3
227
+ │ │ └─ "completed" → 进入 Phase 4
228
+ │ │
229
+ │ ├─ 检查 phase4_synthesize 状态
230
+ │ │ ├─ "pending" → 执行 Phase 4(聚合合成)
231
+ │ │ ├─ "in_progress" / "failed" → 重新执行 Phase 4
232
+ │ │ └─ "completed" → 进入 Phase 5
233
+ │ │
234
+ │ └─ 检查 phase5_export 状态
235
+ │ ├─ "pending" → 执行 Phase 5(最终导出)
236
+ │ ├─ "in_progress" / "failed" → 重新执行 Phase 5
237
+ │ └─ "completed" → 分析完成(可选重新导出)
238
+ ```
239
+
240
+ **断点恢复的具体判断**(在每个 Phase 入口执行):
241
+ - 若 phase 状态为 "completed" 且无 `--force`,**跳过该 phase**
242
+ - 若 phase 状态为 "in_progress"/"failed",**重新执行该 phase**(覆盖部分输出)
243
+ - 若 phase 状态为 "pending",**首次执行该 phase**
244
+
245
+ **文件变更检测**(Phase 2+ 的可选优化):
246
+ - 计算 project root 下所有源文件的 hash(与 manifest.json 对比)
247
+ - 若有新增/删除/修改的文件,标记对应模块为"需重新分析"
248
+ - 该模块在 Phase 2 中重新派发 sub-agent(即使之前已完成)
186
249
 
187
- Detailed resume logic: see `phases/phase1-setup.md`.
250
+ 详见各 Phase 的前置检查条款(phase1-setup.md → phase5-export.md)
188
251
 
189
252
  ### Incremental Document Recovery
190
253
  When resuming Phase 5, incrementally update already-generated documents using `<!-- aTool-module-start:{slug} -->` markers. Only regenerate changed modules.
@@ -255,6 +318,51 @@ When resuming Phase 5, incrementally update already-generated documents using `<
255
318
 
256
319
  ---
257
320
 
321
+ ## 调试指南(Debug Guide)
322
+
323
+ ### 查看当前分析状态
324
+ ```bash
325
+ cat .atool-docs/analysis-state.json | jq '.phases'
326
+ # 输出每个 Phase 的状态(completed/in_progress/failed/pending)
327
+ ```
328
+
329
+ ### 强制重新执行某个 Phase
330
+ ```bash
331
+ # 删除特定 Phase 的状态
332
+ jq '.phases.{phase_name} = "pending"' .atool-docs/analysis-state.json > .tmp && mv .tmp .atool-docs/analysis-state.json
333
+
334
+ # 示例:重新执行 Phase 2
335
+ jq '.phases.phase2_understand = "pending"' .atool-docs/analysis-state.json > .tmp && mv .tmp .atool-docs/analysis-state.json
336
+
337
+ # 重新触发分析
338
+ # 在对话中说:分析项目 (AI 会检测到 phase2_understand = "pending",重新执行)
339
+ ```
340
+
341
+ ### 完全重置分析(回到 Phase 1)
342
+ ```bash
343
+ rm -rf .atool-docs/
344
+ # 重新触发分析会从 Phase 1 开始
345
+ ```
346
+
347
+ ### 查看模块分析进度
348
+ ```bash
349
+ # 查看每个模块在 Phase 2 的状态
350
+ jq '.module_status' .atool-docs/analysis-state.json
351
+
352
+ # 查看 Phase 2.5 精炼进度
353
+ jq '.refine_status' .atool-docs/analysis-state.json
354
+ ```
355
+
356
+ ### 诊断常见问题
357
+ | 问题 | 诊断命令 | 解决方案 |
358
+ |------|---------|---------|
359
+ | 没有检测到模块 | `cat .atool-docs/pre-scan/manifest.json \| jq '.modules'` | 检查源文件格式或 detect-stack 规则 |
360
+ | phase3_graph 失败 | `cat .atool-docs/analysis-state.json \| jq '.phases.phase3_graph'` | 运行 `source lib/knowledge-graph.sh; assemble_enhanced_graph` 检查错误 |
361
+ | Sub-agent 无法读文件 | `cat .atool-docs/modules/{name}/data.json` | 检查 Phase 2 初稿是否生成 |
362
+ | 精炼 Gate 失败 | `cat atool-analysis/modules/{name}/prd.md \| wc -l` | PRD 文件小于 30 行,需要扩展初稿 |
363
+
364
+ ---
365
+
258
366
  ## Important Notes
259
367
 
260
368
  - Always check `.atool-docs/` before starting; offer incremental update if exists
@@ -275,10 +383,10 @@ When resuming Phase 5, incrementally update already-generated documents using `<
275
383
  | Collaborating Skill | Trigger Condition | Interaction |
276
384
  |---------------------|-------------------|-------------|
277
385
  | code-review | Phase 4 quality report generation | References rules/ files |
278
- | software-architecture | Phase 3 structural layer violation rate >30% | Suggest running |
386
+ | software-architecture | Phase 2.5 Refine Mode 调用;Phase 4 聚合时 layer_violations/total_edges > 30% 建议深度审查 | 精炼模式 + 建议运行 |
279
387
  | {stack}-conventions | Phase 2 module analysis | Load stack-level conventions |
280
388
  | doc-standards-enforcer | Phase 4 document generation | Validate frontmatter format |
281
389
  | smart-dispatch | LARGE/XLARGE projects | Batch parallel by module |
282
390
  | project-query | Need to query analysis results | User manually invokes /project-query |
283
- | requirements-writer | Phase 4 PRD 覆盖率 < 70% | 建议运行,自动进入后向增强模式读取 atool-analysis/ |
391
+ | requirements-writer | Phase 2.5 Refine Mode 调用;Phase 4 PRD 降级模块存在时建议补全 | 精炼模式 + 建议运行 |
284
392
  | clarify-before-build | Before Phase 1 user confirmation | Requirement clarification (auto-injected) |
@@ -155,7 +155,8 @@
155
155
  >
156
156
  > cat > "$DOCS_DIR/analysis-state.json" << STATEEOF
157
157
  > {
158
- > "version": "5.1",
158
+ > "version": "5.2.0",
159
+ > "project": "$(basename "$PROJECT_ROOT")",
159
160
  > "project_root": "$PROJECT_ROOT",
160
161
  > "stack": "$STACK",
161
162
  > "depth": "$DEPTH",
@@ -164,11 +165,14 @@
164
165
  > "phases": {
165
166
  > "phase1_setup": "completed",
166
167
  > "phase2_understand": "pending",
168
+ > "phase2_5_refine": "pending",
167
169
  > "phase3_graph": "pending",
168
170
  > "phase4_synthesize": "pending",
169
171
  > "phase5_export": "pending"
170
172
  > },
171
173
  > "module_status": $MODULE_STATUS,
174
+ > "refine_status": {},
175
+ > "deliverable_status": {},
172
176
  > "updated_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
173
177
  > }
174
178
  > STATEEOF
@@ -180,3 +184,13 @@
180
184
  - `.atool-docs/pre-scan/manifest.json` 存在(或 warning 已记录)
181
185
  - `.atool-docs/analysis-state.json` 已写入且 `phases.phase1_setup = "completed"`
182
186
  - 用户已确认分析深度
187
+
188
+ ## 故障排查(Troubleshooting)
189
+
190
+ | 症状 | 可能原因 | 解决方案 |
191
+ |------|---------|---------|
192
+ | pre-scan 超时(>2分钟) | 项目过大或网络配置问题 | 检查 PROJECT_ROOT,尝试指定具体子目录 |
193
+ | manifest.json 为空或缺数据 | 源文件识别失败 | 检查 PRESCAN_EXCLUDE_DIRS,确保源文件扩展名被识别 |
194
+ | state.json 初始化失败 | 目录权限问题 | 确保 ~/.atool-docs 目录可写 |
195
+ | detected_stack = "generic" | 技术栈检测失败 | 检查是否存在 package.json/pom.xml/go.mod 等 |
196
+ | 重复执行 Phase 1 | 上次中断或状态不清 | `rm -rf .atool-docs/analysis-state.json` 后重试 |
@@ -2,7 +2,16 @@
2
2
 
3
3
  **目标**:每个模块派发 1 个 sub-agent,产出三层文档(业务/技术/数据),直接写入 `atool-analysis/modules/`。
4
4
 
5
- **并发上限:5 个 sub-agent**
5
+ ---
6
+
7
+ ## IDE 适配(执行前检查)
8
+
9
+ - **Claude Code**:使用 Agent 工具批量派发,每批最多 5 个并行,等待全部完成后派发下一批
10
+ - **Cursor/其他**:**顺序执行**,按 importance 降序逐模块处理,每个模块完成后更新 state.json
11
+ - *原因*:Cursor 不支持并行 sub-agent,自动降级为逐个执行
12
+ - *判断方式*:若 Agent 工具不可用或不响应,自动切换到顺序模式
13
+
14
+ ---
6
15
 
7
16
  ## 前置检查
8
17
 
@@ -94,7 +103,13 @@ atool-analysis/modules/{module-name}/dev-guide.md # 层2c: 开发指引
94
103
  ## 完成条件
95
104
 
96
105
  - 所有模块的 `module_status.{slug}.phase2 == "completed"`
97
- - `atool-analysis/modules/*/README.md` 全部存在
106
+ - 每个模块至少 5/6 核心文件存在(data-model.md 可选):
107
+ - `atool-analysis/modules/*/README.md` ✓ 必须
108
+ - `atool-analysis/modules/*/api.md` ✓ 必须
109
+ - `atool-analysis/modules/*/dev-guide.md` ✓ 必须
110
+ - `atool-analysis/modules/*/prd.md` ✓ 必须
111
+ - `atool-analysis/modules/*/test-cases.md` ✓ 必须
112
+ - `atool-analysis/modules/*/data-model.md` ○ 可选(无实体时可不存在)
98
113
  - `.atool-docs/modules/*/data.json` 全部存在
99
114
  - 更新 state:`phases.phase2_understand = "completed"`
100
115