@eliya-oss/agent-diff 0.1.0-alpha.17 → 0.1.0-alpha.171
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/.agents/adr/README.md +3 -0
- package/.claude/skills/create-pr/SKILL.md +163 -0
- package/.claude/skills/release-notes/SKILL.md +318 -0
- package/CHANGELOG.md +1563 -0
- package/README.md +27 -99
- package/bin/adiff.js +6 -2
- package/dist/main.js +21359 -14526
- package/package.json +14 -7
- package/skills/adiff/SKILL.md +187 -32
package/package.json
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"name": "@eliya-oss/agent-diff",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"devDependencies": {
|
|
5
|
-
"@effect/
|
|
5
|
+
"@effect/tsgo": "^0.31.0",
|
|
6
|
+
"@effect/vitest": "^4.0.0-rc.110",
|
|
6
7
|
"@types/node": "^26.1.2",
|
|
7
|
-
"effect": "^4.0.0-
|
|
8
|
-
"oxlint": "
|
|
8
|
+
"effect": "^4.0.0-rc.110",
|
|
9
|
+
"oxlint": "1.77.0",
|
|
10
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
9
11
|
"rolldown": "^1.2.1",
|
|
10
12
|
"vitest": "^4.1.10"
|
|
11
13
|
},
|
|
@@ -21,8 +23,8 @@
|
|
|
21
23
|
"bin": {
|
|
22
24
|
"adiff": "./bin/adiff.js"
|
|
23
25
|
},
|
|
24
|
-
"version": "0.1.0-alpha.
|
|
25
|
-
"description": "Review
|
|
26
|
+
"version": "0.1.0-alpha.171",
|
|
27
|
+
"description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
|
|
26
28
|
"license": "MIT",
|
|
27
29
|
"repository": {
|
|
28
30
|
"type": "git",
|
|
@@ -41,7 +43,8 @@
|
|
|
41
43
|
"check": "pnpm run typecheck && pnpm run lint && pnpm run build && pnpm test",
|
|
42
44
|
"build": "rolldown -c rolldown.config.ts",
|
|
43
45
|
"typecheck": "tsc --noEmit",
|
|
44
|
-
"lint": "oxlint && node scripts/check-
|
|
46
|
+
"lint": "oxlint && node scripts/check-rules.ts && node scripts/check-film.ts && node scripts/check-public.ts",
|
|
47
|
+
"check-body": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/check-public.ts",
|
|
45
48
|
"test": "NODE_OPTIONS=--experimental-ffi vitest run",
|
|
46
49
|
"test:watch": "NODE_OPTIONS=--experimental-ffi vitest",
|
|
47
50
|
"dev": "node --experimental-ffi --disable-warning=ExperimentalWarning src/main.ts",
|
|
@@ -51,6 +54,10 @@
|
|
|
51
54
|
"sketch": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/sketch.ts",
|
|
52
55
|
"watch": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/watch.ts",
|
|
53
56
|
"serve": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/serve.ts",
|
|
54
|
-
"play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts"
|
|
57
|
+
"play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts",
|
|
58
|
+
"shot": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/shot.ts",
|
|
59
|
+
"pr-summary": "node scripts/pr-summary.ts",
|
|
60
|
+
"scenario": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/scenario.ts",
|
|
61
|
+
"record": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/record.ts"
|
|
55
62
|
}
|
|
56
63
|
}
|
package/skills/adiff/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: adiff
|
|
3
|
-
description: Pick up review comments left on this worktree's diff in the adiff terminal, act on them, and
|
|
3
|
+
description: Pick up review comments left on this worktree's diff in the adiff terminal, act on them, and answer them by id. Use when the user says they left comments, asks you to check adiff, asks you to watch for review feedback, or asks you to hand work over for review.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# adiff
|
|
@@ -24,7 +24,22 @@ Each comment carries the code it is about. `snippet` is the exact text the revie
|
|
|
24
24
|
`side` says whether the line numbers are in the new file (`new`) or the version being replaced
|
|
25
25
|
(`old`), and `head` is the commit the diff was read at.
|
|
26
26
|
|
|
27
|
-
A comment
|
|
27
|
+
A comment on code one of your layers explains carries `layer`, that layer's title as your latest
|
|
28
|
+
revision has it. The code the layer describes is about to change under your hands, so the layers go
|
|
29
|
+
stale the moment you act on the comment: write a new revision with `adiff layers set` before you
|
|
30
|
+
answer, and say in the answer that you did.
|
|
31
|
+
|
|
32
|
+
A comment keeps coming back until it is answered. A second `take` returns it again, so answer what
|
|
33
|
+
you take. Settling or removing it also retires it: those are the reviewer saying they no longer
|
|
34
|
+
need one.
|
|
35
|
+
|
|
36
|
+
## A remark is context, a comment is work
|
|
37
|
+
|
|
38
|
+
`adiff remark list --repo . --branch <branch>` reads the remarks left on the branch's pull request.
|
|
39
|
+
They are not yours to act on. A remark is somebody's point about the code, and the reviewer decides
|
|
40
|
+
what happens to it: accepting one writes a comment, and that comment is what reaches you through
|
|
41
|
+
`comment take`. Read remarks when the reviewer asks you to, or to understand a comment that answers
|
|
42
|
+
one. Never act on a remark that has not been accepted, and never accept one yourself.
|
|
28
43
|
|
|
29
44
|
## Wait for the next one
|
|
30
45
|
|
|
@@ -35,14 +50,30 @@ adiff comment take --worktree . --wait 300
|
|
|
35
50
|
Blocks until a comment arrives or the timeout in seconds elapses, then returns the same envelope.
|
|
36
51
|
An empty `comments` array means the wait expired with nothing new — that is not an error.
|
|
37
52
|
|
|
53
|
+
`--wait` takes a whole number of seconds from 1 to 86400. A value outside that is refused on
|
|
54
|
+
stderr with exit 2, because an instant empty answer would read exactly like a wait that expired:
|
|
55
|
+
if a wait comes back at once, you are not waiting.
|
|
56
|
+
|
|
57
|
+
Arm the wait as the first thing you do in a turn, before the work. A turn that is interrupted
|
|
58
|
+
half-way then still leaves a listener running, and a wait armed at the end of a turn is a wait that
|
|
59
|
+
often never gets armed.
|
|
60
|
+
|
|
38
61
|
Run the wait in the background, not in the foreground. A foreground wait holds the turn, so you
|
|
39
62
|
cannot do anything else and the person you are working with cannot talk to you. Backgrounded, the
|
|
40
63
|
harness brings you back the moment a comment lands.
|
|
41
64
|
|
|
65
|
+
Keep one wait per worktree. A second wait returns the same comments as the first, so two of them
|
|
66
|
+
running at once is two of you answering the same comment. Before starting one, check whether one is
|
|
67
|
+
already running.
|
|
68
|
+
|
|
42
69
|
Re-arm it after each comment you handle, and keep it running while you work. A reviewer reads at
|
|
43
70
|
their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
|
|
44
71
|
events rather than by you asking. When you finish a piece of work, say you are still listening.
|
|
45
72
|
|
|
73
|
+
A backgrounded wait that is killed rather than expiring is not the reviewer going quiet, and not a
|
|
74
|
+
reason to stop listening. A kill loses whatever the wait would have handed you, so take once
|
|
75
|
+
without `--wait` to collect what landed, then arm a new wait.
|
|
76
|
+
|
|
46
77
|
## Answering a comment
|
|
47
78
|
|
|
48
79
|
Say what you did, against the comment you were handed:
|
|
@@ -58,15 +89,29 @@ Answer when the change alone does not carry the reasoning: what you did instead
|
|
|
58
89
|
what you found while doing it, or why the comment does not apply. A comment that asked a question
|
|
59
90
|
deserves an answer even when nothing changed.
|
|
60
91
|
|
|
61
|
-
Add `--
|
|
92
|
+
Add `--question` when you need the reviewer to decide before you continue:
|
|
62
93
|
|
|
63
94
|
```bash
|
|
64
|
-
adiff comment answer --worktree . --id <id> --
|
|
95
|
+
adiff comment answer --worktree . --id <id> --question --body "Drop it, or keep it and map the error?"
|
|
65
96
|
```
|
|
66
97
|
|
|
67
98
|
That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when
|
|
68
99
|
the work genuinely stops without an answer.
|
|
69
100
|
|
|
101
|
+
## When the reviewer writes back
|
|
102
|
+
|
|
103
|
+
A reviewer can reply to an answer, and the reply arrives through `comment take` like any other
|
|
104
|
+
comment — with an `id` of its own that you answer against, and a `thread` carrying what was said
|
|
105
|
+
before it, oldest first:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{"body":"the imports","replyTo":"c1","thread":[{"voice":"reviewer","body":"why two of these"},{"voice":"agent","body":"which two did you mean"}]}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Read the thread before answering. A reply is usually short because it is the rest of a sentence you
|
|
112
|
+
already have: "the imports" only means something next to the question it answers. Answer it against
|
|
113
|
+
its own id, not the id of the comment that started the thread.
|
|
114
|
+
|
|
70
115
|
Settling a thread is the reviewer's to do, not yours. They raised the point, so they decide it is
|
|
71
116
|
closed.
|
|
72
117
|
|
|
@@ -89,15 +134,75 @@ Failures go to **stderr**, never stdout, so stdout is always safe to parse. The
|
|
|
89
134
|
what kind of problem it is: `2` the request was malformed, `3` the branch or file does not exist,
|
|
90
135
|
`1` something unexpected.
|
|
91
136
|
|
|
137
|
+
Every command that acts on a review takes either `--worktree <path>` or `--repo <path>` with
|
|
138
|
+
`--branch <name>`. Standing in the worktree, `--worktree .` is always enough.
|
|
139
|
+
|
|
92
140
|
Read `suggestion` before doing anything else — it names the command that resolves the failure.
|
|
93
141
|
Retry only when `retriable` is true. `UnknownBranch` means this worktree is not one adiff knows
|
|
94
142
|
about, because the reviewer has not opened it; report that rather than looping.
|
|
95
143
|
|
|
96
|
-
## Handing work over
|
|
144
|
+
## Handing work over
|
|
145
|
+
|
|
146
|
+
Finishing is not a reason to publish anything. Say the work is ready, put the review in front of
|
|
147
|
+
them if they asked for one, and say how to read it. That is the whole handover. A reading order is
|
|
148
|
+
extra work you do on request, and it has its own section further down.
|
|
149
|
+
|
|
150
|
+
## Put the review in front of them
|
|
151
|
+
|
|
152
|
+
When someone asks you for a review, open it rather than describing how:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
adiff review pane --repo <repo> --branch <branch>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
It splits the pane they are already looking at, so their next move is to look right rather than to
|
|
159
|
+
type. The answer says what happened:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api --branch add-invitations"}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
|
|
166
|
+
WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
|
|
167
|
+
line and let them run it.
|
|
97
168
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
169
|
+
Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
|
|
170
|
+
someone's screen uninvited is worse than a line they have to copy.
|
|
171
|
+
|
|
172
|
+
## Tell the reviewer how to read it
|
|
173
|
+
|
|
174
|
+
Whether or not a pane opened, say what to do with it. Name the repository they should point at,
|
|
175
|
+
which is the repository the worktree belongs to:
|
|
176
|
+
|
|
177
|
+
> Open it with `adiff review open --repo <repo> --branch <branch>`, which lands on this branch's
|
|
178
|
+
> diff. The sidebar lists the files; `j` and `k` move down the diff, `]` and `[` walk between
|
|
179
|
+
> files, `}` and `{` jump to the next and previous change, `G` goes to the end. Select lines with
|
|
180
|
+
> `v`, write a comment with `c`, and send it with `ctrl+s`. Press `?` for the rest.
|
|
181
|
+
|
|
182
|
+
Fill the repository path and the branch in yourself, so nobody has to compose the command or find
|
|
183
|
+
the branch in a list. `--branch` takes the name `branch list` reports; without it the review opens
|
|
184
|
+
on the worktree list.
|
|
185
|
+
|
|
186
|
+
Say what you want looked at hardest, and where you are unsure. A reviewer who knows which part you
|
|
187
|
+
doubt spends their attention there. Offer a reading order rather than writing one: if the change is
|
|
188
|
+
long enough that the order matters, say you can publish one and let them decide.
|
|
189
|
+
|
|
190
|
+
## Publishing a reading order, when you are asked for one
|
|
191
|
+
|
|
192
|
+
Only when the reviewer asks. A reading order is a real piece of work, it can be wrong, and one
|
|
193
|
+
nobody wanted spends their attention on your summary rather than on the code.
|
|
194
|
+
|
|
195
|
+
The ask often arrives as a comment. Pressing `L` in the review sends you one of these:
|
|
196
|
+
|
|
197
|
+
- "Please write a reading order for this branch with `adiff layers set` …" — there is none yet.
|
|
198
|
+
- "The reading order on this branch describes an older commit …" — read the diff again from
|
|
199
|
+
scratch. Do not patch the old layers; line numbers have moved.
|
|
200
|
+
- "Please revise the reading order …" — there is one and the reviewer wants it different. Ask what
|
|
201
|
+
is wrong with it if the comment does not say.
|
|
202
|
+
|
|
203
|
+
Answer it like any other comment when you are done.
|
|
204
|
+
|
|
205
|
+
When they do ask, write **layers**: an ordered set over the diff, each one a claim about a span of
|
|
101
206
|
code. The reviewer then walks the argument instead of the filesystem.
|
|
102
207
|
|
|
103
208
|
```bash
|
|
@@ -133,42 +238,91 @@ Rules that make a layers worth reading:
|
|
|
133
238
|
- **A title is a claim, not a file name.** "Add the invitation API", never "changes to
|
|
134
239
|
src/api/invites.ts".
|
|
135
240
|
- **Line numbers are the new side of the diff**, the same numbers `adiff comment take` reports.
|
|
136
|
-
- **Cover everything.** adiff computes coverage itself and answers with the
|
|
137
|
-
those show up for the reviewer under "not in any layer" whatever you do. A
|
|
138
|
-
skips a third of the diff is worse than
|
|
139
|
-
they are mechanical.
|
|
241
|
+
- **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer
|
|
242
|
+
claims; those show up for the reviewer under "not in any layer" whatever you do. A layer set that
|
|
243
|
+
quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and
|
|
244
|
+
say they are mechanical. Claim the lines you actually read: a span reaching past them counts only
|
|
245
|
+
the changed lines inside it, so padding the range buys nothing.
|
|
140
246
|
|
|
141
247
|
The answer to `layers set` is the honest report — check it before you claim to be done:
|
|
142
248
|
|
|
143
249
|
```json
|
|
144
|
-
{"ok":true,"layers":{"version":1,"stale":false,"covered":7,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"layers":[{"title":"Add the invitation data model","files":["src/db/invites.ts"]}]}}
|
|
250
|
+
{"ok":true,"layers":{"version":1,"stale":false,"covered":7,"partial":1,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"layers":[{"title":"Add the invitation data model","files":["src/db/invites.ts"],"covered":1,"partial":0,"vanished":[]}]}}
|
|
251
|
+
|
|
252
|
+
`covered`, `partial` and `vanished` appear per layer as well as for the document, so you can tell
|
|
253
|
+
which of your own layers is the thin one. `vanished` on a layer names paths it claims that are not
|
|
254
|
+
in the diff — usually a typo or a file that moved.
|
|
255
|
+
|
|
256
|
+
`layers set` refuses a document it cannot use and says which layer is wrong and why: a span that
|
|
257
|
+
ends before it starts, a span starting below line 1, a start or end that is not a whole number, a
|
|
258
|
+
block with no `kind`, a layer with no title. It no longer drops a bad span quietly, so a layer that
|
|
259
|
+
used to cover less than you thought now fails loudly instead.
|
|
145
260
|
```
|
|
146
261
|
|
|
147
|
-
`
|
|
148
|
-
|
|
149
|
-
|
|
262
|
+
`total` counts hunks. `covered` counts the ones where every changed line sits inside a layer, and
|
|
263
|
+
`partial` the ones a layer explains only some of. `uncovered` names the runs of changed lines no
|
|
264
|
+
layer claims, so it reads as line numbers a reviewer would otherwise have to find alone: claim them
|
|
265
|
+
and set the layers again. Done means `uncovered` is empty and `shared` is zero. `vanished` names
|
|
266
|
+
paths a layer points at that this branch does not change, which usually means a typo in a path. Read
|
|
267
|
+
it back at any time with:
|
|
150
268
|
|
|
151
269
|
```bash
|
|
152
|
-
adiff layers show --worktree . --fields covered,total,uncovered
|
|
270
|
+
adiff layers show --worktree . --fields covered,partial,total,uncovered
|
|
153
271
|
```
|
|
154
272
|
|
|
155
|
-
|
|
156
|
-
it
|
|
157
|
-
|
|
273
|
+
`uncovered` does not always empty out by claiming lines you can see. A deleted line is counted at
|
|
274
|
+
the number it had in the old file, so a branch that cuts a file from 409 lines to 394 reports an
|
|
275
|
+
uncovered run at 395-409 — line numbers past the end of the file as it now stands. A span over the
|
|
276
|
+
new file cannot reach them; only a span whose `end` runs past the end of the file can. Write one, or
|
|
277
|
+
say the run is unreachable, rather than reading the leftover as a layer you forgot.
|
|
158
278
|
|
|
159
|
-
|
|
279
|
+
That case aside, claim the runs you explain and nothing more. A span from line 1 to past the end of
|
|
280
|
+
the file covers whatever happens to it, and it is the wrong trade: the terminal scopes a layer to the
|
|
281
|
+
lines it claims, so a layer claiming the whole file draws the whole diff, and eleven layers over one
|
|
282
|
+
file draw it eleven times. Staleness is cheap by comparison — adiff says when a set is stale and the
|
|
283
|
+
reviewer asks for another.
|
|
284
|
+
|
|
285
|
+
`shared` in the answer counts the hunks more than one layer claims. Coverage cannot see this: a
|
|
286
|
+
reading order whose layers each claim the whole diff reports the same `covered` as one whose layers
|
|
287
|
+
each claim their own run. Done means `uncovered` is empty **and** `shared` is zero.
|
|
288
|
+
|
|
289
|
+
Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
|
|
290
|
+
was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
|
|
291
|
+
reviewer has a reading order, keep it true: write it again after you address their comments.
|
|
292
|
+
|
|
293
|
+
When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and
|
|
294
|
+
the files, each layer shows the files it covers with the ones already reviewed ticked off, and `]`
|
|
295
|
+
and `[` walk those files in the order you put them in — from the last file of one layer into the
|
|
296
|
+
first of the next.
|
|
297
|
+
|
|
298
|
+
## Helping draft a review of somebody else's pull request
|
|
299
|
+
|
|
300
|
+
Sometimes the reviewer is not reading your work — they are reading a stranger's pull request and
|
|
301
|
+
want you to think it through with them before they say anything on it. There, a comment is not an
|
|
302
|
+
instruction to you. It is a draft of what the reviewer will say, in the reviewer's name.
|
|
303
|
+
|
|
304
|
+
Comments on a pull request are **held**. Nothing reaches the forge until the reviewer sends them.
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
adiff draft list --repo . --branch their-change
|
|
308
|
+
adiff draft add --repo . --branch their-change --file src/api.ts --start 40 --end 52 --body "…"
|
|
309
|
+
adiff draft edit --repo . --branch their-change --id d1 --body "…"
|
|
310
|
+
adiff draft drop --repo . --branch their-change --id d1
|
|
311
|
+
```
|
|
160
312
|
|
|
161
|
-
|
|
162
|
-
command and the keys. Name the repository they should point at, which is the repository the
|
|
163
|
-
worktree belongs to:
|
|
313
|
+
`draft add` anchors the same way `comment send` does, so `--side old` is the version being replaced.
|
|
164
314
|
|
|
165
|
-
|
|
166
|
-
> lists the layers in reading order; `j` and `k` move between them and the diff follows. Inside a
|
|
167
|
-
> layer, `]` and `[` walk its files. Select lines with `v`, write a comment with `c`, stage it with
|
|
168
|
-
> `ctrl+a`, and send the whole review with `S`. Press `?` for the rest.
|
|
315
|
+
Rules for drafting on somebody else's behalf:
|
|
169
316
|
|
|
170
|
-
|
|
171
|
-
|
|
317
|
+
- **You never send.** `draft send` exists and it is the reviewer's, not yours. The reviewer signs
|
|
318
|
+
the review, so the reviewer sends it.
|
|
319
|
+
- **Write what the reviewer meant, not what you would say.** They told you the point; your job is
|
|
320
|
+
the wording. If you are not sure what the point is, ask rather than inventing one.
|
|
321
|
+
- **One draft per point.** A held comment that covers three things cannot be dropped in part.
|
|
322
|
+
- **Say what you drafted.** List the drafts back after you write them, so the reviewer can read
|
|
323
|
+
them over rather than discovering them at the moment of sending.
|
|
324
|
+
- **A draft is not a review of the reviewer.** Do not soften a point they meant sharply, or sharpen
|
|
325
|
+
one they meant gently.
|
|
172
326
|
|
|
173
327
|
## Discovering the rest
|
|
174
328
|
|
|
@@ -176,8 +330,9 @@ doubt spends their attention there.
|
|
|
176
330
|
adiff describe
|
|
177
331
|
```
|
|
178
332
|
|
|
179
|
-
Returns every command with its options, which are required,
|
|
180
|
-
|
|
333
|
+
Returns every command with its options, which are required, which part of the loop it belongs to,
|
|
334
|
+
and where its payload sits. `adiff <command> --help` says the same for one command in plain text.
|
|
335
|
+
Use either instead of guessing, and use `--fields` to keep answers small:
|
|
181
336
|
|
|
182
337
|
```bash
|
|
183
338
|
adiff branch list --repo . --fields branch,files
|