Refactor team collaboration skills and update documentation

- Renamed `team-lifecycle-v5` to `team-lifecycle` across various documentation files for consistency.
- Updated references in code examples and usage sections to reflect the new skill name.
- Added a new command file for the `monitor` functionality in the `team-iterdev` skill, detailing the coordinator's monitoring events and task management.
- Introduced new components for dynamic pipeline visualization and session coordinates display in the frontend.
- Implemented utility functions for pipeline stage detection and status derivation based on message history.
- Enhanced the team role panel to map members to their respective pipeline roles with status indicators.
- Updated Chinese documentation to reflect the changes in skill names and descriptions.
This commit is contained in:
catlog22
2026-03-04 11:07:48 +08:00
parent 5e96722c09
commit ffd5282932
132 changed files with 2938 additions and 18916 deletions

View File

@@ -1,165 +0,0 @@
# Command: create-plan
> 使用 gemini CLI 创建结构化治理方案。将 quick-wins 归为立即执行systematic 归为中期治理,识别预防机制用于长期改善。输出 remediation-plan.md。
## When to Use
- Phase 3 of Planner
- 评估矩阵已就绪,需要创建治理方案
- 债务项已按优先级象限分组
**Trigger conditions**:
- TDPLAN-* 任务进入 Phase 3
- 评估数据可用priority-matrix.json
- 需要 CLI 辅助生成详细修复建议
## Strategy
### Delegation Mode
**Mode**: CLI Analysis + Template Generation
**CLI Tool**: `gemini` (primary)
**CLI Mode**: `analysis`
### Decision Logic
```javascript
// 方案生成策略
if (quickWins.length + strategic.length <= 5) {
// 少量项目:内联生成方案
mode = 'inline'
} else {
// 较多项目CLI 辅助生成详细修复步骤
mode = 'cli-assisted'
}
```
## Execution Steps
### Step 1: Context Preparation
```javascript
// 准备债务摘要供 CLI 分析
const debtSummary = debtInventory
.filter(i => i.priority_quadrant === 'quick-win' || i.priority_quadrant === 'strategic')
.map(i => `[${i.id}] [${i.priority_quadrant}] [${i.dimension}] ${i.file}:${i.line} - ${i.description} (impact: ${i.impact_score}, cost: ${i.cost_score})`)
.join('\n')
// 读取相关源文件获取上下文
const affectedFiles = [...new Set(debtInventory.map(i => i.file).filter(Boolean))]
const fileContext = affectedFiles.slice(0, 20).map(f => `@${f}`).join(' ')
```
### Step 2: Execute Strategy
```javascript
if (mode === 'inline') {
// 内联生成方案
for (const item of quickWins) {
item.remediation_steps = [
`Read ${item.file}`,
`Apply fix: ${item.suggestion || 'Resolve ' + item.description}`,
`Verify fix with relevant tests`
]
}
for (const item of strategic) {
item.remediation_steps = [
`Analyze impact scope of ${item.file}`,
`Plan refactoring: ${item.suggestion || 'Address ' + item.description}`,
`Implement changes incrementally`,
`Run full test suite to verify`
]
}
} else {
// CLI 辅助生成修复方案
const prompt = `PURPOSE: Create detailed remediation steps for each technical debt item, grouped into actionable phases
TASK: • For each quick-win item, generate specific fix steps (1-3 steps) • For each strategic item, generate a refactoring plan (3-5 steps) • Identify prevention mechanisms based on recurring patterns • Group related items that should be fixed together
MODE: analysis
CONTEXT: ${fileContext}
EXPECTED: Structured remediation plan with: phase name, items, steps per item, dependencies between fixes, estimated time per phase
CONSTRAINTS: Focus on backward-compatible changes, prefer incremental fixes over big-bang refactoring
## Debt Items to Plan
${debtSummary}
## Recurring Patterns
${[...new Set(debtInventory.map(i => i.dimension))].map(d => {
const count = debtInventory.filter(i => i.dimension === d).length
return `- ${d}: ${count} items`
}).join('\n')}`
Bash(`ccw cli -p "${prompt}" --tool gemini --mode analysis --rule planning-breakdown-task-steps`, {
run_in_background: true
})
// 等待 CLI 完成,解析结果
}
```
### Step 3: Result Processing
```javascript
// 生成 Markdown 治理方案
function generatePlanMarkdown(plan, validation) {
return `# Tech Debt Remediation Plan
## Overview
- **Total Actions**: ${validation.total_actions}
- **Files Affected**: ${validation.files_affected.length}
- **Total Estimated Effort**: ${validation.total_effort} points
## Phase 1: Quick Wins (Immediate)
> High impact, low cost items for immediate action.
${plan.phases[0].actions.map((a, i) => `### ${i + 1}. ${a.debt_id}: ${a.action}
- **File**: ${a.file || 'N/A'}
- **Type**: ${a.type}
${a.steps ? a.steps.map(s => `- [ ] ${s}`).join('\n') : ''}`).join('\n\n')}
## Phase 2: Systematic (Medium-term)
> High impact items requiring structured refactoring.
${plan.phases[1].actions.map((a, i) => `### ${i + 1}. ${a.debt_id}: ${a.action}
- **File**: ${a.file || 'N/A'}
- **Type**: ${a.type}
${a.steps ? a.steps.map(s => `- [ ] ${s}`).join('\n') : ''}`).join('\n\n')}
## Phase 3: Prevention (Long-term)
> Mechanisms to prevent future debt accumulation.
${plan.phases[2].actions.map((a, i) => `### ${i + 1}. ${a.action}
- **Dimension**: ${a.dimension || 'general'}
- **Type**: ${a.type}`).join('\n\n')}
## Execution Notes
- Execute Phase 1 first for maximum ROI
- Phase 2 items may require feature branches
- Phase 3 should be integrated into CI/CD pipeline
`
}
```
## Output Format
```
## Remediation Plan Created
### Phases: 3
### Quick Wins: [count] actions
### Systematic: [count] actions
### Prevention: [count] actions
### Files Affected: [count]
### Output: [sessionFolder]/plan/remediation-plan.md
```
## Error Handling
| Scenario | Resolution |
|----------|------------|
| CLI returns unstructured text | Parse manually, extract action items |
| No quick-wins available | Focus plan on systematic and prevention |
| File references invalid | Verify with Glob, skip non-existent files |
| CLI timeout | Generate plan from heuristic data only |
| Agent/CLI failure | Retry once, then inline generation |
| Timeout (>5 min) | Report partial plan, notify planner |

