diff --git a/.claude/commands/ccw-coordinator.md b/.claude/commands/ccw-coordinator.md index e26d651c..38632a4b 100644 --- a/.claude/commands/ccw-coordinator.md +++ b/.claude/commands/ccw-coordinator.md @@ -25,8 +25,20 @@ Interactive orchestration tool: analyze task → discover commands → recommend | `workflow-tdd` | tdd-plan, tdd-verify | | `review-cycle` | review-session-cycle, review-module-cycle, review-cycle-fix | | `brainstorm` | auto-parallel, artifacts, role-analysis, synthesis | +| `workflow:collaborative-plan-with-file` | understanding agent → parallel agents → plan-note.md | +| `workflow:req-plan-with-file` | requirement decomposition → issue creation → execution-plan.json | +| `workflow:integration-test-cycle` | explore → test dev → test-fix cycle → reflection | +| `workflow:refactor-cycle` | tech debt discovery → prioritize → execute → validate | +| `team-planex` | planner + executor wave pipeline(边规划边执行)| +| `team-iterdev` | 迭代开发团队(planner → developer → reviewer 循环)| +| `team-lifecycle` | 全生命周期团队(spec → impl → test)| +| `team-issue` | issue 解决团队(discover → plan → execute)| +| `team-testing` | 测试团队(strategy → generate → execute → analyze)| +| `team-quality-assurance` | QA 团队(scout → strategist → generator → executor → analyst)| +| `team-brainstorm` | 团队头脑风暴(facilitator → participants → synthesizer)| +| `team-uidesign` | UI 设计团队(designer → implementer dual-track)| -独立命令:workflow:brainstorm-with-file, workflow:debug-with-file, workflow:analyze-with-file, issue:* +独立命令(仍使用 colon 格式):workflow:brainstorm-with-file, workflow:debug-with-file, workflow:analyze-with-file, workflow:collaborative-plan-with-file, workflow:req-plan-with-file, workflow:integration-test-cycle, workflow:refactor-cycle, workflow:unified-execute-with-file, workflow:clean, workflow:init, workflow:init-guidelines, workflow:ui-design:*, issue:*, workflow:session:* ## Core Concept: Minimum Execution Units (最小执行单元) @@ -82,6 +94,28 @@ Interactive orchestration tool: analyze task → discover commands → recommend | **Brainstorm With File** | brainstorm-with-file | Multi-perspective ideation with documentation | brainstorm.md | | **Debug With File** | debug-with-file | Hypothesis-driven debugging with documentation | understanding.md | | **Analyze With File** | analyze-with-file | Collaborative analysis with documentation | discussion.md | +| **Collaborative Plan** | collaborative-plan-with-file → unified-execute-with-file | Multi-agent collaborative planning and execution | plan-note.md + code | +| **Requirement Plan** | req-plan-with-file → team-planex | Requirement decomposition and wave execution | execution-plan.json + code | + +**Cycle Units** (循环单元): + +| Unit Name | Commands | Purpose | Output | +|-----------|----------|---------|--------| +| **Integration Test Cycle** | integration-test-cycle | Self-iterating integration test with reflection | Tests passed | +| **Refactor Cycle** | refactor-cycle | Tech debt discovery and refactoring | Refactored code | + +**Team Units** (团队单元): + +| Unit Name | Commands | Purpose | Output | +|-----------|----------|---------|--------| +| **Team Plan+Execute** | team-planex | Wave pipeline (planner + executor) | Working code | +| **Team Iterative Dev** | team-iterdev | Iterative development (planner → developer → reviewer) | Working code | +| **Team Lifecycle** | team-lifecycle | Full lifecycle (spec → impl → test) | Working code | +| **Team Issue** | team-issue | Multi-role issue resolution | Resolved issues | +| **Team Testing** | team-testing | Comprehensive test pipeline | Tests passed | +| **Team QA** | team-quality-assurance | Quality assurance pipeline | QA report | +| **Team Brainstorm** | team-brainstorm | Multi-role brainstorming | Analysis | +| **Team UI Design** | team-uidesign | Dual-track design + implementation | UI code | ### Command-to-Unit Mapping (命令与最小单元的映射) @@ -103,6 +137,19 @@ Interactive orchestration tool: analyze task → discover commands → recommend | issue:queue | issue:execute | Issue Workflow, Rapid-to-Issue, Brainstorm-to-Issue | | issue:from-brainstorm | issue:queue | Brainstorm-to-Issue | | brainstorm-with-file | issue:from-brainstorm (optional) | Brainstorm With File, Brainstorm-to-Issue | +| collaborative-plan-with-file | unified-execute-with-file | Collaborative Plan | +| req-plan-with-file | team-planex | Requirement Plan | +| unified-execute-with-file | (terminal) | Collaborative Plan | +| integration-test-cycle | (standalone) | Integration Test Cycle | +| refactor-cycle | (standalone) | Refactor Cycle | +| team-planex | (standalone) | Team Plan+Execute | +| team-iterdev | (standalone) | Team Iterative Dev | +| team-lifecycle | (standalone) | Team Lifecycle | +| team-issue | (standalone) | Team Issue | +| team-testing | (standalone) | Team Testing | +| team-quality-assurance | (standalone) | Team QA | +| team-brainstorm | (standalone) | Team Brainstorm | +| team-uidesign | (standalone) | Team UI Design | | debug-with-file | (standalone) | Debug With File | | analyze-with-file | (standalone) | Analyze With File | @@ -153,8 +200,23 @@ function detectTaskType(text) { if (/brainstorm.*issue|头脑风暴.*issue|idea.*issue|想法.*issue|从.*头脑风暴|convert.*brainstorm/.test(text)) return 'brainstorm-to-issue'; if (/debug.*document|hypothesis.*debug|深度调试|假设.*验证|systematic debug/.test(text)) return 'debug-file'; if (/analyze.*document|collaborative analysis|协作分析|深度.*理解/.test(text)) return 'analyze-file'; + if (/collaborative.*plan|协作.*规划|多人.*规划|multi.*agent.*plan|Plan Note|分工.*规划/.test(text)) return 'collaborative-plan'; + if (/roadmap|需求.*规划|需求.*拆解|requirement.*plan|req.*plan|progressive.*plan|路线.*图/.test(text)) return 'req-plan'; + // Cycle workflow patterns + if (/integration.*test|集成测试|端到端.*测试|e2e.*test|integration.*cycle/.test(text)) return 'integration-test'; + if (/refactor|重构|tech.*debt|技术债务/.test(text)) return 'refactor'; + // Team workflow patterns (explicit "team" keyword required) + if (/team.*plan.*exec|team.*planex|团队.*规划.*执行|并行.*规划.*执行|wave.*pipeline/.test(text)) return 'team-planex'; + if (/team.*iter|team.*iterdev|迭代.*开发.*团队|iterative.*dev.*team/.test(text)) return 'team-iterdev'; + if (/team.*lifecycle|全生命周期|full.*lifecycle|spec.*impl.*test.*team/.test(text)) return 'team-lifecycle'; + if (/team.*issue.*resolv|团队.*issue|team.*resolve.*issue/.test(text)) return 'team-issue'; + if (/team.*test|测试团队|comprehensive.*test.*team|全面.*测试.*团队/.test(text)) return 'team-testing'; + if (/team.*qa|quality.*assurance.*team|QA.*团队|质量.*保障.*团队|团队.*质量/.test(text)) return 'team-qa'; + if (/team.*brainstorm|团队.*头脑风暴|team.*ideation|多人.*头脑风暴/.test(text)) return 'team-brainstorm'; + if (/team.*ui.*design|UI.*设计.*团队|dual.*track.*design|团队.*UI/.test(text)) return 'team-uidesign'; + // Standard workflows + if (/multi.*cli|多.*CLI|多模型.*协作|multi.*model.*collab/.test(text)) return 'multi-cli'; if (/不确定|explore|研究|what if|brainstorm|权衡/.test(text)) return 'brainstorm'; - if (/多视角|比较方案|cross-verify|multi-cli/.test(text)) return 'multi-cli'; return 'feature'; // Default } @@ -414,6 +476,105 @@ const commandPorts = { output: ['discussion-document'], // 输出端口:discussion.md + 结论 tags: ['analysis', 'with-file'], note: 'Self-contained workflow with multi-round discussion' + }, + + // Collaborative planning workflows + 'collaborative-plan-with-file': { + name: 'collaborative-plan-with-file', + input: ['requirement'], // 输入端口:需求 + output: ['plan-note'], // 输出端口:plan-note.md + tags: ['planning', 'with-file'], + atomic_group: 'collaborative-plan', // 最小单元:collaborative-plan → unified-execute + note: 'Multi-agent collaborative planning with Plan Note shared doc' + }, + 'unified-execute-with-file': { + name: 'unified-execute-with-file', + input: ['plan-note', 'brainstorm-document', 'discussion-document'], // 可接受多种规划输出 + output: ['code'], // 输出端口:代码 + tags: ['execution', 'with-file'], + atomic_group: 'collaborative-plan' // 最小单元:与 collaborative-plan-with-file 绑定 + }, + 'req-plan-with-file': { + name: 'req-plan-with-file', + input: ['requirement'], // 输入端口:需求 + output: ['execution-plan'], // 输出端口:execution-plan.json + issues + tags: ['planning', 'with-file'], + atomic_group: 'requirement-plan', // 最小单元:req-plan → team-planex + note: 'Requirement decomposition with issue creation' + }, + + // Cycle workflows (self-iterating with reflection) + 'integration-test-cycle': { + name: 'integration-test-cycle', + input: ['requirement'], // 输入端口:需求/模块 + output: ['test-passed'], // 输出端口:测试通过 + tags: ['testing', 'cycle'], + note: 'Self-contained: explore → test dev → test-fix cycle → reflection' + }, + 'refactor-cycle': { + name: 'refactor-cycle', + input: ['codebase'], // 输入端口:代码库 + output: ['refactored-code'], // 输出端口:重构后代码 + tags: ['refactoring', 'cycle'], + note: 'Self-contained: tech debt discovery → prioritize → execute → validate' + }, + + // Team workflows (multi-role collaboration, all self-contained) + 'team-planex': { + name: 'team-planex', + input: ['requirement'], + output: ['code'], + tags: ['team'], + note: 'Self-contained: planner + executor wave pipeline' + }, + 'team-iterdev': { + name: 'team-iterdev', + input: ['requirement'], + output: ['code'], + tags: ['team'], + note: 'Self-contained: planner → developer → reviewer iterative loop' + }, + 'team-lifecycle': { + name: 'team-lifecycle', + input: ['requirement'], + output: ['code'], + tags: ['team'], + note: 'Self-contained: spec → impl → test full lifecycle' + }, + 'team-issue': { + name: 'team-issue', + input: ['pending-issues'], + output: ['completed-issues'], + tags: ['team', 'issue'], + note: 'Self-contained: discover → plan → execute multi-role' + }, + 'team-testing': { + name: 'team-testing', + input: ['code'], + output: ['test-passed'], + tags: ['team', 'testing'], + note: 'Self-contained: strategy → generate → execute → analyze' + }, + 'team-quality-assurance': { + name: 'team-quality-assurance', + input: ['code'], + output: ['quality-report'], + tags: ['team', 'testing'], + note: 'Self-contained: scout → strategist → generator → executor → analyst' + }, + 'team-brainstorm': { + name: 'team-brainstorm', + input: ['exploration-topic'], + output: ['brainstorm-analysis'], + tags: ['team', 'brainstorm'], + note: 'Self-contained: facilitator → participants → synthesizer' + }, + 'team-uidesign': { + name: 'team-uidesign', + input: ['requirement'], + output: ['ui-code'], + tags: ['team', 'ui'], + note: 'Self-contained: designer → implementer dual-track' } }; ``` @@ -450,6 +611,20 @@ function determinePortFlow(taskType, constraints) { 'brainstorm-to-issue': { inputPort: 'brainstorm-document', outputPort: 'completed-issues' }, 'debug-file': { inputPort: 'bug-report', outputPort: 'understanding-document' }, 'analyze-file': { inputPort: 'analysis-topic', outputPort: 'discussion-document' }, + 'collaborative-plan': { inputPort: 'requirement', outputPort: 'code' }, + 'req-plan': { inputPort: 'requirement', outputPort: 'code' }, + // Cycle workflow types + 'integration-test': { inputPort: 'requirement', outputPort: 'test-passed' }, + 'refactor': { inputPort: 'codebase', outputPort: 'refactored-code' }, + // Team workflow types (all self-contained) + 'team-planex': { inputPort: 'requirement', outputPort: 'code' }, + 'team-iterdev': { inputPort: 'requirement', outputPort: 'code' }, + 'team-lifecycle': { inputPort: 'requirement', outputPort: 'code' }, + 'team-issue': { inputPort: 'pending-issues', outputPort: 'completed-issues' }, + 'team-testing': { inputPort: 'code', outputPort: 'test-passed' }, + 'team-qa': { inputPort: 'code', outputPort: 'quality-report' }, + 'team-brainstorm': { inputPort: 'exploration-topic', outputPort: 'brainstorm-analysis' }, + 'team-uidesign': { inputPort: 'requirement', outputPort: 'ui-code' }, 'feature': { inputPort: 'requirement', outputPort: constraints?.includes('skip-tests') ? 'code' : 'test-passed' } }; return flows[taskType] || flows['feature']; @@ -733,6 +908,28 @@ function formatCommand(cmd, previousResults, analysis) { // Find latest brainstorm session prompt = `/issue:from-brainstorm -y --auto`; } + + // Collaborative planning workflows + } else if (name === 'collaborative-plan-with-file') { + prompt = `/workflow:collaborative-plan-with-file -y "${analysis.goal}"`; + + } else if (name === 'unified-execute-with-file') { + prompt = `/workflow:unified-execute-with-file -y`; + + } else if (name === 'req-plan-with-file') { + prompt = `/workflow:req-plan-with-file -y "${analysis.goal}"`; + + // Cycle workflows (self-contained) + } else if (name === 'integration-test-cycle') { + prompt = `/workflow:integration-test-cycle -y "${analysis.goal}"`; + + } else if (name === 'refactor-cycle') { + prompt = `/workflow:refactor-cycle -y "${analysis.goal}"`; + + // Team workflows (all self-contained, use Skill name directly) + } else if (['team-planex', 'team-iterdev', 'team-lifecycle', 'team-issue', + 'team-testing', 'team-quality-assurance', 'team-brainstorm', 'team-uidesign'].includes(name)) { + prompt = `/${name} -y "${analysis.goal}"`; } return prompt; @@ -1088,14 +1285,25 @@ break; // ⚠️ STOP HERE - DO NOT use TaskOutput polling | `workflow-test-fix` | test-fix-gen, test-cycle-execute | | `workflow-tdd` | tdd-plan, tdd-verify | | `review-cycle` | review-session-cycle, review-module-cycle, review-cycle-fix | +| `brainstorm` | auto-parallel, artifacts, role-analysis, synthesis | +| `team-planex` | planner + executor wave pipeline | +| `team-iterdev` | planner → developer → reviewer 循环 | +| `team-lifecycle` | spec → impl → test 全流程 | +| `team-issue` | discover → plan → execute 多角色 | +| `team-testing` | strategy → generate → execute → analyze | +| `team-quality-assurance` | scout → strategist → generator → executor → analyst | +| `team-brainstorm` | facilitator → participants → synthesizer | +| `team-uidesign` | designer → implementer dual-track | ### Commands(命名空间 Skill) -**With-File Workflows**: workflow:brainstorm-with-file, workflow:debug-with-file, workflow:analyze-with-file +**With-File Workflows**: workflow:brainstorm-with-file, workflow:debug-with-file, workflow:analyze-with-file, workflow:collaborative-plan-with-file, workflow:req-plan-with-file +**Cycle Workflows**: workflow:integration-test-cycle, workflow:refactor-cycle +**Execution**: workflow:unified-execute-with-file **Design**: workflow:ui-design:* **Session Management**: workflow:session:start, workflow:session:resume, workflow:session:complete, workflow:session:solidify, workflow:session:list **Tools**: workflow:tools:context-gather, workflow:tools:test-context-gather, workflow:tools:task-generate-agent, workflow:tools:conflict-resolution -**Utility**: workflow:clean, workflow:init +**Utility**: workflow:clean, workflow:init, workflow:init-guidelines **Issue Workflow**: issue:discover, issue:plan, issue:queue, issue:execute, issue:convert-to-plan, issue:from-brainstorm, issue:new ### Testing Commands Distinction @@ -1131,5 +1339,18 @@ break; // ⚠️ STOP HERE - DO NOT use TaskOutput polling | **brainstorm-to-issue** | brainstorm.md →【from-brainstorm → queue → execute】→ 完成 issues | Brainstorm to Issue | | **debug-file** | Bug报告 → debug-with-file → understanding.md (自包含) | Debug With File | | **analyze-file** | 分析主题 → analyze-with-file → discussion.md (自包含) | Analyze With File | +| **collaborative-plan** | 需求 →【collaborative-plan-with-file → unified-execute-with-file】→ 代码 | Collaborative Plan | +| **req-plan** | 需求 →【req-plan-with-file → team-planex】→ 代码 | Requirement Plan | +| **multi-cli** | 需求 → multi-cli-plan → 对比分析 → lite-execute → test | Multi-CLI Planning | +| **integration-test** | 需求/模块 → integration-test-cycle → 测试通过 (自包含) | Integration Test Cycle | +| **refactor** | 代码库 → refactor-cycle → 重构后代码 (自包含) | Refactor Cycle | +| **team-planex** | 需求 → team-planex → 代码 (自包含) | Team Plan+Execute | +| **team-iterdev** | 需求 → team-iterdev → 代码 (自包含) | Team Iterative Dev | +| **team-lifecycle** | 需求 → team-lifecycle → 代码 (自包含) | Team Lifecycle | +| **team-issue** | issues → team-issue → 完成 issues (自包含) | Team Issue | +| **team-testing** | 代码 → team-testing → 测试通过 (自包含) | Team Testing | +| **team-qa** | 代码 → team-quality-assurance → 质量报告 (自包含) | Team QA | +| **team-brainstorm** | 主题 → team-brainstorm → 分析 (自包含) | Team Brainstorm | +| **team-uidesign** | 需求 → team-uidesign → UI代码 (自包含) | Team UI Design | Refer to the Skill 映射 section above for available Skills and Commands. diff --git a/.claude/commands/ccw-debug.md b/.claude/commands/ccw-debug.md deleted file mode 100644 index 4f80889a..00000000 --- a/.claude/commands/ccw-debug.md +++ /dev/null @@ -1,372 +0,0 @@ ---- -name: ccw-debug -description: Debug coordinator - analyze issue, select debug strategy, execute debug workflow in main process -argument-hint: "[--mode cli|debug|test|bidirectional] [--yes|-y] \"bug description\"" -allowed-tools: Skill(*), TodoWrite(*), AskUserQuestion(*), Read(*), Bash(*) ---- - -# CCW-Debug Command - Debug Coordinator - -Debug orchestrator: issue analysis → strategy selection → debug execution. - -## Skill 映射 - -| Skill | 包含操作 | -|-------|---------| -| `workflow-test-fix` | test-fix-gen, test-cycle-execute | - -独立命令:workflow:debug-with-file - -## Core Concept: Debug Units (调试单元) - -**Definition**: Debug commands grouped into logical units for different root cause strategies. - -**Debug Units**: - -| Unit Type | Pattern | Example | -|-----------|---------|---------| -| **Quick Diagnosis** | CLI analysis only | cli → recommendation | -| **Hypothesis-Driven** | Debug exploration | debug-with-file → apply fix | -| **Test-Driven** | Test generation/iteration | test-fix-gen → test-cycle-execute | -| **Convergence** | Parallel debug + test | debug + test (parallel) | - -**Atomic Rules**: -1. CLI mode: Analysis only, recommendation for user action -2. Debug/Test modes: Full cycle (analysis → fix → validate) -3. Bidirectional mode: Parallel execution, merge findings - -## Execution Model - -**Synchronous (Main Process)**: Debug commands execute via Skill, blocking until complete. - -``` -User Input → Analyze Issue → Select Strategy → [Confirm] → Execute Debug - ↓ - Skill (blocking) - ↓ - Update TodoWrite - ↓ - Generate Fix/Report -``` - -## 5-Phase Workflow - -### Phase 1: Analyze Issue - -**Input** → Extract (description, symptoms) → Assess (error_type, clarity, complexity, scope) → **Analysis** - -| Field | Values | -|-------|--------| -| error_type | syntax \| logic \| async \| integration \| unknown | -| clarity | 0-3 (≥2 = clear) | -| complexity | low \| medium \| high | -| scope | single-module \| cross-module \| system | - -#### Mode Detection (Priority Order) - -``` -Input Keywords → Mode -───────────────────────────────────────────────────────── -quick|fast|immediate|recommendation|suggest → cli -test|fail|coverage|pass → test -multiple|system|distributed|concurrent → bidirectional -(default) → debug -``` - -**Output**: `IssueType: [type] | Clarity: [clarity]/3 | Complexity: [complexity] | RecommendedMode: [mode]` - ---- - -### Phase 1.5: Issue Clarification (if clarity < 2) - -``` -Analysis → Check clarity ≥ 2? - ↓ - YES → Continue to Phase 2 - ↓ - NO → Ask Questions → Update Analysis -``` - -**Questions Asked**: Error Symptoms, When It Occurs, Affected Components, Reproducibility - ---- - -### Phase 2: Select Debug Strategy & Build Command Chain - -``` -Analysis → Detect Mode (keywords) → Build Command Chain → Debug Workflow -``` - -#### Command Chain Mapping - -| Mode | Command Chain | Execution | -|------|---------------|-----------| -| **cli** | ccw cli --mode analysis --rule analysis-diagnose-bug-root-cause | Analysis only | -| **debug** | debug-with-file → test-fix-gen → test-cycle-execute | Sequential | -| **test** | test-fix-gen → test-cycle-execute | Sequential | -| **bidirectional** | (debug-with-file ∥ test-fix-gen ∥ test-cycle-execute) → merge-findings | Parallel → Merge | - -**Note**: `∥` = parallel execution - -**Output**: `Mode: [mode] | Strategy: [strategy] | Commands: [1. /cmd1 2. /cmd2]` - ---- - -### Phase 3: User Confirmation - -``` -Debug Chain → Show Strategy → Ask User → User Decision: -- ✓ Confirm → Continue to Phase 4 -- ⚙ Change Mode → Select Different Mode (back to Phase 2) -- ✗ Cancel → Abort -``` - ---- - -### Phase 4: Setup TODO Tracking & Status File - -``` -Debug Chain → Create Session Dir → Initialize Tracking → Tracking State -``` - -**Session Structure**: -``` -Session ID: CCWD-{issue-slug}-{date} -Session Dir: .workflow/.ccw-debug/{session_id}/ - -TodoWrite: - CCWD:{mode}: [1/n] /command1 [in_progress] - CCWD:{mode}: [2/n] /command2 [pending] - ... - -status.json: - { - "session_id": "CCWD-...", - "mode": "debug|cli|test|bidirectional", - "status": "running", - "parallel_execution": false|true, - "issue": { description, error_type, clarity, complexity }, - "command_chain": [...], - "findings": { debug, test, merged } - } -``` - -**Output**: -- TODO: `-> CCWD:debug: [1/3] /workflow:debug-with-file | ...` -- Status File: `.workflow/.ccw-debug/{session_id}/status.json` - ---- - -### Phase 5: Execute Debug Chain - -#### For Bidirectional Mode (Parallel Execution) - -``` -Start Commands (parallel) → Execute debug-with-file ∥ test-fix-gen ∥ test-cycle-execute - ↓ - Collect Results → Merge Findings - ↓ - Update status.json (findings.merged) - ↓ - Mark completed -``` - -#### For Sequential Modes (cli, debug, test) - -``` -Start Command → Update status (running) → Execute via Skill → Result - ↓ - CLI Mode? → YES → Ask Escalation → Escalate or Done - → NO → Continue - ↓ - Update status (completed) → Next Command - ↓ - Error? → YES → Ask Action (Retry/Skip/Abort) - → NO → Continue -``` - -#### Error Handling Pattern - -``` -Command Error → Update status (failed) → Ask User: - - Retry → Re-execute (same index) - - Skip → Continue next command - - Abort → Stop execution -``` - -#### CLI Mode Escalation - -``` -CLI Result → Findings.confidence? - ↓ - High → Present findings → User decides: - • Done (end here) - • Escalate to debug mode - • Escalate to test mode - ↓ - Low → Recommend escalation -``` - ---- - -## Execution Flow Summary - -``` -User Input - | -Phase 1: Analyze Issue - |-- Extract: description, error_type, clarity, complexity, scope - +-- If clarity < 2 -> Phase 1.5: Clarify Issue - | -Phase 2: Select Debug Strategy & Build Chain - |-- Detect mode: cli | debug | test | bidirectional - |-- Build command chain based on mode - |-- Parallel execution for bidirectional - +-- Consider escalation points (cli → debug/test) - | -Phase 3: User Confirmation (optional) - |-- Show debug strategy - +-- Allow mode change - | -Phase 4: Setup TODO Tracking & Status File - |-- Create todos with CCWD prefix - +-- Initialize .workflow/.ccw-debug/{session_id}/status.json - | -Phase 5: Execute Debug Chain - |-- For sequential modes: execute commands in order - |-- For bidirectional: execute debug + test in parallel - |-- CLI mode: present findings, ask for escalation - |-- Merge findings (bidirectional mode) - +-- Update status and TODO -``` - ---- - -## Debug Pipeline Examples - -| Issue | Mode | Pipeline | -|-------|------|----------| -| "Login timeout error (quick)" | cli | ccw cli → analysis → (escalate or done) | -| "User login fails intermittently" | debug | debug-with-file → test-gen → test-cycle | -| "Authentication tests failing" | test | test-fix-gen → test-cycle-execute | -| "Multi-module auth + db sync issue" | bidirectional | (debug ∥ test) → merge findings | - -**Legend**: `∥` = parallel execution - ---- - -## State Management - -### Dual Tracking System - -**1. TodoWrite-Based Tracking** (UI Display): - -``` -// Initial state (debug mode) -CCWD:debug: [1/3] /workflow:debug-with-file [in_progress] -CCWD:debug: [2/3] /workflow:test-fix-gen [pending] -CCWD:debug: [3/3] /workflow:test-cycle-execute [pending] - -// CLI mode: only 1 command -CCWD:cli: [1/1] ccw cli --mode analysis [in_progress] - -// Bidirectional mode -CCWD:bidirectional: [1/3] /workflow:debug-with-file [in_progress] ∥ -CCWD:bidirectional: [2/3] /workflow:test-fix-gen [in_progress] ∥ -CCWD:bidirectional: [3/3] /workflow:test-cycle-execute [in_progress] -CCWD:bidirectional: [4/4] merge-findings [pending] -``` - -**2. Status.json Tracking**: Persistent state for debug monitoring. - -**Location**: `.workflow/.ccw-debug/{session_id}/status.json` - -**Structure**: -```json -{ - "session_id": "CCWD-auth-timeout-2025-02-02", - "mode": "debug", - "status": "running|completed|failed", - "parallel_execution": false, - "created_at": "2025-02-02T10:00:00Z", - "updated_at": "2025-02-02T10:05:00Z", - "issue": { - "description": "User login timeout after 30 seconds", - "error_type": "async", - "clarity": 3, - "complexity": "medium" - }, - "command_chain": [ - { "index": 0, "command": "/workflow:debug-with-file", "unit": "sequential", "status": "completed" }, - { "index": 1, "command": "/workflow:test-fix-gen", "unit": "sequential", "status": "in_progress" }, - { "index": 2, "command": "/workflow:test-cycle-execute", "unit": "sequential", "status": "pending" } - ], - "current_index": 1, - "findings": { - "debug": { "root_cause": "...", "confidence": "high" }, - "test": { "failure_pattern": "..." }, - "merged": null - } -} -``` - -**Status Values**: -- `running`: Debug workflow in progress -- `completed`: Debug finished, fix applied -- `failed`: Debug aborted or unfixable - -**Mode-Specific Fields**: -- `cli` mode: No findings field (recommendation-only) -- `debug`/`test`: Single finding source -- `bidirectional`: All three findings + merged result - ---- - -## Key Design Principles - -1. **Issue-Focused** - Diagnose root cause, not symptoms -2. **Mode-Driven** - 4 debug strategies for different issues -3. **Parallel Capability** - Bidirectional mode for complex systems -4. **Escalation Support** - CLI → debug/test mode progression -5. **Quick Diagnosis** - CLI mode for immediate recommendations -6. **TODO Tracking** - Use CCWD prefix to isolate debug todos -7. **Finding Convergence** - Merge parallel results for consensus ---- - -## Usage - -```bash -# Auto-select mode -/ccw-debug "Login failed: token validation error" - -# Explicit mode selection -/ccw-debug --mode cli "Quick diagnosis: API 500 error" -/ccw-debug --mode debug "User profile sync intermittent failure" -/ccw-debug --mode test "Permission check failing" -/ccw-debug --mode bidirectional "Multi-module auth + cache sync issue" - -# Auto mode (skip confirmations) -/ccw-debug --yes "Production hotfix: database connection timeout" - -# Resume or escalate from previous session -/ccw-debug --mode debug --source-session CCWD-login-timeout-2025-01-27 -``` - ---- - -## Mode Selection Decision Tree - -``` -User calls: /ccw-debug "issue description" - -├─ Keywords: "quick", "fast", "recommendation" -│ └─ Mode: CLI (2-5 min analysis, optional escalation) -│ -├─ Keywords: "test", "fail", "coverage" -│ └─ Mode: Test (automated iteration, ≥95% pass) -│ -├─ Keywords: "multiple", "system", "distributed" -│ └─ Mode: Bidirectional (parallel debug + test) -│ -└─ Default → Debug (full hypothesis-driven workflow) -``` diff --git a/.claude/commands/ccw-plan.md b/.claude/commands/ccw-plan.md deleted file mode 100644 index 994d4c82..00000000 --- a/.claude/commands/ccw-plan.md +++ /dev/null @@ -1,467 +0,0 @@ ---- -name: ccw-plan -description: Planning coordinator - analyze requirements, select planning strategy, execute planning workflow in main process -argument-hint: "[--mode lite|multi-cli|full|plan-verify|replan|cli|issue|rapid-to-issue|brainstorm-with-file|analyze-with-file] [--yes|-y] \"task description\"" -allowed-tools: Skill(*), TodoWrite(*), AskUserQuestion(*), Read(*), Grep(*), Glob(*) ---- - -# CCW-Plan Command - Planning Coordinator - -Planning orchestrator: requirement analysis → strategy selection → planning execution. - -## Skill 映射 - -| Skill | 包含操作 | -|-------|---------| -| `workflow-lite-plan` | lite-plan, lite-execute | -| `workflow-plan` | plan, plan-verify, replan | -| `workflow-multi-cli-plan` | multi-cli-plan | -| `brainstorm` | brainstorm | - -独立命令:workflow:brainstorm-with-file, workflow:analyze-with-file, issue:* - -## Core Concept: Planning Units (规划单元) - -**Definition**: Planning commands are grouped into logical units based on verification requirements and collaboration strategies. - -**Planning Units**: - -| Unit Type | Pattern | Example | -|-----------|---------|---------| -| **Quick Planning** | plan-cmd (no verify) | lite-plan | -| **Verified Planning** | plan-cmd → verify-cmd | plan → plan-verify | -| **Collaborative Planning** | multi-cli-plan (implicit verify) | multi-cli-plan | -| **With-File Planning** | brainstorm-with-file or analyze-with-file | brainstorm + plan options | -| **CLI-Assisted Planning** | ccw cli (analysis) → recommendations | quick analysis + decision | -| **Issue Workflow Planning** | plan → issue workflow (discover/queue/execute) | rapid-to-issue bridge | - -**Atomic Rules**: -1. Lite mode: No verification (fast iteration) -2. Plan-verify mode: Mandatory quality gate -3. Multi-cli/Full mode: Optional verification (via --skip-verify flag) -4. With-File modes: Self-contained iteration with built-in post-completion options -5. CLI mode: Quick analysis, user-driven decisions -6. Issue modes: Planning integrated into issue workflow lifecycle - -## Execution Model - -**Synchronous (Main Process)**: Planning commands execute via Skill, blocking until complete. - -``` -User Input → Analyze Requirements → Select Strategy → [Confirm] → Execute Planning - ↓ - Skill (blocking) - ↓ - Update TodoWrite - ↓ - Generate Artifacts -``` - -## 5-Phase Workflow - -### Phase 1: Analyze Requirements - -**Input** → Extract (goal, scope, constraints) → Assess (complexity, clarity, criticality) → **Analysis** - -| Field | Values | -|-------|--------| -| complexity | low \| medium \| high | -| clarity | 0-3 (≥2 = clear) | -| criticality | normal \| high \| critical | -| scope | single-module \| cross-module \| system \| batch-issues | - -**Output**: `Type: [task_type] | Goal: [goal] | Complexity: [complexity] | Clarity: [clarity]/3 | Criticality: [criticality]` - ---- - -### Phase 1.5: Requirement Clarification (if clarity < 2) - -``` -Analysis → Check clarity ≥ 2? - ↓ - YES → Continue to Phase 2 - ↓ - NO → Ask Questions → Update Analysis -``` - -**Questions Asked**: Goal (Create/Fix/Optimize/Analyze), Scope (Single file/Module/Cross-module/System), Constraints (Backward compat/Skip tests/Urgent hotfix) - ---- - -### Phase 2: Select Planning Strategy & Build Command Chain - -``` -Analysis → Detect Mode (keywords) → Build Command Chain → Planning Workflow -``` - -#### Mode Detection (Priority Order) - -``` -Input Keywords → Mode -─────────────────────────────────────────────────────────────────────────────── -quick|fast|immediate|recommendation|suggest → cli -issues?|batch|issue workflow|structured workflow|queue → issue -issue transition|rapid.*issue|plan.*issue|convert.*issue → rapid-to-issue -brainstorm|ideation|头脑风暴|创意|发散思维|multi-perspective → brainstorm-with-file -analyze.*document|explore.*concept|collaborative analysis → analyze-with-file -production|critical|payment|auth → plan-verify -adjust|modify|change plan → replan -uncertain|explore → full -complex|multiple module|integrate → multi-cli -(default) → lite -``` - -#### Command Chain Mapping - -| Mode | Command Chain | Verification | Use Case | -|------|---------------|--------------|----------| -| **cli** | ccw cli --mode analysis --rule planning-* | None | Quick planning recommendation | -| **issue** | /issue:discover → /issue:plan → /issue:queue → /issue:execute | Optional | Batch issue planning & execution | -| **rapid-to-issue** | lite-plan → /issue:convert-to-plan → queue → execute | Optional | Quick planning → Issue workflow bridge | -| **brainstorm-with-file** | /workflow:brainstorm-with-file → (plan/issue options) | Self-contained | Multi-perspective ideation | -| **analyze-with-file** | /workflow:analyze-with-file → (plan/issue options) | Self-contained | Collaborative architecture analysis | -| **lite** | lite-plan | None | Fast simple planning | -| **multi-cli** | multi-cli-plan → [plan-verify] | Optional | Multi-model collaborative planning | -| **full** | brainstorm → plan → [plan-verify] | Optional | Comprehensive brainstorm + planning | -| **plan-verify** | plan → **plan-verify** | **Mandatory** | Production/critical features | -| **replan** | replan | None | Plan refinement/adjustment | - -**Note**: -- `[ ]` = optional verification -- **bold** = mandatory quality gate -- With-File modes include built-in post-completion options to create plans/issues - -**Output**: `Mode: [mode] | Strategy: [strategy] | Commands: [1. /cmd1 2. /cmd2]` - ---- - -### Phase 3: User Confirmation - -``` -Planning Chain → Show Strategy → Ask User → User Decision: -- ✓ Confirm → Continue to Phase 4 -- ⚙ Adjust → Change Mode (back to Phase 2) -- ✗ Cancel → Abort -``` - ---- - -### Phase 4: Setup TODO Tracking & Status File - -``` -Planning Chain → Create Session Dir → Initialize Tracking → Tracking State -``` - -**Session Structure**: -``` -Session ID: CCWP-{goal-slug}-{date} -Session Dir: .workflow/.ccw-plan/{session_id}/ - -TodoWrite: - CCWP:{mode}: [1/n] /command1 [in_progress] - CCWP:{mode}: [2/n] /command2 [pending] - ... - -status.json: - { - "session_id": "CCWP-...", - "mode": "plan-verify", - "status": "running", - "command_chain": [...], - "quality_gate": "pending" // plan-verify mode only - } -``` - -**Output**: -- TODO: `-> CCWP:plan-verify: [1/2] /workflow:plan | ...` -- Status File: `.workflow/.ccw-plan/{session_id}/status.json` - ---- - -### Phase 5: Execute Planning Chain - -``` -Start Command → Update status (running) → Execute via Skill → Result -``` - -#### For Plan-Verify Mode (Quality Gate) - -``` -Quality Gate → PASS → Mark completed → Next command - ↓ FAIL (plan-verify mode) - Ask User → Refine: replan + re-verify - → Override: continue anyway - → Abort: stop planning -``` - -#### Error Handling Pattern - -``` -Command Error → Update status (failed) → Ask User: - - Retry → Re-execute (same index) - - Skip → Continue next command - - Abort → Stop execution -``` - ---- - -## Planning Pipeline Examples - -| Input | Mode | Pipeline | Use Case | -|-------|------|----------|----------| -| "Quick: should we use OAuth2?" | cli | ccw cli --mode analysis → recommendation | Immediate planning advice | -| "Plan user login system" | lite | lite-plan | Fast simple planning | -| "Implement OAuth2 auth" | multi-cli | multi-cli-plan → [plan-verify] | Multi-model collaborative planning | -| "Design notification system" | full | brainstorm → plan → [plan-verify] | Comprehensive brainstorm + planning | -| "Payment processing (prod)" | plan-verify | plan → **plan-verify** | Production critical (mandatory gate) | -| "头脑风暴: 用户通知系统重新设计" | brainstorm-with-file | brainstorm-with-file → (plan/issue options) | Multi-perspective ideation | -| "协作分析: 认证架构设计决策" | analyze-with-file | analyze-with-file → (plan/issue options) | Collaborative analysis | -| "Batch plan: handle 10 pending issues" | issue | /issue:discover → plan → queue → execute | Batch issue planning | -| "Plan and create issues" | rapid-to-issue | lite-plan → convert-to-plan → queue → execute | Quick plan → Issue workflow | -| "Update existing plan" | replan | replan | Plan refinement/adjustment | - -**Legend**: -- `[ ]` = optional verification -- **bold** = mandatory quality gate -- **With-File modes** include built-in post-completion options to create plans/issues - ---- - -## State Management - -### Dual Tracking System - -**1. TodoWrite-Based Tracking** (UI Display): - -``` -// Plan-verify mode (mandatory quality gate) -CCWP:plan-verify: [1/2] /workflow:plan [in_progress] -CCWP:plan-verify: [2/2] /workflow:plan-verify [pending] - -// CLI mode (quick recommendations) -CCWP:cli: [1/1] ccw cli --mode analysis [in_progress] - -// Issue mode (batch planning) -CCWP:issue: [1/4] /issue:discover [in_progress] -CCWP:issue: [2/4] /issue:plan [pending] -CCWP:issue: [3/4] /issue:queue [pending] -CCWP:issue: [4/4] /issue:execute [pending] - -// Rapid-to-issue mode (planning → issue bridge) -CCWP:rapid-to-issue: [1/4] /workflow:lite-plan [in_progress] -CCWP:rapid-to-issue: [2/4] /issue:convert-to-plan [pending] -CCWP:rapid-to-issue: [3/4] /issue:queue [pending] -CCWP:rapid-to-issue: [4/4] /issue:execute [pending] - -// Brainstorm-with-file mode (self-contained) -CCWP:brainstorm-with-file: [1/1] /workflow:brainstorm-with-file [in_progress] - -// Analyze-with-file mode (self-contained) -CCWP:analyze-with-file: [1/1] /workflow:analyze-with-file [in_progress] - -// Lite mode (fast simple planning) -CCWP:lite: [1/1] /workflow:lite-plan [in_progress] - -// Multi-CLI mode (collaborative planning) -CCWP:multi-cli: [1/1] /workflow:multi-cli-plan [in_progress] - -// Full mode (brainstorm + planning with optional verification) -CCWP:full: [1/2] /brainstorm [in_progress] -CCWP:full: [2/2] /workflow:plan [pending] -``` - -**2. Status.json Tracking**: Persistent state for planning monitoring. - -**Location**: `.workflow/.ccw-plan/{session_id}/status.json` - -**Structure**: -```json -{ - "session_id": "CCWP-oauth-auth-2025-02-02", - "mode": "plan-verify", - "status": "running|completed|failed", - "created_at": "2025-02-02T10:00:00Z", - "updated_at": "2025-02-02T10:05:00Z", - "analysis": { - "goal": "Implement OAuth2 authentication", - "complexity": "high", - "clarity_score": 2, - "criticality": "high" - }, - "command_chain": [ - { "index": 0, "command": "/workflow:plan", "mandatory": false, "status": "completed" }, - { "index": 1, "command": "/workflow:plan-verify", "mandatory": true, "status": "running" } - ], - "current_index": 1, - "quality_gate": "pending|PASS|FAIL" -} -``` - -**Status Values**: -- `running`: Planning in progress -- `completed`: Planning finished successfully -- `failed`: Planning aborted or quality gate failed - -**Quality Gate Values** (plan-verify mode only): -- `pending`: Verification not started -- `PASS`: Plan meets quality standards -- `FAIL`: Plan needs refinement - -**Mode-Specific Fields**: -- **plan-verify**: `quality_gate` field (pending|PASS|FAIL) -- **cli**: No command_chain, stores CLI recommendations and user decision -- **issue**: includes issue discovery results and queue configuration -- **rapid-to-issue**: includes plan output and conversion to issue -- **with-file modes**: stores session artifacts and post-completion options -- **other modes**: basic command_chain tracking - ---- - -## Extended Planning Modes - -### CLI-Assisted Planning (cli mode) - -``` -Quick Input → ccw cli --mode analysis --rule planning-* → Recommendations → User Decision: -- ✓ Accept → Create lite-plan from recommendations -- ↗ Escalate → Switch to multi-cli or full mode -- ✗ Done → Stop (recommendation only) -``` - -**Use Cases**: -- Quick architecture decision questions -- Planning approach recommendations -- Pattern/library selection advice - -**CLI Rules** (auto-selected based on context): -- `planning-plan-architecture-design` - Architecture decisions -- `planning-breakdown-task-steps` - Task decomposition -- `planning-design-component-spec` - Component specifications - ---- - -### With-File Planning Workflows - -**With-File workflows** provide documented exploration with multi-CLI collaboration, generating comprehensive session artifacts. - -| Mode | Purpose | Key Features | Output Folder | -|------|---------|--------------|---------------| -| **brainstorm-with-file** | Multi-perspective ideation | Gemini/Codex/Claude perspectives, diverge-converge | `.workflow/.brainstorm/` | -| **analyze-with-file** | Collaborative architecture analysis | Multi-round Q&A, CLI exploration, documented discussions | `.workflow/.analysis/` | - -**Detection Keywords**: -- **brainstorm-with-file**: 头脑风暴, 创意, 发散思维, multi-perspective, ideation -- **analyze-with-file**: 协作分析, 深度理解, collaborative analysis, explore concept - -**Characteristics**: -1. **Self-Contained**: Each workflow handles its own iteration loop -2. **Documented Process**: Creates evolving documents (brainstorm.md, discussion.md) -3. **Multi-CLI**: Uses Gemini/Codex/Claude for different perspectives -4. **Built-in Post-Completion**: Offers follow-up options (create plan, create issue, deep dive) - ---- - -### Issue Workflow Integration - -| Mode | Purpose | Command Chain | Typical Use | -|------|---------|---------------|-------------| -| **issue** | Batch issue planning | discover → plan → queue → execute | Multiple issues in codebase | -| **rapid-to-issue** | Quick plan → Issue workflow | lite-plan → convert-to-plan → queue → execute | Fast iteration → structured execution | - -**Issue Workflow Bridge**: -``` -lite-plan (in-memory) → /issue:convert-to-plan → Creates issue JSON - ↓ - /issue:queue → Form execution queue - ↓ - /issue:execute → DAG-based parallel execution -``` - -**When to use Issue Workflow**: -- Need structured multi-stage execution (queue-based) -- Want parallel DAG execution -- Multiple related changes as individual commits -- Converting brainstorm/plan output to executable tasks - ---- - -## Key Design Principles - -1. **Planning-Focused** - Pure planning coordination, no execution -2. **Mode-Driven** - 10 planning modes for different needs (lite/multi-cli/full/plan-verify/replan + cli/issue/rapid-to-issue/brainstorm-with-file/analyze-with-file) -3. **CLI Integration** - Quick analysis for immediate recommendations -4. **With-File Support** - Multi-CLI collaboration with documented artifacts -5. **Issue Workflow Bridge** - Seamless transition from planning to structured execution -6. **Quality Gates** - Mandatory verification for production features -7. **Flexible Verification** - Optional for exploration, mandatory for critical features -8. **Progressive Clarification** - Low clarity triggers requirement questions -9. **TODO Tracking** - Use CCWP prefix to isolate planning todos -10. **Handoff Ready** - Generates artifacts ready for execution phase - ---- - -## Usage - -```bash -# Auto-select mode (keyword-based detection) -/ccw-plan "Add user authentication" - -# Standard planning modes -/ccw-plan --mode lite "Add logout endpoint" -/ccw-plan --mode multi-cli "Implement OAuth2" -/ccw-plan --mode full "Design notification system" -/ccw-plan --mode plan-verify "Payment processing (production)" -/ccw-plan --mode replan --session WFS-auth-2025-01-28 - -# CLI-assisted planning (quick recommendations) -/ccw-plan --mode cli "Quick: should we use OAuth2 or JWT?" -/ccw-plan --mode cli "Which state management pattern for React app?" - -# With-File workflows (multi-CLI collaboration) -/ccw-plan --mode brainstorm-with-file "头脑风暴: 用户通知系统重新设计" -/ccw-plan --mode analyze-with-file "协作分析: 认证架构的设计决策" - -# Issue workflow integration -/ccw-plan --mode issue "Batch plan: handle all pending security issues" -/ccw-plan --mode rapid-to-issue "Plan user profile feature and create issue" - -# Auto mode (skip confirmations) -/ccw-plan --yes "Quick feature: user profile endpoint" -``` - ---- - -## Mode Selection Decision Tree - -``` -User calls: /ccw-plan "task description" - -├─ Keywords: "quick", "fast", "recommendation" -│ └─ Mode: CLI (quick analysis → recommendations) -│ -├─ Keywords: "issue", "batch", "queue" -│ └─ Mode: Issue (batch planning → execution queue) -│ -├─ Keywords: "plan.*issue", "rapid.*issue" -│ └─ Mode: Rapid-to-Issue (lite-plan → issue bridge) -│ -├─ Keywords: "头脑风暴", "brainstorm", "ideation" -│ └─ Mode: Brainstorm-with-file (multi-CLI ideation) -│ -├─ Keywords: "协作分析", "analyze.*document" -│ └─ Mode: Analyze-with-file (collaborative analysis) -│ -├─ Keywords: "production", "critical", "payment" -│ └─ Mode: Plan-Verify (mandatory quality gate) -│ -├─ Keywords: "adjust", "modify", "change plan" -│ └─ Mode: Replan (refine existing plan) -│ -├─ Keywords: "uncertain", "explore" -│ └─ Mode: Full (brainstorm → plan → [verify]) -│ -├─ Keywords: "complex", "multiple module" -│ └─ Mode: Multi-CLI (collaborative planning) -│ -└─ Default → Lite (fast simple planning) -``` diff --git a/.claude/commands/ccw-test.md b/.claude/commands/ccw-test.md deleted file mode 100644 index 170a4f5c..00000000 --- a/.claude/commands/ccw-test.md +++ /dev/null @@ -1,395 +0,0 @@ ---- -name: ccw-test -description: Test coordinator - analyze testing needs, select test strategy, execute test workflow in main process -argument-hint: "[--mode gen|fix|verify|tdd] [--yes|-y] \"test description\"" -allowed-tools: Skill(*), TodoWrite(*), AskUserQuestion(*), Read(*), Bash(*) ---- - -# CCW-Test Command - Test Coordinator - -Test orchestrator: testing needs analysis → strategy selection → test execution. - -## Skill 映射 - -| Skill | 包含操作 | -|-------|---------| -| `workflow-test-fix` | test-fix-gen, test-cycle-execute | -| `workflow-tdd` | tdd-plan, tdd-verify | -| `workflow-execute` | execute | - -## Core Concept: Test Units (测试单元) - -**Definition**: Test commands grouped into logical units based on testing objectives. - -**Test Units**: - -| Unit Type | Pattern | Example | -|-----------|---------|---------| -| **Generation Only** | test-gen (no execution) | test-fix-gen | -| **Test + Fix Cycle** | test-gen → test-execute-fix | test-fix-gen → test-cycle-execute | -| **Verification Only** | existing-tests → execute | execute-tests | -| **TDD Cycle** | tdd-plan → tdd-execute → verify | Red-Green-Refactor | - -**Atomic Rules**: -1. Gen mode: Generate tests only (no execution) -2. Fix mode: Generate + auto-iteration until ≥95% pass -3. Verify mode: Execute existing tests + report -4. TDD mode: Full Red-Green-Refactor cycle compliance - -## Execution Model - -**Synchronous (Main Process)**: Test commands execute via Skill, blocking until complete. - -``` -User Input → Analyze Testing Needs → Select Strategy → [Confirm] → Execute Tests - ↓ - Skill (blocking) - ↓ - Update TodoWrite - ↓ - Generate Tests/Results -``` - -## 5-Phase Workflow - -### Phase 1: Analyze Testing Needs - -**Input** → Extract (description, target_module, existing_tests) → Assess (testing_goal, framework, coverage_target) → **Analysis** - -| Field | Values | -|-------|--------| -| testing_goal | generate \| fix \| verify \| tdd | -| framework | jest \| vitest \| pytest \| ... | -| coverage_target | 0-100 (default: 80) | -| existing_tests | true \| false | - -#### Mode Detection (Priority Order) - -``` -Input Keywords → Mode -───────────────────────────────────────────────────────── -generate|create|write test|need test → gen -fix|repair|failing|broken → fix -verify|validate|check|run test → verify -tdd|test-driven|test first → tdd -(default) → fix -``` - -**Output**: `TestingGoal: [goal] | Mode: [mode] | Target: [module] | Framework: [framework]` - ---- - -### Phase 1.5: Testing Clarification (if needed) - -``` -Analysis → Check testing_goal known? - ↓ - YES → Check target_module set? - ↓ - YES → Continue to Phase 2 - ↓ - NO → Ask Questions → Update Analysis -``` - -**Questions Asked**: Testing Goal, Target Module/Files, Coverage Requirements, Test Framework - ---- - -### Phase 2: Select Test Strategy & Build Command Chain - -``` -Analysis → Detect Mode (keywords) → Build Command Chain → Test Workflow -``` - -#### Command Chain Mapping - -| Mode | Command Chain | Behavior | -|------|---------------|----------| -| **gen** | test-fix-gen | Generate only, no execution | -| **fix** | test-fix-gen → test-cycle-execute (iterate) | Auto-iteration until ≥95% pass or max iterations | -| **verify** | execute-existing-tests → coverage-report | Execute + report only | -| **tdd** | tdd-plan → execute → tdd-verify | Red-Green-Refactor cycle compliance | - -**Note**: `(iterate)` = auto-iteration until pass_rate ≥ 95% or max_iterations reached - -**Output**: `Mode: [mode] | Strategy: [strategy] | Commands: [1. /cmd1 2. /cmd2]` - ---- - -### Phase 3: User Confirmation - -``` -Test Chain → Show Strategy → Ask User → User Decision: -- ✓ Confirm → Continue to Phase 4 -- ⚙ Change Mode → Select Different Mode (back to Phase 2) -- ✗ Cancel → Abort -``` - ---- - -### Phase 4: Setup TODO Tracking & Status File - -``` -Test Chain → Create Session Dir → Initialize Tracking → Tracking State -``` - -**Session Structure**: -``` -Session ID: CCWT-{target-module-slug}-{date} -Session Dir: .workflow/.ccw-test/{session_id}/ - -TodoWrite: - CCWT:{mode}: [1/n] /command1 [in_progress] - CCWT:{mode}: [2/n] /command2 [pending] - ... - -status.json: - { - "session_id": "CCWT-...", - "mode": "gen|fix|verify|tdd", - "status": "running", - "testing": { description, target_module, framework, coverage_target }, - "command_chain": [...], - "test_metrics": { total_tests, passed, failed, pass_rate, iteration_count, coverage } - } -``` - -**Output**: -- TODO: `-> CCWT:fix: [1/2] /workflow:test-fix-gen | CCWT:fix: [2/2] /workflow:test-cycle-execute` -- Status File: `.workflow/.ccw-test/{session_id}/status.json` - ---- - -### Phase 5: Execute Test Chain - -#### For All Modes (Sequential Execution) - -``` -Start Command → Update status (running) → Execute via Skill → Result - ↓ - Update test_metrics → Next Command - ↓ - Error? → YES → Ask Action (Retry/Skip/Abort) - → NO → Continue -``` - -#### For Fix Mode (Auto-Iteration) - -``` -test-fix-gen completes → test-cycle-execute begins - ↓ - Check pass_rate ≥ 95%? - ↓ ↓ - YES → Complete NO → Check iteration < max? - ↓ ↓ - YES → Iteration NO → Complete - | (analyze failures - | generate fix - | re-execute tests) - | - └→ Loop back to pass_rate check -``` - -#### Error Handling Pattern - -``` -Command Error → Update status (failed) → Ask User: - - Retry → Re-execute (same index) - - Skip → Continue next command - - Abort → Stop execution -``` - -#### Test Metrics Update - -``` -After Each Execution → Collect test_metrics: - - total_tests: number - - passed/failed: count - - pass_rate: percentage - - iteration_count: increment (fix mode) - - coverage: line/branch/function - ↓ -Update status.json → Update TODO with iteration info (if fix mode) -``` - ---- - -## Execution Flow Summary - -``` -User Input - | -Phase 1: Analyze Testing Needs - |-- Extract: description, testing_goal, target_module, existing_tests - +-- If unclear -> Phase 1.5: Clarify Testing Needs - | -Phase 2: Select Test Strategy & Build Chain - |-- Detect mode: gen | fix | verify | tdd - |-- Build command chain based on mode - +-- Configure iteration limits (fix mode) - | -Phase 3: User Confirmation (optional) - |-- Show test strategy - +-- Allow mode change - | -Phase 4: Setup TODO Tracking & Status File - |-- Create todos with CCWT prefix - +-- Initialize .workflow/.ccw-test/{session_id}/status.json - | -Phase 5: Execute Test Chain - |-- For each command: - | |-- Update status.json (current=running) - | |-- Execute via Skill - | |-- Test-fix cycle: iterate until ≥95% pass or max iterations - | |-- Update test_metrics in status.json - | +-- Update TODO status - +-- Mark status.json as completed -``` - ---- - -## Test Pipeline Examples - -| Input | Mode | Pipeline | Iteration | -|-------|------|----------|-----------| -| "Generate tests for auth module" | gen | test-fix-gen | No execution | -| "Fix failing authentication tests" | fix | test-fix-gen → test-cycle-execute (iterate) | Max 3 iterations | -| "Run existing test suite" | verify | execute-tests → coverage-report | One-time | -| "Implement user profile with TDD" | tdd | tdd-plan → execute → tdd-verify | Red-Green-Refactor | - -**Legend**: `(iterate)` = auto-iteration until ≥95% pass rate - ---- - -## State Management - -### Dual Tracking System - -**1. TodoWrite-Based Tracking** (UI Display): - -``` -// Initial state (fix mode) -CCWT:fix: [1/2] /workflow:test-fix-gen [in_progress] -CCWT:fix: [2/2] /workflow:test-cycle-execute [pending] - -// During iteration (fix mode, iteration 2/3) -CCWT:fix: [1/2] /workflow:test-fix-gen [completed] -CCWT:fix: [2/2] /workflow:test-cycle-execute [in_progress] (iteration 2/3, pass rate: 78%) - -// Gen mode (no execution) -CCWT:gen: [1/1] /workflow:test-fix-gen [in_progress] - -// Verify mode (one-time) -CCWT:verify: [1/2] execute-existing-tests [in_progress] -CCWT:verify: [2/2] generate-coverage-report [pending] - -// TDD mode (Red-Green-Refactor) -CCWT:tdd: [1/3] /workflow:tdd-plan [in_progress] -CCWT:tdd: [2/3] /workflow:execute [pending] -CCWT:tdd: [3/3] /workflow:tdd-verify [pending] -``` - -**2. Status.json Tracking**: Persistent state for test monitoring. - -**Location**: `.workflow/.ccw-test/{session_id}/status.json` - -**Structure**: -```json -{ - "session_id": "CCWT-auth-module-2025-02-02", - "mode": "fix", - "status": "running|completed|failed", - "created_at": "2025-02-02T10:00:00Z", - "updated_at": "2025-02-02T10:05:00Z", - "testing": { - "description": "Fix failing authentication tests", - "target_module": "src/auth/**/*.ts", - "framework": "jest", - "coverage_target": 80 - }, - "command_chain": [ - { "index": 0, "command": "/workflow:test-fix-gen", "unit": "sequential", "status": "completed" }, - { "index": 1, "command": "/workflow:test-cycle-execute", "unit": "test-fix-cycle", "max_iterations": 3, "status": "in_progress" } - ], - "current_index": 1, - "test_metrics": { - "total_tests": 42, - "passed": 38, - "failed": 4, - "pass_rate": 90.5, - "iteration_count": 2, - "coverage": { - "line": 82.3, - "branch": 75.6, - "function": 88.1 - } - } -} -``` - -**Status Values**: -- `running`: Test workflow in progress -- `completed`: Tests passing (≥95%) or generation complete -- `failed`: Test workflow aborted - -**Test Metrics** (updated during execution): -- `total_tests`: Number of tests executed -- `pass_rate`: Percentage of passing tests (target: ≥95%) -- `iteration_count`: Number of test-fix iterations (fix mode) -- `coverage`: Line/branch/function coverage percentages - ---- - -## Key Design Principles - -1. **Testing-Focused** - Pure test coordination, no implementation -2. **Mode-Driven** - 4 test strategies for different needs -3. **Auto-Iteration** - Fix mode iterates until ≥95% pass rate -4. **Metrics Tracking** - Real-time test metrics in status.json -5. **Coverage-Driven** - Coverage targets guide test generation -6. **TODO Tracking** - Use CCWT prefix to isolate test todos -7. **TDD Compliance** - TDD mode enforces Red-Green-Refactor cycle - ---- - -## Usage - -```bash -# Auto-select mode -/ccw-test "Test user authentication module" - -# Explicit mode selection -/ccw-test --mode gen "Generate tests for payment module" -/ccw-test --mode fix "Fix failing authentication tests" -/ccw-test --mode verify "Validate current test suite" -/ccw-test --mode tdd "Implement user profile with TDD" - -# Custom configuration -/ccw-test --mode fix --max-iterations 5 --pass-threshold 98 "Fix all tests" -/ccw-test --target "src/auth/**/*.ts" "Test authentication module" - -# Auto mode (skip confirmations) -/ccw-test --yes "Quick test validation" -``` - ---- - -## Mode Selection Decision Tree - -``` -User calls: /ccw-test "test description" - -├─ Keywords: "generate", "create", "write test" -│ └─ Mode: Gen (generate only, no execution) -│ -├─ Keywords: "fix", "repair", "failing" -│ └─ Mode: Fix (auto-iterate until ≥95% pass) -│ -├─ Keywords: "verify", "validate", "run test" -│ └─ Mode: Verify (execute existing tests) -│ -├─ Keywords: "tdd", "test-driven", "test first" -│ └─ Mode: TDD (Red-Green-Refactor cycle) -│ -└─ Default → Fix (most common: fix failing tests) -``` diff --git a/.claude/commands/ccw.md b/.claude/commands/ccw.md index f8af0e1b..a9b49a27 100644 --- a/.claude/commands/ccw.md +++ b/.claude/commands/ccw.md @@ -23,8 +23,20 @@ Main process orchestrator: intent analysis → workflow selection → command ch | `workflow-multi-cli-plan` | ACE context → CLI discussion → plan → execute | | `review-cycle` | session/module review → fix orchestration | | `brainstorm` | auto/single-role → artifacts → analysis → synthesis | +| `workflow:collaborative-plan-with-file` | understanding agent → parallel agents → plan-note.md | +| `workflow:req-plan-with-file` | requirement decomposition → issue creation → execution-plan.json | +| `workflow:integration-test-cycle` | explore → test dev → test-fix cycle → reflection | +| `workflow:refactor-cycle` | tech debt discovery → prioritize → execute → validate | +| `team-planex` | planner + executor wave pipeline(边规划边执行)| +| `team-iterdev` | 迭代开发团队(planner → developer → reviewer 循环)| +| `team-lifecycle` | 全生命周期团队(spec → impl → test)| +| `team-issue` | issue 解决团队(discover → plan → execute)| +| `team-testing` | 测试团队(strategy → generate → execute → analyze)| +| `team-quality-assurance` | QA 团队(scout → strategist → generator → executor → analyst)| +| `team-brainstorm` | 团队头脑风暴(facilitator → participants → synthesizer)| +| `team-uidesign` | UI 设计团队(designer → implementer dual-track)| -独立命令(仍使用 colon 格式):workflow:brainstorm-with-file, workflow:debug-with-file, workflow:analyze-with-file, workflow:ui-design:*, issue:*, workflow:session:* +独立命令(仍使用 colon 格式):workflow:brainstorm-with-file, workflow:debug-with-file, workflow:analyze-with-file, workflow:collaborative-plan-with-file, workflow:req-plan-with-file, workflow:integration-test-cycle, workflow:refactor-cycle, workflow:unified-execute-with-file, workflow:clean, workflow:init, workflow:init-guidelines, workflow:ui-design:*, issue:*, workflow:session:* ## Core Concept: Self-Contained Skills (自包含 Skill) @@ -44,6 +56,19 @@ Main process orchestrator: intent analysis → workflow selection → command ch | TDD Planning | `workflow-tdd` → `workflow-execute` | tdd-plan 和 execute 是独立 Skill | | 测试流水线 | `workflow-test-fix` | 内部完成 gen→cycle | | 代码审查 | `review-cycle` | 内部完成 review→fix | +| 多CLI协作 | `workflow-multi-cli-plan` | ACE context → CLI discussion → plan → execute | +| 协作规划 | `workflow:collaborative-plan-with-file` | 多 agent 协作生成 plan-note.md | +| 需求路线图 | `workflow:req-plan-with-file` | 需求拆解→issue 创建→执行计划 | +| 集成测试循环 | `workflow:integration-test-cycle` | 自迭代集成测试闭环 | +| 重构循环 | `workflow:refactor-cycle` | 技术债务发现→重构→验证 | +| 团队 Plan+Execute | `team-planex` | 2 人团队 wave pipeline,边规划边执行 | +| 团队迭代开发 | `team-iterdev` | 多角色迭代开发闭环 | +| 团队全生命周期 | `team-lifecycle` | spec→impl→test 全流程 | +| 团队 Issue | `team-issue` | 多角色协作 issue 解决 | +| 团队测试 | `team-testing` | 多角色测试流水线 | +| 团队 QA | `team-quality-assurance` | 多角色质量保障闭环 | +| 团队头脑风暴 | `team-brainstorm` | 多角色协作头脑风暴 | +| 团队 UI 设计 | `team-uidesign` | dual-track 设计+实现 | ## Execution Model @@ -116,7 +141,22 @@ function detectTaskType(text) { 'brainstorm-to-issue': /brainstorm.*issue|头脑风暴.*issue|idea.*issue|想法.*issue|从.*头脑风暴|convert.*brainstorm/, 'debug-file': /debug.*document|hypothesis.*debug|troubleshoot.*track|investigate.*log|调试.*记录|假设.*验证|systematic debug|深度调试/, 'analyze-file': /analyze.*document|explore.*concept|understand.*architecture|investigate.*discuss|collaborative analysis|分析.*讨论|深度.*理解|协作.*分析/, + 'collaborative-plan': /collaborative.*plan|协作.*规划|多人.*规划|multi.*agent.*plan|Plan Note|分工.*规划/, + 'req-plan': /roadmap|需求.*规划|需求.*拆解|requirement.*plan|req.*plan|progressive.*plan|路线.*图/, + // Cycle workflows (self-iterating with reflection) + 'integration-test': /integration.*test|集成测试|端到端.*测试|e2e.*test|integration.*cycle/, + 'refactor': /refactor|重构|tech.*debt|技术债务/, + // Team workflows (multi-role collaboration, explicit "team" keyword required) + 'team-planex': /team.*plan.*exec|team.*planex|团队.*规划.*执行|并行.*规划.*执行|wave.*pipeline/, + 'team-iterdev': /team.*iter|team.*iterdev|迭代.*开发.*团队|iterative.*dev.*team/, + 'team-lifecycle': /team.*lifecycle|全生命周期|full.*lifecycle|spec.*impl.*test.*team/, + 'team-issue': /team.*issue.*resolv|团队.*issue|team.*resolve.*issue/, + 'team-testing': /team.*test|测试团队|comprehensive.*test.*team|全面.*测试.*团队/, + 'team-qa': /team.*qa|quality.*assurance.*team|QA.*团队|质量.*保障.*团队|团队.*质量/, + 'team-brainstorm': /team.*brainstorm|团队.*头脑风暴|team.*ideation|多人.*头脑风暴/, + 'team-uidesign': /team.*ui.*design|UI.*设计.*团队|dual.*track.*design|团队.*UI/, // Standard workflows + 'multi-cli-plan': /multi.*cli|多.*CLI|多模型.*协作|multi.*model.*collab/, 'bugfix': /fix|bug|error|crash|fail|debug/, 'issue-batch': /issues?|batch/ && /fix|resolve/, 'issue-transition': /issue workflow|structured workflow|queue|multi-stage/, @@ -167,7 +207,22 @@ function selectWorkflow(analysis) { 'brainstorm-to-issue': { level: 4, flow: 'brainstorm-to-issue' }, // Brainstorm → Issue workflow 'debug-file': { level: 3, flow: 'debug-with-file' }, // Hypothesis-driven debugging 'analyze-file': { level: 3, flow: 'analyze-with-file' }, // Collaborative analysis + 'collaborative-plan': { level: 3, flow: 'collaborative-plan' }, // Multi-agent collaborative planning + 'req-plan': { level: 4, flow: 'req-plan' }, // Requirement-level roadmap planning + // Cycle workflows (self-iterating with reflection) + 'integration-test': { level: 3, flow: 'integration-test-cycle' }, // Self-iterating integration test + 'refactor': { level: 3, flow: 'refactor-cycle' }, // Tech debt discovery and refactoring + // Team workflows (multi-role collaboration) + 'team-planex': { level: 'Team', flow: 'team-planex' }, + 'team-iterdev': { level: 'Team', flow: 'team-iterdev' }, + 'team-lifecycle': { level: 'Team', flow: 'team-lifecycle' }, + 'team-issue': { level: 'Team', flow: 'team-issue' }, + 'team-testing': { level: 'Team', flow: 'team-testing' }, + 'team-qa': { level: 'Team', flow: 'team-qa' }, + 'team-brainstorm': { level: 'Team', flow: 'team-brainstorm' }, + 'team-uidesign': { level: 'Team', flow: 'team-uidesign' }, // Standard workflows + 'multi-cli-plan': { level: 3, flow: 'multi-cli-plan' }, // Multi-CLI collaborative planning 'bugfix': { level: 2, flow: 'bugfix.standard' }, 'issue-batch': { level: 'Issue', flow: 'issue' }, 'issue-transition': { level: 2.5, flow: 'rapid-to-issue' }, // Bridge workflow @@ -250,6 +305,29 @@ function buildCommandChain(workflow, analysis) { // Note: Self-contained with multi-round discussion and CLI exploration ], + 'collaborative-plan': [ + { cmd: 'workflow:collaborative-plan-with-file', args: `"${analysis.goal}"` }, + { cmd: 'workflow:unified-execute-with-file', args: '' } + // Note: Plan Note → unified execution engine + ], + + 'req-plan': [ + { cmd: 'workflow:req-plan-with-file', args: `"${analysis.goal}"` }, + { cmd: 'team-planex', args: '' } + // Note: Requirement decomposition → issue creation → team-planex wave execution + ], + + // Cycle workflows (self-iterating with reflection) + 'integration-test-cycle': [ + { cmd: 'workflow:integration-test-cycle', args: `"${analysis.goal}"` } + // Note: Self-contained explore → test → fix cycle with reflection + ], + + 'refactor-cycle': [ + { cmd: 'workflow:refactor-cycle', args: `"${analysis.goal}"` } + // Note: Self-contained tech debt discovery → refactor → validate + ], + // Level 3 - Standard 'coupled': [ { cmd: 'workflow-plan', args: `"${analysis.goal}"` }, @@ -298,6 +376,39 @@ function buildCommandChain(workflow, analysis) { { cmd: 'issue:plan', args: '--all-pending' }, { cmd: 'issue:queue', args: '' }, { cmd: 'issue:execute', args: '' } + ], + + // Team Workflows (multi-role collaboration, self-contained) + 'team-planex': [ + { cmd: 'team-planex', args: `"${analysis.goal}"` } + ], + + 'team-iterdev': [ + { cmd: 'team-iterdev', args: `"${analysis.goal}"` } + ], + + 'team-lifecycle': [ + { cmd: 'team-lifecycle', args: `"${analysis.goal}"` } + ], + + 'team-issue': [ + { cmd: 'team-issue', args: `"${analysis.goal}"` } + ], + + 'team-testing': [ + { cmd: 'team-testing', args: `"${analysis.goal}"` } + ], + + 'team-qa': [ + { cmd: 'team-quality-assurance', args: `"${analysis.goal}"` } + ], + + 'team-brainstorm': [ + { cmd: 'team-brainstorm', args: `"${analysis.goal}"` } + ], + + 'team-uidesign': [ + { cmd: 'team-uidesign', args: `"${analysis.goal}"` } ] }; @@ -532,9 +643,22 @@ Phase 5: Execute Command Chain | "从头脑风暴创建 issue" | brainstorm-to-issue | 4 | issue:from-brainstorm → issue:queue → issue:execute | | "深度调试 WebSocket" | debug-file | 3 | workflow:debug-with-file | | "协作分析: 认证架构优化" | analyze-file | 3 | workflow:analyze-with-file | +| "协作规划: 实时通知系统" | collaborative-plan | 3 | collaborative-plan-with-file → unified-execute-with-file | +| "需求规划: OAuth + 2FA" | req-plan | 4 | req-plan-with-file → team-planex | +| "集成测试: 支付流程" | integration-test | 3 | workflow:integration-test-cycle | +| "重构 auth 模块" | refactor | 3 | workflow:refactor-cycle | +| "multi-cli plan: API设计" | multi-cli-plan | 3 | workflow-multi-cli-plan → workflow-test-fix | | "OAuth2 system" | feature (high) | 3 | workflow-plan → workflow-execute → review-cycle → workflow-test-fix | | "Implement with TDD" | tdd | 3 | workflow-tdd → workflow-execute | | "Uncertain: real-time" | exploration | 4 | brainstorm → workflow-plan → workflow-execute → workflow-test-fix | +| "team planex: 用户系统" | team-planex | Team | team-planex | +| "迭代开发团队: 支付模块" | team-iterdev | Team | team-iterdev | +| "全生命周期: 通知服务" | team-lifecycle | Team | team-lifecycle | +| "team resolve issue #42" | team-issue | Team | team-issue | +| "测试团队: 全面测试认证" | team-testing | Team | team-testing | +| "QA 团队: 质量保障支付" | team-qa | Team | team-quality-assurance | +| "团队头脑风暴: API 设计" | team-brainstorm | Team | team-brainstorm | +| "团队 UI 设计: 仪表盘" | team-uidesign | Team | team-uidesign | --- @@ -629,11 +753,15 @@ todos = [ | **brainstorm-with-file** | Multi-perspective ideation | Gemini/Codex/Claude perspectives, diverge-converge cycles | `.workflow/.brainstorm/` | | **debug-with-file** | Hypothesis-driven debugging | Gemini validation, understanding evolution, NDJSON logging | `.workflow/.debug/` | | **analyze-with-file** | Collaborative analysis | Multi-round Q&A, CLI exploration, documented discussions | `.workflow/.analysis/` | +| **collaborative-plan-with-file** | Multi-agent collaborative planning | Understanding agent + parallel agents, Plan Note shared doc | `.workflow/.planning/` | +| **req-plan-with-file** | Requirement roadmap planning | Requirement decomposition, issue creation, execution-plan.json | `.workflow/.planning/` | **Detection Keywords**: - **brainstorm**: 头脑风暴, 创意, 发散思维, multi-perspective, compare perspectives - **debug-file**: 深度调试, 假设验证, systematic debug, hypothesis debug - **analyze-file**: 协作分析, 深度理解, collaborative analysis, explore concept +- **collaborative-plan**: 协作规划, 多人规划, collaborative plan, multi-agent plan, Plan Note +- **req-plan**: roadmap, 需求规划, 需求拆解, requirement plan, progressive plan **Characteristics**: 1. **Self-Contained**: Each workflow handles its own iteration loop @@ -643,6 +771,73 @@ todos = [ --- +## Team Workflows + +**Team workflows** provide multi-role collaboration for complex tasks. Each team skill is self-contained with internal role routing via `--role=xxx`. + +| Workflow | Roles | Pipeline | Use Case | +|----------|-------|----------|----------| +| **team-planex** | planner + executor | wave pipeline(边规划边执行)| 需要并行规划和执行的任务 | +| **team-iterdev** | planner → developer → reviewer | 迭代开发循环 | 需要多轮迭代的开发任务 | +| **team-lifecycle** | spec → impl → test | 全生命周期 | 从需求到测试的完整流程 | +| **team-issue** | discover → plan → execute | issue 解决 | 多角色协作解决 issue | +| **team-testing** | strategy → generate → execute → analyze | 测试流水线 | 全面测试覆盖 | +| **team-quality-assurance** | scout → strategist → generator → executor → analyst | QA 闭环 | 质量保障全流程 | +| **team-brainstorm** | facilitator → participants → synthesizer | 团队头脑风暴 | 多角色协作头脑风暴 | +| **team-uidesign** | designer → implementer | dual-track 设计+实现 | UI 设计与实现并行 | + +**Detection Keywords**: +- **team-planex**: team planex, 团队规划执行, wave pipeline +- **team-iterdev**: team iterdev, 迭代开发团队, iterative dev team +- **team-lifecycle**: team lifecycle, 全生命周期, full lifecycle +- **team-issue**: team issue, 团队 issue, team resolve issue +- **team-testing**: team test, 测试团队, comprehensive test team +- **team-qa**: team qa, QA 团队, 质量保障团队 +- **team-brainstorm**: team brainstorm, 团队头脑风暴, team ideation +- **team-uidesign**: team ui design, UI 设计团队, dual track design + +**Characteristics**: +1. **Self-Contained**: Each team skill handles internal role coordination +2. **Role-Based Routing**: All roles invoke the same skill with `--role=xxx` +3. **Shared Memory**: Roles communicate via shared-memory.json and message bus +4. **Auto Mode Support**: All team skills support `-y`/`--yes` for skip confirmations + +--- + +## Cycle Workflows + +**Cycle workflows** provide self-iterating development cycles with reflection-driven strategy adjustment. Each cycle is autonomous with built-in test-fix loops and quality gates. + +| Workflow | Pipeline | Key Features | Output Folder | +|----------|----------|--------------|---------------| +| **integration-test-cycle** | explore → test dev → test-fix → reflection | Self-iterating with max-iterations, auto continue | `.workflow/.test-cycle/` | +| **refactor-cycle** | discover → prioritize → execute → validate | Multi-dimensional analysis, regression validation | `.workflow/.refactor-cycle/` | + +**Detection Keywords**: +- **integration-test**: integration test, 集成测试, 端到端测试, e2e test +- **refactor**: refactor, 重构, tech debt, 技术债务 + +**Characteristics**: +1. **Self-Iterating**: Autonomous test-fix loops until quality gate passes +2. **Reflection-Driven**: Strategy adjusts based on previous iteration results +3. **Continue Support**: `--continue` flag to resume interrupted sessions +4. **Auto Mode Support**: `-y`/`--yes` for fully autonomous execution + +--- + +## Utility Commands + +**Utility commands** are not auto-routed by CCW intent detection. Invoke directly when needed. + +| Command | Purpose | +|---------|---------| +| `workflow:unified-execute-with-file` | Universal execution engine - consumes plan output from collaborative-plan, req-plan, brainstorm | +| `workflow:clean` | Intelligent code cleanup - mainline detection, stale artifact removal | +| `workflow:init` | Initialize `.workflow/project-tech.json` with project analysis | +| `workflow:init-guidelines` | Interactive wizard to fill `project-guidelines.json` | + +--- + ## Usage ```bash @@ -665,9 +860,38 @@ todos = [ # Exploratory task /ccw "Uncertain about architecture for real-time notifications" +# Multi-CLI collaborative planning +/ccw "multi-cli plan: 支付网关API设计" # → workflow-multi-cli-plan → workflow-test-fix + # With-File workflows (documented exploration with multi-CLI collaboration) /ccw "头脑风暴: 用户通知系统重新设计" # → brainstorm-with-file /ccw "从头脑风暴 BS-通知系统-2025-01-28 创建 issue" # → brainstorm-to-issue (bridge) /ccw "深度调试: 系统随机崩溃问题" # → debug-with-file /ccw "协作分析: 理解现有认证架构的设计决策" # → analyze-with-file + +# Team workflows (multi-role collaboration) +/ccw "team planex: 用户认证系统" # → team-planex (planner + executor wave pipeline) +/ccw "迭代开发团队: 支付模块重构" # → team-iterdev (planner → developer → reviewer) +/ccw "全生命周期: 通知服务开发" # → team-lifecycle (spec → impl → test) +/ccw "team resolve issue #42" # → team-issue (discover → plan → execute) +/ccw "测试团队: 全面测试认证模块" # → team-testing (strategy → generate → execute → analyze) +/ccw "QA 团队: 质量保障支付流程" # → team-quality-assurance (scout → strategist → generator → executor → analyst) +/ccw "团队头脑风暴: API 网关设计" # → team-brainstorm (facilitator → participants → synthesizer) +/ccw "团队 UI 设计: 管理后台仪表盘" # → team-uidesign (designer → implementer dual-track) + +# Collaborative planning & requirement workflows +/ccw "协作规划: 实时通知系统架构" # → collaborative-plan-with-file → unified-execute +/ccw "需求规划: 用户认证 OAuth + 2FA" # → req-plan-with-file → team-planex +/ccw "roadmap: 数据导出功能路线图" # → req-plan-with-file → team-planex + +# Cycle workflows (self-iterating) +/ccw "集成测试: 支付流程端到端" # → integration-test-cycle +/ccw "重构 auth 模块的技术债务" # → refactor-cycle +/ccw "tech debt: 清理支付服务" # → refactor-cycle + +# Utility commands (invoked directly, not auto-routed) +# /workflow:unified-execute-with-file # 通用执行引擎(消费 plan 输出) +# /workflow:clean # 智能代码清理 +# /workflow:init # 初始化项目状态 +# /workflow:init-guidelines # 交互式填充项目规范 ``` diff --git a/.claude/skills/review-cycle/SKILL.md b/.claude/skills/review-cycle/SKILL.md index f30576f8..61e3cc23 100644 --- a/.claude/skills/review-cycle/SKILL.md +++ b/.claude/skills/review-cycle/SKILL.md @@ -27,6 +27,15 @@ Unified code review orchestrator with mode-based routing. Detects input type and review-session.md review-module.md review-fix.md ``` +## Auto Mode Detection + +```javascript +// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 +const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) +``` + +When `autoYes` is true, skip all interactive confirmations and use defaults throughout the review cycle phases. + ## Mode Detection ```javascript @@ -56,6 +65,7 @@ Skill(skill="review-cycle", args="WFS-payment-integration") Skill(skill="review-cycle", args="") # Session: auto-detect Skill(skill="review-cycle", args="--fix .workflow/active/WFS-123/.review/") # Fix mode Skill(skill="review-cycle", args="--fix --resume") # Fix: resume +Skill(skill="review-cycle", args="-y src/auth/**") # Auto mode (skip confirmations) # Common flags (all modes): --dimensions=dim1,dim2,... Custom dimensions (default: all 7) diff --git a/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md b/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md index c357bc8d..705d3948 100644 --- a/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md +++ b/.claude/skills/team-quality-assurance/roles/coordinator/commands/monitor.md @@ -57,7 +57,7 @@ const SLEEP_CMD = process.platform === 'win32' : `sleep ${POLL_INTERVAL_SEC}` // ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 -const autoMode = /\b(-y|--yes)\b/.test(args) +const autoYes = /\b(-y|--yes)\b/.test(args) ``` ## Execution Steps @@ -123,7 +123,7 @@ for (const stageTask of pipelineTasks) { if (!stageComplete) { const elapsedMin = Math.round(pollCount * POLL_INTERVAL_SEC / 60) - if (autoMode) { + if (autoYes) { // 自动模式:记录日志,自动跳过 mcp__ccw-tools__team_msg({ operation: "log", team: teamName, from: "coordinator", @@ -286,7 +286,7 @@ const summary = { |----------|------------| | Message bus unavailable | Fall back to TaskList polling only | | Stage timeout (交互模式) | AskUserQuestion:继续等待 / 跳过 / 终止流水线 | -| Stage timeout (自动模式 `-y`/`--yes`) | 自动跳过,记录日志,继续流水线 | +| Stage timeout (自动模式 `-y`/`--yes`,`autoYes`) | 自动跳过,记录日志,继续流水线 | | Teammate unresponsive (2x no response) | Respawn teammate with same task | | Deadlock detected (tasks blocked indefinitely) | Identify cycle, manually unblock | | Quality gate FAIL | Report to user, suggest targeted re-run | diff --git a/.claude/skills/workflow-execute/SKILL.md b/.claude/skills/workflow-execute/SKILL.md index a8ddb016..de371525 100644 --- a/.claude/skills/workflow-execute/SKILL.md +++ b/.claude/skills/workflow-execute/SKILL.md @@ -41,7 +41,8 @@ When `--with-commit` flag is used: **Flag Parsing**: ```javascript -const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 +const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) const withCommit = $ARGUMENTS.includes('--with-commit') ``` @@ -170,7 +171,8 @@ bash(for dir in .workflow/active/WFS-*/; do [ -d "$dir" ] || continue; session=$ **Parse --yes flag**: ```javascript -const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 +const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) ``` **Conditional Selection**: @@ -324,7 +326,8 @@ while (TODO_LIST.md has pending tasks) { ```javascript // Parse --yes flag -const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y') +// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 +const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) if (autoYes) { // Auto mode: Complete session automatically diff --git a/.claude/skills/workflow-multi-cli-plan/SKILL.md b/.claude/skills/workflow-multi-cli-plan/SKILL.md index 73a85a14..d9b959a9 100644 --- a/.claude/skills/workflow-multi-cli-plan/SKILL.md +++ b/.claude/skills/workflow-multi-cli-plan/SKILL.md @@ -49,7 +49,13 @@ function detectMode() { Before dispatching, collect workflow preferences via AskUserQuestion: ```javascript -if (mode === 'plan') { +// ★ 统一 auto mode 检测:-y/--yes 从 $ARGUMENTS 或 ccw 传播 +const autoYes = /\b(-y|--yes)\b/.test($ARGUMENTS) + +if (autoYes) { + // 自动模式:跳过所有询问,使用默认值 + workflowPreferences = { autoYes: true } +} else if (mode === 'plan') { const prefResponse = AskUserQuestion({ questions: [ {