wachiman 1.12.0 โ†’ 1.13.0

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.
Files changed (41) hide show
  1. package/README.md +132 -101
  2. package/package.json +1 -1
  3. package/skills/wachiman-loop/SKILL.md +91 -0
  4. package/src/call-message.ts +26 -3
  5. package/src/cli.ts +81 -5
  6. package/src/config.ts +19 -0
  7. package/src/connectors/local-git.ts +101 -13
  8. package/src/cost.ts +20 -0
  9. package/src/doctor/checks.ts +1 -1
  10. package/src/engine.ts +532 -55
  11. package/src/estimate.ts +64 -0
  12. package/src/fidelity/block.ts +263 -0
  13. package/src/fidelity/claims-call.ts +172 -0
  14. package/src/fidelity/claims.ts +69 -0
  15. package/src/fidelity/digest.ts +80 -0
  16. package/src/fidelity/grade.ts +242 -0
  17. package/src/fidelity/inert.ts +25 -0
  18. package/src/fidelity/rules.ts +166 -0
  19. package/src/fidelity/sink.ts +135 -0
  20. package/src/fidelity/summary.ts +16 -0
  21. package/src/fidelity/types.ts +93 -0
  22. package/src/formats.ts +16 -3
  23. package/src/history/fingerprint.ts +1 -1
  24. package/src/history/store.ts +39 -1
  25. package/src/init/options.ts +1 -1
  26. package/src/local.ts +20 -2
  27. package/src/loop/command.ts +441 -0
  28. package/src/loop/state.ts +88 -0
  29. package/src/loop/stop-rule.ts +98 -0
  30. package/src/providers/claude-code.ts +47 -12
  31. package/src/providers/codex.ts +3 -2
  32. package/src/providers/index.ts +5 -2
  33. package/src/providers/types.ts +10 -0
  34. package/src/sinks/json.ts +13 -2
  35. package/src/skills/install.ts +4 -4
  36. package/src/store/command.ts +109 -0
  37. package/src/store/figures.ts +153 -0
  38. package/src/store/html.ts +138 -0
  39. package/src/store/index.ts +298 -0
  40. package/templates/caller-workflow.yml +45 -15
  41. package/templates/wachiman-review-caller.yml +8 -0
@@ -1,7 +1,8 @@
1
1
  name: Wachiman review
2
2
 
3
3
  # An advisory code review by an agent CLI (today Claude Code), paid from the Anthropic Console
4
- # API credits through the `ANTHROPIC_API_KEY` secret. It is a GitHub review: each finding is a comment on its
4
+ # API credits through the `ANTHROPIC_API_KEY` secret (or a Claude subscription, through a
5
+ # `CLAUDE_CODE_OAUTH_TOKEN` secret: see the commented lines below). It is a GitHub review: each finding is a comment on its
5
6
  # line, labelled with a severity and a topic (for example "๐ŸŸ ๐Ÿ“ Fix ยท docs"), that the owner can
6
7
  # answer in its thread; information that needs no reply goes in the review body. It is
7
8
  # advisory: never a required check, never an approval or a change request, never a merge
@@ -40,7 +41,8 @@ name: Wachiman review
40
41
  # Before the agent is called, `scripts/agent-review/cli.ts` drops lockfiles, build output and
41
42
  # generated files, then packs the rest into batches of about 1,000 changed lines, riskiest
42
43
  # first, one agent call each with its diff inside the prompt. A batch that leaves files
43
- # unaccounted for is re-run once with only those files. There is no size gate: the budgets
44
+ # unaccounted for is re-run once with only those files. A pull request whose estimate is above
45
+ # the size gate is skipped with one comment. Otherwise the budgets
44
46
  # below limit each run (Claude Code's per-call limit is a soft cap that can be exceeded; see
45
47
  # docs/providers/claude-code.md), and a file still not accounted for marks the review
46
48
  # "partial" on its first line.
@@ -100,6 +102,9 @@ env:
100
102
  # may spend together; the engine sums it from its own signed review footers. `/wachiman review`
101
103
  # is not limited by it. A thread-reply run has its own cap, inside this one.
102
104
  AGENT_REVIEW_AUTO_BUDGET_USD: 2
105
+ # A review whose estimate (from the diff size, before any model call) is above this is skipped
106
+ # with one comment. It is never below what the run may spend, so raising the budgets lifts it.
107
+ AGENT_REVIEW_SIZE_GATE_USD: 6
103
108
  AGENT_REVIEW_THREADS_BUDGET_USD: 0.25
104
109
  AGENT_REVIEW_ANSWER_BUDGET_USD: 1
105
110
  # Who may ask a question by comment: `operator` (only the operator) or `write` (also a collaborator
@@ -117,6 +122,12 @@ env:
117
122
  # wait; `opened` and `ready_for_review` start at once. `0` disables the wait. The wait counts
118
123
  # toward the job's 30 minute limit.
119
124
  AGENT_REVIEW_PUSH_DEBOUNCE_SECONDS: 180
125
+ # Trial. PR Confidence: after a full review of a pull request, one more small model call grades
126
+ # whether the diff does what the title and body say, and writes it into the pull request
127
+ # description. Each push first resets it to "cannot say", and a push after the first review is
128
+ # reviewed incrementally, which is not graded, so it stays "cannot say" until a review of the whole
129
+ # pull request runs. Not an approval or a check. `1` turns it on. See docs/pr-confidence.md
130
+ AGENT_REVIEW_CONFIDENCE: 0
120
131
 
121
132
  jobs:
