claude-code-workflow 6.3.50 → 6.3.52

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 (71) hide show
  1. package/.claude/commands/view.md +367 -0
  2. package/.claude/commands/workflow/merge-plans-with-file.md +807 -0
  3. package/.claude/commands/workflow/quick-plan-with-file.md +808 -0
  4. package/.claude/commands/workflow/unified-execute-with-file.md +807 -0
  5. package/.claude/skills/ccw-help/SKILL.md +72 -12
  6. package/.claude/skills/ccw-help/command.json +922 -520
  7. package/.claude/skills/ccw-help/index/all-agents.json +97 -0
  8. package/.claude/skills/ccw-help/index/all-commands.json +805 -0
  9. package/.claude/skills/ccw-help/index/by-category.json +833 -0
  10. package/.claude/skills/ccw-help/index/by-use-case.json +819 -0
  11. package/.claude/skills/ccw-help/index/command-relationships.json +160 -0
  12. package/.claude/skills/ccw-help/index/essential-commands.json +90 -0
  13. package/.claude/skills/ccw-help/scripts/auto-update.py +34 -0
  14. package/.claude/skills/skill-generator/SKILL.md +255 -208
  15. package/.claude/skills/skill-generator/phases/01-requirements-discovery.md +238 -228
  16. package/.claude/skills/skill-generator/phases/02-structure-generation.md +261 -262
  17. package/.claude/skills/skill-generator/phases/03-phase-generation.md +976 -969
  18. package/.claude/skills/skill-generator/phases/04-specs-templates.md +398 -398
  19. package/.claude/skills/skill-generator/phases/05-validation.md +417 -417
  20. package/.claude/skills/skill-generator/specs/cli-integration.md +131 -131
  21. package/.claude/skills/skill-generator/specs/execution-modes.md +399 -396
  22. package/.claude/skills/skill-generator/specs/reference-docs-spec.md +271 -0
  23. package/.claude/skills/skill-generator/specs/scripting-integration.md +265 -265
  24. package/.claude/skills/skill-generator/specs/skill-requirements.md +466 -466
  25. package/.claude/skills/skill-generator/templates/autonomous-action.md +91 -88
  26. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +89 -89
  27. package/.claude/skills/skill-generator/templates/code-analysis-action.md +148 -149
  28. package/.claude/skills/skill-generator/templates/llm-action.md +367 -367
  29. package/.claude/skills/skill-generator/templates/script-template.md +79 -79
  30. package/.claude/skills/skill-generator/templates/sequential-phase.md +129 -129
  31. package/.claude/skills/skill-generator/templates/skill-md.md +134 -75
  32. package/.codex/prompts/brainstorm-with-file.md +99 -32
  33. package/.codex/prompts/merge-plans-with-file.md +530 -0
  34. package/.codex/prompts/quick-plan-with-file.md +450 -0
  35. package/.codex/prompts/unified-execute-with-file.md +722 -0
  36. package/.codex/skills/codex-issue-plan-execute/SKILL.md +214 -0
  37. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-complete.md +173 -0
  38. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-execute.md +220 -0
  39. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-init.md +86 -0
  40. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-list.md +165 -0
  41. package/.codex/skills/codex-issue-plan-execute/phases/actions/action-plan.md +170 -0
  42. package/.codex/skills/codex-issue-plan-execute/phases/orchestrator.md +212 -0
  43. package/.codex/skills/codex-issue-plan-execute/phases/state-schema.md +136 -0
  44. package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent-system.md +32 -0
  45. package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent.md +323 -0
  46. package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent-system.md +32 -0
  47. package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent.md +224 -0
  48. package/.codex/skills/codex-issue-plan-execute/specs/agent-roles.md +468 -0
  49. package/.codex/skills/codex-issue-plan-execute/specs/issue-handling.md +187 -0
  50. package/.codex/skills/codex-issue-plan-execute/specs/quality-standards.md +231 -0
  51. package/.codex/skills/codex-issue-plan-execute/specs/solution-schema.md +270 -0
  52. package/.codex/skills/codex-issue-plan-execute/specs/subagent-roles.md +32 -0
  53. package/ccw/dist/commands/cli.d.ts.map +1 -1
  54. package/ccw/dist/commands/cli.js +23 -2
  55. package/ccw/dist/commands/cli.js.map +1 -1
  56. package/ccw/dist/core/routes/help-routes.d.ts.map +1 -1
  57. package/ccw/dist/core/routes/help-routes.js +51 -1
  58. package/ccw/dist/core/routes/help-routes.js.map +1 -1
  59. package/ccw/dist/tools/cli-executor-core.d.ts.map +1 -1
  60. package/ccw/dist/tools/cli-executor-core.js +5 -3
  61. package/ccw/dist/tools/cli-executor-core.js.map +1 -1
  62. package/ccw/dist/tools/cli-executor-utils.d.ts +1 -0
  63. package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
  64. package/ccw/dist/tools/cli-executor-utils.js +9 -1
  65. package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
  66. package/ccw/src/commands/cli.ts +26 -2
  67. package/ccw/src/core/routes/help-routes.ts +60 -1
  68. package/ccw/src/templates/dashboard-js/views/help.js +423 -1
  69. package/ccw/src/tools/cli-executor-core.ts +6 -3
  70. package/ccw/src/tools/cli-executor-utils.ts +11 -2
  71. package/package.json +1 -1
