feat: Enhance CCW help system with new command orchestration and dashboard features

This commit is contained in:
catlog22
2026-01-29 15:43:07 +08:00
parent 9762445876
commit 86d5be8288
3 changed files with 497 additions and 11 deletions

367
.claude/commands/view.md Normal file
View File

@@ -0,0 +1,367 @@
---
name: ccw view
description: Dashboard - Open CCW workflow dashboard for managing tasks and sessions
category: general
---
# CCW View Command
Open the CCW workflow dashboard for visualizing and managing project tasks, sessions, and workflow execution status.
## Description
`ccw view` launches an interactive web dashboard that provides:
- **Workflow Overview**: Visualize current workflow status and command chain execution
- **Session Management**: View and manage active workflow sessions
- **Task Tracking**: Monitor TODO items and task progress
- **Workspace Switching**: Switch between different project workspaces
- **Real-time Updates**: Live updates of command execution and status
## Usage
```bash
# Open dashboard for current workspace
ccw view
# Specify workspace path
ccw view --path /path/to/workspace
# Custom port (default: 3456)
ccw view --port 3000
# Bind to specific host
ccw view --host 0.0.0.0 --port 3456
# Open without launching browser
ccw view --no-browser
# Show URL without opening browser
ccw view --no-browser
```
## Options
| Option | Default | Description |
|--------|---------|-------------|
| `--path <path>` | Current directory | Workspace path to display |
| `--port <port>` | 3456 | Server port for dashboard |
| `--host <host>` | 127.0.0.1 | Server host/bind address |
| `--no-browser` | false | Don't launch browser automatically |
| `-h, --help` | - | Show help message |
## Features
### Dashboard Sections
#### 1. **Workflow Overview**
- Current workflow status
- Command chain visualization (with Minimum Execution Units marked)
- Live progress tracking
- Error alerts
#### 2. **Session Management**
- List active sessions by type (workflow, review, tdd)
- Session details (created time, last activity, session ID)
- Quick actions (resume, pause, complete)
- Session logs/history
#### 3. **Task Tracking**
- TODO list with status indicators
- Progress percentage
- Task grouping by workflow stage
- Quick inline task updates
#### 4. **Workspace Switcher**
- Browse available workspaces
- Switch context with one click
- Recent workspaces list
#### 5. **Command History**
- Recent commands executed
- Execution time and status
- Quick re-run options
### Keyboard Shortcuts
| Shortcut | Action |
|----------|--------|
| `R` | Refresh dashboard |
| `Cmd/Ctrl + J` | Jump to session search |
| `Cmd/Ctrl + K` | Open command palette |
| `?` | Show help |
## Multi-Instance Support
The dashboard supports multiple concurrent instances:
```bash
# Terminal 1: Workspace A on port 3456
ccw view --path ~/projects/workspace-a
# Terminal 2: Workspace B on port 3457
ccw view --path ~/projects/workspace-b --port 3457
# Switching workspaces on the same port
ccw view --path ~/projects/workspace-c # Auto-switches existing server
```
When the server is already running and you execute `ccw view` with a different path:
1. Detects running server on the port
2. Sends workspace switch request
3. Updates dashboard to new workspace
4. Opens browser with updated context
## Server Lifecycle
### Startup
```
ccw view
├─ Check if server running on port
│ ├─ If yes: Send switch-path request
│ └─ If no: Start new server
├─ Launch browser (unless --no-browser)
└─ Display dashboard URL
```
### Running
The dashboard server continues running until:
- User explicitly stops it (Ctrl+C)
- All connections close after timeout
- System shutdown
### Multiple Workspaces
Switching to a different workspace keeps the same server instance:
```
Server State Before: workspace-a on port 3456
ccw view --path ~/projects/workspace-b
Server State After: workspace-b on port 3456 (same instance)
```
## Environment Variables
```bash
# Set default port
export CCW_VIEW_PORT=4000
ccw view # Uses port 4000
# Set default host
export CCW_VIEW_HOST=localhost
ccw view --port 3456 # Binds to localhost:3456
# Disable browser launch by default
export CCW_VIEW_NO_BROWSER=true
ccw view # Won't auto-launch browser
```
## Integration with CCW Workflows
The dashboard is fully integrated with CCW commands:
### Viewing Workflow Progress
```bash
# Start a workflow
ccw "Add user authentication"
# In another terminal, view progress
ccw view # Shows execution progress in real-time
```
### Session Management from Dashboard
- Start new session: Click "New Session" button
- Resume paused session: Sessions list → Resume button
- View session logs: Click session name
- Complete session: Sessions list → Complete button
### Real-time Command Execution
- View active command chain execution
- Watch command transition through Minimum Execution Units
- See error alerts and recovery options
- View command output logs
## Troubleshooting
### Port Already in Use
```bash
# Use different port
ccw view --port 3457
# Or kill existing server
lsof -i :3456 # Find process
kill -9 <pid> # Kill it
ccw view # Start fresh
```
### Dashboard Not Loading
```bash
# Try without browser
ccw view --no-browser
# Check server logs
tail -f ~/.ccw/logs/dashboard.log
# Verify network access
curl http://localhost:3456/api/health
```
### Workspace Path Not Found
```bash
# Use full absolute path
ccw view --path "$(pwd)"
# Or specify explicit path
ccw view --path ~/projects/my-project
```
## Related Commands
- **`/ccw`** - Main workflow orchestrator
- **`/workflow:session:list`** - List workflow sessions
- **`/workflow:session:resume`** - Resume paused session
- **`/memory:compact`** - Compact session memory for dashboard display
## Examples
### Basic Dashboard View
```bash
cd ~/projects/my-app
ccw view
# → Launches http://localhost:3456 in browser
```
### Network-Accessible Dashboard
```bash
# Allow remote access
ccw view --host 0.0.0.0 --port 3000
# → Dashboard accessible at http://machine-ip:3000
```
### Multiple Workspaces on Different Ports
```bash
# Terminal 1: Main project
ccw view --path ~/projects/main --port 3456
# Terminal 2: Side project
ccw view --path ~/projects/side --port 3457
# View both simultaneously
# → http://localhost:3456 (main)
# → http://localhost:3457 (side)
```
### Headless Dashboard
```bash
# Run dashboard without browser
ccw view --port 3000 --no-browser
echo "Dashboard available at http://localhost:3000"
# Share URL with team
# Can be proxied through nginx/port forwarding
```
### Environment-Based Configuration
```bash
# Script for CI/CD
export CCW_VIEW_HOST=0.0.0.0
export CCW_VIEW_PORT=8080
ccw view --path /workspace
# → Dashboard accessible on port 8080 to all interfaces
```
## Dashboard Pages
### Overview Page (`/`)
- Current workflow status
- Active sessions summary
- Recent commands
- System health indicators
### Sessions Page (`/sessions`)
- All sessions (grouped by type)
- Session details and metadata
- Session logs viewer
- Quick actions (resume/complete)
### Tasks Page (`/tasks`)
- Current TODO items
- Progress tracking
- Inline task editing
- Workflow history
### Workspace Page (`/workspace`)
- Current workspace info
- Available workspaces
- Workspace switcher
- Workspace settings
### Settings Page (`/settings`)
- Port configuration
- Theme preferences
- Auto-refresh settings
- Export settings
## Server Health Monitoring
The dashboard includes health monitoring:
```bash
# Check health endpoint
curl http://localhost:3456/api/health
# → { "status": "ok", "uptime": 12345 }
# Monitor metrics
curl http://localhost:3456/api/metrics
# → { "sessions": 3, "tasks": 15, "lastUpdate": "2025-01-29T10:30:00Z" }
```
## Advanced Usage
### Custom Port with Dynamic Discovery
```bash
# Find next available port
available_port=$(find-available-port 3456)
ccw view --port $available_port
# Display in CI/CD
echo "Dashboard: http://localhost:$available_port"
```
### Dashboard Behind Proxy
```bash
# Configure nginx reverse proxy
# Proxy http://proxy.example.com/dashboard → http://localhost:3456
ccw view --host 127.0.0.1 --port 3456
# Access via proxy
# http://proxy.example.com/dashboard
```
### Session Export from Dashboard
- View → Sessions → Export JSON
- Exports session metadata and progress
- Useful for record-keeping and reporting
## See Also
- **CCW Commands**: `/ccw` - Auto workflow orchestration
- **Session Management**: `/workflow:session:start`, `/workflow:session:list`
- **Task Tracking**: `TodoWrite` tool for programmatic task management
- **Workflow Status**: `/workflow:status` for CLI-based status view

