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,210 +0,0 @@
# Command: analyze
> CLI 多视角深度分析。基于探索结果,通过 CLI 工具执行深度分析并生成结构化洞察。
## When to Use
- Phase 3 of Analyst
- 探索结果已就绪,需要深度分析
- 每个 ANALYZE-* 任务触发一次
**Trigger conditions**:
- Analyst Phase 2 完成后(上下文已加载)
- 方向调整时创建的 ANALYZE-fix 任务
## Strategy
### Delegation Mode
**Mode**: CLI通过 ccw cli 执行分析Bash run_in_background: true
### Decision Logic
```javascript
// 根据 perspective 选择 CLI 工具和分析模板
function buildAnalysisConfig(perspective, isDirectionFix) {
const configs = {
'technical': {
tool: 'gemini',
rule: 'analysis-analyze-code-patterns',
focus: 'Implementation patterns, code quality, technical debt, feasibility',
tasks: [
'Analyze code structure and organization patterns',
'Identify technical debt and anti-patterns',
'Evaluate error handling and edge cases',
'Assess testing coverage and quality'
]
},
'architectural': {
tool: 'claude',
rule: 'analysis-review-architecture',
focus: 'System design, scalability, component coupling, boundaries',
tasks: [
'Evaluate module boundaries and coupling',
'Analyze data flow and component interactions',
'Assess scalability and extensibility',
'Review design pattern usage and consistency'
]
},
'business': {
tool: 'codex',
rule: 'analysis-analyze-code-patterns',
focus: 'Business logic, domain models, value delivery, stakeholder impact',
tasks: [
'Map business logic to code implementation',
'Identify domain model completeness',
'Evaluate business rule enforcement',
'Assess impact on stakeholders and users'
]
},
'domain_expert': {
tool: 'gemini',
rule: 'analysis-analyze-code-patterns',
focus: 'Domain-specific patterns, standards compliance, best practices',
tasks: [
'Compare against domain best practices',
'Check standards and convention compliance',
'Identify domain-specific anti-patterns',
'Evaluate domain model accuracy'
]
}
}
const config = configs[perspective] || configs['technical']
if (isDirectionFix) {
config.rule = 'analysis-diagnose-bug-root-cause'
config.tasks = [
'Re-analyze from adjusted perspective',
'Identify previously missed patterns',
'Generate new insights from fresh angle',
'Update discussion points based on direction change'
]
}
return config
}
```
## Execution Steps
### Step 1: Context Preparation
```javascript
const config = buildAnalysisConfig(perspective, isDirectionFix)
// 构建探索上下文摘要
const explorationSummary = `
PRIOR EXPLORATION CONTEXT:
- Key files: ${(explorationContext.relevant_files || []).slice(0, 8).map(f => f.path || f).join(', ')}
- Patterns found: ${(explorationContext.patterns || []).slice(0, 5).join('; ')}
- Key findings: ${(explorationContext.key_findings || []).slice(0, 5).join('; ')}
- Questions from exploration: ${(explorationContext.questions_for_analysis || []).slice(0, 3).join('; ')}`
```
### Step 2: Execute CLI Analysis
```javascript
const cliPrompt = `PURPOSE: ${isDirectionFix
? `Supplementary analysis with adjusted focus on "${adjustedFocus}" for topic "${topic}"`
: `Deep analysis of "${topic}" from ${perspective} perspective`}
Success: ${isDirectionFix
? 'New insights from adjusted direction with clear evidence'
: 'Actionable insights with confidence levels and evidence references'}
${explorationSummary}
TASK:
${config.tasks.map(t => `${t}`).join('\n')}
• Generate structured findings with confidence levels (high/medium/low)
• Identify discussion points requiring user input
• List open questions needing further exploration
MODE: analysis
CONTEXT: @**/* | Topic: ${topic}
EXPECTED: JSON-structured analysis with sections: key_insights (with confidence), key_findings (with evidence), discussion_points, open_questions, recommendations (with priority)
CONSTRAINTS: Focus on ${perspective} perspective | ${dimensions.join(', ')} dimensions${isDirectionFix ? ` | Adjusted focus: ${adjustedFocus}` : ''}`
Bash({
command: `ccw cli -p "${cliPrompt}" --tool ${config.tool} --mode analysis --rule ${config.rule}`,
run_in_background: true
})
// ⚠️ STOP POINT: Wait for CLI callback before continuing
```
### Step 3: Result Processing
```javascript
// CLI 结果返回后,解析并结构化
const outputPath = `${sessionFolder}/analyses/analysis-${analyzeNum}.json`
// 从 CLI 输出中提取结构化数据
// CLI 输出通常是 markdown需要解析为 JSON
const analysisResult = {
perspective,
dimensions,
is_direction_fix: isDirectionFix,
adjusted_focus: adjustedFocus || null,
key_insights: [
// 从 CLI 输出提取,每个包含 {insight, confidence, evidence}
],
key_findings: [
// 具体发现 {finding, file_ref, impact}
],
discussion_points: [
// 需要用户输入的讨论要点
],
open_questions: [
// 未解决的问题
],
recommendations: [
// {action, rationale, priority}
],
_metadata: {
cli_tool: config.tool,
cli_rule: config.rule,
perspective,
is_direction_fix: isDirectionFix,
timestamp: new Date().toISOString()
}
}
Write(outputPath, JSON.stringify(analysisResult, null, 2))
```
## Output Format
```json
{
"perspective": "technical",
"dimensions": ["architecture", "implementation"],
"is_direction_fix": false,
"key_insights": [
{"insight": "Authentication uses stateless JWT", "confidence": "high", "evidence": "src/auth/jwt.ts:L42"}
],
"key_findings": [
{"finding": "No rate limiting on login endpoint", "file_ref": "src/routes/auth.ts:L15", "impact": "Security risk"}
],
"discussion_points": [
"Should we implement token rotation for refresh tokens?"
],
"open_questions": [
"What is the expected concurrent user load?"
],
"recommendations": [
{"action": "Add rate limiting to auth endpoints", "rationale": "Prevent brute force attacks", "priority": "high"}
],
"_metadata": {"cli_tool": "gemini", "cli_rule": "analysis-analyze-code-patterns", "timestamp": "..."}
}
```
## Error Handling
| Scenario | Resolution |
|----------|------------|
| CLI tool unavailable | Try fallback: gemini → codex → claude |
| CLI timeout | Retry with shorter prompt, or use exploration results directly |
| CLI returns empty | Use exploration findings as-is, note analysis gap |
| Invalid CLI output | Extract what's parseable, fill gaps with defaults |
| Exploration context missing | Analyze with topic keywords only |

View File

@@ -1,251 +0,0 @@
# Analyst Role
深度分析师。基于 explorer 的代码库探索结果,通过 CLI 多视角深度分析,生成结构化洞察和讨论要点。
## Identity
- **Name**: `analyst` | **Tag**: `[analyst]`
- **Task Prefix**: `ANALYZE-*`
- **Responsibility**: Read-only analysis (深度分析)
## Boundaries
### MUST
- Only process `ANALYZE-*` prefixed tasks
- All output (SendMessage, team_msg, logs) must carry `[analyst]` identifier
- Only communicate with coordinator via SendMessage
- Work strictly within deep analysis responsibility scope
- Base analysis on explorer exploration results
- Share analysis results via team_msg(type='state_update')
### MUST NOT
- Execute codebase exploration (belongs to explorer)
- Handle user feedback (belongs to discussant)
- Generate final conclusions (belongs to synthesizer)
- Create tasks for other roles (TaskCreate is coordinator-exclusive)
- Communicate directly with other worker roles
- Modify source code
- Omit `[analyst]` identifier in any output
---
## Toolbox
### Available Commands
| Command | File | Phase | Description |
|---------|------|-------|-------------|
| `analyze` | [commands/analyze.md](commands/analyze.md) | Phase 3 | CLI 多视角深度分析 |
### Tool Capabilities
| Tool | Type | Used By | Purpose |
|------|------|---------|---------|
| `Bash` | CLI | analyze.md | Execute ccw cli for analysis |
| `Read` | File | analyst | Read exploration results and session context |
| `Write` | File | analyst | Write analysis results |
| `Glob` | File | analyst | Find exploration/analysis files |
### CLI Tools
| CLI Tool | Mode | Used By | Purpose |
|----------|------|---------|---------|
| `gemini` | analysis | analyze.md | 技术/领域分析 |
| `codex` | analysis | analyze.md | 业务视角分析 |
| `claude` | analysis | analyze.md | 架构视角分析 |
---
## Message Types
| Type | Direction | Trigger | Description |
|------|-----------|---------|-------------|
| `analysis_ready` | analyst → coordinator | 分析完成 | 包含洞察、讨论要点、开放问题 |
| `error` | analyst → 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: "analyst",
type: "analysis_ready",
ref: "<output-path>"
})
```
> `to` and `summary` are auto-defaulted by the tool.
**CLI fallback** (when MCP unavailable):
```
Bash("ccw team log --session-id <session-id> --from analyst --type analysis_ready --ref <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 `ANALYZE-*` + owner match + pending + unblocked -> TaskGet -> TaskUpdate in_progress.
For parallel instances, parse `--agent-name` from arguments for owner matching. Falls back to `analyst` for single-instance roles.
### Phase 2: Context Loading
**Loading steps**:
1. Extract session path from task description
2. Extract topic, perspective, dimensions from task metadata
3. Check for direction-fix type (补充分析)
4. Read role states via team_msg(operation="get_state") for existing context
5. Read corresponding exploration results
**Context extraction**:
| Field | Source | Pattern |
|-------|--------|---------|
| sessionFolder | task description | `session:\s*(.+)` |
| topic | task description | `topic:\s*(.+)` |
| perspective | task description | `perspective:\s*(.+)` or default "technical" |
| dimensions | task description | `dimensions:\s*(.+)` or default "general" |
| isDirectionFix | task description | `type:\s*direction-fix` |
| adjustedFocus | task description | `adjusted_focus:\s*(.+)` |
**Exploration context loading**:
| Condition | Source |
|-----------|--------|
| Direction fix | Read ALL exploration files, merge context |
| Normal analysis | Read exploration file matching ANALYZE-N number |
| Fallback | Read first available exploration file |
**CLI tool selection**:
| Perspective | CLI Tool |
|-------------|----------|
| technical | gemini |
| architectural | claude |
| business | codex |
| domain_expert | gemini |
### Phase 3: Deep Analysis via CLI
Delegate to `commands/analyze.md` if available, otherwise execute inline.
**Analysis prompt structure** (Direction Fix):
```
PURPOSE: 补充分析 - 方向调整至 "<adjusted_focus>"
Success: 针对新方向的深入洞察
PRIOR EXPLORATION CONTEXT:
- Key files: <top 5 files from exploration>
- Patterns: <top 3 patterns>
- Previous findings: <top 3 findings>
TASK:
- Focus analysis on: <adjusted_focus>
- Build on previous exploration findings
- Identify new insights from adjusted perspective
- Generate discussion points for user
MODE: analysis
CONTEXT: @**/* | Topic: <topic>
EXPECTED: Structured analysis with adjusted focus, new insights, updated discussion points
CONSTRAINTS: Focus on <adjusted_focus>
```
**Analysis prompt structure** (Normal):
```
PURPOSE: Analyze topic '<topic>' from <perspective> perspective across <dimensions> dimensions
Success: Actionable insights with clear reasoning and evidence
PRIOR EXPLORATION CONTEXT:
- Key files: <top 5 files from exploration>
- Patterns found: <top 3 patterns>
- Key findings: <top 3 findings>
TASK:
- Build on exploration findings above
- Analyze from <perspective> perspective: <dimensions>
- Identify patterns, anti-patterns, and opportunities
- Generate discussion points for user clarification
- Assess confidence level for each insight
MODE: analysis
CONTEXT: @**/* | Topic: <topic>
EXPECTED: Structured analysis with: key insights (with confidence), discussion points, open questions, recommendations with rationale
CONSTRAINTS: Focus on <dimensions> | <perspective> perspective
```
**CLI execution**:
```
Bash({
command: "ccw cli -p \"<analysis-prompt>\" --tool <cli-tool> --mode analysis",
run_in_background: true
})
// STOP POINT: Wait for CLI callback
```
### Phase 4: Result Aggregation
**Analysis output structure**:
| Field | Description |
|-------|-------------|
| perspective | Analysis perspective |
| dimensions | Analysis dimensions |
| is_direction_fix | Boolean for direction fix mode |
| adjusted_focus | Focus area if direction fix |
| key_insights | Main insights with confidence levels |
| key_findings | Specific findings |
| discussion_points | Points for user discussion |
| open_questions | Unresolved questions |
| recommendations | Actionable recommendations |
| evidence | Supporting evidence references |
**Output path**: `<session-folder>/analyses/analysis-<num>.json`
### Phase 5: Report to Coordinator
> See SKILL.md Shared Infrastructure -> Worker Phase 5: Report
Standard report flow: team_msg log -> SendMessage with `[analyst]` prefix -> TaskUpdate completed -> Loop to Phase 1 for next task.
**Shared memory update**:
```
sharedMemory.analyses.push({
id: "analysis-<num>",
perspective: <perspective>,
is_direction_fix: <boolean>,
insight_count: <count>,
finding_count: <count>,
timestamp: <timestamp>
})
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| No ANALYZE-* tasks available | Idle, wait for coordinator assignment |
| CLI tool unavailable | Fallback chain: gemini -> codex -> claude |
| No exploration results found | Analyze with topic keywords only, note limitation |
| CLI timeout | Use partial results, report incomplete |
| Invalid exploration JSON | Skip context, analyze from scratch |
| Command file not found | Fall back to inline execution |