claude-code-workflow 6.3.2 → 6.3.5

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 (80) hide show
  1. package/.claude/CLAUDE.md +9 -1
  2. package/.claude/commands/{clean.md → workflow/clean.md} +5 -5
  3. package/.claude/commands/workflow/docs/analyze.md +1467 -0
  4. package/.claude/commands/workflow/docs/copyright.md +1265 -0
  5. package/.claude/commands/workflow/lite-plan.md +1 -1
  6. package/.claude/commands/workflow/tools/conflict-resolution.md +76 -240
  7. package/.claude/commands/workflow/tools/task-generate-agent.md +81 -8
  8. package/.claude/skills/_shared/mermaid-utils.md +584 -0
  9. package/.claude/skills/copyright-docs/SKILL.md +132 -0
  10. package/.claude/skills/copyright-docs/phases/01-metadata-collection.md +78 -0
  11. package/.claude/skills/copyright-docs/phases/02-deep-analysis.md +454 -0
  12. package/.claude/skills/copyright-docs/phases/02.5-consolidation.md +192 -0
  13. package/.claude/skills/copyright-docs/phases/04-document-assembly.md +261 -0
  14. package/.claude/skills/copyright-docs/phases/05-compliance-refinement.md +192 -0
  15. package/.claude/skills/copyright-docs/specs/cpcc-requirements.md +121 -0
  16. package/.claude/skills/copyright-docs/templates/agent-base.md +200 -0
  17. package/.claude/skills/project-analyze/SKILL.md +162 -0
  18. package/.claude/skills/project-analyze/phases/01-requirements-discovery.md +79 -0
  19. package/.claude/skills/project-analyze/phases/02-project-exploration.md +75 -0
  20. package/.claude/skills/project-analyze/phases/03-deep-analysis.md +640 -0
  21. package/.claude/skills/project-analyze/phases/03.5-consolidation.md +208 -0
  22. package/.claude/skills/project-analyze/phases/04-report-generation.md +217 -0
  23. package/.claude/skills/project-analyze/phases/05-iterative-refinement.md +124 -0
  24. package/.claude/skills/project-analyze/specs/quality-standards.md +115 -0
  25. package/.claude/skills/project-analyze/specs/writing-style.md +152 -0
  26. package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +79 -65
  27. package/.claude/workflows/cli-tools-usage.md +515 -516
  28. package/README.md +11 -1
  29. package/ccw/dist/cli.d.ts.map +1 -1
  30. package/ccw/dist/cli.js +7 -1
  31. package/ccw/dist/cli.js.map +1 -1
  32. package/ccw/dist/commands/cli.d.ts +1 -1
  33. package/ccw/dist/commands/cli.d.ts.map +1 -1
  34. package/ccw/dist/commands/cli.js +116 -14
  35. package/ccw/dist/commands/cli.js.map +1 -1
  36. package/ccw/dist/core/routes/cli-routes.js +2 -2
  37. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  38. package/ccw/dist/tools/claude-cli-tools.d.ts +7 -3
  39. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  40. package/ccw/dist/tools/claude-cli-tools.js +31 -17
  41. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  42. package/ccw/dist/tools/cli-executor.d.ts.map +1 -1
  43. package/ccw/dist/tools/cli-executor.js +19 -7
  44. package/ccw/dist/tools/cli-executor.js.map +1 -1
  45. package/ccw/dist/tools/cli-history-store.d.ts +33 -0
  46. package/ccw/dist/tools/cli-history-store.d.ts.map +1 -1
  47. package/ccw/dist/tools/cli-history-store.js +89 -5
  48. package/ccw/dist/tools/cli-history-store.js.map +1 -1
  49. package/ccw/dist/tools/smart-search.d.ts +25 -0
  50. package/ccw/dist/tools/smart-search.d.ts.map +1 -1
  51. package/ccw/dist/tools/smart-search.js +121 -17
  52. package/ccw/dist/tools/smart-search.js.map +1 -1
  53. package/ccw/src/cli.ts +264 -258
  54. package/ccw/src/commands/cli.ts +1009 -884
  55. package/ccw/src/core/routes/cli-routes.ts +3 -3
  56. package/ccw/src/templates/dashboard-js/components/cli-history.js +40 -13
  57. package/ccw/src/templates/dashboard-js/components/cli-status.js +26 -2
  58. package/ccw/src/templates/dashboard-js/views/cli-manager.js +5 -0
  59. package/ccw/src/templates/dashboard-js/views/history.js +19 -4
  60. package/ccw/src/tools/claude-cli-tools.ts +37 -20
  61. package/ccw/src/tools/cli-executor.ts +20 -7
  62. package/ccw/src/tools/cli-history-store.ts +125 -5
  63. package/ccw/src/tools/smart-search.ts +157 -16
  64. package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
  65. package/codex-lens/src/codexlens/config.py +8 -0
  66. package/codex-lens/src/codexlens/search/__pycache__/chain_search.cpython-313.pyc +0 -0
  67. package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
  68. package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
  69. package/codex-lens/src/codexlens/search/chain_search.py +71 -1
  70. package/codex-lens/src/codexlens/search/hybrid_search.py +144 -11
  71. package/codex-lens/src/codexlens/search/ranking.py +540 -274
  72. package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
  73. package/codex-lens/src/codexlens/semantic/chunker.py +55 -10
  74. package/codex-lens/src/codexlens/storage/__pycache__/dir_index.cpython-313.pyc +0 -0
  75. package/codex-lens/src/codexlens/storage/__pycache__/global_index.cpython-313.pyc +0 -0
  76. package/codex-lens/src/codexlens/storage/__pycache__/index_tree.cpython-313.pyc +0 -0
  77. package/codex-lens/src/codexlens/storage/dir_index.py +1888 -1850
  78. package/codex-lens/src/codexlens/storage/global_index.py +365 -0
  79. package/codex-lens/src/codexlens/storage/index_tree.py +83 -10
  80. package/package.json +2 -2
