claude-code-workflow 6.3.4 → 6.3.6

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 (111) hide show
  1. package/.claude/agents/issue-plan-agent.md +859 -0
  2. package/.claude/agents/issue-queue-agent.md +702 -0
  3. package/.claude/commands/issue/execute.md +453 -0
  4. package/.claude/commands/issue/manage.md +865 -0
  5. package/.claude/commands/issue/new.md +484 -0
  6. package/.claude/commands/issue/plan.md +421 -0
  7. package/.claude/commands/issue/queue.md +354 -0
  8. package/.claude/commands/{clean.md → workflow/clean.md} +5 -5
  9. package/.claude/commands/workflow/docs/analyze.md +1467 -0
  10. package/.claude/commands/workflow/docs/copyright.md +1265 -0
  11. package/.claude/commands/workflow/execute.md +0 -1
  12. package/.claude/commands/workflow/tools/conflict-resolution.md +76 -240
  13. package/.claude/commands/workflow/tools/context-gather.md +0 -2
  14. package/.claude/commands/workflow/tools/task-generate-agent.md +81 -8
  15. package/.claude/commands/workflow/tools/task-generate-tdd.md +0 -9
  16. package/.claude/commands/workflow/tools/test-context-gather.md +2 -3
  17. package/.claude/commands/workflow/tools/test-task-generate.md +0 -2
  18. package/.claude/skills/_shared/mermaid-utils.md +584 -0
  19. package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +0 -2
  20. package/.claude/skills/command-guide/reference/commands/workflow/execute.md +1 -1
  21. package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +1 -2
  22. package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +1 -8
  23. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-context-gather.md +1 -4
  24. package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +0 -2
  25. package/.claude/skills/copyright-docs/SKILL.md +132 -0
  26. package/.claude/skills/copyright-docs/phases/01-metadata-collection.md +78 -0
  27. package/.claude/skills/copyright-docs/phases/01.5-project-exploration.md +150 -0
  28. package/.claude/skills/copyright-docs/phases/02-deep-analysis.md +664 -0
  29. package/.claude/skills/copyright-docs/phases/02.5-consolidation.md +192 -0
  30. package/.claude/skills/copyright-docs/phases/04-document-assembly.md +261 -0
  31. package/.claude/skills/copyright-docs/phases/05-compliance-refinement.md +192 -0
  32. package/.claude/skills/copyright-docs/specs/cpcc-requirements.md +121 -0
  33. package/.claude/skills/copyright-docs/templates/agent-base.md +200 -0
  34. package/.claude/skills/project-analyze/SKILL.md +162 -0
  35. package/.claude/skills/project-analyze/phases/01-requirements-discovery.md +79 -0
  36. package/.claude/skills/project-analyze/phases/02-project-exploration.md +176 -0
  37. package/.claude/skills/project-analyze/phases/03-deep-analysis.md +854 -0
  38. package/.claude/skills/project-analyze/phases/03.5-consolidation.md +233 -0
  39. package/.claude/skills/project-analyze/phases/04-report-generation.md +217 -0
  40. package/.claude/skills/project-analyze/phases/05-iterative-refinement.md +124 -0
  41. package/.claude/skills/project-analyze/specs/quality-standards.md +115 -0
  42. package/.claude/skills/project-analyze/specs/writing-style.md +152 -0
  43. package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +79 -65
  44. package/.claude/workflows/cli-templates/schemas/issue-task-jsonl-schema.json +136 -0
  45. package/.claude/workflows/cli-templates/schemas/issues-jsonl-schema.json +74 -0
  46. package/.claude/workflows/cli-templates/schemas/queue-schema.json +136 -0
  47. package/.claude/workflows/cli-templates/schemas/registry-schema.json +94 -0
  48. package/.claude/workflows/cli-templates/schemas/solution-schema.json +120 -0
  49. package/.claude/workflows/cli-templates/schemas/solutions-jsonl-schema.json +125 -0
  50. package/.codex/prompts/issue-execute.md +266 -0
  51. package/README.md +11 -1
  52. package/ccw/dist/cli.d.ts.map +1 -1
  53. package/ccw/dist/cli.js +25 -0
  54. package/ccw/dist/cli.js.map +1 -1
  55. package/ccw/dist/commands/cli.d.ts.map +1 -1
  56. package/ccw/dist/commands/cli.js +46 -8
  57. package/ccw/dist/commands/cli.js.map +1 -1
  58. package/ccw/dist/commands/issue.d.ts +21 -0
  59. package/ccw/dist/commands/issue.d.ts.map +1 -0
  60. package/ccw/dist/commands/issue.js +895 -0
  61. package/ccw/dist/commands/issue.js.map +1 -0
  62. package/ccw/dist/core/dashboard-generator-patch.js +1 -0
  63. package/ccw/dist/core/dashboard-generator-patch.js.map +1 -1
  64. package/ccw/dist/core/routes/cli-routes.js +2 -2
  65. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  66. package/ccw/dist/core/routes/issue-routes.d.ts +34 -0
  67. package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -0
  68. package/ccw/dist/core/routes/issue-routes.js +487 -0
  69. package/ccw/dist/core/routes/issue-routes.js.map +1 -0
  70. package/ccw/dist/core/server.d.ts.map +1 -1
  71. package/ccw/dist/core/server.js +17 -2
  72. package/ccw/dist/core/server.js.map +1 -1
  73. package/ccw/dist/tools/claude-cli-tools.d.ts +7 -3
  74. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  75. package/ccw/dist/tools/claude-cli-tools.js +31 -17
  76. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  77. package/ccw/dist/tools/smart-search.d.ts +25 -0
  78. package/ccw/dist/tools/smart-search.d.ts.map +1 -1
  79. package/ccw/dist/tools/smart-search.js +121 -17
  80. package/ccw/dist/tools/smart-search.js.map +1 -1
  81. package/ccw/src/cli.ts +26 -0
  82. package/ccw/src/commands/cli.ts +49 -7
  83. package/ccw/src/commands/issue.ts +1184 -0
  84. package/ccw/src/core/dashboard-generator-patch.ts +1 -0
  85. package/ccw/src/core/routes/cli-routes.ts +3 -3
  86. package/ccw/src/core/routes/issue-routes.ts +559 -0
  87. package/ccw/src/core/server.ts +17 -2
  88. package/ccw/src/templates/dashboard-css/32-issue-manager.css +2544 -0
  89. package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +467 -0
  90. package/ccw/src/templates/dashboard-js/components/cli-history.js +40 -13
  91. package/ccw/src/templates/dashboard-js/components/cli-status.js +26 -2
  92. package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +461 -0
  93. package/ccw/src/templates/dashboard-js/components/navigation.js +8 -0
  94. package/ccw/src/templates/dashboard-js/components/notifications.js +16 -0
  95. package/ccw/src/templates/dashboard-js/i18n.js +290 -2
  96. package/ccw/src/templates/dashboard-js/views/cli-manager.js +5 -0
  97. package/ccw/src/templates/dashboard-js/views/history.js +19 -4
  98. package/ccw/src/templates/dashboard-js/views/hook-manager.js +11 -5
  99. package/ccw/src/templates/dashboard-js/views/issue-manager.js +1546 -0
  100. package/ccw/src/templates/dashboard.html +55 -0
  101. package/ccw/src/tools/claude-cli-tools.ts +37 -20
  102. package/ccw/src/tools/smart-search.ts +157 -16
  103. package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
  104. package/codex-lens/src/codexlens/config.py +5 -0
  105. package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
  106. package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
  107. package/codex-lens/src/codexlens/search/hybrid_search.py +144 -11
  108. package/codex-lens/src/codexlens/search/ranking.py +267 -1
  109. package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
  110. package/codex-lens/src/codexlens/semantic/chunker.py +55 -10
  111. package/package.json +2 -2
