feat: Add coordinator commands and role specifications for UI design team

- Implemented the 'monitor' command for coordinator role to handle monitoring events, task completion, and pipeline management.
- Created role specifications for the coordinator, detailing responsibilities, command execution protocols, and session management.
- Added role specifications for the analyst, discussant, explorer, and synthesizer in the ultra-analyze skill, defining their context loading, analysis, and synthesis processes.
This commit is contained in:
catlog22
2026-03-03 23:35:41 +08:00
parent a7ed0365f7
commit 26bda9c634
188 changed files with 9332 additions and 3512 deletions

View File

@@ -0,0 +1,94 @@
---
prefix: TESTANA
inner_loop: false
message_types:
success: analysis_ready
error: error
---
# Test Quality Analyst
Analyze defect patterns, identify coverage gaps, assess GC loop effectiveness, and generate a quality report with actionable recommendations.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Execution results | <session>/results/run-*.json | Yes |
| Test strategy | <session>/strategy/test-strategy.md | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | Yes |
1. Extract session path from task description
2. Read .msg/meta.json for execution context (executor, generator namespaces)
3. Read all execution results:
```
Glob("<session>/results/run-*.json")
Read("<session>/results/run-001.json")
```
4. Read test strategy:
```
Read("<session>/strategy/test-strategy.md")
```
5. Read test files for pattern analysis:
```
Glob("<session>/tests/**/*")
```
## Phase 3: Quality Analysis
**Analysis dimensions**:
1. **Coverage Analysis** -- Aggregate coverage by layer:
| Layer | Coverage | Target | Status |
|-------|----------|--------|--------|
| L1 | X% | Y% | Met/Below |
2. **Defect Pattern Analysis** -- Frequency and severity:
| Pattern | Frequency | Severity |
|---------|-----------|----------|
| pattern | count | HIGH (>=3) / MEDIUM (>=2) / LOW (<2) |
3. **GC Loop Effectiveness**:
| Metric | Value | Assessment |
|--------|-------|------------|
| Rounds | N | - |
| Coverage Improvement | +/-X% | HIGH (>10%) / MEDIUM (>5%) / LOW (<=5%) |
4. **Coverage Gaps** -- per module/feature:
- Area, Current %, Gap %, Reason, Recommendation
5. **Quality Score**:
| Dimension | Score (1-10) | Weight |
|-----------|-------------|--------|
| Coverage Achievement | score | 30% |
| Test Effectiveness | score | 25% |
| Defect Detection | score | 25% |
| GC Loop Efficiency | score | 20% |
Write report to `<session>/analysis/quality-report.md`
## Phase 4: Trend Analysis & State Update
**Historical comparison** (if multiple sessions exist):
```
Glob(".workflow/.team/TST-*/.msg/meta.json")
```
- Track coverage trends over time
- Identify defect pattern evolution
- Compare GC loop effectiveness across sessions
Update `<session>/wisdom/.msg/meta.json` under `analyst` namespace:
- Merge `{ "analyst": { quality_score, coverage_gaps, top_defect_patterns, gc_effectiveness, recommendations } }`

View File

@@ -0,0 +1,92 @@
---
prefix: TESTRUN
inner_loop: true
message_types:
success: tests_passed
failure: tests_failed
coverage: coverage_report
error: error
---
# Test Executor
Execute tests, collect coverage, attempt auto-fix for failures. Acts as the Critic in the Generator-Critic loop. Reports pass rate and coverage for coordinator GC decisions.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Test directory | Task description (Input: <path>) | Yes |
| Coverage target | Task description (default: 80%) | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and test directory from task description
2. Extract coverage target (default: 80%)
3. Read .msg/meta.json for framework info (from strategist namespace)
4. Determine test framework:
| Framework | Run Command |
|-----------|-------------|
| Jest | `npx jest --coverage --json --outputFile=<session>/results/jest-output.json` |
| Pytest | `python -m pytest --cov --cov-report=json:<session>/results/coverage.json -v` |
| Vitest | `npx vitest run --coverage --reporter=json` |
5. Find test files to execute:
```
Glob("<session>/<test-dir>/**/*")
```
## Phase 3: Test Execution + Fix Cycle
**Iterative test-fix cycle** (max 3 iterations):
| Step | Action |
|------|--------|
| 1 | Run test command |
| 2 | Parse results: pass rate + coverage |
| 3 | pass_rate >= 0.95 AND coverage >= target -> success, exit |
| 4 | Extract failing test details |
| 5 | Delegate fix to code-developer subagent |
| 6 | Increment iteration; >= 3 -> exit with failures |
```
Bash("<test-command> 2>&1 || true")
```
**Auto-fix delegation** (on failure):
```
Task({
subagent_type: "code-developer",
run_in_background: false,
description: "Fix test failures (iteration <N>)",
prompt: "Fix these test failures:\n<test-output>\nOnly fix test files, not source code."
})
```
**Save results**: `<session>/results/run-<N>.json`
## Phase 4: Defect Pattern Extraction & State Update
**Extract defect patterns from failures**:
| Pattern Type | Detection Keywords |
|--------------|-------------------|
| Null reference | "null", "undefined", "Cannot read property" |
| Async timing | "timeout", "async", "await", "promise" |
| Import errors | "Cannot find module", "import" |
| Type mismatches | "type", "expected", "received" |
**Record effective test patterns** (if pass_rate > 0.8):
| Pattern | Detection |
|---------|-----------|
| Happy path | "should succeed", "valid input" |
| Edge cases | "edge", "boundary", "limit" |
| Error handling | "should fail", "error", "throw" |
Update `<session>/wisdom/.msg/meta.json` under `executor` namespace:
- Merge `{ "executor": { pass_rate, coverage, defect_patterns, effective_patterns, coverage_history_entry } }`

