@eliya-oss/agent-diff 0.1.0-alpha.5 → 0.1.0-alpha.50

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.5",
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.50",
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 `--question` when you need the reviewer to decide before you continue:
62
+
63
+ ```bash
64
+ adiff comment answer --worktree . --id <id> --question --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
@@ -62,25 +89,76 @@ Failures go to **stderr**, never stdout, so stdout is always safe to parse. The
62
89
  what kind of problem it is: `2` the request was malformed, `3` the branch or file does not exist,
63
90
  `1` something unexpected.
64
91
 
92
+ Every command that acts on a review takes either `--worktree <path>` or `--repo <path>` with
93
+ `--branch <name>`. Standing in the worktree, `--worktree .` is always enough.
94
+
65
95
  Read `suggestion` before doing anything else — it names the command that resolves the failure.
66
96
  Retry only when `retriable` is true. `UnknownBranch` means this worktree is not one adiff knows
67
97
  about, because the reviewer has not opened it; report that rather than looping.
68
98
 
69
- ## Handing work over: write the story
99
+ ## Handing work over
100
+
101
+ Finishing is not a reason to publish anything. Say the work is ready, put the review in front of
102
+ them if they asked for one, and say how to read it. That is the whole handover. A reading order is
103
+ extra work you do on request, and it has its own section further down.
104
+
105
+ ## Put the review in front of them
106
+
107
+ When someone asks you for a review, open it rather than describing how:
108
+
109
+ ```bash
110
+ adiff review pane --repo <repo> --branch <branch>
111
+ ```
112
+
113
+ It splits the pane they are already looking at, so their next move is to look right rather than to
114
+ type. The answer says what happened:
115
+
116
+ ```json
117
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api --branch cdr-1"}
118
+ ```
119
+
120
+ `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
121
+ WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
122
+ line and let them run it.
123
+
124
+ Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
125
+ someone's screen uninvited is worse than a line they have to copy.
126
+
127
+ ## Tell the reviewer how to read it
128
+
129
+ Whether or not a pane opened, say what to do with it. Name the repository they should point at,
130
+ which is the repository the worktree belongs to:
70
131
 
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
132
+ > Open it with `adiff review open --repo <repo> --branch <branch>`, which lands on this branch's
133
+ > diff. The sidebar lists the files; `j` and `k` move down the diff, `]` and `[` walk between
134
+ > files, `}` and `{` jump to the next and previous change, `G` goes to the end. Select lines with
135
+ > `v`, write a comment with `c`, stage it with `ctrl+a`, and send the whole review with `S`. Press
136
+ > `?` for the rest.
137
+
138
+ Fill the repository path and the branch in yourself, so nobody has to compose the command or find
139
+ the branch in a list. `--branch` takes the name `branch list` reports; without it the review opens
140
+ on the worktree list.
141
+
142
+ Say what you want looked at hardest, and where you are unsure. A reviewer who knows which part you
143
+ doubt spends their attention there. Offer a reading order rather than writing one: if the change is
144
+ long enough that the order matters, say you can publish one and let them decide.
145
+
146
+ ## Publishing a reading order, when you are asked for one
147
+
148
+ Only when the reviewer asks. A reading order is a real piece of work, it can be wrong, and one
149
+ nobody wanted spends their attention on your summary rather than on the code.
150
+
151
+ When they do ask, write **layers**: an ordered set over the diff, each one a claim about a span of
74
152
  code. The reviewer then walks the argument instead of the filesystem.
75
153
 
76
154
  ```bash
77
- adiff story set --worktree . --json - <<'JSON'
155
+ adiff layers set --worktree . --json - <<'JSON'
78
156
  {
79
157
  "summary": "Team invitations, end to end",
80
- "steps": [
158
+ "layers": [
81
159
  {
82
160
  "title": "Add the invitation data model",
83
- "note": "The record every later step leans on",
161
+ "note": "The record every later layer leans on",
84
162
  "spans": [{ "path": "src/db/invites.ts", "start": 1, "end": 48 }]
85
163
  },
86
164
  {
@@ -99,49 +177,43 @@ adiff story set --worktree . --json - <<'JSON'
99
177
  JSON
100
178
  ```
101
179
 
102
- Rules that make a story worth reading:
180
+ Rules that make a layers worth reading:
103
181
 
104
- - **Order is the point.** Step 1 is what the reader must understand before step 2 makes sense.
182
+ - **Order is the point.** Layer 1 is what the reader must understand before layer 2 makes sense.
105
183
  Data model, then the code that uses it, then the surface, then the mechanical bits last.
106
184
  - **A title is a claim, not a file name.** "Add the invitation API", never "changes to
107
185
  src/api/invites.ts".
108
186
  - **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.
187
+ - **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer
188
+ claims; those show up for the reviewer under "not in any layer" whatever you do. A layer set that
189
+ quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and
190
+ say they are mechanical. Claim the lines you actually read: a span reaching past them counts only
191
+ the changed lines inside it, so padding the range buys nothing.
113
192
 
114
- The answer to `story set` is the honest report — check it before you claim to be done:
193
+ The answer to `layers set` is the honest report — check it before you claim to be done:
115
194
 
116
195
  ```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"]}]}}
196
+ {"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
197
  ```
119
198
 
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:
199
+ `total` counts hunks. `covered` counts the ones where every changed line sits inside a layer, and
200
+ `partial` the ones a layer explains only some of. `uncovered` names the runs of changed lines no
201
+ layer claims, so it reads as line numbers a reviewer would otherwise have to find alone: claim them
202
+ and set the layers again. Done means `uncovered` is empty. `vanished` names paths a layer points at
203
+ that this branch does not change, which usually means a typo in a path. Read it back at any time
204
+ with:
123
205
 
124
206
  ```bash
125
- adiff story show --worktree . --fields covered,total,uncovered
207
+ adiff layers show --worktree . --fields covered,partial,total,uncovered
126
208
  ```
127
209
 
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.
210
+ Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
211
+ was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
212
+ reviewer has a reading order, keep it true: write it again after you address their comments.
142
213
 
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.
214
+ When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and
215
+ the files, `j` and `k` move between layers with the diff following, and `]` and `[` walk the files
216
+ inside a layer.
145
217
 
146
218
  ## Discovering the rest
147
219
 
@@ -149,8 +221,9 @@ doubt spends their attention there.
149
221
  adiff describe
150
222
  ```
151
223
 
152
- Returns every command with its options, which are required, and where its payload sits. Use it
153
- instead of guessing, and use `--fields` to keep answers small:
224
+ Returns every command with its options, which are required, which part of the loop it belongs to,
225
+ and where its payload sits. `adiff <command> --help` says the same for one command in plain text.
226
+ Use either instead of guessing, and use `--fields` to keep answers small:
154
227
 
155
228
  ```bash
156
229
  adiff branch list --repo . --fields branch,files