claude-code-workflow 6.3.4 → 6.3.6
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/agents/issue-plan-agent.md +859 -0
- package/.claude/agents/issue-queue-agent.md +702 -0
- package/.claude/commands/issue/execute.md +453 -0
- package/.claude/commands/issue/manage.md +865 -0
- package/.claude/commands/issue/new.md +484 -0
- package/.claude/commands/issue/plan.md +421 -0
- package/.claude/commands/issue/queue.md +354 -0
- package/.claude/commands/{clean.md → workflow/clean.md} +5 -5
- package/.claude/commands/workflow/docs/analyze.md +1467 -0
- package/.claude/commands/workflow/docs/copyright.md +1265 -0
- package/.claude/commands/workflow/execute.md +0 -1
- package/.claude/commands/workflow/tools/conflict-resolution.md +76 -240
- package/.claude/commands/workflow/tools/context-gather.md +0 -2
- package/.claude/commands/workflow/tools/task-generate-agent.md +81 -8
- package/.claude/commands/workflow/tools/task-generate-tdd.md +0 -9
- package/.claude/commands/workflow/tools/test-context-gather.md +2 -3
- package/.claude/commands/workflow/tools/test-task-generate.md +0 -2
- package/.claude/skills/_shared/mermaid-utils.md +584 -0
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +0 -2
- package/.claude/skills/command-guide/reference/commands/workflow/execute.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +1 -2
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +1 -8
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-context-gather.md +1 -4
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +0 -2
- package/.claude/skills/copyright-docs/SKILL.md +132 -0
- package/.claude/skills/copyright-docs/phases/01-metadata-collection.md +78 -0
- package/.claude/skills/copyright-docs/phases/01.5-project-exploration.md +150 -0
- package/.claude/skills/copyright-docs/phases/02-deep-analysis.md +664 -0
- package/.claude/skills/copyright-docs/phases/02.5-consolidation.md +192 -0
- package/.claude/skills/copyright-docs/phases/04-document-assembly.md +261 -0
- package/.claude/skills/copyright-docs/phases/05-compliance-refinement.md +192 -0
- package/.claude/skills/copyright-docs/specs/cpcc-requirements.md +121 -0
- package/.claude/skills/copyright-docs/templates/agent-base.md +200 -0
- package/.claude/skills/project-analyze/SKILL.md +162 -0
- package/.claude/skills/project-analyze/phases/01-requirements-discovery.md +79 -0
- package/.claude/skills/project-analyze/phases/02-project-exploration.md +176 -0
- package/.claude/skills/project-analyze/phases/03-deep-analysis.md +854 -0
- package/.claude/skills/project-analyze/phases/03.5-consolidation.md +233 -0
- package/.claude/skills/project-analyze/phases/04-report-generation.md +217 -0
- package/.claude/skills/project-analyze/phases/05-iterative-refinement.md +124 -0
- package/.claude/skills/project-analyze/specs/quality-standards.md +115 -0
- package/.claude/skills/project-analyze/specs/writing-style.md +152 -0
- package/.claude/workflows/cli-templates/schemas/conflict-resolution-schema.json +79 -65
- package/.claude/workflows/cli-templates/schemas/issue-task-jsonl-schema.json +136 -0
- package/.claude/workflows/cli-templates/schemas/issues-jsonl-schema.json +74 -0
- package/.claude/workflows/cli-templates/schemas/queue-schema.json +136 -0
- package/.claude/workflows/cli-templates/schemas/registry-schema.json +94 -0
- package/.claude/workflows/cli-templates/schemas/solution-schema.json +120 -0
- package/.claude/workflows/cli-templates/schemas/solutions-jsonl-schema.json +125 -0
- package/.codex/prompts/issue-execute.md +266 -0
- package/README.md +11 -1
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +25 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/cli.d.ts.map +1 -1
- package/ccw/dist/commands/cli.js +46 -8
- package/ccw/dist/commands/cli.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +21 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -0
- package/ccw/dist/commands/issue.js +895 -0
- package/ccw/dist/commands/issue.js.map +1 -0
- package/ccw/dist/core/dashboard-generator-patch.js +1 -0
- package/ccw/dist/core/dashboard-generator-patch.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +2 -2
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts +34 -0
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -0
- package/ccw/dist/core/routes/issue-routes.js +487 -0
- package/ccw/dist/core/routes/issue-routes.js.map +1 -0
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +17 -2
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts +7 -3
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +31 -17
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/smart-search.d.ts +25 -0
- package/ccw/dist/tools/smart-search.d.ts.map +1 -1
- package/ccw/dist/tools/smart-search.js +121 -17
- package/ccw/dist/tools/smart-search.js.map +1 -1
- package/ccw/src/cli.ts +26 -0
- package/ccw/src/commands/cli.ts +49 -7
- package/ccw/src/commands/issue.ts +1184 -0
- package/ccw/src/core/dashboard-generator-patch.ts +1 -0
- package/ccw/src/core/routes/cli-routes.ts +3 -3
- package/ccw/src/core/routes/issue-routes.ts +559 -0
- package/ccw/src/core/server.ts +17 -2
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +2544 -0
- package/ccw/src/templates/dashboard-css/33-cli-stream-viewer.css +467 -0
- package/ccw/src/templates/dashboard-js/components/cli-history.js +40 -13
- package/ccw/src/templates/dashboard-js/components/cli-status.js +26 -2
- package/ccw/src/templates/dashboard-js/components/cli-stream-viewer.js +461 -0
- package/ccw/src/templates/dashboard-js/components/navigation.js +8 -0
- package/ccw/src/templates/dashboard-js/components/notifications.js +16 -0
- package/ccw/src/templates/dashboard-js/i18n.js +290 -2
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +5 -0
- package/ccw/src/templates/dashboard-js/views/history.js +19 -4
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +11 -5
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +1546 -0
- package/ccw/src/templates/dashboard.html +55 -0
- package/ccw/src/tools/claude-cli-tools.ts +37 -20
- package/ccw/src/tools/smart-search.ts +157 -16
- package/codex-lens/src/codexlens/__pycache__/config.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/config.py +5 -0
- package/codex-lens/src/codexlens/search/__pycache__/hybrid_search.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/__pycache__/ranking.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/search/hybrid_search.py +144 -11
- package/codex-lens/src/codexlens/search/ranking.py +267 -1
- package/codex-lens/src/codexlens/semantic/__pycache__/chunker.cpython-313.pyc +0 -0
- package/codex-lens/src/codexlens/semantic/chunker.py +55 -10
- package/package.json +2 -2
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: execute
|
|
3
|
+
description: Execute queue with codex using endpoint-driven task fetching (single task per codex instance)
|
|
4
|
+
argument-hint: "[--parallel <n>] [--executor codex|gemini]"
|
|
5
|
+
allowed-tools: TodoWrite(*), Bash(*), Read(*), AskUserQuestion(*)
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Issue Execute Command (/issue:execute)
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
Execution orchestrator that coordinates codex instances. Each task is executed by an independent codex instance that fetches its task via CLI endpoint. **Codex does NOT read task files** - it calls `ccw issue next` to get task data dynamically.
|
|
13
|
+
|
|
14
|
+
**Core design:**
|
|
15
|
+
- Single task per codex instance (not loop mode)
|
|
16
|
+
- Endpoint-driven: `ccw issue next` → execute → `ccw issue complete`
|
|
17
|
+
- No file reading in codex
|
|
18
|
+
- Orchestrator manages parallelism
|
|
19
|
+
|
|
20
|
+
## Storage Structure (Flat JSONL)
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
.workflow/issues/
|
|
24
|
+
├── issues.jsonl # All issues (one per line)
|
|
25
|
+
├── queue.json # Execution queue
|
|
26
|
+
└── solutions/
|
|
27
|
+
├── {issue-id}.jsonl # Solutions for issue
|
|
28
|
+
└── ...
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
/issue:execute [FLAGS]
|
|
35
|
+
|
|
36
|
+
# Examples
|
|
37
|
+
/issue:execute # Execute all ready tasks
|
|
38
|
+
/issue:execute --parallel 3 # Execute up to 3 tasks in parallel
|
|
39
|
+
/issue:execute --executor codex # Force codex executor
|
|
40
|
+
|
|
41
|
+
# Flags
|
|
42
|
+
--parallel <n> Max parallel codex instances (default: 1)
|
|
43
|
+
--executor <type> Force executor: codex|gemini|agent
|
|
44
|
+
--dry-run Show what would execute without running
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Execution Process
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
Phase 1: Queue Loading
|
|
51
|
+
├─ Load queue.json
|
|
52
|
+
├─ Count pending/ready tasks
|
|
53
|
+
└─ Initialize TodoWrite tracking
|
|
54
|
+
|
|
55
|
+
Phase 2: Ready Task Detection
|
|
56
|
+
├─ Find tasks with satisfied dependencies
|
|
57
|
+
├─ Group by execution_group (parallel batches)
|
|
58
|
+
└─ Determine execution order
|
|
59
|
+
|
|
60
|
+
Phase 3: Codex Coordination
|
|
61
|
+
├─ For each ready task:
|
|
62
|
+
│ ├─ Launch independent codex instance
|
|
63
|
+
│ ├─ Codex calls: ccw issue next
|
|
64
|
+
│ ├─ Codex receives task data (NOT file)
|
|
65
|
+
│ ├─ Codex executes task
|
|
66
|
+
│ ├─ Codex calls: ccw issue complete <queue-id>
|
|
67
|
+
│ └─ Update TodoWrite
|
|
68
|
+
└─ Parallel execution based on --parallel flag
|
|
69
|
+
|
|
70
|
+
Phase 4: Completion
|
|
71
|
+
├─ Generate execution summary
|
|
72
|
+
├─ Update issue statuses in issues.jsonl
|
|
73
|
+
└─ Display results
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Implementation
|
|
77
|
+
|
|
78
|
+
### Phase 1: Queue Loading
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
// Load queue
|
|
82
|
+
const queuePath = '.workflow/issues/queue.json';
|
|
83
|
+
if (!Bash(`test -f "${queuePath}" && echo exists`).includes('exists')) {
|
|
84
|
+
console.log('No queue found. Run /issue:queue first.');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const queue = JSON.parse(Read(queuePath));
|
|
89
|
+
|
|
90
|
+
// Count by status
|
|
91
|
+
const pending = queue.queue.filter(q => q.status === 'pending');
|
|
92
|
+
const executing = queue.queue.filter(q => q.status === 'executing');
|
|
93
|
+
const completed = queue.queue.filter(q => q.status === 'completed');
|
|
94
|
+
|
|
95
|
+
console.log(`
|
|
96
|
+
## Execution Queue Status
|
|
97
|
+
|
|
98
|
+
- Pending: ${pending.length}
|
|
99
|
+
- Executing: ${executing.length}
|
|
100
|
+
- Completed: ${completed.length}
|
|
101
|
+
- Total: ${queue.queue.length}
|
|
102
|
+
`);
|
|
103
|
+
|
|
104
|
+
if (pending.length === 0 && executing.length === 0) {
|
|
105
|
+
console.log('All tasks completed!');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Phase 2: Ready Task Detection
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
// Find ready tasks (dependencies satisfied)
|
|
114
|
+
function getReadyTasks() {
|
|
115
|
+
const completedIds = new Set(
|
|
116
|
+
queue.queue.filter(q => q.status === 'completed').map(q => q.queue_id)
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return queue.queue.filter(item => {
|
|
120
|
+
if (item.status !== 'pending') return false;
|
|
121
|
+
return item.depends_on.every(depId => completedIds.has(depId));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const readyTasks = getReadyTasks();
|
|
126
|
+
|
|
127
|
+
if (readyTasks.length === 0) {
|
|
128
|
+
if (executing.length > 0) {
|
|
129
|
+
console.log('Tasks are currently executing. Wait for completion.');
|
|
130
|
+
} else {
|
|
131
|
+
console.log('No ready tasks. Check for blocked dependencies.');
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log(`Found ${readyTasks.length} ready tasks`);
|
|
137
|
+
|
|
138
|
+
// Sort by execution order
|
|
139
|
+
readyTasks.sort((a, b) => a.execution_order - b.execution_order);
|
|
140
|
+
|
|
141
|
+
// Initialize TodoWrite
|
|
142
|
+
TodoWrite({
|
|
143
|
+
todos: readyTasks.slice(0, parallelLimit).map(t => ({
|
|
144
|
+
content: `[${t.queue_id}] ${t.issue_id}:${t.task_id}`,
|
|
145
|
+
status: 'pending',
|
|
146
|
+
activeForm: `Executing ${t.queue_id}`
|
|
147
|
+
}))
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Phase 3: Codex Coordination (Single Task Mode - Full Lifecycle)
|
|
152
|
+
|
|
153
|
+
```javascript
|
|
154
|
+
// Execute tasks - single codex instance per task with full lifecycle
|
|
155
|
+
async function executeTask(queueItem) {
|
|
156
|
+
const codexPrompt = `
|
|
157
|
+
## Single Task Execution - CLOSED-LOOP LIFECYCLE
|
|
158
|
+
|
|
159
|
+
You are executing ONE task from the issue queue. Each task has 5 phases that MUST ALL complete successfully.
|
|
160
|
+
|
|
161
|
+
### Step 1: Fetch Task
|
|
162
|
+
Run this command to get your task:
|
|
163
|
+
\`\`\`bash
|
|
164
|
+
ccw issue next
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
167
|
+
This returns JSON with full lifecycle definition:
|
|
168
|
+
- task.implementation: Implementation steps
|
|
169
|
+
- task.test: Test requirements and commands
|
|
170
|
+
- task.regression: Regression check commands
|
|
171
|
+
- task.acceptance: Acceptance criteria and verification
|
|
172
|
+
- task.commit: Commit specification
|
|
173
|
+
|
|
174
|
+
### Step 2: Execute Full Lifecycle
|
|
175
|
+
|
|
176
|
+
**Phase 1: IMPLEMENT**
|
|
177
|
+
1. Follow task.implementation steps in order
|
|
178
|
+
2. Modify files specified in modification_points
|
|
179
|
+
3. Use context.relevant_files for reference
|
|
180
|
+
4. Use context.patterns for code style
|
|
181
|
+
|
|
182
|
+
**Phase 2: TEST**
|
|
183
|
+
1. Run test commands from task.test.commands
|
|
184
|
+
2. Ensure all unit tests pass (task.test.unit)
|
|
185
|
+
3. Run integration tests if specified (task.test.integration)
|
|
186
|
+
4. Verify coverage meets task.test.coverage_target if specified
|
|
187
|
+
5. If tests fail → fix code and re-run, do NOT proceed until tests pass
|
|
188
|
+
|
|
189
|
+
**Phase 3: REGRESSION**
|
|
190
|
+
1. Run all commands in task.regression
|
|
191
|
+
2. Ensure no existing tests are broken
|
|
192
|
+
3. If regression fails → fix and re-run
|
|
193
|
+
|
|
194
|
+
**Phase 4: ACCEPTANCE**
|
|
195
|
+
1. Verify each criterion in task.acceptance.criteria
|
|
196
|
+
2. Execute verification steps in task.acceptance.verification
|
|
197
|
+
3. Complete any manual_checks if specified
|
|
198
|
+
4. All criteria MUST pass before proceeding
|
|
199
|
+
|
|
200
|
+
**Phase 5: COMMIT**
|
|
201
|
+
1. Stage all modified files
|
|
202
|
+
2. Use task.commit.message_template as commit message
|
|
203
|
+
3. Commit with: git commit -m "$(cat <<'EOF'\n<message>\nEOF\n)"
|
|
204
|
+
4. If commit_strategy is 'per-task', commit now
|
|
205
|
+
5. If commit_strategy is 'atomic' or 'squash', stage but don't commit
|
|
206
|
+
|
|
207
|
+
### Step 3: Report Completion
|
|
208
|
+
When ALL phases complete successfully:
|
|
209
|
+
\`\`\`bash
|
|
210
|
+
ccw issue complete <queue_id> --result '{
|
|
211
|
+
"files_modified": ["path1", "path2"],
|
|
212
|
+
"tests_passed": true,
|
|
213
|
+
"regression_passed": true,
|
|
214
|
+
"acceptance_passed": true,
|
|
215
|
+
"committed": true,
|
|
216
|
+
"commit_hash": "<hash>",
|
|
217
|
+
"summary": "What was done"
|
|
218
|
+
}'
|
|
219
|
+
\`\`\`
|
|
220
|
+
|
|
221
|
+
If any phase fails and cannot be fixed:
|
|
222
|
+
\`\`\`bash
|
|
223
|
+
ccw issue fail <queue_id> --reason "Phase X failed: <details>"
|
|
224
|
+
\`\`\`
|
|
225
|
+
|
|
226
|
+
### Rules
|
|
227
|
+
- NEVER skip any lifecycle phase
|
|
228
|
+
- Tests MUST pass before proceeding to acceptance
|
|
229
|
+
- Regression MUST pass before commit
|
|
230
|
+
- ALL acceptance criteria MUST be verified
|
|
231
|
+
- Report accurate lifecycle status in result
|
|
232
|
+
|
|
233
|
+
### Start Now
|
|
234
|
+
Begin by running: ccw issue next
|
|
235
|
+
`;
|
|
236
|
+
|
|
237
|
+
// Execute codex
|
|
238
|
+
const executor = queueItem.assigned_executor || flags.executor || 'codex';
|
|
239
|
+
|
|
240
|
+
if (executor === 'codex') {
|
|
241
|
+
Bash(
|
|
242
|
+
`ccw cli -p "${escapePrompt(codexPrompt)}" --tool codex --mode write --id exec-${queueItem.queue_id}`,
|
|
243
|
+
timeout=3600000 // 1 hour timeout
|
|
244
|
+
);
|
|
245
|
+
} else if (executor === 'gemini') {
|
|
246
|
+
Bash(
|
|
247
|
+
`ccw cli -p "${escapePrompt(codexPrompt)}" --tool gemini --mode write --id exec-${queueItem.queue_id}`,
|
|
248
|
+
timeout=1800000 // 30 min timeout
|
|
249
|
+
);
|
|
250
|
+
} else {
|
|
251
|
+
// Agent execution
|
|
252
|
+
Task(
|
|
253
|
+
subagent_type="code-developer",
|
|
254
|
+
run_in_background=false,
|
|
255
|
+
description=`Execute ${queueItem.queue_id}`,
|
|
256
|
+
prompt=codexPrompt
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Execute with parallelism
|
|
262
|
+
const parallelLimit = flags.parallel || 1;
|
|
263
|
+
|
|
264
|
+
for (let i = 0; i < readyTasks.length; i += parallelLimit) {
|
|
265
|
+
const batch = readyTasks.slice(i, i + parallelLimit);
|
|
266
|
+
|
|
267
|
+
console.log(`\n### Executing Batch ${Math.floor(i / parallelLimit) + 1}`);
|
|
268
|
+
console.log(batch.map(t => `- ${t.queue_id}: ${t.issue_id}:${t.task_id}`).join('\n'));
|
|
269
|
+
|
|
270
|
+
if (parallelLimit === 1) {
|
|
271
|
+
// Sequential execution
|
|
272
|
+
for (const task of batch) {
|
|
273
|
+
updateTodo(task.queue_id, 'in_progress');
|
|
274
|
+
await executeTask(task);
|
|
275
|
+
updateTodo(task.queue_id, 'completed');
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
// Parallel execution - launch all at once
|
|
279
|
+
const executions = batch.map(task => {
|
|
280
|
+
updateTodo(task.queue_id, 'in_progress');
|
|
281
|
+
return executeTask(task);
|
|
282
|
+
});
|
|
283
|
+
await Promise.all(executions);
|
|
284
|
+
batch.forEach(task => updateTodo(task.queue_id, 'completed'));
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Refresh ready tasks after batch
|
|
288
|
+
const newReady = getReadyTasks();
|
|
289
|
+
if (newReady.length > 0) {
|
|
290
|
+
console.log(`${newReady.length} more tasks now ready`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Codex Task Fetch Response
|
|
296
|
+
|
|
297
|
+
When codex calls `ccw issue next`, it receives:
|
|
298
|
+
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"queue_id": "Q-001",
|
|
302
|
+
"issue_id": "GH-123",
|
|
303
|
+
"solution_id": "SOL-001",
|
|
304
|
+
"task": {
|
|
305
|
+
"id": "T1",
|
|
306
|
+
"title": "Create auth middleware",
|
|
307
|
+
"scope": "src/middleware/",
|
|
308
|
+
"action": "Create",
|
|
309
|
+
"description": "Create JWT validation middleware",
|
|
310
|
+
"modification_points": [
|
|
311
|
+
{ "file": "src/middleware/auth.ts", "target": "new file", "change": "Create middleware" }
|
|
312
|
+
],
|
|
313
|
+
"implementation": [
|
|
314
|
+
"Create auth.ts file in src/middleware/",
|
|
315
|
+
"Implement JWT token validation using jsonwebtoken",
|
|
316
|
+
"Add error handling for invalid/expired tokens",
|
|
317
|
+
"Export middleware function"
|
|
318
|
+
],
|
|
319
|
+
"acceptance": [
|
|
320
|
+
"Middleware validates JWT tokens successfully",
|
|
321
|
+
"Returns 401 for invalid or missing tokens",
|
|
322
|
+
"Passes token payload to request context"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
"context": {
|
|
326
|
+
"relevant_files": ["src/config/auth.ts", "src/types/auth.d.ts"],
|
|
327
|
+
"patterns": "Follow existing middleware pattern in src/middleware/logger.ts"
|
|
328
|
+
},
|
|
329
|
+
"execution_hints": {
|
|
330
|
+
"executor": "codex",
|
|
331
|
+
"estimated_minutes": 30
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Phase 4: Completion Summary
|
|
337
|
+
|
|
338
|
+
```javascript
|
|
339
|
+
// Reload queue for final status
|
|
340
|
+
const finalQueue = JSON.parse(Read(queuePath));
|
|
341
|
+
|
|
342
|
+
const summary = {
|
|
343
|
+
completed: finalQueue.queue.filter(q => q.status === 'completed').length,
|
|
344
|
+
failed: finalQueue.queue.filter(q => q.status === 'failed').length,
|
|
345
|
+
pending: finalQueue.queue.filter(q => q.status === 'pending').length,
|
|
346
|
+
total: finalQueue.queue.length
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
console.log(`
|
|
350
|
+
## Execution Complete
|
|
351
|
+
|
|
352
|
+
**Completed**: ${summary.completed}/${summary.total}
|
|
353
|
+
**Failed**: ${summary.failed}
|
|
354
|
+
**Pending**: ${summary.pending}
|
|
355
|
+
|
|
356
|
+
### Task Results
|
|
357
|
+
${finalQueue.queue.map(q => {
|
|
358
|
+
const icon = q.status === 'completed' ? '✓' :
|
|
359
|
+
q.status === 'failed' ? '✗' :
|
|
360
|
+
q.status === 'executing' ? '⟳' : '○';
|
|
361
|
+
return `${icon} ${q.queue_id} [${q.issue_id}:${q.task_id}] - ${q.status}`;
|
|
362
|
+
}).join('\n')}
|
|
363
|
+
`);
|
|
364
|
+
|
|
365
|
+
// Update issue statuses in issues.jsonl
|
|
366
|
+
const issuesPath = '.workflow/issues/issues.jsonl';
|
|
367
|
+
const allIssues = Bash(`cat "${issuesPath}"`)
|
|
368
|
+
.split('\n')
|
|
369
|
+
.filter(line => line.trim())
|
|
370
|
+
.map(line => JSON.parse(line));
|
|
371
|
+
|
|
372
|
+
const issueIds = [...new Set(finalQueue.queue.map(q => q.issue_id))];
|
|
373
|
+
for (const issueId of issueIds) {
|
|
374
|
+
const issueTasks = finalQueue.queue.filter(q => q.issue_id === issueId);
|
|
375
|
+
|
|
376
|
+
if (issueTasks.every(q => q.status === 'completed')) {
|
|
377
|
+
console.log(`\n✓ Issue ${issueId} fully completed!`);
|
|
378
|
+
|
|
379
|
+
// Update issue status
|
|
380
|
+
const issueIndex = allIssues.findIndex(i => i.id === issueId);
|
|
381
|
+
if (issueIndex !== -1) {
|
|
382
|
+
allIssues[issueIndex].status = 'completed';
|
|
383
|
+
allIssues[issueIndex].completed_at = new Date().toISOString();
|
|
384
|
+
allIssues[issueIndex].updated_at = new Date().toISOString();
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Write updated issues.jsonl
|
|
390
|
+
Write(issuesPath, allIssues.map(i => JSON.stringify(i)).join('\n'));
|
|
391
|
+
|
|
392
|
+
if (summary.pending > 0) {
|
|
393
|
+
console.log(`
|
|
394
|
+
### Continue Execution
|
|
395
|
+
Run \`/issue:execute\` again to execute remaining tasks.
|
|
396
|
+
`);
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Dry Run Mode
|
|
401
|
+
|
|
402
|
+
```javascript
|
|
403
|
+
if (flags.dryRun) {
|
|
404
|
+
console.log(`
|
|
405
|
+
## Dry Run - Would Execute
|
|
406
|
+
|
|
407
|
+
${readyTasks.map((t, i) => `
|
|
408
|
+
${i + 1}. ${t.queue_id}
|
|
409
|
+
Issue: ${t.issue_id}
|
|
410
|
+
Task: ${t.task_id}
|
|
411
|
+
Executor: ${t.assigned_executor}
|
|
412
|
+
Group: ${t.execution_group}
|
|
413
|
+
`).join('')}
|
|
414
|
+
|
|
415
|
+
No changes made. Remove --dry-run to execute.
|
|
416
|
+
`);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Error Handling
|
|
422
|
+
|
|
423
|
+
| Error | Resolution |
|
|
424
|
+
|-------|------------|
|
|
425
|
+
| Queue not found | Display message, suggest /issue:queue |
|
|
426
|
+
| No ready tasks | Check dependencies, show blocked tasks |
|
|
427
|
+
| Codex timeout | Mark as failed, allow retry |
|
|
428
|
+
| ccw issue next empty | All tasks done or blocked |
|
|
429
|
+
| Task execution failure | Marked via ccw issue fail |
|
|
430
|
+
|
|
431
|
+
## Endpoint Contract
|
|
432
|
+
|
|
433
|
+
### `ccw issue next`
|
|
434
|
+
- Returns next ready task as JSON
|
|
435
|
+
- Marks task as 'executing'
|
|
436
|
+
- Returns `{ status: 'empty' }` when no tasks
|
|
437
|
+
|
|
438
|
+
### `ccw issue complete <queue-id>`
|
|
439
|
+
- Marks task as 'completed'
|
|
440
|
+
- Updates queue.json
|
|
441
|
+
- Checks if issue is fully complete
|
|
442
|
+
|
|
443
|
+
### `ccw issue fail <queue-id>`
|
|
444
|
+
- Marks task as 'failed'
|
|
445
|
+
- Records failure reason
|
|
446
|
+
- Allows retry via /issue:execute
|
|
447
|
+
|
|
448
|
+
## Related Commands
|
|
449
|
+
|
|
450
|
+
- `/issue:plan` - Plan issues with solutions
|
|
451
|
+
- `/issue:queue` - Form execution queue
|
|
452
|
+
- `ccw issue queue list` - View queue status
|
|
453
|
+
- `ccw issue retry` - Retry failed tasks
|