claude-code-workflow 6.3.26 → 6.3.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/CLAUDE.md +7 -1
- package/.claude/agents/action-planning-agent.md +1 -0
- package/.claude/agents/cli-discuss-agent.md +391 -0
- package/.claude/agents/cli-execution-agent.md +2 -0
- package/.claude/agents/cli-explore-agent.md +2 -1
- package/.claude/agents/cli-lite-planning-agent.md +1 -0
- package/.claude/agents/cli-planning-agent.md +1 -0
- package/.claude/agents/code-developer.md +1 -0
- package/.claude/agents/conceptual-planning-agent.md +2 -0
- package/.claude/agents/context-search-agent.md +1 -0
- package/.claude/agents/debug-explore-agent.md +2 -0
- package/.claude/agents/doc-generator.md +1 -0
- package/.claude/agents/issue-plan-agent.md +2 -1
- package/.claude/agents/issue-queue-agent.md +2 -1
- package/.claude/agents/memory-bridge.md +2 -0
- package/.claude/agents/test-context-search-agent.md +2 -0
- package/.claude/agents/test-fix-agent.md +1 -0
- package/.claude/agents/ui-design-agent.md +2 -0
- package/.claude/agents/universal-executor.md +1 -0
- package/.claude/commands/issue/execute.md +141 -163
- package/.claude/commands/workflow/lite-lite-lite.md +798 -0
- package/.claude/commands/workflow/multi-cli-plan.md +510 -0
- package/.claude/skills/ccw/SKILL.md +262 -372
- package/.claude/skills/ccw/command.json +547 -0
- package/.claude/skills/ccw-help/SKILL.md +46 -107
- package/.claude/skills/ccw-help/command.json +511 -0
- package/.claude/skills/skill-tuning/SKILL.md +303 -0
- package/.claude/skills/skill-tuning/phases/actions/action-abort.md +164 -0
- package/.claude/skills/skill-tuning/phases/actions/action-analyze-requirements.md +406 -0
- package/.claude/skills/skill-tuning/phases/actions/action-apply-fix.md +206 -0
- package/.claude/skills/skill-tuning/phases/actions/action-complete.md +195 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-agent.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-context.md +243 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-dataflow.md +318 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-docs.md +299 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-memory.md +269 -0
- package/.claude/skills/skill-tuning/phases/actions/action-diagnose-token-consumption.md +200 -0
- package/.claude/skills/skill-tuning/phases/actions/action-gemini-analysis.md +322 -0
- package/.claude/skills/skill-tuning/phases/actions/action-generate-report.md +228 -0
- package/.claude/skills/skill-tuning/phases/actions/action-init.md +149 -0
- package/.claude/skills/skill-tuning/phases/actions/action-propose-fixes.md +317 -0
- package/.claude/skills/skill-tuning/phases/actions/action-verify.md +222 -0
- package/.claude/skills/skill-tuning/phases/orchestrator.md +377 -0
- package/.claude/skills/skill-tuning/phases/state-schema.md +378 -0
- package/.claude/skills/skill-tuning/specs/category-mappings.json +284 -0
- package/.claude/skills/skill-tuning/specs/dimension-mapping.md +212 -0
- package/.claude/skills/skill-tuning/specs/problem-taxonomy.md +318 -0
- package/.claude/skills/skill-tuning/specs/quality-gates.md +263 -0
- package/.claude/skills/skill-tuning/specs/skill-authoring-principles.md +189 -0
- package/.claude/skills/skill-tuning/specs/tuning-strategies.md +1537 -0
- package/.claude/skills/skill-tuning/templates/diagnosis-report.md +153 -0
- package/.claude/skills/skill-tuning/templates/fix-proposal.md +204 -0
- package/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json +421 -0
- package/.claude/workflows/cli-tools-usage.md +0 -41
- package/ccw/dist/core/auth/csrf-middleware.d.ts.map +1 -1
- package/ccw/dist/core/auth/csrf-middleware.js +3 -1
- package/ccw/dist/core/auth/csrf-middleware.js.map +1 -1
- package/ccw/dist/core/data-aggregator.d.ts +2 -0
- package/ccw/dist/core/data-aggregator.d.ts.map +1 -1
- package/ccw/dist/core/data-aggregator.js +5 -2
- package/ccw/dist/core/data-aggregator.js.map +1 -1
- package/ccw/dist/core/lite-scanner.d.ts +2 -1
- package/ccw/dist/core/lite-scanner.d.ts.map +1 -1
- package/ccw/dist/core/lite-scanner.js +295 -6
- package/ccw/dist/core/lite-scanner.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +5 -5
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/session-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/session-routes.js +166 -48
- package/ccw/dist/core/routes/session-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +87 -0
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.js +2 -2
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/scripts/IMPLEMENTATION-SUMMARY.md +226 -0
- package/ccw/scripts/QUICK-REFERENCE.md +135 -0
- package/ccw/scripts/README-memory-embedder.md +157 -0
- package/ccw/scripts/__pycache__/memory_embedder.cpython-313.pyc +0 -0
- package/ccw/scripts/__pycache__/test_memory_embedder.cpython-313-pytest-8.4.2.pyc +0 -0
- package/ccw/scripts/memory-embedder-example.ts +184 -0
- package/ccw/scripts/memory_embedder.py +428 -0
- package/ccw/scripts/test_memory_embedder.py +245 -0
- package/ccw/src/core/auth/csrf-middleware.ts +3 -1
- package/ccw/src/core/data-aggregator.ts +7 -2
- package/ccw/src/core/lite-scanner.ts +440 -6
- package/ccw/src/core/routes/codexlens/config-handlers.ts +12 -9
- package/ccw/src/core/routes/session-routes.ts +201 -48
- package/ccw/src/core/routes/system-routes.ts +102 -0
- package/ccw/src/core/server.ts +2 -2
- package/ccw/src/templates/dashboard-css/01-base.css +8 -0
- package/ccw/src/templates/dashboard-css/02-session.css +81 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +2442 -0
- package/ccw/src/templates/dashboard-css/21-cli-toolmgmt.css +157 -0
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +23 -0
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +38 -4
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +38 -13
- package/ccw/src/templates/dashboard-js/components/navigation.js +24 -4
- package/ccw/src/templates/dashboard-js/i18n.js +194 -6
- package/ccw/src/templates/dashboard-js/views/api-settings.js +32 -0
- package/ccw/src/templates/dashboard-js/views/claude-manager.js +44 -3
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +303 -31
- package/ccw/src/templates/dashboard-js/views/history.js +44 -6
- package/ccw/src/templates/dashboard-js/views/home.js +1 -0
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +54 -7
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +1817 -4
- package/ccw/src/templates/dashboard.html +5 -0
- package/package.json +2 -1
- package/.claude/skills/ccw/index/command-capabilities.json +0 -127
- package/.claude/skills/ccw/index/intent-rules.json +0 -136
- package/.claude/skills/ccw/index/workflow-chains.json +0 -451
- package/.claude/skills/ccw/phases/actions/bugfix.md +0 -218
- package/.claude/skills/ccw/phases/actions/coupled.md +0 -194
- package/.claude/skills/ccw/phases/actions/docs.md +0 -93
- package/.claude/skills/ccw/phases/actions/full.md +0 -154
- package/.claude/skills/ccw/phases/actions/issue.md +0 -201
- package/.claude/skills/ccw/phases/actions/rapid.md +0 -104
- package/.claude/skills/ccw/phases/actions/review-fix.md +0 -84
- package/.claude/skills/ccw/phases/actions/tdd.md +0 -66
- package/.claude/skills/ccw/phases/actions/ui.md +0 -79
- package/.claude/skills/ccw/phases/orchestrator.md +0 -435
- package/.claude/skills/ccw/specs/intent-classification.md +0 -336
- package/.claude/skills/ccw-help/index/all-agents.json +0 -82
- package/.claude/skills/ccw-help/index/all-commands.json +0 -882
- package/.claude/skills/ccw-help/index/by-category.json +0 -914
- package/.claude/skills/ccw-help/index/by-use-case.json +0 -896
- package/.claude/skills/ccw-help/index/command-relationships.json +0 -160
- package/.claude/skills/ccw-help/index/essential-commands.json +0 -112
|
@@ -1,435 +0,0 @@
|
|
|
1
|
-
# CCW Orchestrator
|
|
2
|
-
|
|
3
|
-
无状态编排器:分析输入 → 选择工作流链 → TODO 跟踪执行
|
|
4
|
-
|
|
5
|
-
## Architecture
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
┌──────────────────────────────────────────────────────────────────┐
|
|
9
|
-
│ CCW Orchestrator │
|
|
10
|
-
├──────────────────────────────────────────────────────────────────┤
|
|
11
|
-
│ │
|
|
12
|
-
│ Phase 1: Input Analysis │
|
|
13
|
-
│ ├─ Parse input (natural language / explicit command) │
|
|
14
|
-
│ ├─ Classify intent (bugfix / feature / issue / ui / docs) │
|
|
15
|
-
│ └─ Assess complexity (low / medium / high) │
|
|
16
|
-
│ │
|
|
17
|
-
│ Phase 2: Chain Selection │
|
|
18
|
-
│ ├─ Load index/workflow-chains.json │
|
|
19
|
-
│ ├─ Match intent → chain(s) │
|
|
20
|
-
│ ├─ Filter by complexity │
|
|
21
|
-
│ └─ Select optimal chain │
|
|
22
|
-
│ │
|
|
23
|
-
│ Phase 3: User Confirmation (optional) │
|
|
24
|
-
│ ├─ Display selected chain and steps │
|
|
25
|
-
│ └─ Allow modification or manual selection │
|
|
26
|
-
│ │
|
|
27
|
-
│ Phase 4: TODO Tracking Setup │
|
|
28
|
-
│ ├─ Create TodoWrite with chain steps │
|
|
29
|
-
│ └─ Mark first step as in_progress │
|
|
30
|
-
│ │
|
|
31
|
-
│ Phase 5: Execution Loop │
|
|
32
|
-
│ ├─ Execute current step (SlashCommand) │
|
|
33
|
-
│ ├─ Update TODO status (completed) │
|
|
34
|
-
│ ├─ Check auto_continue flag │
|
|
35
|
-
│ └─ Proceed to next step or wait for user │
|
|
36
|
-
│ │
|
|
37
|
-
└──────────────────────────────────────────────────────────────────┘
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Implementation
|
|
41
|
-
|
|
42
|
-
### Phase 1: Input Analysis
|
|
43
|
-
|
|
44
|
-
```javascript
|
|
45
|
-
// Load external configuration (externalized for flexibility)
|
|
46
|
-
const intentRules = JSON.parse(Read('.claude/skills/ccw/index/intent-rules.json'))
|
|
47
|
-
const capabilities = JSON.parse(Read('.claude/skills/ccw/index/command-capabilities.json'))
|
|
48
|
-
|
|
49
|
-
function analyzeInput(userInput) {
|
|
50
|
-
const input = userInput.trim()
|
|
51
|
-
|
|
52
|
-
// Check for explicit command passthrough
|
|
53
|
-
if (input.match(/^\/(?:workflow|issue|memory|task):/)) {
|
|
54
|
-
return { type: 'explicit', command: input, passthrough: true }
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Classify intent using external rules
|
|
58
|
-
const intent = classifyIntent(input, intentRules.intent_patterns)
|
|
59
|
-
|
|
60
|
-
// Assess complexity using external indicators
|
|
61
|
-
const complexity = assessComplexity(input, intentRules.complexity_indicators)
|
|
62
|
-
|
|
63
|
-
// Detect tool preferences using external triggers
|
|
64
|
-
const toolPreference = detectToolPreference(input, intentRules.cli_tool_triggers)
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
type: 'natural',
|
|
68
|
-
text: input,
|
|
69
|
-
intent,
|
|
70
|
-
complexity,
|
|
71
|
-
toolPreference,
|
|
72
|
-
passthrough: false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function classifyIntent(text, patterns) {
|
|
77
|
-
// Sort by priority
|
|
78
|
-
const sorted = Object.entries(patterns)
|
|
79
|
-
.sort((a, b) => a[1].priority - b[1].priority)
|
|
80
|
-
|
|
81
|
-
for (const [intentType, config] of sorted) {
|
|
82
|
-
// Handle variants (bugfix, ui, docs)
|
|
83
|
-
if (config.variants) {
|
|
84
|
-
for (const [variant, variantConfig] of Object.entries(config.variants)) {
|
|
85
|
-
const variantPatterns = variantConfig.patterns || variantConfig.triggers || []
|
|
86
|
-
if (matchesAnyPattern(text, variantPatterns)) {
|
|
87
|
-
// For bugfix, check if standard patterns also match
|
|
88
|
-
if (intentType === 'bugfix') {
|
|
89
|
-
const standardMatch = matchesAnyPattern(text, config.variants.standard?.patterns || [])
|
|
90
|
-
if (standardMatch) {
|
|
91
|
-
return { type: intentType, variant, workflow: variantConfig.workflow }
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
94
|
-
return { type: intentType, variant, workflow: variantConfig.workflow }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Check default variant
|
|
99
|
-
if (config.variants.standard) {
|
|
100
|
-
if (matchesAnyPattern(text, config.variants.standard.patterns)) {
|
|
101
|
-
return { type: intentType, variant: 'standard', workflow: config.variants.standard.workflow }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Handle simple patterns (exploration, tdd, review)
|
|
107
|
-
if (config.patterns && !config.require_both) {
|
|
108
|
-
if (matchesAnyPattern(text, config.patterns)) {
|
|
109
|
-
return { type: intentType, workflow: config.workflow }
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Handle dual-pattern matching (issue_batch)
|
|
114
|
-
if (config.require_both && config.patterns) {
|
|
115
|
-
const matchBatch = matchesAnyPattern(text, config.patterns.batch_keywords)
|
|
116
|
-
const matchAction = matchesAnyPattern(text, config.patterns.action_keywords)
|
|
117
|
-
if (matchBatch && matchAction) {
|
|
118
|
-
return { type: intentType, workflow: config.workflow }
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Default to feature
|
|
124
|
-
return { type: 'feature' }
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function matchesAnyPattern(text, patterns) {
|
|
128
|
-
if (!Array.isArray(patterns)) return false
|
|
129
|
-
const lowerText = text.toLowerCase()
|
|
130
|
-
return patterns.some(p => lowerText.includes(p.toLowerCase()))
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function assessComplexity(text, indicators) {
|
|
134
|
-
let score = 0
|
|
135
|
-
|
|
136
|
-
for (const [level, config] of Object.entries(indicators)) {
|
|
137
|
-
if (config.patterns) {
|
|
138
|
-
for (const [category, patternConfig] of Object.entries(config.patterns)) {
|
|
139
|
-
if (matchesAnyPattern(text, patternConfig.keywords)) {
|
|
140
|
-
score += patternConfig.weight || 1
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (score >= indicators.high.score_threshold) return 'high'
|
|
147
|
-
if (score >= indicators.medium.score_threshold) return 'medium'
|
|
148
|
-
return 'low'
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function detectToolPreference(text, triggers) {
|
|
152
|
-
for (const [tool, config] of Object.entries(triggers)) {
|
|
153
|
-
// Check explicit triggers
|
|
154
|
-
if (matchesAnyPattern(text, config.explicit)) return tool
|
|
155
|
-
// Check semantic triggers
|
|
156
|
-
if (matchesAnyPattern(text, config.semantic)) return tool
|
|
157
|
-
}
|
|
158
|
-
return null
|
|
159
|
-
}
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### Phase 2: Chain Selection
|
|
163
|
-
|
|
164
|
-
```javascript
|
|
165
|
-
// Load workflow chains index
|
|
166
|
-
const chains = JSON.parse(Read('.claude/skills/ccw/index/workflow-chains.json'))
|
|
167
|
-
|
|
168
|
-
function selectChain(analysis) {
|
|
169
|
-
const { intent, complexity } = analysis
|
|
170
|
-
|
|
171
|
-
// Map intent type (from intent-rules.json) to chain ID (from workflow-chains.json)
|
|
172
|
-
const chainMapping = {
|
|
173
|
-
'bugfix': 'bugfix',
|
|
174
|
-
'issue_batch': 'issue', // intent-rules.json key → chains.json chain ID
|
|
175
|
-
'exploration': 'full',
|
|
176
|
-
'ui_design': 'ui', // intent-rules.json key → chains.json chain ID
|
|
177
|
-
'tdd': 'tdd',
|
|
178
|
-
'review': 'review-fix',
|
|
179
|
-
'documentation': 'docs', // intent-rules.json key → chains.json chain ID
|
|
180
|
-
'feature': null // Use complexity fallback
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
let chainId = chainMapping[intent.type]
|
|
184
|
-
|
|
185
|
-
// Fallback to complexity-based selection
|
|
186
|
-
if (!chainId) {
|
|
187
|
-
chainId = chains.chain_selection_rules.complexity_fallback[complexity]
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const chain = chains.chains[chainId]
|
|
191
|
-
|
|
192
|
-
// Handle variants
|
|
193
|
-
let steps = chain.steps
|
|
194
|
-
if (chain.variants) {
|
|
195
|
-
const variant = intent.variant || Object.keys(chain.variants)[0]
|
|
196
|
-
steps = chain.variants[variant].steps
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
id: chainId,
|
|
201
|
-
name: chain.name,
|
|
202
|
-
description: chain.description,
|
|
203
|
-
steps,
|
|
204
|
-
complexity: chain.complexity,
|
|
205
|
-
estimated_time: chain.estimated_time
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Phase 3: User Confirmation
|
|
211
|
-
|
|
212
|
-
```javascript
|
|
213
|
-
function confirmChain(selectedChain, analysis) {
|
|
214
|
-
// Skip confirmation for simple chains
|
|
215
|
-
if (selectedChain.steps.length <= 2 && analysis.complexity === 'low') {
|
|
216
|
-
return selectedChain
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
console.log(`
|
|
220
|
-
## CCW Workflow Selection
|
|
221
|
-
|
|
222
|
-
**Task**: ${analysis.text.substring(0, 80)}...
|
|
223
|
-
**Intent**: ${analysis.intent.type}${analysis.intent.variant ? ` (${analysis.intent.variant})` : ''}
|
|
224
|
-
**Complexity**: ${analysis.complexity}
|
|
225
|
-
|
|
226
|
-
**Selected Chain**: ${selectedChain.name}
|
|
227
|
-
**Description**: ${selectedChain.description}
|
|
228
|
-
**Estimated Time**: ${selectedChain.estimated_time}
|
|
229
|
-
|
|
230
|
-
**Steps**:
|
|
231
|
-
${selectedChain.steps.map((s, i) => `${i + 1}. ${s.command}${s.optional ? ' (optional)' : ''}`).join('\n')}
|
|
232
|
-
`)
|
|
233
|
-
|
|
234
|
-
const response = AskUserQuestion({
|
|
235
|
-
questions: [{
|
|
236
|
-
question: `Proceed with ${selectedChain.name}?`,
|
|
237
|
-
header: "Confirm",
|
|
238
|
-
multiSelect: false,
|
|
239
|
-
options: [
|
|
240
|
-
{ label: "Proceed", description: `Execute ${selectedChain.steps.length} steps` },
|
|
241
|
-
{ label: "Rapid", description: "Use lite-plan → lite-execute" },
|
|
242
|
-
{ label: "Full", description: "Use brainstorm → plan → execute" },
|
|
243
|
-
{ label: "Manual", description: "Specify commands manually" }
|
|
244
|
-
]
|
|
245
|
-
}]
|
|
246
|
-
})
|
|
247
|
-
|
|
248
|
-
// Handle alternative selection
|
|
249
|
-
if (response.Confirm === 'Rapid') {
|
|
250
|
-
return selectChain({ intent: { type: 'feature' }, complexity: 'low' })
|
|
251
|
-
}
|
|
252
|
-
if (response.Confirm === 'Full') {
|
|
253
|
-
return chains.chains['full']
|
|
254
|
-
}
|
|
255
|
-
if (response.Confirm === 'Manual') {
|
|
256
|
-
return null // User will specify
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return selectedChain
|
|
260
|
-
}
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
### Phase 4: TODO Tracking Setup
|
|
264
|
-
|
|
265
|
-
```javascript
|
|
266
|
-
function setupTodoTracking(chain, analysis) {
|
|
267
|
-
const todos = chain.steps.map((step, index) => ({
|
|
268
|
-
content: `[${index + 1}/${chain.steps.length}] ${step.command}`,
|
|
269
|
-
status: index === 0 ? 'in_progress' : 'pending',
|
|
270
|
-
activeForm: `Executing ${step.command}`
|
|
271
|
-
}))
|
|
272
|
-
|
|
273
|
-
// Add header todo
|
|
274
|
-
todos.unshift({
|
|
275
|
-
content: `CCW: ${chain.name} (${chain.steps.length} steps)`,
|
|
276
|
-
status: 'in_progress',
|
|
277
|
-
activeForm: `Running ${chain.name} workflow`
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
TodoWrite({ todos })
|
|
281
|
-
|
|
282
|
-
return {
|
|
283
|
-
chain,
|
|
284
|
-
currentStep: 0,
|
|
285
|
-
todos
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Phase 5: Execution Loop
|
|
291
|
-
|
|
292
|
-
```javascript
|
|
293
|
-
async function executeChain(execution, analysis) {
|
|
294
|
-
const { chain, todos } = execution
|
|
295
|
-
let currentStep = 0
|
|
296
|
-
|
|
297
|
-
while (currentStep < chain.steps.length) {
|
|
298
|
-
const step = chain.steps[currentStep]
|
|
299
|
-
|
|
300
|
-
// Update TODO: mark current as in_progress
|
|
301
|
-
const updatedTodos = todos.map((t, i) => ({
|
|
302
|
-
...t,
|
|
303
|
-
status: i === 0
|
|
304
|
-
? 'in_progress'
|
|
305
|
-
: i === currentStep + 1
|
|
306
|
-
? 'in_progress'
|
|
307
|
-
: i <= currentStep
|
|
308
|
-
? 'completed'
|
|
309
|
-
: 'pending'
|
|
310
|
-
}))
|
|
311
|
-
TodoWrite({ todos: updatedTodos })
|
|
312
|
-
|
|
313
|
-
console.log(`\n### Step ${currentStep + 1}/${chain.steps.length}: ${step.command}\n`)
|
|
314
|
-
|
|
315
|
-
// Check for confirmation requirement
|
|
316
|
-
if (step.confirm_before) {
|
|
317
|
-
const proceed = AskUserQuestion({
|
|
318
|
-
questions: [{
|
|
319
|
-
question: `Ready to execute ${step.command}?`,
|
|
320
|
-
header: "Step",
|
|
321
|
-
multiSelect: false,
|
|
322
|
-
options: [
|
|
323
|
-
{ label: "Execute", description: "Run this step" },
|
|
324
|
-
{ label: "Skip", description: "Skip to next step" },
|
|
325
|
-
{ label: "Abort", description: "Stop workflow" }
|
|
326
|
-
]
|
|
327
|
-
}]
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
if (proceed.Step === 'Skip') {
|
|
331
|
-
currentStep++
|
|
332
|
-
continue
|
|
333
|
-
}
|
|
334
|
-
if (proceed.Step === 'Abort') {
|
|
335
|
-
break
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Execute the command
|
|
340
|
-
const args = analysis.text
|
|
341
|
-
SlashCommand(step.command, { args })
|
|
342
|
-
|
|
343
|
-
// Mark step as completed
|
|
344
|
-
updatedTodos[currentStep + 1].status = 'completed'
|
|
345
|
-
TodoWrite({ todos: updatedTodos })
|
|
346
|
-
|
|
347
|
-
currentStep++
|
|
348
|
-
|
|
349
|
-
// Check auto_continue
|
|
350
|
-
if (!step.auto_continue && currentStep < chain.steps.length) {
|
|
351
|
-
console.log(`
|
|
352
|
-
Step completed. Next: ${chain.steps[currentStep].command}
|
|
353
|
-
Type "continue" to proceed or specify different action.
|
|
354
|
-
`)
|
|
355
|
-
// Wait for user input before continuing
|
|
356
|
-
break
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// Final status
|
|
361
|
-
if (currentStep >= chain.steps.length) {
|
|
362
|
-
const finalTodos = todos.map(t => ({ ...t, status: 'completed' }))
|
|
363
|
-
TodoWrite({ todos: finalTodos })
|
|
364
|
-
|
|
365
|
-
console.log(`\n✓ ${chain.name} workflow completed (${chain.steps.length} steps)`)
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return { completed: currentStep, total: chain.steps.length }
|
|
369
|
-
}
|
|
370
|
-
```
|
|
371
|
-
|
|
372
|
-
## Main Orchestration Entry
|
|
373
|
-
|
|
374
|
-
```javascript
|
|
375
|
-
async function ccwOrchestrate(userInput) {
|
|
376
|
-
console.log('## CCW Orchestrator\n')
|
|
377
|
-
|
|
378
|
-
// Phase 1: Analyze input
|
|
379
|
-
const analysis = analyzeInput(userInput)
|
|
380
|
-
|
|
381
|
-
// Handle explicit command passthrough
|
|
382
|
-
if (analysis.passthrough) {
|
|
383
|
-
console.log(`Direct command: ${analysis.command}`)
|
|
384
|
-
return SlashCommand(analysis.command)
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
// Phase 2: Select chain
|
|
388
|
-
const selectedChain = selectChain(analysis)
|
|
389
|
-
|
|
390
|
-
// Phase 3: Confirm (for complex workflows)
|
|
391
|
-
const confirmedChain = confirmChain(selectedChain, analysis)
|
|
392
|
-
if (!confirmedChain) {
|
|
393
|
-
console.log('Manual mode selected. Specify commands directly.')
|
|
394
|
-
return
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// Phase 4: Setup TODO tracking
|
|
398
|
-
const execution = setupTodoTracking(confirmedChain, analysis)
|
|
399
|
-
|
|
400
|
-
// Phase 5: Execute
|
|
401
|
-
const result = await executeChain(execution, analysis)
|
|
402
|
-
|
|
403
|
-
return result
|
|
404
|
-
}
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
## Decision Matrix
|
|
408
|
-
|
|
409
|
-
| Intent | Complexity | Chain | Steps |
|
|
410
|
-
|--------|------------|-------|-------|
|
|
411
|
-
| bugfix (standard) | * | bugfix | lite-fix |
|
|
412
|
-
| bugfix (hotfix) | * | bugfix | lite-fix --hotfix |
|
|
413
|
-
| issue | * | issue | plan → queue → execute |
|
|
414
|
-
| exploration | * | full | brainstorm → plan → execute |
|
|
415
|
-
| ui (explore) | * | ui | ui-design:explore → sync → plan → execute |
|
|
416
|
-
| ui (imitate) | * | ui | ui-design:imitate → sync → plan → execute |
|
|
417
|
-
| tdd | * | tdd | tdd-plan → execute → tdd-verify |
|
|
418
|
-
| review | * | review-fix | review-session-cycle → review-fix |
|
|
419
|
-
| docs | low | docs | update-related |
|
|
420
|
-
| docs | medium+ | docs | docs → execute |
|
|
421
|
-
| feature | low | rapid | lite-plan → lite-execute |
|
|
422
|
-
| feature | medium | coupled | plan → verify → execute |
|
|
423
|
-
| feature | high | full | brainstorm → plan → execute |
|
|
424
|
-
|
|
425
|
-
## Continuation Commands
|
|
426
|
-
|
|
427
|
-
After each step pause:
|
|
428
|
-
|
|
429
|
-
| User Input | Action |
|
|
430
|
-
|------------|--------|
|
|
431
|
-
| `continue` | Execute next step |
|
|
432
|
-
| `skip` | Skip current step |
|
|
433
|
-
| `abort` | Stop workflow |
|
|
434
|
-
| `/workflow:*` | Execute specific command |
|
|
435
|
-
| Natural language | Re-analyze and potentially switch chains |
|