@@ -0,0 +1,231 @@
1
+ # Quality Standards
2
+
3
+ 质量评估标准和验收条件。
4
+
5
+ ## Quality Dimensions
6
+
7
+ ### 1. Completeness (完整性) - 25%
8
+
9
+ **定义**:所有必需的结构和字段都存在
10
+
11
+ - [ ] 所有 issues 都有规划或执行结果
12
+ - [ ] 每个 solution 都有完整的 task 列表
13
+ - [ ] 每个 task 都有 acceptance criteria
14
+ - [ ] 状态日志完整记录
15
+
16
+ **评分**:
17
+ - 90-100%:全部完整,可能有可选字段缺失
18
+ - 70-89%:主要字段完整,部分可选字段缺失
19
+ - 50-69%:核心字段完整,重要字段缺失
20
+ - <50%:结构不完整
21
+
22
+ ### 2. Consistency (一致性) - 25%
23
+
24
+ **定义**:整个工作流中的术语、格式、风格统一
25
+
26
+ - [ ] Issue ID/Solution ID 格式统一
27
+ - [ ] Status 值遵循规范
28
+ - [ ] Task 结构一致
29
+ - [ ] 时间戳格式一致(ISO-8601)
30
+
31
+ **评分**:
32
+ - 90-100%:完全一致,无格式混乱
33
+ - 70-89%:大部分一致,偶有格式变化
34
+ - 50-69%:半数一致,混乱明显
35
+ - <50%:严重不一致
36
+
37
+ ### 3. Correctness (正确性) - 25%
38
+
39
+ **定义**:执行过程中没有错误,验收条件都通过
40
+
41
+ - [ ] 无 DAG 循环依赖
42
+ - [ ] 所有测试通过
43
+ - [ ] 所有 acceptance criteria 验证通过
44
+ - [ ] 无代码冲突
45
+
46
+ **评分**:
47
+ - 90-100%:完全正确,无错误
48
+ - 70-89%:基本正确,<10% 错误率
49
+ - 50-69%:有明显错误,10-30% 错误率
50
+ - <50%:错误过多,>30% 错误率
51
+
52
+ ### 4. Clarity (清晰度) - 25%
53
+
54
+ **定义**:文档清晰易读,逻辑清晰
55
+
56
+ - [ ] Task 描述明确可操作
57
+ - [ ] Acceptance criteria 具体明确
58
+ - [ ] 报告结构清晰,易理解
59
+ - [ ] 错误信息详细有帮助
60
+
61
+ **评分**:
62
+ - 90-100%:非常清晰,一目了然
63
+ - 70-89%:大部分清晰,有基本可读性
64
+ - 50-69%:部分清晰,理解有难度
65
+ - <50%:极不清晰,难以理解
66
+
67
+ ## Quality Gates
68
+
69
+ ### Pass (通过)
70
+
71
+ **条件**:总分 >= 80%
72
+
73
+ **结果**:工作流正常完成,可进入下一阶段
74
+
75
+ **检查清单**:
76
+ - [ ] 所有 issues 已规划或执行
77
+ - [ ] 成功率 >= 80%
78
+ - [ ] 无关键错误
79
+ - [ ] 报告完整
80
+
81
+ ### Review (需审查)
82
+
83
+ **条件**:总分 60-79%
84
+
85
+ **结果**:工作流部分完成,有可改进项
86
+
87
+ **常见问题**:
88
+ - 部分 task 失败
89
+ - 某些验收条件未满足
90
+ - 文档不够完整
91
+
92
+ **改进方式**:
93
+ - 检查失败的 task
94
+ - 添加缺失的文档
95
+ - 优化工作流配置
96
+
97
+ ### Fail (失败)
98
+
99
+ **条件**:总分 < 60%
100
+
101
+ **结果**:工作流失败,需重做
102
+
103
+ **常见原因**:
104
+ - 关键 task 失败
105
+ - 规划过程中断
106
+ - 系统错误过多
107
+ - 无法生成有效报告
108
+
109
+ **恢复方式**:
110
+ - 从快照恢复
111
+ - 修复根本问题
112
+ - 重新规划和执行
113
+
114
+ ## Issue Classification
115
+
116
+ ### Errors (必须修复)
117
+
118
+ | 错误 | 影响 | 处理 |
119
+ |------|------|------|
120
+ | DAG 循环依赖 | Critical | 中止规划 |
121
+ | 任务无 acceptance | High | 补充条件 |
122
+ | 提交失败 | High | 调查并重试 |
123
+ | 规划 subagent 超时 | Medium | 重试或跳过 |
124
+ | 无效的 solution ID | Medium | 重新生成 |
125
+
126
+ ### Warnings (应该修复)
127
+
128
+ | 警告 | 影响 | 处理 |
129
+ |------|------|------|
130
+ | Task 执行时间过长 | Medium | 考虑拆分 |
131
+ | 测试覆盖率低 | Medium | 补充测试 |
132
+ | 多个解决方案 | Low | 明确选择 |
133
+ | Criteria 不具体 | Low | 改进措辞 |
134
+
135
+ ### Info (可选改进)
136
+
137
+ | 信息 | 说明 |
138
+ |------|------|
139
+ | 建议任务数 | 2-7 个任务为最优 |
140
+ | 时间建议 | 总耗时 <= 2 小时为佳 |
141
+ | 代码风格 | 检查是否遵循项目规范 |
142
+
143
+ ## 执行检查清单
144
+
145
+ ### 规划阶段
146
+
147
+ - [ ] Issue 描述清晰
148
+ - [ ] 生成了有效的 solution
149
+ - [ ] 所有 task 有 acceptance criteria
150
+ - [ ] 依赖关系正确
151
+
152
+ ### 执行阶段
153
+
154
+ - [ ] 每个 task 实现完整
155
+ - [ ] 所有测试通过
156
+ - [ ] 所有 acceptance criteria 验证通过
157
+ - [ ] 提交信息规范
158
+
159
+ ### 完成阶段
160
+
161
+ - [ ] 生成了最终报告
162
+ - [ ] 统计信息准确
163
+ - [ ] 状态持久化完整
164
+ - [ ] 快照保存无误
165
+
166
+ ## 自动化验证函数
167
+
168
+ ```javascript
169
+ function runQualityChecks(workDir) {
170
+ const state = JSON.parse(Read(`${workDir}/state.json`));
171
+ const issues = state.issues || {};
172
+
173
+ const scores = {
174
+ completeness: checkCompleteness(issues),
175
+ consistency: checkConsistency(state),
176
+ correctness: checkCorrectness(issues),
177
+ clarity: checkClarity(state)
178
+ };
179
+
180
+ const overall = Object.values(scores).reduce((a, b) => a + b) / 4;
181
+
182
+ return {
183
+ scores: scores,
184
+ overall: overall.toFixed(1),
185
+ gate: overall >= 80 ? 'pass' : overall >= 60 ? 'review' : 'fail',
186
+ details: {
187
+ issues_total: Object.keys(issues).length,
188
+ completed: Object.values(issues).filter(i => i.status === 'completed').length,
189
+ failed: Object.values(issues).filter(i => i.status === 'failed').length
190
+ }
191
+ };
192
+ }
193
+ ```
194
+
195
+ ## 报告模板
196
+
197
+ ```markdown
198
+ # Quality Report
199
+
200
+ ## Scores
201
+
202
+ | Dimension | Score | Status |
203
+ |-----------|-------|--------|
204
+ | Completeness | 90% | ✓ |
205
+ | Consistency | 85% | ✓ |
206
+ | Correctness | 92% | ✓ |
207
+ | Clarity | 88% | ✓ |
208
+ | **Overall** | **89%** | **PASS** |
209
+
210
+ ## Issues Summary
211
+
212
+ - Total: 10
213
+ - Completed: 8 (80%)
214
+ - Failed: 2 (20%)
215
+ - Pending: 0 (0%)
216
+
217
+ ## Recommendations
218
+
219
+ 1. ...
220
+ 2. ...
221
+
222
+ ## Errors & Warnings
223
+
224
+ ### Errors (0)
225
+
226
+ None
227
+
228
+ ### Warnings (1)
229
+
230
+ - Task T4 in ISS-003 took 45 minutes (expected 30)
231
+ ```
@@ -0,0 +1,270 @@
1
+ # Solution Schema Specification
2
+
3
+ 解决方案数据结构和验证规则。
4
+
5
+ ## When to Use
6
+
7
+ | Phase | Usage | Section |
8
+ |-------|-------|---------|
9
+ | Phase: action-plan | Solution 生成 | Solution Structure |
10
+ | Phase: action-execute | Task 解析 | Task Definition |
11
+
12
+ ---
13
+
14
+ ## Solution Structure
15
+
16
+ ### 完整 Schema
17
+
18
+ ```json
19
+ {
20
+ "id": "SOL-ISS-001-1",
21
+ "issue_id": "ISS-001",
22
+ "description": "Fix authentication token expiration by extending TTL",
23
+ "strategy_type": "bugfix",
24
+ "created_at": "2025-01-29T11:00:00Z",
25
+ "tasks": [
26
+ {
27
+ "id": "T1",
28
+ "title": "Update token TTL configuration",
29
+ "action": "Modify",
30
+ "scope": "src/config/auth.ts",
31
+ "description": "Increase JWT token expiration from 1h to 24h",
32
+ "modification_points": [
33
+ {
34
+ "file": "src/config/auth.ts",
35
+ "target": "JWT_EXPIRY",
36
+ "change": "Change value from 3600 to 86400"
37
+ }
38
+ ],
39
+ "implementation": [
40
+ "Open src/config/auth.ts",
41
+ "Locate JWT_EXPIRY constant",
42
+ "Update value: 3600 → 86400",
43
+ "Add comment explaining change"
44
+ ],
45
+ "test": {
46
+ "commands": ["npm test -- auth.config.test.ts"],
47
+ "unit": ["Token expiration should be 24h"],
48
+ "integration": []
49
+ },
50
+ "acceptance": {
51
+ "criteria": [
52
+ "Unit tests pass",
53
+ "Token TTL is correctly set",
54
+ "No breaking changes to API"
55
+ ],
56
+ "verification": [
57
+ "Run: npm test",
58
+ "Manual: Verify token in console"
59
+ ]
60
+ },
61
+ "depends_on": [],
62
+ "estimated_minutes": 15,
63
+ "priority": 1
64
+ }
65
+ ],
66
+ "exploration_context": {
67
+ "relevant_files": [
68
+ "src/config/auth.ts",
69
+ "src/services/auth.service.ts",
70
+ "tests/auth.test.ts"
71
+ ],
72
+ "patterns": "Follow existing config pattern in .env",
73
+ "integration_points": "Used by AuthService in middleware"
74
+ },
75
+ "analysis": {
76
+ "risk": "low",
77
+ "impact": "medium",
78
+ "complexity": "low"
79
+ },
80
+ "score": 0.95,
81
+ "is_bound": true
82
+ }
83
+ ```
84
+
85
+ ## 字段说明
86
+
87
+ ### 基础字段
88
+
89
+ | 字段 | 类型 | 必需 | 说明 |
90
+ |------|------|------|------|
91
+ | `id` | string | ✓ | 唯一 ID:SOL-{issue-id}-{seq} |
92
+ | `issue_id` | string | ✓ | 关联的 Issue ID |
93
+ | `description` | string | ✓ | 解决方案描述 |
94
+ | `strategy_type` | string | | 策略类型:bugfix/feature/refactor |
95
+ | `tasks` | array | ✓ | 任务列表,至少 1 个 |
96
+
97
+ ### Task 字段
98
+
99
+ | 字段 | 类型 | 说明 |
100
+ |------|------|------|
101
+ | `id` | string | 任务 ID:T1, T2, ... |
102
+ | `title` | string | 任务标题 |
103
+ | `action` | string | 动作类型:Create/Modify/Fix/Refactor |
104
+ | `scope` | string | 作用范围:文件或目录 |
105
+ | `modification_points` | array | 具体修改点列表 |
106
+ | `implementation` | array | 实现步骤 |
107
+ | `test` | object | 测试命令和用例 |
108
+ | `acceptance` | object | 验收条件和验证步骤 |
109
+ | `depends_on` | array | 任务依赖:[T1, T2] |
110
+ | `estimated_minutes` | number | 预计耗时(分钟) |
111
+
112
+ ### 验收条件
113
+
114
+ ```json
115
+ {
116
+ "acceptance": {
117
+ "criteria": [
118
+ "Unit tests pass",
119
+ "Function returns correct result",
120
+ "No performance regression"
121
+ ],
122
+ "verification": [
123
+ "Run: npm test -- module.test.ts",
124
+ "Manual: Call function and verify output"
125
+ ]
126
+ }
127
+ }
128
+ ```
129
+
130
+ ## 验证规则
131
+
132
+ ### 必需字段检查
133
+
134
+ ```javascript
135
+ function validateSolution(solution) {
136
+ if (!solution.id) throw new Error("Missing: id");
137
+ if (!solution.issue_id) throw new Error("Missing: issue_id");
138
+ if (!solution.description) throw new Error("Missing: description");
139
+ if (!Array.isArray(solution.tasks)) throw new Error("tasks must be array");
140
+ if (solution.tasks.length === 0) throw new Error("tasks cannot be empty");
141
+ return true;
142
+ }
143
+
144
+ function validateTask(task) {
145
+ if (!task.id) throw new Error("Missing: task.id");
146
+ if (!task.title) throw new Error("Missing: task.title");
147
+ if (!task.action) throw new Error("Missing: task.action");
148
+ if (!Array.isArray(task.implementation)) throw new Error("implementation must be array");
149
+ if (!task.acceptance) throw new Error("Missing: task.acceptance");
150
+ if (!Array.isArray(task.acceptance.criteria)) throw new Error("acceptance.criteria must be array");
151
+ if (task.acceptance.criteria.length === 0) throw new Error("acceptance.criteria cannot be empty");
152
+ return true;
153
+ }
154
+ ```
155
+
156
+ ### 格式验证
157
+
158
+ - ID 格式:`SOL-ISS-\d+-\d+`
159
+ - Action 值:Create | Modify | Fix | Refactor | Add | Remove
160
+ - Risk/Impact/Complexity 值:low | medium | high
161
+ - Score 范围:0.0 - 1.0
162
+
163
+ ## 任务依赖
164
+
165
+ ### 表示方法
166
+
167
+ ```json
168
+ {
169
+ "tasks": [
170
+ {
171
+ "id": "T1",
172
+ "title": "Create auth module",
173
+ "depends_on": []
174
+ },
175
+ {
176
+ "id": "T2",
177
+ "title": "Add authentication logic",
178
+ "depends_on": ["T1"]
179
+ },
180
+ {
181
+ "id": "T3",
182
+ "title": "Add tests",
183
+ "depends_on": ["T1", "T2"]
184
+ }
185
+ ]
186
+ }
187
+ ```
188
+
189
+ ### DAG 验证
190
+
191
+ ```javascript
192
+ function validateDAG(tasks) {
193
+ const visited = new Set();
194
+ const recursionStack = new Set();
195
+
196
+ function hasCycle(taskId) {
197
+ visited.add(taskId);
198
+ recursionStack.add(taskId);
199
+
200
+ const task = tasks.find(t => t.id === taskId);
201
+ if (!task || !task.depends_on) return false;
202
+
203
+ for (const dep of task.depends_on) {
204
+ if (!visited.has(dep)) {
205
+ if (hasCycle(dep)) return true;
206
+ } else if (recursionStack.has(dep)) {
207
+ return true; // 发现循环
208
+ }
209
+ }
210
+
211
+ recursionStack.delete(taskId);
212
+ return false;
213
+ }
214
+
215
+ for (const task of tasks) {
216
+ if (!visited.has(task.id) && hasCycle(task.id)) {
217
+ throw new Error(`Circular dependency detected: ${task.id}`);
218
+ }
219
+ }
220
+ return true;
221
+ }
222
+ ```
223
+
224
+ ## 文件保存
225
+
226
+ ### 位置
227
+
228
+ ```
229
+ .workflow/.scratchpad/codex-issue-{timestamp}/solutions/
230
+ ├── ISS-001-plan.json # 规划结果
231
+ ├── ISS-001-execution.json # 执行结果
232
+ ├── ISS-002-plan.json
233
+ └── ISS-002-execution.json
234
+ ```
235
+
236
+ ### 文件内容
237
+
238
+ **规划结果**:包含 solution 完整定义
239
+ **执行结果**:包含执行状态和提交信息
240
+
241
+ ```json
242
+ {
243
+ "solution_id": "SOL-ISS-001-1",
244
+ "status": "completed|failed",
245
+ "executed_at": "ISO-8601",
246
+ "execution_result": {
247
+ "files_modified": ["src/auth.ts"],
248
+ "commit_hash": "abc123...",
249
+ "tests_passed": true
250
+ }
251
+ }
252
+ ```
253
+
254
+ ## 质量门控
255
+
256
+ ### Solution 评分标准
257
+
258
+ | 指标 | 权重 | 评分方法 |
259
+ |------|------|----------|
260
+ | 任务完整性 | 30% | 无空任务,每个任务有 acceptance |
261
+ | 依赖合法性 | 20% | 无循环依赖,依赖链清晰 |
262
+ | 验收可测 | 30% | Criteria 明确可测,有验证步骤 |
263
+ | 复杂度评估 | 20% | Risk/Impact/Complexity 合理评估 |
264
+
265
+ ### 通过条件
266
+
267
+ - 所有必需字段存在
268
+ - 无格式错误
269
+ - 无循环依赖
270
+ - Score >= 0.8
@@ -0,0 +1,32 @@
1
+ ⚠️ **DEPRECATED** - This file is deprecated as of v2.0 (2025-01-29)
2
+
3
+ **Use instead**: [`agent-roles.md`](agent-roles.md)
4
+
5
+ This file has been superseded by a consolidated `agent-roles.md` that improves organization and eliminates duplication.
6
+
7
+ **Why the change?**
8
+ - Consolidates all agent role definitions in one place
9
+ - Eliminates duplicated role descriptions
10
+ - Single source of truth for agent capabilities
11
+ - Better organization with unified reference format
12
+
13
+ **Migration**:
14
+ ```javascript
15
+ // OLD (v1.0)
16
+ // Reference: specs/subagent-roles.md
17
+
18
+ // NEW (v2.0)
19
+ // Reference: specs/agent-roles.md
20
+ ```
21
+
22
+ **Timeline**:
23
+ - v2.0 (2025-01-29): Old file kept for backward compatibility
24
+ - v2.1 (2025-03-31): Old file will be removed
25
+
26
+ ---
27
+
28
+ # Subagent Roles Definition (Legacy - See agent-roles.md instead)
29
+
30
+ See [`agent-roles.md`](agent-roles.md) for the current consolidated agent roles specification.
31
+
32
+ All content has been merged into the new agent-roles.md file with improved organization and formatting.
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/commands/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4GH,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAQD,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+pCD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,OAAO,EAAE,cAAc,GAAG,cAAc,GACvC,OAAO,CAAC,IAAI,CAAC,CA8Hf"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/commands/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoHH,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAQD,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA+qCD;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,OAAO,EAAE,cAAc,GAAG,cAAc,GACvC,OAAO,CAAC,IAAI,CAAC,CA8Hf"}
@@ -54,6 +54,9 @@ function notifyDashboard(data) {
54
54
  * Uses specific event types that match frontend handlers
55
55
  */
56
56
  function broadcastStreamEvent(eventType, payload) {
57
+ if (process.env.DEBUG_CLI_EVENTS) {
58
+ console.error(`[CLI-BROADCAST] START ${eventType} at ${Date.now()}`);
59
+ }
57
60
  const data = JSON.stringify({
58
61
  type: eventType,
59
62
  ...payload,
@@ -82,6 +85,9 @@ function broadcastStreamEvent(eventType, payload) {
82
85
  });
83
86
  req.write(data);
84
87
  req.end();
88
+ if (process.env.DEBUG_CLI_EVENTS) {
89
+ console.error(`[CLI-BROADCAST] END ${eventType} at ${Date.now()}`);
90
+ }
85
91
  }
86
92
  /**
87
93
  * Show storage information and management options
@@ -756,6 +762,9 @@ async function execAction(positionalPrompt, options) {
756
762
  tool,
757
763
  mode
758
764
  });
765
+ if (process.env.DEBUG) {
766
+ console.error(`[CLI] Generated executionId: ${executionId}`);
767
+ }
759
768
  // Buffer to accumulate output when both --stream and --to-file are specified
760
769
  let streamBuffer = '';
761
770
  // Streaming output handler - broadcasts to dashboard AND writes to stdout
@@ -820,7 +829,7 @@ async function execAction(positionalPrompt, options) {
820
829
  includeDirs,
821
830
  // timeout removed - controlled by external caller (bash timeout)
822
831
  resume,
823
- id, // custom execution ID
832
+ id: executionId, // unified execution ID (matches broadcast events)
824
833
  noNative,
825
834
  stream: !!stream, // stream=true → streaming enabled (no cache), stream=false → cache output (default)
826
835
  outputFormat, // Enable JSONL parsing for tools that support it
@@ -925,14 +934,26 @@ async function execAction(positionalPrompt, options) {
925
934
  turn_count: result.conversation.turn_count
926
935
  });
927
936
  // Broadcast CLI_EXECUTION_COMPLETED for real-time streaming viewer
937
+ if (process.env.DEBUG_CLI_EVENTS) {
938
+ console.error(`[CLI-TIMING] Broadcasting CLI_EXECUTION_COMPLETED at ${Date.now()}`);
939
+ }
928
940
  broadcastStreamEvent('CLI_EXECUTION_COMPLETED', {
929
941
  executionId, // Use the same executionId as started event
930
942
  success: true,
931
943
  duration: result.execution.duration_ms
932
944
  });
945
+ if (process.env.DEBUG_CLI_EVENTS) {
946
+ console.error(`[CLI-TIMING] Broadcast returned, setting timeout at ${Date.now()}`);
947
+ }
933
948
  // Ensure clean exit after successful execution
934
949
  // Delay to allow HTTP request to complete
935
- setTimeout(() => process.exit(0), 150);
950
+ // FIX: Increased from 150ms to 500ms for long-running executions
951
+ setTimeout(() => {
952
+ if (process.env.DEBUG_CLI_EVENTS) {
953
+ console.error(`[CLI-TIMING] process.exit(0) at ${Date.now()}`);
954
+ }
955
+ process.exit(0);
956
+ }, 500);
936
957
  }
937
958
  else {
938
959
  if (!spinner) {