claude-code-workflow 7.2.29 → 7.2.30
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/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
- package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
- package/.claude/agents/action-planning-agent.md +7 -4
- package/.claude/agents/cli-explore-agent.md +77 -63
- package/.claude/agents/cli-lite-planning-agent.md +11 -10
- package/.claude/agents/issue-plan-agent.md +421 -426
- package/.claude/commands/workflow/spec/setup.md +1 -1
- package/.claude/skills/ccw-chain/SKILL.md +119 -0
- package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
- package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
- package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
- package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
- package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
- package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
- package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
- package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
- package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
- package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
- package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
- package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
- package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
- package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
- package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
- package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
- package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
- package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
- package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
- package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
- package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
- package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
- package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
- package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
- package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
- package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
- package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
- package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
- package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
- package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
- package/.claude/skills/chain-loader/SKILL.md +78 -0
- package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
- package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
- package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
- package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
- package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
- package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
- package/.claude/skills/review-cycle/phases/review-module.md +764 -764
- package/.claude/skills/review-cycle/phases/review-session.md +775 -775
- package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
- package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
- package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
- package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
- package/README.md +14 -0
- package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
- package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
- package/ccw/dist/tools/chain-loader.d.ts +10 -0
- package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
- package/ccw/dist/tools/chain-loader.js +642 -0
- package/ccw/dist/tools/chain-loader.js.map +1 -0
- package/ccw/dist/tools/index.d.ts.map +1 -1
- package/ccw/dist/tools/index.js +2 -0
- package/ccw/dist/tools/index.js.map +1 -1
- package/ccw/dist/tools/json-builder.js +20 -0
- package/ccw/dist/tools/json-builder.js.map +1 -1
- package/ccw/dist/types/chain-types.d.ts +72 -0
- package/ccw/dist/types/chain-types.d.ts.map +1 -0
- package/ccw/dist/types/chain-types.js +5 -0
- package/ccw/dist/types/chain-types.js.map +1 -0
- package/ccw/scripts/prepublish-clean.mjs +0 -1
- package/package.json +1 -3
- package/ccw-litellm/README.md +0 -180
- package/ccw-litellm/pyproject.toml +0 -35
- package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
- package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
- package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
- package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
- package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
- package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
- package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
- package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
- package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
- package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
- package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
# Phase 7: TDD Verification
|
|
2
|
+
|
|
3
|
+
Full TDD compliance verification with quality gate reporting. Generates comprehensive TDD_COMPLIANCE_REPORT.md.
|
|
4
|
+
|
|
5
|
+
## Objective
|
|
6
|
+
|
|
7
|
+
- Verify TDD task chain structure (TEST → IMPL → REFACTOR or internal Red-Green-Refactor)
|
|
8
|
+
- Analyze test coverage metrics
|
|
9
|
+
- Validate TDD cycle execution quality
|
|
10
|
+
- Generate compliance report with quality gate recommendation
|
|
11
|
+
|
|
12
|
+
## Operating Constraints
|
|
13
|
+
|
|
14
|
+
**ORCHESTRATOR MODE**:
|
|
15
|
+
- This phase coordinates sub-steps and inline TDD coverage analysis
|
|
16
|
+
- MAY write output files: TDD_COMPLIANCE_REPORT.md (primary report), .process/*.json (intermediate artifacts)
|
|
17
|
+
- MUST NOT modify source task files or implementation code
|
|
18
|
+
- MUST NOT create or delete tasks in the workflow
|
|
19
|
+
|
|
20
|
+
**Quality Gate Authority**: The compliance report provides a binding recommendation (BLOCK_MERGE / REQUIRE_FIXES / PROCEED_WITH_CAVEATS / APPROVED) based on objective compliance criteria.
|
|
21
|
+
|
|
22
|
+
## 4-Step Execution
|
|
23
|
+
|
|
24
|
+
### Step 7.1: Session Discovery & Validation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
IF --session parameter provided:
|
|
28
|
+
session_id = provided session
|
|
29
|
+
ELSE:
|
|
30
|
+
# Auto-detect active session
|
|
31
|
+
active_sessions = bash(find .workflow/active/ -name "WFS-*" -type d 2>/dev/null)
|
|
32
|
+
IF active_sessions is empty:
|
|
33
|
+
ERROR: "No active workflow session found. Use --session <session-id>"
|
|
34
|
+
EXIT
|
|
35
|
+
ELSE IF active_sessions has multiple entries:
|
|
36
|
+
# Use most recently modified session
|
|
37
|
+
session_id = bash(ls -td .workflow/active/WFS-*/ 2>/dev/null | head -1 | xargs basename)
|
|
38
|
+
ELSE:
|
|
39
|
+
session_id = basename(active_sessions[0])
|
|
40
|
+
|
|
41
|
+
# Derive paths
|
|
42
|
+
session_dir = .workflow/active/WFS-{session_id}
|
|
43
|
+
task_dir = session_dir/.task
|
|
44
|
+
summaries_dir = session_dir/.summaries
|
|
45
|
+
process_dir = session_dir/.process
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Validate Required Artifacts**:
|
|
49
|
+
```bash
|
|
50
|
+
# Check task files exist
|
|
51
|
+
task_files = Glob(task_dir/*.json)
|
|
52
|
+
IF task_files.count == 0:
|
|
53
|
+
ERROR: "No task JSON files found. Run /workflow-tdd-plan first"
|
|
54
|
+
EXIT
|
|
55
|
+
|
|
56
|
+
# Check summaries exist (optional but recommended for full analysis)
|
|
57
|
+
summaries_exist = EXISTS(summaries_dir)
|
|
58
|
+
IF NOT summaries_exist:
|
|
59
|
+
WARNING: "No .summaries/ directory found. Some analysis may be limited."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Output**: session_id, session_dir, task_files list
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### Step 7.2: Task Chain Structure Validation
|
|
67
|
+
|
|
68
|
+
**Load and Parse Task JSONs**:
|
|
69
|
+
```bash
|
|
70
|
+
# Single-pass JSON extraction using jq
|
|
71
|
+
cd '{session_dir}/.task'
|
|
72
|
+
|
|
73
|
+
# Extract all task IDs
|
|
74
|
+
task_ids=$(jq -r '.id' *.json 2>/dev/null | sort)
|
|
75
|
+
|
|
76
|
+
# Extract dependencies for IMPL tasks
|
|
77
|
+
impl_deps=$(jq -r 'select(.id | startswith("IMPL")) | .id + ":" + (.context.depends_on[]? // "none")' *.json 2>/dev/null)
|
|
78
|
+
|
|
79
|
+
# Extract dependencies for REFACTOR tasks
|
|
80
|
+
refactor_deps=$(jq -r 'select(.id | startswith("REFACTOR")) | .id + ":" + (.context.depends_on[]? // "none")' *.json 2>/dev/null)
|
|
81
|
+
|
|
82
|
+
# Extract meta fields
|
|
83
|
+
meta_tdd=$(jq -r '.id + ":" + (.meta.tdd_phase // "missing")' *.json 2>/dev/null)
|
|
84
|
+
meta_agent=$(jq -r '.id + ":" + (.meta.agent // "missing")' *.json 2>/dev/null)
|
|
85
|
+
|
|
86
|
+
# Output as JSON
|
|
87
|
+
jq -n --arg ids "$task_ids" \
|
|
88
|
+
--arg impl "$impl_deps" \
|
|
89
|
+
--arg refactor "$refactor_deps" \
|
|
90
|
+
--arg tdd "$meta_tdd" \
|
|
91
|
+
--arg agent "$meta_agent" \
|
|
92
|
+
'{ids: $ids, impl_deps: $impl, refactor_deps: $refactor, tdd: $tdd, agent: $agent}'
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Validate TDD Chain Structure**:
|
|
96
|
+
```
|
|
97
|
+
Parse validation_data JSON and validate:
|
|
98
|
+
|
|
99
|
+
For each feature N (extracted from task IDs):
|
|
100
|
+
1. TEST-N.M exists?
|
|
101
|
+
2. IMPL-N.M exists?
|
|
102
|
+
3. REFACTOR-N.M exists? (optional but recommended)
|
|
103
|
+
4. IMPL-N.M.context.depends_on contains TEST-N.M?
|
|
104
|
+
5. REFACTOR-N.M.context.depends_on contains IMPL-N.M?
|
|
105
|
+
6. TEST-N.M.meta.tdd_phase == "red"?
|
|
106
|
+
7. TEST-N.M.meta.agent == "@code-review-test-agent"?
|
|
107
|
+
8. IMPL-N.M.meta.tdd_phase == "green"?
|
|
108
|
+
9. IMPL-N.M.meta.agent == "@code-developer"?
|
|
109
|
+
10. REFACTOR-N.M.meta.tdd_phase == "refactor"?
|
|
110
|
+
|
|
111
|
+
Calculate:
|
|
112
|
+
- chain_completeness_score = (complete_chains / total_chains) * 100
|
|
113
|
+
- dependency_accuracy = (correct_deps / total_deps) * 100
|
|
114
|
+
- meta_field_accuracy = (correct_meta / total_meta) * 100
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Output**: chain_validation_report (JSON structure with validation results)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Step 7.3: Coverage & Cycle Analysis
|
|
122
|
+
|
|
123
|
+
**Execute TDD Coverage Analysis**:
|
|
124
|
+
|
|
125
|
+
#### Phase 3a: Extract Test Tasks
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Find TEST task files and extract focus_paths
|
|
129
|
+
find .workflow/active/{session_id}/.task/ -name 'TEST-*.json' -exec jq -r '.context.focus_paths[]' {} \;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Output**: List of test directories/files from all TEST tasks
|
|
133
|
+
|
|
134
|
+
#### Phase 3b: Run Test Suite
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Auto-detect test framework from project
|
|
138
|
+
if [ -f "package.json" ] && grep -q "jest\|mocha\|vitest" package.json; then
|
|
139
|
+
TEST_CMD="npm test -- --coverage --json"
|
|
140
|
+
elif [ -f "pytest.ini" ] || [ -f "setup.py" ]; then
|
|
141
|
+
TEST_CMD="pytest --cov --json-report"
|
|
142
|
+
elif [ -f "Cargo.toml" ]; then
|
|
143
|
+
TEST_CMD="cargo test -- --test-threads=1 --nocapture"
|
|
144
|
+
elif [ -f "go.mod" ]; then
|
|
145
|
+
TEST_CMD="go test -coverprofile=coverage.out -json ./..."
|
|
146
|
+
else
|
|
147
|
+
TEST_CMD="echo 'No supported test framework found'"
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
# Execute test suite with coverage
|
|
151
|
+
$TEST_CMD > .workflow/active/{session_id}/.process/test-results.json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Output**: test-results.json with coverage data
|
|
155
|
+
|
|
156
|
+
#### Phase 3c: Parse Coverage Data
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
jq '.coverage' .workflow/active/{session_id}/.process/test-results.json > .workflow/active/{session_id}/.process/coverage-report.json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Extract**:
|
|
163
|
+
- Line coverage percentage
|
|
164
|
+
- Branch coverage percentage
|
|
165
|
+
- Function coverage percentage
|
|
166
|
+
- Uncovered lines/branches
|
|
167
|
+
|
|
168
|
+
#### Phase 3d: Verify TDD Cycle
|
|
169
|
+
|
|
170
|
+
For each TDD chain (TEST-N.M -> IMPL-N.M -> REFACTOR-N.M):
|
|
171
|
+
|
|
172
|
+
**1. Red Phase Verification**
|
|
173
|
+
```bash
|
|
174
|
+
cat .workflow/active/{session_id}/.summaries/TEST-N.M-summary.md
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Verify:
|
|
178
|
+
- Tests were created
|
|
179
|
+
- Tests failed initially
|
|
180
|
+
- Failure messages were clear
|
|
181
|
+
|
|
182
|
+
**2. Green Phase Verification**
|
|
183
|
+
```bash
|
|
184
|
+
cat .workflow/active/{session_id}/.summaries/IMPL-N.M-summary.md
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Verify:
|
|
188
|
+
- Implementation was completed
|
|
189
|
+
- Tests now pass
|
|
190
|
+
- Implementation was minimal
|
|
191
|
+
|
|
192
|
+
**3. Refactor Phase Verification**
|
|
193
|
+
```bash
|
|
194
|
+
cat .workflow/active/{session_id}/.summaries/REFACTOR-N.M-summary.md
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Verify:
|
|
198
|
+
- Refactoring was completed
|
|
199
|
+
- Tests still pass
|
|
200
|
+
- Code quality improved
|
|
201
|
+
|
|
202
|
+
#### TDD Cycle Verification Algorithm
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
For each feature N:
|
|
206
|
+
1. Load TEST-N.M-summary.md
|
|
207
|
+
IF summary missing:
|
|
208
|
+
Mark: "Red phase incomplete"
|
|
209
|
+
SKIP to next feature
|
|
210
|
+
|
|
211
|
+
CHECK: Contains "test" AND "fail"
|
|
212
|
+
IF NOT found:
|
|
213
|
+
Mark: "Red phase verification failed"
|
|
214
|
+
ELSE:
|
|
215
|
+
Mark: "Red phase [PASS]"
|
|
216
|
+
|
|
217
|
+
2. Load IMPL-N.M-summary.md
|
|
218
|
+
IF summary missing:
|
|
219
|
+
Mark: "Green phase incomplete"
|
|
220
|
+
SKIP to next feature
|
|
221
|
+
|
|
222
|
+
CHECK: Contains "pass" OR "green"
|
|
223
|
+
IF NOT found:
|
|
224
|
+
Mark: "Green phase verification failed"
|
|
225
|
+
ELSE:
|
|
226
|
+
Mark: "Green phase [PASS]"
|
|
227
|
+
|
|
228
|
+
3. Load REFACTOR-N.M-summary.md
|
|
229
|
+
IF summary missing:
|
|
230
|
+
Mark: "Refactor phase incomplete"
|
|
231
|
+
CONTINUE (refactor is optional)
|
|
232
|
+
|
|
233
|
+
CHECK: Contains "refactor" AND "pass"
|
|
234
|
+
IF NOT found:
|
|
235
|
+
Mark: "Refactor phase verification failed"
|
|
236
|
+
ELSE:
|
|
237
|
+
Mark: "Refactor phase [PASS]"
|
|
238
|
+
|
|
239
|
+
4. Calculate chain score:
|
|
240
|
+
- Red + Green + Refactor all [PASS] = 100%
|
|
241
|
+
- Red + Green [PASS], Refactor missing = 80%
|
|
242
|
+
- Red [PASS], Green missing = 40%
|
|
243
|
+
- All missing = 0%
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### Phase 3e: Generate Analysis Report
|
|
247
|
+
|
|
248
|
+
Create `.workflow/active/{session_id}/.process/tdd-cycle-report.md`:
|
|
249
|
+
|
|
250
|
+
```markdown
|
|
251
|
+
# TDD Cycle Analysis - {Session ID}
|
|
252
|
+
|
|
253
|
+
## Coverage Metrics
|
|
254
|
+
- **Line Coverage**: {percentage}%
|
|
255
|
+
- **Branch Coverage**: {percentage}%
|
|
256
|
+
- **Function Coverage**: {percentage}%
|
|
257
|
+
|
|
258
|
+
## Coverage Details
|
|
259
|
+
### Covered
|
|
260
|
+
- {covered_lines} lines
|
|
261
|
+
- {covered_branches} branches
|
|
262
|
+
- {covered_functions} functions
|
|
263
|
+
|
|
264
|
+
### Uncovered
|
|
265
|
+
- Lines: {uncovered_line_numbers}
|
|
266
|
+
- Branches: {uncovered_branch_locations}
|
|
267
|
+
|
|
268
|
+
## TDD Cycle Verification
|
|
269
|
+
|
|
270
|
+
### Feature 1: {Feature Name}
|
|
271
|
+
**Chain**: TEST-1.1 -> IMPL-1.1 -> REFACTOR-1.1
|
|
272
|
+
|
|
273
|
+
- [PASS] **Red Phase**: Tests created and failed initially
|
|
274
|
+
- [PASS] **Green Phase**: Implementation made tests pass
|
|
275
|
+
- [PASS] **Refactor Phase**: Refactoring maintained green tests
|
|
276
|
+
|
|
277
|
+
[Repeat for all features]
|
|
278
|
+
|
|
279
|
+
## TDD Compliance Summary
|
|
280
|
+
- **Total Chains**: {N}
|
|
281
|
+
- **Complete Cycles**: {N}
|
|
282
|
+
- **Incomplete Cycles**: {0}
|
|
283
|
+
- **Compliance Score**: {score}/100
|
|
284
|
+
|
|
285
|
+
## Gaps Identified
|
|
286
|
+
- {gap descriptions}
|
|
287
|
+
|
|
288
|
+
## Recommendations
|
|
289
|
+
- {improvement suggestions}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
#### Coverage Metrics Calculation
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
line_coverage=$(jq '.coverage.lineCoverage' test-results.json)
|
|
296
|
+
branch_coverage=$(jq '.coverage.branchCoverage' test-results.json)
|
|
297
|
+
function_coverage=$(jq '.coverage.functionCoverage' test-results.json)
|
|
298
|
+
|
|
299
|
+
overall_score=$(echo "($line_coverage + $branch_coverage + $function_coverage) / 3" | bc)
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Parse Output Files**:
|
|
303
|
+
```bash
|
|
304
|
+
# Check required outputs exist
|
|
305
|
+
IF NOT EXISTS(process_dir/test-results.json):
|
|
306
|
+
WARNING: "test-results.json not found. Coverage analysis incomplete."
|
|
307
|
+
coverage_data = null
|
|
308
|
+
ELSE:
|
|
309
|
+
coverage_data = Read(process_dir/test-results.json)
|
|
310
|
+
|
|
311
|
+
IF NOT EXISTS(process_dir/coverage-report.json):
|
|
312
|
+
WARNING: "coverage-report.json not found. Coverage metrics incomplete."
|
|
313
|
+
metrics = null
|
|
314
|
+
ELSE:
|
|
315
|
+
metrics = Read(process_dir/coverage-report.json)
|
|
316
|
+
|
|
317
|
+
IF NOT EXISTS(process_dir/tdd-cycle-report.md):
|
|
318
|
+
WARNING: "tdd-cycle-report.md not found. Cycle validation incomplete."
|
|
319
|
+
cycle_data = null
|
|
320
|
+
ELSE:
|
|
321
|
+
cycle_data = Read(process_dir/tdd-cycle-report.md)
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Extract Coverage Metrics**:
|
|
325
|
+
```
|
|
326
|
+
If coverage_data exists:
|
|
327
|
+
- line_coverage_percent
|
|
328
|
+
- branch_coverage_percent
|
|
329
|
+
- function_coverage_percent
|
|
330
|
+
- uncovered_files (list)
|
|
331
|
+
- uncovered_lines (map: file -> line ranges)
|
|
332
|
+
|
|
333
|
+
If cycle_data exists:
|
|
334
|
+
- red_phase_compliance (tests failed initially?)
|
|
335
|
+
- green_phase_compliance (tests pass after impl?)
|
|
336
|
+
- refactor_phase_compliance (tests stay green during refactor?)
|
|
337
|
+
- minimal_implementation_score (was impl minimal?)
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Output**: coverage_analysis, cycle_analysis
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
### Step 7.4: Compliance Report Generation
|
|
345
|
+
|
|
346
|
+
**Calculate Compliance Score**:
|
|
347
|
+
```
|
|
348
|
+
Base Score: 100 points
|
|
349
|
+
|
|
350
|
+
Deductions:
|
|
351
|
+
Chain Structure:
|
|
352
|
+
- Missing TEST task: -30 points per feature
|
|
353
|
+
- Missing IMPL task: -30 points per feature
|
|
354
|
+
- Missing REFACTOR task: -10 points per feature
|
|
355
|
+
- Wrong dependency: -15 points per error
|
|
356
|
+
- Wrong agent: -5 points per error
|
|
357
|
+
- Wrong tdd_phase: -5 points per error
|
|
358
|
+
|
|
359
|
+
TDD Cycle Compliance:
|
|
360
|
+
- Test didn't fail initially: -10 points per feature
|
|
361
|
+
- Tests didn't pass after IMPL: -20 points per feature
|
|
362
|
+
- Tests broke during REFACTOR: -15 points per feature
|
|
363
|
+
- Over-engineered IMPL: -10 points per feature
|
|
364
|
+
|
|
365
|
+
Coverage Quality:
|
|
366
|
+
- Line coverage < 80%: -5 points
|
|
367
|
+
- Branch coverage < 70%: -5 points
|
|
368
|
+
- Function coverage < 80%: -5 points
|
|
369
|
+
- Critical paths uncovered: -10 points
|
|
370
|
+
|
|
371
|
+
Final Score: Max(0, Base Score - Total Deductions)
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Determine Quality Gate**:
|
|
375
|
+
```
|
|
376
|
+
IF score >= 90 AND no_critical_violations:
|
|
377
|
+
recommendation = "APPROVED"
|
|
378
|
+
ELSE IF score >= 70 AND critical_violations == 0:
|
|
379
|
+
recommendation = "PROCEED_WITH_CAVEATS"
|
|
380
|
+
ELSE IF score >= 50:
|
|
381
|
+
recommendation = "REQUIRE_FIXES"
|
|
382
|
+
ELSE:
|
|
383
|
+
recommendation = "BLOCK_MERGE"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Quality Gate Criteria**:
|
|
387
|
+
|
|
388
|
+
| Recommendation | Score Range | Critical Violations | Action |
|
|
389
|
+
|----------------|-------------|---------------------|--------|
|
|
390
|
+
| **APPROVED** | ≥90 | 0 | Safe to merge |
|
|
391
|
+
| **PROCEED_WITH_CAVEATS** | ≥70 | 0 | Can proceed, address minor issues |
|
|
392
|
+
| **REQUIRE_FIXES** | ≥50 | Any | Must fix before merge |
|
|
393
|
+
| **BLOCK_MERGE** | <50 | Any | Block merge until resolved |
|
|
394
|
+
|
|
395
|
+
**Critical Violations**:
|
|
396
|
+
- Missing TEST or IMPL task for any feature
|
|
397
|
+
- Tests didn't fail initially (Red phase violation)
|
|
398
|
+
- Tests didn't pass after IMPL (Green phase violation)
|
|
399
|
+
- Tests broke during REFACTOR (Refactor phase violation)
|
|
400
|
+
|
|
401
|
+
**Generate Report**:
|
|
402
|
+
```javascript
|
|
403
|
+
const report_content = generateComplianceReport(/* see template below */)
|
|
404
|
+
const report_path = `${session_dir}/TDD_COMPLIANCE_REPORT.md`
|
|
405
|
+
Write(report_path, report_content)
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**Display Summary to User**:
|
|
409
|
+
```
|
|
410
|
+
=== TDD Verification Complete ===
|
|
411
|
+
Session: {session_id}
|
|
412
|
+
Report: {report_path}
|
|
413
|
+
|
|
414
|
+
Quality Gate: {recommendation}
|
|
415
|
+
Compliance Score: {score}/100
|
|
416
|
+
|
|
417
|
+
Chain Validation: {chain_completeness_score}%
|
|
418
|
+
Line Coverage: {line_coverage}%
|
|
419
|
+
Branch Coverage: {branch_coverage}%
|
|
420
|
+
|
|
421
|
+
Next: Review full report for detailed findings
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
## TDD Compliance Report Template
|
|
425
|
+
|
|
426
|
+
```markdown
|
|
427
|
+
# TDD Compliance Report - {Session ID}
|
|
428
|
+
|
|
429
|
+
**Generated**: {timestamp}
|
|
430
|
+
**Session**: WFS-{sessionId}
|
|
431
|
+
**Workflow Type**: TDD
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Executive Summary
|
|
436
|
+
|
|
437
|
+
### Quality Gate Decision
|
|
438
|
+
|
|
439
|
+
| Metric | Value | Status |
|
|
440
|
+
|--------|-------|--------|
|
|
441
|
+
| Compliance Score | {score}/100 | {status_emoji} |
|
|
442
|
+
| Chain Completeness | {percentage}% | {status} |
|
|
443
|
+
| Line Coverage | {percentage}% | {status} |
|
|
444
|
+
| Branch Coverage | {percentage}% | {status} |
|
|
445
|
+
| Function Coverage | {percentage}% | {status} |
|
|
446
|
+
|
|
447
|
+
### Recommendation
|
|
448
|
+
|
|
449
|
+
**{RECOMMENDATION}**
|
|
450
|
+
|
|
451
|
+
**Decision Rationale**:
|
|
452
|
+
{brief explanation based on score and violations}
|
|
453
|
+
|
|
454
|
+
**Quality Gate Criteria**:
|
|
455
|
+
- **APPROVED**: Score ≥90, no critical violations
|
|
456
|
+
- **PROCEED_WITH_CAVEATS**: Score ≥70, no critical violations
|
|
457
|
+
- **REQUIRE_FIXES**: Score ≥50 or critical violations exist
|
|
458
|
+
- **BLOCK_MERGE**: Score <50
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## Chain Analysis
|
|
463
|
+
|
|
464
|
+
### Feature 1: {Feature Name}
|
|
465
|
+
**Status**: ✅ Complete
|
|
466
|
+
**Chain**: TEST-1.1 → IMPL-1.1 → REFACTOR-1.1
|
|
467
|
+
|
|
468
|
+
| Phase | Task | Status | Details |
|
|
469
|
+
|-------|------|--------|---------|
|
|
470
|
+
| Red | TEST-1.1 | ✅ Pass | Test created and failed with clear message |
|
|
471
|
+
| Green | IMPL-1.1 | ✅ Pass | Minimal implementation made test pass |
|
|
472
|
+
| Refactor | REFACTOR-1.1 | ✅ Pass | Code improved, tests remained green |
|
|
473
|
+
|
|
474
|
+
### Chain Validation Summary
|
|
475
|
+
|
|
476
|
+
| Metric | Value |
|
|
477
|
+
|--------|-------|
|
|
478
|
+
| Total Features | {count} |
|
|
479
|
+
| Complete Chains | {count} ({percent}%) |
|
|
480
|
+
| Incomplete Chains | {count} |
|
|
481
|
+
| Missing TEST | {count} |
|
|
482
|
+
| Missing IMPL | {count} |
|
|
483
|
+
| Missing REFACTOR | {count} |
|
|
484
|
+
| Dependency Errors | {count} |
|
|
485
|
+
| Meta Field Errors | {count} |
|
|
486
|
+
|
|
487
|
+
---
|
|
488
|
+
|
|
489
|
+
## Test Coverage Analysis
|
|
490
|
+
|
|
491
|
+
### Coverage Metrics
|
|
492
|
+
|
|
493
|
+
| Metric | Coverage | Target | Status |
|
|
494
|
+
|--------|----------|--------|--------|
|
|
495
|
+
| Line Coverage | {percentage}% | ≥80% | {status} |
|
|
496
|
+
| Branch Coverage | {percentage}% | ≥70% | {status} |
|
|
497
|
+
| Function Coverage | {percentage}% | ≥80% | {status} |
|
|
498
|
+
|
|
499
|
+
### Coverage Gaps
|
|
500
|
+
|
|
501
|
+
| File | Lines | Issue | Priority |
|
|
502
|
+
|------|-------|-------|----------|
|
|
503
|
+
| {file} | {lines} | {issue} | {priority} |
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## TDD Cycle Validation
|
|
508
|
+
|
|
509
|
+
### Red Phase (Write Failing Test)
|
|
510
|
+
- {N}/{total} features had failing tests initially ({percent}%)
|
|
511
|
+
- ✅ Compliant features: {list}
|
|
512
|
+
- ❌ Non-compliant features: {list}
|
|
513
|
+
|
|
514
|
+
### Green Phase (Make Test Pass)
|
|
515
|
+
- {N}/{total} implementations made tests pass ({percent}%)
|
|
516
|
+
- ✅ Compliant features: {list}
|
|
517
|
+
- ❌ Non-compliant features: {list}
|
|
518
|
+
|
|
519
|
+
### Refactor Phase (Improve Quality)
|
|
520
|
+
- {N}/{total} features completed refactoring ({percent}%)
|
|
521
|
+
- ✅ Compliant features: {list}
|
|
522
|
+
- ❌ Non-compliant features: {list}
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## Best Practices Assessment
|
|
527
|
+
|
|
528
|
+
### Strengths
|
|
529
|
+
- {strengths}
|
|
530
|
+
|
|
531
|
+
### Areas for Improvement
|
|
532
|
+
- {improvements}
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Detailed Findings by Severity
|
|
537
|
+
|
|
538
|
+
### Critical Issues ({count})
|
|
539
|
+
{List of critical issues with impact and remediation}
|
|
540
|
+
|
|
541
|
+
### High Priority Issues ({count})
|
|
542
|
+
{List of high priority issues}
|
|
543
|
+
|
|
544
|
+
### Medium Priority Issues ({count})
|
|
545
|
+
{List of medium priority issues}
|
|
546
|
+
|
|
547
|
+
### Low Priority Issues ({count})
|
|
548
|
+
{List of low priority issues}
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
## Recommendations
|
|
553
|
+
|
|
554
|
+
### Required Fixes (Before Merge)
|
|
555
|
+
1. {required fixes}
|
|
556
|
+
|
|
557
|
+
### Recommended Improvements
|
|
558
|
+
1. {recommended improvements}
|
|
559
|
+
|
|
560
|
+
### Optional Enhancements
|
|
561
|
+
1. {optional enhancements}
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
## Metrics Summary
|
|
566
|
+
|
|
567
|
+
| Metric | Value |
|
|
568
|
+
|--------|-------|
|
|
569
|
+
| Total Features | {count} |
|
|
570
|
+
| Complete Chains | {count} ({percent}%) |
|
|
571
|
+
| Compliance Score | {score}/100 |
|
|
572
|
+
| Critical Issues | {count} |
|
|
573
|
+
| High Issues | {count} |
|
|
574
|
+
| Medium Issues | {count} |
|
|
575
|
+
| Low Issues | {count} |
|
|
576
|
+
| Line Coverage | {percent}% |
|
|
577
|
+
| Branch Coverage | {percent}% |
|
|
578
|
+
| Function Coverage | {percent}% |
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
**Report End**
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
## Error Handling
|
|
586
|
+
|
|
587
|
+
### Session Discovery Errors
|
|
588
|
+
|
|
589
|
+
| Error | Cause | Resolution |
|
|
590
|
+
|-------|-------|------------|
|
|
591
|
+
| No active session | No WFS-* directories | Provide --session explicitly |
|
|
592
|
+
| Multiple active sessions | Multiple WFS-* directories | Provide --session explicitly |
|
|
593
|
+
| Session not found | Invalid session-id | Check available sessions |
|
|
594
|
+
|
|
595
|
+
### Validation Errors
|
|
596
|
+
|
|
597
|
+
| Error | Cause | Resolution |
|
|
598
|
+
|-------|-------|------------|
|
|
599
|
+
| Task files missing | Incomplete planning | Run /workflow-tdd-plan first |
|
|
600
|
+
| Invalid JSON | Corrupted task files | Regenerate tasks |
|
|
601
|
+
| Missing summaries | Tasks not executed | Execute tasks before verify |
|
|
602
|
+
|
|
603
|
+
### Analysis Errors
|
|
604
|
+
|
|
605
|
+
| Error | Cause | Resolution |
|
|
606
|
+
|-------|-------|------------|
|
|
607
|
+
| Coverage tool missing | No test framework | Configure testing first |
|
|
608
|
+
| Tests fail to run | Code errors | Fix errors before verify |
|
|
609
|
+
| Coverage analysis fails | Test framework or coverage tool error | Check test framework configuration |
|
|
610
|
+
|
|
611
|
+
## Output
|
|
612
|
+
|
|
613
|
+
- **File**: `TDD_COMPLIANCE_REPORT.md` (comprehensive compliance report)
|
|
614
|
+
- **Files**: `.process/test-results.json`, `.process/coverage-report.json`, `.process/tdd-cycle-report.md`
|
|
615
|
+
|
|
616
|
+
## Output Files Structure
|
|
617
|
+
|
|
618
|
+
```
|
|
619
|
+
.workflow/active/WFS-{session-id}/
|
|
620
|
+
├── TDD_COMPLIANCE_REPORT.md # Comprehensive compliance report ⭐
|
|
621
|
+
└── .process/
|
|
622
|
+
├── test-results.json # From coverage analysis (Step 7.3)
|
|
623
|
+
├── coverage-report.json # From coverage analysis (Step 7.3)
|
|
624
|
+
└── tdd-cycle-report.md # From coverage analysis (Step 7.3)
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
## Next Steps Decision Table
|
|
628
|
+
|
|
629
|
+
| Situation | Recommended Command | Purpose |
|
|
630
|
+
|-----------|---------------------|---------|
|
|
631
|
+
| APPROVED | `workflow-execute` skill | Start TDD implementation |
|
|
632
|
+
| PROCEED_WITH_CAVEATS | `workflow-execute` skill | Start with noted caveats |
|
|
633
|
+
| REQUIRE_FIXES | Review report, refine tasks | Address issues before proceed |
|
|
634
|
+
| BLOCK_MERGE | `workflow-plan` skill (replan phase) | Significant restructuring needed |
|
|
635
|
+
| After implementation | Re-run `workflow-tdd-plan` skill (tdd-verify phase) | Verify post-execution compliance |
|