View File

@@ -1,188 +0,0 @@
# Planner Role
技术债务治理方案规划师。基于评估矩阵创建分阶段治理方案quick-wins 立即执行、systematic 中期系统治理、prevention 长期预防机制。产出 remediation-plan.md。
## Identity
- **Name**: `planner` | **Tag**: `[planner]`
- **Task Prefix**: `TDPLAN-*`
- **Responsibility**: Orchestration (治理规划)
## Boundaries
### MUST
- Only process `TDPLAN-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[planner]` identifier
- Only communicate with coordinator via SendMessage
- Work strictly within remediation planning responsibility scope
- Base plans on assessment data from shared memory
### MUST NOT
- Modify source code or test code
- Execute fix operations
- Create tasks for other roles
- Communicate directly with other worker roles (must go through coordinator)
- Omit `[planner]` identifier in any output
---
## Toolbox
### Available Commands
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `create-plan` | [commands/create-plan.md](commands/create-plan.md) | Phase 3 | 分阶段治理方案生成 |
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `cli-explore-agent` | Subagent | create-plan.md | 代码库探索验证方案可行性 |
| `gemini` | CLI | create-plan.md | 治理方案生成 |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `plan_ready` | planner -> coordinator | 方案完成 | 包含分阶段治理方案 |
| `plan_revision` | planner -> coordinator | 方案修订 | 根据反馈调整方案 |
| `error` | planner -> coordinator | 规划失败 | 阻塞性错误 |
## Message Bus
Before every SendMessage, log via `mcp__ccw-tools__team_msg`:
```
mcp__ccw-tools__team_msg({
operation: "log",
session_id: <session-id>,
from: "planner",
type: <message-type>,
ref: <artifact-path>
})
```
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from planner --type <message-type> --ref <artifact-path> --json")
```
---
## Execution (5-Phase)
### Phase 1: Task Discovery
> See SKILL.md Shared Infrastructure -> Worker Phase 1: Task Discovery
Standard task discovery flow: TaskList -> filter by prefix `TDPLAN-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
### Phase 2: Load Assessment Data
| Input | Source | Required |
|-------|--------|----------|
| Session folder | task.description (regex: `session:\s*(.+)`) | Yes |
| Shared memory | `<session-folder>/.msg/meta.json` | Yes |
| Priority matrix | `<session-folder>/assessment/priority-matrix.json` | Yes |
**Loading steps**:
1. Extract session path from task description
2. Read .msg/meta.json for debt_inventory
3. Read priority-matrix.json for quadrant groupings
4. Group items by priority quadrant:
| Quadrant | Filter |
|----------|--------|
| quickWins | priority_quadrant === 'quick-win' |
| strategic | priority_quadrant === 'strategic' |
| backlog | priority_quadrant === 'backlog' |
| deferred | priority_quadrant === 'defer' |
### Phase 3: Create Remediation Plan
Delegate to `commands/create-plan.md` if available, otherwise execute inline.
**Core Strategy**: 3-phase remediation plan
| Phase | Name | Description | Items |
|-------|------|-------------|-------|
| 1 | Quick Wins | 高影响低成本项,立即执行 | quickWins |
| 2 | Systematic | 高影响高成本项,需系统规划 | strategic |
| 3 | Prevention | 预防机制建设,长期生效 | Generated from inventory |
**Action Type Mapping**:
| Dimension | Action Type |
|-----------|-------------|
| code | refactor |
| architecture | restructure |
| testing | add-tests |
| dependency | update-deps |
| documentation | add-docs |
**Prevention Action Generation**:
| Condition | Action |
|-----------|--------|
| dimension count >= 3 | Generate prevention action for that dimension |
| Dimension | Prevention Action |
|-----------|-------------------|
| code | Add linting rules for complexity thresholds and code smell detection |
| architecture | Introduce module boundary checks in CI pipeline |
| testing | Set minimum coverage thresholds in CI and add pre-commit test hooks |
| dependency | Configure automated dependency update bot (Renovate/Dependabot) |
| documentation | Add JSDoc/docstring enforcement in linting rules |
### Phase 4: Validate Plan Feasibility
**Validation metrics**:
| Metric | Description |
|--------|-------------|
| total_actions | Sum of actions across all phases |
| total_effort | Sum of estimated effort scores |
| files_affected | Unique files in action list |
| has_quick_wins | Boolean: quickWins.length > 0 |
| has_prevention | Boolean: prevention actions exist |
**Save outputs**:
1. Write `<session-folder>/plan/remediation-plan.md` (markdown format)
2. Write `<session-folder>/plan/remediation-plan.json` (machine-readable)
3. Update .msg/meta.json with `remediation_plan` summary
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with `[planner]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Report content**:
| Field | Value |
|-------|-------|
| Task | task.subject |
| Total Actions | Count of all actions |
| Files Affected | Count of unique files |
| Phase 1: Quick Wins | Top 5 quick-win items |
| Phase 2: Systematic | Top 3 strategic items |
| Phase 3: Prevention | Top 3 prevention actions |
| Plan Document | Path to remediation-plan.md |
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No TDPLAN-* tasks available | Idle, wait for coordinator |
| Assessment data empty | Create minimal plan based on debt inventory |
| No quick-wins found | Skip Phase 1, focus on systematic |
| CLI analysis fails | Fall back to heuristic plan generation |
| Too many items for single plan | Split into multiple phases with priorities |