claude-code-workflow 7.2.30 → 7.3.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/commands/workflow-skill.md +130 -0
- package/.claude/skills/ccw-chain/SKILL.md +44 -71
- package/.claude/skills/ccw-chain/chains/ccw-cycle.json +13 -3
- package/.claude/skills/ccw-chain/chains/ccw-exploration.json +33 -22
- package/.claude/skills/ccw-chain/chains/ccw-issue.json +23 -12
- package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +23 -9
- package/.claude/skills/ccw-chain/chains/ccw-main.json +15 -2
- package/.claude/skills/ccw-chain/chains/ccw-standard.json +28 -16
- package/.claude/skills/ccw-chain/chains/ccw-team.json +7 -2
- package/.claude/skills/ccw-chain/chains/ccw-with-file.json +25 -9
- package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -53
- package/.claude/skills/chain-loader/specs/chain-schema.md +30 -3
- package/.claude/skills/chain-loader/templates/chain-json.md +63 -63
- package/.claude/skills/workflow-plan/SKILL.md +1 -0
- package/.claude/skills/workflow-plan/phases/01-session-discovery.md +19 -2
- package/.claude/skills/workflow-plan/phases/02-context-gathering.md +2 -2
- package/.claude/skills/workflow-plan/phases/04-task-generation.md +9 -1
- package/.codex/skills/analyze-with-file/SKILL.md +383 -134
- package/.codex/skills/brainstorm/SKILL.md +3 -3
- package/.codex/skills/brainstorm-with-file/SKILL.md +208 -88
- package/.codex/skills/clean/SKILL.md +1 -1
- package/.codex/skills/csv-wave-pipeline/SKILL.md +2 -2
- package/.codex/skills/investigate/orchestrator.md +24 -0
- package/.codex/skills/issue-discover/SKILL.md +374 -361
- package/.codex/skills/issue-discover/phases/01-issue-new.md +1 -1
- package/.codex/skills/issue-discover/phases/02-discover.md +2 -2
- package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +1 -1
- package/.codex/skills/issue-discover/phases/04-quick-execute.md +2 -2
- package/.codex/skills/parallel-dev-cycle/SKILL.md +44 -37
- package/.codex/skills/project-documentation-workflow/SKILL.md +1 -1
- package/.codex/skills/review-cycle/SKILL.md +31 -12
- package/.codex/skills/roadmap-with-file/SKILL.md +141 -133
- package/.codex/skills/security-audit/orchestrator.md +29 -0
- package/.codex/skills/session-sync/SKILL.md +1 -1
- package/.codex/skills/ship/orchestrator.md +24 -0
- package/.codex/skills/spec-add/SKILL.md +5 -5
- package/.codex/skills/spec-generator/SKILL.md +33 -2
- package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +3 -3
- package/.codex/skills/spec-generator/phases/01-discovery.md +1 -1
- package/.codex/skills/spec-generator/phases/02-product-brief.md +1 -1
- package/.codex/skills/spec-generator/phases/03-requirements.md +1 -1
- package/.codex/skills/spec-generator/phases/04-architecture.md +1 -1
- package/.codex/skills/spec-generator/phases/05-epics-stories.md +1 -1
- package/.codex/skills/spec-generator/phases/06-readiness-check.md +1 -1
- package/.codex/skills/spec-generator/phases/07-issue-export.md +1 -1
- package/.codex/skills/spec-setup/SKILL.md +669 -669
- package/.codex/skills/team-arch-opt/specs/team-config.json +1 -1
- package/.codex/skills/team-brainstorm/SKILL.md +259 -259
- package/.codex/skills/team-coordinate/SKILL.md +359 -359
- package/.codex/skills/team-coordinate/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-designer/SKILL.md +27 -1
- package/.codex/skills/team-designer/phases/01-requirements-analysis.md +2 -2
- package/.codex/skills/team-designer/phases/02-scaffold-generation.md +1 -1
- package/.codex/skills/team-designer/phases/04-validation.md +1 -1
- package/.codex/skills/team-executor/SKILL.md +218 -218
- package/.codex/skills/team-frontend/SKILL.md +227 -227
- package/.codex/skills/team-frontend-debug/SKILL.md +278 -278
- package/.codex/skills/team-frontend-debug/roles/coordinator/commands/analyze.md +2 -2
- package/.codex/skills/team-interactive-craft/SKILL.md +220 -220
- package/.codex/skills/team-interactive-craft/roles/coordinator/role.md +209 -209
- package/.codex/skills/team-issue/SKILL.md +269 -269
- package/.codex/skills/team-issue/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-lifecycle-v4/SKILL.md +305 -305
- package/.codex/skills/team-motion-design/SKILL.md +222 -222
- package/.codex/skills/team-motion-design/roles/coordinator/role.md +210 -210
- package/.codex/skills/team-perf-opt/SKILL.md +258 -258
- package/.codex/skills/team-perf-opt/specs/team-config.json +1 -1
- package/.codex/skills/team-planex/SKILL.md +216 -216
- package/.codex/skills/team-quality-assurance/SKILL.md +229 -229
- package/.codex/skills/team-review/SKILL.md +227 -227
- package/.codex/skills/team-roadmap-dev/SKILL.md +238 -238
- package/.codex/skills/team-roadmap-dev/roles/coordinator/commands/roadmap-discuss.md +5 -5
- package/.codex/skills/team-tech-debt/SKILL.md +206 -206
- package/.codex/skills/team-tech-debt/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-testing/SKILL.md +237 -237
- package/.codex/skills/team-ui-polish/SKILL.md +218 -218
- package/.codex/skills/team-ui-polish/roles/coordinator/role.md +213 -213
- package/.codex/skills/team-uidesign/SKILL.md +219 -219
- package/.codex/skills/team-uidesign/roles/coordinator/role.md +2 -2
- package/.codex/skills/team-ultra-analyze/SKILL.md +260 -260
- package/.codex/skills/team-ultra-analyze/roles/coordinator/commands/monitor.md +1 -1
- package/.codex/skills/team-ultra-analyze/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-ux-improve/SKILL.md +227 -227
- package/.codex/skills/team-ux-improve/roles/coordinator/role.md +1 -1
- package/.codex/skills/team-ux-improve/specs/team-config.json +1 -1
- package/.codex/skills/team-visual-a11y/SKILL.md +319 -319
- package/.codex/skills/team-visual-a11y/roles/coordinator/role.md +213 -213
- package/.codex/skills/workflow-execute/SKILL.md +5 -5
- package/.codex/skills/workflow-lite-planex/SKILL.md +3 -3
- package/.codex/skills/workflow-plan/SKILL.md +3 -3
- package/.codex/skills/workflow-tdd-plan/SKILL.md +4 -4
- package/.codex/skills/workflow-test-fix-cycle/SKILL.md +403 -402
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +16 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/chain-loader.d.ts +2 -0
- package/ccw/dist/commands/chain-loader.d.ts.map +1 -0
- package/ccw/dist/commands/chain-loader.js +11 -0
- package/ccw/dist/commands/chain-loader.js.map +1 -0
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +52 -1
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/launcher.d.ts +2 -0
- package/ccw/dist/commands/launcher.d.ts.map +1 -0
- package/ccw/dist/commands/launcher.js +434 -0
- package/ccw/dist/commands/launcher.js.map +1 -0
- package/ccw/dist/tools/chain-loader.d.ts.map +1 -1
- package/ccw/dist/tools/chain-loader.js +457 -45
- package/ccw/dist/tools/chain-loader.js.map +1 -1
- package/ccw/dist/tools/skill-context-loader.d.ts.map +1 -1
- package/ccw/dist/tools/skill-context-loader.js +12 -26
- package/ccw/dist/tools/skill-context-loader.js.map +1 -1
- package/ccw/dist/types/chain-types.d.ts +41 -1
- package/ccw/dist/types/chain-types.d.ts.map +1 -1
- package/ccw/dist/utils/chain-visualizer.d.ts +13 -0
- package/ccw/dist/utils/chain-visualizer.d.ts.map +1 -0
- package/ccw/dist/utils/chain-visualizer.js +164 -0
- package/ccw/dist/utils/chain-visualizer.js.map +1 -0
- package/package.json +1 -1
- package/.claude/commands/cli/cli-init.md +0 -441
- package/.claude/commands/cli/codex-review.md +0 -361
- package/.claude/commands/flow-create.md +0 -663
- package/.claude/skills/ccw-chain/phases/analyze-with-file.md +0 -788
- package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +0 -408
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +0 -207
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +0 -567
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +0 -748
- package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +0 -827
- package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +0 -482
- package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +0 -639
- package/.claude/skills/ccw-chain/phases/debug-with-file.md +0 -656
- package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +0 -936
- package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +0 -720
- package/.claude/skills/ccw-chain/phases/issue-discover.md +0 -483
- package/.claude/skills/ccw-chain/phases/issue-execute.md +0 -629
- package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +0 -382
- package/.claude/skills/ccw-chain/phases/issue-plan.md +0 -343
- package/.claude/skills/ccw-chain/phases/issue-queue.md +0 -464
- package/.claude/skills/ccw-chain/phases/refactor-cycle.md +0 -852
- package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +0 -132
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +0 -760
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +0 -764
- package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +0 -775
- package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +0 -544
- package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +0 -338
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +0 -404
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +0 -257
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +0 -274
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +0 -184
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +0 -248
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +0 -178
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +0 -144
- package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +0 -480
- package/.claude/skills/ccw-chain/phases/team-planex.md +0 -123
- package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +0 -678
- package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +0 -870
- package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +0 -625
- package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +0 -215
- package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +0 -616
- package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +0 -424
- package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +0 -466
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +0 -99
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +0 -338
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +0 -422
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +0 -440
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +0 -395
- package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +0 -594
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +0 -527
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +0 -57
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +0 -407
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +0 -172
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +0 -426
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +0 -473
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +0 -189
- package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +0 -635
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +0 -482
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +0 -60
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +0 -493
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +0 -150
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +0 -346
- package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +0 -538
- package/.claude/skills/ccw-chain/specs/intent-patterns.md +0 -60
- package/.claude/skills/team-edict.zip +0 -0
|
@@ -1,936 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: integration-test-cycle
|
|
3
|
-
description: Self-iterating integration test workflow with codebase exploration, test development, autonomous test-fix cycles, and reflection-driven strategy adjustment
|
|
4
|
-
argument-hint: "[-y|--yes] [-c|--continue] [--max-iterations=N] \"module or feature description\""
|
|
5
|
-
allowed-tools: TodoWrite(*), Agent(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*), Bash(*), Edit(*), Write(*), Skill(*)
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Auto Mode
|
|
9
|
-
|
|
10
|
-
When `--yes` or `-y`: Auto-confirm exploration decisions, use recommended test strategies, skip interactive checkpoints.
|
|
11
|
-
|
|
12
|
-
# Workflow Integration-Test-Cycle Command
|
|
13
|
-
|
|
14
|
-
## Quick Start
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
# Basic - explore and test a module
|
|
18
|
-
/workflow:integration-test-cycle "用户认证模块的集成测试"
|
|
19
|
-
|
|
20
|
-
# Auto mode - fully autonomous
|
|
21
|
-
/workflow:integration-test-cycle -y "支付流程端到端集成测试"
|
|
22
|
-
|
|
23
|
-
# Continue interrupted session
|
|
24
|
-
/workflow:integration-test-cycle --continue "认证模块"
|
|
25
|
-
|
|
26
|
-
# Custom iteration limit
|
|
27
|
-
/workflow:integration-test-cycle --max-iterations=15 "API网关集成测试"
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Context Source**: cli-explore-agent + Gemini/Codex analysis
|
|
31
|
-
**Output Directory**: `.workflow/.integration-test/{session-id}/`
|
|
32
|
-
**Core Innovation**: Reflection-driven self-iterating test cycle with documented learning evolution
|
|
33
|
-
|
|
34
|
-
## What & Why
|
|
35
|
-
|
|
36
|
-
### Core Concept
|
|
37
|
-
|
|
38
|
-
Unified integration test workflow: **Explore → Design → Develop → Test → Reflect → Adjust → Re-test** — a closed-loop that autonomously improves test quality through text-based reflection.
|
|
39
|
-
|
|
40
|
-
**vs Existing Commands**:
|
|
41
|
-
- **test-fix-gen**: Only generates test tasks, requires manual `workflow-test-fix` skill
|
|
42
|
-
- **test-cycle-execute**: Only executes pre-existing tasks, no exploration or test design
|
|
43
|
-
- **This command**: Full lifecycle — from zero knowledge to passing integration tests, with self-reflection
|
|
44
|
-
|
|
45
|
-
### Value Proposition
|
|
46
|
-
1. **Zero-to-Tests**: No prior session needed — starts from exploration
|
|
47
|
-
2. **Self-Improving**: Reflection log drives strategy adjustment between iterations
|
|
48
|
-
3. **Integration Focus**: Specifically targets cross-module boundaries and API contracts
|
|
49
|
-
4. **Documented Learning**: Every decision, failure, and adjustment recorded in reflection-log.md
|
|
50
|
-
|
|
51
|
-
## Output Artifacts
|
|
52
|
-
|
|
53
|
-
**2 核心文件 + 1 追踪目录**,全流程产物最小化:
|
|
54
|
-
|
|
55
|
-
| Artifact | Type | Description |
|
|
56
|
-
|----------|------|-------------|
|
|
57
|
-
| `reflection-log.md` | 人类可读 | ⭐ 唯一文本文档:探索发现、设计决策、迭代反思、累积认知、最终结论 |
|
|
58
|
-
| `state.json` | 机器可读 | 唯一状态文件:探索上下文、测试设计、测试清单、迭代状态、测试结果、修复历史、最终摘要 |
|
|
59
|
-
| `.trace/` | 原始日志 | CLI 输出和测试日志,仅调试用:`cli-{N}.txt`、`test-output.log` |
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
.workflow/.integration-test/ITG-{slug}-{date}/
|
|
63
|
-
├── reflection-log.md # ⭐ 唯一人类可读文档 (exploration + design + iterations + conclusions)
|
|
64
|
-
├── state.json # 唯一机器状态 (exploration + design + inventory + iterations + results + summary)
|
|
65
|
-
└── .trace/ # 原始日志 (仅调试参考)
|
|
66
|
-
├── cli-1.txt
|
|
67
|
-
├── cli-2.txt
|
|
68
|
-
└── test-output.log
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Overview
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
┌─────────────────────────────────────────────────────────────────────────┐
|
|
75
|
-
│ SELF-ITERATING INTEGRATION TEST WORKFLOW │
|
|
76
|
-
├─────────────────────────────────────────────────────────────────────────┤
|
|
77
|
-
│ │
|
|
78
|
-
│ Phase 1: Session Initialization │
|
|
79
|
-
│ ├─ Parse input (module description) │
|
|
80
|
-
│ ├─ Create session directory │
|
|
81
|
-
│ └─ Initialize reflection-log.md + state.json │
|
|
82
|
-
│ │
|
|
83
|
-
│ Phase 2: Codebase Exploration │
|
|
84
|
-
│ ├─ cli-explore-agent: Module structure & dependencies │
|
|
85
|
-
│ ├─ Identify integration points & boundaries │
|
|
86
|
-
│ ├─ Map cross-module data flows │
|
|
87
|
-
│ ├─ Write state.json.exploration │
|
|
88
|
-
│ └─ Append exploration findings to reflection-log.md │
|
|
89
|
-
│ │
|
|
90
|
-
│ Phase 3: Integration Test Design │
|
|
91
|
-
│ ├─ CLI analysis: Design test strategy │
|
|
92
|
-
│ ├─ Define integration scenarios │
|
|
93
|
-
│ ├─ [Interactive] User confirms/adjusts strategy │
|
|
94
|
-
│ ├─ Write state.json.test_design │
|
|
95
|
-
│ └─ Append design decisions to reflection-log.md │
|
|
96
|
-
│ │
|
|
97
|
-
│ Phase 4: Test Development │
|
|
98
|
-
│ ├─ @code-developer: Generate integration tests │
|
|
99
|
-
│ ├─ Code validation (imports, types, mocks) │
|
|
100
|
-
│ ├─ Write state.json.test_inventory │
|
|
101
|
-
│ └─ Append development notes to reflection-log.md │
|
|
102
|
-
│ │
|
|
103
|
-
│ Phase 5: Self-Iterating Test Cycle ◄─── CORE LOOP ──┐ │
|
|
104
|
-
│ ├─ Execute tests │ │
|
|
105
|
-
│ ├─ Calculate pass rate │ │
|
|
106
|
-
│ ├─ Decision: │ │
|
|
107
|
-
│ │ ├─ >= 95% → Phase 6 (Complete) │ │
|
|
108
|
-
│ │ └─ < 95% → Reflect & Adjust ──────────────────→ │ │
|
|
109
|
-
│ │ ├─ Inline reflection to reflection-log.md │ │
|
|
110
|
-
│ │ ├─ Update state.json.iterations │ │
|
|
111
|
-
│ │ ├─ Select strategy based on cumulative learnings │
|
|
112
|
-
│ │ ├─ @cli-planning-agent: Analyze failures │ │
|
|
113
|
-
│ │ ├─ @test-fix-agent: Apply fixes │ │
|
|
114
|
-
│ │ └─ Loop │ │
|
|
115
|
-
│ └─ Max iterations check (default: 10) │
|
|
116
|
-
│ │
|
|
117
|
-
│ Phase 6: Completion │
|
|
118
|
-
│ ├─ Write state.json.summary │
|
|
119
|
-
│ ├─ Finalize reflection-log.md with conclusions │
|
|
120
|
-
│ └─ Offer next steps │
|
|
121
|
-
│ │
|
|
122
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Implementation
|
|
126
|
-
|
|
127
|
-
### Session Initialization
|
|
128
|
-
|
|
129
|
-
**Objective**: Create session context and initialize 2 core files.
|
|
130
|
-
|
|
131
|
-
**Required Actions**:
|
|
132
|
-
1. Extract module/feature description from `$ARGUMENTS`
|
|
133
|
-
2. Generate session ID: `ITG-{slug}-{date}`
|
|
134
|
-
- slug: lowercase, alphanumeric + Chinese, max 40 chars
|
|
135
|
-
- date: YYYY-MM-DD (UTC+8)
|
|
136
|
-
3. Define session folder: `.workflow/.integration-test/{session-id}`
|
|
137
|
-
4. Parse command options:
|
|
138
|
-
- `-c` or `--continue` for session continuation
|
|
139
|
-
- `-y` or `--yes` for auto-approval mode
|
|
140
|
-
- `--max-iterations=N` (default: 10)
|
|
141
|
-
5. Auto-detect mode: If session folder + reflection-log.md exist → continue mode
|
|
142
|
-
6. Create directory structure: `{sessionFolder}/`, `{sessionFolder}/.trace/`
|
|
143
|
-
|
|
144
|
-
**Initialize reflection-log.md**:
|
|
145
|
-
|
|
146
|
-
```markdown
|
|
147
|
-
# Integration Test Reflection Log
|
|
148
|
-
|
|
149
|
-
## Session: {sessionId}
|
|
150
|
-
- **Topic**: {module_or_feature_description}
|
|
151
|
-
- **Started**: {timestamp}
|
|
152
|
-
- **Mode**: {new|continue}
|
|
153
|
-
- **Max Iterations**: {maxIterations}
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## Phase 2: Exploration
|
|
158
|
-
> Pending...
|
|
159
|
-
|
|
160
|
-
## Phase 3: Test Design
|
|
161
|
-
> Pending...
|
|
162
|
-
|
|
163
|
-
## Phase 4: Test Development
|
|
164
|
-
> Pending...
|
|
165
|
-
|
|
166
|
-
## Iteration Timeline
|
|
167
|
-
> Iterations will be appended here...
|
|
168
|
-
|
|
169
|
-
## Cumulative Learnings
|
|
170
|
-
> Updated after each iteration...
|
|
171
|
-
|
|
172
|
-
## Conclusions
|
|
173
|
-
> Final synthesis after completion...
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
**Initialize state.json**:
|
|
177
|
-
|
|
178
|
-
```json
|
|
179
|
-
{
|
|
180
|
-
"session_id": "{sessionId}",
|
|
181
|
-
"module": "{module_description}",
|
|
182
|
-
"started": "{timestamp}",
|
|
183
|
-
"max_iterations": 10,
|
|
184
|
-
"phase": "init",
|
|
185
|
-
"exploration": null,
|
|
186
|
-
"test_design": null,
|
|
187
|
-
"test_inventory": null,
|
|
188
|
-
"iterations": {
|
|
189
|
-
"current": 0,
|
|
190
|
-
"strategy": null,
|
|
191
|
-
"next_action": "explore",
|
|
192
|
-
"history": [],
|
|
193
|
-
"stuck_tests": [],
|
|
194
|
-
"latest_results": null
|
|
195
|
-
},
|
|
196
|
-
"fix_history": [],
|
|
197
|
-
"summary": null
|
|
198
|
-
}
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
### Phase 2: Codebase Exploration
|
|
204
|
-
|
|
205
|
-
**Objective**: Deep-dive into the target module, identify integration points, dependencies, and data flows.
|
|
206
|
-
|
|
207
|
-
**Workflow Steps**:
|
|
208
|
-
|
|
209
|
-
1. **Codebase Exploration via cli-explore-agent**
|
|
210
|
-
|
|
211
|
-
```javascript
|
|
212
|
-
Agent({
|
|
213
|
-
subagent_type: "cli-explore-agent",
|
|
214
|
-
run_in_background: false,
|
|
215
|
-
description: `Explore integration points: ${topicSlug}`,
|
|
216
|
-
prompt: `
|
|
217
|
-
## Analysis Context
|
|
218
|
-
Topic: ${module_description}
|
|
219
|
-
Session: ${sessionFolder}
|
|
220
|
-
|
|
221
|
-
## MANDATORY FIRST STEPS
|
|
222
|
-
1. Run: ccw tool exec get_modules_by_depth '{}'
|
|
223
|
-
2. Execute relevant searches: module boundaries, exported APIs, shared types
|
|
224
|
-
3. Read: .workflow/project-tech.json (if exists)
|
|
225
|
-
|
|
226
|
-
## Exploration Focus
|
|
227
|
-
- **Module Boundaries**: Entry points, public APIs, exported interfaces
|
|
228
|
-
- **Dependencies**: What this module depends on, what depends on it
|
|
229
|
-
- **Integration Points**: Cross-module calls, shared state, event flows
|
|
230
|
-
- **Data Contracts**: Types, schemas, validation at boundaries
|
|
231
|
-
- **Existing Tests**: Current test patterns, test utilities, mocking conventions
|
|
232
|
-
- **Configuration**: Environment dependencies, feature flags, external services
|
|
233
|
-
|
|
234
|
-
## Output
|
|
235
|
-
Update state.json field "exploration" with:
|
|
236
|
-
{
|
|
237
|
-
"module_structure": { "entry_points": [], "public_apis": [], "internal_modules": [] },
|
|
238
|
-
"dependencies": { "upstream": [], "downstream": [], "external_services": [] },
|
|
239
|
-
"integration_points": [{ "from": "", "to": "", "type": "api|event|shared_state", "contract": "" }],
|
|
240
|
-
"data_flows": [{ "name": "", "path": [], "transforms": [] }],
|
|
241
|
-
"existing_tests": { "test_files": [], "patterns": [], "utilities": [], "mocking_conventions": "" },
|
|
242
|
-
"test_framework": { "runner": "", "assertion_lib": "", "mock_lib": "" },
|
|
243
|
-
"risk_areas": [{ "area": "", "reason": "", "priority": "high|medium|low" }],
|
|
244
|
-
"_metadata": { "files_analyzed": 0, "timestamp": "" }
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
Also set state.json "phase" to "explored".
|
|
248
|
-
`
|
|
249
|
-
})
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
2. **Append to reflection-log.md** (replace `## Phase 2: Exploration` placeholder):
|
|
253
|
-
|
|
254
|
-
```markdown
|
|
255
|
-
## Phase 2: Exploration - {timestamp}
|
|
256
|
-
|
|
257
|
-
### What We Found
|
|
258
|
-
- **Module Boundaries**: {summary of entry points and APIs}
|
|
259
|
-
- **Integration Points**: {N} cross-module connections identified
|
|
260
|
-
- **Data Flows**: {key data flow paths}
|
|
261
|
-
- **Existing Test Patterns**: {test framework, conventions}
|
|
262
|
-
|
|
263
|
-
### Initial Assumptions
|
|
264
|
-
- {assumption_1}: {basis}
|
|
265
|
-
- {assumption_2}: {basis}
|
|
266
|
-
|
|
267
|
-
### Risk Areas
|
|
268
|
-
- {risk_1}: {why risky for integration testing}
|
|
269
|
-
|
|
270
|
-
### Decision Log
|
|
271
|
-
> **Decision**: Focus integration testing on {specific boundaries}
|
|
272
|
-
> - **Context**: Exploration revealed {N} integration points
|
|
273
|
-
> - **Chosen**: {approach} — **Reason**: {rationale}
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
### Phase 3: Integration Test Design
|
|
279
|
-
|
|
280
|
-
**Objective**: Design integration test strategy based on exploration findings.
|
|
281
|
-
|
|
282
|
-
**Workflow Steps**:
|
|
283
|
-
|
|
284
|
-
1. **CLI Analysis for Test Strategy Design**
|
|
285
|
-
|
|
286
|
-
```javascript
|
|
287
|
-
Bash({
|
|
288
|
-
command: `ccw cli -p "
|
|
289
|
-
PURPOSE: Design integration test strategy for '${module_description}' based on exploration findings
|
|
290
|
-
Success: Comprehensive test design covering all critical integration points
|
|
291
|
-
|
|
292
|
-
EXPLORATION CONTEXT:
|
|
293
|
-
${JSON.stringify(state.exploration, null, 2)}
|
|
294
|
-
|
|
295
|
-
TASK:
|
|
296
|
-
• Analyze integration points and prioritize by risk
|
|
297
|
-
• Design test scenarios for each critical integration boundary
|
|
298
|
-
• Define mocking strategy: what to mock vs what to test end-to-end
|
|
299
|
-
• Specify test data setup and teardown patterns
|
|
300
|
-
• Define success criteria per scenario
|
|
301
|
-
|
|
302
|
-
MODE: analysis
|
|
303
|
-
CONTEXT: @**/* | Module: ${module_description}
|
|
304
|
-
EXPECTED: Structured test design with: integration scenarios (grouped by boundary), mocking strategy, test data patterns, execution order, success criteria per scenario
|
|
305
|
-
CONSTRAINTS: Focus on integration boundaries | Follow existing test patterns | Avoid duplicating unit tests
|
|
306
|
-
" --tool gemini --mode analysis --rule analysis-analyze-code-patterns`,
|
|
307
|
-
run_in_background: true
|
|
308
|
-
})
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
2. **Interactive Strategy Confirmation** (skip in auto mode)
|
|
312
|
-
|
|
313
|
-
```javascript
|
|
314
|
-
AskUserQuestion({
|
|
315
|
-
questions: [{
|
|
316
|
-
question: "集成测试策略如何调整?",
|
|
317
|
-
header: "Test Strategy",
|
|
318
|
-
options: [
|
|
319
|
-
{ label: "确认策略,开始开发", description: "当前测试设计方案合理,直接开始生成测试" },
|
|
320
|
-
{ label: "调整测试范围", description: "需要扩大或缩小集成测试覆盖范围" },
|
|
321
|
-
{ label: "修改Mock策略", description: "对哪些模块需要Mock有不同意见" },
|
|
322
|
-
{ label: "补充测试场景", description: "有额外的集成测试场景需要覆盖" }
|
|
323
|
-
],
|
|
324
|
-
multiSelect: false
|
|
325
|
-
}]
|
|
326
|
-
})
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
3. **Update state.json** — write `test_design` field:
|
|
330
|
-
|
|
331
|
-
```json
|
|
332
|
-
{
|
|
333
|
-
"test_design": {
|
|
334
|
-
"integration_scenarios": [
|
|
335
|
-
{
|
|
336
|
-
"id": "IS-001",
|
|
337
|
-
"name": "scenario name",
|
|
338
|
-
"boundary": "moduleA → moduleB",
|
|
339
|
-
"type": "api_contract|event_flow|shared_state|data_pipeline",
|
|
340
|
-
"priority": "critical|high|medium",
|
|
341
|
-
"test_cases": [
|
|
342
|
-
{ "name": "happy path", "input": "", "expected": "", "assertion_type": "" },
|
|
343
|
-
{ "name": "error propagation", "input": "", "expected": "" },
|
|
344
|
-
{ "name": "boundary condition", "input": "", "expected": "" }
|
|
345
|
-
],
|
|
346
|
-
"mocking": { "mock_targets": [], "real_targets": [], "reason": "" },
|
|
347
|
-
"setup": "description",
|
|
348
|
-
"teardown": "description"
|
|
349
|
-
}
|
|
350
|
-
],
|
|
351
|
-
"mocking_strategy": {
|
|
352
|
-
"approach": "minimal|moderate|heavy",
|
|
353
|
-
"mock_boundaries": [],
|
|
354
|
-
"real_boundaries": [],
|
|
355
|
-
"rationale": ""
|
|
356
|
-
},
|
|
357
|
-
"execution_order": ["IS-001", "IS-002"],
|
|
358
|
-
"success_criteria": { "pass_rate": 95, "coverage_target": 80 }
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
Also set `state.json.phase` to `"designed"`.
|
|
364
|
-
|
|
365
|
-
4. **Append to reflection-log.md** (replace `## Phase 3: Test Design` placeholder):
|
|
366
|
-
|
|
367
|
-
```markdown
|
|
368
|
-
## Phase 3: Test Design - {timestamp}
|
|
369
|
-
|
|
370
|
-
### Strategy Summary
|
|
371
|
-
- **Total Scenarios**: {N} integration scenarios
|
|
372
|
-
- **Priority Distribution**: {N} critical, {N} high, {N} medium
|
|
373
|
-
- **Mocking Approach**: {minimal|moderate|heavy}
|
|
374
|
-
|
|
375
|
-
### Design Decisions
|
|
376
|
-
> **Decision**: {mocking strategy choice}
|
|
377
|
-
> - **Chosen**: {approach} — **Reason**: {rationale}
|
|
378
|
-
|
|
379
|
-
### User Feedback
|
|
380
|
-
- {user_adjustment_if_any}
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
### Phase 4: Test Development
|
|
386
|
-
|
|
387
|
-
**Objective**: Generate integration test code based on the test design.
|
|
388
|
-
|
|
389
|
-
**Workflow Steps**:
|
|
390
|
-
|
|
391
|
-
1. **Generate Integration Tests via @code-developer**
|
|
392
|
-
|
|
393
|
-
```javascript
|
|
394
|
-
Agent({
|
|
395
|
-
subagent_type: "code-developer",
|
|
396
|
-
run_in_background: false,
|
|
397
|
-
description: `Generate integration tests: ${topicSlug}`,
|
|
398
|
-
prompt: `
|
|
399
|
-
## Task Objective
|
|
400
|
-
Generate integration tests based on test design specification.
|
|
401
|
-
|
|
402
|
-
## MANDATORY FIRST STEPS
|
|
403
|
-
1. Read state.json: ${sessionFolder}/state.json — use "exploration" and "test_design" fields
|
|
404
|
-
2. Identify existing test patterns in the codebase
|
|
405
|
-
3. Read relevant source files for each integration boundary
|
|
406
|
-
|
|
407
|
-
## Test Development Requirements
|
|
408
|
-
- Follow existing test framework and conventions (from state.json.exploration.test_framework)
|
|
409
|
-
- One test file per integration boundary (or logical grouping)
|
|
410
|
-
- Include: test data setup, scenario execution, assertions, cleanup
|
|
411
|
-
- Use mocking strategy from state.json.test_design.mocking_strategy
|
|
412
|
-
- Cover all test cases defined in integration_scenarios
|
|
413
|
-
- Add descriptive test names: "should {behavior} when {condition}"
|
|
414
|
-
|
|
415
|
-
## Code Quality
|
|
416
|
-
- No hallucinated imports - verify every import exists
|
|
417
|
-
- No placeholder/TODO code - all tests must be executable
|
|
418
|
-
- Proper async/await handling
|
|
419
|
-
- Proper error assertion (expect specific error types/messages)
|
|
420
|
-
|
|
421
|
-
## Output
|
|
422
|
-
1. Write test files to appropriate directories following project conventions
|
|
423
|
-
2. Update state.json field "test_inventory" with:
|
|
424
|
-
{
|
|
425
|
-
"test_files": [{ "path": "", "scenario_ids": [], "test_count": 0, "boundary": "" }],
|
|
426
|
-
"total_tests": 0,
|
|
427
|
-
"total_files": 0,
|
|
428
|
-
"timestamp": ""
|
|
429
|
-
}
|
|
430
|
-
Also set state.json "phase" to "developed".
|
|
431
|
-
`
|
|
432
|
-
})
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
2. **Code Validation Gate via @test-fix-agent**
|
|
436
|
-
|
|
437
|
-
```javascript
|
|
438
|
-
Agent({
|
|
439
|
-
subagent_type: "test-fix-agent",
|
|
440
|
-
run_in_background: false,
|
|
441
|
-
description: `Validate generated tests: ${topicSlug}`,
|
|
442
|
-
prompt: `
|
|
443
|
-
## Task Objective
|
|
444
|
-
Validate generated integration test code for common AI-generated issues.
|
|
445
|
-
|
|
446
|
-
## MANDATORY FIRST STEPS
|
|
447
|
-
1. Read state.json: ${sessionFolder}/state.json — use "test_inventory" field for file list
|
|
448
|
-
2. Read each test file listed in test_inventory.test_files
|
|
449
|
-
|
|
450
|
-
## Validation Checklist
|
|
451
|
-
- [ ] All imports resolve to existing modules
|
|
452
|
-
- [ ] No placeholder or TODO code blocks
|
|
453
|
-
- [ ] Mock setup matches actual module interfaces
|
|
454
|
-
- [ ] Async operations properly awaited
|
|
455
|
-
- [ ] Test assertions are specific (not just "toBeTruthy")
|
|
456
|
-
- [ ] Cleanup/teardown properly implemented
|
|
457
|
-
- [ ] TypeScript types correct (run tsc --noEmit if applicable)
|
|
458
|
-
|
|
459
|
-
## On Validation Failure
|
|
460
|
-
- Fix issues directly in test files
|
|
461
|
-
- Log fixes to: ${sessionFolder}/.trace/validation-fixes.log
|
|
462
|
-
`
|
|
463
|
-
})
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
3. **Append to reflection-log.md** (replace `## Phase 4: Test Development` placeholder):
|
|
467
|
-
|
|
468
|
-
```markdown
|
|
469
|
-
## Phase 4: Test Development - {timestamp}
|
|
470
|
-
|
|
471
|
-
### Generated Tests
|
|
472
|
-
- **Files**: {N} test files
|
|
473
|
-
- **Total Tests**: {N} test cases
|
|
474
|
-
- **Scenarios Covered**: {list}
|
|
475
|
-
|
|
476
|
-
### Validation Results
|
|
477
|
-
- Issues Found: {N}, Fixed: {N}
|
|
478
|
-
|
|
479
|
-
### Development Notes
|
|
480
|
-
- {notable patterns used}
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
---
|
|
484
|
-
|
|
485
|
-
### Phase 5: Self-Iterating Test Cycle
|
|
486
|
-
|
|
487
|
-
**Objective**: Execute tests, analyze failures, reflect, adjust strategy, fix, and re-test until pass rate >= 95% or max iterations.
|
|
488
|
-
|
|
489
|
-
**Quality Gate**: Pass rate >= 95% (criticality-aware) or 100%
|
|
490
|
-
**Max Iterations**: From session config (default: 10)
|
|
491
|
-
|
|
492
|
-
#### Iteration Loop
|
|
493
|
-
|
|
494
|
-
```
|
|
495
|
-
for iteration = 1 to maxIterations:
|
|
496
|
-
1. Execute Tests → update state.json.iterations.latest_results
|
|
497
|
-
2. Evaluate: 100% → SUCCESS | >= 95% low-crit → PARTIAL | < 95% → step 3
|
|
498
|
-
3. Reflect → append inline to reflection-log.md
|
|
499
|
-
4. Select Strategy (reflection-informed)
|
|
500
|
-
5. Analyze & Fix → save CLI output to .trace/cli-{N}.txt
|
|
501
|
-
6. Loop back to step 1
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
#### Strategy Engine (Reflection-Enhanced)
|
|
505
|
-
|
|
506
|
-
| Strategy | Trigger | Behavior |
|
|
507
|
-
|----------|---------|----------|
|
|
508
|
-
| **Conservative** | Iteration 1-2 (default) | Single targeted fix, full validation |
|
|
509
|
-
| **Aggressive** | Pass rate >80% + similar failures | Batch fix related issues |
|
|
510
|
-
| **Surgical** | Regression detected (pass rate drops >10%) | Minimal changes, rollback focus |
|
|
511
|
-
| **Reflective** | Same tests stuck 3+ iterations | Re-examine assumptions, redesign test |
|
|
512
|
-
|
|
513
|
-
```javascript
|
|
514
|
-
function selectStrategy(iteration, passRate, stuckTests) {
|
|
515
|
-
if (regressionDetected) return "surgical";
|
|
516
|
-
if (stuckTests.length > 0 && stuckTestIterations >= 3) return "reflective";
|
|
517
|
-
if (iteration <= 2) return "conservative";
|
|
518
|
-
if (passRate > 80 && failurePattern.similarity > 0.7) return "aggressive";
|
|
519
|
-
return "conservative";
|
|
520
|
-
}
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
#### Inline Reflection Format (appended to reflection-log.md `## Iteration Timeline`)
|
|
524
|
-
|
|
525
|
-
Each iteration appends one section directly into reflection-log.md (no separate files):
|
|
526
|
-
|
|
527
|
-
```markdown
|
|
528
|
-
### Iteration {N} - {timestamp}
|
|
529
|
-
|
|
530
|
-
**Results**: {pass_rate}% ({passed}/{total}) | Strategy: {strategy}
|
|
531
|
-
**Failed**: {test_list}
|
|
532
|
-
|
|
533
|
-
**Why It Failed**: {root cause analysis}
|
|
534
|
-
**Assumed vs Reality**: {gap description}
|
|
535
|
-
**Learned**: {key takeaway}
|
|
536
|
-
**Next Action**: {strategy adjustment or specific fix plan}
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
#### state.json Iteration Update
|
|
540
|
-
|
|
541
|
-
After each iteration, update `state.json.iterations`:
|
|
542
|
-
|
|
543
|
-
```json
|
|
544
|
-
{
|
|
545
|
-
"iterations": {
|
|
546
|
-
"current": 3,
|
|
547
|
-
"strategy": "aggressive",
|
|
548
|
-
"next_action": "execute_fix",
|
|
549
|
-
"history": [
|
|
550
|
-
{
|
|
551
|
-
"iteration": 1,
|
|
552
|
-
"pass_rate": 70,
|
|
553
|
-
"strategy": "conservative",
|
|
554
|
-
"failed_tests": ["test_auth_integration", "test_payment_flow"],
|
|
555
|
-
"reflection_summary": "Auth token not propagated to payment service",
|
|
556
|
-
"strategy_adjustment": "none"
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
"iteration": 2,
|
|
560
|
-
"pass_rate": 82,
|
|
561
|
-
"strategy": "conservative",
|
|
562
|
-
"failed_tests": ["test_payment_flow"],
|
|
563
|
-
"reflection_summary": "Payment timeout too short for integration",
|
|
564
|
-
"strategy_adjustment": "aggressive - similar timeout failures"
|
|
565
|
-
}
|
|
566
|
-
],
|
|
567
|
-
"stuck_tests": [],
|
|
568
|
-
"latest_results": {
|
|
569
|
-
"pass_rate": 82,
|
|
570
|
-
"passed": 9,
|
|
571
|
-
"failed": 2,
|
|
572
|
-
"total": 11,
|
|
573
|
-
"failures": [
|
|
574
|
-
{ "test": "", "file": "", "error": "", "criticality": "high|medium|low" }
|
|
575
|
-
]
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
#### Cumulative Learnings Update
|
|
582
|
-
|
|
583
|
-
After each iteration, update the `## Cumulative Learnings` section in reflection-log.md (replace, not append):
|
|
584
|
-
|
|
585
|
-
```markdown
|
|
586
|
-
## Cumulative Learnings (Updated: Iteration {N})
|
|
587
|
-
|
|
588
|
-
### Confirmed Understanding
|
|
589
|
-
- {verified facts}
|
|
590
|
-
|
|
591
|
-
### Corrected Assumptions
|
|
592
|
-
- ~~{old}~~ → {new} (Iteration {N})
|
|
593
|
-
|
|
594
|
-
### Effective Strategies
|
|
595
|
-
- {what worked}: {context}
|
|
596
|
-
|
|
597
|
-
### Ineffective Strategies
|
|
598
|
-
- {what didn't work}: {why}
|
|
599
|
-
|
|
600
|
-
### Recurring Patterns
|
|
601
|
-
- {pattern}: root cause {cause}
|
|
602
|
-
```
|
|
603
|
-
|
|
604
|
-
#### Agent Invocations
|
|
605
|
-
|
|
606
|
-
**@test-fix-agent** (test execution):
|
|
607
|
-
```javascript
|
|
608
|
-
Agent({
|
|
609
|
-
subagent_type: "test-fix-agent",
|
|
610
|
-
run_in_background: false,
|
|
611
|
-
description: `Execute integration tests: iteration ${N}`,
|
|
612
|
-
prompt: `
|
|
613
|
-
## Task Objective
|
|
614
|
-
Execute integration test suite and report results with criticality assessment.
|
|
615
|
-
|
|
616
|
-
## MANDATORY FIRST STEPS
|
|
617
|
-
1. Read state.json: ${sessionFolder}/state.json — use "test_inventory" for test files
|
|
618
|
-
${isFixIteration ? `2. Read fix strategy from state.json.fix_history (latest entry)` : ''}
|
|
619
|
-
|
|
620
|
-
## Test Execution
|
|
621
|
-
${progressiveMode
|
|
622
|
-
? `- Run affected tests only: ${affectedTests.join(' ')}`
|
|
623
|
-
: '- Run full integration test suite'}
|
|
624
|
-
|
|
625
|
-
## Criticality Assessment
|
|
626
|
-
For each failure, assign:
|
|
627
|
-
- **high**: Core integration broken, data corruption risk
|
|
628
|
-
- **medium**: Feature degradation, partial failure
|
|
629
|
-
- **low**: Edge case, flaky, environment-specific
|
|
630
|
-
|
|
631
|
-
## Output
|
|
632
|
-
- Update state.json field "iterations.latest_results" with test results
|
|
633
|
-
- Overwrite ${sessionFolder}/.trace/test-output.log with full output
|
|
634
|
-
`
|
|
635
|
-
})
|
|
636
|
-
```
|
|
637
|
-
|
|
638
|
-
**@cli-planning-agent** (failure analysis with reflection):
|
|
639
|
-
```javascript
|
|
640
|
-
Agent({
|
|
641
|
-
subagent_type: "cli-planning-agent",
|
|
642
|
-
run_in_background: false,
|
|
643
|
-
description: `Analyze failures: iteration ${N} - ${strategy}`,
|
|
644
|
-
prompt: `
|
|
645
|
-
## Task Objective
|
|
646
|
-
Analyze test failures using reflection context and generate fix strategy.
|
|
647
|
-
|
|
648
|
-
## MANDATORY FIRST STEPS
|
|
649
|
-
1. Read state.json: ${sessionFolder}/state.json — use "iterations" for history
|
|
650
|
-
2. Read test output: ${sessionFolder}/.trace/test-output.log
|
|
651
|
-
3. Read reflection-log.md: ${sessionFolder}/reflection-log.md — "Cumulative Learnings" section
|
|
652
|
-
|
|
653
|
-
## Reflection Context (CRITICAL)
|
|
654
|
-
- **Iteration History**: ${state.iterations.history}
|
|
655
|
-
- **Stuck Tests**: ${state.iterations.stuck_tests}
|
|
656
|
-
- **What hasn't worked**: Read from "Ineffective Strategies" in reflection-log.md
|
|
657
|
-
|
|
658
|
-
## Strategy: ${selectedStrategy}
|
|
659
|
-
- Conservative: Single targeted fix, verify no regression
|
|
660
|
-
- Aggressive: Batch fix similar failures
|
|
661
|
-
- Surgical: Minimal changes, rollback-safe
|
|
662
|
-
- Reflective: Challenge assumptions, propose alternative test approach
|
|
663
|
-
|
|
664
|
-
## Expected Deliverables
|
|
665
|
-
1. Append fix entry to state.json "fix_history" array:
|
|
666
|
-
{ "iteration": ${N}, "strategy": "", "modification_points": [], "affected_tests": [], "confidence": 0.0 }
|
|
667
|
-
2. Save CLI output to: ${sessionFolder}/.trace/cli-${N}.txt
|
|
668
|
-
|
|
669
|
-
## Success Criteria
|
|
670
|
-
- Root cause identified (not symptoms)
|
|
671
|
-
- Fix strategy with specific modification points
|
|
672
|
-
- Affected tests listed for progressive testing
|
|
673
|
-
`
|
|
674
|
-
})
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
**@test-fix-agent** (apply fixes):
|
|
678
|
-
```javascript
|
|
679
|
-
Agent({
|
|
680
|
-
subagent_type: "test-fix-agent",
|
|
681
|
-
run_in_background: false,
|
|
682
|
-
description: `Apply fixes: iteration ${N} - ${strategy}`,
|
|
683
|
-
prompt: `
|
|
684
|
-
## Task Objective
|
|
685
|
-
Apply fixes from analysis and validate with targeted tests.
|
|
686
|
-
|
|
687
|
-
## MANDATORY FIRST STEPS
|
|
688
|
-
1. Read state.json: ${sessionFolder}/state.json — use latest "fix_history" entry
|
|
689
|
-
2. Run project syntax checker before any code modification
|
|
690
|
-
|
|
691
|
-
## Fix Application
|
|
692
|
-
- Apply modifications from fix_history[latest].modification_points
|
|
693
|
-
- Test execution: ${progressiveMode ? 'affected tests only' : 'full suite'}
|
|
694
|
-
${progressiveMode ? `- Affected tests: ${affectedTests.join(' ')}` : ''}
|
|
695
|
-
|
|
696
|
-
## Output
|
|
697
|
-
- Update state.json "iterations.latest_results" with new test results
|
|
698
|
-
- Overwrite ${sessionFolder}/.trace/test-output.log
|
|
699
|
-
`
|
|
700
|
-
})
|
|
701
|
-
```
|
|
702
|
-
|
|
703
|
-
#### Commit Strategy
|
|
704
|
-
|
|
705
|
-
1. **After Test Development** (Phase 4):
|
|
706
|
-
```bash
|
|
707
|
-
git add <test_files>
|
|
708
|
-
git commit -m "test(integration): generate integration tests for ${module}"
|
|
709
|
-
```
|
|
710
|
-
|
|
711
|
-
2. **After Successful Iteration** (pass rate increased):
|
|
712
|
-
```bash
|
|
713
|
-
git add .
|
|
714
|
-
git commit -m "test(integration): iteration ${N} - ${strategy} (pass: ${oldRate}% → ${newRate}%)"
|
|
715
|
-
```
|
|
716
|
-
|
|
717
|
-
3. **Before Rollback** (regression detected):
|
|
718
|
-
```bash
|
|
719
|
-
git revert HEAD
|
|
720
|
-
git commit -m "test(integration): rollback iteration ${N} - regression detected"
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
---
|
|
724
|
-
|
|
725
|
-
### Phase 6: Completion
|
|
726
|
-
|
|
727
|
-
**Objective**: Finalize reflection log, update state summary, offer next steps.
|
|
728
|
-
|
|
729
|
-
**Workflow Steps**:
|
|
730
|
-
|
|
731
|
-
1. **Update state.json** — write `summary` field:
|
|
732
|
-
|
|
733
|
-
```json
|
|
734
|
-
{
|
|
735
|
-
"summary": {
|
|
736
|
-
"result": "success|partial_success|failure",
|
|
737
|
-
"final_pass_rate": 0,
|
|
738
|
-
"total_iterations": 0,
|
|
739
|
-
"strategies_used": [],
|
|
740
|
-
"test_metrics": {
|
|
741
|
-
"total_tests": 0,
|
|
742
|
-
"passed": 0,
|
|
743
|
-
"failed": 0,
|
|
744
|
-
"test_files": 0,
|
|
745
|
-
"integration_points_covered": 0
|
|
746
|
-
},
|
|
747
|
-
"key_learnings": [],
|
|
748
|
-
"corrected_assumptions": [],
|
|
749
|
-
"recommendations": [],
|
|
750
|
-
"completed": "{timestamp}"
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
```
|
|
754
|
-
|
|
755
|
-
Also set `state.json.phase` to `"completed"`.
|
|
756
|
-
|
|
757
|
-
2. **Finalize reflection-log.md** — replace `## Conclusions` placeholder:
|
|
758
|
-
|
|
759
|
-
```markdown
|
|
760
|
-
## Conclusions - {timestamp}
|
|
761
|
-
|
|
762
|
-
### Result: {SUCCESS|PARTIAL SUCCESS|NEEDS ATTENTION}
|
|
763
|
-
|
|
764
|
-
### Metrics
|
|
765
|
-
- **Final Pass Rate**: {X}%
|
|
766
|
-
- **Total Iterations**: {N}
|
|
767
|
-
- **Strategies Used**: {list}
|
|
768
|
-
- **Tests**: {passed}/{total} across {N} files
|
|
769
|
-
|
|
770
|
-
### What We Established
|
|
771
|
-
- {verified integration behavior}
|
|
772
|
-
|
|
773
|
-
### What Was Corrected
|
|
774
|
-
- ~~{old assumption}~~ → {corrected understanding}
|
|
775
|
-
|
|
776
|
-
### Key Insights
|
|
777
|
-
- {insight with impact on future testing}
|
|
778
|
-
|
|
779
|
-
### Decision Trail
|
|
780
|
-
| Phase/Iteration | Decision | Outcome |
|
|
781
|
-
|-----------------|----------|---------|
|
|
782
|
-
| Exploration | Focus on {boundaries} | Found {N} integration points |
|
|
783
|
-
| Iteration 1 | Conservative single fix | Pass rate: {X}% |
|
|
784
|
-
| ... | ... | ... |
|
|
785
|
-
|
|
786
|
-
### Recommendations
|
|
787
|
-
- {codebase improvement}
|
|
788
|
-
- {test maintenance}
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
3. **Post-Completion Options** (AskUserQuestion)
|
|
792
|
-
|
|
793
|
-
```javascript
|
|
794
|
-
AskUserQuestion({
|
|
795
|
-
questions: [{
|
|
796
|
-
question: "集成测试完成,下一步?",
|
|
797
|
-
header: "Next Steps",
|
|
798
|
-
options: [
|
|
799
|
-
{ label: "创建Issue", description: "将发现的问题创建为Issue跟踪" },
|
|
800
|
-
{ label: "扩展测试", description: "基于当前测试继续扩展覆盖范围" },
|
|
801
|
-
{ label: "生成报告", description: "导出详细测试报告" },
|
|
802
|
-
{ label: "完成", description: "无需进一步操作" }
|
|
803
|
-
],
|
|
804
|
-
multiSelect: false
|
|
805
|
-
}]
|
|
806
|
-
})
|
|
807
|
-
```
|
|
808
|
-
|
|
809
|
-
4. **Sync Session State** (automatic)
|
|
810
|
-
- Execute: `/workflow:session:sync -y "Integration test cycle complete: ${passRate}% pass rate, ${iterations} iterations"`
|
|
811
|
-
- Updates specs/*.md with test learnings and project-tech.json with development index entry
|
|
812
|
-
|
|
813
|
-
---
|
|
814
|
-
|
|
815
|
-
## Completion Conditions
|
|
816
|
-
|
|
817
|
-
| Condition | Criteria | Action |
|
|
818
|
-
|-----------|----------|--------|
|
|
819
|
-
| **Full Success** | Pass rate === 100% | Finalize with success summary |
|
|
820
|
-
| **Partial Success** | Pass rate >= 95%, all failures low criticality | Finalize with review notes |
|
|
821
|
-
| **Failure** | Max iterations reached, pass rate < 95% | Generate failure report with full reflection history |
|
|
822
|
-
|
|
823
|
-
---
|
|
824
|
-
|
|
825
|
-
## Error Handling
|
|
826
|
-
|
|
827
|
-
| Scenario | Action |
|
|
828
|
-
|----------|--------|
|
|
829
|
-
| cli-explore-agent fails | Fallback to manual exploration via Grep/Glob |
|
|
830
|
-
| CLI analysis timeout | Fallback: Gemini → Qwen → Codex → manual |
|
|
831
|
-
| Test execution crash | Log error, retry with simplified test subset |
|
|
832
|
-
| Max iterations reached | Generate failure report with full reflection history |
|
|
833
|
-
| Regression detected | Rollback via git revert, switch to surgical strategy |
|
|
834
|
-
| Stuck tests (3+ iterations) | Switch to reflective strategy, challenge assumptions |
|
|
835
|
-
| All CLI tools fail | Pattern match from state.json.fix_history, notify user |
|
|
836
|
-
|
|
837
|
-
**CLI Fallback Chain**: Gemini → Qwen → Codex
|
|
838
|
-
|
|
839
|
-
Triggers: Invalid JSON output, confidence < 0.4, HTTP 429/timeout, analysis < 100 words, same root cause 3+ times.
|
|
840
|
-
|
|
841
|
-
---
|
|
842
|
-
|
|
843
|
-
## state.json Full Schema
|
|
844
|
-
|
|
845
|
-
Single evolving state file — each phase writes its section:
|
|
846
|
-
|
|
847
|
-
```json
|
|
848
|
-
{
|
|
849
|
-
"session_id": "ITG-xxx",
|
|
850
|
-
"module": "description",
|
|
851
|
-
"started": "timestamp",
|
|
852
|
-
"max_iterations": 10,
|
|
853
|
-
"phase": "init|explored|designed|developed|iterating|completed",
|
|
854
|
-
|
|
855
|
-
"exploration": {
|
|
856
|
-
"module_structure": { "entry_points": [], "public_apis": [], "internal_modules": [] },
|
|
857
|
-
"dependencies": { "upstream": [], "downstream": [], "external_services": [] },
|
|
858
|
-
"integration_points": [{ "from": "", "to": "", "type": "", "contract": "" }],
|
|
859
|
-
"data_flows": [{ "name": "", "path": [], "transforms": [] }],
|
|
860
|
-
"existing_tests": { "test_files": [], "patterns": [], "utilities": [], "mocking_conventions": "" },
|
|
861
|
-
"test_framework": { "runner": "", "assertion_lib": "", "mock_lib": "" },
|
|
862
|
-
"risk_areas": [{ "area": "", "reason": "", "priority": "" }],
|
|
863
|
-
"_metadata": { "files_analyzed": 0, "timestamp": "" }
|
|
864
|
-
},
|
|
865
|
-
|
|
866
|
-
"test_design": {
|
|
867
|
-
"integration_scenarios": [{ "id": "", "name": "", "boundary": "", "type": "", "priority": "", "test_cases": [], "mocking": {}, "setup": "", "teardown": "" }],
|
|
868
|
-
"mocking_strategy": { "approach": "", "mock_boundaries": [], "real_boundaries": [], "rationale": "" },
|
|
869
|
-
"execution_order": [],
|
|
870
|
-
"success_criteria": { "pass_rate": 95, "coverage_target": 80 }
|
|
871
|
-
},
|
|
872
|
-
|
|
873
|
-
"test_inventory": {
|
|
874
|
-
"test_files": [{ "path": "", "scenario_ids": [], "test_count": 0, "boundary": "" }],
|
|
875
|
-
"total_tests": 0,
|
|
876
|
-
"total_files": 0,
|
|
877
|
-
"timestamp": ""
|
|
878
|
-
},
|
|
879
|
-
|
|
880
|
-
"iterations": {
|
|
881
|
-
"current": 0,
|
|
882
|
-
"strategy": null,
|
|
883
|
-
"next_action": "execute_tests|execute_fix|complete",
|
|
884
|
-
"history": [{ "iteration": 0, "pass_rate": 0, "strategy": "", "failed_tests": [], "reflection_summary": "", "strategy_adjustment": "" }],
|
|
885
|
-
"stuck_tests": [],
|
|
886
|
-
"latest_results": { "pass_rate": 0, "passed": 0, "failed": 0, "total": 0, "failures": [] }
|
|
887
|
-
},
|
|
888
|
-
|
|
889
|
-
"fix_history": [{ "iteration": 0, "strategy": "", "modification_points": [], "affected_tests": [], "confidence": 0.0 }],
|
|
890
|
-
|
|
891
|
-
"summary": {
|
|
892
|
-
"result": "success|partial_success|failure",
|
|
893
|
-
"final_pass_rate": 0,
|
|
894
|
-
"total_iterations": 0,
|
|
895
|
-
"strategies_used": [],
|
|
896
|
-
"test_metrics": {},
|
|
897
|
-
"key_learnings": [],
|
|
898
|
-
"corrected_assumptions": [],
|
|
899
|
-
"recommendations": [],
|
|
900
|
-
"completed": ""
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
```
|
|
904
|
-
|
|
905
|
-
---
|
|
906
|
-
|
|
907
|
-
## Best Practices
|
|
908
|
-
|
|
909
|
-
1. **Clear Module Description**: Specific module names improve exploration quality
|
|
910
|
-
2. **Trust the Reflection**: Cumulative learnings inform better strategy choices over time
|
|
911
|
-
3. **Monitor reflection-log.md**: The single document captures the full journey
|
|
912
|
-
4. **Auto Mode for CI**: Use `-y` for automated pipelines
|
|
913
|
-
5. **Start Conservative**: Let the strategy engine escalate naturally
|
|
914
|
-
6. **Review Stuck Tests**: 3+ iterations means test design may need revisiting
|
|
915
|
-
7. **Incremental Commits**: Each iteration is a safe rollback point
|
|
916
|
-
|
|
917
|
-
---
|
|
918
|
-
|
|
919
|
-
## Usage Recommendations
|
|
920
|
-
|
|
921
|
-
**Use this command when:**
|
|
922
|
-
- Starting integration tests from scratch for a module
|
|
923
|
-
- Need comprehensive exploration before test development
|
|
924
|
-
- Want self-healing test cycles with documented reasoning
|
|
925
|
-
|
|
926
|
-
**Use `workflow-test-fix` skill + `workflow-test-fix` skill when:**
|
|
927
|
-
- Already have a completed implementation session (WFS-*)
|
|
928
|
-
- Only need unit/component level tests
|
|
929
|
-
|
|
930
|
-
**Use `workflow-tdd-plan` skill when:**
|
|
931
|
-
- Building new features with test-first approach
|
|
932
|
-
- Red-Green-Refactor cycle
|
|
933
|
-
|
|
934
|
-
---
|
|
935
|
-
|
|
936
|
-
**Now execute integration-test-cycle for**: $ARGUMENTS
|