@@ -0,0 +1,664 @@
1
+ # Phase 2: Deep Code Analysis
2
+
3
+ 6 个并行 Agent,各自直接写入 MD 章节文件。
4
+
5
+ > **模板参考**: [../templates/agent-base.md](../templates/agent-base.md)
6
+ > **规范参考**: [../specs/cpcc-requirements.md](../specs/cpcc-requirements.md)
7
+
8
+ ## Exploration → Agent 自动分配
9
+
10
+ 根据 Phase 1.5 生成的 exploration 文件名自动分配对应的 analysis agent。
11
+
12
+ ### 映射规则
13
+
14
+ ```javascript
15
+ // Exploration 角度 → Agent 映射(基于文件名识别,不读取内容)
16
+ const EXPLORATION_TO_AGENT = {
17
+ 'architecture': 'architecture',
18
+ 'commands': 'functions', // CLI 命令 → 功能模块
19
+ 'endpoints': 'interfaces', // API 端点 → 接口设计
20
+ 'algorithms': 'algorithms',
21
+ 'data-structures': 'data_structures',
22
+ 'dataflow': 'data_structures', // 数据流 → 数据结构
23
+ 'interfaces': 'interfaces',
24
+ 'exceptions': 'exceptions'
25
+ };
26
+
27
+ // 从文件名提取角度
28
+ function extractAngle(filename) {
29
+ // exploration-architecture.json → architecture
30
+ const match = filename.match(/exploration-(.+)\.json$/);
31
+ return match ? match[1] : null;
32
+ }
33
+
34
+ // 分配 agent
35
+ function assignAgent(explorationFile) {
36
+ const angle = extractAngle(path.basename(explorationFile));
37
+ return EXPLORATION_TO_AGENT[angle] || null;
38
+ }
39
+
40
+ // Agent 配置(用于 buildAgentPrompt)
41
+ const AGENT_CONFIGS = {
42
+ architecture: {
43
+ role: '系统架构师,专注于分层设计和模块依赖',
44
+ section: '2',
45
+ output: 'section-2-architecture.md',
46
+ focus: '分层结构、模块依赖、数据流向'
47
+ },
48
+ functions: {
49
+ role: '功能分析师,专注于功能点识别和交互',
50
+ section: '3',
51
+ output: 'section-3-functions.md',
52
+ focus: '功能点枚举、模块分组、入口文件、功能交互'
53
+ },
54
+ algorithms: {
55
+ role: '算法工程师,专注于核心逻辑和复杂度分析',
56
+ section: '4',
57
+ output: 'section-4-algorithms.md',
58
+ focus: '核心算法、流程步骤、复杂度、输入输出'
59
+ },
60
+ data_structures: {
61
+ role: '数据建模师,专注于实体关系和类型定义',
62
+ section: '5',
63
+ output: 'section-5-data-structures.md',
64
+ focus: '实体定义、属性类型、关系映射、枚举'
65
+ },
66
+ interfaces: {
67
+ role: 'API设计师,专注于接口契约和协议',
68
+ section: '6',
69
+ output: 'section-6-interfaces.md',
70
+ focus: 'API端点、参数校验、响应格式、时序'
71
+ },
72
+ exceptions: {
73
+ role: '可靠性工程师,专注于异常处理和恢复策略',
74
+ section: '7',
75
+ output: 'section-7-exceptions.md',
76
+ focus: '异常类型、错误码、处理模式、恢复策略'
77
+ }
78
+ };
79
+ ```
80
+
81
+ ### 自动发现与分配流程
82
+
83
+ ```javascript
84
+ // 1. 发现所有 exploration 文件(仅看文件名)
85
+ const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`)
86
+ .split('\n')
87
+ .filter(f => f.trim());
88
+
89
+ // 2. 按文件名自动分配 agent
90
+ const agentAssignments = explorationFiles.map(file => {
91
+ const angle = extractAngle(path.basename(file));
92
+ const agentName = EXPLORATION_TO_AGENT[angle];
93
+ return {
94
+ exploration_file: file,
95
+ angle: angle,
96
+ agent: agentName,
97
+ output_file: AGENT_CONFIGS[agentName]?.output
98
+ };
99
+ }).filter(a => a.agent);
100
+
101
+ // 3. 补充未被 exploration 覆盖的必需 agent(分配相关 exploration)
102
+ const coveredAgents = new Set(agentAssignments.map(a => a.agent));
103
+ const requiredAgents = ['architecture', 'functions', 'algorithms', 'data_structures', 'interfaces', 'exceptions'];
104
+ const missingAgents = requiredAgents.filter(a => !coveredAgents.has(a));
105
+
106
+ // 相关性映射:为缺失 agent 分配最相关的 exploration
107
+ const RELATED_EXPLORATIONS = {
108
+ architecture: ['architecture', 'dataflow', 'interfaces'],
109
+ functions: ['commands', 'endpoints', 'architecture'],
110
+ algorithms: ['algorithms', 'dataflow', 'architecture'],
111
+ data_structures: ['data-structures', 'dataflow', 'architecture'],
112
+ interfaces: ['interfaces', 'endpoints', 'architecture'],
113
+ exceptions: ['exceptions', 'algorithms', 'architecture']
114
+ };
115
+
116
+ function findRelatedExploration(agent, availableFiles) {
117
+ const preferences = RELATED_EXPLORATIONS[agent] || ['architecture'];
118
+ for (const pref of preferences) {
119
+ const match = availableFiles.find(f => f.includes(`exploration-${pref}.json`));
120
+ if (match) return { file: match, angle: pref, isRelated: true };
121
+ }
122
+ // 最后兜底:任意 exploration 都比没有强
123
+ return availableFiles.length > 0
124
+ ? { file: availableFiles[0], angle: extractAngle(path.basename(availableFiles[0])), isRelated: true }
125
+ : { file: null, angle: null, isRelated: false };
126
+ }
127
+
128
+ missingAgents.forEach(agent => {
129
+ const related = findRelatedExploration(agent, explorationFiles);
130
+ agentAssignments.push({
131
+ exploration_file: related.file,
132
+ angle: related.angle,
133
+ agent: agent,
134
+ output_file: AGENT_CONFIGS[agent].output,
135
+ is_related: related.isRelated // 标记为相关而非直接匹配
136
+ });
137
+ });
138
+
139
+ console.log(`
140
+ ## Agent Auto-Assignment
141
+
142
+ Found ${explorationFiles.length} exploration files:
143
+ ${agentAssignments.map(a => {
144
+ if (!a.exploration_file) return `- ${a.agent} agent (no exploration)`;
145
+ if (a.is_related) return `- ${a.agent} agent ← ${a.angle} (related)`;
146
+ return `- ${a.agent} agent ← ${a.angle} (direct)`;
147
+ }).join('\n')}
148
+ `);
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Agent 执行前置条件
154
+
155
+ **每个 Agent 接收 exploration 文件路径,自行读取内容**:
156
+
157
+ ```javascript
158
+ // Agent prompt 中包含文件路径
159
+ // Agent 启动后的操作顺序:
160
+ // 1. Read exploration 文件(如有)
161
+ // 2. Read CPCC 规范文件
162
+ // 3. 执行分析任务
163
+ ```
164
+
165
+ 规范文件路径(相对于 skill 根目录):
166
+ - `specs/cpcc-requirements.md` - CPCC 软著申请规范要求
167
+
168
+ ---
169
+
170
+ ## Agent 配置
171
+
172
+ | Agent | 输出文件 | 章节 |
173
+ |-------|----------|------|
174
+ | architecture | section-2-architecture.md | 系统架构图 |
175
+ | functions | section-3-functions.md | 功能模块设计 |
176
+ | algorithms | section-4-algorithms.md | 核心算法与流程 |
177
+ | data_structures | section-5-data-structures.md | 数据结构设计 |
178
+ | interfaces | section-6-interfaces.md | 接口设计 |
179
+ | exceptions | section-7-exceptions.md | 异常处理设计 |
180
+
181
+ ## CPCC 规范要点 (所有 Agent 共用)
182
+
183
+ ```
184
+ [CPCC_SPEC]
185
+ 1. 内容基于代码分析,无臆测或未来计划
186
+ 2. 图表编号格式: 图N-M (如图2-1, 图3-1)
187
+ 3. 每个子章节内容不少于100字
188
+ 4. Mermaid 语法必须正确可渲染
189
+ 5. 包含具体文件路径引用
190
+ 6. 中文输出,技术术语可用英文
191
+ ```
192
+
193
+ ## 执行流程
194
+
195
+ ```javascript
196
+ // 1. 发现 exploration 文件并自动分配 agent
197
+ const explorationFiles = bash(`find ${sessionFolder} -name "exploration-*.json" -type f`)
198
+ .split('\n')
199
+ .filter(f => f.trim());
200
+
201
+ const agentAssignments = explorationFiles.map(file => {
202
+ const angle = extractAngle(path.basename(file));
203
+ const agentName = EXPLORATION_TO_AGENT[angle];
204
+ return { exploration_file: file, angle, agent: agentName };
205
+ }).filter(a => a.agent);
206
+
207
+ // 补充必需 agent
208
+ const coveredAgents = new Set(agentAssignments.map(a => a.agent));
209
+ const requiredAgents = ['architecture', 'functions', 'algorithms', 'data_structures', 'interfaces', 'exceptions'];
210
+ requiredAgents.filter(a => !coveredAgents.has(a)).forEach(agent => {
211
+ agentAssignments.push({ exploration_file: null, angle: null, agent });
212
+ });
213
+
214
+ // 2. 准备目录
215
+ Bash(`mkdir -p ${outputDir}/sections`);
216
+
217
+ // 3. 并行启动所有 Agent(传递 exploration 文件路径)
218
+ const results = await Promise.all(
219
+ agentAssignments.map(assignment =>
220
+ Task({
221
+ subagent_type: "cli-explore-agent",
222
+ run_in_background: false,
223
+ description: `Analyze: ${assignment.agent}`,
224
+ prompt: buildAgentPrompt(assignment, metadata, outputDir)
225
+ })
226
+ )
227
+ );
228
+
229
+ // 4. 收集返回信息
230
+ const summaries = results.map(r => JSON.parse(r));
231
+
232
+ // 5. 传递给 Phase 2.5
233
+ return { summaries, cross_notes: summaries.flatMap(s => s.cross_module_notes) };
234
+ ```
235
+
236
+ ### Agent Prompt 构建
237
+
238
+ ```javascript
239
+ function buildAgentPrompt(assignment, metadata, outputDir) {
240
+ const config = AGENT_CONFIGS[assignment.agent];
241
+ let contextSection = '';
242
+
243
+ if (assignment.exploration_file) {
244
+ const matchType = assignment.is_related ? '相关' : '直接匹配';
245
+ contextSection = `[CONTEXT]
246
+ **Exploration 文件**: ${assignment.exploration_file}
247
+ **匹配类型**: ${matchType}
248
+ 首先读取此文件获取 ${assignment.angle} 探索结果作为分析上下文。
249
+ ${assignment.is_related ? `注意:这是相关探索结果(非直接匹配),请提取与 ${config.focus} 相关的信息。` : ''}
250
+ `;
251
+ }
252
+
253
+ return `
254
+ ${contextSection}
255
+ [SPEC]
256
+ 读取规范文件:
257
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
258
+
259
+ [ROLE] ${config.role}
260
+
261
+ [TASK]
262
+ 分析 ${metadata.scope_path},生成 Section ${config.section}。
263
+ 输出: ${outputDir}/sections/${config.output}
264
+
265
+ [CPCC_SPEC]
266
+ - 内容基于代码分析,无臆测
267
+ - 图表编号: 图${config.section}-1, 图${config.section}-2...
268
+ - 每个子章节 ≥100字
269
+ - 包含文件路径引用
270
+
271
+ [FOCUS]
272
+ ${config.focus}
273
+
274
+ [RETURN JSON]
275
+ {"status":"completed","output_file":"${config.output}","summary":"<50字>","cross_module_notes":[],"stats":{}}
276
+ `;
277
+ }
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Agent 提示词
283
+
284
+ ### Architecture
285
+
286
+ ```javascript
287
+ Task({
288
+ subagent_type: "cli-explore-agent",
289
+ run_in_background: false,
290
+ prompt: `
291
+ [SPEC]
292
+ 首先读取规范文件:
293
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
294
+ 严格遵循 CPCC 软著申请规范要求。
295
+
296
+ [ROLE] 系统架构师,专注于分层设计和模块依赖。
297
+
298
+ [TASK]
299
+ 分析 ${meta.scope_path},生成 Section 2: 系统架构图。
300
+ 输出: ${outDir}/sections/section-2-architecture.md
301
+
302
+ [CPCC_SPEC]
303
+ - 内容基于代码分析,无臆测
304
+ - 图表编号: 图2-1, 图2-2...
305
+ - 每个子章节 ≥100字
306
+ - 包含文件路径引用
307
+
308
+ [TEMPLATE]
309
+ ## 2. 系统架构图
310
+
311
+ 本章节展示${meta.software_name}的系统架构设计。
312
+
313
+ \`\`\`mermaid
314
+ graph TD
315
+ subgraph Layer1["层名"]
316
+ Comp1[组件1]
317
+ end
318
+ Comp1 --> Comp2
319
+ \`\`\`
320
+
321
+ **图2-1 系统架构图**
322
+
323
+ ### 2.1 分层说明
324
+ | 层级 | 组件 | 职责 |
325
+ |------|------|------|
326
+
327
+ ### 2.2 模块依赖
328
+ | 模块 | 依赖 | 说明 |
329
+ |------|------|------|
330
+
331
+ [FOCUS]
332
+ 1. 分层: 识别代码层次 (Controller/Service/Repository 或其他)
333
+ 2. 模块: 核心模块及职责边界
334
+ 3. 依赖: 模块间依赖方向
335
+ 4. 数据流: 请求/数据的流动路径
336
+
337
+ [RETURN JSON]
338
+ {"status":"completed","output_file":"section-2-architecture.md","summary":"<50字摘要>","cross_module_notes":["跨模块发现"],"stats":{"diagrams":1,"subsections":2}}
339
+ `
340
+ })
341
+ ```
342
+
343
+ ### Functions
344
+
345
+ ```javascript
346
+ Task({
347
+ subagent_type: "cli-explore-agent",
348
+ run_in_background: false,
349
+ prompt: `
350
+ [SPEC]
351
+ 首先读取规范文件:
352
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
353
+ 严格遵循 CPCC 软著申请规范要求。
354
+
355
+ [ROLE] 功能分析师,专注于功能点识别和交互。
356
+
357
+ [TASK]
358
+ 分析 ${meta.scope_path},生成 Section 3: 功能模块设计。
359
+ 输出: ${outDir}/sections/section-3-functions.md
360
+
361
+ [CPCC_SPEC]
362
+ - 内容基于代码分析,无臆测
363
+ - 图表编号: 图3-1, 图3-2...
364
+ - 每个子章节 ≥100字
365
+ - 包含文件路径引用
366
+
367
+ [TEMPLATE]
368
+ ## 3. 功能模块设计
369
+
370
+ 本章节展示${meta.software_name}的功能模块结构。
371
+
372
+ \`\`\`mermaid
373
+ flowchart TD
374
+ ROOT["${meta.software_name}"]
375
+ subgraph Group1["模块组1"]
376
+ F1["功能1"]
377
+ end
378
+ ROOT --> Group1
379
+ \`\`\`
380
+
381
+ **图3-1 功能模块结构图**
382
+
383
+ ### 3.1 功能清单
384
+ | ID | 功能名称 | 模块 | 入口文件 | 说明 |
385
+ |----|----------|------|----------|------|
386
+
387
+ ### 3.2 功能交互
388
+ | 调用方 | 被调用方 | 触发条件 |
389
+ |--------|----------|----------|
390
+
391
+ [FOCUS]
392
+ 1. 功能点: 枚举所有用户可见功能
393
+ 2. 模块分组: 按业务域分组
394
+ 3. 入口: 每个功能的代码入口 \`src/path/file.ts\`
395
+ 4. 交互: 功能间的调用关系
396
+
397
+ [RETURN JSON]
398
+ {"status":"completed","output_file":"section-3-functions.md","summary":"<50字>","cross_module_notes":[],"stats":{}}
399
+ `
400
+ })
401
+ ```
402
+
403
+ ### Algorithms
404
+
405
+ ```javascript
406
+ Task({
407
+ subagent_type: "cli-explore-agent",
408
+ run_in_background: false,
409
+ prompt: `
410
+ [SPEC]
411
+ 首先读取规范文件:
412
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
413
+ 严格遵循 CPCC 软著申请规范要求。
414
+
415
+ [ROLE] 算法工程师,专注于核心逻辑和复杂度分析。
416
+
417
+ [TASK]
418
+ 分析 ${meta.scope_path},生成 Section 4: 核心算法与流程。
419
+ 输出: ${outDir}/sections/section-4-algorithms.md
420
+
421
+ [CPCC_SPEC]
422
+ - 内容基于代码分析,无臆测
423
+ - 图表编号: 图4-1, 图4-2... (每个算法一个流程图)
424
+ - 每个算法说明 ≥100字
425
+ - 包含文件路径和行号引用
426
+
427
+ [TEMPLATE]
428
+ ## 4. 核心算法与流程
429
+
430
+ 本章节展示${meta.software_name}的核心算法设计。
431
+
432
+ ### 4.1 {算法名称}
433
+
434
+ **说明**: {描述,≥100字}
435
+ **位置**: \`src/path/file.ts:line\`
436
+
437
+ **输入**: param1 (type) - 说明
438
+ **输出**: result (type) - 说明
439
+
440
+ \`\`\`mermaid
441
+ flowchart TD
442
+ Start([开始]) --> Input[/输入/]
443
+ Input --> Check{判断}
444
+ Check -->|是| P1[步骤1]
445
+ Check -->|否| P2[步骤2]
446
+ P1 --> End([结束])
447
+ P2 --> End
448
+ \`\`\`
449
+
450
+ **图4-1 {算法名称}流程图**
451
+
452
+ ### 4.N 复杂度分析
453
+ | 算法 | 时间 | 空间 | 文件 |
454
+ |------|------|------|------|
455
+
456
+ [FOCUS]
457
+ 1. 核心算法: 业务逻辑的关键算法 (>10行或含分支循环)
458
+ 2. 流程步骤: 分支/循环/条件逻辑
459
+ 3. 复杂度: 时间/空间复杂度估算
460
+ 4. 输入输出: 参数类型和返回值
461
+
462
+ [RETURN JSON]
463
+ {"status":"completed","output_file":"section-4-algorithms.md","summary":"<50字>","cross_module_notes":[],"stats":{}}
464
+ `
465
+ })
466
+ ```
467
+
468
+ ### Data Structures
469
+
470
+ ```javascript
471
+ Task({
472
+ subagent_type: "cli-explore-agent",
473
+ run_in_background: false,
474
+ prompt: `
475
+ [SPEC]
476
+ 首先读取规范文件:
477
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
478
+ 严格遵循 CPCC 软著申请规范要求。
479
+
480
+ [ROLE] 数据建模师,专注于实体关系和类型定义。
481
+
482
+ [TASK]
483
+ 分析 ${meta.scope_path},生成 Section 5: 数据结构设计。
484
+ 输出: ${outDir}/sections/section-5-data-structures.md
485
+
486
+ [CPCC_SPEC]
487
+ - 内容基于代码分析,无臆测
488
+ - 图表编号: 图5-1 (数据结构类图)
489
+ - 每个子章节 ≥100字
490
+ - 包含文件路径引用
491
+
492
+ [TEMPLATE]
493
+ ## 5. 数据结构设计
494
+
495
+ 本章节展示${meta.software_name}的核心数据结构。
496
+
497
+ \`\`\`mermaid
498
+ classDiagram
499
+ class Entity1 {
500
+ +type field1
501
+ +method1()
502
+ }
503
+ Entity1 "1" --> "*" Entity2 : 关系
504
+ \`\`\`
505
+
506
+ **图5-1 数据结构类图**
507
+
508
+ ### 5.1 实体说明
509
+ | 实体 | 类型 | 文件 | 说明 |
510
+ |------|------|------|------|
511
+
512
+ ### 5.2 关系说明
513
+ | 源 | 目标 | 类型 | 基数 |
514
+ |----|------|------|------|
515
+
516
+ [FOCUS]
517
+ 1. 实体: class/interface/type 定义
518
+ 2. 属性: 字段类型和可见性 (+public/-private/#protected)
519
+ 3. 关系: 继承(--|>)/组合(*--)/关联(-->)
520
+ 4. 枚举: enum 类型及其值
521
+
522
+ [RETURN JSON]
523
+ {"status":"completed","output_file":"section-5-data-structures.md","summary":"<50字>","cross_module_notes":[],"stats":{}}
524
+ `
525
+ })
526
+ ```
527
+
528
+ ### Interfaces
529
+
530
+ ```javascript
531
+ Task({
532
+ subagent_type: "cli-explore-agent",
533
+ run_in_background: false,
534
+ prompt: `
535
+ [SPEC]
536
+ 首先读取规范文件:
537
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
538
+ 严格遵循 CPCC 软著申请规范要求。
539
+
540
+ [ROLE] API设计师,专注于接口契约和协议。
541
+
542
+ [TASK]
543
+ 分析 ${meta.scope_path},生成 Section 6: 接口设计。
544
+ 输出: ${outDir}/sections/section-6-interfaces.md
545
+
546
+ [CPCC_SPEC]
547
+ - 内容基于代码分析,无臆测
548
+ - 图表编号: 图6-1, 图6-2... (每个核心接口一个时序图)
549
+ - 每个接口详情 ≥100字
550
+ - 包含文件路径引用
551
+
552
+ [TEMPLATE]
553
+ ## 6. 接口设计
554
+
555
+ 本章节展示${meta.software_name}的接口设计。
556
+
557
+ \`\`\`mermaid
558
+ sequenceDiagram
559
+ participant C as Client
560
+ participant A as API
561
+ participant S as Service
562
+ C->>A: POST /api/xxx
563
+ A->>S: method()
564
+ S-->>A: result
565
+ A-->>C: 200 OK
566
+ \`\`\`
567
+
568
+ **图6-1 {接口名}时序图**
569
+
570
+ ### 6.1 接口清单
571
+ | 接口 | 方法 | 路径 | 说明 |
572
+ |------|------|------|------|
573
+
574
+ ### 6.2 接口详情
575
+
576
+ #### METHOD /path
577
+ **请求**:
578
+ | 参数 | 类型 | 必填 | 说明 |
579
+ |------|------|------|------|
580
+
581
+ **响应**:
582
+ | 字段 | 类型 | 说明 |
583
+ |------|------|------|
584
+
585
+ [FOCUS]
586
+ 1. API端点: 路径/方法/说明
587
+ 2. 参数: 请求参数类型和校验规则
588
+ 3. 响应: 响应格式、状态码、错误码
589
+ 4. 时序: 典型调用流程 (选2-3个核心接口)
590
+
591
+ [RETURN JSON]
592
+ {"status":"completed","output_file":"section-6-interfaces.md","summary":"<50字>","cross_module_notes":[],"stats":{}}
593
+ `
594
+ })
595
+ ```
596
+
597
+ ### Exceptions
598
+
599
+ ```javascript
600
+ Task({
601
+ subagent_type: "cli-explore-agent",
602
+ run_in_background: false,
603
+ prompt: `
604
+ [SPEC]
605
+ 首先读取规范文件:
606
+ - Read: ${skillRoot}/specs/cpcc-requirements.md
607
+ 严格遵循 CPCC 软著申请规范要求。
608
+
609
+ [ROLE] 可靠性工程师,专注于异常处理和恢复策略。
610
+
611
+ [TASK]
612
+ 分析 ${meta.scope_path},生成 Section 7: 异常处理设计。
613
+ 输出: ${outDir}/sections/section-7-exceptions.md
614
+
615
+ [CPCC_SPEC]
616
+ - 内容基于代码分析,无臆测
617
+ - 图表编号: 图7-1 (异常处理流程图)
618
+ - 每个子章节 ≥100字
619
+ - 包含文件路径引用
620
+
621
+ [TEMPLATE]
622
+ ## 7. 异常处理设计
623
+
624
+ 本章节展示${meta.software_name}的异常处理机制。
625
+
626
+ \`\`\`mermaid
627
+ flowchart TD
628
+ Req[请求] --> Try{Try-Catch}
629
+ Try -->|正常| Process[处理]
630
+ Try -->|异常| ErrType{类型}
631
+ ErrType -->|E1| H1[处理1]
632
+ ErrType -->|E2| H2[处理2]
633
+ H1 --> Log[日志]
634
+ H2 --> Log
635
+ Process --> Resp[响应]
636
+ \`\`\`
637
+
638
+ **图7-1 异常处理流程图**
639
+
640
+ ### 7.1 异常类型
641
+ | 异常类 | 错误码 | HTTP状态 | 说明 |
642
+ |--------|--------|----------|------|
643
+
644
+ ### 7.2 恢复策略
645
+ | 场景 | 策略 | 说明 |
646
+ |------|------|------|
647
+
648
+ [FOCUS]
649
+ 1. 异常类型: 自定义异常类及继承关系
650
+ 2. 错误码: 错误码定义和分类
651
+ 3. 处理模式: try-catch/中间件/装饰器
652
+ 4. 恢复策略: 重试/降级/熔断/告警
653
+
654
+ [RETURN JSON]
655
+ {"status":"completed","output_file":"section-7-exceptions.md","summary":"<50字>","cross_module_notes":[],"stats":{}}
656
+ `
657
+ })
658
+ ```
659
+
660
+ ---
661
+
662
+ ## Output
663
+
664
+ 各 Agent 写入 `sections/section-N-xxx.md`,返回简要 JSON 供 Phase 2.5 汇总。