Enhance CCW Orchestrator with Requirement Analysis Features

- Updated SKILL.md to reflect new requirement analysis capabilities, including input analysis and clarity scoring.
- Expanded issue workflow in issue.md to include discovery and creation phases, along with detailed command references.
- Introduced requirement analysis specification in requirement-analysis.md, outlining clarity scoring, dimension extraction, and validation processes.
- Added output templates specification in output-templates.md for consistent user experience across classification, planning, clarification, execution, and summary outputs.
This commit is contained in:
catlog22
2026-01-14 20:15:42 +08:00
parent 959d60b31f
commit 1f5ce9c03a
5 changed files with 1015 additions and 157 deletions

View File

@@ -1,201 +1,335 @@
# Action: Issue Workflow
Issue 批量处理工作流:规划 + 队列 + 批量执行
Issue 批量处理工作流:发现 → 创建 → 规划 队列 批量执行
## Pattern
## Complete Workflow Pattern
```
issue:plan → issue:queue → issue:execute
┌─────────────────────────────────────────────────────────────────┐
│ Issue Workflow - Complete Chain │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Discovery Phase (Optional) │
│ ├─ /issue:discover - 多视角问题发现 │
│ └─ /issue:discover-by-prompt - 基于提示的迭代发现 │
│ │
│ Creation Phase │
│ └─ /issue:new - 创建结构化 Issue │
│ │
│ Planning Phase │
│ └─ /issue:plan - 生成解决方案 │
│ │
│ Queue Phase │
│ └─ /issue:queue - 冲突分析 + 队列构建 │
│ │
│ Execution Phase │
│ └─ /issue:execute - DAG 并行执行 │
│ │
└─────────────────────────────────────────────────────────────────┘
```
## Workflow Patterns
### Pattern 1: Full Discovery Flow
```
/issue:discover → /issue:new → /issue:plan → /issue:queue → /issue:execute
```
**Use when**: 不知道有什么问题,需要全面发现
### Pattern 2: Prompt-Driven Discovery
```
/issue:discover-by-prompt → /issue:plan → /issue:queue → /issue:execute
```
**Use when**: 有特定方向的问题探索
### Pattern 3: Direct Planning (Default)
```
/issue:plan → /issue:queue → /issue:execute
```
**Use when**: 已有明确的 Issue 列表
### Pattern 4: GitHub Import
```
/issue:new (GitHub URL) → /issue:plan → /issue:queue → /issue:execute
```
**Use when**: 从 GitHub Issues 导入
## Command Reference
### /issue:discover
多视角问题发现,支持 8 种视角的并行探索。
**视角列表**:
| Perspective | Description | Agent Type |
|-------------|-------------|------------|
| bug | 功能缺陷和错误 | CLI explore |
| ux | 用户体验问题 | CLI explore |
| test | 测试覆盖缺口 | CLI explore |
| quality | 代码质量问题 | CLI explore |
| security | 安全漏洞 | CLI explore + Exa |
| performance | 性能瓶颈 | CLI explore |
| maintainability | 可维护性问题 | CLI explore |
| best-practices | 最佳实践偏离 | CLI explore + Exa |
**输出**: `.workflow/issues/discoveries/` 下的发现报告
**调用方式**:
```bash
/issue:discover # 全视角发现
/issue:discover --perspectives security,performance # 指定视角
```
### /issue:discover-by-prompt
基于用户提示的智能发现,使用 Gemini 规划迭代探索策略。
**核心能力**:
- ACE 语义搜索上下文收集
- 跨模块比较(如 API 契约一致性)
- 多轮迭代探索直到收敛
**调用方式**:
```bash
/issue:discover-by-prompt "检查前端后端API契约一致性"
```
### /issue:new
从 GitHub URL 或文本描述创建结构化 Issue。
**清晰度检测** (0-3分):
| Score | Level | Action |
|-------|-------|--------|
| 0 | 无法理解 | 必须澄清 |
| 1 | 基本理解 | 建议澄清 |
| 2 | 清晰 | 直接创建 |
| 3 | 详细 | 直接创建 |
**调用方式**:
```bash
/issue:new https://github.com/user/repo/issues/123 # GitHub 导入
/issue:new "登录页面在移动端显示异常" # 文本创建
```
**输出**: `.workflow/issues/issues.jsonl` 追加新 Issue
### /issue:plan
为每个 Issue 生成解决方案,使用 `issue-plan-agent`
**核心流程**:
1. 加载未规划的 Issues
2. ACE 上下文探索
3. 生成 1-3 个解决方案/Issue
4. 用户选择绑定方案
**调用方式**:
```bash
/issue:plan # 规划所有未绑定 Issue
/issue:plan --issue ISS-001 # 规划特定 Issue
```
**输出**: `.workflow/issues/solutions/ISS-xxx.jsonl`
### /issue:queue
解决方案级别的队列构建冲突分析DAG 生成。
**使用 Agent**: `issue-queue-agent`
**冲突检测类型**:
| Type | Description | Severity | Resolution |
|------|-------------|----------|------------|
| file | 同文件修改 | Low | Sequential |
| api | API 签名变更 | Medium | Dependency ordering |
| data | 数据结构冲突 | High | User decision |
| dependency | 包依赖冲突 | Medium | Version negotiation |
| architecture | 架构方向冲突 | Critical | User decision |
**DAG 结构**:
```
execution_groups:
├── P1: Parallel (independent solutions)
├── S1: Sequential (depends on P1)
└── P2: Parallel (depends on S1)
```
**调用方式**:
```bash
/issue:queue # 构建队列
/issue:queue --dry-run # 预览冲突分析
```
**输出**: `.workflow/issues/queues/QUE-xxx.json`
### /issue:execute
DAG 并行执行编排器,单 worktree 策略。
**Executor 选项**:
| Executor | Best For | Mode |
|----------|----------|------|
| codex (recommended) | 代码实现 | Autonomous |
| gemini | 复杂分析 | Analysis first |
| agent | 灵活控制 | Supervised |
**执行策略**:
- 单 worktree 用于整个队列
- 按 solution 粒度分发
- 自动处理依赖顺序
- 支持断点续传
**调用方式**:
```bash
/issue:execute # 执行当前队列
/issue:execute --queue QUE-xxx # 执行特定队列
/issue:execute --resume # 恢复中断的执行
```
## Trigger Conditions
- Keywords: "issues", "batch", "queue", "多个", "批量"
- Multiple related problems
- Long-running fix campaigns
- Priority-based processing needed
CCW 自动识别以下关键词触发 Issue 工作流:
## Execution Flow
```javascript
const issuePatterns = {
// Batch processing
batch: /issues?|batch|queue|多个|批量|一批/i,
// Action requirement
action: /fix|resolve|处理|修复|解决/i,
// Discovery
discover: /discover|find|发现|检查|扫描|audit/i,
// GitHub specific
github: /github\.com\/.*\/issues/i
}
```mermaid
sequenceDiagram
participant U as User
participant O as CCW Orchestrator
participant IP as issue:plan
participant IQ as issue:queue
participant IE as issue:execute
U->>O: Multiple issues / batch fix
O->>O: Classify: issue
Note over IP: Phase 1: Issue Planning
O->>IP: /issue:plan
IP->>IP: Load unplanned issues
IP->>IP: Generate solutions per issue
IP->>U: Review solutions
U->>IP: Bind selected solutions
Note over IQ: Phase 2: Queue Formation
IP->>IQ: /issue:queue
IQ->>IQ: Conflict analysis
IQ->>IQ: Priority calculation
IQ->>IQ: DAG construction
IQ->>U: High-severity conflicts?
U->>IQ: Resolve conflicts
IQ->>IQ: Generate execution queue
Note over IE: Phase 3: Execution
IQ->>IE: /issue:execute
IE->>IE: DAG-based parallel execution
IE->>IE: Per-solution progress tracking
IE-->>U: Batch execution complete
// Trigger when: batch + action OR discover OR github
```
## When to Use
**Ideal scenarios**:
- 多个相关 Bug 需要批量修复
- GitHub Issues 批量处理
- 技术债务清理
- 安全漏洞批量修复
- 代码质量改进活动
**Avoid when**:
- 单一问题 → `/workflow:lite-fix`
- 独立不相关的任务 → 分别处理
- 紧急生产问题 → `/workflow:lite-fix --hotfix`
## Issue Lifecycle
```
draft → planned → queued → executing → completed
↓ ↓
skipped on-hold
┌───────┐ ┌────────┐ ┌────────┐ ┌───────────┐ ┌───────────┐
│ draft │ ──▶ │ planned│ ──▶ │ queued │ ──▶ │ executing │ ──▶ │ completed │
└───────┘ └────────┘ └────────┘ └───────────┘ └───────────┘
│ │
▼ ▼
┌─────────┐ ┌─────────┐
│ skipped │ │ on-hold │
└─────────┘ └─────────┘
```
## Conflict Types
| Type | Description | Resolution |
|------|-------------|------------|
| File | 多个解决方案修改同一文件 | Sequential execution |
| API | API 签名变更影响 | Dependency ordering |
| Data | 数据结构变更冲突 | User decision |
| Dependency | 包依赖冲突 | Version negotiation |
| Architecture | 架构方向冲突 | User decision (high severity) |
## Configuration
```javascript
const issueConfig = {
discover: {
perspectives: ['bug', 'ux', 'test', 'quality', 'security', 'performance', 'maintainability', 'best-practices'],
parallelExploration: true,
exaIntegration: ['security', 'best-practices']
},
create: {
clarityThreshold: 2, // Minimum clarity score to proceed
autoClarify: true, // Prompt for missing info
githubPublish: 'ask' // ask | always | never
},
plan: {
solutionsPerIssue: 3, // Generate up to 3 solutions
autoSelect: false, // User must bind solution
solutionsPerIssue: 3, // Generate up to 3 solutions
autoSelect: false, // User must bind solution
planningAgent: 'issue-plan-agent'
},
queue: {
conflictAnalysis: true,
priorityCalculation: true,
clarifyThreshold: 'high', // Ask user for high-severity conflicts
clarifyThreshold: 'high', // Ask user for high-severity conflicts
queueAgent: 'issue-queue-agent'
},
execute: {
dagParallel: true,
executionLevel: 'solution', // Execute by solution, not task
executionLevel: 'solution',
executor: 'codex',
resumable: true
}
}
```
## Example Invocations
```bash
# From GitHub Issues
ccw "批量处理所有 label:bug 的 GitHub Issues"
→ issue:new (import from GitHub)
→ issue:plan (generate solutions)
→ issue:queue (form execution queue)
→ issue:execute (batch execute)
# Tech debt cleanup
ccw "处理所有 TODO 注释和已知技术债务"
→ issue:discover (find issues)
→ issue:plan (plan solutions)
→ issue:queue (prioritize)
→ issue:execute (execute)
# Security vulnerabilities
ccw "修复所有 npm audit 报告的安全漏洞"
→ issue:new (from audit report)
→ issue:plan (upgrade strategies)
→ issue:queue (conflict resolution)
→ issue:execute (staged upgrades)
```
## Queue Structure
```json
{
"queue_id": "QUE-20251227-143000",
"status": "active",
"execution_groups": [
{
"id": "P1",
"type": "parallel",
"solutions": ["SOL-ISS-001-1", "SOL-ISS-002-1"],
"description": "Independent fixes, no file overlap"
},
{
"id": "S1",
"type": "sequential",
"solutions": ["SOL-ISS-003-1"],
"depends_on": ["P1"],
"description": "Depends on P1 completion"
}
]
}
```
## Output Artifacts
## Output Structure
```
.workflow/issues/
├── issues.jsonl # All issues (one per line)
├── issues.jsonl # All issues (append-only)
├── discoveries/
│ ├── DIS-xxx.json # Discovery session
│ └── reports/
│ ├── security.md
│ └── performance.md
├── solutions/
│ ├── ISS-001.jsonl # Solutions for ISS-001
│ ├── ISS-001.jsonl # Solutions for ISS-001
│ └── ISS-002.jsonl
├── queues/
│ ├── index.json # Queue index
│ └── QUE-xxx.json # Queue details
│ ├── index.json # Queue index
│ └── QUE-xxx.json # Queue details
└── execution/
└── {queue-id}/
├── progress.json
├── logs/
└── results/
```
## Progress Tracking
```javascript
// Real-time progress during execution
const progress = {
queue_id: "QUE-xxx",
total_solutions: 5,
completed: 2,
in_progress: 1,
pending: 2,
current_group: "P1",
eta: "15 minutes"
}
```
## Resume Capability
## Example Invocations
```bash
# If execution interrupted
ccw "继续执行 issue 队列"
Detects active queue: QUE-xxx
Resumes from last checkpoint
→ /issue:execute --resume
# Complete discovery flow
ccw "全面检查代码库问题并批量修复"
/issue:discover (全视角)
/issue:new (创建发现的问题)
→ /issue:plan (生成方案)
→ /issue:queue (构建队列)
→ /issue:execute (批量执行)
# Security audit
ccw "安全审计并修复所有漏洞"
→ /issue:discover --perspectives security
→ /issue:plan
→ /issue:queue
→ /issue:execute
# GitHub batch processing
ccw "处理所有 label:bug 的 GitHub Issues"
→ /issue:new (批量导入)
→ /issue:plan
→ /issue:queue
→ /issue:execute
# Tech debt cleanup
ccw "清理技术债务"
→ /issue:discover --perspectives quality,maintainability
→ /issue:plan
→ /issue:queue
→ /issue:execute
```
## Integration with CCW Orchestrator
在 orchestrator.md 中的集成点:
```javascript
// Intent classification
if (matchesIssuePattern(input)) {
// Determine entry point
if (hasDiscoveryIntent(input)) {
if (hasPromptDirection(input)) {
return { workflow: 'issue:discover-by-prompt → issue:plan → issue:queue → issue:execute' }
}
return { workflow: 'issue:discover → issue:plan → issue:queue → issue:execute' }
}
if (hasGitHubUrl(input)) {
return { workflow: 'issue:new → issue:plan → issue:queue → issue:execute' }
}
// Default: direct planning
return { workflow: 'issue:plan → issue:queue → issue:execute' }
}
```