@@ -0,0 +1,121 @@
1
+ # CPCC Compliance Requirements
2
+
3
+ China Copyright Protection Center (CPCC) requirements for software design specification.
4
+
5
+ ## When to Use
6
+
7
+ | Phase | Usage | Section |
8
+ |-------|-------|---------|
9
+ | Phase 4 | Check document structure before assembly | Document Requirements, Mandatory Sections |
10
+ | Phase 4 | Apply correct figure numbering | Figure Numbering Convention |
11
+ | Phase 5 | Validate before each iteration | Validation Function |
12
+ | Phase 5 | Handle failures during refinement | Error Handling |
13
+
14
+ ---
15
+
16
+ ## Document Requirements
17
+
18
+ ### Format
19
+ - [ ] 页眉包含软件名称和版本号
20
+ - [ ] 页码位于右上角说明
21
+ - [ ] 每页不少于30行文字(图表页除外)
22
+ - [ ] A4纵向排版,文字从左至右
23
+
24
+ ### Mandatory Sections (7 章节)
25
+ - [ ] 1. 软件概述
26
+ - [ ] 2. 系统架构图
27
+ - [ ] 3. 功能模块设计
28
+ - [ ] 4. 核心算法与流程
29
+ - [ ] 5. 数据结构设计
30
+ - [ ] 6. 接口设计
31
+ - [ ] 7. 异常处理设计
32
+
33
+ ### Content Requirements
34
+ - [ ] 所有内容基于代码分析
35
+ - [ ] 无臆测或未来计划
36
+ - [ ] 无原始指令性文字
37
+ - [ ] Mermaid 语法正确
38
+ - [ ] 图表编号和说明完整
39
+
40
+ ## Validation Function
41
+
42
+ ```javascript
43
+ function validateCPCCCompliance(document, analyses) {
44
+ const checks = [
45
+ {name: "软件概述完整性", pass: document.includes("## 1. 软件概述")},
46
+ {name: "系统架构图存在", pass: document.includes("图2-1 系统架构图")},
47
+ {name: "功能模块设计完整", pass: document.includes("## 3. 功能模块设计")},
48
+ {name: "核心算法描述", pass: document.includes("## 4. 核心算法与流程")},
49
+ {name: "数据结构设计", pass: document.includes("## 5. 数据结构设计")},
50
+ {name: "接口设计说明", pass: document.includes("## 6. 接口设计")},
51
+ {name: "异常处理设计", pass: document.includes("## 7. 异常处理设计")},
52
+ {name: "Mermaid图表语法", pass: !document.includes("mermaid error")},
53
+ {name: "页眉信息", pass: document.includes("页眉")},
54
+ {name: "页码说明", pass: document.includes("页码")}
55
+ ];
56
+
57
+ return {
58
+ passed: checks.filter(c => c.pass).length,
59
+ total: checks.length,
60
+ details: checks
61
+ };
62
+ }
63
+ ```
64
+
65
+ ## Software Categories
66
+
67
+ | Category | Document Focus |
68
+ |----------|----------------|
69
+ | 命令行工具 (CLI) | 命令、参数、使用流程 |
70
+ | 后端服务/API | 端点、协议、数据流 |
71
+ | SDK/库 | 接口、集成、使用示例 |
72
+ | 数据处理系统 | 数据流、转换、ETL |
73
+ | 自动化脚本 | 工作流、触发器、调度 |
74
+
75
+ ## Figure Numbering Convention
76
+
77
+ | Section | Figure | Title |
78
+ |---------|--------|-------|
79
+ | 2 | 图2-1 | 系统架构图 |
80
+ | 3 | 图3-1 | 功能模块结构图 |
81
+ | 4 | 图4-N | {算法名称}流程图 |
82
+ | 5 | 图5-1 | 数据结构类图 |
83
+ | 6 | 图6-N | {接口名称}时序图 |
84
+ | 7 | 图7-1 | 异常处理流程图 |
85
+
86
+ ## Error Handling
87
+
88
+ | Error | Recovery |
89
+ |-------|----------|
90
+ | Analysis timeout | Reduce scope, retry |
91
+ | Missing section data | Re-run targeted agent |
92
+ | Diagram validation fails | Regenerate with fixes |
93
+ | User abandons iteration | Save progress, allow resume |
94
+
95
+ ---
96
+
97
+ ## Integration with Phases
98
+
99
+ **Phase 4 - Document Assembly**:
100
+ ```javascript
101
+ // Before assembling document
102
+ const docChecks = [
103
+ {check: "页眉格式", value: `<!-- 页眉:${metadata.software_name} - 版本号:${metadata.version} -->`},
104
+ {check: "页码说明", value: `<!-- 注:最终文档页码位于每页右上角 -->`}
105
+ ];
106
+
107
+ // Apply figure numbering from convention table
108
+ const figureNumbers = getFigureNumbers(sectionIndex);
109
+ ```
110
+
111
+ **Phase 5 - Compliance Refinement**:
112
+ ```javascript
113
+ // In 05-compliance-refinement.md
114
+ const validation = validateCPCCCompliance(document, analyses);
115
+
116
+ if (validation.passed < validation.total) {
117
+ // Failed checks become discovery questions
118
+ const failedChecks = validation.details.filter(d => !d.pass);
119
+ discoveries.complianceIssues = failedChecks;
120
+ }
121
+ ```
@@ -0,0 +1,200 @@
1
+ # Agent Base Template
2
+
3
+ 所有分析 Agent 的基础模板,确保一致性和高效执行。
4
+
5
+ ## 通用提示词结构
6
+
7
+ ```
8
+ [ROLE] 你是{角色},专注于{职责}。
9
+
10
+ [TASK]
11
+ 分析代码库,生成 CPCC 合规的章节文档。
12
+ - 输出: {output_dir}/sections/{filename}
13
+ - 格式: Markdown + Mermaid
14
+ - 范围: {scope_path}
15
+
16
+ [CONSTRAINTS]
17
+ - 只描述已实现的代码,不臆测
18
+ - 中文输出,技术术语可用英文
19
+ - Mermaid 图表必须可渲染
20
+ - 文件/类/函数需包含路径引用
21
+
22
+ [OUTPUT_FORMAT]
23
+ 1. 直接写入 MD 文件
24
+ 2. 返回 JSON 简要信息
25
+
26
+ [QUALITY_CHECKLIST]
27
+ - [ ] 包含至少1个 Mermaid 图表
28
+ - [ ] 每个子章节有实质内容 (>100字)
29
+ - [ ] 代码引用格式: `src/path/file.ts:line`
30
+ - [ ] 图表编号正确 (图N-M)
31
+ ```
32
+
33
+ ## 变量说明
34
+
35
+ | 变量 | 来源 | 示例 |
36
+ |------|------|------|
37
+ | {output_dir} | Phase 1 创建 | .workflow/.scratchpad/copyright-xxx |
38
+ | {software_name} | metadata.software_name | 智能数据分析系统 |
39
+ | {scope_path} | metadata.scope_path | src/ |
40
+ | {tech_stack} | metadata.tech_stack | TypeScript/Node.js |
41
+
42
+ ## Agent 提示词模板
43
+
44
+ ### 精简版 (推荐)
45
+
46
+ ```javascript
47
+ const agentPrompt = (agent, meta, outDir) => `
48
+ [ROLE] ${AGENT_ROLES[agent]}
49
+
50
+ [TASK]
51
+ 分析 ${meta.scope_path},生成 ${AGENT_SECTIONS[agent]}。
52
+ 输出: ${outDir}/sections/${AGENT_FILES[agent]}
53
+
54
+ [TEMPLATE]
55
+ ${AGENT_TEMPLATES[agent]}
56
+
57
+ [FOCUS]
58
+ ${AGENT_FOCUS[agent].join('\n')}
59
+
60
+ [RETURN]
61
+ {"status":"completed","output_file":"${AGENT_FILES[agent]}","summary":"<50字>","cross_module_notes":[],"stats":{}}
62
+ `;
63
+ ```
64
+
65
+ ### 配置映射
66
+
67
+ ```javascript
68
+ const AGENT_ROLES = {
69
+ architecture: "系统架构师,专注于分层设计和模块依赖",
70
+ functions: "功能分析师,专注于功能点识别和交互",
71
+ algorithms: "算法工程师,专注于核心逻辑和复杂度",
72
+ data_structures: "数据建模师,专注于实体关系和类型",
73
+ interfaces: "API设计师,专注于接口契约和协议",
74
+ exceptions: "可靠性工程师,专注于异常处理和恢复"
75
+ };
76
+
77
+ const AGENT_SECTIONS = {
78
+ architecture: "Section 2: 系统架构图",
79
+ functions: "Section 3: 功能模块设计",
80
+ algorithms: "Section 4: 核心算法与流程",
81
+ data_structures: "Section 5: 数据结构设计",
82
+ interfaces: "Section 6: 接口设计",
83
+ exceptions: "Section 7: 异常处理设计"
84
+ };
85
+
86
+ const AGENT_FILES = {
87
+ architecture: "section-2-architecture.md",
88
+ functions: "section-3-functions.md",
89
+ algorithms: "section-4-algorithms.md",
90
+ data_structures: "section-5-data-structures.md",
91
+ interfaces: "section-6-interfaces.md",
92
+ exceptions: "section-7-exceptions.md"
93
+ };
94
+
95
+ const AGENT_FOCUS = {
96
+ architecture: [
97
+ "1. 分层: 识别代码层次 (Controller/Service/Repository)",
98
+ "2. 模块: 核心模块及职责边界",
99
+ "3. 依赖: 模块间依赖方向",
100
+ "4. 数据流: 请求/数据的流动路径"
101
+ ],
102
+ functions: [
103
+ "1. 功能点: 枚举所有用户可见功能",
104
+ "2. 模块分组: 按业务域分组",
105
+ "3. 入口: 每个功能的代码入口",
106
+ "4. 交互: 功能间的调用关系"
107
+ ],
108
+ algorithms: [
109
+ "1. 核心算法: 业务逻辑的关键算法",
110
+ "2. 流程步骤: 分支/循环/条件",
111
+ "3. 复杂度: 时间/空间复杂度",
112
+ "4. 输入输出: 参数和返回值"
113
+ ],
114
+ data_structures: [
115
+ "1. 实体: class/interface/type 定义",
116
+ "2. 属性: 字段类型和可见性",
117
+ "3. 关系: 继承/组合/关联",
118
+ "4. 枚举: 枚举类型及其值"
119
+ ],
120
+ interfaces: [
121
+ "1. API端点: 路径/方法/说明",
122
+ "2. 参数: 请求参数类型和校验",
123
+ "3. 响应: 响应格式和状态码",
124
+ "4. 时序: 典型调用流程"
125
+ ],
126
+ exceptions: [
127
+ "1. 异常类型: 自定义异常类",
128
+ "2. 错误码: 错误码定义和含义",
129
+ "3. 处理模式: try-catch/中间件",
130
+ "4. 恢复策略: 重试/降级/告警"
131
+ ]
132
+ };
133
+ ```
134
+
135
+ ## 效率优化
136
+
137
+ ### 1. 减少冗余
138
+
139
+ **Before (冗余)**:
140
+ ```
141
+ 你是一个专业的系统架构师,具有丰富的软件设计经验。
142
+ 你需要分析代码库,识别系统的分层结构...
143
+ ```
144
+
145
+ **After (精简)**:
146
+ ```
147
+ [ROLE] 系统架构师,专注于分层设计和模块依赖。
148
+ [TASK] 分析 src/,生成系统架构图章节。
149
+ ```
150
+
151
+ ### 2. 模板驱动
152
+
153
+ **Before (描述性)**:
154
+ ```
155
+ 请按照以下格式输出:
156
+ 首先写一个二级标题...
157
+ 然后添加一个Mermaid图...
158
+ ```
159
+
160
+ **After (模板)**:
161
+ ```
162
+ [TEMPLATE]
163
+ ## 2. 系统架构图
164
+ {intro}
165
+ \`\`\`mermaid
166
+ {diagram}
167
+ \`\`\`
168
+ **图2-1 系统架构图**
169
+ ### 2.1 {subsection}
170
+ {content}
171
+ ```
172
+
173
+ ### 3. 焦点明确
174
+
175
+ **Before (模糊)**:
176
+ ```
177
+ 分析项目的各个方面,包括架构、模块、依赖等
178
+ ```
179
+
180
+ **After (具体)**:
181
+ ```
182
+ [FOCUS]
183
+ 1. 分层: Controller/Service/Repository
184
+ 2. 模块: 职责边界
185
+ 3. 依赖: 方向性
186
+ 4. 数据流: 路径
187
+ ```
188
+
189
+ ### 4. 返回简洁
190
+
191
+ **Before (冗长)**:
192
+ ```
193
+ 请返回详细的分析结果,包括所有发现的问题...
194
+ ```
195
+
196
+ **After (结构化)**:
197
+ ```
198
+ [RETURN]
199
+ {"status":"completed","output_file":"xxx.md","summary":"<50字>","cross_module_notes":[],"stats":{}}
200
+ ```
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: project-analyze
3
+ description: Multi-phase iterative project analysis with Mermaid diagrams. Generates architecture reports, design reports, method analysis reports. Use when analyzing codebases, understanding project structure, reviewing architecture, exploring design patterns, or documenting system components. Triggers on "analyze project", "architecture report", "design analysis", "code structure", "system overview".
4
+ allowed-tools: Task, AskUserQuestion, Read, Bash, Glob, Grep, Write
5
+ ---
6
+
7
+ # Project Analysis Skill
8
+
9
+ Generate comprehensive project analysis reports through multi-phase iterative workflow.
10
+
11
+ ## Architecture Overview
12
+
13
+ ```
14
+ ┌─────────────────────────────────────────────────────────────────┐
15
+ │ Context-Optimized Architecture │
16
+ ├─────────────────────────────────────────────────────────────────┤
17
+ │ │
18
+ │ Phase 1: Requirements → analysis-config.json │
19
+ │ ↓ │
20
+ │ Phase 2: Exploration → 初步探索,确定范围 │
21
+ │ ↓ │
22
+ │ Phase 3: Parallel Agents → sections/section-*.md (直接写MD) │
23
+ │ ↓ 返回简要JSON │
24
+ │ Phase 3.5: Consolidation → consolidation-summary.md │
25
+ │ Agent ↓ 返回质量评分+问题列表 │
26
+ │ ↓ │
27
+ │ Phase 4: Assembly → 合并MD + 质量附录 │
28
+ │ ↓ │
29
+ │ Phase 5: Refinement → 最终报告 │
30
+ │ │
31
+ └─────────────────────────────────────────────────────────────────┘
32
+ ```
33
+
34
+ ## Key Design Principles
35
+
36
+ 1. **Agent 直接输出 MD**: 避免 JSON → MD 转换的上下文开销
37
+ 2. **简要返回**: Agent 只返回路径+摘要,不返回完整内容
38
+ 3. **汇总 Agent**: 独立 Agent 负责跨章节问题检测和质量评分
39
+ 4. **引用合并**: Phase 4 读取文件合并,不在上下文中传递
40
+ 5. **段落式描述**: 禁止清单罗列,层层递进,客观学术表达
41
+
42
+ ## Execution Flow
43
+
44
+ ```
45
+ ┌─────────────────────────────────────────────────────────────────┐
46
+ │ Phase 1: Requirements Discovery │
47
+ │ → Read: phases/01-requirements-discovery.md │
48
+ │ → Collect: report type, depth level, scope, focus areas │
49
+ │ → Output: analysis-config.json │
50
+ ├─────────────────────────────────────────────────────────────────┤
51
+ │ Phase 2: Project Exploration │
52
+ │ → Read: phases/02-project-exploration.md │
53
+ │ → Launch: parallel exploration agents │
54
+ │ → Output: exploration context for Phase 3 │
55
+ ├─────────────────────────────────────────────────────────────────┤
56
+ │ Phase 3: Deep Analysis (Parallel Agents) │
57
+ │ → Read: phases/03-deep-analysis.md │
58
+ │ → Reference: specs/quality-standards.md │
59
+ │ → Each Agent: 分析代码 → 直接写 sections/section-*.md │
60
+ │ → Return: {"status", "output_file", "summary", "cross_notes"} │
61
+ ├─────────────────────────────────────────────────────────────────┤
62
+ │ Phase 3.5: Consolidation (New!) │
63
+ │ → Read: phases/03.5-consolidation.md │
64
+ │ → Input: Agent 返回的简要信息 + cross_module_notes │
65
+ │ → Analyze: 一致性/完整性/关联性/质量检查 │
66
+ │ → Output: consolidation-summary.md │
67
+ │ → Return: {"quality_score", "issues", "stats"} │
68
+ ├─────────────────────────────────────────────────────────────────┤
69
+ │ Phase 4: Report Generation │
70
+ │ → Read: phases/04-report-generation.md │
71
+ │ → Check: 如有 errors,提示用户处理 │
72
+ │ → Merge: Executive Summary + sections/*.md + 质量附录 │
73
+ │ → Output: {TYPE}-REPORT.md │
74
+ ├─────────────────────────────────────────────────────────────────┤
75
+ │ Phase 5: Iterative Refinement │
76
+ │ → Read: phases/05-iterative-refinement.md │
77
+ │ → Reference: specs/quality-standards.md │
78
+ │ → Loop: 发现问题 → 提问 → 修复 → 重新检查 │
79
+ └─────────────────────────────────────────────────────────────────┘
80
+ ```
81
+
82
+ ## Report Types
83
+
84
+ | Type | Output | Agents | Focus |
85
+ |------|--------|--------|-------|
86
+ | `architecture` | ARCHITECTURE-REPORT.md | 5 | System structure, modules, dependencies |
87
+ | `design` | DESIGN-REPORT.md | 4 | Patterns, classes, interfaces |
88
+ | `methods` | METHODS-REPORT.md | 4 | Algorithms, critical paths, APIs |
89
+ | `comprehensive` | COMPREHENSIVE-REPORT.md | All | All above combined |
90
+
91
+ ## Agent Configuration by Report Type
92
+
93
+ ### Architecture Report
94
+ | Agent | Output File | Section |
95
+ |-------|-------------|---------|
96
+ | overview | section-overview.md | System Overview |
97
+ | layers | section-layers.md | Layer Analysis |
98
+ | dependencies | section-dependencies.md | Module Dependencies |
99
+ | dataflow | section-dataflow.md | Data Flow |
100
+ | entrypoints | section-entrypoints.md | Entry Points |
101
+
102
+ ### Design Report
103
+ | Agent | Output File | Section |
104
+ |-------|-------------|---------|
105
+ | patterns | section-patterns.md | Design Patterns |
106
+ | classes | section-classes.md | Class Relationships |
107
+ | interfaces | section-interfaces.md | Interface Contracts |
108
+ | state | section-state.md | State Management |
109
+
110
+ ### Methods Report
111
+ | Agent | Output File | Section |
112
+ |-------|-------------|---------|
113
+ | algorithms | section-algorithms.md | Core Algorithms |
114
+ | paths | section-paths.md | Critical Code Paths |
115
+ | apis | section-apis.md | Public API Reference |
116
+ | logic | section-logic.md | Complex Logic |
117
+
118
+ ## Directory Setup
119
+
120
+ ```javascript
121
+ // 生成时间戳目录名
122
+ const timestamp = new Date().toISOString().slice(0,19).replace(/[-:T]/g, '');
123
+ const dir = `.workflow/.scratchpad/analyze-${timestamp}`;
124
+
125
+ // Windows (cmd)
126
+ Bash(`mkdir "${dir}\\sections"`);
127
+ Bash(`mkdir "${dir}\\iterations"`);
128
+
129
+ // Unix/macOS
130
+ // Bash(`mkdir -p "${dir}/sections" "${dir}/iterations"`);
131
+ ```
132
+
133
+ ## Output Structure
134
+
135
+ ```
136
+ .workflow/.scratchpad/analyze-{timestamp}/
137
+ ├── analysis-config.json # Phase 1
138
+ ├── sections/ # Phase 3 (Agent 直接写入)
139
+ │ ├── section-overview.md
140
+ │ ├── section-layers.md
141
+ │ ├── section-dependencies.md
142
+ │ └── ...
143
+ ├── consolidation-summary.md # Phase 3.5
144
+ ├── {TYPE}-REPORT.md # Final Output
145
+ └── iterations/ # Phase 5
146
+ ├── v1.md
147
+ └── v2.md
148
+ ```
149
+
150
+ ## Reference Documents
151
+
152
+ | Document | Purpose |
153
+ |----------|---------|
154
+ | [phases/01-requirements-discovery.md](phases/01-requirements-discovery.md) | User interaction, config collection |
155
+ | [phases/02-project-exploration.md](phases/02-project-exploration.md) | Initial exploration |
156
+ | [phases/03-deep-analysis.md](phases/03-deep-analysis.md) | Parallel agent analysis |
157
+ | [phases/03.5-consolidation.md](phases/03.5-consolidation.md) | Cross-section consolidation |
158
+ | [phases/04-report-generation.md](phases/04-report-generation.md) | Report assembly |
159
+ | [phases/05-iterative-refinement.md](phases/05-iterative-refinement.md) | Quality refinement |
160
+ | [specs/quality-standards.md](specs/quality-standards.md) | Quality gates, standards |
161
+ | [specs/writing-style.md](specs/writing-style.md) | 段落式学术写作规范 |
162
+ | [../_shared/mermaid-utils.md](../_shared/mermaid-utils.md) | Shared Mermaid utilities |
@@ -0,0 +1,79 @@
1
+ # Phase 1: Requirements Discovery
2
+
3
+ Collect user requirements before analysis begins.
4
+
5
+ ## Execution
6
+
7
+ ### Step 1: Report Type Selection
8
+
9
+ ```javascript
10
+ AskUserQuestion({
11
+ questions: [{
12
+ question: "What type of project analysis report would you like?",
13
+ header: "Report Type",
14
+ multiSelect: false,
15
+ options: [
16
+ {label: "Architecture (Recommended)", description: "System structure, module relationships, layer analysis, dependency graph"},
17
+ {label: "Design", description: "Design patterns, class relationships, component interactions, abstraction analysis"},
18
+ {label: "Methods", description: "Key algorithms, critical code paths, core function explanations with examples"},
19
+ {label: "Comprehensive", description: "All above combined into a complete project analysis"}
20
+ ]
21
+ }]
22
+ })
23
+ ```
24
+
25
+ ### Step 2: Depth Level Selection
26
+
27
+ ```javascript
28
+ AskUserQuestion({
29
+ questions: [{
30
+ question: "What depth level do you need?",
31
+ header: "Depth",
32
+ multiSelect: false,
33
+ options: [
34
+ {label: "Overview", description: "High-level understanding, suitable for onboarding"},
35
+ {label: "Detailed", description: "In-depth analysis with code examples"},
36
+ {label: "Deep-Dive", description: "Exhaustive analysis with implementation details"}
37
+ ]
38
+ }]
39
+ })
40
+ ```
41
+
42
+ ### Step 3: Scope Definition
43
+
44
+ ```javascript
45
+ AskUserQuestion({
46
+ questions: [{
47
+ question: "What scope should the analysis cover?",
48
+ header: "Scope",
49
+ multiSelect: false,
50
+ options: [
51
+ {label: "Full Project", description: "Analyze entire codebase"},
52
+ {label: "Specific Module", description: "Focus on a specific module or directory"},
53
+ {label: "Custom Path", description: "Specify custom path pattern"}
54
+ ]
55
+ }]
56
+ })
57
+ ```
58
+
59
+ ## Focus Areas Mapping
60
+
61
+ | Report Type | Focus Areas |
62
+ |-------------|-------------|
63
+ | Architecture | Layer Structure, Module Dependencies, Entry Points, Data Flow |
64
+ | Design | Design Patterns, Class Relationships, Interface Contracts, State Management |
65
+ | Methods | Core Algorithms, Critical Paths, Public APIs, Complex Logic |
66
+ | Comprehensive | All above combined |
67
+
68
+ ## Output
69
+
70
+ Save configuration to `analysis-config.json`:
71
+
72
+ ```json
73
+ {
74
+ "type": "architecture|design|methods|comprehensive",
75
+ "depth": "overview|detailed|deep-dive",
76
+ "scope": "**/*|src/**/*|custom",
77
+ "focus_areas": ["..."]
78
+ }
79
+ ```
@@ -0,0 +1,75 @@
1
+ # Phase 2: Project Exploration
2
+
3
+ Launch parallel exploration agents based on report type.
4
+
5
+ ## Execution
6
+
7
+ ### Step 1: Map Exploration Angles
8
+
9
+ ```javascript
10
+ const angleMapping = {
11
+ architecture: ["Layer Structure", "Module Dependencies", "Entry Points", "Data Flow"],
12
+ design: ["Design Patterns", "Class Relationships", "Interface Contracts", "State Management"],
13
+ methods: ["Core Algorithms", "Critical Paths", "Public APIs", "Complex Logic"],
14
+ comprehensive: ["Layer Structure", "Design Patterns", "Core Algorithms", "Data Flow"]
15
+ };
16
+
17
+ const angles = angleMapping[config.type];
18
+ ```
19
+
20
+ ### Step 2: Launch Parallel Agents
21
+
22
+ For each angle, launch an exploration agent:
23
+
24
+ ```javascript
25
+ Task({
26
+ subagent_type: "cli-explore-agent",
27
+ run_in_background: false,
28
+ description: `Explore: ${angle}`,
29
+ prompt: `
30
+ ## Exploration Objective
31
+ Execute **${angle}** exploration for project analysis report.
32
+
33
+ ## Context
34
+ - **Angle**: ${angle}
35
+ - **Report Type**: ${config.type}
36
+ - **Depth**: ${config.depth}
37
+ - **Scope**: ${config.scope}
38
+
39
+ ## Exploration Protocol
40
+ 1. Structural Discovery (get_modules_by_depth, rg, glob)
41
+ 2. Pattern Recognition (conventions, naming, organization)
42
+ 3. Relationship Mapping (dependencies, integration points)
43
+
44
+ ## Output Format
45
+ {
46
+ "angle": "${angle}",
47
+ "findings": {
48
+ "structure": [...],
49
+ "patterns": [...],
50
+ "relationships": [...],
51
+ "key_files": [{path, relevance, rationale}]
52
+ },
53
+ "insights": [...]
54
+ }
55
+ `
56
+ })
57
+ ```
58
+
59
+ ### Step 3: Aggregate Results
60
+
61
+ Merge all exploration results into unified findings:
62
+
63
+ ```javascript
64
+ const aggregatedFindings = {
65
+ structure: [], // from all angles
66
+ patterns: [], // from all angles
67
+ relationships: [], // from all angles
68
+ key_files: [], // deduplicated
69
+ insights: [] // prioritized
70
+ };
71
+ ```
72
+
73
+ ## Output
74
+
75
+ Save exploration results to `exploration-{angle}.json` files.