@eliya-oss/agent-diff 0.1.0-alpha.4 → 0.1.0-alpha.40

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
@@ -2,10 +2,12 @@
2
2
  "name": "@eliya-oss/agent-diff",
3
3
  "type": "module",
4
4
  "devDependencies": {
5
+ "@effect/tsgo": "^0.31.0",
5
6
  "@effect/vitest": "^4.0.0-beta.102",
6
7
  "@types/node": "^26.1.2",
7
8
  "effect": "^4.0.0-beta.102",
8
- "oxlint": "^1.76.0",
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.4",
25
- "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
26
+ "version": "0.1.0-alpha.40",
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,7 @@
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-style.ts",
46
+ "lint": "oxlint && node scripts/check-rules.ts",
45
47
  "test": "NODE_OPTIONS=--experimental-ffi vitest run",
46
48
  "test:watch": "NODE_OPTIONS=--experimental-ffi vitest",
47
49
  "dev": "node --experimental-ffi --disable-warning=ExperimentalWarning src/main.ts",
@@ -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 write the story that explains the diff. 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.
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
@@ -43,6 +43,33 @@ Re-arm it after each comment you handle, and keep it running while you work. A r
43
43
  their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
44
44
  events rather than by you asking. When you finish a piece of work, say you are still listening.
45
45
 
46
+ ## Answering a comment
47
+
48
+ Say what you did, against the comment you were handed:
49
+
50
+ ```bash
51
+ adiff comment answer --worktree . --id <id> --body "Dropped it, and the import with it."
52
+ ```
53
+
54
+ The id comes from `comment take`. The reviewer sees the answer under their own words the next time
55
+ they read the branch, so this is how they learn a point was addressed rather than ignored.
56
+
57
+ Answer when the change alone does not carry the reasoning: what you did instead of what was asked,
58
+ what you found while doing it, or why the comment does not apply. A comment that asked a question
59
+ deserves an answer even when nothing changed.
60
+
61
+ Add `--asks` when you need the reviewer to decide before you continue:
62
+
63
+ ```bash
64
+ adiff comment answer --worktree . --id <id> --asks --body "Drop it, or keep it and map the error?"
65
+ ```
66
+
67
+ That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when
68
+ the work genuinely stops without an answer.
69
+
70
+ Settling a thread is the reviewer's to do, not yours. They raised the point, so they decide it is
71
+ closed.
72
+
46
73
  ## Acting on a comment
47
74
 
48
75
  Read `snippet` before opening the file: the reviewer commented on the diff, and the file may have
@@ -66,21 +93,66 @@ Read `suggestion` before doing anything else — it names the command that resol
66
93
  Retry only when `retriable` is true. `UnknownBranch` means this worktree is not one adiff knows
67
94
  about, because the reviewer has not opened it; report that rather than looping.
68
95
 
69
- ## Handing work over: write the story
96
+ ## Handing work over
97
+
98
+ Finishing is not a reason to publish anything. Say the work is ready, put the review in front of
99
+ them if they asked for one, and say how to read it. That is the whole handover. A reading order is
100
+ extra work you do on request, and it has its own section further down.
101
+
102
+ ## Put the review in front of them
103
+
104
+ When someone asks you for a review, open it rather than describing how:
105
+
106
+ ```bash
107
+ adiff review pane --repo <repo>
108
+ ```
109
+
110
+ It splits the pane they are already looking at, so their next move is to look right rather than to
111
+ type. The answer says what happened:
70
112
 
71
- You know the order the change was built in. The reviewer does not, and rebuilding it by reading
72
- every file is the most expensive way to learn something you already have. When you finish a piece
73
- of work, write a **story**: an ordered set of steps over the diff, each one a claim about a span of
113
+ ```json
114
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api"}
115
+ ```
116
+
117
+ `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
118
+ WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
119
+ line and let them run it.
120
+
121
+ Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
122
+ someone's screen uninvited is worse than a line they have to copy.
123
+
124
+ ## Tell the reviewer how to read it
125
+
126
+ Whether or not a pane opened, say what to do with it. Name the repository they should point at,
127
+ which is the repository the worktree belongs to:
128
+
129
+ > Open it with `adiff review open --repo <repo>`, then press `enter` on this branch. The sidebar
130
+ > lists the files; `j` and `k` move down the diff, `]` and `[` walk between files. Select lines with
131
+ > `v`, write a comment with `c`, stage it with `ctrl+a`, and send the whole review with `S`. Press
132
+ > `?` for the rest.
133
+
134
+ Fill the repository path in yourself so nobody has to compose the command.
135
+
136
+ Say what you want looked at hardest, and where you are unsure. A reviewer who knows which part you
137
+ doubt spends their attention there. Offer a reading order rather than writing one: if the change is
138
+ long enough that the order matters, say you can publish one and let them decide.
139
+
140
+ ## Publishing a reading order, when you are asked for one
141
+
142
+ Only when the reviewer asks. A reading order is a real piece of work, it can be wrong, and one
143
+ nobody wanted spends their attention on your summary rather than on the code.
144
+
145
+ When they do ask, write **layers**: an ordered set over the diff, each one a claim about a span of
74
146
  code. The reviewer then walks the argument instead of the filesystem.
75
147
 
76
148
  ```bash
77
- adiff story set --worktree . --json - <<'JSON'
149
+ adiff layers set --worktree . --json - <<'JSON'
78
150
  {
79
151
  "summary": "Team invitations, end to end",
80
- "steps": [
152
+ "layers": [
81
153
  {
82
154
  "title": "Add the invitation data model",
83
- "note": "The record every later step leans on",
155
+ "note": "The record every later layer leans on",
84
156
  "spans": [{ "path": "src/db/invites.ts", "start": 1, "end": 48 }]
85
157
  },
86
158
  {
@@ -99,49 +171,43 @@ adiff story set --worktree . --json - <<'JSON'
99
171
  JSON
100
172
  ```
101
173
 
102
- Rules that make a story worth reading:
174
+ Rules that make a layers worth reading:
103
175
 
104
- - **Order is the point.** Step 1 is what the reader must understand before step 2 makes sense.
176
+ - **Order is the point.** Layer 1 is what the reader must understand before layer 2 makes sense.
105
177
  Data model, then the code that uses it, then the surface, then the mechanical bits last.
106
178
  - **A title is a claim, not a file name.** "Add the invitation API", never "changes to
107
179
  src/api/invites.ts".
108
180
  - **Line numbers are the new side of the diff**, the same numbers `adiff comment take` reports.
109
- - **Cover everything.** adiff computes coverage itself and answers with the hunks no step claims;
110
- those show up for the reviewer under "not in any step" whatever you do. A story that quietly
111
- skips a third of the diff is worse than no story, so put the leftovers in a final step and say
112
- they are mechanical.
181
+ - **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer
182
+ claims; those show up for the reviewer under "not in any layer" whatever you do. A layer set that
183
+ quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and
184
+ say they are mechanical. Claim the lines you actually read: a span reaching past them counts only
185
+ the changed lines inside it, so padding the range buys nothing.
113
186
 
114
- The answer to `story set` is the honest report — check it before you claim to be done:
187
+ The answer to `layers set` is the honest report — check it before you claim to be done:
115
188
 
116
189
  ```json
117
- {"ok":true,"story":{"version":1,"stale":false,"covered":7,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"steps":[{"title":"Add the invitation data model","files":["src/db/invites.ts"]}]}}
190
+ {"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"]}]}}
118
191
  ```
119
192
 
120
- `covered`/`total` count hunks. `uncovered` names the ones no step claims — claim them and set the
121
- story again. `vanished` names paths a step points at that this branch does not change, which
122
- usually means a typo in a path. Read it back at any time with:
193
+ `total` counts hunks. `covered` counts the ones where every changed line sits inside a layer, and
194
+ `partial` the ones a layer explains only some of. `uncovered` names the runs of changed lines no
195
+ layer claims, so it reads as line numbers a reviewer would otherwise have to find alone: claim them
196
+ and set the layers again. Done means `uncovered` is empty. `vanished` names paths a layer points at
197
+ that this branch does not change, which usually means a typo in a path. Read it back at any time
198
+ with:
123
199
 
124
200
  ```bash
125
- adiff story show --worktree . --fields covered,total,uncovered
201
+ adiff layers show --worktree . --fields covered,partial,total,uncovered
126
202
  ```
127
203
 
128
- Setting a story again supersedes the previous one and bumps `version`; the story records the commit
129
- it was written for, and adiff reports it as `stale` once the branch moves past that commit. After
130
- you address a review, write the story again.
131
-
132
- ## Tell the reviewer how to read it
133
-
134
- The person you are handing work to has to open the review themselves, so end your reply with the
135
- command and the keys. Name the repository they should point at, which is the repository the
136
- worktree belongs to:
137
-
138
- > Open it with `adiff review open --repo <repo>`, then press `enter` on this branch. The sidebar
139
- > lists the steps in reading order; `j` and `k` move between them and the diff follows. Inside a
140
- > step, `]` and `[` walk its files. Select lines with `v`, write a comment with `c`, stage it with
141
- > `ctrl+a`, and send the whole review with `S`. Press `?` for the rest.
204
+ Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
205
+ was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
206
+ reviewer has a reading order, keep it true: write it again after you address their comments.
142
207
 
143
- Say what you want looked at hardest, and where you are unsure. A reviewer who knows which step you
144
- doubt spends their attention there.
208
+ When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and
209
+ the files, `j` and `k` move between layers with the diff following, and `]` and `[` walk the files
210
+ inside a layer.
145
211
 
146
212
  ## Discovering the rest
147
213