mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-15 03:32:43 +08:00
fix(do): reuse worktree across phases via DO_WORKTREE_DIR env var
Previously, each codeagent-wrapper --worktree call created a new worktree, causing multiple worktrees per /do task (one per phase). Changes: - setup-do.py: create worktree at initialization, export DO_WORKTREE_DIR - executor.go: check DO_WORKTREE_DIR first, reuse if set - SKILL.md: update documentation for new behavior Generated with SWE-Agent.ai Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
@@ -41,10 +41,15 @@ This creates `.claude/do.{task_id}.local.md` with:
|
||||
|
||||
## Worktree Mode
|
||||
|
||||
When `use_worktree: true` in state file, ALL `codeagent-wrapper` calls that modify code MUST include `--worktree`:
|
||||
When `use_worktree: true` in state file:
|
||||
- The worktree is created once during initialization (setup-do.py)
|
||||
- The worktree path is stored in `worktree_dir` frontmatter field
|
||||
- Environment variable `DO_WORKTREE_DIR` is exported for codeagent-wrapper to use
|
||||
- ALL `codeagent-wrapper` calls that modify code MUST include `--worktree` flag
|
||||
- codeagent-wrapper detects `DO_WORKTREE_DIR` and reuses the existing worktree instead of creating new ones
|
||||
|
||||
```bash
|
||||
# With worktree mode enabled
|
||||
# With worktree mode enabled - codeagent-wrapper will use DO_WORKTREE_DIR automatically
|
||||
codeagent-wrapper --worktree --agent develop - . <<'EOF'
|
||||
...
|
||||
EOF
|
||||
@@ -60,7 +65,7 @@ workdir: .
|
||||
EOF
|
||||
```
|
||||
|
||||
The `--worktree` flag tells codeagent-wrapper to create/use a worktree internally. Read-only agents (code-explorer, code-architect, code-reviewer) do NOT need `--worktree`.
|
||||
The `--worktree` flag tells codeagent-wrapper to use worktree mode. When `DO_WORKTREE_DIR` is set, it reuses that directory; otherwise it creates a new worktree (backward compatibility). Read-only agents (code-explorer, code-architect, code-reviewer) do NOT need `--worktree`.
|
||||
|
||||
## Loop State Management
|
||||
|
||||
|
||||
Reference in New Issue
Block a user