Skip to content

Commit 398b752

Browse files
authored
Merge pull request #67 from openclaw/feat/clawpatch-operating-loop
feat: add clawpatch operating loop surfaces
2 parents 4954bbb + e3d4be0 commit 398b752

15 files changed

Lines changed: 2796 additions & 43 deletions

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## 0.3.1 - Unreleased
44

5+
- Added `clawpatch ci` to initialize, map, review, write a report, and append a GitHub Actions step summary in one CI-friendly command.
6+
- Added `clawpatch open-pr --patch <id>` to turn an applied patch attempt into an explicit GitHub pull request.
7+
- Added review prompt provenance and budget accounting for included files, omitted files, prompt bytes, and approximate tokens.
8+
- Hardened review ingestion so provider findings must cite included files with valid line ranges and matching evidence quotes.
9+
- Fixed `clawpatch open-pr` so repositories without default-branch metadata use a dedicated patch branch and let GitHub choose the PR base.
10+
- Fixed `clawpatch open-pr` retries to push the recorded patch commit instead of any later local branch tip.
11+
- Fixed first-time `clawpatch open-pr` branch creation to start from the recorded patch base.
12+
- Fixed command execution so providers that exit before reading stdin do not surface benign `EPIPE` errors.
13+
- Fixed `clawpatch ci --since` empty-review output so it reports `reviewed: 0`.
514
- Improved OpenCode malformed JSON diagnostics with output length, event kinds, and a bounded preview, thanks @rohitjavvadi.
615
- Fixed Express route mapping for aliased Router imports that follow block comment banners, thanks @rohitjavvadi.
716
- Fixed Bun package-manager detection to recognize the text `bun.lock` lockfile, thanks @austinm911.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ clawpatch init
3131
clawpatch map
3232
clawpatch review --limit 3 --jobs 3
3333
clawpatch review --mode deslopify --limit 3
34+
clawpatch ci --since origin/main --output clawpatch-report.md
3435
clawpatch report
3536
clawpatch next
3637
clawpatch show --finding <id>
3738
clawpatch triage --finding <id> --status false-positive --note "covered by tests"
3839
clawpatch fix --finding <id>
40+
clawpatch open-pr --patch <patchAttemptId> --draft
3941
clawpatch revalidate --finding <id>
4042
clawpatch revalidate --all --status open
4143
```
@@ -122,11 +124,13 @@ Supported provider names today:
122124
- `clawpatch status`: show project, dirty state, feature/finding counts
123125
- `clawpatch review`: review pending or selected features
124126
- `clawpatch review --mode deslopify`: review only for locally provable slop cleanup
127+
- `clawpatch ci`: initialize if needed, map, review, write a report, and append a GitHub step summary
125128
- `clawpatch report`: print or write a Markdown findings report
126129
- `clawpatch next`: print the next actionable finding
127130
- `clawpatch show --finding <id>`: inspect one finding with evidence and suggested validation
128131
- `clawpatch triage --finding <id> --status <status>`: mark a finding with optional history note
129132
- `clawpatch fix --finding <id>`: run the explicit patch loop for one finding
133+
- `clawpatch open-pr --patch <id>`: commit an applied patch attempt and open a GitHub PR
130134
- `clawpatch revalidate --finding <id>`: re-check one finding
131135
- `clawpatch revalidate --all`: re-check open findings with report-style filters
132136
- `clawpatch doctor`: check provider availability
@@ -180,7 +184,8 @@ to features so runs can resume and be audited.
180184
- Review does not edit files.
181185
- Fix is explicit and selected by finding ID.
182186
- Fix refuses a dirty source worktree by default.
183-
- Clawpatch never commits, pushes, opens PRs, or lands changes today.
187+
- Clawpatch commits, pushes, and opens PRs only from explicit patch commands such as `open-pr`.
188+
- Clawpatch does not land changes today.
184189
- Provider output is parsed through strict schemas.
185190
- Symlinked directories and generated build output are skipped during mapping.
186191

docs/code-review.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ Current behavior:
2323
- reviews with a bounded worker pool; default `--jobs` is `10`
2424
- emits progress to stderr unless `--quiet` is set
2525
- builds bounded prompt context from owned files, context files, and tests
26+
- includes a prompt context manifest with included files, omitted files, byte
27+
counts, and truncation status
2628
- calls the configured provider
2729
- requires strict JSON output
30+
- rejects findings whose evidence cites files outside the prompt context, stale
31+
line ranges, or quotes that do not match current file contents
2832
- writes findings under `.clawpatch/findings/`
2933
- appends analysis history to the feature record
34+
- records prompt byte and approximate token counts in feature analysis history
3035
- releases the feature lock
3136

3237
## Flags
@@ -47,6 +52,19 @@ If no features are touched by the diff, `review` exits cleanly with no findings.
4752
The same flag is available on `revalidate`; revalidation scopes open findings to
4853
features whose owned files changed.
4954

55+
### CI command
56+
57+
Use `clawpatch ci` when a GitHub Actions job should run the whole read-only
58+
review loop:
59+
60+
```bash
61+
clawpatch ci --since origin/main --limit 20 --jobs 4 --output clawpatch-report.md
62+
```
63+
64+
The command initializes `.clawpatch/` if needed, maps features, reviews the
65+
selected feature set, writes a Markdown report when `--output` is provided, and
66+
appends a compact summary to `GITHUB_STEP_SUMMARY` when that file is available.
67+
5068
Progress uses stderr so `--json` stdout remains machine-readable. The worker
5169
pool is per-process, and lock files under `.clawpatch/locks/` prevent
5270
overlapping review processes from claiming the same feature. Interrupted runs

docs/patching.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,23 @@ Status updates:
3434
The CLI does not currently mark a finding `fixed` from the patch pass alone.
3535
Use `clawpatch revalidate --finding <id>` for a second pass.
3636

37+
## Opening a PR
38+
39+
After reviewing the applied worktree changes, create a GitHub PR explicitly:
40+
41+
```bash
42+
clawpatch open-pr --patch <patchAttemptId> --draft
43+
```
44+
45+
`open-pr` requires an applied or validated patch attempt with recorded changed
46+
files. It refuses failed validation unless `--force` is passed, commits only the
47+
recorded patch files, pushes the branch, and calls the GitHub CLI. Use
48+
`--dry-run` to preview the branch, title, body, and commands without touching
49+
git.
50+
3751
Not implemented yet:
3852

3953
- fixing by severity or category
4054
- batching multiple findings
4155
- auto-commit
42-
- PR creation
4356
- rollback snapshots

docs/spec.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,8 @@ Behavior:
330330
- Requires existing patch attempt with changed files.
331331
- Requires clean validation state unless `--force`.
332332
- Creates branch/commit/PR only after explicit command.
333-
- Uses repo-native commit helper if configured.
334-
- PR body includes findings, tests, revalidation, and links to state report.
335-
336-
Post-v0.
333+
- Uses the GitHub CLI to create the PR after committing the recorded patch files.
334+
- PR body includes linked findings, changed files, validation output, and the patch plan.
337335

338336
### `clawpatch land`
339337

0 commit comments

Comments
 (0)