mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
feat: initialize monorepo with package.json for CCW workflow platform
This commit is contained in:
292
ccw/docs-site/docs/commands/general/ccw-coordinator.mdx
Normal file
292
ccw/docs-site/docs/commands/general/ccw-coordinator.mdx
Normal file
@@ -0,0 +1,292 @@
|
||||
---
|
||||
title: /ccw-coordinator
|
||||
sidebar_label: /ccw-coordinator
|
||||
sidebar_position: 4
|
||||
description: Generic command orchestration tool for CCW workflows
|
||||
---
|
||||
|
||||
# /ccw-coordinator
|
||||
|
||||
Generic command orchestration tool - analyzes requirements, recommends command chains, and executes sequentially with state persistence.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/ccw-coordinator` command is a generic orchestrator that can handle any CCW workflow by analyzing task requirements and recommending optimal command chains.
|
||||
|
||||
**Parameters**:
|
||||
- `[task description]`: Task to orchestrate (required)
|
||||
|
||||
**Execution Model**: Pseudocode guidance - Claude intelligently executes each phase based on context.
|
||||
|
||||
## Core Concept: Minimum Execution Units
|
||||
|
||||
**Definition**: Commands that must execute together as an atomic group to achieve meaningful workflow milestones.
|
||||
|
||||
### Examples of Execution Units
|
||||
|
||||
| Unit Name | Commands | Purpose |
|
||||
|-----------|----------|---------|
|
||||
| **Quick Implementation** | `/workflow:lite-plan` → `/workflow:lite-execute` | Lightweight plan and execution |
|
||||
| **Multi-CLI Planning** | `/workflow:multi-cli-plan` → `/workflow:lite-execute` | Multi-perspective analysis |
|
||||
| **Bug Fix** | `/workflow:lite-fix` → `/workflow:lite-execute` | Bug diagnosis and fix |
|
||||
| **Verified Planning** | `/workflow:plan` → `/workflow:plan-verify` → `/workflow:execute` | Planning with verification |
|
||||
| **TDD Planning** | `/workflow:tdd-plan` → `/workflow:execute` | Test-driven development |
|
||||
|
||||
## Command Port Mapping
|
||||
|
||||
Each workflow command has defined input/output ports for intelligent routing:
|
||||
|
||||
```javascript
|
||||
const commandPorts = {
|
||||
// Planning Commands
|
||||
'lite-plan': {
|
||||
name: 'lite-plan',
|
||||
input: ['task-description'],
|
||||
output: ['memory-plan'],
|
||||
tags: ['planning', 'lite']
|
||||
},
|
||||
'plan': {
|
||||
name: 'plan',
|
||||
input: ['task-description', 'brainstorm-artifacts'],
|
||||
output: ['impl-plan', 'tasks-json'],
|
||||
tags: ['planning', 'full']
|
||||
},
|
||||
'multi-cli-plan': {
|
||||
name: 'multi-cli-plan',
|
||||
input: ['decision-topic'],
|
||||
output: ['comparison-report', 'recommendation'],
|
||||
tags: ['planning', 'multi-cli', 'analysis']
|
||||
},
|
||||
// ... more commands
|
||||
};
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Let coordinator analyze and recommend
|
||||
/ccw-coordinator "Implement user authentication"
|
||||
|
||||
# The coordinator will:
|
||||
# 1. Analyze task requirements
|
||||
# 2. Recommend optimal command chain
|
||||
# 3. Execute commands sequentially
|
||||
# 4. Track state throughout
|
||||
```
|
||||
|
||||
## Execution Flow
|
||||
|
||||
### Phase 1: Analyze Requirements
|
||||
|
||||
```javascript
|
||||
async function analyzeRequirements(taskDescription) {
|
||||
const analysis = {
|
||||
goal: extractGoal(taskDescription),
|
||||
scope: determineScope(taskDescription),
|
||||
complexity: calculateComplexity(taskDescription),
|
||||
task_type: classifyTask(taskDescription),
|
||||
constraints: identifyConstraints(taskDescription)
|
||||
};
|
||||
return analysis;
|
||||
}
|
||||
```
|
||||
|
||||
**Output**:
|
||||
- Goal: What needs to be accomplished
|
||||
- Scope: Affected modules/components
|
||||
- Complexity: simple/medium/complex
|
||||
- Task type: feature, bugfix, refactor, etc.
|
||||
- Constraints: Time, resources, dependencies
|
||||
|
||||
### Phase 2: Recommend Command Chain
|
||||
|
||||
```javascript
|
||||
async function recommendCommandChain(analysis) {
|
||||
const { inputPort, outputPort } = determinePortFlow(analysis.task_type, analysis.constraints);
|
||||
const chain = selectChainByPorts(inputPort, outputPort, analysis);
|
||||
return chain;
|
||||
}
|
||||
```
|
||||
|
||||
**Output**:
|
||||
- Selected workflow level
|
||||
- Command chain with units
|
||||
- Execution mode (mainprocess/async)
|
||||
- Expected artifacts
|
||||
|
||||
### Phase 3: User Confirmation
|
||||
|
||||
```javascript
|
||||
async function getUserConfirmation(chain) {
|
||||
const response = await AskUserQuestion({
|
||||
questions: [{
|
||||
question: 'Proceed with this command chain?',
|
||||
header: 'Confirm',
|
||||
options: [
|
||||
{ label: 'Confirm and execute', description: 'Proceed with commands' },
|
||||
{ label: 'Show details', description: 'View each command' },
|
||||
{ label: 'Adjust chain', description: 'Remove or reorder' },
|
||||
{ label: 'Cancel', description: 'Abort' }
|
||||
]
|
||||
}]
|
||||
});
|
||||
return response;
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 4: Execute Sequential Command Chain
|
||||
|
||||
```javascript
|
||||
async function executeCommandChain(chain, analysis) {
|
||||
const sessionId = `ccw-coord-${Date.now()}`;
|
||||
const state = {
|
||||
session_id: sessionId,
|
||||
status: 'running',
|
||||
analysis: analysis,
|
||||
command_chain: chain.map((cmd, idx) => ({ ...cmd, index: idx, status: 'pending' })),
|
||||
execution_results: []
|
||||
};
|
||||
|
||||
// Save initial state
|
||||
Write(`.workflow/.ccw-coordinator/${sessionId}/state.json`, JSON.stringify(state, null, 2));
|
||||
|
||||
for (let i = 0; i < chain.length; i++) {
|
||||
const cmd = chain[i];
|
||||
console.log(`[${i+1}/${chain.length}] Executing: ${cmd.command}`);
|
||||
|
||||
// Update status to running
|
||||
state.command_chain[i].status = 'running';
|
||||
Write(`.workflow/.ccw-coordinator/${sessionId}/state.json`, JSON.stringify(state, null, 2));
|
||||
|
||||
// Execute command via CLI
|
||||
const taskId = Bash(
|
||||
`ccw cli -p "${escapePrompt(prompt)}" --tool claude --mode write`,
|
||||
{ run_in_background: true }
|
||||
).task_id;
|
||||
|
||||
// Save execution record
|
||||
state.execution_results.push({
|
||||
index: i,
|
||||
command: cmd.command,
|
||||
status: 'in-progress',
|
||||
task_id: taskId,
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
```
|
||||
|
||||
## Command Chain Examples
|
||||
|
||||
### Quick Implementation Unit
|
||||
|
||||
```javascript
|
||||
// Commands: 2 | Units: 1 (quick-impl)
|
||||
const quickImplChain = [
|
||||
{
|
||||
command: '/workflow:lite-plan',
|
||||
args: '"{{goal}}"',
|
||||
unit: 'quick-impl',
|
||||
execution: { type: 'slash-command', mode: 'mainprocess' }
|
||||
},
|
||||
{
|
||||
command: '/workflow:lite-execute',
|
||||
args: '--in-memory',
|
||||
unit: 'quick-impl',
|
||||
execution: { type: 'slash-command', mode: 'async' }
|
||||
}
|
||||
];
|
||||
```
|
||||
|
||||
### Verified Planning Unit
|
||||
|
||||
```javascript
|
||||
// Commands: 3 | Units: 1 (verified-planning-execution)
|
||||
const verifiedChain = [
|
||||
{
|
||||
command: '/workflow:plan',
|
||||
args: '"{{goal}}"',
|
||||
unit: 'verified-planning-execution',
|
||||
execution: { type: 'slash-command', mode: 'mainprocess' }
|
||||
},
|
||||
{
|
||||
command: '/workflow:plan-verify',
|
||||
args: '',
|
||||
unit: 'verified-planning-execution',
|
||||
execution: { type: 'slash-command', mode: 'mainprocess' }
|
||||
},
|
||||
{
|
||||
command: '/workflow:execute',
|
||||
args: '--resume-session="{{session}}"',
|
||||
unit: 'verified-planning-execution',
|
||||
execution: { type: 'slash-command', mode: 'mainprocess' }
|
||||
}
|
||||
];
|
||||
```
|
||||
|
||||
## Parameter Patterns
|
||||
|
||||
| Command Type | Parameter Pattern | Example |
|
||||
|--------------|------------------|---------|
|
||||
| **Planning** | `"task description"` | `/workflow:plan -y "Implement OAuth2"` |
|
||||
| **Execution (with plan)** | `--resume-session="WFS-xxx"` | `/workflow:execute -y --resume-session="WFS-plan-001"` |
|
||||
| **Execution (standalone)** | `--in-memory` or `"task"` | `/workflow:lite-execute -y --in-memory` |
|
||||
| **Session-based** | `--session="WFS-xxx"` | `/workflow:test-fix-gen -y --session="WFS-impl-001"` |
|
||||
| **Fix/Debug** | `"problem description"` | `/workflow:lite-fix -y "Fix timeout bug"` |
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple Feature
|
||||
|
||||
```bash
|
||||
/ccw-coordinator "Add user profile page"
|
||||
|
||||
# Output:
|
||||
# Analyzing: "Add user profile page"
|
||||
# Complexity: Low (score: 1)
|
||||
# Recommended: Level 2 - Rapid Workflow
|
||||
# Command chain:
|
||||
# Unit: quick-impl
|
||||
# 1. /workflow:lite-plan "Add user profile page"
|
||||
# 2. /workflow:lite-execute --in-memory
|
||||
# Confirm? (y/n): y
|
||||
#
|
||||
# [1/2] Executing: /workflow:lite-plan
|
||||
# [2/2] Executing: /workflow:lite-execute
|
||||
# ✅ Complete! Session: ccw-coord-1738425600000
|
||||
```
|
||||
|
||||
### Complex Feature
|
||||
|
||||
```bash
|
||||
/ccw-coordinator "Refactor authentication system with OAuth2"
|
||||
|
||||
# Output:
|
||||
# Analyzing: "Refactor authentication system..."
|
||||
# Complexity: High (score: 6)
|
||||
# Recommended: Level 3 - Standard Workflow
|
||||
# Command chain:
|
||||
# Unit: verified-planning-execution
|
||||
# 1. /workflow:plan "Refactor authentication..."
|
||||
# 2. /workflow:plan-verify
|
||||
# 3. /workflow:execute --resume-session="{session}"
|
||||
# Confirm? (y/n): y
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/ccw** - Main workflow coordinator
|
||||
- **/ccw-plan** - Planning coordinator
|
||||
- **/ccw-test** - Test coordinator
|
||||
- **/ccw-debug** - Debug coordinator
|
||||
|
||||
## Notes
|
||||
|
||||
- **Atomic execution** - Never split minimum execution units
|
||||
- **State persistence** - All state saved to `.workflow/.ccw-coordinator/`
|
||||
- **User control** - Confirmation before execution
|
||||
- **Context passing** - Parameters chain across commands
|
||||
- **Resume support** - Can resume from state.json
|
||||
- **Intelligent routing** - Port-based command matching
|
||||
270
ccw/docs-site/docs/commands/general/ccw-debug.mdx
Normal file
270
ccw/docs-site/docs/commands/general/ccw-debug.mdx
Normal file
@@ -0,0 +1,270 @@
|
||||
---
|
||||
title: /ccw-debug
|
||||
sidebar_label: /ccw-debug
|
||||
sidebar_position: 5
|
||||
description: Debug coordinator for intelligent debugging workflows
|
||||
---
|
||||
|
||||
# /ccw-debug
|
||||
|
||||
Debug coordinator - analyzes issues, selects debug strategy, and executes debug workflow in the main process.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/ccw-debug` command orchestrates debugging workflows by analyzing issue descriptions, selecting appropriate debug strategies, and executing targeted command chains.
|
||||
|
||||
**Parameters**:
|
||||
- `--mode <mode>`: Debug mode (cli, debug, test, bidirectional)
|
||||
- `--yes|-y`: Skip confirmation prompts
|
||||
- `"bug description"`: Issue to debug (required)
|
||||
|
||||
**Core Concept**: Debug Units - commands grouped into logical units for different root cause strategies.
|
||||
|
||||
## Features
|
||||
|
||||
- **Issue Analysis** - Extracts symptoms, occurrence patterns, affected components
|
||||
- **Strategy Selection** - Auto-selects based on keywords and complexity
|
||||
- **Debug Units** - 4 debug modes for different scenarios
|
||||
- **Parallel Execution** - Bidirectional mode for complex issues
|
||||
- **State Tracking** - TODO and status file tracking
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Auto-select mode (keyword-based detection)
|
||||
/ccw-debug "Login timeout error"
|
||||
|
||||
# Explicit mode selection
|
||||
/ccw-debug --mode cli "Quick API question"
|
||||
/ccw-debug --mode debug "User authentication fails"
|
||||
/ccw-debug --mode test "Unit tests failing"
|
||||
/ccw-debug --mode bidirectional "Complex multi-module issue"
|
||||
|
||||
# Skip confirmation
|
||||
/ccw-debug --yes "Fix typo in config"
|
||||
```
|
||||
|
||||
## Debug Modes
|
||||
|
||||
### CLI Mode
|
||||
**Use for**: Quick analysis, simple questions, early diagnosis
|
||||
|
||||
**Command Chain**:
|
||||
```
|
||||
ccw cli --mode analysis --rule analysis-diagnose-bug-root-ause
|
||||
```
|
||||
|
||||
**Characteristics**:
|
||||
- Analysis only
|
||||
- No code changes
|
||||
- Returns findings and recommendations
|
||||
|
||||
### Debug Mode
|
||||
**Use for**: Standard bug diagnosis and fix
|
||||
|
||||
**Command Chain**:
|
||||
```
|
||||
/workflow:debug-with-file
|
||||
/workflow:test-fix-gen
|
||||
/workflow:test-cycle-execute
|
||||
```
|
||||
|
||||
**Characteristics**:
|
||||
- Hypothesis-driven debugging
|
||||
- Test generation
|
||||
- Iterative fixing
|
||||
|
||||
### Test Mode
|
||||
**Use for**: Test failures, test validation
|
||||
|
||||
**Command Chain**:
|
||||
```
|
||||
/workflow:test-fix-gen
|
||||
/workflow:test-cycle-execute
|
||||
```
|
||||
|
||||
**Characteristics**:
|
||||
- Test-focused
|
||||
- Fix in testing
|
||||
- Iterative until pass
|
||||
|
||||
### Bidirectional Mode
|
||||
**Use for**: Complex issues requiring multiple perspectives
|
||||
|
||||
**Command Chain** (Parallel):
|
||||
```
|
||||
/workflow:debug-with-file ∥ /workflow:test-fix-gen ∥ /workflow:test-cycle-execute
|
||||
↓
|
||||
Merge findings
|
||||
```
|
||||
|
||||
**Characteristics**:
|
||||
- Parallel execution
|
||||
- Multiple perspectives
|
||||
- Merged findings
|
||||
|
||||
## Debug Units
|
||||
|
||||
| Unit Name | Commands | Purpose |
|
||||
|-----------|----------|---------|
|
||||
| **Quick Analysis** | ccw cli (analysis) | Quick diagnosis |
|
||||
| **Standard Debug** | debug-with-file → test-fix-gen → test-cycle-execute | Full debug cycle |
|
||||
| **Test Fix** | test-fix-gen → test-cycle-execute | Test-focused fix |
|
||||
| **Comprehensive** | (debug ∥ test ∥ test-cycle) → merge | Multi-perspective |
|
||||
|
||||
## Execution Flow
|
||||
|
||||
```
|
||||
User Input: "bug description"
|
||||
↓
|
||||
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
|
||||
↓
|
||||
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
|
||||
├─ Sequential: execute commands in order
|
||||
├─ Bidirectional: execute debug + test in parallel
|
||||
├─ CLI: present findings, ask for escalation
|
||||
└─ Merge findings (bidirectional)
|
||||
↓
|
||||
Update status and TODO
|
||||
```
|
||||
|
||||
## Mode Detection
|
||||
|
||||
| Keywords | Detected Mode |
|
||||
|----------|---------------|
|
||||
| quick, simple, question, what, how | cli |
|
||||
| bug, error, fail, crash, timeout | debug |
|
||||
| test, unit test, coverage, assertion | test |
|
||||
| complex, multiple, module, integration | bidirectional |
|
||||
|
||||
## 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):
|
||||
```bash
|
||||
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]
|
||||
```
|
||||
|
||||
**2. Status File** (Internal State):
|
||||
```json
|
||||
{
|
||||
"session_id": "CCWD-...",
|
||||
"mode": "debug|cli|test|bidirectional",
|
||||
"status": "running",
|
||||
"parallel_execution": false|true,
|
||||
"issue": {
|
||||
"description": "...",
|
||||
"error_type": "...",
|
||||
"clarity": 1-5,
|
||||
"complexity": "low|medium|high"
|
||||
},
|
||||
"command_chain": [...],
|
||||
"findings": {
|
||||
"debug": {...},
|
||||
"test": {...},
|
||||
"merged": {...}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### CLI Mode
|
||||
|
||||
```bash
|
||||
# Quick analysis
|
||||
/ccw-debug --mode cli "Why is the API returning 500?"
|
||||
|
||||
# Output:
|
||||
# Executing CLI analysis...
|
||||
# Analysis complete:
|
||||
# - Root cause: Database connection timeout
|
||||
# - Recommendation: Increase connection pool size
|
||||
# Escalate to debug mode? (y/n): y
|
||||
```
|
||||
|
||||
### Debug Mode
|
||||
|
||||
```bash
|
||||
# Standard debugging
|
||||
/ccw-debug "User login fails intermittently"
|
||||
|
||||
# Output:
|
||||
# Analyzing issue...
|
||||
# Mode detected: debug
|
||||
# Command chain:
|
||||
# 1. /workflow:debug-with-file
|
||||
# 2. /workflow:test-fix-gen
|
||||
# 3. /workflow:test-cycle-execute
|
||||
# Confirm? (y/n): y
|
||||
#
|
||||
# CCWD:debug: [1/3] /workflow:debug-with-file [in_progress]
|
||||
# ...
|
||||
```
|
||||
|
||||
### Bidirectional Mode
|
||||
|
||||
```bash
|
||||
# Complex issue
|
||||
/ccw-debug --mode bidirectional "Multi-module auth + database sync issue"
|
||||
|
||||
# Output:
|
||||
# Analyzing issue...
|
||||
# Mode: bidirectional (parallel execution)
|
||||
# Command chain:
|
||||
# Branch A: /workflow:debug-with-file
|
||||
# Branch B: /workflow:test-fix-gen
|
||||
# Branch C: /workflow:test-cycle-execute
|
||||
# → Merge findings
|
||||
# Confirm? (y/n): y
|
||||
#
|
||||
# Executing branches in parallel...
|
||||
# Merging findings...
|
||||
# Final recommendations: ...
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/workflow:debug-with-file** - Hypothesis-driven debugging
|
||||
- **/workflow:test-fix-gen** - Test fix generation
|
||||
- **/workflow:test-cycle-execute** - Test cycle execution
|
||||
- **/ccw** - Main workflow coordinator
|
||||
|
||||
## Notes
|
||||
|
||||
- **Auto mode detection** based on keywords
|
||||
- **Debug units** ensure complete debugging milestones
|
||||
- **TODO tracking** with CCWD prefix
|
||||
- **Status file** in `.workflow/.ccw-debug/{session}/`
|
||||
- **Parallel execution** for bidirectional mode
|
||||
- **Merge findings** combines multiple perspectives
|
||||
- **Escalation support** from CLI to other modes
|
||||
205
ccw/docs-site/docs/commands/general/ccw-plan.mdx
Normal file
205
ccw/docs-site/docs/commands/general/ccw-plan.mdx
Normal file
@@ -0,0 +1,205 @@
|
||||
---
|
||||
title: /ccw-plan
|
||||
sidebar_label: /ccw-plan
|
||||
sidebar_position: 2
|
||||
description: Planning coordinator for intelligent workflow selection
|
||||
---
|
||||
|
||||
# /ccw-plan
|
||||
|
||||
Planning coordinator - analyzes requirements, selects planning strategy, and executes planning workflow in the main process.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/ccw-plan` command serves as the planning orchestrator, automatically analyzing task requirements and selecting the appropriate planning workflow based on complexity and constraints.
|
||||
|
||||
**Parameters**:
|
||||
- `--mode <mode>`: Planning mode (lite, multi-cli, full, plan-verify, replan, cli, issue, rapid-to-issue, brainstorm-with-file, analyze-with-file)
|
||||
- `--yes|-y`: Skip confirmation prompts
|
||||
- `"task description"`: Task to plan (required)
|
||||
|
||||
## Features
|
||||
|
||||
- **Auto Mode Detection** - Keyword-based mode selection
|
||||
- **Planning Units** - Commands grouped for complete planning milestones
|
||||
- **Multi-Mode Support** - 10+ planning workflows available
|
||||
- **Issue Integration** - Bridge to issue workflow
|
||||
- **With-File Workflows** - Multi-CLI collaboration support
|
||||
|
||||
## 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"
|
||||
/ccw-plan --mode replan --session WFS-auth-2025-01-28
|
||||
|
||||
# CLI-assisted planning (quick recommendations)
|
||||
/ccw-plan --mode cli "Should we use OAuth2 or JWT?"
|
||||
|
||||
# With-File workflows
|
||||
/ccw-plan --mode brainstorm-with-file "用户通知系统重新设计"
|
||||
/ccw-plan --mode analyze-with-file "认证架构设计决策"
|
||||
|
||||
# Issue workflow integration
|
||||
/ccw-plan --mode issue "Handle all pending security issues"
|
||||
/ccw-plan --mode rapid-to-issue "Plan and create user profile issue"
|
||||
|
||||
# Auto mode (skip confirmations)
|
||||
/ccw-plan --yes "Quick feature: user profile endpoint"
|
||||
```
|
||||
|
||||
## Planning Modes
|
||||
|
||||
### Lite Modes (Level 2)
|
||||
|
||||
| Mode | Description | Use Case |
|
||||
|------|-------------|----------|
|
||||
| `lite` | In-memory planning | Clear requirements, single module |
|
||||
| `multi-cli` | Multi-CLI collaborative | Technology selection, solution comparison |
|
||||
|
||||
### Full Modes (Level 3)
|
||||
|
||||
| Mode | Description | Use Case |
|
||||
|------|-------------|----------|
|
||||
| `full` | 5-phase standard planning | Complex features, multi-module |
|
||||
| `plan-verify` | Planning with quality gate | Production features, high quality required |
|
||||
|
||||
### Special Modes
|
||||
|
||||
| Mode | Description | Use Case |
|
||||
|------|-------------|----------|
|
||||
| `cli` | Quick CLI recommendations | Quick questions, architectural decisions |
|
||||
| `replan` | Modify existing plan | Plan adjustments, scope changes |
|
||||
| `tdd` | Test-driven development planning | TDD workflow |
|
||||
|
||||
### With-File Modes (Level 3-4)
|
||||
|
||||
| Mode | Description | Multi-CLI |
|
||||
|------|-------------|-----------|
|
||||
| `brainstorm-with-file` | Multi-perspective ideation | Yes |
|
||||
| `analyze-with-file` | Collaborative analysis | Yes |
|
||||
|
||||
### Issue Modes
|
||||
|
||||
| Mode | Description | Use Case |
|
||||
|------|-------------|----------|
|
||||
| `issue` | Batch issue planning | Handle multiple issues |
|
||||
| `rapid-to-issue` | Plan + create issue | Bridge planning to issue tracking |
|
||||
|
||||
## Planning Units
|
||||
|
||||
| Unit Name | Commands | Purpose |
|
||||
|-----------|----------|---------|
|
||||
| **Quick Planning** | lite-plan → lite-execute | Lightweight plan and execution |
|
||||
| **Multi-CLI Planning** | multi-cli-plan → lite-execute | Multi-perspective analysis |
|
||||
| **Verified Planning** | plan → plan-verify → execute | Planning with verification |
|
||||
| **TDD Planning** | tdd-plan → execute | Test-driven development |
|
||||
| **Issue Planning** | issue:discover → issue:plan → issue:queue → issue:execute | Issue workflow |
|
||||
| **Brainstorm to Issue** | brainstorm:auto-parallel → issue:from-brainstorm → issue:queue | Exploration to issues |
|
||||
|
||||
## Mode Selection Decision Tree
|
||||
|
||||
```
|
||||
User calls: /ccw-plan "task description"
|
||||
↓
|
||||
Explicit --mode specified?
|
||||
├─ Yes → Use specified mode
|
||||
└─ No → Detect keywords
|
||||
├─ "brainstorm" → brainstorm-with-file
|
||||
├─ "analyze" → analyze-with-file
|
||||
├─ "test", "tdd" → tdd
|
||||
├─ "issue" → issue or rapid-to-issue
|
||||
├─ Complexity high → full or plan-verify
|
||||
└─ Default → lite
|
||||
```
|
||||
|
||||
## Execution Flow
|
||||
|
||||
```
|
||||
User Input
|
||||
↓
|
||||
Phase 1: Analyze Requirements
|
||||
├─ Extract: goal, scope, complexity, constraints
|
||||
└─ Detect: task type, keywords
|
||||
↓
|
||||
Phase 2: Select Mode & Build Chain
|
||||
├─ Detect mode (explicit or auto)
|
||||
├─ Build command chain based on mode
|
||||
└─ Show planning strategy
|
||||
↓
|
||||
Phase 3: User Confirmation (optional)
|
||||
├─ Show command chain
|
||||
└─ Allow mode change
|
||||
↓
|
||||
Phase 4: Execute Planning Chain
|
||||
├─ Setup TODO tracking (CCWP prefix)
|
||||
├─ Initialize status file
|
||||
└─ Execute commands sequentially
|
||||
↓
|
||||
Output completion summary
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Auto Mode Selection
|
||||
|
||||
```bash
|
||||
# CCW detects keywords and selects mode
|
||||
/ccw-plan "Implement user authentication with TDD"
|
||||
|
||||
# Output:
|
||||
# Detecting mode...
|
||||
# Keywords: "TDD" → Mode: tdd
|
||||
# Commands: tdd-plan
|
||||
# Confirm? (y/n): y
|
||||
```
|
||||
|
||||
### Brainstorm Mode
|
||||
|
||||
```bash
|
||||
# Multi-perspective exploration
|
||||
/ccw-plan --mode brainstorm-with-file "Design notification system"
|
||||
|
||||
# Uses brainstorm workflow with multi-CLI collaboration
|
||||
```
|
||||
|
||||
### CLI Quick Recommendations
|
||||
|
||||
```bash
|
||||
# Quick architectural question
|
||||
/ccw-plan --mode cli "Should we use Redux or Zustand for state?"
|
||||
|
||||
# Uses CLI for quick analysis and recommendations
|
||||
```
|
||||
|
||||
### Replan Existing Session
|
||||
|
||||
```bash
|
||||
# Modify existing plan
|
||||
/ccw-plan --mode replan --session WFS-auth-2025-01-28
|
||||
|
||||
# Opens existing plan for modification
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/ccw** - Main workflow coordinator
|
||||
- **/ccw-test** - Test workflow coordinator
|
||||
- **/ccw-debug** - Debug workflow coordinator
|
||||
- **/workflow:plan** - Standard planning workflow
|
||||
- **/workflow:tdd-plan** - TDD planning workflow
|
||||
|
||||
## Notes
|
||||
|
||||
- **Keyword detection** for auto mode selection
|
||||
- **Planning units** ensure complete planning milestones
|
||||
- **TODO tracking** with CCWP prefix
|
||||
- **Status file** in `.workflow/.ccw-plan/{session}/`
|
||||
- **Multi-CLI collaboration** for with-file modes
|
||||
- **Issue integration** for seamless workflow transition
|
||||
221
ccw/docs-site/docs/commands/general/ccw-test.mdx
Normal file
221
ccw/docs-site/docs/commands/general/ccw-test.mdx
Normal file
@@ -0,0 +1,221 @@
|
||||
---
|
||||
title: /ccw-test
|
||||
sidebar_label: /ccw-test
|
||||
sidebar_position: 3
|
||||
description: Test workflow coordinator for testing strategies
|
||||
---
|
||||
|
||||
# /ccw-test
|
||||
|
||||
Test workflow coordinator - analyzes testing requirements, selects test strategy, and executes test workflow.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/ccw-test` command serves as the testing orchestrator, automatically analyzing testing requirements and selecting the appropriate test workflow based on the testing context.
|
||||
|
||||
**Parameters**:
|
||||
- `--mode <mode>`: Test mode (test-gen, test-fix-gen, test-cycle-execute, tdd-verify)
|
||||
- `--session <id>`: Resume from existing session
|
||||
- `"test description or session ID"`: Test target
|
||||
|
||||
## Features
|
||||
|
||||
- **Auto Test Mode Detection** - Analyzes context to select appropriate test workflow
|
||||
- **Test Units** - Commands grouped for complete testing milestones
|
||||
- **Progressive Layers** - L0-L3 test requirements
|
||||
- **AI Code Validation** - Detects common AI-generated code issues
|
||||
- **Quality Gates** - Multiple validation checkpoints
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Session mode - test validation for completed implementation
|
||||
/ccw-test WFS-user-auth-v2
|
||||
|
||||
# Prompt mode - text description
|
||||
/ccw-test "Test the user authentication API endpoints"
|
||||
|
||||
# Prompt mode - file reference
|
||||
/ccw-test ./docs/api-requirements.md
|
||||
|
||||
# Explicit mode selection
|
||||
/ccw-test --mode test-gen "Generate comprehensive tests for auth module"
|
||||
/ccw-test --mode test-fix-gen "Test failures in login flow"
|
||||
/ccw-test --mode test-cycle-execute WFS-test-auth
|
||||
```
|
||||
|
||||
## Test Modes
|
||||
|
||||
### Test Generation
|
||||
|
||||
| Mode | Description | Output | Follow-up |
|
||||
|------|-------------|--------|-----------|
|
||||
| `test-gen` | Extensive test generation | test-tasks | `/workflow:execute` |
|
||||
|
||||
**Purpose**: Generate comprehensive test examples and execute tests
|
||||
|
||||
### Test Fix Generation
|
||||
|
||||
| Mode | Description | Output | Follow-up |
|
||||
|------|-------------|--------|-----------|
|
||||
| `test-fix-gen` | Test and fix specific issues | test-tasks | `/workflow:test-cycle-execute` |
|
||||
|
||||
**Purpose**: Generate tests for specific problems and fix in testing
|
||||
|
||||
### Test Cycle Execution
|
||||
|
||||
| Mode | Description | Output | Follow-up |
|
||||
|------|-------------|--------|-----------|
|
||||
| `test-cycle-execute` | Iterative test and fix | test-passed | N/A |
|
||||
|
||||
**Purpose**: Execute test-fix cycle until 95% pass rate
|
||||
|
||||
### TDD Verification
|
||||
|
||||
| Mode | Description | Output |
|
||||
|------|-------------|--------|
|
||||
| `tdd-verify` | Verify TDD compliance | Quality report |
|
||||
|
||||
**Purpose**: Verify Red-Green-Refactor cycle compliance
|
||||
|
||||
## Test Units
|
||||
|
||||
| Unit Name | Commands | Purpose |
|
||||
|-----------|----------|---------|
|
||||
| **Test Generation** | test-gen → execute | Generate and run comprehensive tests |
|
||||
| **Test Fix** | test-fix-gen → test-cycle-execute | Generate tests and fix iteratively |
|
||||
|
||||
## Progressive Test Layers
|
||||
|
||||
| Layer | Description | Components |
|
||||
|-------|-------------|------------|
|
||||
| **L0** | AI code issues | Hallucinated imports, placeholder code, mock leakage |
|
||||
| **L0.5** | Common issues | Edge cases, error handling |
|
||||
| **L1** | Unit tests | Component-level testing |
|
||||
| **L2** | Integration tests | API/database integration |
|
||||
| **L3** | E2E tests | Full workflow testing |
|
||||
|
||||
## Execution Flow
|
||||
|
||||
### Session Mode
|
||||
|
||||
```
|
||||
Session ID Input
|
||||
↓
|
||||
Phase 1: Create Test Session
|
||||
└─ /workflow:session:start --type test
|
||||
└─ Output: testSessionId
|
||||
↓
|
||||
Phase 2: Test Context Gathering
|
||||
└─ /workflow:tools:test-context-gather
|
||||
└─ Output: test-context-package.json
|
||||
↓
|
||||
Phase 3: Test Concept Enhancement
|
||||
└─ /workflow:tools:test-concept-enhanced
|
||||
└─ Output: TEST_ANALYSIS_RESULTS.md (L0-L3 requirements)
|
||||
↓
|
||||
Phase 4: Test Task Generation
|
||||
└─ /workflow:tools:test-task-generate
|
||||
└─ Output: IMPL_PLAN.md, IMPL-*.json (4+ tasks)
|
||||
↓
|
||||
Return summary → Next: /workflow:test-cycle-execute
|
||||
```
|
||||
|
||||
### Prompt Mode
|
||||
|
||||
```
|
||||
Description/File Input
|
||||
↓
|
||||
Phase 1: Create Test Session
|
||||
└─ /workflow:session:start --type test "description"
|
||||
↓
|
||||
Phase 2: Context Gathering
|
||||
└─ /workflow:tools:context-gather
|
||||
↓
|
||||
Phase 3-4: Same as Session Mode
|
||||
```
|
||||
|
||||
## Minimum Task Structure (test-fix-gen)
|
||||
|
||||
| Task | Type | Agent | Purpose |
|
||||
|------|------|-------|---------|
|
||||
| **IMPL-001** | test-gen | @code-developer | Test understanding & generation (L1-L3) |
|
||||
| **IMPL-001.3** | code-validation | @test-fix-agent | Code validation gate (L0 + AI issues) |
|
||||
| **IMPL-001.5** | test-quality-review | @test-fix-agent | Test quality gate |
|
||||
| **IMPL-002** | test-fix | @test-fix-agent | Test execution & fix cycle |
|
||||
|
||||
## Examples
|
||||
|
||||
### Session Mode
|
||||
|
||||
```bash
|
||||
# Test validation for completed implementation
|
||||
/ccw-test WFS-user-auth-v2
|
||||
|
||||
# Output:
|
||||
# Creating test session...
|
||||
# Gathering test context...
|
||||
# Analyzing test coverage...
|
||||
# Generating test tasks...
|
||||
# Created 4 test tasks
|
||||
# Next: /workflow:test-cycle-execute
|
||||
```
|
||||
|
||||
### Prompt Mode
|
||||
|
||||
```bash
|
||||
# Test specific functionality
|
||||
/ccw-test "Test the user authentication API endpoints in src/auth/api.ts"
|
||||
|
||||
# Generates tests for specific module
|
||||
```
|
||||
|
||||
### Test Fix for Failures
|
||||
|
||||
```bash
|
||||
# Fix failing tests
|
||||
/ccw-test --mode test-fix-gen "Login tests failing with timeout error"
|
||||
|
||||
# Generates tasks to diagnose and fix test failures
|
||||
```
|
||||
|
||||
## AI Code Issue Detection (L0)
|
||||
|
||||
The test workflow automatically detects common AI-generated code problems:
|
||||
|
||||
| Issue Type | Description | Detection |
|
||||
|------------|-------------|-----------|
|
||||
| **Hallucinated Imports** | Imports that don't exist | Static analysis |
|
||||
| **Placeholder Code** | TODO/FIXME in production | Pattern matching |
|
||||
| **Mock Leakage** | Test mocks in production code | Code analysis |
|
||||
| **Incomplete Implementation** | Empty functions/stubs | AST analysis |
|
||||
|
||||
## Quality Gates
|
||||
|
||||
### IMPL-001.3 - Code Validation
|
||||
- Validates L0 requirements (AI code issues)
|
||||
- Checks for hallucinated imports
|
||||
- Detects placeholder code
|
||||
- Ensures no mock leakage
|
||||
|
||||
### IMPL-001.5 - Test Quality
|
||||
- Reviews test coverage
|
||||
- Validates test patterns
|
||||
- Checks assertion quality
|
||||
- Ensures proper error handling
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/workflow:test-fix-gen** - Test fix generation workflow
|
||||
- **/workflow:test-cycle-execute** - Test cycle execution
|
||||
- **/workflow:tdd-plan** - TDD planning workflow
|
||||
- **/workflow:tdd-verify** - TDD verification
|
||||
|
||||
## Notes
|
||||
|
||||
- **Progressive layers** ensure comprehensive testing (L0-L3)
|
||||
- **AI code validation** detects common AI-generated issues
|
||||
- **Quality gates** ensure high test standards
|
||||
- **Iterative fixing** until 95% pass rate
|
||||
- **Project type detection** applies appropriate test templates
|
||||
- **CLI tool preference** supports semantic detection
|
||||
237
ccw/docs-site/docs/commands/general/ccw.mdx
Normal file
237
ccw/docs-site/docs/commands/general/ccw.mdx
Normal file
@@ -0,0 +1,237 @@
|
||||
---
|
||||
title: /ccw
|
||||
sidebar_label: /ccw
|
||||
sidebar_position: 1
|
||||
description: Main CCW workflow coordinator for intelligent command orchestration
|
||||
---
|
||||
|
||||
# /ccw
|
||||
|
||||
Main CCW workflow coordinator - the unified entry point for intelligent command orchestration based on task complexity analysis.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/ccw` command is the primary CCW workflow coordinator that automatically analyzes task requirements, evaluates complexity, and selects the appropriate workflow level and execution path.
|
||||
|
||||
**Core Concept**: Minimum Execution Units - commands grouped into logical units for complete workflow milestones.
|
||||
|
||||
## Features
|
||||
|
||||
- **Auto Complexity Analysis** - Evaluates task based on keywords and context
|
||||
- **Workflow Selection** - Automatically selects optimal workflow level (1-5)
|
||||
- **Unit-Based Orchestration** - Groups commands into Minimum Execution Units
|
||||
- **State Persistence** - Tracks execution state in `.workflow/.ccw-coordinator/`
|
||||
- **Intelligent Routing** - Direct execution vs CLI-based execution
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Let CCW analyze and select workflow
|
||||
/ccw "Implement user authentication"
|
||||
|
||||
# Explicit workflow selection
|
||||
/ccw --workflow rapid "Add logout endpoint"
|
||||
|
||||
# Skip tests
|
||||
/ccw --skip-tests "Quick config fix"
|
||||
|
||||
# Auto-confirm (skip confirmation prompts)
|
||||
/ccw --yes "Simple bug fix"
|
||||
```
|
||||
|
||||
## Command Options
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
| `[task description]` | Task to execute (required) | - |
|
||||
| `--workflow <name>` | Explicit workflow selection | Auto-detected |
|
||||
| `--skip-tests` | Skip test validation unit | false |
|
||||
| `--yes` | Auto-confirm execution | false |
|
||||
|
||||
## Workflow Levels
|
||||
|
||||
The coordinator automatically selects from 5 workflow levels:
|
||||
|
||||
### Level 1: Rapid Execution
|
||||
**Complexity**: Low | **Artifacts**: None | **State**: Stateless
|
||||
|
||||
| Workflow | Description |
|
||||
|----------|-------------|
|
||||
| `lite-lite-lite` | Ultra-lightweight direct execution |
|
||||
|
||||
**Use for**: Quick fixes, simple features, config adjustments
|
||||
|
||||
### Level 2: Lightweight Planning
|
||||
**Complexity**: Low-Medium | **Artifacts**: Memory/Lightweight files
|
||||
|
||||
| Workflow | Description |
|
||||
|----------|-------------|
|
||||
| `rapid` | lite-plan → lite-execute (+ optional test units) |
|
||||
|
||||
**Use for**: Single-module features, bug fixes
|
||||
|
||||
### Level 3: Standard Planning
|
||||
**Complexity**: Medium-High | **Artifacts**: Persistent session files
|
||||
|
||||
| Workflow | Description |
|
||||
|----------|-------------|
|
||||
| `coupled` | plan → plan-verify → execute (+ optional test units) |
|
||||
| `tdd` | tdd-plan → execute → tdd-verify |
|
||||
|
||||
**Use for**: Multi-module changes, refactoring, TDD
|
||||
|
||||
### Level 4: Brainstorming
|
||||
**Complexity**: High | **Artifacts**: Multi-role analysis docs
|
||||
|
||||
| Workflow | Description |
|
||||
|----------|-------------|
|
||||
| `brainstorm` | brainstorm:auto-parallel → plan → execute |
|
||||
|
||||
**Use for**: New feature design, architecture refactoring
|
||||
|
||||
### Level 5: Intelligent Orchestration
|
||||
**Complexity**: All levels | **Artifacts**: Full state persistence
|
||||
|
||||
| Workflow | Description |
|
||||
|----------|-------------|
|
||||
| `full` | ccw-coordinator (auto-analyze & recommend) |
|
||||
|
||||
**Use for**: Complex multi-step workflows, uncertain commands
|
||||
|
||||
## Execution Flow
|
||||
|
||||
```
|
||||
User Input: "task description"
|
||||
↓
|
||||
Phase 1: Complexity Analysis
|
||||
├─ Extract keywords
|
||||
├─ Calculate complexity score
|
||||
└─ Detect constraints
|
||||
↓
|
||||
Phase 2: Workflow Selection
|
||||
├─ Map complexity to level
|
||||
├─ Select workflow
|
||||
└─ Build command chain
|
||||
↓
|
||||
Phase 3: User Confirmation
|
||||
├─ Display selected workflow
|
||||
└─ Show command chain
|
||||
↓
|
||||
Phase 4: Execute Command Chain
|
||||
├─ Setup TODO tracking
|
||||
├─ Execute commands sequentially
|
||||
└─ Track state
|
||||
↓
|
||||
Output completion summary
|
||||
```
|
||||
|
||||
## Complexity Evaluation
|
||||
|
||||
Auto-evaluates complexity based on keywords:
|
||||
|
||||
| Weight | Keywords |
|
||||
|--------|----------|
|
||||
| +2 | refactor, migrate, architect, system |
|
||||
| +2 | multiple, across, all, entire |
|
||||
| +1 | integrate, api, database |
|
||||
| +1 | security, performance, scale |
|
||||
|
||||
**Thresholds**:
|
||||
- **High complexity** (>=4): Level 3-4
|
||||
- **Medium complexity** (2-3): Level 2
|
||||
- **Low complexity** (<2): Level 1
|
||||
|
||||
## Minimum Execution Units
|
||||
|
||||
| Unit Name | Commands | Purpose |
|
||||
|-----------|----------|---------|
|
||||
| **Quick Implementation** | lite-plan → lite-execute | Lightweight plan and execution |
|
||||
| **Multi-CLI Planning** | multi-cli-plan → lite-execute | Multi-perspective analysis |
|
||||
| **Bug Fix** | lite-fix → lite-execute | Bug diagnosis and fix |
|
||||
| **Verified Planning** | plan → plan-verify → execute | Planning with verification |
|
||||
| **TDD Planning** | tdd-plan → execute | Test-driven development |
|
||||
| **Test Validation** | test-fix-gen → test-cycle-execute | Test fix cycle |
|
||||
| **Code Review** | review-session-cycle → review-cycle-fix | Review and fix |
|
||||
|
||||
## Command Chain Examples
|
||||
|
||||
### Rapid Workflow (Level 2)
|
||||
|
||||
```bash
|
||||
# Quick implementation
|
||||
Unit: quick-impl
|
||||
Commands:
|
||||
1. /workflow:lite-plan "Add logout endpoint"
|
||||
2. /workflow:lite-execute --in-memory
|
||||
|
||||
(Optional) Unit: test-validation
|
||||
Commands:
|
||||
3. /workflow:test-fix-gen
|
||||
4. /workflow:test-cycle-execute
|
||||
```
|
||||
|
||||
### Coupled Workflow (Level 3)
|
||||
|
||||
```bash
|
||||
# Verified planning
|
||||
Unit: verified-planning-execution
|
||||
Commands:
|
||||
1. /workflow:plan "Implement OAuth2"
|
||||
2. /workflow:plan-verify
|
||||
3. /workflow:execute
|
||||
|
||||
(Optional) Unit: test-validation
|
||||
Commands:
|
||||
4. /workflow:test-fix-gen
|
||||
5. /workflow:test-cycle-execute
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Auto Workflow Selection
|
||||
|
||||
```bash
|
||||
# CCW analyzes and selects appropriate workflow
|
||||
/ccw "Add user profile page"
|
||||
|
||||
# Output:
|
||||
# Analyzing task...
|
||||
# Complexity: Low (score: 1)
|
||||
# Selected: Level 2 - Rapid Workflow
|
||||
# Commands: lite-plan → lite-execute
|
||||
# Confirm? (y/n): y
|
||||
```
|
||||
|
||||
### Explicit Workflow
|
||||
|
||||
```bash
|
||||
# Force specific workflow
|
||||
/ccw --workflow tdd "Implement authentication with TDD"
|
||||
|
||||
# Uses TDD workflow regardless of complexity
|
||||
```
|
||||
|
||||
### Skip Tests
|
||||
|
||||
```bash
|
||||
# Quick fix without tests
|
||||
/ccw --skip-tests "Fix typo in config"
|
||||
|
||||
# Omits test-validation unit
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/ccw-plan** - Planning coordinator
|
||||
- **/ccw-test** - Test workflow coordinator
|
||||
- **/ccw-coordinator** - Generic command orchestration
|
||||
- **/ccw-debug** - Debug workflow coordinator
|
||||
|
||||
## Notes
|
||||
|
||||
- **Auto-analysis** evaluates task complexity based on keywords
|
||||
- **Workflow levels** map complexity to appropriate execution paths
|
||||
- **Minimum Execution Units** ensure complete workflow milestones
|
||||
- **State persistence** in `.workflow/.ccw-coordinator/{session}/`
|
||||
- **TODO tracking** with CCW prefix for visibility
|
||||
- **CLI execution** runs in background with hook callbacks
|
||||
295
ccw/docs-site/docs/commands/general/codex-coordinator.mdx
Normal file
295
ccw/docs-site/docs/commands/general/codex-coordinator.mdx
Normal file
@@ -0,0 +1,295 @@
|
||||
---
|
||||
title: /codex-coordinator
|
||||
sidebar_label: /codex-coordinator
|
||||
sidebar_position: 7
|
||||
description: Command orchestration tool for Codex workflows
|
||||
---
|
||||
|
||||
# /codex-coordinator
|
||||
|
||||
Command orchestration tool for Codex - analyzes requirements, recommends command chains, and executes sequentially with state persistence.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/codex-coordinator` command is the Codex equivalent of the CCW coordinator, providing intelligent orchestration for Codex-specific workflows.
|
||||
|
||||
**Parameters**:
|
||||
- `TASK="<task description>"`: Task to orchestrate (required)
|
||||
- `--depth=<standard|deep>`: Analysis depth (default: standard)
|
||||
- `--auto-confirm`: Skip user confirmation
|
||||
- `--verbose`: Enable verbose output
|
||||
|
||||
**Execution Model**: Intelligent agent-driven workflow - Claude analyzes each phase and orchestrates command execution.
|
||||
|
||||
## Core Concept: Minimum Execution Units
|
||||
|
||||
**Definition**: Commands that must execute together as an atomic group to achieve meaningful workflow milestones.
|
||||
|
||||
### Available Codex Commands
|
||||
|
||||
| Category | Commands | Purpose |
|
||||
|----------|----------|---------|
|
||||
| **Planning** | lite-plan-a, lite-plan-b, plan-a, plan-b | Various planning approaches |
|
||||
| **Execution** | execute, execute-a, execute-b | Implementation workflows |
|
||||
| **Analysis** | analyze-a, analyze-b | Code analysis |
|
||||
| **Testing** | test-a, test-b | Test generation |
|
||||
| **Brainstorming** | brainstorm-a, brainstorm-with-file, brainstorm-to-cycle | Idea exploration |
|
||||
| **Cleanup** | clean, compact | Code cleanup and memory compaction |
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Basic usage
|
||||
/codex-coordinator TASK="Implement user authentication"
|
||||
|
||||
# With deep analysis
|
||||
/codex-coordinator TASK="Design notification system" --depth=deep
|
||||
|
||||
# Auto-confirm
|
||||
/codex-coordinator TASK="Fix typo in config" --auto-confirm
|
||||
|
||||
# Verbose output
|
||||
/codex-coordinator TASK="Add API endpoint" --verbose
|
||||
```
|
||||
|
||||
## Execution Flow
|
||||
|
||||
### Phase 1: Analyze Requirements
|
||||
|
||||
```javascript
|
||||
async function analyzeRequirements(taskDescription) {
|
||||
const analysis = {
|
||||
goal: extractGoal(taskDescription),
|
||||
scope: determineScope(taskDescription),
|
||||
complexity: calculateComplexity(taskDescription),
|
||||
task_type: classifyTask(taskDescription),
|
||||
constraints: identifyConstraints(taskDescription)
|
||||
};
|
||||
return analysis;
|
||||
}
|
||||
```
|
||||
|
||||
**Output**:
|
||||
- Goal: Primary objective
|
||||
- Scope: Affected modules
|
||||
- Complexity: simple/medium/complex
|
||||
- Task type: feature/bugfix/refactor
|
||||
- Constraints: Dependencies, requirements
|
||||
|
||||
### Phase 2: Recommend Command Chain
|
||||
|
||||
```javascript
|
||||
async function recommendCommandChain(analysis) {
|
||||
const { inputPort, outputPort } = determinePortFlow(analysis.task_type, analysis.complexity);
|
||||
const chain = selectChainByTaskType(analysis);
|
||||
return chain;
|
||||
}
|
||||
```
|
||||
|
||||
**Output**:
|
||||
- Recommended command sequence
|
||||
- Execution parameters
|
||||
- Expected artifacts
|
||||
- Estimated complexity
|
||||
|
||||
### Phase 3: User Confirmation
|
||||
|
||||
```javascript
|
||||
async function getUserConfirmation(chain) {
|
||||
const response = await AskUserQuestion({
|
||||
questions: [{
|
||||
question: 'Proceed with this command chain?',
|
||||
header: 'Confirm Chain',
|
||||
options: [
|
||||
{ label: 'Confirm and execute', description: 'Proceed with commands' },
|
||||
{ label: 'Show details', description: 'View each command' },
|
||||
{ label: 'Adjust chain', description: 'Remove or reorder' },
|
||||
{ label: 'Cancel', description: 'Abort' }
|
||||
]
|
||||
}]
|
||||
});
|
||||
return response;
|
||||
}
|
||||
```
|
||||
|
||||
### Phase 4: Execute Sequential Command Chain
|
||||
|
||||
```javascript
|
||||
async function executeCommandChain(chain, analysis) {
|
||||
const sessionId = `codex-coord-${Date.now()}`;
|
||||
const state = {
|
||||
session_id: sessionId,
|
||||
status: 'running',
|
||||
analysis: analysis,
|
||||
command_chain: chain.map((cmd, idx) => ({ ...cmd, index: idx, status: 'pending' })),
|
||||
execution_results: []
|
||||
};
|
||||
|
||||
// Save initial state
|
||||
Write(`.workflow/.codex-coordinator/${sessionId}/state.json`, JSON.stringify(state, null, 2));
|
||||
|
||||
for (let i = 0; i < chain.length; i++) {
|
||||
const cmd = chain[i];
|
||||
|
||||
// Build command string
|
||||
let commandStr = `@~/.codex/prompts/${cmd.name}.md`;
|
||||
|
||||
// Add parameters
|
||||
if (i > 0 && state.execution_results.length > 0) {
|
||||
const lastResult = state.execution_results[state.execution_results.length - 1];
|
||||
commandStr += ` --resume="${lastResult.session_id || lastResult.artifact}"`;
|
||||
}
|
||||
|
||||
// Add depth for complex tasks
|
||||
if (analysis.complexity === 'complex' && (cmd.name.includes('analyze') || cmd.name.includes('plan'))) {
|
||||
commandStr += ` --depth=deep`;
|
||||
}
|
||||
|
||||
// Add task description for planning commands
|
||||
if (cmd.type === 'planning' && i === 0) {
|
||||
commandStr += ` TASK="${analysis.goal}"`;
|
||||
}
|
||||
|
||||
// Execute command
|
||||
console.log(`Executing: ${commandStr}`);
|
||||
state.execution_results.push({
|
||||
index: i,
|
||||
command: cmd.name,
|
||||
status: 'in-progress',
|
||||
started_at: new Date().toISOString()
|
||||
});
|
||||
|
||||
state.command_chain[i].status = 'completed';
|
||||
state.updated_at = new Date().toISOString();
|
||||
Write(`.workflow/.codex-coordinator/${sessionId}/state.json`, JSON.stringify(state, null, 2));
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
```
|
||||
|
||||
## Command Invocation Format
|
||||
|
||||
**Format**: `@~/.codex/prompts/<command-name>.md <parameters>`
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Planning command
|
||||
@~/.codex/prompts/plan-a.md TASK="Implement OAuth2"
|
||||
|
||||
# Execution with resume
|
||||
@~/.codex/prompts/execute-a.md --resume="session-id"
|
||||
|
||||
# Analysis with depth
|
||||
@~/.codex/prompts/analyze-a.md --depth=deep
|
||||
```
|
||||
|
||||
## Available Codex Workflows
|
||||
|
||||
### Planning Workflows
|
||||
|
||||
| Command | Purpose | Output |
|
||||
|---------|---------|--------|
|
||||
| **lite-plan-a** | Lightweight planning A | Quick plan |
|
||||
| **lite-plan-b** | Lightweight planning B | Alternative quick plan |
|
||||
| **plan-a** | Standard planning A | Detailed plan |
|
||||
| **plan-b** | Standard planning B | Alternative detailed plan |
|
||||
|
||||
### Execution Workflows
|
||||
|
||||
| Command | Purpose | Output |
|
||||
|---------|---------|--------|
|
||||
| **execute** | Standard execution | Implemented code |
|
||||
| **execute-a** | Execution variant A | Implementation A |
|
||||
| **execute-b** | Execution variant B | Implementation B |
|
||||
|
||||
### Analysis Workflows
|
||||
|
||||
| Command | Purpose | Output |
|
||||
|---------|---------|--------|
|
||||
| **analyze-a** | Code analysis A | Analysis report |
|
||||
| **analyze-b** | Code analysis B | Alternative analysis |
|
||||
|
||||
### Testing Workflows
|
||||
|
||||
| Command | Purpose | Output |
|
||||
|---------|---------|--------|
|
||||
| **test-a** | Test generation A | Test suite A |
|
||||
| **test-b** | Test generation B | Test suite B |
|
||||
|
||||
### Brainstorming Workflows
|
||||
|
||||
| Command | Purpose | Output |
|
||||
|---------|---------|--------|
|
||||
| **brainstorm-a** | Brainstorming A | Ideas A |
|
||||
| **brainstorm-with-file** | Documented brainstorm | brainstorm.md |
|
||||
| **brainstorm-to-cycle** | Brainstorm to cycle | Actionable cycle |
|
||||
|
||||
### Cleanup Workflows
|
||||
|
||||
| Command | Purpose | Output |
|
||||
|---------|---------|--------|
|
||||
| **clean** | Code cleanup | Cleaned code |
|
||||
| **compact** | Memory compaction | Compressed state |
|
||||
|
||||
## Examples
|
||||
|
||||
### Simple Feature
|
||||
|
||||
```bash
|
||||
/codex-coordinator TASK="Add user profile page" --auto-confirm
|
||||
|
||||
# Output:
|
||||
# Analyzing: "Add user profile page"
|
||||
# Complexity: Low
|
||||
# Recommended: lite-plan-a → execute
|
||||
# Executing: @~/.codex/prompts/lite-plan-a.md TASK="Add user profile page"
|
||||
# Executing: @~/.codex/prompts/execute.md
|
||||
# ✅ Complete! Session: codex-coord-1738425600000
|
||||
```
|
||||
|
||||
### Complex Feature
|
||||
|
||||
```bash
|
||||
/codex-coordinator TASK="Refactor authentication system" --depth=deep
|
||||
|
||||
# Output:
|
||||
# Analyzing: "Refactor authentication system"
|
||||
# Complexity: High
|
||||
# Recommended: plan-a → execute → test-a
|
||||
# Executing: @~/.codex/prompts/plan-a.md --depth=deep
|
||||
# Executing: @~/.codex/prompts/execute.md
|
||||
# Executing: @~/.codex/prompts/test-a.md
|
||||
# ✅ Complete! Session: codex-coord-1738425600000
|
||||
```
|
||||
|
||||
## Session Management
|
||||
|
||||
### Resume Previous Session
|
||||
|
||||
```bash
|
||||
# Find session
|
||||
ls .workflow/.codex-coordinator/
|
||||
|
||||
# Load state
|
||||
cat .workflow/.codex-coordinator/{session-id}/state.json
|
||||
|
||||
# Resume from last completed command
|
||||
# (Manual continuation based on state)
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/ccw-coordinator** - CCW workflow coordinator
|
||||
- **@~/.codex/prompts/** - Individual Codex commands
|
||||
- **/ccw** - Main CCW workflow coordinator
|
||||
|
||||
## Notes
|
||||
|
||||
- **Agent-driven** workflow - Claude intelligently orchestrates
|
||||
- **State persistence** in `.workflow/.codex-coordinator/`
|
||||
- **Command chaining** with parameter passing
|
||||
- **Resume support** from state files
|
||||
- **Depth control** for analysis complexity
|
||||
- **Auto-confirm** for non-interactive use
|
||||
311
ccw/docs-site/docs/commands/general/flow-create.mdx
Normal file
311
ccw/docs-site/docs/commands/general/flow-create.mdx
Normal file
@@ -0,0 +1,311 @@
|
||||
---
|
||||
title: /flow-create
|
||||
sidebar_label: /flow-create
|
||||
sidebar_position: 6
|
||||
description: Generate workflow templates for flow-coordinator
|
||||
---
|
||||
|
||||
# /flow-create
|
||||
|
||||
Flow template generator - create workflow templates for meta-skill/flow-coordinator with interactive step definition.
|
||||
|
||||
## Overview
|
||||
|
||||
The `/flow-create` command generates workflow templates that can be used by the flow-coordinator skill for executing predefined command chains.
|
||||
|
||||
**Usage**: `/flow-create [template-name] [--output <path>]`
|
||||
|
||||
## Features
|
||||
|
||||
- **Interactive Design** - Guided template creation process
|
||||
- **Complexity Levels** - 4 levels from rapid to full workflows
|
||||
- **Step Definition** - Define workflow steps with commands and parameters
|
||||
- **Command Selection** - Choose from available CCW commands
|
||||
- **Template Validation** - Ensures template structure correctness
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
# Create template with default name
|
||||
/flow-create
|
||||
|
||||
# Create specific template
|
||||
/flow-create bugfix-v2
|
||||
|
||||
# Create with custom output
|
||||
/flow-create my-workflow --output ~/.claude/skills/my-skill/templates/
|
||||
```
|
||||
|
||||
## Execution Flow
|
||||
|
||||
```
|
||||
User Input → Phase 1: Template Design → Phase 2: Step Definition → Phase 3: Generate JSON
|
||||
↓ ↓ ↓
|
||||
Name + Description Define workflow steps Write template file
|
||||
```
|
||||
|
||||
## Phase 1: Template Design
|
||||
|
||||
Gather basic template information:
|
||||
|
||||
- **Template Name** - Identifier for the template
|
||||
- **Purpose** - What the template accomplishes
|
||||
- **Complexity Level** - 1-4 (Rapid to Full)
|
||||
|
||||
### Complexity Levels
|
||||
|
||||
| Level | Name | Steps | Description |
|
||||
|-------|------|-------|-------------|
|
||||
| **1** | Rapid | 1-2 | Ultra-lightweight (lite-lite-lite) |
|
||||
| **2** | Lightweight | 2-4 | Quick implementation |
|
||||
| **3** | Standard | 4-6 | With verification and testing |
|
||||
| **4** | Full | 6+ | Brainstorm + full workflow |
|
||||
|
||||
### Purpose Categories
|
||||
|
||||
- **Bug Fix** - Fix bugs and issues
|
||||
- **Feature** - Implement new features
|
||||
- **Generation** - Generate code or content
|
||||
- **Analysis** - Analyze code or architecture
|
||||
- **Transformation** - Transform or refactor code
|
||||
- **Orchestration** - Complex multi-step workflows
|
||||
|
||||
## Phase 2: Step Definition
|
||||
|
||||
Define workflow steps with:
|
||||
|
||||
1. **Command Selection** - Choose from available CCW commands
|
||||
2. **Execution Unit** - Group related steps
|
||||
3. **Execution Mode** - mainprocess or async
|
||||
4. **Context Hint** - Description of step purpose
|
||||
|
||||
### Command Categories
|
||||
|
||||
- **Planning** - plan, lite-plan, multi-cli-plan, tdd-plan
|
||||
- **Execution** - execute, lite-execute, lite-lite-lite
|
||||
- **Testing** - test-fix-gen, test-cycle-execute, tdd-verify
|
||||
- **Review** - review-session-cycle, review-module-cycle
|
||||
- **Debug** - debug-with-file, lite-fix
|
||||
- **Brainstorm** - brainstorm:auto-parallel, brainstorm-with-file
|
||||
- **Issue** - issue:discover, issue:plan, issue:queue, issue:execute
|
||||
|
||||
## Phase 3: Generate JSON
|
||||
|
||||
Creates template file with structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "template-name",
|
||||
"description": "Template description",
|
||||
"level": 2,
|
||||
"steps": [
|
||||
{
|
||||
"cmd": "/workflow:command",
|
||||
"args": "\"{{goal}}\"",
|
||||
"unit": "unit-name",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Description of what this step does"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Template Examples
|
||||
|
||||
### Bug Fix Template (Level 2)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "hotfix-simple",
|
||||
"description": "Quick bug fix workflow",
|
||||
"level": 2,
|
||||
"steps": [
|
||||
{
|
||||
"cmd": "/workflow:lite-fix",
|
||||
"args": "\"{{goal}}\"",
|
||||
"unit": "bug-fix",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Diagnose and fix the bug"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:lite-execute",
|
||||
"args": "--in-memory",
|
||||
"unit": "bug-fix",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "async"
|
||||
},
|
||||
"contextHint": "Apply the fix"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Feature Template (Level 3)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "feature-standard",
|
||||
"description": "Standard feature implementation with verification",
|
||||
"level": 3,
|
||||
"steps": [
|
||||
{
|
||||
"cmd": "/workflow:plan",
|
||||
"args": "\"{{goal}}\"",
|
||||
"unit": "verified-planning",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Create detailed implementation plan"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:plan-verify",
|
||||
"args": "",
|
||||
"unit": "verified-planning",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Verify plan completeness and quality"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:execute",
|
||||
"args": "--resume-session=\"{{session}}\"",
|
||||
"unit": "verified-planning",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Execute the implementation plan"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Full Workflow Template (Level 4)
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "full",
|
||||
"description": "Comprehensive workflow with brainstorm and verification",
|
||||
"level": 4,
|
||||
"steps": [
|
||||
{
|
||||
"cmd": "/workflow:brainstorm:auto-parallel",
|
||||
"args": "\"{{goal}}\"",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Multi-perspective exploration of requirements"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:plan",
|
||||
"unit": "verified-planning-execution",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Create detailed implementation plan"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:plan-verify",
|
||||
"unit": "verified-planning-execution",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Verify plan completeness"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:execute",
|
||||
"unit": "verified-planning-execution",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Execute implementation"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:test-fix-gen",
|
||||
"unit": "test-validation",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Generate tests"
|
||||
},
|
||||
{
|
||||
"cmd": "/workflow:test-cycle-execute",
|
||||
"unit": "test-validation",
|
||||
"execution": {
|
||||
"type": "slash-command",
|
||||
"mode": "mainprocess"
|
||||
},
|
||||
"contextHint": "Execute test-fix cycle"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Execution Mode Types
|
||||
|
||||
| Mode | Description | Use Case |
|
||||
|------|-------------|----------|
|
||||
| **mainprocess** | Execute in main process | Sequential execution, state sharing |
|
||||
| **async** | Execute asynchronously | Parallel execution, independent steps |
|
||||
|
||||
## Template Output Location
|
||||
|
||||
Default: `~/.claude/skills/flow-coordinator/templates/{name}.json`
|
||||
|
||||
Custom: Use `--output` to specify alternative location
|
||||
|
||||
## Examples
|
||||
|
||||
### Quick Bug Fix Template
|
||||
|
||||
```bash
|
||||
/flow-create hotfix-simple
|
||||
|
||||
# Interactive prompts:
|
||||
# Purpose: Bug Fix
|
||||
# Level: 2 (Lightweight)
|
||||
# Steps: Use Suggested
|
||||
# Output: ~/.claude/skills/flow-coordinator/templates/hotfix-simple.json
|
||||
```
|
||||
|
||||
### Custom Multi-Stage Workflow
|
||||
|
||||
```bash
|
||||
/flow-create complex-feature --output ~/.claude/skills/my-project/templates/
|
||||
|
||||
# Interactive prompts:
|
||||
# Name: complex-feature
|
||||
# Purpose: Feature
|
||||
# Level: 4 (Full)
|
||||
# Steps: Custom definition
|
||||
# Output: ~/.claude/skills/my-project/templates/complex-feature.json
|
||||
```
|
||||
|
||||
## Related Commands
|
||||
|
||||
- **/flow-coordinator** - Execute workflow templates
|
||||
- **/ccw-coordinator** - Generic command orchestration
|
||||
- **Skill:flow-coordinator** - Flow coordinator skill
|
||||
|
||||
## Notes
|
||||
|
||||
- **Interactive design** process with guided prompts
|
||||
- **Complexity levels** determine workflow depth
|
||||
- **Execution units** group related steps
|
||||
- **Template validation** ensures correctness
|
||||
- **Custom output** supported via `--output` parameter
|
||||
- **Existing templates** can be used as examples
|
||||
Reference in New Issue
Block a user