mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +08:00
feat: Add 4 new team skills with Generator-Critic loops, shared memory, and dynamic pipelines
Create team-brainstorm (ideator↔challenger GC, quick/deep/full pipelines), team-testing (generator↔executor GC, L1/L2/L3 test layers), team-iterdev (developer↔reviewer GC, task-ledger sprint tracking), and team-uidesign (designer↔reviewer GC, CP-9 dual-track with sync points). Each team includes SKILL.md router, 5 roles, and team-config.json.
This commit is contained in:
331
.claude/skills/team-testing/SKILL.md
Normal file
331
.claude/skills/team-testing/SKILL.md
Normal file
@@ -0,0 +1,331 @@
|
||||
---
|
||||
name: team-testing
|
||||
description: Unified team skill for testing team. All roles invoke this skill with --role arg for role-specific execution. Triggers on "team testing".
|
||||
allowed-tools: TeamCreate(*), TeamDelete(*), SendMessage(*), TaskCreate(*), TaskUpdate(*), TaskList(*), TaskGet(*), Task(*), AskUserQuestion(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*)
|
||||
---
|
||||
|
||||
# Team Testing
|
||||
|
||||
测试团队技能。通过 Generator-Critic 循环(generator↔executor)、共享记忆(缺陷模式追踪)和动态层级选择,实现渐进式测试覆盖。所有团队成员通过 `--role=xxx` 路由到角色执行逻辑。
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────┐
|
||||
│ Skill(skill="team-testing", args="--role=xxx") │
|
||||
└───────────────────┬──────────────────────────────┘
|
||||
│ Role Router
|
||||
┌───────────┬───┼───────────┬───────────┐
|
||||
↓ ↓ ↓ ↓ ↓
|
||||
┌──────────┐┌──────────┐┌─────────┐┌────────┐┌────────┐
|
||||
│coordinator││strategist││generator││executor││analyst │
|
||||
│ roles/ ││ roles/ ││ roles/ ││ roles/ ││ roles/ │
|
||||
└──────────┘└──────────┘└─────────┘└────────┘└────────┘
|
||||
```
|
||||
|
||||
## Role Router
|
||||
|
||||
### Input Parsing
|
||||
|
||||
```javascript
|
||||
const args = "$ARGUMENTS"
|
||||
const roleMatch = args.match(/--role[=\s]+(\w+)/)
|
||||
|
||||
if (!roleMatch) {
|
||||
throw new Error("Missing --role argument. Available roles: coordinator, strategist, generator, executor, analyst")
|
||||
}
|
||||
|
||||
const role = roleMatch[1]
|
||||
const teamName = args.match(/--team[=\s]+([\w-]+)/)?.[1] || "testing"
|
||||
```
|
||||
|
||||
### Role Dispatch
|
||||
|
||||
```javascript
|
||||
const VALID_ROLES = {
|
||||
"coordinator": { file: "roles/coordinator.md", prefix: null },
|
||||
"strategist": { file: "roles/strategist.md", prefix: "STRATEGY" },
|
||||
"generator": { file: "roles/generator.md", prefix: "TESTGEN" },
|
||||
"executor": { file: "roles/executor.md", prefix: "TESTRUN" },
|
||||
"analyst": { file: "roles/analyst.md", prefix: "TESTANA" }
|
||||
}
|
||||
|
||||
if (!VALID_ROLES[role]) {
|
||||
throw new Error(`Unknown role: ${role}. Available: ${Object.keys(VALID_ROLES).join(', ')}`)
|
||||
}
|
||||
|
||||
Read(VALID_ROLES[role].file)
|
||||
```
|
||||
|
||||
### Available Roles
|
||||
|
||||
| Role | Task Prefix | Responsibility | Role File |
|
||||
|------|-------------|----------------|-----------|
|
||||
| `coordinator` | N/A | 变更范围分析、层级选择、质量门控 | [roles/coordinator.md](roles/coordinator.md) |
|
||||
| `strategist` | STRATEGY-* | 分析 git diff、确定测试层级、定义覆盖率目标 | [roles/strategist.md](roles/strategist.md) |
|
||||
| `generator` | TESTGEN-* | 按层级生成测试用例(单元/集成/E2E) | [roles/generator.md](roles/generator.md) |
|
||||
| `executor` | TESTRUN-* | 执行测试、收集覆盖率、自动修复 | [roles/executor.md](roles/executor.md) |
|
||||
| `analyst` | TESTANA-* | 缺陷模式分析、覆盖率差距、质量报告 | [roles/analyst.md](roles/analyst.md) |
|
||||
|
||||
## Shared Infrastructure
|
||||
|
||||
### Role Isolation Rules
|
||||
|
||||
**核心原则**: 每个角色仅能执行自己职责范围内的工作。
|
||||
|
||||
#### Output Tagging(强制)
|
||||
|
||||
```javascript
|
||||
SendMessage({ content: `## [${role}] ...`, summary: `[${role}] ...` })
|
||||
mcp__ccw-tools__team_msg({ summary: `[${role}] ...` })
|
||||
```
|
||||
|
||||
#### Coordinator 隔离
|
||||
|
||||
| 允许 | 禁止 |
|
||||
|------|------|
|
||||
| 变更范围分析 | ❌ 直接编写测试 |
|
||||
| 创建任务链 (TaskCreate) | ❌ 直接执行测试 |
|
||||
| 质量门控判断 | ❌ 直接分析覆盖率 |
|
||||
| 监控进度 (消息总线) | ❌ 绕过 worker 自行完成 |
|
||||
|
||||
#### Worker 隔离
|
||||
|
||||
| 允许 | 禁止 |
|
||||
|------|------|
|
||||
| 处理自己前缀的任务 | ❌ 处理其他角色前缀的任务 |
|
||||
| 读写 shared-memory.json (自己的字段) | ❌ 为其他角色创建任务 |
|
||||
| SendMessage 给 coordinator | ❌ 直接与其他 worker 通信 |
|
||||
|
||||
### Team Configuration
|
||||
|
||||
```javascript
|
||||
const TEAM_CONFIG = {
|
||||
name: "testing",
|
||||
sessionDir: ".workflow/.team/TST-{slug}-{date}/",
|
||||
msgDir: ".workflow/.team-msg/testing/",
|
||||
sharedMemory: "shared-memory.json",
|
||||
testLayers: {
|
||||
L1: { name: "Unit Tests", coverage_target: 80 },
|
||||
L2: { name: "Integration Tests", coverage_target: 60 },
|
||||
L3: { name: "E2E Tests", coverage_target: 40 }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Shared Memory (创新模式)
|
||||
|
||||
```javascript
|
||||
// Phase 2: 读取共享记忆
|
||||
const memoryPath = `${sessionFolder}/shared-memory.json`
|
||||
let sharedMemory = {}
|
||||
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
|
||||
|
||||
// Phase 5: 写入共享记忆(仅更新自己负责的字段)
|
||||
// strategist → sharedMemory.test_strategy
|
||||
// generator → sharedMemory.generated_tests
|
||||
// executor → sharedMemory.execution_results + defect_patterns
|
||||
// analyst → sharedMemory.analysis_report + coverage_history
|
||||
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
|
||||
```
|
||||
|
||||
### Message Bus (All Roles)
|
||||
|
||||
```javascript
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log",
|
||||
team: teamName,
|
||||
from: role,
|
||||
to: "coordinator",
|
||||
type: "<type>",
|
||||
summary: `[${role}] <summary>`,
|
||||
ref: "<file_path>"
|
||||
})
|
||||
```
|
||||
|
||||
| Role | Types |
|
||||
|------|-------|
|
||||
| coordinator | `pipeline_selected`, `gc_loop_trigger`, `quality_gate`, `task_unblocked`, `error`, `shutdown` |
|
||||
| strategist | `strategy_ready`, `error` |
|
||||
| generator | `tests_generated`, `tests_revised`, `error` |
|
||||
| executor | `tests_passed`, `tests_failed`, `coverage_report`, `error` |
|
||||
| analyst | `analysis_ready`, `error` |
|
||||
|
||||
### CLI Fallback
|
||||
|
||||
```javascript
|
||||
Bash(`ccw team log --team "${teamName}" --from "${role}" --to "coordinator" --type "<type>" --summary "<summary>" --json`)
|
||||
```
|
||||
|
||||
### Task Lifecycle (All Worker Roles)
|
||||
|
||||
```javascript
|
||||
const tasks = TaskList()
|
||||
const myTasks = tasks.filter(t =>
|
||||
t.subject.startsWith(`${VALID_ROLES[role].prefix}-`) &&
|
||||
t.owner === role &&
|
||||
t.status === 'pending' &&
|
||||
t.blockedBy.length === 0
|
||||
)
|
||||
if (myTasks.length === 0) return
|
||||
const task = TaskGet({ taskId: myTasks[0].id })
|
||||
TaskUpdate({ taskId: task.id, status: 'in_progress' })
|
||||
|
||||
// Phase 2-4: Role-specific
|
||||
// Phase 5: Report + Loop
|
||||
mcp__ccw-tools__team_msg({ operation: "log", team: teamName, from: role, to: "coordinator", type: "...", summary: `[${role}] ...` })
|
||||
SendMessage({ type: "message", recipient: "coordinator", content: `## [${role}] ...`, summary: `[${role}] ...` })
|
||||
TaskUpdate({ taskId: task.id, status: 'completed' })
|
||||
```
|
||||
|
||||
## Three-Pipeline Architecture
|
||||
|
||||
```
|
||||
Targeted (小范围变更):
|
||||
STRATEGY-001 → TESTGEN-001(L1 unit) → TESTRUN-001
|
||||
|
||||
Standard (渐进式):
|
||||
STRATEGY-001 → TESTGEN-001(L1) → TESTRUN-001(L1) → TESTGEN-002(L2) → TESTRUN-002(L2) → TESTANA-001
|
||||
|
||||
Comprehensive (全覆盖):
|
||||
STRATEGY-001 → [TESTGEN-001(L1) + TESTGEN-002(L2)](parallel) → [TESTRUN-001(L1) + TESTRUN-002(L2)](parallel) → TESTGEN-003(L3) → TESTRUN-003(L3) → TESTANA-001
|
||||
```
|
||||
|
||||
### Generator-Critic Loop
|
||||
|
||||
generator ↔ executor 循环(覆盖率不达标时修订测试):
|
||||
|
||||
```
|
||||
TESTGEN → TESTRUN → (if coverage < target) → TESTGEN-fix → TESTRUN-2
|
||||
(if coverage >= target) → next layer or TESTANA
|
||||
```
|
||||
|
||||
## Unified Session Directory
|
||||
|
||||
```
|
||||
.workflow/.team/TST-{slug}-{YYYY-MM-DD}/
|
||||
├── team-session.json
|
||||
├── shared-memory.json # 缺陷模式 / 有效测试模式 / 覆盖率历史
|
||||
├── strategy/ # Strategist output
|
||||
│ └── test-strategy.md
|
||||
├── tests/ # Generator output
|
||||
│ ├── L1-unit/
|
||||
│ ├── L2-integration/
|
||||
│ └── L3-e2e/
|
||||
├── results/ # Executor output
|
||||
│ ├── run-001.json
|
||||
│ └── coverage-001.json
|
||||
└── analysis/ # Analyst output
|
||||
└── quality-report.md
|
||||
```
|
||||
|
||||
## Coordinator Spawn Template
|
||||
|
||||
```javascript
|
||||
TeamCreate({ team_name: teamName })
|
||||
|
||||
// Strategist
|
||||
Task({
|
||||
subagent_type: "general-purpose",
|
||||
team_name: teamName,
|
||||
name: "strategist",
|
||||
prompt: `你是 team "${teamName}" 的 STRATEGIST。
|
||||
当你收到 STRATEGY-* 任务时,调用 Skill(skill="team-testing", args="--role=strategist") 执行。
|
||||
当前需求: ${taskDescription}
|
||||
约束: ${constraints}
|
||||
|
||||
## 角色准则(强制)
|
||||
- 你只能处理 STRATEGY-* 前缀的任务
|
||||
- 所有输出必须带 [strategist] 标识前缀
|
||||
- 仅与 coordinator 通信
|
||||
|
||||
## 消息总线(必须)
|
||||
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
|
||||
|
||||
工作流程:
|
||||
1. TaskList → 找到 STRATEGY-* 任务
|
||||
2. Skill(skill="team-testing", args="--role=strategist") 执行
|
||||
3. team_msg log + SendMessage 结果给 coordinator
|
||||
4. TaskUpdate completed → 检查下一个任务`
|
||||
})
|
||||
|
||||
// Generator
|
||||
Task({
|
||||
subagent_type: "general-purpose",
|
||||
team_name: teamName,
|
||||
name: "generator",
|
||||
prompt: `你是 team "${teamName}" 的 GENERATOR。
|
||||
当你收到 TESTGEN-* 任务时,调用 Skill(skill="team-testing", args="--role=generator") 执行。
|
||||
当前需求: ${taskDescription}
|
||||
|
||||
## 角色准则(强制)
|
||||
- 你只能处理 TESTGEN-* 前缀的任务
|
||||
- 所有输出必须带 [generator] 标识前缀
|
||||
|
||||
## 消息总线(必须)
|
||||
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
|
||||
|
||||
工作流程:
|
||||
1. TaskList → 找到 TESTGEN-* 任务
|
||||
2. Skill(skill="team-testing", args="--role=generator") 执行
|
||||
3. team_msg log + SendMessage
|
||||
4. TaskUpdate completed → 检查下一个任务`
|
||||
})
|
||||
|
||||
// Executor
|
||||
Task({
|
||||
subagent_type: "general-purpose",
|
||||
team_name: teamName,
|
||||
name: "executor",
|
||||
prompt: `你是 team "${teamName}" 的 EXECUTOR。
|
||||
当你收到 TESTRUN-* 任务时,调用 Skill(skill="team-testing", args="--role=executor") 执行。
|
||||
当前需求: ${taskDescription}
|
||||
|
||||
## 角色准则(强制)
|
||||
- 你只能处理 TESTRUN-* 前缀的任务
|
||||
- 所有输出必须带 [executor] 标识前缀
|
||||
|
||||
## 消息总线(必须)
|
||||
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
|
||||
|
||||
工作流程:
|
||||
1. TaskList → 找到 TESTRUN-* 任务
|
||||
2. Skill(skill="team-testing", args="--role=executor") 执行
|
||||
3. team_msg log + SendMessage
|
||||
4. TaskUpdate completed → 检查下一个任务`
|
||||
})
|
||||
|
||||
// Analyst
|
||||
Task({
|
||||
subagent_type: "general-purpose",
|
||||
team_name: teamName,
|
||||
name: "analyst",
|
||||
prompt: `你是 team "${teamName}" 的 ANALYST。
|
||||
当你收到 TESTANA-* 任务时,调用 Skill(skill="team-testing", args="--role=analyst") 执行。
|
||||
当前需求: ${taskDescription}
|
||||
|
||||
## 角色准则(强制)
|
||||
- 你只能处理 TESTANA-* 前缀的任务
|
||||
- 所有输出必须带 [analyst] 标识前缀
|
||||
|
||||
## 消息总线(必须)
|
||||
每次 SendMessage 前,先调用 mcp__ccw-tools__team_msg 记录。
|
||||
|
||||
工作流程:
|
||||
1. TaskList → 找到 TESTANA-* 任务
|
||||
2. Skill(skill="team-testing", args="--role=analyst") 执行
|
||||
3. team_msg log + SendMessage
|
||||
4. TaskUpdate completed → 检查下一个任务`
|
||||
})
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| Unknown --role value | Error with available role list |
|
||||
| Missing --role arg | Error with usage hint |
|
||||
| Role file not found | Error with expected path |
|
||||
| Task prefix conflict | Log warning, proceed |
|
||||
| Coverage never reaches target | After 3 GC loops, accept current coverage with warning |
|
||||
| Test environment broken | Notify user, suggest manual fix |
|
||||
228
.claude/skills/team-testing/roles/analyst.md
Normal file
228
.claude/skills/team-testing/roles/analyst.md
Normal file
@@ -0,0 +1,228 @@
|
||||
# Role: analyst
|
||||
|
||||
测试质量分析师。负责缺陷模式分析、覆盖率差距识别、质量报告生成。
|
||||
|
||||
## Role Identity
|
||||
|
||||
- **Name**: `analyst`
|
||||
- **Task Prefix**: `TESTANA-*`
|
||||
- **Responsibility**: Read-only analysis (质量分析)
|
||||
- **Communication**: SendMessage to coordinator only
|
||||
- **Output Tag**: `[analyst]`
|
||||
|
||||
## Role Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- 仅处理 `TESTANA-*` 前缀的任务
|
||||
- 所有输出必须带 `[analyst]` 标识
|
||||
- Phase 2 读取 shared-memory.json (所有历史数据),Phase 5 写入 analysis_report
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- ❌ 生成测试、执行测试或制定策略
|
||||
- ❌ 直接与其他 worker 通信
|
||||
- ❌ 为其他角色创建任务
|
||||
|
||||
## Message Types
|
||||
|
||||
| Type | Direction | Trigger | Description |
|
||||
|------|-----------|---------|-------------|
|
||||
| `analysis_ready` | analyst → coordinator | Analysis completed | 分析报告完成 |
|
||||
| `error` | analyst → coordinator | Processing failure | 错误上报 |
|
||||
|
||||
## Execution (5-Phase)
|
||||
|
||||
### Phase 1: Task Discovery
|
||||
|
||||
```javascript
|
||||
const tasks = TaskList()
|
||||
const myTasks = tasks.filter(t =>
|
||||
t.subject.startsWith('TESTANA-') &&
|
||||
t.owner === 'analyst' &&
|
||||
t.status === 'pending' &&
|
||||
t.blockedBy.length === 0
|
||||
)
|
||||
if (myTasks.length === 0) return
|
||||
const task = TaskGet({ taskId: myTasks[0].id })
|
||||
TaskUpdate({ taskId: task.id, status: 'in_progress' })
|
||||
```
|
||||
|
||||
### Phase 2: Context Loading + Shared Memory Read
|
||||
|
||||
```javascript
|
||||
const sessionMatch = task.description.match(/Session:\s*([^\n]+)/)
|
||||
const sessionFolder = sessionMatch?.[1]?.trim()
|
||||
|
||||
const memoryPath = `${sessionFolder}/shared-memory.json`
|
||||
let sharedMemory = {}
|
||||
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
|
||||
|
||||
// Read all execution results
|
||||
const resultFiles = Glob({ pattern: `${sessionFolder}/results/run-*.json` })
|
||||
const results = resultFiles.map(f => {
|
||||
try { return JSON.parse(Read(f)) } catch { return null }
|
||||
}).filter(Boolean)
|
||||
|
||||
// Read test strategy
|
||||
const strategy = Read(`${sessionFolder}/strategy/test-strategy.md`)
|
||||
|
||||
// Read test files for pattern analysis
|
||||
const testFiles = Glob({ pattern: `${sessionFolder}/tests/**/*` })
|
||||
```
|
||||
|
||||
### Phase 3: Quality Analysis
|
||||
|
||||
```javascript
|
||||
const outputPath = `${sessionFolder}/analysis/quality-report.md`
|
||||
|
||||
// 1. Coverage Analysis
|
||||
const coverageHistory = sharedMemory.coverage_history || []
|
||||
const layerCoverage = {}
|
||||
coverageHistory.forEach(c => {
|
||||
if (!layerCoverage[c.layer] || c.timestamp > layerCoverage[c.layer].timestamp) {
|
||||
layerCoverage[c.layer] = c
|
||||
}
|
||||
})
|
||||
|
||||
// 2. Defect Pattern Analysis
|
||||
const defectPatterns = sharedMemory.defect_patterns || []
|
||||
const patternFrequency = {}
|
||||
defectPatterns.forEach(p => {
|
||||
patternFrequency[p] = (patternFrequency[p] || 0) + 1
|
||||
})
|
||||
const sortedPatterns = Object.entries(patternFrequency)
|
||||
.sort(([,a], [,b]) => b - a)
|
||||
|
||||
// 3. GC Loop Effectiveness
|
||||
const gcRounds = sharedMemory.gc_round || 0
|
||||
const gcEffectiveness = coverageHistory.length >= 2
|
||||
? coverageHistory[coverageHistory.length - 1].coverage - coverageHistory[0].coverage
|
||||
: 0
|
||||
|
||||
// 4. Test Quality Metrics
|
||||
const totalTests = sharedMemory.generated_tests?.length || 0
|
||||
const effectivePatterns = sharedMemory.effective_test_patterns || []
|
||||
|
||||
const reportContent = `# Quality Analysis Report
|
||||
|
||||
**Session**: ${sessionFolder}
|
||||
**Pipeline**: ${sharedMemory.pipeline}
|
||||
**GC Rounds**: ${gcRounds}
|
||||
**Total Test Files**: ${totalTests}
|
||||
|
||||
## Coverage Summary
|
||||
|
||||
| Layer | Coverage | Target | Status |
|
||||
|-------|----------|--------|--------|
|
||||
${Object.entries(layerCoverage).map(([layer, data]) =>
|
||||
`| ${layer} | ${data.coverage}% | ${data.target}% | ${data.coverage >= data.target ? '✅ Met' : '❌ Below'} |`
|
||||
).join('\n')}
|
||||
|
||||
## Defect Pattern Analysis
|
||||
|
||||
| Pattern | Frequency | Severity |
|
||||
|---------|-----------|----------|
|
||||
${sortedPatterns.map(([pattern, freq]) =>
|
||||
`| ${pattern} | ${freq} | ${freq >= 3 ? 'HIGH' : freq >= 2 ? 'MEDIUM' : 'LOW'} |`
|
||||
).join('\n')}
|
||||
|
||||
### Recurring Defect Categories
|
||||
${categorizeDefects(defectPatterns).map(cat =>
|
||||
`- **${cat.name}**: ${cat.count} occurrences — ${cat.recommendation}`
|
||||
).join('\n')}
|
||||
|
||||
## Generator-Critic Loop Effectiveness
|
||||
|
||||
- **Rounds Executed**: ${gcRounds}
|
||||
- **Coverage Improvement**: ${gcEffectiveness > 0 ? '+' : ''}${gcEffectiveness.toFixed(1)}%
|
||||
- **Effectiveness**: ${gcEffectiveness > 10 ? 'HIGH' : gcEffectiveness > 5 ? 'MEDIUM' : 'LOW'}
|
||||
- **Recommendation**: ${gcRounds > 2 && gcEffectiveness < 5 ? 'Diminishing returns — consider manual intervention' : 'GC loop effective'}
|
||||
|
||||
## Coverage Gaps
|
||||
|
||||
${identifyCoverageGaps(sharedMemory).map(gap =>
|
||||
`### ${gap.area}\n- **Current**: ${gap.current}%\n- **Gap**: ${gap.gap}%\n- **Reason**: ${gap.reason}\n- **Recommendation**: ${gap.recommendation}\n`
|
||||
).join('\n')}
|
||||
|
||||
## Effective Test Patterns
|
||||
|
||||
${effectivePatterns.map(p => `- ${p}`).join('\n')}
|
||||
|
||||
## Recommendations
|
||||
|
||||
### Immediate Actions
|
||||
${immediateActions.map((a, i) => `${i + 1}. ${a}`).join('\n')}
|
||||
|
||||
### Long-term Improvements
|
||||
${longTermActions.map((a, i) => `${i + 1}. ${a}`).join('\n')}
|
||||
|
||||
## Quality Score
|
||||
|
||||
| Dimension | Score | Weight | Weighted |
|
||||
|-----------|-------|--------|----------|
|
||||
| Coverage Achievement | ${coverageScore}/10 | 30% | ${(coverageScore * 0.3).toFixed(1)} |
|
||||
| Test Effectiveness | ${effectivenessScore}/10 | 25% | ${(effectivenessScore * 0.25).toFixed(1)} |
|
||||
| Defect Detection | ${defectScore}/10 | 25% | ${(defectScore * 0.25).toFixed(1)} |
|
||||
| GC Loop Efficiency | ${gcScore}/10 | 20% | ${(gcScore * 0.2).toFixed(1)} |
|
||||
| **Total** | | | **${totalScore.toFixed(1)}/10** |
|
||||
`
|
||||
|
||||
Write(outputPath, reportContent)
|
||||
```
|
||||
|
||||
### Phase 4: Trend Analysis (if historical data available)
|
||||
|
||||
```javascript
|
||||
// Compare with previous sessions if available
|
||||
const previousSessions = Glob({ pattern: '.workflow/.team/TST-*/shared-memory.json' })
|
||||
if (previousSessions.length > 1) {
|
||||
// Track coverage trends, defect pattern evolution
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 5: Report to Coordinator + Shared Memory Write
|
||||
|
||||
```javascript
|
||||
sharedMemory.analysis_report = {
|
||||
quality_score: totalScore,
|
||||
coverage_gaps: coverageGaps,
|
||||
top_defect_patterns: sortedPatterns.slice(0, 5),
|
||||
gc_effectiveness: gcEffectiveness,
|
||||
recommendations: immediateActions
|
||||
}
|
||||
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
|
||||
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "analyst", to: "coordinator",
|
||||
type: "analysis_ready",
|
||||
summary: `[analyst] Quality report: score ${totalScore.toFixed(1)}/10, ${sortedPatterns.length} defect patterns, ${coverageGaps.length} coverage gaps`,
|
||||
ref: outputPath
|
||||
})
|
||||
|
||||
SendMessage({
|
||||
type: "message", recipient: "coordinator",
|
||||
content: `## [analyst] Quality Analysis Complete
|
||||
|
||||
**Quality Score**: ${totalScore.toFixed(1)}/10
|
||||
**Defect Patterns**: ${sortedPatterns.length}
|
||||
**Coverage Gaps**: ${coverageGaps.length}
|
||||
**GC Effectiveness**: ${gcEffectiveness > 0 ? '+' : ''}${gcEffectiveness.toFixed(1)}%
|
||||
**Output**: ${outputPath}
|
||||
|
||||
### Top Issues
|
||||
${immediateActions.slice(0, 3).map((a, i) => `${i + 1}. ${a}`).join('\n')}`,
|
||||
summary: `[analyst] Quality: ${totalScore.toFixed(1)}/10`
|
||||
})
|
||||
|
||||
TaskUpdate({ taskId: task.id, status: 'completed' })
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| No TESTANA-* tasks | Idle |
|
||||
| No execution results | Generate report based on strategy only |
|
||||
| Incomplete data | Report available metrics, flag gaps |
|
||||
| Previous session data corrupted | Analyze current session only |
|
||||
284
.claude/skills/team-testing/roles/coordinator.md
Normal file
284
.claude/skills/team-testing/roles/coordinator.md
Normal file
@@ -0,0 +1,284 @@
|
||||
# Role: coordinator
|
||||
|
||||
测试团队协调者。负责变更范围分析、测试层级选择、Generator-Critic 循环控制(generator↔executor)和质量门控。
|
||||
|
||||
## Role Identity
|
||||
|
||||
- **Name**: `coordinator`
|
||||
- **Task Prefix**: N/A (coordinator creates tasks, doesn't receive them)
|
||||
- **Responsibility**: Orchestration
|
||||
- **Communication**: SendMessage to all teammates
|
||||
- **Output Tag**: `[coordinator]`
|
||||
|
||||
## Role Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- 所有输出必须带 `[coordinator]` 标识
|
||||
- 仅负责变更分析、任务创建/分发、质量门控、结果汇报
|
||||
- 管理 Generator-Critic 循环计数(generator↔executor)
|
||||
- 根据覆盖率结果决定是否触发修订循环
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- ❌ **直接编写测试、执行测试或分析覆盖率**
|
||||
- ❌ 直接调用实现类 subagent
|
||||
- ❌ 直接修改测试文件或源代码
|
||||
- ❌ 绕过 worker 角色自行完成应委派的工作
|
||||
|
||||
## Message Types
|
||||
|
||||
| Type | Direction | Trigger | Description |
|
||||
|------|-----------|---------|-------------|
|
||||
| `pipeline_selected` | coordinator → all | Pipeline decided | 通知选定管道模式 |
|
||||
| `gc_loop_trigger` | coordinator → generator | Coverage < target | 触发 generator 修订测试 |
|
||||
| `quality_gate` | coordinator → all | Quality assessment | 质量门控结果 |
|
||||
| `task_unblocked` | coordinator → any | Dependency resolved | 通知 worker 可用任务 |
|
||||
| `error` | coordinator → all | Critical error | 上报用户 |
|
||||
| `shutdown` | coordinator → all | Team dissolving | 关闭信号 |
|
||||
|
||||
## Execution
|
||||
|
||||
### Phase 1: Change Scope Analysis
|
||||
|
||||
```javascript
|
||||
const args = "$ARGUMENTS"
|
||||
const teamName = args.match(/--team-name[=\s]+([\w-]+)/)?.[1] || `testing-${Date.now().toString(36)}`
|
||||
const taskDescription = args.replace(/--team-name[=\s]+[\w-]+/, '').replace(/--role[=\s]+\w+/, '').trim()
|
||||
|
||||
// Analyze change scope
|
||||
const changedFiles = Bash(`git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached`).split('\n').filter(Boolean)
|
||||
const changedModules = new Set(changedFiles.map(f => f.split('/').slice(0, 2).join('/')))
|
||||
|
||||
function selectPipeline(fileCount, moduleCount) {
|
||||
if (fileCount <= 3 && moduleCount <= 1) return 'targeted'
|
||||
if (fileCount <= 10 && moduleCount <= 3) return 'standard'
|
||||
return 'comprehensive'
|
||||
}
|
||||
|
||||
const suggestedPipeline = selectPipeline(changedFiles.length, changedModules.size)
|
||||
```
|
||||
|
||||
```javascript
|
||||
AskUserQuestion({
|
||||
questions: [
|
||||
{
|
||||
question: `检测到 ${changedFiles.length} 个变更文件,${changedModules.size} 个模块。选择测试模式:`,
|
||||
header: "Mode",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{ label: suggestedPipeline === 'targeted' ? "targeted (推荐)" : "targeted", description: "目标模式:策略→生成L1→执行(小范围变更)" },
|
||||
{ label: suggestedPipeline === 'standard' ? "standard (推荐)" : "standard", description: "标准模式:L1→L2 渐进式(含分析)" },
|
||||
{ label: suggestedPipeline === 'comprehensive' ? "comprehensive (推荐)" : "comprehensive", description: "全覆盖:并行L1+L2→L3(含分析)" }
|
||||
]
|
||||
},
|
||||
{
|
||||
question: "覆盖率目标:",
|
||||
header: "Coverage",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{ label: "标准", description: "L1:80% L2:60% L3:40%" },
|
||||
{ label: "严格", description: "L1:90% L2:75% L3:60%" },
|
||||
{ label: "最低", description: "L1:60% L2:40% L3:20%" }
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
### Phase 2: Create Team + Spawn Workers
|
||||
|
||||
```javascript
|
||||
TeamCreate({ team_name: teamName })
|
||||
|
||||
const topicSlug = taskDescription.toLowerCase().replace(/[^a-z0-9]+/g, '-').substring(0, 40)
|
||||
const dateStr = new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString().substring(0, 10)
|
||||
const sessionId = `TST-${topicSlug}-${dateStr}`
|
||||
const sessionFolder = `.workflow/.team/${sessionId}`
|
||||
|
||||
Bash(`mkdir -p "${sessionFolder}/strategy" "${sessionFolder}/tests/L1-unit" "${sessionFolder}/tests/L2-integration" "${sessionFolder}/tests/L3-e2e" "${sessionFolder}/results" "${sessionFolder}/analysis"`)
|
||||
|
||||
// Initialize shared memory
|
||||
const sharedMemory = {
|
||||
task: taskDescription,
|
||||
pipeline: selectedPipeline,
|
||||
changed_files: changedFiles,
|
||||
changed_modules: [...changedModules],
|
||||
coverage_targets: coverageTargets,
|
||||
gc_round: 0,
|
||||
max_gc_rounds: 3,
|
||||
test_strategy: null,
|
||||
generated_tests: [],
|
||||
execution_results: [],
|
||||
defect_patterns: [],
|
||||
effective_test_patterns: [],
|
||||
coverage_history: []
|
||||
}
|
||||
Write(`${sessionFolder}/shared-memory.json`, JSON.stringify(sharedMemory, null, 2))
|
||||
|
||||
const teamSession = {
|
||||
session_id: sessionId,
|
||||
team_name: teamName,
|
||||
task: taskDescription,
|
||||
pipeline: selectedPipeline,
|
||||
status: "active",
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString(),
|
||||
gc_round: 0,
|
||||
completed_tasks: []
|
||||
}
|
||||
Write(`${sessionFolder}/team-session.json`, JSON.stringify(teamSession, null, 2))
|
||||
```
|
||||
|
||||
Spawn workers (see SKILL.md Coordinator Spawn Template).
|
||||
|
||||
### Phase 3: Create Task Chain
|
||||
|
||||
#### Targeted Pipeline
|
||||
|
||||
```javascript
|
||||
TaskCreate({ subject: "STRATEGY-001: 变更范围分析与测试策略", description: `分析变更: ${changedFiles.join(', ')}\n\nSession: ${sessionFolder}\n输出: ${sessionFolder}/strategy/test-strategy.md\n\n确定测试层级、覆盖目标、优先级`, activeForm: "制定策略中" })
|
||||
TaskUpdate({ taskId: strategyId, owner: "strategist" })
|
||||
|
||||
TaskCreate({ subject: "TESTGEN-001: 生成 L1 单元测试", description: `基于策略生成单元测试\n\nSession: ${sessionFolder}\n层级: L1-unit\n输入: strategy/test-strategy.md\n输出: tests/L1-unit/\n覆盖率目标: ${coverageTargets.L1}%`, activeForm: "生成测试中" })
|
||||
TaskUpdate({ taskId: genId, owner: "generator", addBlockedBy: [strategyId] })
|
||||
|
||||
TaskCreate({ subject: "TESTRUN-001: 执行 L1 单元测试", description: `执行生成的单元测试\n\nSession: ${sessionFolder}\n输入: tests/L1-unit/\n输出: results/run-001.json + coverage-001.json\n覆盖率目标: ${coverageTargets.L1}%`, activeForm: "执行测试中" })
|
||||
TaskUpdate({ taskId: runId, owner: "executor", addBlockedBy: [genId] })
|
||||
```
|
||||
|
||||
#### Standard Pipeline
|
||||
|
||||
```javascript
|
||||
// STRATEGY-001 → TESTGEN-001(L1) → TESTRUN-001(L1) → TESTGEN-002(L2) → TESTRUN-002(L2) → TESTANA-001
|
||||
|
||||
// ... STRATEGY-001, TESTGEN-001, TESTRUN-001 same as targeted ...
|
||||
|
||||
TaskCreate({ subject: "TESTGEN-002: 生成 L2 集成测试", description: `基于 L1 结果生成集成测试\n\nSession: ${sessionFolder}\n层级: L2-integration\n输入: strategy/ + results/run-001.json\n输出: tests/L2-integration/\n覆盖率目标: ${coverageTargets.L2}%`, activeForm: "生成集成测试中" })
|
||||
TaskUpdate({ taskId: gen2Id, owner: "generator", addBlockedBy: [run1Id] })
|
||||
|
||||
TaskCreate({ subject: "TESTRUN-002: 执行 L2 集成测试", description: `执行集成测试\n\nSession: ${sessionFolder}\n输入: tests/L2-integration/\n输出: results/run-002.json`, activeForm: "执行集成测试中" })
|
||||
TaskUpdate({ taskId: run2Id, owner: "executor", addBlockedBy: [gen2Id] })
|
||||
|
||||
TaskCreate({ subject: "TESTANA-001: 质量分析报告", description: `分析所有测试结果\n\nSession: ${sessionFolder}\n输入: results/ + shared-memory.json\n输出: analysis/quality-report.md\n\n分析: 缺陷模式、覆盖率差距、测试有效性`, activeForm: "分析中" })
|
||||
TaskUpdate({ taskId: anaId, owner: "analyst", addBlockedBy: [run2Id] })
|
||||
```
|
||||
|
||||
#### Comprehensive Pipeline
|
||||
|
||||
```javascript
|
||||
// STRATEGY-001 → [TESTGEN-001(L1) + TESTGEN-002(L2)] → [TESTRUN-001 + TESTRUN-002] → TESTGEN-003(L3) → TESTRUN-003 → TESTANA-001
|
||||
|
||||
// TESTGEN-001 and TESTGEN-002 are parallel (both blockedBy STRATEGY-001)
|
||||
// TESTRUN-001 and TESTRUN-002 are parallel (blockedBy their respective TESTGEN)
|
||||
// TESTGEN-003(L3) blockedBy both TESTRUN-001 and TESTRUN-002
|
||||
// TESTRUN-003 blockedBy TESTGEN-003
|
||||
// TESTANA-001 blockedBy TESTRUN-003
|
||||
```
|
||||
|
||||
### Phase 4: Coordination Loop + Generator-Critic Control
|
||||
|
||||
| Received Message | Action |
|
||||
|-----------------|--------|
|
||||
| strategist: strategy_ready | Read strategy → team_msg log → TaskUpdate completed |
|
||||
| generator: tests_generated | team_msg log → TaskUpdate completed → unblock TESTRUN |
|
||||
| executor: tests_passed | Read coverage → **质量门控** → proceed to next layer |
|
||||
| executor: tests_failed | **Generator-Critic 判断** → 决定是否触发修订 |
|
||||
| executor: coverage_report | Read coverage data → update shared memory |
|
||||
| analyst: analysis_ready | Read report → team_msg log → Phase 5 |
|
||||
|
||||
#### Generator-Critic Loop Control
|
||||
|
||||
```javascript
|
||||
if (msgType === 'tests_failed' || msgType === 'coverage_report') {
|
||||
const result = JSON.parse(Read(`${sessionFolder}/results/run-${runNum}.json`))
|
||||
const sharedMemory = JSON.parse(Read(`${sessionFolder}/shared-memory.json`))
|
||||
|
||||
const passRate = result.pass_rate || 0
|
||||
const coverage = result.coverage || 0
|
||||
const target = coverageTargets[currentLayer]
|
||||
const gcRound = sharedMemory.gc_round || 0
|
||||
|
||||
if ((passRate < 0.95 || coverage < target) && gcRound < sharedMemory.max_gc_rounds) {
|
||||
// Trigger generator revision
|
||||
sharedMemory.gc_round = gcRound + 1
|
||||
Write(`${sessionFolder}/shared-memory.json`, JSON.stringify(sharedMemory, null, 2))
|
||||
|
||||
// Create TESTGEN-fix task
|
||||
TaskCreate({
|
||||
subject: `TESTGEN-fix-${gcRound + 1}: 修订 ${currentLayer} 测试`,
|
||||
description: `基于执行结果修订测试\n\nSession: ${sessionFolder}\n失败原因: ${result.failure_summary}\n覆盖率: ${coverage}% (目标: ${target}%)\n通过率: ${(passRate * 100).toFixed(1)}%`,
|
||||
activeForm: "修订测试中"
|
||||
})
|
||||
TaskUpdate({ taskId: fixGenId, owner: "generator" })
|
||||
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "coordinator", to: "generator",
|
||||
type: "gc_loop_trigger",
|
||||
summary: `[coordinator] GC round ${gcRound + 1}: coverage ${coverage}% < target ${target}%, revise tests`
|
||||
})
|
||||
} else if (gcRound >= sharedMemory.max_gc_rounds) {
|
||||
// Max rounds exceeded — accept current coverage
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "coordinator", to: "all",
|
||||
type: "quality_gate",
|
||||
summary: `[coordinator] GC loop exhausted (${gcRound} rounds), accepting coverage ${coverage}%`
|
||||
})
|
||||
} else {
|
||||
// Coverage met — proceed
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "coordinator", to: "all",
|
||||
type: "quality_gate",
|
||||
summary: `[coordinator] ${currentLayer} coverage ${coverage}% >= target ${target}%, proceeding`
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 5: Report + Persist
|
||||
|
||||
```javascript
|
||||
const sharedMemory = JSON.parse(Read(`${sessionFolder}/shared-memory.json`))
|
||||
const analysisReport = Read(`${sessionFolder}/analysis/quality-report.md`)
|
||||
|
||||
SendMessage({
|
||||
content: `## [coordinator] 测试完成
|
||||
|
||||
**任务**: ${taskDescription}
|
||||
**管道**: ${selectedPipeline}
|
||||
**GC 轮次**: ${sharedMemory.gc_round}
|
||||
**变更文件**: ${changedFiles.length}
|
||||
|
||||
### 覆盖率
|
||||
${sharedMemory.coverage_history.map(c => `- **${c.layer}**: ${c.coverage}% (目标: ${c.target}%)`).join('\n')}
|
||||
|
||||
### 质量报告
|
||||
${analysisReport}`,
|
||||
summary: `[coordinator] Testing complete: ${sharedMemory.gc_round} GC rounds`
|
||||
})
|
||||
|
||||
updateSession(sessionFolder, { status: 'completed', completed_at: new Date().toISOString() })
|
||||
|
||||
AskUserQuestion({
|
||||
questions: [{
|
||||
question: "测试已完成。下一步:",
|
||||
header: "Next",
|
||||
multiSelect: false,
|
||||
options: [
|
||||
{ label: "新测试", description: "对新变更运行测试" },
|
||||
{ label: "深化测试", description: "增加测试层级或提高覆盖率" },
|
||||
{ label: "关闭团队", description: "关闭所有 teammate 并清理" }
|
||||
]
|
||||
}]
|
||||
})
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| Teammate 无响应 | 发追踪消息,2次 → 重新 spawn |
|
||||
| GC 循环超限 (3轮) | 接受当前覆盖率,记录到 shared memory |
|
||||
| 测试环境异常 | 上报用户,建议手动修复 |
|
||||
| 所有测试失败 | 检查测试框架配置,通知 analyst 分析 |
|
||||
| 覆盖率工具不可用 | 降级为通过率判断 |
|
||||
204
.claude/skills/team-testing/roles/executor.md
Normal file
204
.claude/skills/team-testing/roles/executor.md
Normal file
@@ -0,0 +1,204 @@
|
||||
# Role: executor
|
||||
|
||||
测试执行者。执行测试、收集覆盖率、尝试自动修复失败。作为 Generator-Critic 循环中的 Critic 角色。
|
||||
|
||||
## Role Identity
|
||||
|
||||
- **Name**: `executor`
|
||||
- **Task Prefix**: `TESTRUN-*`
|
||||
- **Responsibility**: Validation (测试执行与验证)
|
||||
- **Communication**: SendMessage to coordinator only
|
||||
- **Output Tag**: `[executor]`
|
||||
|
||||
## Role Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- 仅处理 `TESTRUN-*` 前缀的任务
|
||||
- 所有输出必须带 `[executor]` 标识
|
||||
- Phase 2 读取 shared-memory.json,Phase 5 写入 execution_results + defect_patterns
|
||||
- 报告覆盖率和通过率供 coordinator 做 GC 判断
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- ❌ 生成新测试、制定策略或分析趋势
|
||||
- ❌ 直接与其他 worker 通信
|
||||
- ❌ 为其他角色创建任务
|
||||
|
||||
## Message Types
|
||||
|
||||
| Type | Direction | Trigger | Description |
|
||||
|------|-----------|---------|-------------|
|
||||
| `tests_passed` | executor → coordinator | All tests pass + coverage met | 测试通过 |
|
||||
| `tests_failed` | executor → coordinator | Tests fail or coverage below target | 测试失败/覆盖不足 |
|
||||
| `coverage_report` | executor → coordinator | Coverage data collected | 覆盖率数据 |
|
||||
| `error` | executor → coordinator | Execution environment failure | 错误上报 |
|
||||
|
||||
## Execution (5-Phase)
|
||||
|
||||
### Phase 1: Task Discovery
|
||||
|
||||
```javascript
|
||||
const tasks = TaskList()
|
||||
const myTasks = tasks.filter(t =>
|
||||
t.subject.startsWith('TESTRUN-') &&
|
||||
t.owner === 'executor' &&
|
||||
t.status === 'pending' &&
|
||||
t.blockedBy.length === 0
|
||||
)
|
||||
if (myTasks.length === 0) return
|
||||
const task = TaskGet({ taskId: myTasks[0].id })
|
||||
TaskUpdate({ taskId: task.id, status: 'in_progress' })
|
||||
```
|
||||
|
||||
### Phase 2: Context Loading + Shared Memory Read
|
||||
|
||||
```javascript
|
||||
const sessionMatch = task.description.match(/Session:\s*([^\n]+)/)
|
||||
const sessionFolder = sessionMatch?.[1]?.trim()
|
||||
|
||||
const memoryPath = `${sessionFolder}/shared-memory.json`
|
||||
let sharedMemory = {}
|
||||
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
|
||||
|
||||
const framework = sharedMemory.test_strategy?.framework || 'Jest'
|
||||
const coverageTarget = parseInt(task.description.match(/覆盖率目标:\s*(\d+)/)?.[1] || '80')
|
||||
|
||||
// Find test files to execute
|
||||
const testDir = task.description.match(/输入:\s*([^\n]+)/)?.[1]?.trim()
|
||||
const testFiles = Glob({ pattern: `${sessionFolder}/${testDir || 'tests'}/**/*` })
|
||||
```
|
||||
|
||||
### Phase 3: Test Execution + Fix Cycle
|
||||
|
||||
```javascript
|
||||
// Determine test command based on framework
|
||||
const testCommands = {
|
||||
'Jest': `npx jest --coverage --json --outputFile=${sessionFolder}/results/jest-output.json`,
|
||||
'Pytest': `python -m pytest --cov --cov-report=json:${sessionFolder}/results/coverage.json -v`,
|
||||
'Vitest': `npx vitest run --coverage --reporter=json`
|
||||
}
|
||||
const testCommand = testCommands[framework] || testCommands['Jest']
|
||||
|
||||
// Execute tests with auto-fix cycle (max 3 iterations)
|
||||
let iteration = 0
|
||||
const MAX_FIX_ITERATIONS = 3
|
||||
let lastResult = null
|
||||
let passRate = 0
|
||||
let coverage = 0
|
||||
|
||||
while (iteration < MAX_FIX_ITERATIONS) {
|
||||
lastResult = Bash(`${testCommand} 2>&1 || true`)
|
||||
|
||||
// Parse results
|
||||
const passed = !lastResult.includes('FAIL') && !lastResult.includes('FAILED')
|
||||
passRate = parsePassRate(lastResult)
|
||||
coverage = parseCoverage(lastResult)
|
||||
|
||||
if (passed && coverage >= coverageTarget) break
|
||||
|
||||
if (iteration < MAX_FIX_ITERATIONS - 1 && !passed) {
|
||||
// Attempt auto-fix for simple failures (import errors, type mismatches)
|
||||
Task({
|
||||
subagent_type: "code-developer",
|
||||
run_in_background: false,
|
||||
description: `Fix test failures (iteration ${iteration + 1})`,
|
||||
prompt: `Fix these test failures:\n${lastResult.substring(0, 3000)}\n\nOnly fix the test files, not the source code.`
|
||||
})
|
||||
}
|
||||
|
||||
iteration++
|
||||
}
|
||||
|
||||
// Save results
|
||||
const runNum = task.subject.match(/TESTRUN-(\d+)/)?.[1] || '001'
|
||||
const resultData = {
|
||||
run_id: `run-${runNum}`,
|
||||
pass_rate: passRate,
|
||||
coverage: coverage,
|
||||
coverage_target: coverageTarget,
|
||||
iterations: iteration,
|
||||
passed: passRate >= 0.95 && coverage >= coverageTarget,
|
||||
failure_summary: passRate < 0.95 ? extractFailures(lastResult) : null,
|
||||
timestamp: new Date().toISOString()
|
||||
}
|
||||
|
||||
Write(`${sessionFolder}/results/run-${runNum}.json`, JSON.stringify(resultData, null, 2))
|
||||
```
|
||||
|
||||
### Phase 4: Defect Pattern Extraction
|
||||
|
||||
```javascript
|
||||
// Extract defect patterns from failures
|
||||
if (resultData.failure_summary) {
|
||||
const newPatterns = extractDefectPatterns(lastResult)
|
||||
// Common patterns: null reference, async timing, import errors, type mismatches
|
||||
resultData.defect_patterns = newPatterns
|
||||
}
|
||||
|
||||
// Record effective test patterns (from passing tests)
|
||||
if (passRate > 0.8) {
|
||||
const effectivePatterns = extractEffectivePatterns(testFiles)
|
||||
resultData.effective_patterns = effectivePatterns
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 5: Report to Coordinator + Shared Memory Write
|
||||
|
||||
```javascript
|
||||
// Update shared memory
|
||||
sharedMemory.execution_results.push(resultData)
|
||||
if (resultData.defect_patterns) {
|
||||
sharedMemory.defect_patterns = [
|
||||
...sharedMemory.defect_patterns,
|
||||
...resultData.defect_patterns
|
||||
]
|
||||
}
|
||||
if (resultData.effective_patterns) {
|
||||
sharedMemory.effective_test_patterns = [
|
||||
...new Set([...sharedMemory.effective_test_patterns, ...resultData.effective_patterns])
|
||||
]
|
||||
}
|
||||
sharedMemory.coverage_history.push({
|
||||
layer: testDir,
|
||||
coverage: coverage,
|
||||
target: coverageTarget,
|
||||
pass_rate: passRate,
|
||||
timestamp: new Date().toISOString()
|
||||
})
|
||||
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
|
||||
|
||||
const msgType = resultData.passed ? "tests_passed" : "tests_failed"
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "executor", to: "coordinator",
|
||||
type: msgType,
|
||||
summary: `[executor] ${msgType}: pass=${(passRate*100).toFixed(1)}%, coverage=${coverage}% (target: ${coverageTarget}%), iterations=${iteration}`,
|
||||
ref: `${sessionFolder}/results/run-${runNum}.json`
|
||||
})
|
||||
|
||||
SendMessage({
|
||||
type: "message", recipient: "coordinator",
|
||||
content: `## [executor] Test Execution Results
|
||||
|
||||
**Task**: ${task.subject}
|
||||
**Pass Rate**: ${(passRate * 100).toFixed(1)}%
|
||||
**Coverage**: ${coverage}% (target: ${coverageTarget}%)
|
||||
**Fix Iterations**: ${iteration}/${MAX_FIX_ITERATIONS}
|
||||
**Status**: ${resultData.passed ? '✅ PASSED' : '❌ NEEDS REVISION'}
|
||||
|
||||
${resultData.defect_patterns ? `### Defect Patterns\n${resultData.defect_patterns.map(p => `- ${p}`).join('\n')}` : ''}`,
|
||||
summary: `[executor] ${resultData.passed ? 'PASSED' : 'FAILED'}: ${coverage}% coverage`
|
||||
})
|
||||
|
||||
TaskUpdate({ taskId: task.id, status: 'completed' })
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| No TESTRUN-* tasks | Idle |
|
||||
| Test command fails to start | Check framework installation, notify coordinator |
|
||||
| Coverage tool unavailable | Report pass rate only |
|
||||
| All tests timeout | Increase timeout, retry once |
|
||||
| Auto-fix makes tests worse | Revert, report original failures |
|
||||
192
.claude/skills/team-testing/roles/generator.md
Normal file
192
.claude/skills/team-testing/roles/generator.md
Normal file
@@ -0,0 +1,192 @@
|
||||
# Role: generator
|
||||
|
||||
测试用例生成者。按层级(L1单元/L2集成/L3 E2E)生成测试代码。作为 Generator-Critic 循环中的 Generator 角色。
|
||||
|
||||
## Role Identity
|
||||
|
||||
- **Name**: `generator`
|
||||
- **Task Prefix**: `TESTGEN-*`
|
||||
- **Responsibility**: Code generation (测试代码生成)
|
||||
- **Communication**: SendMessage to coordinator only
|
||||
- **Output Tag**: `[generator]`
|
||||
|
||||
## Role Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- 仅处理 `TESTGEN-*` 前缀的任务
|
||||
- 所有输出必须带 `[generator]` 标识
|
||||
- Phase 2 读取 shared-memory.json + test strategy,Phase 5 写入 generated_tests
|
||||
- 生成可直接执行的测试代码
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- ❌ 执行测试、分析覆盖率或制定策略
|
||||
- ❌ 直接与其他 worker 通信
|
||||
- ❌ 为其他角色创建任务
|
||||
- ❌ 修改源代码(仅生成测试代码)
|
||||
|
||||
## Message Types
|
||||
|
||||
| Type | Direction | Trigger | Description |
|
||||
|------|-----------|---------|-------------|
|
||||
| `tests_generated` | generator → coordinator | Tests created | 测试生成完成 |
|
||||
| `tests_revised` | generator → coordinator | Tests revised after failure | 修订测试完成 (GC 循环) |
|
||||
| `error` | generator → coordinator | Processing failure | 错误上报 |
|
||||
|
||||
## Execution (5-Phase)
|
||||
|
||||
### Phase 1: Task Discovery
|
||||
|
||||
```javascript
|
||||
const tasks = TaskList()
|
||||
const myTasks = tasks.filter(t =>
|
||||
t.subject.startsWith('TESTGEN-') &&
|
||||
t.owner === 'generator' &&
|
||||
t.status === 'pending' &&
|
||||
t.blockedBy.length === 0
|
||||
)
|
||||
if (myTasks.length === 0) return
|
||||
const task = TaskGet({ taskId: myTasks[0].id })
|
||||
TaskUpdate({ taskId: task.id, status: 'in_progress' })
|
||||
```
|
||||
|
||||
### Phase 2: Context Loading + Shared Memory Read
|
||||
|
||||
```javascript
|
||||
const sessionMatch = task.description.match(/Session:\s*([^\n]+)/)
|
||||
const sessionFolder = sessionMatch?.[1]?.trim()
|
||||
const layerMatch = task.description.match(/层级:\s*(\S+)/)
|
||||
const layer = layerMatch?.[1] || 'L1-unit'
|
||||
|
||||
const memoryPath = `${sessionFolder}/shared-memory.json`
|
||||
let sharedMemory = {}
|
||||
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
|
||||
|
||||
// Read strategy
|
||||
const strategy = Read(`${sessionFolder}/strategy/test-strategy.md`)
|
||||
|
||||
// Read source files to test
|
||||
const targetFiles = sharedMemory.test_strategy?.priority_files || sharedMemory.changed_files || []
|
||||
const sourceContents = {}
|
||||
for (const file of targetFiles.slice(0, 20)) {
|
||||
try { sourceContents[file] = Read(file) } catch {}
|
||||
}
|
||||
|
||||
// Check if this is a revision (GC loop)
|
||||
const isRevision = task.subject.includes('fix') || task.subject.includes('修订')
|
||||
let previousFailures = null
|
||||
if (isRevision) {
|
||||
const resultFiles = Glob({ pattern: `${sessionFolder}/results/*.json` })
|
||||
if (resultFiles.length > 0) {
|
||||
try { previousFailures = JSON.parse(Read(resultFiles[resultFiles.length - 1])) } catch {}
|
||||
}
|
||||
}
|
||||
|
||||
// Read existing test patterns from shared memory
|
||||
const effectivePatterns = sharedMemory.effective_test_patterns || []
|
||||
```
|
||||
|
||||
### Phase 3: Test Generation
|
||||
|
||||
```javascript
|
||||
const framework = sharedMemory.test_strategy?.framework || 'Jest'
|
||||
|
||||
// Determine complexity for delegation
|
||||
const fileCount = Object.keys(sourceContents).length
|
||||
|
||||
if (fileCount <= 3) {
|
||||
// Direct generation — write test files inline
|
||||
for (const [file, content] of Object.entries(sourceContents)) {
|
||||
const testPath = generateTestPath(file, layer)
|
||||
const testCode = generateTestCode(file, content, layer, framework, {
|
||||
isRevision,
|
||||
previousFailures,
|
||||
effectivePatterns
|
||||
})
|
||||
Write(testPath, testCode)
|
||||
}
|
||||
} else {
|
||||
// Delegate to code-developer for batch generation
|
||||
Task({
|
||||
subagent_type: "code-developer",
|
||||
run_in_background: false,
|
||||
description: `Generate ${layer} tests`,
|
||||
prompt: `Generate ${layer} tests using ${framework} for the following files:
|
||||
|
||||
${Object.entries(sourceContents).map(([f, c]) => `### ${f}\n\`\`\`\n${c.substring(0, 2000)}\n\`\`\``).join('\n\n')}
|
||||
|
||||
${isRevision ? `\n## Previous Failures\n${JSON.stringify(previousFailures?.failures?.slice(0, 10), null, 2)}` : ''}
|
||||
|
||||
${effectivePatterns.length > 0 ? `\n## Effective Patterns (from previous rounds)\n${effectivePatterns.map(p => `- ${p}`).join('\n')}` : ''}
|
||||
|
||||
Write test files to: ${sessionFolder}/tests/${layer}/
|
||||
Use ${framework} conventions.
|
||||
Each test file should cover: happy path, edge cases, error handling.`
|
||||
})
|
||||
}
|
||||
|
||||
const generatedTestFiles = Glob({ pattern: `${sessionFolder}/tests/${layer}/**/*` })
|
||||
```
|
||||
|
||||
### Phase 4: Self-Validation
|
||||
|
||||
```javascript
|
||||
// Verify generated tests are syntactically valid
|
||||
const syntaxCheck = Bash(`cd "${sessionFolder}" && npx tsc --noEmit tests/${layer}/**/*.ts 2>&1 || true`)
|
||||
const hasSyntaxErrors = syntaxCheck.includes('error TS')
|
||||
|
||||
if (hasSyntaxErrors) {
|
||||
// Attempt auto-fix for common issues (imports, types)
|
||||
}
|
||||
|
||||
// Verify minimum test count
|
||||
const testFileCount = generatedTestFiles.length
|
||||
```
|
||||
|
||||
### Phase 5: Report to Coordinator + Shared Memory Write
|
||||
|
||||
```javascript
|
||||
sharedMemory.generated_tests = [
|
||||
...sharedMemory.generated_tests,
|
||||
...generatedTestFiles.map(f => ({
|
||||
file: f,
|
||||
layer: layer,
|
||||
round: isRevision ? sharedMemory.gc_round : 0,
|
||||
revised: isRevision
|
||||
}))
|
||||
]
|
||||
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
|
||||
|
||||
const msgType = isRevision ? "tests_revised" : "tests_generated"
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "generator", to: "coordinator",
|
||||
type: msgType,
|
||||
summary: `[generator] ${isRevision ? 'Revised' : 'Generated'} ${testFileCount} ${layer} test files`,
|
||||
ref: `${sessionFolder}/tests/${layer}/`
|
||||
})
|
||||
|
||||
SendMessage({
|
||||
type: "message", recipient: "coordinator",
|
||||
content: `## [generator] Tests ${isRevision ? 'Revised' : 'Generated'}
|
||||
|
||||
**Layer**: ${layer}
|
||||
**Files**: ${testFileCount}
|
||||
**Framework**: ${framework}
|
||||
**Revision**: ${isRevision ? 'Yes (GC round ' + sharedMemory.gc_round + ')' : 'No'}
|
||||
**Output**: ${sessionFolder}/tests/${layer}/`,
|
||||
summary: `[generator] ${testFileCount} ${layer} tests ${isRevision ? 'revised' : 'generated'}`
|
||||
})
|
||||
|
||||
TaskUpdate({ taskId: task.id, status: 'completed' })
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| No TESTGEN-* tasks | Idle |
|
||||
| Source file not found | Skip, notify coordinator |
|
||||
| Test framework unknown | Default to Jest patterns |
|
||||
| Revision with no failure data | Generate additional tests instead of revising |
|
||||
| Syntax errors in generated tests | Auto-fix imports and types |
|
||||
179
.claude/skills/team-testing/roles/strategist.md
Normal file
179
.claude/skills/team-testing/roles/strategist.md
Normal file
@@ -0,0 +1,179 @@
|
||||
# Role: strategist
|
||||
|
||||
测试策略制定者。分析 git diff、确定测试层级、定义覆盖率目标和测试优先级。
|
||||
|
||||
## Role Identity
|
||||
|
||||
- **Name**: `strategist`
|
||||
- **Task Prefix**: `STRATEGY-*`
|
||||
- **Responsibility**: Read-only analysis (策略分析)
|
||||
- **Communication**: SendMessage to coordinator only
|
||||
- **Output Tag**: `[strategist]`
|
||||
|
||||
## Role Boundaries
|
||||
|
||||
### MUST
|
||||
|
||||
- 仅处理 `STRATEGY-*` 前缀的任务
|
||||
- 所有输出必须带 `[strategist]` 标识
|
||||
- Phase 2 读取 shared-memory.json,Phase 5 写入 test_strategy
|
||||
|
||||
### MUST NOT
|
||||
|
||||
- ❌ 生成测试代码、执行测试或分析结果
|
||||
- ❌ 直接与其他 worker 通信
|
||||
- ❌ 为其他角色创建任务
|
||||
|
||||
## Message Types
|
||||
|
||||
| Type | Direction | Trigger | Description |
|
||||
|------|-----------|---------|-------------|
|
||||
| `strategy_ready` | strategist → coordinator | Strategy completed | 策略制定完成 |
|
||||
| `error` | strategist → coordinator | Processing failure | 错误上报 |
|
||||
|
||||
## Execution (5-Phase)
|
||||
|
||||
### Phase 1: Task Discovery
|
||||
|
||||
```javascript
|
||||
const tasks = TaskList()
|
||||
const myTasks = tasks.filter(t =>
|
||||
t.subject.startsWith('STRATEGY-') &&
|
||||
t.owner === 'strategist' &&
|
||||
t.status === 'pending' &&
|
||||
t.blockedBy.length === 0
|
||||
)
|
||||
if (myTasks.length === 0) return
|
||||
const task = TaskGet({ taskId: myTasks[0].id })
|
||||
TaskUpdate({ taskId: task.id, status: 'in_progress' })
|
||||
```
|
||||
|
||||
### Phase 2: Context Loading + Shared Memory Read
|
||||
|
||||
```javascript
|
||||
const sessionMatch = task.description.match(/Session:\s*([^\n]+)/)
|
||||
const sessionFolder = sessionMatch?.[1]?.trim()
|
||||
|
||||
const memoryPath = `${sessionFolder}/shared-memory.json`
|
||||
let sharedMemory = {}
|
||||
try { sharedMemory = JSON.parse(Read(memoryPath)) } catch {}
|
||||
|
||||
const changedFiles = sharedMemory.changed_files || []
|
||||
const changedModules = sharedMemory.changed_modules || []
|
||||
|
||||
// Read git diff for detailed analysis
|
||||
const gitDiff = Bash(`git diff HEAD~1 -- ${changedFiles.join(' ')} 2>/dev/null || git diff --cached -- ${changedFiles.join(' ')}`)
|
||||
|
||||
// Detect test framework
|
||||
const hasJest = Bash(`test -f jest.config.js || test -f jest.config.ts && echo "yes" || echo "no"`).trim() === 'yes'
|
||||
const hasPytest = Bash(`test -f pytest.ini || test -f pyproject.toml && echo "yes" || echo "no"`).trim() === 'yes'
|
||||
const hasVitest = Bash(`test -f vitest.config.ts || test -f vitest.config.js && echo "yes" || echo "no"`).trim() === 'yes'
|
||||
```
|
||||
|
||||
### Phase 3: Strategy Formulation
|
||||
|
||||
```javascript
|
||||
// Analyze changes by type:
|
||||
// - New files → need new tests
|
||||
// - Modified functions → need updated tests
|
||||
// - Deleted files → need test cleanup
|
||||
// - Config changes → may need integration tests
|
||||
|
||||
const outputPath = `${sessionFolder}/strategy/test-strategy.md`
|
||||
|
||||
const strategyContent = `# Test Strategy
|
||||
|
||||
**Changed Files**: ${changedFiles.length}
|
||||
**Changed Modules**: ${changedModules.join(', ')}
|
||||
**Test Framework**: ${hasJest ? 'Jest' : hasPytest ? 'Pytest' : hasVitest ? 'Vitest' : 'Unknown'}
|
||||
|
||||
## Change Analysis
|
||||
|
||||
| File | Change Type | Impact | Priority |
|
||||
|------|------------|--------|----------|
|
||||
${changeAnalysis.map(c => `| ${c.file} | ${c.type} | ${c.impact} | ${c.priority} |`).join('\n')}
|
||||
|
||||
## Test Layer Recommendations
|
||||
|
||||
### L1: Unit Tests
|
||||
- **Scope**: ${l1Scope.join(', ')}
|
||||
- **Coverage Target**: ${coverageTargets.L1}%
|
||||
- **Priority Files**: ${l1Priority.join(', ')}
|
||||
- **Test Patterns**: ${l1Patterns.join(', ')}
|
||||
|
||||
### L2: Integration Tests
|
||||
- **Scope**: ${l2Scope.join(', ')}
|
||||
- **Coverage Target**: ${coverageTargets.L2}%
|
||||
- **Integration Points**: ${integrationPoints.join(', ')}
|
||||
|
||||
### L3: E2E Tests
|
||||
- **Scope**: ${l3Scope.join(', ')}
|
||||
- **Coverage Target**: ${coverageTargets.L3}%
|
||||
- **User Scenarios**: ${userScenarios.join(', ')}
|
||||
|
||||
## Risk Assessment
|
||||
|
||||
| Risk | Probability | Impact | Mitigation |
|
||||
|------|------------|--------|------------|
|
||||
${risks.map(r => `| ${r.risk} | ${r.probability} | ${r.impact} | ${r.mitigation} |`).join('\n')}
|
||||
|
||||
## Test Execution Order
|
||||
|
||||
1. L1 unit tests for high-priority changed files
|
||||
2. L1 unit tests for dependent modules
|
||||
3. L2 integration tests for cross-module interactions
|
||||
4. L3 E2E tests for affected user scenarios
|
||||
`
|
||||
|
||||
Write(outputPath, strategyContent)
|
||||
```
|
||||
|
||||
### Phase 4: Self-Validation
|
||||
|
||||
```javascript
|
||||
// Verify strategy completeness
|
||||
const hasAllLayers = l1Scope.length > 0
|
||||
const hasCoverageTargets = coverageTargets.L1 > 0
|
||||
const hasPriorityFiles = l1Priority.length > 0
|
||||
|
||||
if (!hasAllLayers || !hasCoverageTargets) {
|
||||
// Fill gaps
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 5: Report to Coordinator + Shared Memory Write
|
||||
|
||||
```javascript
|
||||
sharedMemory.test_strategy = {
|
||||
framework: hasJest ? 'Jest' : hasPytest ? 'Pytest' : hasVitest ? 'Vitest' : 'Unknown',
|
||||
layers: { L1: l1Scope, L2: l2Scope, L3: l3Scope },
|
||||
coverage_targets: coverageTargets,
|
||||
priority_files: l1Priority,
|
||||
risks: risks
|
||||
}
|
||||
Write(memoryPath, JSON.stringify(sharedMemory, null, 2))
|
||||
|
||||
mcp__ccw-tools__team_msg({
|
||||
operation: "log", team: teamName, from: "strategist", to: "coordinator",
|
||||
type: "strategy_ready",
|
||||
summary: `[strategist] Strategy complete: ${changedFiles.length} files, L1-L3 layers defined`,
|
||||
ref: outputPath
|
||||
})
|
||||
|
||||
SendMessage({
|
||||
type: "message", recipient: "coordinator",
|
||||
content: `## [strategist] Test Strategy Ready\n\n**Files**: ${changedFiles.length}\n**Layers**: L1(${l1Scope.length} targets), L2(${l2Scope.length}), L3(${l3Scope.length})\n**Framework**: ${sharedMemory.test_strategy.framework}\n**Output**: ${outputPath}`,
|
||||
summary: `[strategist] Strategy ready`
|
||||
})
|
||||
|
||||
TaskUpdate({ taskId: task.id, status: 'completed' })
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Scenario | Resolution |
|
||||
|----------|------------|
|
||||
| No STRATEGY-* tasks | Idle |
|
||||
| No changed files | Analyze full codebase, recommend smoke tests |
|
||||
| Unknown test framework | Recommend Jest/Pytest based on project language |
|
||||
| All files are config | Recommend integration tests only |
|
||||
93
.claude/skills/team-testing/specs/team-config.json
Normal file
93
.claude/skills/team-testing/specs/team-config.json
Normal file
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"team_name": "team-testing",
|
||||
"team_display_name": "Team Testing",
|
||||
"description": "Testing team with Generator-Critic loop, shared defect memory, and progressive test layers",
|
||||
"version": "1.0.0",
|
||||
|
||||
"roles": {
|
||||
"coordinator": {
|
||||
"task_prefix": null,
|
||||
"responsibility": "Change scope analysis, layer selection, quality gating",
|
||||
"message_types": ["pipeline_selected", "gc_loop_trigger", "quality_gate", "task_unblocked", "error", "shutdown"]
|
||||
},
|
||||
"strategist": {
|
||||
"task_prefix": "STRATEGY",
|
||||
"responsibility": "Analyze git diff, determine test layers, define coverage targets",
|
||||
"message_types": ["strategy_ready", "error"]
|
||||
},
|
||||
"generator": {
|
||||
"task_prefix": "TESTGEN",
|
||||
"responsibility": "Generate test cases by layer (unit/integration/E2E)",
|
||||
"message_types": ["tests_generated", "tests_revised", "error"]
|
||||
},
|
||||
"executor": {
|
||||
"task_prefix": "TESTRUN",
|
||||
"responsibility": "Execute tests, collect coverage, auto-fix failures",
|
||||
"message_types": ["tests_passed", "tests_failed", "coverage_report", "error"]
|
||||
},
|
||||
"analyst": {
|
||||
"task_prefix": "TESTANA",
|
||||
"responsibility": "Defect pattern analysis, coverage gap analysis, quality report",
|
||||
"message_types": ["analysis_ready", "error"]
|
||||
}
|
||||
},
|
||||
|
||||
"pipelines": {
|
||||
"targeted": {
|
||||
"description": "Small scope: strategy → generate L1 → run",
|
||||
"task_chain": ["STRATEGY-001", "TESTGEN-001", "TESTRUN-001"],
|
||||
"gc_loops": 0
|
||||
},
|
||||
"standard": {
|
||||
"description": "Progressive: L1 → L2 with analysis",
|
||||
"task_chain": ["STRATEGY-001", "TESTGEN-001", "TESTRUN-001", "TESTGEN-002", "TESTRUN-002", "TESTANA-001"],
|
||||
"gc_loops": 1
|
||||
},
|
||||
"comprehensive": {
|
||||
"description": "Full coverage: parallel L1+L2, then L3 with analysis",
|
||||
"task_chain": ["STRATEGY-001", "TESTGEN-001", "TESTGEN-002", "TESTRUN-001", "TESTRUN-002", "TESTGEN-003", "TESTRUN-003", "TESTANA-001"],
|
||||
"gc_loops": 2,
|
||||
"parallel_groups": [["TESTGEN-001", "TESTGEN-002"], ["TESTRUN-001", "TESTRUN-002"]]
|
||||
}
|
||||
},
|
||||
|
||||
"innovation_patterns": {
|
||||
"generator_critic": {
|
||||
"generator": "generator",
|
||||
"critic": "executor",
|
||||
"max_rounds": 3,
|
||||
"convergence_trigger": "coverage >= target && pass_rate >= 0.95"
|
||||
},
|
||||
"shared_memory": {
|
||||
"file": "shared-memory.json",
|
||||
"fields": {
|
||||
"strategist": "test_strategy",
|
||||
"generator": "generated_tests",
|
||||
"executor": "execution_results",
|
||||
"analyst": "analysis_report"
|
||||
},
|
||||
"persistent_fields": ["defect_patterns", "effective_test_patterns", "coverage_history"]
|
||||
},
|
||||
"dynamic_pipeline": {
|
||||
"selector": "coordinator",
|
||||
"criteria": "changed_file_count + module_count + change_type"
|
||||
}
|
||||
},
|
||||
|
||||
"test_layers": {
|
||||
"L1": { "name": "Unit Tests", "coverage_target": 80, "description": "Function-level isolation tests" },
|
||||
"L2": { "name": "Integration Tests", "coverage_target": 60, "description": "Module interaction tests" },
|
||||
"L3": { "name": "E2E Tests", "coverage_target": 40, "description": "User scenario end-to-end tests" }
|
||||
},
|
||||
|
||||
"collaboration_patterns": ["CP-1", "CP-3", "CP-5"],
|
||||
|
||||
"session_dirs": {
|
||||
"base": ".workflow/.team/TST-{slug}-{YYYY-MM-DD}/",
|
||||
"strategy": "strategy/",
|
||||
"tests": "tests/",
|
||||
"results": "results/",
|
||||
"analysis": "analysis/",
|
||||
"messages": ".workflow/.team-msg/{team-name}/"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user