mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
fix(issue): Use correct Codex tool interfaces
- update_plan: { explanation, plan: [{step, status}] }
- shell_command: { command, workdir } for ccw commands in main repo
- multi_tool_use.parallel for reading context files in parallel
This commit is contained in:
@@ -164,10 +164,14 @@ WHEN queue empty:
|
|||||||
|
|
||||||
## Step 1: Fetch First Solution
|
## Step 1: Fetch First Solution
|
||||||
|
|
||||||
Run this command to get your first solution:
|
Run this command to get your first solution (**must run from main repo**):
|
||||||
|
|
||||||
```bash
|
```javascript
|
||||||
ccw issue next
|
// Fetch solution from main repo (not worktree)
|
||||||
|
const result = shell_command({
|
||||||
|
command: "ccw issue next",
|
||||||
|
workdir: REPO_ROOT // Main repo path, NOT worktree
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
This returns JSON with the full solution definition:
|
This returns JSON with the full solution definition:
|
||||||
@@ -249,35 +253,60 @@ Expected solution structure:
|
|||||||
|
|
||||||
After parsing solution, use `update_plan` to track each task:
|
After parsing solution, use `update_plan` to track each task:
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
# Add tasks to plan for tracking
|
// Initialize plan with all tasks from solution
|
||||||
update_plan("Add task tracking for solution ${item_id}:
|
update_plan({
|
||||||
- [ ] ${task.id}: ${task.title}
|
explanation: `Starting solution ${item_id}`,
|
||||||
- [ ] ${task.id}: ${task.title}
|
plan: solution.tasks.map(task => ({
|
||||||
...")
|
step: `${task.id}: ${task.title}`,
|
||||||
|
status: "pending"
|
||||||
|
}))
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note**: Codex uses `update_plan` tool instead of TodoWrite for task tracking.
|
**Note**: Codex uses `update_plan` tool for task tracking (not TodoWrite).
|
||||||
|
|
||||||
## Step 3: Execute Tasks Sequentially
|
## Step 3: Execute Tasks Sequentially
|
||||||
|
|
||||||
Iterate through `solution.tasks` array and execute each task.
|
Iterate through `solution.tasks` array and execute each task.
|
||||||
|
|
||||||
**Before starting each task**, mark it as in_progress:
|
**Before starting each task**, mark it as in_progress:
|
||||||
```
|
```javascript
|
||||||
# Update task status
|
// Update current task status
|
||||||
update_plan("Mark ${task.id} as in-progress: 🔄 ${task.title}")
|
update_plan({
|
||||||
|
explanation: `Working on ${task.id}: ${task.title}`,
|
||||||
|
plan: tasks.map(t => ({
|
||||||
|
step: `${t.id}: ${t.title}`,
|
||||||
|
status: t.id === task.id ? "in_progress" : (t.completed ? "completed" : "pending")
|
||||||
|
}))
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
**After completing each task** (commit done), mark it as completed:
|
**After completing each task** (commit done), mark it as completed:
|
||||||
```
|
```javascript
|
||||||
# Update completed task
|
// Mark task as completed
|
||||||
update_plan("Mark ${task.id} as completed: ✅ ${task.title}")
|
update_plan({
|
||||||
|
explanation: `Completed ${task.id}: ${task.title}`,
|
||||||
|
plan: tasks.map(t => ({
|
||||||
|
step: `${t.id}: ${t.title}`,
|
||||||
|
status: t.id === task.id ? "completed" : t.status
|
||||||
|
}))
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Phase A: IMPLEMENT
|
### Phase A: IMPLEMENT
|
||||||
|
|
||||||
1. Read all `solution.exploration_context.relevant_files` to understand existing patterns
|
1. **Read context files in parallel** using `multi_tool_use.parallel`:
|
||||||
|
```javascript
|
||||||
|
// Read all relevant files in parallel for context
|
||||||
|
multi_tool_use.parallel({
|
||||||
|
tool_uses: solution.exploration_context.relevant_files.map(file => ({
|
||||||
|
recipient_name: "functions.read_file",
|
||||||
|
parameters: { path: file }
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
2. Follow `task.implementation` steps in order
|
2. Follow `task.implementation` steps in order
|
||||||
3. Apply changes to `task.modification_points` files
|
3. Apply changes to `task.modification_points` files
|
||||||
4. Follow `solution.exploration_context.patterns` for code style consistency
|
4. Follow `solution.exploration_context.patterns` for code style consistency
|
||||||
@@ -372,42 +401,46 @@ Continue to next task in `solution.tasks` array until all tasks are complete.
|
|||||||
|
|
||||||
## Step 4: Report Completion
|
## Step 4: Report Completion
|
||||||
|
|
||||||
After ALL tasks in the solution are complete, **return to main repo** and report to queue system:
|
After ALL tasks in the solution are complete, report to queue system (**must run from main repo**):
|
||||||
|
|
||||||
```bash
|
```javascript
|
||||||
# Return to main repo for ccw commands (worktree mode)
|
// Report completion from main repo (not worktree)
|
||||||
cd "${REPO_ROOT}"
|
shell_command({
|
||||||
|
command: `ccw issue done ${item_id} --result '${JSON.stringify({
|
||||||
ccw issue done <item_id> --result '{
|
files_modified: ["path1", "path2"],
|
||||||
"files_modified": ["path1", "path2"],
|
tests_passed: true,
|
||||||
"tests_passed": true,
|
acceptance_passed: true,
|
||||||
"acceptance_passed": true,
|
committed: true,
|
||||||
"committed": true,
|
commits: [
|
||||||
"commits": [
|
{ task_id: "T1", hash: "abc123" },
|
||||||
{ "task_id": "T1", "hash": "abc123" },
|
{ task_id: "T2", hash: "def456" }
|
||||||
{ "task_id": "T2", "hash": "def456" }
|
],
|
||||||
],
|
summary: "[What was accomplished]"
|
||||||
"summary": "[What was accomplished]"
|
})}'`,
|
||||||
}'
|
workdir: REPO_ROOT // Main repo path, NOT worktree
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
**If solution failed and cannot be fixed:**
|
**If solution failed and cannot be fixed:**
|
||||||
|
|
||||||
```bash
|
```javascript
|
||||||
ccw issue done <item_id> --fail --reason "Task [task.id] failed: [details]"
|
// Report failure from main repo
|
||||||
|
shell_command({
|
||||||
|
command: `ccw issue done ${item_id} --fail --reason '{"task_id": "TX", "error_type": "test_failure", "message": "..."}'`,
|
||||||
|
workdir: REPO_ROOT
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## Step 5: Continue to Next Solution
|
## Step 5: Continue to Next Solution
|
||||||
|
|
||||||
**⚠️ WORKTREE MODE**: Return to main repo before running `ccw issue next`:
|
Fetch next solution (**must run from main repo**):
|
||||||
```bash
|
|
||||||
cd "${REPO_ROOT}" # Return to main repo for ccw commands
|
|
||||||
```
|
|
||||||
|
|
||||||
Then fetch next solution:
|
```javascript
|
||||||
|
// Fetch next solution from main repo
|
||||||
```bash
|
const result = shell_command({
|
||||||
ccw issue next
|
command: "ccw issue next",
|
||||||
|
workdir: REPO_ROOT
|
||||||
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output progress:**
|
**Output progress:**
|
||||||
|
|||||||
Reference in New Issue
Block a user