View File

@@ -11,8 +11,8 @@ CCW 命令帮助系统,提供命令搜索、推荐、文档查看功能。
## Trigger Conditions
- 关键词: "ccw-help", "ccw-issue", "帮助", "命令", "怎么用"
- 场景: 询问命令用法、搜索命令、请求下一步建议
- 关键词: "ccw-help", "ccw-issue", "帮助", "命令", "怎么用", "ccw 怎么用", "工作流"
- 场景: 询问命令用法、搜索命令、请求下一步建议、询问任务应该用哪个工作流
## Operation Modes
@@ -50,7 +50,35 @@ CCW 命令帮助系统,提供命令搜索、推荐、文档查看功能。
1. Query `essential_commands` array
2. Guide appropriate workflow entry point
### Mode 5: Issue Reporting
### Mode 5: CCW Command Orchestration
**Triggers**: "ccw ", "自动工作流", "自动选择工作流", "帮我规划"
**Process**:
1. Analyze user intent (task type, complexity, clarity)
2. Auto-select workflow level (1-4 or Issue)
3. Build command chain based on workflow
4. Get user confirmation
5. Execute chain with TODO tracking
**Supported Workflows**:
- **Level 1** (Lite-Lite-Lite): Ultra-simple quick tasks
- **Level 2** (Rapid/Hotfix): Bug fixes, simple features, documentation
- **Level 2.5** (Rapid-to-Issue): Bridge from quick planning to issue workflow
- **Level 3** (Coupled): Complex features with planning, execution, review, tests
- **Level 3 Variants**:
- TDD workflows (test-first development)
- Test-fix workflows (debug failing tests)
- Review workflows (code review and fixes)
- UI design workflows
- **Level 4** (Full): Exploratory tasks with brainstorming
- **With-File Workflows**: Documented exploration with multi-CLI collaboration
- `brainstorm-with-file`: Multi-perspective ideation
- `debug-with-file`: Hypothesis-driven debugging
- `analyze-with-file`: Collaborative analysis
- **Issue Workflow**: Batch issue discovery, planning, queueing, execution
### Mode 6: Issue Reporting
**Triggers**: "ccw-issue", "报告 bug"
@@ -84,10 +112,22 @@ Single source of truth: **[command.json](command.json)**
## Slash Commands
```bash
/ccw-help # 通用帮助入口
/ccw-help search <keyword> # 搜索命令
/ccw-help next <command> # 获取下一步建议
/ccw-issue # 问题报告
/ccw "task description" # Auto-select workflow and execute
/ccw-help # General help entry
/ccw-help search <keyword> # Search commands
/ccw-help next <command> # Get next step suggestions
/ccw-issue # Issue reporting
```
### CCW Command Examples
```bash
/ccw "Add user authentication" # → auto-select level 2-3
/ccw "Fix memory leak in WebSocket" # → auto-select bugfix workflow
/ccw "Implement with TDD" # → detect TDD, use tdd-plan → execute → tdd-verify
/ccw "头脑风暴: 用户通知系统" # → detect brainstorm, use brainstorm-with-file
/ccw "深度调试: 系统随机崩溃" # → detect debug-file, use debug-with-file
/ccw "协作分析: 认证架构设计" # → detect analyze-file, use analyze-with-file
```
## Maintenance
@@ -103,9 +143,10 @@ python scripts/analyze_commands.py
## Statistics
- **Commands**: 88+
- **Commands**: 50+
- **Agents**: 16
- **Essential**: 10 核心命令
- **Workflows**: 6 main levels + 3 with-file variants
- **Essential**: 10 core commands
## Core Principle

