claude-code-workflow 6.3.36 → 6.3.37

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.
Files changed (134) hide show
  1. package/.claude/commands/workflow/lite-fix.md +108 -9
  2. package/.claude/skills/ccw-loop/README.md +303 -0
  3. package/.claude/skills/ccw-loop/SKILL.md +259 -0
  4. package/.claude/skills/ccw-loop/phases/actions/action-complete.md +320 -0
  5. package/.claude/skills/ccw-loop/phases/actions/action-debug-with-file.md +485 -0
  6. package/.claude/skills/ccw-loop/phases/actions/action-develop-with-file.md +365 -0
  7. package/.claude/skills/ccw-loop/phases/actions/action-init.md +200 -0
  8. package/.claude/skills/ccw-loop/phases/actions/action-menu.md +192 -0
  9. package/.claude/skills/ccw-loop/phases/actions/action-validate-with-file.md +307 -0
  10. package/.claude/skills/ccw-loop/phases/orchestrator.md +486 -0
  11. package/.claude/skills/ccw-loop/phases/state-schema.md +474 -0
  12. package/.claude/skills/ccw-loop/specs/action-catalog.md +300 -0
  13. package/.claude/skills/ccw-loop/specs/loop-requirements.md +192 -0
  14. package/.claude/skills/ccw-loop/templates/progress-template.md +175 -0
  15. package/.claude/skills/ccw-loop/templates/understanding-template.md +303 -0
  16. package/.claude/skills/ccw-loop/templates/validation-template.md +258 -0
  17. package/ccw/dist/cli.d.ts.map +1 -1
  18. package/ccw/dist/cli.js +8 -1
  19. package/ccw/dist/cli.js.map +1 -1
  20. package/ccw/dist/commands/cli.d.ts.map +1 -1
  21. package/ccw/dist/commands/cli.js +14 -1
  22. package/ccw/dist/commands/cli.js.map +1 -1
  23. package/ccw/dist/commands/loop.d.ts +10 -0
  24. package/ccw/dist/commands/loop.d.ts.map +1 -0
  25. package/ccw/dist/commands/loop.js +289 -0
  26. package/ccw/dist/commands/loop.js.map +1 -0
  27. package/ccw/dist/core/dashboard-generator.d.ts.map +1 -1
  28. package/ccw/dist/core/dashboard-generator.js +4 -1
  29. package/ccw/dist/core/dashboard-generator.js.map +1 -1
  30. package/ccw/dist/core/routes/claude-routes.d.ts.map +1 -1
  31. package/ccw/dist/core/routes/claude-routes.js +5 -3
  32. package/ccw/dist/core/routes/claude-routes.js.map +1 -1
  33. package/ccw/dist/core/routes/cli-routes.d.ts +6 -0
  34. package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
  35. package/ccw/dist/core/routes/cli-routes.js +42 -13
  36. package/ccw/dist/core/routes/cli-routes.js.map +1 -1
  37. package/ccw/dist/core/routes/cli-settings-routes.d.ts.map +1 -1
  38. package/ccw/dist/core/routes/cli-settings-routes.js +44 -0
  39. package/ccw/dist/core/routes/cli-settings-routes.js.map +1 -1
  40. package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
  41. package/ccw/dist/core/routes/codexlens/semantic-handlers.js +3 -2
  42. package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
  43. package/ccw/dist/core/routes/core-memory-routes.d.ts.map +1 -1
  44. package/ccw/dist/core/routes/core-memory-routes.js +4 -2
  45. package/ccw/dist/core/routes/core-memory-routes.js.map +1 -1
  46. package/ccw/dist/core/routes/files-routes.d.ts.map +1 -1
  47. package/ccw/dist/core/routes/files-routes.js +4 -2
  48. package/ccw/dist/core/routes/files-routes.js.map +1 -1
  49. package/ccw/dist/core/routes/loop-routes.d.ts +24 -0
  50. package/ccw/dist/core/routes/loop-routes.d.ts.map +1 -0
  51. package/ccw/dist/core/routes/loop-routes.js +334 -0
  52. package/ccw/dist/core/routes/loop-routes.js.map +1 -0
  53. package/ccw/dist/core/routes/loop-v2-routes.d.ts +35 -0
  54. package/ccw/dist/core/routes/loop-v2-routes.d.ts.map +1 -0
  55. package/ccw/dist/core/routes/loop-v2-routes.js +1208 -0
  56. package/ccw/dist/core/routes/loop-v2-routes.js.map +1 -0
  57. package/ccw/dist/core/routes/memory-routes.d.ts.map +1 -1
  58. package/ccw/dist/core/routes/memory-routes.js +2 -1
  59. package/ccw/dist/core/routes/memory-routes.js.map +1 -1
  60. package/ccw/dist/core/routes/task-routes.d.ts +12 -0
  61. package/ccw/dist/core/routes/task-routes.d.ts.map +1 -0
  62. package/ccw/dist/core/routes/task-routes.js +321 -0
  63. package/ccw/dist/core/routes/task-routes.js.map +1 -0
  64. package/ccw/dist/core/routes/test-loop-routes.d.ts +11 -0
  65. package/ccw/dist/core/routes/test-loop-routes.d.ts.map +1 -0
  66. package/ccw/dist/core/routes/test-loop-routes.js +298 -0
  67. package/ccw/dist/core/routes/test-loop-routes.js.map +1 -0
  68. package/ccw/dist/core/server.d.ts.map +1 -1
  69. package/ccw/dist/core/server.js +43 -3
  70. package/ccw/dist/core/server.js.map +1 -1
  71. package/ccw/dist/core/websocket.d.ts +59 -0
  72. package/ccw/dist/core/websocket.d.ts.map +1 -1
  73. package/ccw/dist/core/websocket.js +34 -0
  74. package/ccw/dist/core/websocket.js.map +1 -1
  75. package/ccw/dist/tools/claude-cli-tools.d.ts +40 -0
  76. package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
  77. package/ccw/dist/tools/claude-cli-tools.js +119 -0
  78. package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
  79. package/ccw/dist/tools/loop-manager.d.ts +84 -0
  80. package/ccw/dist/tools/loop-manager.d.ts.map +1 -0
  81. package/ccw/dist/tools/loop-manager.js +425 -0
  82. package/ccw/dist/tools/loop-manager.js.map +1 -0
  83. package/ccw/dist/tools/loop-state-manager.d.ts +47 -0
  84. package/ccw/dist/tools/loop-state-manager.d.ts.map +1 -0
  85. package/ccw/dist/tools/loop-state-manager.js +149 -0
  86. package/ccw/dist/tools/loop-state-manager.js.map +1 -0
  87. package/ccw/dist/tools/loop-task-manager.d.ts +138 -0
  88. package/ccw/dist/tools/loop-task-manager.d.ts.map +1 -0
  89. package/ccw/dist/tools/loop-task-manager.js +270 -0
  90. package/ccw/dist/tools/loop-task-manager.js.map +1 -0
  91. package/ccw/dist/types/index.d.ts +1 -0
  92. package/ccw/dist/types/index.d.ts.map +1 -1
  93. package/ccw/dist/types/index.js +1 -0
  94. package/ccw/dist/types/index.js.map +1 -1
  95. package/ccw/dist/types/loop.d.ts +257 -0
  96. package/ccw/dist/types/loop.d.ts.map +1 -0
  97. package/ccw/dist/types/loop.js +17 -0
  98. package/ccw/dist/types/loop.js.map +1 -0
  99. package/ccw/src/cli.ts +9 -1
  100. package/ccw/src/commands/cli.ts +14 -1
  101. package/ccw/src/commands/loop.ts +344 -0
  102. package/ccw/src/core/dashboard-generator.ts +4 -1
  103. package/ccw/src/core/routes/claude-routes.ts +5 -3
  104. package/ccw/src/core/routes/cli-routes.ts +47 -15
  105. package/ccw/src/core/routes/cli-settings-routes.ts +47 -0
  106. package/ccw/src/core/routes/codexlens/semantic-handlers.ts +3 -2
  107. package/ccw/src/core/routes/core-memory-routes.ts +4 -2
  108. package/ccw/src/core/routes/files-routes.ts +4 -2
  109. package/ccw/src/core/routes/loop-routes.ts +386 -0
  110. package/ccw/src/core/routes/loop-v2-routes.ts +1412 -0
  111. package/ccw/src/core/routes/memory-routes.ts +2 -1
  112. package/ccw/src/core/routes/task-routes.ts +361 -0
  113. package/ccw/src/core/routes/test-loop-routes.ts +312 -0
  114. package/ccw/src/core/server.ts +44 -3
  115. package/ccw/src/core/websocket.ts +104 -0
  116. package/ccw/src/templates/dashboard-css/12-cli-legacy.css +56 -0
  117. package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +55 -0
  118. package/ccw/src/templates/dashboard-css/36-loop-monitor.css +1896 -0
  119. package/ccw/src/templates/dashboard-css/36-loop-monitor.css.backup +1877 -0
  120. package/ccw/src/templates/dashboard-js/components/cli-status.js +64 -3
  121. package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +251 -110
  122. package/ccw/src/templates/dashboard-js/components/navigation.js +10 -0
  123. package/ccw/src/templates/dashboard-js/components/notifications.js +16 -0
  124. package/ccw/src/templates/dashboard-js/i18n.js +475 -1
  125. package/ccw/src/templates/dashboard-js/views/cli-manager.js +3 -2
  126. package/ccw/src/templates/dashboard-js/views/loop-monitor.js +3244 -0
  127. package/ccw/src/templates/dashboard.html +20 -2
  128. package/ccw/src/tools/claude-cli-tools.ts +143 -0
  129. package/ccw/src/tools/loop-manager.ts +519 -0
  130. package/ccw/src/tools/loop-state-manager.ts +173 -0
  131. package/ccw/src/tools/loop-task-manager.ts +380 -0
  132. package/ccw/src/types/index.ts +1 -0
  133. package/ccw/src/types/loop.ts +316 -0
  134. package/package.json +1 -1