122
133
  review:
@@ -139,7 +150,32 @@ jobs:
139
150
  contents: read
140
151
  pull-requests: write
141
152
  steps:
142
- # Before the checkout and any model call: a run cancelled here has spent nothing.
153
+ # The head, not the default merge commit, so the files match the diff's lines.
154
+ - name: Checkout the pull request head
155
+ uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
156
+ with:
157
+ ref: ${{ github.event.pull_request.head.sha }}
158
+ fetch-depth: 1
159
+
160
+ - name: Setup Bun
161
+ uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
162
+ with:
163
+ bun-version: 1.3.4
164
+
165
+ # PR Confidence: before the push wait and with no model call, the description block becomes
166
+ # "cannot say" for the commit under review, so a run that a newer push cancels during the wait
167
+ # leaves no grade of an older commit. The command does nothing when AGENT_REVIEW_CONFIDENCE is
168
+ # off, so no condition on it is needed here. Best-effort: it never stops the review.
169
+ - name: Reset PR Confidence for this commit
170
+ if: github.event.action == 'synchronize'
171
+ continue-on-error: true
172
+ env:
173
+ GH_TOKEN: ${{ github.token }}
174
+ PR: ${{ github.event.pull_request.number }}
175
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
176
+ run: bun --no-env-file --config=scripts/agent-review/bunfig.toml scripts/agent-review/cli.ts reset-confidence "$PR" --commit "$HEAD_SHA"
177
+
178
+ # Before any model call: a run cancelled here has spent nothing.
143
179
  - name: Wait for further pushes
144
180
  if: github.event.action == 'synchronize'
145
181
  run: |
@@ -153,18 +189,6 @@ jobs:
153
189
  sleep "$seconds"
154
190
  fi
155
191
 
156
- # The head, not the default merge commit, so the files match the diff's lines.
157
- - name: Checkout the pull request head
158
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
159
- with:
160
- ref: ${{ github.event.pull_request.head.sha }}
161
- fetch-depth: 1
162
-
163
- - name: Setup Bun
164
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
165
- with:
166
- bun-version: 1.3.4
167
-
168
192
  - name: Install Claude Code
169
193
  env:
170
194
  CLAUDE_INSTALL_DIR: ${{ runner.temp }}/claude-bin
@@ -177,6 +201,8 @@ jobs:
177
201
  - name: Review the pull request
178
202
  env:
179
203
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
204
+ # To review on a Claude subscription, use this line instead (docs/install.md): the token wins when both are set.
205
+ # CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
180
206
  GH_TOKEN: ${{ github.token }}
181
207
  PR: ${{ github.event.pull_request.number }}
182
208
  # `opened`, `ready_for_review` or `synchronize`: each counts against the automatic ceiling.
@@ -240,6 +266,8 @@ jobs:
240
266
  - name: Answer the pending threads
241
267
  env:
242
268
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
269
+ # To review on a Claude subscription, use this line instead (docs/install.md): the token wins when both are set.
270
+ # CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
243
271
  GH_TOKEN: ${{ github.token }}
244
272
  PR: ${{ github.event.pull_request.number }}
245
273
  AGENT_REVIEW_COMMENT_AUTHOR: ${{ github.event.comment.user.login }}
@@ -336,6 +364,8 @@ jobs:
336
364
  - name: Review or answer
337
365
  env:
338
366
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
367
+ # To review on a Claude subscription, use this line instead (docs/install.md): the token wins when both are set.
368
+ # CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
339
369
  GH_TOKEN: ${{ github.token }}
340
370
  PR: ${{ github.event.issue.number }}
341
371
  REQUEST: ${{ github.event.comment.body }}
@@ -1,5 +1,8 @@
1
1
  name: Wachiman review
2
2
  # Get the key at https://console.anthropic.com and save it as the repository secret ANTHROPIC_API_KEY.
3
+ # To review on a Claude subscription instead, run `claude setup-token` signed in to the account whose
4
+ # plan should pay, save the token with `gh secret set CLAUDE_CODE_OAUTH_TOKEN --repo OWNER/REPO`, and
5
+ # swap the commented line under `secrets:` below (docs/install.md, "Review on a Claude subscription").
3
6
  # Pin an exact release tag (`@v1.5.0`): it names the release whose workflow and engine run with your
4
7
  # key. Maintainers do not move release tags, but a repository admin can; a full commit SHA cannot be
5
8
  # re-pointed (see docs/install.md, "What pinning a version does and does not guarantee"). Do not use
@@ -30,8 +33,13 @@ jobs:
30
33
  operator: EDIT-THIS-github-login
31
34
  # review_on_push: false # review only on open, ready for review and `/wachiman review`
32
35
  # push_debounce_seconds: 180 # a push waits this long first; a newer push cancels it unspent (0 = no wait)
36
+ # pr_confidence: true # trial: grade whether the diff does what the title and body say, in the description (docs/pr-confidence.md)
33
37
  # auto_budget_usd: 2 # most all automatic runs on one pull request may spend together
38
+ # size_gate_usd: 6 # a review estimated above this (before any model call) is skipped with one comment; raise budget_usd to lift it
34
39
  # askers: write # collaborators with admin, maintain or write permission may ask questions too (default: operator)
35
40
  # ask_ceiling_usd: 3 # most all questions from people other than the operator may spend on one pull request
36
41
  secrets:
37
42
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
43
+ # To review on a Claude subscription, replace the line above with this one. The token wins when
44
+ # both are passed, and a refused call is never retried with the key.
45
+ # CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}