Skip to content

Commit 314f664

Browse files
feat(review): add offline local-range review (#369)
Rewritten onto current main with safe current-checkout defaults, git-private artifacts, and focused regression coverage. Co-authored-by: Cameron Beeley <[email protected]>
1 parent b81ec96 commit 314f664

6 files changed

Lines changed: 697 additions & 31 deletions

File tree

‎.agents/skills/local-clawsweeper-review/SKILL.md‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: local-clawsweeper-review
3-
description: Run a local ClawSweeper issue or PR review before submitting or updating a pull request, including Codex CLI auth preflight, exact-item review command, artifact inspection, and no-GitHub-mutation safety. Use when asked to run local ClawSweeper, local clawsweeper review, pre-PR ClawSweeper check, or verify a PR with ClawSweeper locally.
3+
description: Run local ClawSweeper exact-item or committed-range reviews without GitHub mutation.
44
---
55

66
# Local ClawSweeper Review
@@ -10,7 +10,8 @@ submitting, updating, or re-reviewing an issue or PR.
1010

1111
## Safety Boundary
1212

13-
- Run only `pnpm run review -- --local-only` for the default workflow.
13+
- Run only `pnpm run review -- --local-only` for an existing GitHub item, or
14+
`pnpm run review -- --local-range` for a pre-submission committed range.
1415
- Do not run `apply-artifacts`, `apply-decisions`, GitHub comment posting, or
1516
merge/autofix commands unless the user explicitly asks for that mutation.
1617
- Do not print `OPENAI_API_KEY`, `CODEX_API_KEY`, `CODEX_ACCESS_TOKEN`, GitHub
@@ -75,6 +76,10 @@ run. On Windows, the runner prefers the Codex app binary under
7576
By default, an exact local PR review manages its own target checkout under
7677
`artifacts/local-review-<pr-number>/target`.
7778

79+
By default, `--local-range` reviews the clean checkout where the command was
80+
invoked. It does not manage or switch that checkout. Pass `--target-dir` when
81+
the branch to review is elsewhere.
82+
7883
Pass `--target-dir` when the operator wants to review an existing checkout or
7984
an issue.
8085

@@ -116,6 +121,20 @@ pnpm run review -- --local-only \
116121
--target-dir <target-dir>
117122
```
118123

124+
To review committed branch work before a PR exists:
125+
126+
```sh
127+
pnpm run review -- --local-range \
128+
--target-repo <owner/repo> \
129+
--base origin/main
130+
```
131+
132+
The range is `merge-base(<base>, HEAD)..HEAD`. It must be clean and contain at
133+
least one commit beyond the base. This path withholds GitHub credentials,
134+
isolates cached `gh` auth, disables web search, and skips host-side URL/media
135+
preprocessing. It still calls the configured Codex model service; do not call it
136+
air-gapped or fully network-offline.
137+
119138
The exact local command prints a human-readable progress summary by default. Add
120139
`--verbose` only when debugging checkout, selection, or Codex process details.
121140

@@ -148,7 +167,7 @@ stderr or log summary.
148167

149168
Before reporting success:
150169

151-
- Confirm the command used `review --local-only`.
170+
- Confirm the command used `review --local-only` or `review --local-range`.
152171
- Confirm no GitHub comments, labels, merges, or apply commands were run.
153172
- Confirm the target checkout is still clean.
154173
- If findings exist, list the actionable items and the next local fix/test step.

‎README.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,30 @@ pnpm run review -- --local-only \
598598
--target-dir ../target-checkout
599599
```
600600

601+
Pre-submission committed-range review uses the same full proof-aware review
602+
without requiring an open GitHub item. From the clean checkout containing the
603+
branch to review:
604+
605+
```bash
606+
pnpm run review -- --local-range \
607+
--target-repo openclaw/clawsweeper \
608+
--base origin/main
609+
```
610+
611+
Without `--target-dir`, `--local-range` reviews the checkout where the command
612+
was invoked. Pass `--target-dir <path>` when invoking ClawSweeper from a
613+
different checkout. The range is `merge-base(<base>, HEAD)..HEAD`, includes
614+
committed work only, and refuses a dirty working tree. `--body-file` can supply
615+
the proposed PR body and `--additional-policy` can layer an extra local policy.
616+
617+
This mode withholds GitHub token variables, points `gh` at an empty config
618+
directory inside the run artifacts, disables Codex web search, skips host-side
619+
URL/media preprocessing, and makes no GitHub reads or writes. It is not
620+
air-gapped: the Codex model invocation still uses its configured network
621+
service. Reports use a unique
622+
`.git/clawsweeper/reviews/local-range-<time>-<pid>/` directory so the default
623+
run leaves the checkout clean. `--artifact-dir` overrides that location.
624+
601625
Read the report at `artifacts/local-review-<number>/<number>.md`. Key fields are
602626
`review_status`, `main_sha`, `pull_head_sha`, `decision`, `confidence`, and
603627
`Review Findings`. Do not run `apply-artifacts` or `apply-decisions` unless you

‎docs/local-clawsweeper-skill.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ From a ClawSweeper checkout, ask Codex:
1717
Use $local-clawsweeper-review to run a local ClawSweeper review for PR <number>.
1818
```
1919

20+
For a full proof-aware review before a PR exists, ask it to review the current
21+
clean branch with `--local-range`. That path reviews committed work against a
22+
base ref without reading or writing GitHub; the Codex model call itself still
23+
uses its configured network service.
24+
2025
To make the skill available outside this checkout, copy it into your Codex user
2126
skills directory.
2227

0 commit comments

Comments
 (0)