View File

@@ -1,12 +1,13 @@
{
"_metadata": {
"version": "2.0.0",
"total_commands": 45,
"version": "2.1.0",
"total_commands": 51,
"total_agents": 16,
"description": "Unified CCW-Help command index"
},
"essential_commands": [
"/ccw",
"/workflow:lite-plan",
"/workflow:lite-fix",
"/workflow:plan",
@@ -20,6 +21,19 @@
],
"commands": [
{
"name": "ccw",
"command": "/ccw",
"description": "Main workflow orchestrator - analyze intent, auto-select workflow, execute command chain",
"arguments": "\"task description\"",
"category": "general",
"difficulty": "Beginner",
"essential": true,
"flow": {
"next_steps": ["/workflow:lite-plan", "/workflow:lite-fix", "/workflow:plan"]
},
"source": "../../../commands/ccw.md"
},
{
"name": "lite-plan",
"command": "/workflow:lite-plan",
@@ -213,6 +227,45 @@
"difficulty": "Advanced",
"source": "../../../commands/workflow/brainstorm/synthesis.md"
},
{
"name": "brainstorm-with-file",
"command": "/workflow:brainstorm-with-file",
"description": "Multi-perspective ideation with documented exploration and multi-CLI collaboration",
"arguments": "\"topic\" [--count N]",
"category": "workflow",
"subcategory": "brainstorm",
"difficulty": "Advanced",
"flow": {
"next_steps": ["/workflow:plan", "/issue:new"]
},
"source": "../../../commands/workflow/brainstorm-with-file.md"
},
{
"name": "debug-with-file",
"command": "/workflow:debug-with-file",
"description": "Hypothesis-driven debugging with documented understanding evolution",
"arguments": "\"bug description\" [--hotfix]",
"category": "workflow",
"subcategory": "debug",
"difficulty": "Advanced",
"flow": {
"next_steps": ["/workflow:execute"]
},
"source": "../../../commands/workflow/debug-with-file.md"
},
{
"name": "analyze-with-file",
"command": "/workflow:analyze-with-file",
"description": "Collaborative analysis with multi-round Q&A and CLI exploration",
"arguments": "\"topic\" [--depth N]",
"category": "workflow",
"subcategory": "analyze",
"difficulty": "Advanced",
"flow": {
"next_steps": ["/workflow:plan"]
},
"source": "../../../commands/workflow/analyze-with-file.md"
},
{
"name": "tdd-plan",
"command": "/workflow:tdd-plan",
@@ -364,6 +417,19 @@
},
"source": "../../../commands/issue/execute.md"
},
{
"name": "issue:from-brainstorm",
"command": "/issue:from-brainstorm",
"description": "Convert brainstorm session ideas into executable issue with solutions",
"arguments": "SESSION=\"<session-id>\" [--auto]",
"category": "issue",
"difficulty": "Intermediate",
"flow": {
"prerequisites": ["/workflow:brainstorm-with-file"],
"next_steps": ["/issue:queue"]
},
"source": "../../../commands/issue/from-brainstorm.md"
},
{
"name": "docs",
"command": "/memory:docs",
@@ -486,6 +552,18 @@
"difficulty": "Intermediate",
"source": "../../../commands/enhance-prompt.md"
},
{
"name": "view",
"command": "ccw view",
"description": "Open CCW workflow dashboard for managing tasks and sessions",
"arguments": "[--path <path>] [--port <port>] [--host <host>] [--no-browser]",
"category": "general",
"difficulty": "Beginner",
"flow": {
"next_steps": ["/workflow:session:list"]
},
"source": "../../../commands/view.md"
},
{
"name": "cli-init",
"command": "/cli:cli-init",