cc-devflow 2.4.6 → 4.1.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/.claude/CLAUDE.md +1065 -48
- package/.claude/agents/dev-implementer.md +195 -0
- package/.claude/commands/{flow-archive.md → flow/archive.md} +46 -11
- package/.claude/commands/flow/context.md +150 -0
- package/.claude/commands/flow/delta.md +245 -0
- package/.claude/commands/{flow-dev.md → flow/dev.md} +112 -11
- package/.claude/commands/flow/init.md +45 -0
- package/.claude/commands/flow/quality.md +159 -0
- package/.claude/commands/flow/spec.md +186 -0
- package/.claude/commands/flow/workspace.md +146 -0
- package/.claude/commands/{cancel-ralph.md → util/cancel-ralph.md} +1 -0
- package/.claude/config/quality-gates.yml +305 -0
- package/.claude/docs/guides/TEAM_MODE_GUIDE.md +313 -0
- package/.claude/docs/templates/DELTA_SPEC_TEMPLATE.md +91 -0
- package/.claude/docs/templates/DESIGN_DECISIONS_TEMPLATE.md +151 -0
- package/.claude/docs/templates/JOURNAL_TEMPLATE.md +75 -0
- package/.claude/docs/templates/_shared/CLAUDE.md +36 -0
- package/.claude/docs/templates/_shared/CONSTITUTION_CHECK.md +125 -0
- package/.claude/docs/templates/_shared/VALIDATION_CHECKLIST.md +187 -0
- package/.claude/docs/templates/_shared/YAML_FRONTMATTER.md +164 -0
- package/.claude/docs/templates/context/dev.jsonl.template +6 -0
- package/.claude/docs/templates/context/epic.jsonl.template +5 -0
- package/.claude/docs/templates/context/prd.jsonl.template +4 -0
- package/.claude/docs/templates/context/research.jsonl.template +4 -0
- package/.claude/docs/templates/context/review.jsonl.template +5 -0
- package/.claude/docs/templates/context/tech.jsonl.template +5 -0
- package/.claude/hooks/CLAUDE.md +342 -0
- package/.claude/hooks/inject-agent-context.ts +480 -0
- package/.claude/hooks/inject-skill-context.ts +359 -0
- package/.claude/hooks/ralph-loop.ts +931 -0
- package/.claude/hooks/task-completed-hook.ts +593 -0
- package/.claude/hooks/teammate-idle-hook.ts +690 -0
- package/.claude/hooks/types/team-types.d.ts +238 -0
- package/.claude/rules/devflow-conventions.md +82 -9
- package/.claude/scripts/archive-requirement.sh +44 -1
- package/.claude/scripts/common.sh +670 -3
- package/.claude/scripts/delta-parser.ts +527 -0
- package/.claude/scripts/detect-file-conflicts.sh +151 -0
- package/.claude/scripts/flow-context-add.sh +134 -0
- package/.claude/scripts/flow-context-init.sh +133 -0
- package/.claude/scripts/flow-context-validate.sh +144 -0
- package/.claude/scripts/flow-delta-apply.sh +297 -0
- package/.claude/scripts/flow-delta-archive.sh +71 -0
- package/.claude/scripts/flow-delta-create.sh +202 -0
- package/.claude/scripts/flow-delta-list.sh +142 -0
- package/.claude/scripts/flow-delta-status.sh +235 -0
- package/.claude/scripts/flow-quality-full.sh +184 -0
- package/.claude/scripts/flow-quality-quick.sh +64 -0
- package/.claude/scripts/flow-workspace-init.sh +117 -0
- package/.claude/scripts/flow-workspace-record.sh +164 -0
- package/.claude/scripts/flow-workspace-start.sh +88 -0
- package/.claude/scripts/get-workflow-status.sh +415 -0
- package/.claude/scripts/parse-task-dependencies.js +334 -0
- package/.claude/scripts/record-quality-error.sh +165 -0
- package/.claude/scripts/run-quality-gates.sh +242 -0
- package/.claude/scripts/team-dev-init.sh +319 -0
- package/.claude/scripts/team-state-recovery.sh +229 -0
- package/.claude/scripts/workflow-status.ts +433 -0
- package/.claude/settings.json +19 -0
- package/.claude/skills/cc-devflow-orchestrator/SKILL.md +85 -200
- package/.claude/skills/domain/using-git-worktrees/SKILL.md +252 -0
- package/.claude/skills/domain/using-git-worktrees/assets/SHELL_ALIASES.md +133 -0
- package/.claude/skills/domain/using-git-worktrees/context.jsonl +4 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-cleanup.sh +218 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-create.sh +232 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-list.sh +130 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-status.sh +140 -0
- package/.claude/skills/domain/using-git-worktrees/scripts/worktree-switch.sh +70 -0
- package/.claude/skills/skill-rules.json +72 -1
- package/.claude/skills/utility/journey-checker/SKILL.md +199 -0
- package/.claude/skills/utility/journey-checker/pressure-scenarios.md +164 -0
- package/.claude/skills/utility/skill-creator/LICENSE.txt +202 -0
- package/.claude/skills/utility/skill-creator/SKILL.md +356 -0
- package/.claude/skills/utility/skill-creator/references/output-patterns.md +82 -0
- package/.claude/skills/utility/skill-creator/references/workflows.md +28 -0
- package/.claude/skills/utility/skill-creator/scripts/init_skill.py +303 -0
- package/.claude/skills/utility/skill-creator/scripts/package_skill.py +110 -0
- package/.claude/skills/utility/skill-creator/scripts/quick_validate.py +95 -0
- package/.claude/skills/workflow/flow-dev/CLAUDE.md +78 -0
- package/.claude/skills/workflow/flow-dev/SKILL.md +96 -0
- package/.claude/skills/workflow/flow-dev/assets/IMPLEMENTATION_PLAN_TEMPLATE.md +71 -0
- package/.claude/skills/workflow/flow-dev/context.jsonl +8 -0
- package/.claude/skills/workflow/flow-dev/dev-implementer.jsonl +8 -0
- package/.claude/skills/workflow/flow-dev/scripts/entry-gate.sh +116 -0
- package/.claude/skills/workflow/flow-dev/scripts/exit-gate.sh +101 -0
- package/.claude/skills/workflow/flow-dev/scripts/task-orchestrator.sh +106 -0
- package/.claude/skills/workflow/flow-fix/SKILL.md +105 -0
- package/.claude/skills/workflow/flow-fix/context.jsonl +6 -0
- package/.claude/skills/workflow/flow-fix/references/bug-analyzer.md +381 -0
- package/.claude/skills/workflow/flow-init/SKILL.md +211 -0
- package/.claude/skills/workflow/flow-init/assets/BRAINSTORM_TEMPLATE.md +148 -0
- package/.claude/skills/workflow/flow-init/assets/INIT_FLOW_TEMPLATE.md +198 -0
- package/.claude/skills/workflow/flow-init/assets/RESEARCH_TEMPLATE.md +276 -0
- package/.claude/skills/workflow/flow-init/context.jsonl +5 -0
- package/.claude/skills/workflow/flow-init/references/flow-researcher.md +132 -0
- package/.claude/skills/workflow/flow-init/scripts/check-prerequisites.sh +232 -0
- package/.claude/skills/workflow/flow-init/scripts/consolidate-research.sh +182 -0
- package/.claude/skills/workflow/flow-init/scripts/create-requirement.sh +515 -0
- package/.claude/skills/workflow/flow-init/scripts/generate-research-tasks.sh +157 -0
- package/.claude/skills/workflow/flow-init/scripts/populate-research-tasks.sh +284 -0
- package/.claude/skills/workflow/flow-init/scripts/validate-research.sh +332 -0
- package/.claude/skills/workflow/flow-quality/SKILL.md +94 -0
- package/.claude/skills/workflow/flow-quality/context.jsonl +6 -0
- package/.claude/skills/workflow/flow-quality/references/code-quality-reviewer.md +205 -0
- package/.claude/skills/workflow/flow-quality/references/qa-tester.md +313 -0
- package/.claude/skills/workflow/flow-quality/references/security-reviewer.md +314 -0
- package/.claude/skills/workflow/flow-quality/references/spec-reviewer.md +221 -0
- package/.claude/skills/workflow/flow-release/SKILL.md +126 -0
- package/.claude/skills/workflow/flow-release/context.jsonl +7 -0
- package/.claude/skills/workflow/flow-release/references/release-manager.md +295 -0
- package/.claude/skills/workflow/flow-spec/CLAUDE.md +103 -0
- package/.claude/skills/workflow/flow-spec/SKILL.md +545 -0
- package/.claude/skills/workflow/flow-spec/context.jsonl +7 -0
- package/.claude/skills/workflow/flow-spec/scripts/entry-gate.sh +194 -0
- package/.claude/skills/workflow/flow-spec/scripts/exit-gate.sh +244 -0
- package/.claude/skills/workflow/flow-spec/scripts/parallel-orchestrator.sh +205 -0
- package/.claude/skills/workflow/flow-spec/scripts/team-communication.sh +353 -0
- package/.claude/skills/workflow/flow-spec/scripts/team-init.sh +195 -0
- package/.claude/skills/workflow/flow-spec/scripts/test-team-mode.sh +496 -0
- package/.claude/skills/workflow/flow-spec/team-config.json +165 -0
- package/.claude/skills/workflow.yaml +417 -0
- package/CHANGELOG.md +254 -0
- package/README.md +193 -33
- package/README.zh-CN.md +206 -46
- package/lib/compiler/CLAUDE.md +77 -46
- package/lib/compiler/__tests__/multi-module-emitters.test.js +508 -0
- package/lib/compiler/context-expander.js +179 -0
- package/lib/compiler/emitters/antigravity-emitter.js +195 -5
- package/lib/compiler/emitters/base-emitter.js +217 -2
- package/lib/compiler/emitters/codex-emitter.js +200 -4
- package/lib/compiler/emitters/cursor-emitter.js +307 -3
- package/lib/compiler/emitters/qwen-emitter.js +196 -4
- package/lib/compiler/index.js +197 -2
- package/lib/compiler/platforms.js +270 -21
- package/package.json +1 -1
- package/.claude/commands/flow-epic.md +0 -183
- package/.claude/commands/flow-init.md +0 -370
- package/.claude/commands/flow-prd.md +0 -144
- package/.claude/commands/flow-qa.md +0 -93
- package/.claude/commands/flow-review.md +0 -257
- package/.claude/commands/flow-tech.md +0 -142
- package/.claude/commands/flow-ui.md +0 -189
- package/.claude/skills/file-header-guardian/SKILL.md +0 -56
- package/.claude/skills/skill-developer/ADVANCED.md +0 -197
- package/.claude/skills/skill-developer/HOOK_MECHANISMS.md +0 -306
- package/.claude/skills/skill-developer/PATTERNS_LIBRARY.md +0 -152
- package/.claude/skills/skill-developer/SKILL.md +0 -426
- package/.claude/skills/skill-developer/SKILL_RULES_REFERENCE.md +0 -315
- package/.claude/skills/skill-developer/TRIGGER_TYPES.md +0 -305
- package/.claude/skills/skill-developer/TROUBLESHOOTING.md +0 -514
- package/.claude/skills/writing-skills/SKILL.md +0 -655
- package/.claude/skills/writing-skills/anthropic-best-practices.md +0 -1150
- package/.claude/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -189
- package/.claude/skills/writing-skills/graphviz-conventions.dot +0 -172
- package/.claude/skills/writing-skills/persuasion-principles.md +0 -187
- package/.claude/skills/writing-skills/render-graphs.js +0 -168
- package/.claude/skills/writing-skills/testing-skills-with-subagents.md +0 -384
- package/.claude/tsc-cache/795ba6e3-b98a-423b-bab2-51aa62812569/affected-repos.txt +0 -1
- package/.claude/tsc-cache/ae335694-be5a-4ba4-a1a0-b676c09a7906/affected-repos.txt +0 -1
- /package/.claude/commands/{core-architecture.md → core/architecture.md} +0 -0
- /package/.claude/commands/{core-guidelines.md → core/guidelines.md} +0 -0
- /package/.claude/commands/{core-roadmap.md → core/roadmap.md} +0 -0
- /package/.claude/commands/{core-style.md → core/style.md} +0 -0
- /package/.claude/commands/{flow-checklist.md → flow/checklist.md} +0 -0
- /package/.claude/commands/{flow-clarify.md → flow/clarify.md} +0 -0
- /package/.claude/commands/{flow-constitution.md → flow/constitution.md} +0 -0
- /package/.claude/commands/{flow-fix.md → flow/fix.md} +0 -0
- /package/.claude/commands/{flow-ideate.md → flow/ideate.md} +0 -0
- /package/.claude/commands/{flow-new.md → flow/new.md} +0 -0
- /package/.claude/commands/{flow-release.md → flow/release.md} +0 -0
- /package/.claude/commands/{flow-restart.md → flow/restart.md} +0 -0
- /package/.claude/commands/{flow-status.md → flow/status.md} +0 -0
- /package/.claude/commands/{flow-update.md → flow/update.md} +0 -0
- /package/.claude/commands/{flow-upgrade.md → flow/upgrade.md} +0 -0
- /package/.claude/commands/{flow-verify.md → flow/verify.md} +0 -0
- /package/.claude/commands/{code-review-high.md → util/code-review.md} +0 -0
- /package/.claude/commands/{git-commit.md → util/git-commit.md} +0 -0
- /package/.claude/commands/{problem-analyzer.md → util/problem-analyzer.md} +0 -0
- /package/.claude/skills/{flow-attention-refresh → domain/attention-refresh}/SKILL.md +0 -0
- /package/.claude/skills/{flow-brainstorming → domain/brainstorming}/SKILL.md +0 -0
- /package/.claude/skills/{flow-debugging → domain/debugging}/SKILL.md +0 -0
- /package/.claude/skills/{flow-finishing-branch → domain/finishing-branch}/SKILL.md +0 -0
- /package/.claude/skills/{flow-receiving-review → domain/receiving-review}/SKILL.md +0 -0
- /package/.claude/skills/{flow-tdd → domain/tdd}/SKILL.md +0 -0
- /package/.claude/skills/{verification-before-completion → domain/verification}/SKILL.md +0 -0
- /package/.claude/skills/{constitution-guardian → guardrail/constitution-guardian}/SKILL.md +0 -0
- /package/.claude/skills/{devflow-tdd-enforcer → guardrail/tdd-enforcer}/SKILL.md +0 -0
- /package/.claude/skills/{devflow-constitution-quick-ref → utility/constitution-quick-ref}/SKILL.md +0 -0
- /package/.claude/skills/{devflow-file-standards → utility/file-standards}/SKILL.md +0 -0
- /package/.claude/skills/{fractal-docs-generator → utility/fractal-docs}/SKILL.md +0 -0
- /package/.claude/skills/{npm-release → utility/npm-release}/SKILL.md +0 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bug-analyzer
|
|
3
|
+
description: Analyzes BUG descriptions and creates detailed technical analysis documents with root cause investigation and fix strategy.
|
|
4
|
+
tools: Read, Write, WebFetch, WebSearch, Grep, Glob
|
|
5
|
+
model: inherit
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a BUG analysis specialist focused on technical investigation and root cause analysis.
|
|
9
|
+
|
|
10
|
+
Your role:
|
|
11
|
+
- Analyze BUG descriptions and symptoms to identify root causes
|
|
12
|
+
- Investigate codebase patterns and potential failure points
|
|
13
|
+
- Create structured technical analysis with actionable insights
|
|
14
|
+
- Provide fix strategy recommendations and risk assessment
|
|
15
|
+
|
|
16
|
+
## Rules Integration
|
|
17
|
+
You MUST follow these rules during BUG analysis:
|
|
18
|
+
|
|
19
|
+
1. **Standard Patterns**:
|
|
20
|
+
- Apply Fail Fast principle: validate BUG description completeness immediately
|
|
21
|
+
- Use Clear Errors when BUG symptoms are unclear or non-reproducible
|
|
22
|
+
- Maintain Minimal Output with focused, technical analysis
|
|
23
|
+
- Follow Structured Output format for consistent analysis sections
|
|
24
|
+
|
|
25
|
+
2. **Agent Coordination**:
|
|
26
|
+
- Update status in orchestration_status.json when analysis begins and completes
|
|
27
|
+
- Implement proper error handling for unclear BUG symptoms
|
|
28
|
+
- Avoid file locks (read-only agent - only generate documents)
|
|
29
|
+
|
|
30
|
+
3. **DateTime Handling**:
|
|
31
|
+
- Include ISO 8601 UTC timestamps in YAML frontmatter
|
|
32
|
+
- Use real system time for analysis metadata
|
|
33
|
+
- Handle timezone-aware incident timelines correctly
|
|
34
|
+
- Support cross-platform datetime operations in analysis
|
|
35
|
+
|
|
36
|
+
4. **DevFlow Patterns** (${DEVFLOW_CLAUDE_DIR:-.claude}/rules/devflow-conventions.md):
|
|
37
|
+
- Enforce BUG-ID format validation in metadata (BUG-\d+)
|
|
38
|
+
- Use standardized analysis template structure from ${DEVFLOW_CLAUDE_DIR:-.claude}/docs/templates/
|
|
39
|
+
- Apply consistent technical analysis formatting
|
|
40
|
+
- Maintain traceability links to related code and issues
|
|
41
|
+
|
|
42
|
+
## Constitution Compliance
|
|
43
|
+
You MUST adhere to CC-DevFlow Constitution (${DEVFLOW_CLAUDE_DIR:-.claude}/rules/project-constitution.md):
|
|
44
|
+
|
|
45
|
+
1. **Quality First**:
|
|
46
|
+
- NO PARTIAL ANALYSIS: Complete root cause investigation or report insufficient data
|
|
47
|
+
- Ensure 100% traceability from symptoms to root causes
|
|
48
|
+
- All hypotheses must be testable and evidence-based
|
|
49
|
+
|
|
50
|
+
2. **Architecture Consistency**:
|
|
51
|
+
- Follow existing codebase patterns when suggesting fixes
|
|
52
|
+
- NO CODE DUPLICATION in fix recommendations
|
|
53
|
+
- Respect established naming conventions and module boundaries
|
|
54
|
+
|
|
55
|
+
3. **Security First**:
|
|
56
|
+
- Always consider security implications of BUGs and fixes
|
|
57
|
+
- NO HARDCODED SECRETS in any recommendations
|
|
58
|
+
- Validate all input data and error conditions
|
|
59
|
+
|
|
60
|
+
4. **Performance Accountability**:
|
|
61
|
+
- Assess performance impact of both BUG and proposed fixes
|
|
62
|
+
- NO RESOURCE LEAKS in fix strategies
|
|
63
|
+
- Consider scalability implications
|
|
64
|
+
|
|
65
|
+
5. **Maintainability**:
|
|
66
|
+
- NO DEAD CODE in fix recommendations
|
|
67
|
+
- Clear separation of concerns in proposed solutions
|
|
68
|
+
- Ensure fixes are well-documented and understandable
|
|
69
|
+
|
|
70
|
+
## Input Contract
|
|
71
|
+
When called by main agent for BUG analysis, you will receive:
|
|
72
|
+
- bugId: BUG ID for context (BUG-XXX format)
|
|
73
|
+
- description: BUG description and symptoms
|
|
74
|
+
- **MUST OUTPUT**: `devflow/bugs/${bugId}/ANALYSIS.md`
|
|
75
|
+
|
|
76
|
+
## Prerequisites Validation
|
|
77
|
+
Before starting analysis, validate prerequisites using check-prerequisites.sh:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Set environment variable for BUG ID
|
|
81
|
+
export DEVFLOW_REQ_ID="${bugId}"
|
|
82
|
+
|
|
83
|
+
# Run prerequisite check
|
|
84
|
+
bash ${DEVFLOW_CLAUDE_DIR:-.claude}/scripts/check-prerequisites.sh --json
|
|
85
|
+
|
|
86
|
+
# Expected validations:
|
|
87
|
+
# - BUG ID format (BUG-\d+)
|
|
88
|
+
# - BUG directory structure exists
|
|
89
|
+
# - Required documents present (BUG description)
|
|
90
|
+
# - Git repository state is clean
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
If prerequisites fail, report error and stop analysis immediately (Fail Fast principle).
|
|
94
|
+
|
|
95
|
+
## Analysis Process
|
|
96
|
+
1. **Symptom Analysis**: Parse BUG description and identify key symptoms
|
|
97
|
+
2. **Codebase Investigation**: Search for related code patterns and potential failure points
|
|
98
|
+
3. **Root Cause Hypothesis**: Develop technical hypotheses about underlying causes
|
|
99
|
+
4. **Impact Assessment**: Evaluate severity, scope, and user impact
|
|
100
|
+
5. **Fix Strategy**: Recommend approach and identify risks
|
|
101
|
+
6. **Documentation**: Create comprehensive technical analysis
|
|
102
|
+
|
|
103
|
+
## BUG Analysis Methodology
|
|
104
|
+
|
|
105
|
+
### 1. Symptom Classification
|
|
106
|
+
- **Error Type**: Runtime error, logic error, performance issue, UI/UX issue
|
|
107
|
+
- **Frequency**: Always, intermittent, specific conditions
|
|
108
|
+
- **Scope**: Single user, multiple users, system-wide
|
|
109
|
+
- **Environment**: Development, staging, production
|
|
110
|
+
|
|
111
|
+
### 2. Technical Investigation
|
|
112
|
+
- **Code Pattern Analysis**: Search for related functions, modules, components
|
|
113
|
+
- **Error Propagation**: Trace potential error sources and propagation paths
|
|
114
|
+
- **Data Flow Analysis**: Identify data transformation and validation points
|
|
115
|
+
- **External Dependencies**: Check third-party services, APIs, databases
|
|
116
|
+
|
|
117
|
+
### 3. Root Cause Identification
|
|
118
|
+
- **Primary Cause**: Most likely technical root cause
|
|
119
|
+
- **Contributing Factors**: Secondary issues that compound the problem
|
|
120
|
+
- **Systemic Issues**: Architectural or process issues that enabled the BUG
|
|
121
|
+
|
|
122
|
+
### 4. Fix Strategy Development
|
|
123
|
+
- **Approach Options**: Multiple potential fix approaches with pros/cons
|
|
124
|
+
- **Risk Assessment**: Potential side effects and regression risks
|
|
125
|
+
- **Rollback Plan**: Safe rollback strategy if fix fails
|
|
126
|
+
- **Testing Strategy**: How to verify fix and prevent regression
|
|
127
|
+
|
|
128
|
+
## Output Structure
|
|
129
|
+
|
|
130
|
+
Generate comprehensive `devflow/bugs/${bugId}/ANALYSIS.md` containing:
|
|
131
|
+
|
|
132
|
+
### JSON Output Support
|
|
133
|
+
When `--json` flag is requested, also generate `devflow/bugs/${bugId}/ANALYSIS.json`:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"bugId": "${bugId}",
|
|
138
|
+
"title": "${title}",
|
|
139
|
+
"severity": "${severity}",
|
|
140
|
+
"status": "analyzed",
|
|
141
|
+
"timestamps": {
|
|
142
|
+
"createdAt": "${ISO8601_timestamp}",
|
|
143
|
+
"updatedAt": "${ISO8601_timestamp}",
|
|
144
|
+
"analyzedAt": "${ISO8601_timestamp}"
|
|
145
|
+
},
|
|
146
|
+
"analyst": "bug-analyzer",
|
|
147
|
+
"rootCause": {
|
|
148
|
+
"primary": "${primaryCause}",
|
|
149
|
+
"contributing": ["${factor1}", "${factor2}"],
|
|
150
|
+
"systemic": "${systemicIssues}"
|
|
151
|
+
},
|
|
152
|
+
"impact": {
|
|
153
|
+
"severity": "${severity}",
|
|
154
|
+
"affectedUsers": "${affectedUsers}",
|
|
155
|
+
"businessImpact": "${businessImpact}",
|
|
156
|
+
"technicalImpact": "${technicalImpact}"
|
|
157
|
+
},
|
|
158
|
+
"fixStrategy": {
|
|
159
|
+
"recommended": {
|
|
160
|
+
"approach": "${recommendedApproach}",
|
|
161
|
+
"effort": "${estimatedEffort}",
|
|
162
|
+
"risk": "${regressionRisk}"
|
|
163
|
+
},
|
|
164
|
+
"alternatives": [
|
|
165
|
+
{"approach": "${alt1}", "pros": [], "cons": []}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"relatedFiles": ["${file1}", "${file2}"],
|
|
169
|
+
"testingStrategy": {
|
|
170
|
+
"bugReproduction": "${reproductionSteps}",
|
|
171
|
+
"fixValidation": "${validationTests}",
|
|
172
|
+
"regressionTests": ["${test1}", "${test2}"]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Markdown Output
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
---
|
|
181
|
+
bugId: ${bugId}
|
|
182
|
+
title: ${title}
|
|
183
|
+
severity: ${severity}
|
|
184
|
+
status: analyzed
|
|
185
|
+
createdAt: ${timestamp}
|
|
186
|
+
updatedAt: ${timestamp}
|
|
187
|
+
analyst: bug-analyzer
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
# BUG分析报告 - ${bugId}
|
|
191
|
+
|
|
192
|
+
## 概览
|
|
193
|
+
- **BUG描述**: ${description}
|
|
194
|
+
- **严重程度**: ${severity} (Critical/High/Medium/Low)
|
|
195
|
+
- **影响范围**: ${impact}
|
|
196
|
+
- **优先级**: ${priority}
|
|
197
|
+
|
|
198
|
+
## 症状分析
|
|
199
|
+
|
|
200
|
+
### 错误表现
|
|
201
|
+
- **错误类型**: ${errorType}
|
|
202
|
+
- **错误信息**: ${errorMessage}
|
|
203
|
+
- **发生频率**: ${frequency}
|
|
204
|
+
- **触发条件**: ${triggerConditions}
|
|
205
|
+
|
|
206
|
+
### 复现步骤
|
|
207
|
+
1. ${step1}
|
|
208
|
+
2. ${step2}
|
|
209
|
+
3. ${step3}
|
|
210
|
+
|
|
211
|
+
### 预期行为
|
|
212
|
+
${expectedBehavior}
|
|
213
|
+
|
|
214
|
+
### 实际行为
|
|
215
|
+
${actualBehavior}
|
|
216
|
+
|
|
217
|
+
## 技术调查
|
|
218
|
+
|
|
219
|
+
### 代码分析
|
|
220
|
+
- **相关文件**: ${relatedFiles}
|
|
221
|
+
- **可疑函数**: ${suspiciousFunctions}
|
|
222
|
+
- **数据流**: ${dataFlow}
|
|
223
|
+
- **错误传播路径**: ${errorPropagation}
|
|
224
|
+
|
|
225
|
+
### 依赖分析
|
|
226
|
+
- **外部服务**: ${externalServices}
|
|
227
|
+
- **第三方库**: ${thirdPartyLibs}
|
|
228
|
+
- **数据库查询**: ${databaseQueries}
|
|
229
|
+
- **API调用**: ${apiCalls}
|
|
230
|
+
|
|
231
|
+
## 根本原因
|
|
232
|
+
|
|
233
|
+
### 主要原因
|
|
234
|
+
${primaryCause}
|
|
235
|
+
|
|
236
|
+
### 贡献因素
|
|
237
|
+
- ${contributingFactor1}
|
|
238
|
+
- ${contributingFactor2}
|
|
239
|
+
|
|
240
|
+
### 系统性问题
|
|
241
|
+
${systemicIssues}
|
|
242
|
+
|
|
243
|
+
## 影响评估
|
|
244
|
+
|
|
245
|
+
### 用户影响
|
|
246
|
+
- **受影响用户**: ${affectedUsers}
|
|
247
|
+
- **功能影响**: ${functionalImpact}
|
|
248
|
+
- **业务影响**: ${businessImpact}
|
|
249
|
+
|
|
250
|
+
### 技术影响
|
|
251
|
+
- **性能影响**: ${performanceImpact}
|
|
252
|
+
- **数据完整性**: ${dataIntegrity}
|
|
253
|
+
- **系统稳定性**: ${systemStability}
|
|
254
|
+
|
|
255
|
+
## 修复策略
|
|
256
|
+
|
|
257
|
+
### 推荐方案
|
|
258
|
+
**方案**: ${recommendedApproach}
|
|
259
|
+
**理由**: ${reasoning}
|
|
260
|
+
**预估工作量**: ${estimatedEffort}
|
|
261
|
+
|
|
262
|
+
### 备选方案
|
|
263
|
+
1. **方案B**: ${alternativeApproach1}
|
|
264
|
+
- 优点: ${pros1}
|
|
265
|
+
- 缺点: ${cons1}
|
|
266
|
+
|
|
267
|
+
2. **方案C**: ${alternativeApproach2}
|
|
268
|
+
- 优点: ${pros2}
|
|
269
|
+
- 缺点: ${cons2}
|
|
270
|
+
|
|
271
|
+
## 风险评估
|
|
272
|
+
|
|
273
|
+
### 修复风险
|
|
274
|
+
- **回归风险**: ${regressionRisk}
|
|
275
|
+
- **性能风险**: ${performanceRisk}
|
|
276
|
+
- **兼容性风险**: ${compatibilityRisk}
|
|
277
|
+
|
|
278
|
+
### 缓解措施
|
|
279
|
+
- ${mitigationMeasure1}
|
|
280
|
+
- ${mitigationMeasure2}
|
|
281
|
+
|
|
282
|
+
## 回滚计划
|
|
283
|
+
${rollbackPlan}
|
|
284
|
+
|
|
285
|
+
## 测试策略
|
|
286
|
+
|
|
287
|
+
### 验证测试
|
|
288
|
+
- **BUG复现测试**: 确认BUG可以稳定复现
|
|
289
|
+
- **修复验证测试**: 确认修复有效
|
|
290
|
+
- **边界测试**: 测试修复的边界条件
|
|
291
|
+
|
|
292
|
+
### 回归测试
|
|
293
|
+
- **核心功能测试**: ${coreFunctionTests}
|
|
294
|
+
- **集成测试**: ${integrationTests}
|
|
295
|
+
- **性能测试**: ${performanceTests}
|
|
296
|
+
|
|
297
|
+
## 预防措施
|
|
298
|
+
|
|
299
|
+
### 代码改进
|
|
300
|
+
- ${codeImprovement1}
|
|
301
|
+
- ${codeImprovement2}
|
|
302
|
+
|
|
303
|
+
### 流程改进
|
|
304
|
+
- ${processImprovement1}
|
|
305
|
+
- ${processImprovement2}
|
|
306
|
+
|
|
307
|
+
### 监控增强
|
|
308
|
+
- ${monitoringEnhancement1}
|
|
309
|
+
- ${monitoringEnhancement2}
|
|
310
|
+
|
|
311
|
+
## 相关链接
|
|
312
|
+
- **相关Issue**: ${relatedIssues}
|
|
313
|
+
- **相关PRs**: ${relatedPRs}
|
|
314
|
+
- **文档链接**: ${documentationLinks}
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
分析完成时间: ${completionTime}
|
|
318
|
+
下一步: 执行修复计划制定
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Quality Criteria
|
|
322
|
+
|
|
323
|
+
### Technical Analysis Quality
|
|
324
|
+
- Root cause analysis must be evidence-based
|
|
325
|
+
- All hypotheses must be testable
|
|
326
|
+
- Code investigation must be thorough and systematic
|
|
327
|
+
- Risk assessment must be comprehensive
|
|
328
|
+
|
|
329
|
+
### Documentation Quality
|
|
330
|
+
- Analysis must be clear and actionable
|
|
331
|
+
- Technical details must be accurate
|
|
332
|
+
- Fix recommendations must be specific
|
|
333
|
+
- Rollback plans must be safe and tested
|
|
334
|
+
|
|
335
|
+
### Traceability Requirements
|
|
336
|
+
- Link analysis to specific code locations
|
|
337
|
+
- Reference error logs and symptoms
|
|
338
|
+
- Connect to related issues and documentation
|
|
339
|
+
- Maintain audit trail of investigation steps
|
|
340
|
+
|
|
341
|
+
## Investigation Tools
|
|
342
|
+
|
|
343
|
+
### Code Analysis
|
|
344
|
+
- Use Grep tool to search for error patterns
|
|
345
|
+
- Use Glob tool to find related files
|
|
346
|
+
- Use Read tool to examine suspicious code sections
|
|
347
|
+
- Use WebSearch for known issue patterns
|
|
348
|
+
|
|
349
|
+
### Error Pattern Recognition
|
|
350
|
+
- Stack trace analysis
|
|
351
|
+
- Log pattern identification
|
|
352
|
+
- Error message correlation
|
|
353
|
+
- Timing and sequence analysis
|
|
354
|
+
|
|
355
|
+
## BUG Severity Classification
|
|
356
|
+
|
|
357
|
+
### Critical
|
|
358
|
+
- System down, data loss, security breach
|
|
359
|
+
- Immediate fix required, hotfix deployment
|
|
360
|
+
|
|
361
|
+
### High
|
|
362
|
+
- Major functionality broken, significant user impact
|
|
363
|
+
- Fix in next sprint, workaround may be needed
|
|
364
|
+
|
|
365
|
+
### Medium
|
|
366
|
+
- Minor functionality issues, limited user impact
|
|
367
|
+
- Planned fix, can wait for regular release
|
|
368
|
+
|
|
369
|
+
### Low
|
|
370
|
+
- Cosmetic issues, edge cases
|
|
371
|
+
- Future enhancement, low priority
|
|
372
|
+
|
|
373
|
+
## Process Integration
|
|
374
|
+
|
|
375
|
+
This agent integrates with the BUG fix workflow:
|
|
376
|
+
1. **Input**: BUG description from /flow-fix command
|
|
377
|
+
2. **Output**: Detailed technical analysis in ANALYSIS.md
|
|
378
|
+
3. **Next**: planner agent uses analysis to create PLAN.md
|
|
379
|
+
4. **Flow**: Feeds into testing and security analysis phases
|
|
380
|
+
|
|
381
|
+
**IMPORTANT**: This agent only performs analysis and documentation. All actual code investigation and file reading is done through the available tools. The main agent will use this analysis to drive the actual BUG fix implementation.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-init
|
|
3
|
+
description: 'Initialize requirement structure with brainstorming and research. Usage: /flow-init "REQ-123|Title|URLs". Creates BRAINSTORM.md (north star) and research artifacts.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Flow-Init Skill
|
|
7
|
+
|
|
8
|
+
> [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
初始化需求结构,包含头脑风暴和研究阶段。生成 BRAINSTORM.md 作为需求的「北极星」。
|
|
13
|
+
|
|
14
|
+
## Input Format
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
/flow-init "REQ_ID|TITLE|PLAN_URLS?"
|
|
18
|
+
/flow-init "REQ_ID|TITLE" --branch-only
|
|
19
|
+
/flow-init --interactive
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **REQ_ID**: `^(REQ|BUG)-[0-9]+$`
|
|
23
|
+
- **TITLE**: 需求简短标题
|
|
24
|
+
- **PLAN_URLS**: 计划文档URL (可选,逗号分隔)
|
|
25
|
+
- **--branch-only**: 使用传统分支模式 (不创建 worktree)
|
|
26
|
+
|
|
27
|
+
## Execution Flow
|
|
28
|
+
|
|
29
|
+
### Stage 1: Entry Gate
|
|
30
|
+
|
|
31
|
+
1. **参数解析**
|
|
32
|
+
- 验证 REQ_ID 格式
|
|
33
|
+
- 提取 TITLE 和 PLAN_URLS
|
|
34
|
+
- 若 TITLE 含中文,意译生成 BRANCH_TITLE_EN
|
|
35
|
+
|
|
36
|
+
2. **前置检查**
|
|
37
|
+
```bash
|
|
38
|
+
bash scripts/check-prerequisites.sh --json --paths-only
|
|
39
|
+
```
|
|
40
|
+
- Git 状态干净
|
|
41
|
+
- devflow/ 目录存在
|
|
42
|
+
|
|
43
|
+
3. **唯一性检查**
|
|
44
|
+
- `devflow/requirements/${REQ_ID}/` 不存在
|
|
45
|
+
|
|
46
|
+
### Stage 1.2: Git Worktree (Default) or Branch
|
|
47
|
+
|
|
48
|
+
**Worktree 模式 (默认)**:
|
|
49
|
+
```bash
|
|
50
|
+
# 计算路径
|
|
51
|
+
REPO_NAME=$(basename $(git rev-parse --show-toplevel))
|
|
52
|
+
WORKTREE_DIR="../${REPO_NAME}-${REQ_ID}"
|
|
53
|
+
BRANCH_NAME="feature/${REQ_ID}-${slug(BRANCH_TITLE_EN)}"
|
|
54
|
+
|
|
55
|
+
# 创建 worktree + 分支
|
|
56
|
+
git worktree add -b "$BRANCH_NAME" "$WORKTREE_DIR"
|
|
57
|
+
|
|
58
|
+
# 切换到 worktree
|
|
59
|
+
cd "$WORKTREE_DIR"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**分支模式 (--branch-only)**:
|
|
63
|
+
```bash
|
|
64
|
+
# Requirements
|
|
65
|
+
git checkout -b feature/${REQ_ID}-${slug(BRANCH_TITLE_EN)}
|
|
66
|
+
|
|
67
|
+
# Bug Fixes
|
|
68
|
+
git checkout -b bugfix/${BUG_ID}-${slug(BRANCH_TITLE_EN)}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Stage 1.5: Context Loading
|
|
72
|
+
|
|
73
|
+
检查并加载 (如存在):
|
|
74
|
+
- `devflow/ROADMAP.md`
|
|
75
|
+
- `devflow/ARCHITECTURE.md`
|
|
76
|
+
|
|
77
|
+
### Stage 2: Directory Init
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
bash scripts/create-requirement.sh "${REQ_ID}" --title "${TITLE}"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
生成:
|
|
84
|
+
- `devflow/requirements/${REQ_ID}/README.md`
|
|
85
|
+
- `devflow/requirements/${REQ_ID}/EXECUTION_LOG.md`
|
|
86
|
+
- `devflow/requirements/${REQ_ID}/orchestration_status.json`
|
|
87
|
+
- `devflow/requirements/${REQ_ID}/research/`
|
|
88
|
+
|
|
89
|
+
### Stage 2.3: Brainstorming (MANDATORY)
|
|
90
|
+
|
|
91
|
+
**Iron Law**: `NO FLOW EXECUTION WITHOUT BRAINSTORM ALIGNMENT`
|
|
92
|
+
|
|
93
|
+
触发 `flow-brainstorming` skill,执行:
|
|
94
|
+
|
|
95
|
+
1. **Understanding** - 一次问一个问题
|
|
96
|
+
2. **Exploring** - 提出 2-3 种方案
|
|
97
|
+
3. **Presenting** - 分段呈现设计
|
|
98
|
+
4. **Documentation** - 输出 BRAINSTORM.md
|
|
99
|
+
|
|
100
|
+
**输出**: `devflow/requirements/${REQ_ID}/BRAINSTORM.md`
|
|
101
|
+
|
|
102
|
+
**验证**:
|
|
103
|
+
- [ ] BRAINSTORM.md 存在
|
|
104
|
+
- [ ] 包含「原始需求」章节
|
|
105
|
+
- [ ] 包含「成功标准」章节
|
|
106
|
+
- [ ] 包含「方案探索」章节
|
|
107
|
+
- [ ] 包含「最终决策」章节
|
|
108
|
+
|
|
109
|
+
### Stage 2.5: Research (Subagent)
|
|
110
|
+
|
|
111
|
+
调用 `flow-researcher` subagent:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"reqId": "${REQ_ID}",
|
|
116
|
+
"reqDir": "devflow/requirements/${REQ_ID}",
|
|
117
|
+
"title": "${TITLE}",
|
|
118
|
+
"planUrls": ["..."],
|
|
119
|
+
"contextFiles": {
|
|
120
|
+
"brainstorm": "devflow/requirements/${REQ_ID}/BRAINSTORM.md"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**输出**:
|
|
126
|
+
- `research/internal/codebase-overview.md`
|
|
127
|
+
- `research/mcp/YYYYMMDD/**`
|
|
128
|
+
- `research/research-summary.md`
|
|
129
|
+
- `research/tasks.json`
|
|
130
|
+
- `research/research.md`
|
|
131
|
+
|
|
132
|
+
### Stage 3: README Generation
|
|
133
|
+
|
|
134
|
+
生成 `devflow/requirements/${REQ_ID}/README.md`
|
|
135
|
+
|
|
136
|
+
### Stage 4: Exit Gate (5-Level)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# Level 2: Structure validation
|
|
140
|
+
bash scripts/validate-research.sh "${REQ_DIR}" --strict
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**验证**:
|
|
144
|
+
1. File Existence
|
|
145
|
+
2. Research.md Structure
|
|
146
|
+
3. Content Quality (无 TODO/PLACEHOLDER)
|
|
147
|
+
4. Tasks.json Validation
|
|
148
|
+
5. Git & Status & Constitution
|
|
149
|
+
|
|
150
|
+
## Output Artifacts
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
devflow/requirements/${REQ_ID}/
|
|
154
|
+
├── README.md
|
|
155
|
+
├── BRAINSTORM.md # 北极星
|
|
156
|
+
├── research/
|
|
157
|
+
│ ├── internal/
|
|
158
|
+
│ │ └── codebase-overview.md
|
|
159
|
+
│ ├── mcp/YYYYMMDD/
|
|
160
|
+
│ ├── research.md
|
|
161
|
+
│ ├── research-summary.md
|
|
162
|
+
│ └── tasks.json
|
|
163
|
+
├── EXECUTION_LOG.md
|
|
164
|
+
└── orchestration_status.json
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Scripts Reference
|
|
168
|
+
|
|
169
|
+
| Script | Purpose |
|
|
170
|
+
|--------|---------|
|
|
171
|
+
| `scripts/check-prerequisites.sh` | 前置条件检查 |
|
|
172
|
+
| `scripts/create-requirement.sh` | 创建目录结构 |
|
|
173
|
+
| `scripts/generate-research-tasks.sh` | 生成研究任务 |
|
|
174
|
+
| `scripts/populate-research-tasks.sh` | 填充任务内容 |
|
|
175
|
+
| `scripts/consolidate-research.sh` | 整合研究结果 |
|
|
176
|
+
| `scripts/validate-research.sh` | 验证研究质量 |
|
|
177
|
+
|
|
178
|
+
## Templates Reference
|
|
179
|
+
|
|
180
|
+
| Template | Purpose |
|
|
181
|
+
|----------|---------|
|
|
182
|
+
| `assets/INIT_FLOW_TEMPLATE.md` | 详细执行流程 |
|
|
183
|
+
| `assets/RESEARCH_TEMPLATE.md` | 研究文档格式 |
|
|
184
|
+
| `assets/BRAINSTORM_TEMPLATE.md` | 头脑风暴模板 |
|
|
185
|
+
|
|
186
|
+
## Agent Reference
|
|
187
|
+
|
|
188
|
+
| Agent | Purpose |
|
|
189
|
+
|-------|---------|
|
|
190
|
+
| `references/flow-researcher.md` | 研究 subagent 指令 |
|
|
191
|
+
|
|
192
|
+
## Error Handling
|
|
193
|
+
|
|
194
|
+
| Error | Solution |
|
|
195
|
+
|-------|----------|
|
|
196
|
+
| Invalid REQ_ID | 检查格式 `^(REQ\|BUG)-[0-9]+$` |
|
|
197
|
+
| REQ_ID exists | 使用不同 ID 或 --force |
|
|
198
|
+
| Git not clean | commit/stash changes |
|
|
199
|
+
| Research validation failed | 手动补充 research.md |
|
|
200
|
+
|
|
201
|
+
## Next Step
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
/flow-prd "${REQ_ID}"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
**Related Skills**:
|
|
210
|
+
- `flow-brainstorming` - 头脑风暴
|
|
211
|
+
- `flow-prd` - PRD 生成
|