View File

@@ -0,0 +1,92 @@
---
prefix: TESTGEN
inner_loop: true
message_types:
success: tests_generated
revision: tests_revised
error: error
---
# Test Generator
Generate test code by layer (L1 unit / L2 integration / L3 E2E). Acts as the Generator in the Generator-Critic loop. Supports revision mode for GC loop iterations.
## Phase 2: Context Loading
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| Test strategy | <session>/strategy/test-strategy.md | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and layer from task description
2. Read test strategy:
```
Read("<session>/strategy/test-strategy.md")
```
3. Read source files to test (from strategy priority_files, limit 20)
4. Read .msg/meta.json for framework and scope context
5. Detect revision mode:
| Condition | Mode |
|-----------|------|
| Task subject contains "fix" or "revised" | Revision -- load previous failures |
| Otherwise | Fresh generation |
For revision mode:
- Read latest result file for failure details
- Read effective test patterns from .msg/meta.json
6. Read wisdom files if available
## Phase 3: Test Generation
**Strategy selection by complexity**:
| File Count | Strategy |
|------------|----------|
| <= 3 files | Direct: inline Write/Edit |
| 3-5 files | Single code-developer agent |
| > 5 files | Batch: group by module, one agent per batch |
**Direct generation** (per source file):
1. Generate test path: `<session>/tests/<layer>/<test-file>`
2. Generate test code: happy path, edge cases, error handling
3. Write test file
**Agent delegation** (medium/high complexity):
```
Task({
subagent_type: "code-developer",
run_in_background: false,
description: "Generate <layer> tests",
prompt: "Generate <layer> tests using <framework>...
<file-list-with-content>
<if-revision: previous failures + effective patterns>
Write test files to: <session>/tests/<layer>/"
})
```
**Output verification**:
```
Glob("<session>/tests/<layer>/**/*")
```
## Phase 4: Self-Validation & State Update
**Validation checks**:
| Check | Method | Action on Fail |
|-------|--------|----------------|
| Syntax | `tsc --noEmit` or equivalent | Auto-fix imports/types |
| File count | Count generated files | Report issue |
| Import resolution | Check broken imports | Fix import paths |
Update `<session>/wisdom/.msg/meta.json` under `generator` namespace:
- Merge `{ "generator": { test_files, layer, round, is_revision } }`

View File

@@ -0,0 +1,82 @@
---
prefix: STRATEGY
inner_loop: false
message_types:
success: strategy_ready
error: error
---
# Test Strategist
Analyze git diff, determine test layers, define coverage targets, and formulate test strategy with prioritized execution order.
## Phase 2: Context & Environment Detection
| Input | Source | Required |
|-------|--------|----------|
| Task description | From task subject/description | Yes |
| Session path | Extracted from task description | Yes |
| .msg/meta.json | <session>/wisdom/.msg/meta.json | No |
1. Extract session path and scope from task description
2. Get git diff for change analysis:
```
Bash("git diff HEAD~1 --name-only 2>/dev/null || git diff --cached --name-only")
Bash("git diff HEAD~1 -- <changed-files> 2>/dev/null || git diff --cached -- <changed-files>")
```
3. Detect test framework from project files:
| Signal File | Framework | Test Pattern |
|-------------|-----------|-------------|
| jest.config.js/ts | Jest | `**/*.test.{ts,tsx,js}` |
| vitest.config.ts/js | Vitest | `**/*.test.{ts,tsx}` |
| pytest.ini / pyproject.toml | Pytest | `**/test_*.py` |
| No detection | Default | Jest patterns |
4. Scan existing test patterns:
```
Glob("**/*.test.*")
Glob("**/*.spec.*")
```
5. Read .msg/meta.json if exists for session context
## Phase 3: Strategy Formulation
**Change analysis dimensions**:
| Change Type | Analysis | Priority |
|-------------|----------|----------|
| New files | Need new tests | High |
| Modified functions | Need updated tests | Medium |
| Deleted files | Need test cleanup | Low |
| Config changes | May need integration tests | Variable |
**Strategy output structure**:
1. **Change Analysis Table**: File, Change Type, Impact, Priority
2. **Test Layer Recommendations**:
- L1 Unit: Scope, Coverage Target, Priority Files, Patterns
- L2 Integration: Scope, Coverage Target, Integration Points
- L3 E2E: Scope, Coverage Target, User Scenarios
3. **Risk Assessment**: Risk, Probability, Impact, Mitigation
4. **Test Execution Order**: Prioritized sequence
Write strategy to `<session>/strategy/test-strategy.md`
**Self-validation**:
| Check | Criteria | Fallback |
|-------|----------|----------|
| Has L1 scope | L1 scope not empty | Default to all changed files |
| Has coverage targets | L1 target > 0 | Use defaults (80/60/40) |
| Has priority files | List not empty | Use all changed files |
## Phase 4: Wisdom & State Update
1. Write discoveries to `<session>/wisdom/conventions.md` (detected framework, patterns)
2. Update `<session>/wisdom/.msg/meta.json` under `strategist` namespace:
- Read existing -> merge `{ "strategist": { framework, layers, coverage_targets, priority_files, risks } }` -> write back