@@ -0,0 +1,485 @@
1
+ # Action: Debug With File
2
+
3
+ 假设驱动调试,记录理解演变到 understanding.md,支持 Gemini 辅助分析和假设生成。
4
+
5
+ ## Purpose
6
+
7
+ 执行假设驱动的调试流程,包括:
8
+ - 定位错误源
9
+ - 生成可测试假设
10
+ - 添加 NDJSON 日志
11
+ - 分析日志证据
12
+ - 纠正错误理解
13
+ - 应用修复
14
+
15
+ ## Preconditions
16
+
17
+ - [ ] state.initialized === true
18
+ - [ ] state.status === 'running'
19
+
20
+ ## Session Setup
21
+
22
+ ```javascript
23
+ const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
24
+
25
+ const sessionFolder = `.workflow/.loop/${state.session_id}`
26
+ const debugFolder = `${sessionFolder}/debug`
27
+ const understandingPath = `${debugFolder}/understanding.md`
28
+ const hypothesesPath = `${debugFolder}/hypotheses.json`
29
+ const debugLogPath = `${debugFolder}/debug.log`
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Mode Detection
35
+
36
+ ```javascript
37
+ // 自动检测模式
38
+ const understandingExists = fs.existsSync(understandingPath)
39
+ const logHasContent = fs.existsSync(debugLogPath) && fs.statSync(debugLogPath).size > 0
40
+
41
+ const debugMode = logHasContent ? 'analyze' : (understandingExists ? 'continue' : 'explore')
42
+
43
+ console.log(`Debug mode: ${debugMode}`)
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Explore Mode (首次调试)
49
+
50
+ ### Step 1.1: 定位错误源
51
+
52
+ ```javascript
53
+ if (debugMode === 'explore') {
54
+ // 询问用户 bug 描述
55
+ const bugInput = await AskUserQuestion({
56
+ questions: [{
57
+ question: "请描述遇到的 bug 或错误信息:",
58
+ header: "Bug 描述",
59
+ multiSelect: false,
60
+ options: [
61
+ { label: "手动输入", description: "输入错误描述或堆栈" },
62
+ { label: "从测试失败", description: "从验证阶段的失败测试中获取" }
63
+ ]
64
+ }]
65
+ })
66
+
67
+ const bugDescription = bugInput["Bug 描述"]
68
+
69
+ // 提取关键词并搜索
70
+ const searchResults = await Task({
71
+ subagent_type: 'Explore',
72
+ run_in_background: false,
73
+ prompt: `Search codebase for error patterns related to: ${bugDescription}`
74
+ })
75
+
76
+ // 分析搜索结果,识别受影响的位置
77
+ const affectedLocations = analyzeSearchResults(searchResults)
78
+ }
79
+ ```
80
+
81
+ ### Step 1.2: 记录初始理解
82
+
83
+ ```javascript
84
+ // 创建 understanding.md
85
+ const initialUnderstanding = `# Understanding Document
86
+
87
+ **Session ID**: ${state.session_id}
88
+ **Bug Description**: ${bugDescription}
89
+ **Started**: ${getUtc8ISOString()}
90
+
91
+ ---
92
+
93
+ ## Exploration Timeline
94
+
95
+ ### Iteration 1 - Initial Exploration (${getUtc8ISOString()})
96
+
97
+ #### Current Understanding
98
+
99
+ Based on bug description and initial code search:
100
+
101
+ - Error pattern: ${errorPattern}
102
+ - Affected areas: ${affectedLocations.map(l => l.file).join(', ')}
103
+ - Initial hypothesis: ${initialThoughts}
104
+
105
+ #### Evidence from Code Search
106
+
107
+ ${searchResults.map(r => `
108
+ **Keyword: "${r.keyword}"**
109
+ - Found in: ${r.files.join(', ')}
110
+ - Key findings: ${r.insights}
111
+ `).join('\n')}
112
+
113
+ #### Next Steps
114
+
115
+ - Generate testable hypotheses
116
+ - Add instrumentation
117
+ - Await reproduction
118
+
119
+ ---
120
+
121
+ ## Current Consolidated Understanding
122
+
123
+ ${initialConsolidatedUnderstanding}
124
+ `
125
+
126
+ Write(understandingPath, initialUnderstanding)
127
+ ```
128
+
129
+ ### Step 1.3: Gemini 辅助假设生成
130
+
131
+ ```bash
132
+ ccw cli -p "
133
+ PURPOSE: Generate debugging hypotheses for: ${bugDescription}
134
+ Success criteria: Testable hypotheses with clear evidence criteria
135
+
136
+ TASK:
137
+ • Analyze error pattern and code search results
138
+ • Identify 3-5 most likely root causes
139
+ • For each hypothesis, specify:
140
+ - What might be wrong
141
+ - What evidence would confirm/reject it
142
+ - Where to add instrumentation
143
+ • Rank by likelihood
144
+
145
+ MODE: analysis
146
+
147
+ CONTEXT: @${understandingPath} | Search results in understanding.md
148
+
149
+ EXPECTED:
150
+ - Structured hypothesis list (JSON format)
151
+ - Each hypothesis with: id, description, testable_condition, logging_point, evidence_criteria
152
+ - Likelihood ranking (1=most likely)
153
+
154
+ CONSTRAINTS: Focus on testable conditions
155
+ " --tool gemini --mode analysis --rule analysis-diagnose-bug-root-cause
156
+ ```
157
+
158
+ ### Step 1.4: 保存假设
159
+
160
+ ```javascript
161
+ const hypotheses = {
162
+ iteration: 1,
163
+ timestamp: getUtc8ISOString(),
164
+ bug_description: bugDescription,
165
+ hypotheses: [
166
+ {
167
+ id: "H1",
168
+ description: "...",
169
+ testable_condition: "...",
170
+ logging_point: "file.ts:func:42",
171
+ evidence_criteria: {
172
+ confirm: "...",
173
+ reject: "..."
174
+ },
175
+ likelihood: 1,
176
+ status: "pending"
177
+ }
178
+ // ...
179
+ ],
180
+ gemini_insights: "...",
181
+ corrected_assumptions: []
182
+ }
183
+
184
+ Write(hypothesesPath, JSON.stringify(hypotheses, null, 2))
185
+ ```
186
+
187
+ ### Step 1.5: 添加 NDJSON 日志
188
+
189
+ ```javascript
190
+ // 为每个假设添加日志点
191
+ for (const hypothesis of hypotheses.hypotheses) {
192
+ const [file, func, line] = hypothesis.logging_point.split(':')
193
+
194
+ const logStatement = `console.log(JSON.stringify({
195
+ hid: "${hypothesis.id}",
196
+ ts: Date.now(),
197
+ func: "${func}",
198
+ data: { /* 相关数据 */ }
199
+ }))`
200
+
201
+ // 使用 Edit 工具添加日志
202
+ // ...
203
+ }
204
+ ```
205
+
206
+ ---
207
+
208
+ ## Analyze Mode (有日志后)
209
+
210
+ ### Step 2.1: 解析调试日志
211
+
212
+ ```javascript
213
+ if (debugMode === 'analyze') {
214
+ // 读取 NDJSON 日志
215
+ const logContent = Read(debugLogPath)
216
+ const entries = logContent.split('\n')
217
+ .filter(l => l.trim())
218
+ .map(l => JSON.parse(l))
219
+
220
+ // 按假设分组
221
+ const byHypothesis = groupBy(entries, 'hid')
222
+ }
223
+ ```
224
+
225
+ ### Step 2.2: Gemini 辅助证据分析
226
+
227
+ ```bash
228
+ ccw cli -p "
229
+ PURPOSE: Analyze debug log evidence to validate/correct hypotheses for: ${bugDescription}
230
+ Success criteria: Clear verdict per hypothesis + corrected understanding
231
+
232
+ TASK:
233
+ • Parse log entries by hypothesis
234
+ • Evaluate evidence against expected criteria
235
+ • Determine verdict: confirmed | rejected | inconclusive
236
+ • Identify incorrect assumptions from previous understanding
237
+ • Suggest corrections to understanding
238
+
239
+ MODE: analysis
240
+
241
+ CONTEXT:
242
+ @${debugLogPath}
243
+ @${understandingPath}
244
+ @${hypothesesPath}
245
+
246
+ EXPECTED:
247
+ - Per-hypothesis verdict with reasoning
248
+ - Evidence summary
249
+ - List of incorrect assumptions with corrections
250
+ - Updated consolidated understanding
251
+ - Root cause if confirmed, or next investigation steps
252
+
253
+ CONSTRAINTS: Evidence-based reasoning only, no speculation
254
+ " --tool gemini --mode analysis --rule analysis-diagnose-bug-root-cause
255
+ ```
256
+
257
+ ### Step 2.3: 更新理解文档
258
+
259
+ ```javascript
260
+ // 追加新迭代到 understanding.md
261
+ const iteration = state.debug.iteration + 1
262
+
263
+ const analysisEntry = `
264
+ ### Iteration ${iteration} - Evidence Analysis (${getUtc8ISOString()})
265
+
266
+ #### Log Analysis Results
267
+
268
+ ${results.map(r => `
269
+ **${r.id}**: ${r.verdict.toUpperCase()}
270
+ - Evidence: ${JSON.stringify(r.evidence)}
271
+ - Reasoning: ${r.reason}
272
+ `).join('\n')}
273
+
274
+ #### Corrected Understanding
275
+
276
+ Previous misunderstandings identified and corrected:
277
+
278
+ ${corrections.map(c => `
279
+ - ~~${c.wrong}~~ → ${c.corrected}
280
+ - Why wrong: ${c.reason}
281
+ - Evidence: ${c.evidence}
282
+ `).join('\n')}
283
+
284
+ #### New Insights
285
+
286
+ ${newInsights.join('\n- ')}
287
+
288
+ #### Gemini Analysis
289
+
290
+ ${geminiAnalysis}
291
+
292
+ ${confirmedHypothesis ? `
293
+ #### Root Cause Identified
294
+
295
+ **${confirmedHypothesis.id}**: ${confirmedHypothesis.description}
296
+
297
+ Evidence supporting this conclusion:
298
+ ${confirmedHypothesis.supportingEvidence}
299
+ ` : `
300
+ #### Next Steps
301
+
302
+ ${nextSteps}
303
+ `}
304
+
305
+ ---
306
+
307
+ ## Current Consolidated Understanding (Updated)
308
+
309
+ ### What We Know
310
+
311
+ - ${validUnderstanding1}
312
+ - ${validUnderstanding2}
313
+
314
+ ### What Was Disproven
315
+
316
+ - ~~${wrongAssumption}~~ (Evidence: ${disproofEvidence})
317
+
318
+ ### Current Investigation Focus
319
+
320
+ ${currentFocus}
321
+
322
+ ### Remaining Questions
323
+
324
+ - ${openQuestion1}
325
+ - ${openQuestion2}
326
+ `
327
+
328
+ const existingContent = Read(understandingPath)
329
+ Write(understandingPath, existingContent + analysisEntry)
330
+ ```
331
+
332
+ ### Step 2.4: 更新假设状态
333
+
334
+ ```javascript
335
+ const hypothesesData = JSON.parse(Read(hypothesesPath))
336
+
337
+ // 更新假设状态
338
+ hypothesesData.hypotheses = hypothesesData.hypotheses.map(h => ({
339
+ ...h,
340
+ status: results.find(r => r.id === h.id)?.verdict || h.status,
341
+ evidence: results.find(r => r.id === h.id)?.evidence || h.evidence,
342
+ verdict_reason: results.find(r => r.id === h.id)?.reason || h.verdict_reason
343
+ }))
344
+
345
+ hypothesesData.iteration++
346
+ hypothesesData.timestamp = getUtc8ISOString()
347
+
348
+ Write(hypothesesPath, JSON.stringify(hypothesesData, null, 2))
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Fix & Verification
354
+
355
+ ### Step 3.1: 应用修复
356
+
357
+ ```javascript
358
+ if (confirmedHypothesis) {
359
+ console.log(`\n根因确认: ${confirmedHypothesis.description}`)
360
+ console.log('准备应用修复...')
361
+
362
+ // 使用 Gemini 生成修复代码
363
+ const fixPrompt = `
364
+ PURPOSE: Fix the identified root cause
365
+ Root Cause: ${confirmedHypothesis.description}
366
+ Evidence: ${confirmedHypothesis.supportingEvidence}
367
+
368
+ TASK:
369
+ • Generate fix code
370
+ • Ensure backward compatibility
371
+ • Add tests if needed
372
+
373
+ MODE: write
374
+
375
+ CONTEXT: @${confirmedHypothesis.logging_point.split(':')[0]}
376
+
377
+ EXPECTED: Fixed code + verification steps
378
+ `
379
+
380
+ await Bash({
381
+ command: `ccw cli -p "${fixPrompt}" --tool gemini --mode write --rule development-debug-runtime-issues`,
382
+ run_in_background: false
383
+ })
384
+ }
385
+ ```
386
+
387
+ ### Step 3.2: 记录解决方案
388
+
389
+ ```javascript
390
+ const resolutionEntry = `
391
+ ### Resolution (${getUtc8ISOString()})
392
+
393
+ #### Fix Applied
394
+
395
+ - Modified files: ${modifiedFiles.join(', ')}
396
+ - Fix description: ${fixDescription}
397
+ - Root cause addressed: ${rootCause}
398
+
399
+ #### Verification Results
400
+
401
+ ${verificationResults}
402
+
403
+ #### Lessons Learned
404
+
405
+ 1. ${lesson1}
406
+ 2. ${lesson2}
407
+
408
+ #### Key Insights for Future
409
+
410
+ - ${insight1}
411
+ - ${insight2}
412
+ `
413
+
414
+ const existingContent = Read(understandingPath)
415
+ Write(understandingPath, existingContent + resolutionEntry)
416
+ ```
417
+
418
+ ### Step 3.3: 清理日志
419
+
420
+ ```javascript
421
+ // 移除调试日志
422
+ // (可选,根据用户选择)
423
+ ```
424
+
425
+ ---
426
+
427
+ ## State Updates
428
+
429
+ ```javascript
430
+ return {
431
+ stateUpdates: {
432
+ debug: {
433
+ current_bug: bugDescription,
434
+ hypotheses: hypothesesData.hypotheses,
435
+ confirmed_hypothesis: confirmedHypothesis?.id || null,
436
+ iteration: hypothesesData.iteration,
437
+ last_analysis_at: getUtc8ISOString(),
438
+ understanding_updated: true
439
+ },
440
+ last_action: 'action-debug-with-file'
441
+ },
442
+ continue: true,
443
+ message: confirmedHypothesis
444
+ ? `根因确认: ${confirmedHypothesis.description}\n修复已应用,请验证`
445
+ : `分析完成,需要更多证据\n请复现 bug 后再次执行`
446
+ }
447
+ ```
448
+
449
+ ## Error Handling
450
+
451
+ | Error Type | Recovery |
452
+ |------------|----------|
453
+ | 空 debug.log | 提示用户复现 bug |
454
+ | 所有假设被否定 | 使用 Gemini 生成新假设 |
455
+ | 修复无效 | 记录失败尝试,迭代 |
456
+ | >5 迭代 | 建议升级到 /workflow:lite-fix |
457
+ | Gemini 不可用 | 回退到手动分析 |
458
+
459
+ ## Understanding Document Template
460
+
461
+ 参考 [templates/understanding-template.md](../../templates/understanding-template.md)
462
+
463
+ ## CLI Integration
464
+
465
+ ### 假设生成
466
+ ```bash
467
+ ccw cli -p "PURPOSE: Generate debugging hypotheses..." --tool gemini --mode analysis --rule analysis-diagnose-bug-root-cause
468
+ ```
469
+
470
+ ### 证据分析
471
+ ```bash
472
+ ccw cli -p "PURPOSE: Analyze debug log evidence..." --tool gemini --mode analysis --rule analysis-diagnose-bug-root-cause
473
+ ```
474
+
475
+ ### 生成修复
476
+ ```bash
477
+ ccw cli -p "PURPOSE: Fix the identified root cause..." --tool gemini --mode write --rule development-debug-runtime-issues
478
+ ```
479
+
480
+ ## Next Actions (Hints)
481
+
482
+ - 根因确认: `action-validate-with-file` (验证修复)
483
+ - 需要更多证据: 等待用户复现,再次执行此动作
484
+ - 所有假设否定: 重新执行此动作生成新假设
485
+ - 用户选择: `action-menu` (返回菜单)