@eliya-oss/agent-diff 0.1.0-alpha.3 → 0.1.0-alpha.31

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.3",
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.31",
27
+ "description": "A code review your agent can answer: comments carry ids, the agent replies under them, and it publishes the reading order for its own diff.",
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 write the layers 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.
4
4
  ---
5
5
 
6
6
  # adiff
@@ -35,6 +35,41 @@ adiff comment take --worktree . --wait 300
35
35
  Blocks until a comment arrives or the timeout in seconds elapses, then returns the same envelope.
36
36
  An empty `comments` array means the wait expired with nothing new — that is not an error.
37
37
 
38
+ Run the wait in the background, not in the foreground. A foreground wait holds the turn, so you
39
+ cannot do anything else and the person you are working with cannot talk to you. Backgrounded, the
40
+ harness brings you back the moment a comment lands.
41
+
42
+ Re-arm it after each comment you handle, and keep it running while you work. A reviewer reads at
43
+ their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
44
+ events rather than by you asking. When you finish a piece of work, say you are still listening.
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
+
38
73
  ## Acting on a comment
39
74
 
40
75
  Read `snippet` before opening the file: the reviewer commented on the diff, and the file may have
@@ -58,21 +93,21 @@ Read `suggestion` before doing anything else — it names the command that resol
58
93
  Retry only when `retriable` is true. `UnknownBranch` means this worktree is not one adiff knows
59
94
  about, because the reviewer has not opened it; report that rather than looping.
60
95
 
61
- ## Handing work over: write the story
96
+ ## Handing work over: write the layers
62
97
 
63
98
  You know the order the change was built in. The reviewer does not, and rebuilding it by reading
64
99
  every file is the most expensive way to learn something you already have. When you finish a piece
65
- of work, write a **story**: an ordered set of steps over the diff, each one a claim about a span of
100
+ of work, write a **layers**: an ordered set of layers over the diff, each one a claim about a span of
66
101
  code. The reviewer then walks the argument instead of the filesystem.
67
102
 
68
103
  ```bash
69
- adiff story set --worktree . --json - <<'JSON'
104
+ adiff layers set --worktree . --json - <<'JSON'
70
105
  {
71
106
  "summary": "Team invitations, end to end",
72
- "steps": [
107
+ "layers": [
73
108
  {
74
109
  "title": "Add the invitation data model",
75
- "note": "The record every later step leans on",
110
+ "note": "The record every later layer leans on",
76
111
  "spans": [{ "path": "src/db/invites.ts", "start": 1, "end": 48 }]
77
112
  },
78
113
  {
@@ -91,48 +126,73 @@ adiff story set --worktree . --json - <<'JSON'
91
126
  JSON
92
127
  ```
93
128
 
94
- Rules that make a story worth reading:
129
+ Rules that make a layers worth reading:
95
130
 
96
- - **Order is the point.** Step 1 is what the reader must understand before step 2 makes sense.
131
+ - **Order is the point.** Layer 1 is what the reader must understand before layer 2 makes sense.
97
132
  Data model, then the code that uses it, then the surface, then the mechanical bits last.
98
133
  - **A title is a claim, not a file name.** "Add the invitation API", never "changes to
99
134
  src/api/invites.ts".
100
135
  - **Line numbers are the new side of the diff**, the same numbers `adiff comment take` reports.
101
- - **Cover everything.** adiff computes coverage itself and answers with the hunks no step claims;
102
- those show up for the reviewer under "not in any step" whatever you do. A story that quietly
103
- skips a third of the diff is worse than no story, so put the leftovers in a final step and say
104
- they are mechanical.
136
+ - **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer
137
+ claims; those show up for the reviewer under "not in any layer" whatever you do. A layer set that
138
+ quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and
139
+ say they are mechanical. Claim the lines you actually read: a span reaching past them counts only
140
+ the changed lines inside it, so padding the range buys nothing.
105
141
 
106
- The answer to `story set` is the honest report — check it before you claim to be done:
142
+ The answer to `layers set` is the honest report — check it before you claim to be done:
107
143
 
108
144
  ```json
109
- {"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"]}]}}
145
+ {"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"]}]}}
110
146
  ```
111
147
 
112
- `covered`/`total` count hunks. `uncovered` names the ones no step claims — claim them and set the
113
- story again. `vanished` names paths a step points at that this branch does not change, which
114
- usually means a typo in a path. Read it back at any time with:
148
+ `total` counts hunks. `covered` counts the ones where every changed line sits inside a layer, and
149
+ `partial` the ones a layer explains only some of. `uncovered` names the runs of changed lines no
150
+ layer claims, so it reads as line numbers a reviewer would otherwise have to find alone: claim them
151
+ and set the layers again. Done means `uncovered` is empty. `vanished` names paths a layer points at
152
+ that this branch does not change, which usually means a typo in a path. Read it back at any time
153
+ with:
115
154
 
116
155
  ```bash
117
- adiff story show --worktree . --fields covered,total,uncovered
156
+ adiff layers show --worktree . --fields covered,partial,total,uncovered
118
157
  ```
119
158
 
120
- Setting a story again supersedes the previous one and bumps `version`; the story records the commit
159
+ Setting a layers again supersedes the previous one and bumps `version`; the layers records the commit
121
160
  it was written for, and adiff reports it as `stale` once the branch moves past that commit. After
122
- you address a review, write the story again.
161
+ you address a review, write the layers again.
162
+
163
+ ## Put the review in front of them
164
+
165
+ When someone asks you for a review, open it rather than describing how:
166
+
167
+ ```bash
168
+ adiff review pane --repo <repo>
169
+ ```
170
+
171
+ It splits the pane they are already looking at, so their next move is to look right rather than to
172
+ type. The answer says what happened:
173
+
174
+ ```json
175
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api"}
176
+ ```
177
+
178
+ `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,
179
+ WezTerm or kitty has nowhere to put a pane. The answer carries `command` either way, so quote that
180
+ line and let them run it.
181
+
182
+ Open a pane when a review was asked for. Finishing work is not a reason on its own, and taking over
183
+ someone's screen uninvited is worse than a line they have to copy.
123
184
 
124
185
  ## Tell the reviewer how to read it
125
186
 
126
- The person you are handing work to has to open the review themselves, so end your reply with the
127
- command and the keys. Name the repository they should point at, which is the repository the
128
- worktree belongs to:
187
+ Whether or not a pane opened, say what to do with it. Name the repository they should point at,
188
+ which is the repository the worktree belongs to:
129
189
 
130
190
  > Open it with `adiff review open --repo <repo>`, then press `enter` on this branch. The sidebar
131
- > lists the steps in reading order; `j` and `k` move between them and the diff follows. Inside a
132
- > step, `]` and `[` walk its files. Select lines with `v`, write a comment with `c`, stage it with
191
+ > lists the layers in reading order; `j` and `k` move between them and the diff follows. Inside a
192
+ > layer, `]` and `[` walk its files. Select lines with `v`, write a comment with `c`, stage it with
133
193
  > `ctrl+a`, and send the whole review with `S`. Press `?` for the rest.
134
194
 
135
- Say what you want looked at hardest, and where you are unsure. A reviewer who knows which step you
195
+ Say what you want looked at hardest, and where you are unsure. A reviewer who knows which layer you
136
196
  doubt spends their attention there.
137
197
 
138
198
  ## Discovering the rest