claude-dev-env 1.52.0 → 1.52.1
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/package.json
CHANGED
|
@@ -31,6 +31,18 @@ proceed to any state-modifying operation until the working directory
|
|
|
31
31
|
contains `.claude/worktrees/`. If `EnterWorktree` fails, report the failure
|
|
32
32
|
and stop; do not continue in place.
|
|
33
33
|
|
|
34
|
+
`EnterWorktree` isolates the session's **own** repo. When the PR under
|
|
35
|
+
convergence shares that repo, its worktree is where the CODE_REVIEW phase
|
|
36
|
+
runs. When the PR lives in a different repo, `EnterWorktree` cannot
|
|
37
|
+
re-root into it; Step 1.5 resolves a **PR worktree** — a checkout of the
|
|
38
|
+
PR's repo on its head branch — and routes the working directory into it.
|
|
39
|
+
Routing the working directory into the PR's repo is routine and
|
|
40
|
+
automatic, never a fork to pause on. The Pre-flight `.claude/worktrees/`
|
|
41
|
+
gate covers the session repo's own isolation; for a cross-repo PR the
|
|
42
|
+
working directory routes into the PR's repo for local work and returns to
|
|
43
|
+
the session worktree before teardown. See
|
|
44
|
+
[`reference/per-tick.md` § Step 1.5](reference/per-tick.md).
|
|
45
|
+
|
|
34
46
|
## State persistence
|
|
35
47
|
|
|
36
48
|
Single-PR mode persists loop state to `$CLAUDE_JOB_DIR/pr-converge-state.json`.
|
|
@@ -84,6 +96,14 @@ post a fresh PR in a fresh branch based on origin main to the user.
|
|
|
84
96
|
`pwsh` calls run through the PowerShell tool, not Bash. Bash on
|
|
85
97
|
Windows is Git Bash which cannot execute PowerShell cmdlets. Route all
|
|
86
98
|
PowerShell work through the PowerShell tool or `pwsh -NoProfile -File`.
|
|
99
|
+
- **Cross-repo PR: route cwd into the PR worktree before `/code-review`** —
|
|
100
|
+
`/code-review --fix` (Step 5) audits the repo of the current working
|
|
101
|
+
directory. When the session is rooted in a different repo than the PR,
|
|
102
|
+
`EnterWorktree` cannot re-root (it is scoped to the session's repo);
|
|
103
|
+
resolve the PR worktree and `cd` into it per
|
|
104
|
+
[Step 1.5](reference/per-tick.md). Skipping this reviews and edits the
|
|
105
|
+
wrong repo. The route is routine and automatic — never a material fork
|
|
106
|
+
to pause on.
|
|
87
107
|
|
|
88
108
|
## Progress checklist
|
|
89
109
|
|
|
@@ -117,9 +137,14 @@ round as converged. This rule holds every tick, every loop, every PR.
|
|
|
117
137
|
- [ ] **Step 0: Grant project permissions**
|
|
118
138
|
`python "$HOME/.claude/skills/bugteam/scripts/grant_project_claude_permissions.py"`
|
|
119
139
|
|
|
120
|
-
- [ ] **Step 1: Resolve PR scope**
|
|
121
|
-
Capture owner, repo, number, head SHA, branch.
|
|
140
|
+
- [ ] **Step 1: Resolve PR scope + PR worktree**
|
|
141
|
+
Capture owner, repo, number, head SHA, branch. Resolve the **PR
|
|
142
|
+
worktree** — the local checkout every local step this tick targets:
|
|
143
|
+
the `EnterWorktree` checkout when the PR shares the session's repo,
|
|
144
|
+
else a checkout of the PR's repo that the working directory routes
|
|
145
|
+
into via `cd`. Cross-repo routing is automatic, not a fork.
|
|
122
146
|
See: [`reference/per-tick.md` § Step 1](reference/per-tick.md)
|
|
147
|
+
and [§ Step 1.5](reference/per-tick.md)
|
|
123
148
|
|
|
124
149
|
- [ ] **Step 2: Initialize loop state**
|
|
125
150
|
`phase = BUGBOT`; all counters at zero; `run_name` resolved.
|
|
@@ -168,6 +193,13 @@ round as converged. This rule holds every tick, every loop, every PR.
|
|
|
168
193
|
|
|
169
194
|
Pre-condition: `bugbot_clean_at == current_head` (or `bugbot_down == true`).
|
|
170
195
|
|
|
196
|
+
Pre-condition: the working directory is the Step 1.5 PR worktree on
|
|
197
|
+
`current_head` (`git rev-parse --show-toplevel` is that checkout).
|
|
198
|
+
When the session is rooted in a different repo than the PR, `cd`
|
|
199
|
+
into the PR worktree first — `/code-review` audits the repo of the
|
|
200
|
+
current working directory, so this routing targets the real PR
|
|
201
|
+
diff. This `cd` is routine and automatic.
|
|
202
|
+
|
|
171
203
|
Run Claude Code's built-in `/code-review --fix` on the full
|
|
172
204
|
`origin/main...HEAD` diff —
|
|
173
205
|
the [local diff review](https://code.claude.com/docs/en/code-review#review-a-diff-locally)
|
|
@@ -25,6 +25,15 @@ files during fix phase in multi-PR mode.
|
|
|
25
25
|
|
|
26
26
|
**Single-PR (no `state.json`) — same gates, main session executor:**
|
|
27
27
|
|
|
28
|
+
Run every command below in the PR worktree (the working directory routed in
|
|
29
|
+
[per-tick.md § Step 1.5](per-tick.md)). The `git add`, `git commit`, and
|
|
30
|
+
`git push` act on the repo of the current working directory, so a cross-repo
|
|
31
|
+
PR's fix lands in the PR's repo only when the cwd is its worktree. A spawned
|
|
32
|
+
`clean-coder` does not inherit the lead's working directory — name the PR
|
|
33
|
+
worktree path in its prompt and direct it to edit, stage, and commit there,
|
|
34
|
+
matching the worktree-path handoff bugteam embeds in its fix worker's spawn
|
|
35
|
+
prompt.
|
|
36
|
+
|
|
28
37
|
- Read each referenced file:line.
|
|
29
38
|
- Write failing test first when finding has behavior to test. Pure doc /
|
|
30
39
|
comment / naming nits with no behavior → straight to fix.
|
|
@@ -15,3 +15,10 @@
|
|
|
15
15
|
- **Adapt when reality contradicts on-disk state.** If `state.json`,
|
|
16
16
|
`git`, or `gh` disagree with live PR, escalate as hard blocker per
|
|
17
17
|
[stop-conditions.md](stop-conditions.md).
|
|
18
|
+
- **Cross-repo cwd routing is routine, not a fork.** When the PR under
|
|
19
|
+
convergence lives in a different repo than the session is rooted in, route
|
|
20
|
+
the working directory into a checkout of the PR's repo automatically —
|
|
21
|
+
`/code-review --fix`, `git`, and every `clean-coder` fix spawn act on the
|
|
22
|
+
repo of the current working directory. The resolution is fixed
|
|
23
|
+
([per-tick.md § Step 1.5](per-tick.md)): resolve the PR worktree, `cd` into
|
|
24
|
+
it, run local work there. Do not pause, ask, or raise it as a material fork.
|
|
@@ -45,6 +45,89 @@ If `current_head` changed since last tick, reset `bugbot_down` to `false`
|
|
|
45
45
|
|
|
46
46
|
Capture `number`, `head.sha` (= `current_head`), owner/repo, branch.
|
|
47
47
|
|
|
48
|
+
## Step 1.5: Resolve the PR worktree (cwd routing)
|
|
49
|
+
|
|
50
|
+
The **PR worktree** is the local working tree of the PR's repo on its head
|
|
51
|
+
branch. Every local operation this tick runs there: the CODE_REVIEW
|
|
52
|
+
`/code-review --fix`, every `clean-coder` fix spawn, and every commit and
|
|
53
|
+
push. `/code-review` and `git` both act on the repo of the current working
|
|
54
|
+
directory, so the working directory must be the PR worktree before any local
|
|
55
|
+
work begins. Re-resolve it every tick — a rebase or a fresh HEAD can move the
|
|
56
|
+
branch tip.
|
|
57
|
+
|
|
58
|
+
Read the current working tree's origin and parse its `<owner>/<repo>`,
|
|
59
|
+
accepting the `https://github.com/<owner>/<repo>`,
|
|
60
|
+
`git@github.com:<owner>/<repo>`, and `ssh://git@github.com/<owner>/<repo>`
|
|
61
|
+
forms and dropping any trailing `.git`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git remote get-url origin
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- **Parsed owner/repo matches the PR** (case-insensitive): the `EnterWorktree`
|
|
68
|
+
pre-flight checkout is the PR worktree, and the working directory already
|
|
69
|
+
points here, so no `cd` is needed. Bring the branch to the PR head with the
|
|
70
|
+
same deterministic `checkout -B` the cross-repo case uses, after confirming
|
|
71
|
+
the tree carries no uncommitted edits — a non-empty `git status --porcelain`
|
|
72
|
+
means a prior tick left a fix mid-flight, so escalate as a hard blocker:
|
|
73
|
+
```bash
|
|
74
|
+
git fetch origin
|
|
75
|
+
git checkout -B <branch> origin/<branch>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- **Parsed owner/repo differs** (the session is rooted in another repo — for
|
|
79
|
+
example, the PR lives in `llm-settings` while the session runs from
|
|
80
|
+
`claude-code-config`): route the working directory into a checkout of the
|
|
81
|
+
PR's repo. This is routine and automatic — never pause, and never raise it as
|
|
82
|
+
a fork (see [ground-rules.md](ground-rules.md)). `EnterWorktree` is scoped to
|
|
83
|
+
the session's own repo and cannot re-root into the PR's repo.
|
|
84
|
+
|
|
85
|
+
`<run_temp_dir>` is pr-converge's own `pr-converge-pr-<N>` directory under the
|
|
86
|
+
system temp directory — named apart from bugteam's `bugteam-pr-<N>` run dir so
|
|
87
|
+
the two never share a checkout when Step 6 runs bugteam on the same PR.
|
|
88
|
+
pr-converge fills this path by hand; it does not route through the shared
|
|
89
|
+
`_path_resolver` that bugteam uses. Reuse its `checkout` across ticks; create
|
|
90
|
+
it once when it is absent. A fresh clone honors the global `core.hooksPath`, so git-side
|
|
91
|
+
CODE_RULES enforcement covers the fix commit.
|
|
92
|
+
|
|
93
|
+
1. Clone the PR branch when the checkout is absent:
|
|
94
|
+
```bash
|
|
95
|
+
gh repo clone <owner>/<repo> "<run_temp_dir>/checkout" -- --branch <branch>
|
|
96
|
+
```
|
|
97
|
+
2. Bring it to the PR head. On a reused checkout, confirm it carries no
|
|
98
|
+
uncommitted edits first — a non-empty `git -C "<run_temp_dir>/checkout"
|
|
99
|
+
status --porcelain` means a prior tick left a fix mid-flight, so escalate
|
|
100
|
+
as a hard blocker rather than discard it. On a clean tree:
|
|
101
|
+
```bash
|
|
102
|
+
git -C "<run_temp_dir>/checkout" fetch origin
|
|
103
|
+
git -C "<run_temp_dir>/checkout" checkout -B <branch> origin/<branch>
|
|
104
|
+
```
|
|
105
|
+
3. Change into it in a standalone Bash call so the working directory persists
|
|
106
|
+
into the `/code-review` invocation that follows:
|
|
107
|
+
```bash
|
|
108
|
+
cd "<run_temp_dir>/checkout"
|
|
109
|
+
```
|
|
110
|
+
4. Confirm the route took before any local work:
|
|
111
|
+
```bash
|
|
112
|
+
git rev-parse --show-toplevel
|
|
113
|
+
git rev-parse HEAD
|
|
114
|
+
```
|
|
115
|
+
The top level reads `<run_temp_dir>/checkout` and HEAD equals
|
|
116
|
+
`current_head`.
|
|
117
|
+
|
|
118
|
+
Spawn every `clean-coder` fix worker with the PR worktree path in its prompt
|
|
119
|
+
so its edits land in the PR's repo — the same worktree-path handoff bugteam
|
|
120
|
+
gives its fix worker. The
|
|
121
|
+
GitHub API steps (BUGBOT fetch, convergence gates) and the bugteam Skill
|
|
122
|
+
invocation are URL-driven and need no local checkout.
|
|
123
|
+
|
|
124
|
+
Capture the session worktree path (the `EnterWorktree` checkout) before
|
|
125
|
+
routing away. Step 0 grant, Step 8 working-tree cleanup, and Step 10 revoke
|
|
126
|
+
read the current working directory and target the session repo, so `cd` back
|
|
127
|
+
to the session worktree before Step 8 and remove `<run_temp_dir>` there with
|
|
128
|
+
a Windows-safe recursive remove (per
|
|
129
|
+
`$HOME/.claude/rules/windows-filesystem-safe.md`).
|
|
130
|
+
|
|
48
131
|
## Step 2: Branch on `phase`
|
|
49
132
|
|
|
50
133
|
### `phase == BUGBOT`
|
|
@@ -126,12 +209,16 @@ a. Run Claude Code's built-in `/code-review --fix` on the FULL
|
|
|
126
209
|
[local diff review](https://code.claude.com/docs/en/code-review#review-a-diff-locally).
|
|
127
210
|
It reviews the diff and applies its findings to the working tree.
|
|
128
211
|
|
|
129
|
-
Before running, confirm the working
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
212
|
+
Before running, confirm the working directory is the PR worktree resolved
|
|
213
|
+
in [Step 1.5](#step-15-resolve-the-pr-worktree-cwd-routing) — `git rev-parse
|
|
214
|
+
--show-toplevel` is that checkout and `git rev-parse HEAD` equals
|
|
215
|
+
`current_head` — with no uncommitted edits. When the session is rooted in a
|
|
216
|
+
different repo than the PR, the `cd` from Step 1.5 supplies this; the
|
|
217
|
+
persisted working directory is what `/code-review` audits. Then invoke
|
|
218
|
+
`/code-review --fix` with no path arguments so it audits the whole branch
|
|
219
|
+
diff against `origin/main`. Do not delta-scope to commits added since the
|
|
220
|
+
prior clean SHA, do not scope to a single file, do not scope to bugbot's
|
|
221
|
+
flagged paths. A partial-scope round does not count and cannot set
|
|
135
222
|
`code_review_clean_at`. Pass no effort argument, so the review uses
|
|
136
223
|
the session's current effort.
|
|
137
224
|
|