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

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.
@@ -15,6 +15,8 @@ the way it is, why it is tested the way it is. ADRs explain choices that outlive
15
15
  | [ADR-002](ADR-002-effect-v4-and-module-boundaries.md) | Effect v4, and modules sealed behind `index.ts` |
16
16
  | [ADR-003](ADR-003-blackbox-testdriver.md) | Black-box tests through a TestDriver, and no unit tests |
17
17
  | [ADR-004](ADR-004-pnpm-native-releases.md) | pnpm's own release tooling instead of Changesets |
18
+ | [ADR-005](ADR-005-a-mechanical-style-contract.md) | Style is a lint rule, not a document |
19
+ | [ADR-006](ADR-006-the-terminal-runs-on-effect.md) | The terminal runs on Effect |
18
20
 
19
21
  ## Writing one
20
22
 
@@ -16,7 +16,7 @@ PRDs are not the place for every implementation detail. Use the split below:
16
16
  - Read `CONTEXT.md` next. The glossary defines the vocabulary every PRD reuses. adiff has a short
17
17
  language on purpose; a synonym invented in a PRD is a defect.
18
18
  - Read the PRD that owns the behavior. Follow its links to ADRs for durable choices and issues for
19
- implementation steps.
19
+ implementation layers.
20
20
 
21
21
  ## How to write a new PRD
22
22
 
@@ -64,7 +64,7 @@ Before treating a PRD as ready:
64
64
 
65
65
  - [ ] Problem stated from the reviewer's or the agent's perspective, not the code's.
66
66
  - [ ] Solution stated as observable behavior, before any implementation choice is named.
67
- - [ ] User stories cover the happy path, the empty result, the refusal, and the stale case.
67
+ - [ ] User layers cover the happy path, the empty result, the refusal, and the stale case.
68
68
  - [ ] Implementation Decisions are concrete enough that two engineers would build interchangeable
69
69
  implementations.
70
70
  - [ ] File paths, helper names, and rollout order live in GitHub issues.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,189 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.30
4
+
5
+ ### Patch Changes
6
+
7
+ - The palette keeps a command's name clear of its category.
8
+
9
+ ## 0.1.0-alpha.29
10
+
11
+ ### Patch Changes
12
+
13
+ - First contact teaches the loop, an empty collection says what to do next, and a worktree error explains the path.
14
+
15
+ ## 0.1.0-alpha.28
16
+
17
+ ### Patch Changes
18
+
19
+ - An agent can open the review in a split pane beside the conversation.
20
+
21
+ ## 0.1.0-alpha.27
22
+
23
+ ### Minor Changes
24
+
25
+ - adiff init writes the review loop into a repository's agent instructions.
26
+
27
+ ## 0.1.0-alpha.26
28
+
29
+ ### Patch Changes
30
+
31
+ - A branch with no files left to read says so.
32
+
33
+ ## 0.1.0-alpha.25
34
+
35
+ ### Patch Changes
36
+
37
+ - The terminal names the key that sends a review, and counts what is waiting.
38
+
39
+ - The repository's own working tree is reviewable and marked here.
40
+
41
+ ## 0.1.0-alpha.24
42
+
43
+ ### Patch Changes
44
+
45
+ - A selection can be copied, or searched for across the branch's worktree with the matches listed and peeked at.
46
+
47
+ ## 0.1.0-alpha.23
48
+
49
+ ### Patch Changes
50
+
51
+ - A pinned scope wider than the pane can be panned into view, and the command palette opens over the review list.
52
+
53
+ ## 0.1.0-alpha.22
54
+
55
+ ### Patch Changes
56
+
57
+ - A selection reaching over hidden lines reports the range it will actually comment on.
58
+
59
+ - Composing on a row that carries no line says so instead of opening a panel that cannot send.
60
+
61
+ - The stale mark on the layer rail reads in full at any width.
62
+
63
+ ## 0.1.0-alpha.21
64
+
65
+ ### Patch Changes
66
+
67
+ - The store answers with the settings effect directly.
68
+
69
+ ## 0.1.0-alpha.20
70
+
71
+ ### Patch Changes
72
+
73
+ - Homebrew tracks each release.
74
+
75
+ ## 0.1.0-alpha.19
76
+
77
+ ### Patch Changes
78
+
79
+ - The house style lives in the linter, and a thread can be settled and folded from the terminal.
80
+
81
+ ## 0.1.0-alpha.18
82
+
83
+ ### Patch Changes
84
+
85
+ - The cursor stops on a thread so it can be settled directly, and a settled thread folds to one row.
86
+
87
+ ## 0.1.0-alpha.17
88
+
89
+ ### Patch Changes
90
+
91
+ - Say when an agent answers, settle a thread with d, and hold the comments still while the code pans.
92
+
93
+ ## 0.1.0-alpha.16
94
+
95
+ ### Patch Changes
96
+
97
+ - r reads the worktree list again, and notices reach the home screen.
98
+
99
+ ## 0.1.0-alpha.15
100
+
101
+ ### Patch Changes
102
+
103
+ - Pan the diff sideways to read past the right edge.
104
+
105
+ - The footer keeps the way out visible on a narrow terminal.
106
+
107
+ - Wrapping keeps every character and is remembered between sessions.
108
+
109
+ ## 0.1.0-alpha.14
110
+
111
+ ### Patch Changes
112
+
113
+ - V selects the change under the cursor, o grows a selection from its other end, and g and G reach the ends of the worktree list.
114
+
115
+ - w wraps long lines in the diff, and the cursor gutter stops at the last line.
116
+
117
+ ## 0.1.0-alpha.13
118
+
119
+ ### Patch Changes
120
+
121
+ - Reword or withdraw a staged comment, and see when a thread describes an older commit.
122
+
123
+ ## 0.1.0-alpha.12
124
+
125
+ ### Patch Changes
126
+
127
+ - An agent can answer a comment, and a reviewer can settle the thread.
128
+
129
+ ## 0.1.0-alpha.11
130
+
131
+ ### Patch Changes
132
+
133
+ - r reads the branch again, so the agent's newest work appears without leaving the review.
134
+
135
+ ## 0.1.0-alpha.10
136
+
137
+ ### Patch Changes
138
+
139
+ - The rail shows a layer's prose block by block, each above the file it introduces.
140
+
141
+ - layers show says a stale layer set needs a new revision.
142
+
143
+ ## 0.1.0-alpha.9
144
+
145
+ ### Patch Changes
146
+
147
+ - A seeded layer covers two files, so the demo shows what a layer spanning files looks like.
148
+
149
+ ## 0.1.0-alpha.8
150
+
151
+ ### Patch Changes
152
+
153
+ - The simulator seeds layers, so a demo run shows them.
154
+
155
+ - The worktree list says whether a branch already has a pull request.
156
+
157
+ ## 0.1.0-alpha.7
158
+
159
+ ### Patch Changes
160
+
161
+ - A layer's prose reads in the diff, above the code it introduces.
162
+
163
+ ## 0.1.0-alpha.6
164
+
165
+ ### Patch Changes
166
+
167
+ - The diff holds still when a trackpad gesture drifts sideways.
168
+
169
+ - The reading order an agent writes is called layers. adiff layers set and adiff layers show replace the story verbs, and the JSON carries layers where it carried steps.
170
+
171
+ - A layer lists the files it covers, and the footer says how to switch between layers and files.
172
+
173
+ ## 0.1.0-alpha.5
174
+
175
+ ### Patch Changes
176
+
177
+ - Wheel bursts move the diff once a frame, the worktree list shows which branches carry a reading order, and a story the branch has moved past says so.
178
+
179
+ - Scrolling with a trackpad settles as soon as your fingers stop.
180
+
181
+ ## 0.1.0-alpha.4
182
+
183
+ ### Patch Changes
184
+
185
+ - Open the lines a diff leaves out one gap at a time with l, and put them away with h.
186
+
3
187
  ## 0.1.0-alpha.3
4
188
 
5
189
  ### Patch Changes
package/README.md CHANGED
@@ -2,72 +2,135 @@
2
2
 
3
3
  # adiff
4
4
 
5
- Review the work an agent did in a git worktree, in your terminal, and hand your comments back to
6
- the agent still sitting in that worktree. You select lines the way you would on GitHub, write a
7
- comment, and the agent picks it up.
5
+ A code review your agent can answer. You select lines in the terminal and comment; the agent picks
6
+ each comment up by its id, does the work, and answers under your own words. A point stays open until
7
+ you settle it.
8
8
 
9
- <pre align="center">brew install Newbie012/tap/adiff
10
- npm i -g @eliya-oss/agent-diff@alpha</pre>
9
+ The agent can also hand you a reading order: its own diff in layers, a note on each, and a coverage
10
+ check so nothing is quietly left out of the story.
11
+
12
+ <pre align="center">npm i -g @eliya-oss/agent-diff@alpha</pre>
13
+
14
+ <p align="center"><a href="docs/install.md">Other ways to install</a></p>
15
+
16
+ <img src="assets/terminal.webp" alt="The adiff worktree list, showing seven branches with their sizes, layers and review state" width="820">
11
17
 
12
18
  </div>
13
19
 
14
- ## Usage
20
+ ## The loop
21
+
22
+ You comment on a line:
15
23
 
16
24
  ```bash
17
- adiff review open --repo .
18
- adiff branch list --repo . --fields branch,files
19
- adiff comment add --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
20
- adiff comment stage --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
21
- adiff review submit --repo . --branch add-teammate-invitations
22
- adiff file vouch --repo . --branch add-teammate-invitations --file src/api/invitations.ts
23
- adiff story show --worktree . --fields covered,total,uncovered
24
- adiff describe
25
+ adiff comment add --repo . --branch add-teammate-invitations \
26
+ --file src/api/invitations.ts --start 12 --end 13 \
27
+ --body "Three status checks in a row. One error shape would do."
25
28
  ```
26
29
 
27
- `comment add` reaches the agent right away. `comment stage` holds a comment until `review submit`
28
- sends the whole set as one wake-up, so the agent reads a review rather than a stream of remarks.
30
+ The agent in that worktree collects it, carrying the code it was written against:
29
31
 
30
- ## Reviewing
32
+ ```bash
33
+ adiff comment take --worktree .
34
+ {"ok":true,"comments":[{"id":"1c43cb55-6a09-406d-95ad-f048c43e05f5","file":"src/api/invitations.ts",
35
+ "side":"new","start":12,"end":13,"head":"63c11ce3",
36
+ "snippet":" if (res.status === 409) throw new AlreadyInvited(email)\n ...",
37
+ "body":"Three status checks in a row. One error shape would do."}]}
38
+ ```
31
39
 
32
- `adiff review open --repo .` lists the worktrees that have something to review. Enter opens one,
33
- `j` and `k` move down the diff, `[` and `]` move between files, `v` starts a selection, `c` writes
34
- a comment, `ctrl+s` sends it and `ctrl+a` adds it to the review instead. `m` marks a file reviewed,
35
- `ctrl+p` finds any command by name, and the footer lists the keys for wherever you are.
40
+ It does the work, then answers the comment it was handed:
36
41
 
37
- ## The agent side
42
+ ```bash
43
+ adiff comment answer --worktree . --id 1c43cb55-6a09-406d-95ad-f048c43e05f5 \
44
+ --body "Folded them into one InviteRejected carrying the reason."
45
+ {"ok":true,"answered":1}
46
+ ```
38
47
 
39
- In the worktree being reviewed:
48
+ You see that answer under your own words the next time you read the branch, and the thread waits
49
+ there until you settle it with `d`:
40
50
 
41
51
  ```bash
42
- adiff comment take --worktree . # everything written since the last take
43
- adiff comment take --worktree . --wait 300 # block until something arrives
52
+ adiff comment threads --repo . --branch add-teammate-invitations
53
+ {"ok":true,"threads":[{"id":"1c43cb55-6a09-406d-95ad-f048c43e05f5","state":"answered",
54
+ "stale":false,"answers":[{"body":"Folded them into one InviteRejected carrying the reason.",
55
+ "asks":false}]}]}
44
56
  ```
45
57
 
46
- Each comment carries the exact snippet it was written against, the side of the diff, and the commit
47
- the diff was read at, so the agent needs no other reference. A comment is handed over once.
58
+ `--asks` on an answer marks the thread as waiting on you, for a decision the agent needs before it
59
+ can carry on. Settling is yours alone: the agent that raised the answer cannot close the point.
48
60
 
49
- An agent can also record the reading order for its own work as a story: ordered steps over spans of
50
- files, set with `adiff story set --worktree . --json -`. Where a branch has one, the terminal lists
51
- its steps and scopes the diff to the step you are on. adiff computes the coverage itself, so a story
52
- cannot hide code:
61
+ A comment is handed over exactly once, so a second `take` returns only what was written since. Add
62
+ `--wait 300` and it blocks until something arrives, which costs nothing while it waits.
63
+
64
+ ## The reading order
65
+
66
+ An agent knows the order it built a change in. Rebuilding that order by reading forty files is the
67
+ expensive way to learn something it already has, so it can publish the reading itself:
53
68
 
54
69
  ```bash
55
- adiff story show --worktree . --fields covered,total,uncovered
56
- {"ok":true,"story":{"covered":1,"total":3,"uncovered":[{"path":"docs/incidents.md","start":1,"end":6},{"path":"src/api/errors.ts","start":1,"end":11}]}}
70
+ adiff layers set --worktree . --json -
57
71
  ```
58
72
 
59
- ## Skill
73
+ Each layer is a claim over spans of the diff, with a note saying what the layer is for. The terminal
74
+ lists them in the sidebar and scopes the diff to the layer you are on, with the prose sitting above
75
+ the code it describes.
76
+
77
+ adiff computes the coverage itself, so the reading cannot hide code:
78
+
79
+ ```bash
80
+ adiff layers show --worktree . --fields covered,total,uncovered
81
+ {"ok":true,"layers":{"covered":3,"total":3,"uncovered":[]}}
82
+ ```
83
+
84
+ Any hunk no layer claims is reported here and shown to you under "not in any layer". The layers
85
+ record the commit they were written for, and adiff marks them stale once the branch moves past it.
86
+
87
+ ## Reviewing
88
+
89
+ `adiff review open --repo .` lists the worktrees with something to review, including the checkout
90
+ you are standing in. Enter opens one.
91
+
92
+ `j` and `k` move down the diff, `[` and `]` between files, `v` starts a selection and `c` writes a
93
+ comment. `ctrl+s` sends it on its own, `ctrl+a` adds it to a review you send in one go with `S`. `m`
94
+ marks a file reviewed, `d` settles the thread you are on, `s` swaps the sidebar between layers and
95
+ files, `w` wraps long lines, `/` searches for what you selected, `r` reads the branch again, and
96
+ `ctrl+p` finds any command by name. The footer lists the keys for wherever you are.
97
+
98
+ Where the diff leaves lines out, a row says how many. Put the cursor on it and `l` brings ten of them
99
+ back where you stand, `h` puts them away, and the rest of the file stays as small as it was. Opened
100
+ lines are ordinary lines: select them and comment on them.
101
+
102
+ ## Setting up a repository
103
+
104
+ ```bash
105
+ adiff init # shows what it would write
106
+ adiff init --write # writes it
107
+ ```
108
+
109
+ Writes a short passage into `AGENTS.md` and a `CLAUDE.md` that imports it, telling any agent working
110
+ in that repository how the handover runs. It sits between `<!-- adiff:begin -->` and
111
+ `<!-- adiff:end -->`, so a second run changes nothing and removing it is deleting a block you can
112
+ see. `--skill` also writes the full skill into `.claude/skills/adiff/`.
113
+
114
+ For a per-machine install instead:
60
115
 
61
116
  ```bash
62
117
  npx skills add Newbie012/agent-diff --skill adiff
63
118
  ```
64
119
 
65
- Teaches an agent the whole loop: collect comments, act on them, write the story.
120
+ When someone asks for a review, the agent can put it in front of them:
121
+
122
+ ```bash
123
+ adiff review pane --repo .
124
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api"}
125
+ ```
126
+
127
+ It splits tmux, Zellij, WezTerm or kitty. Anywhere else it answers `opened:false` and carries the
128
+ command to run, so the agent quotes one line rather than a paragraph.
66
129
 
67
130
  ## Requirements
68
131
 
69
- Either install gives you an `adiff` on your PATH. Brew brings a Node 26 along with it, so
70
- everything works the moment it finishes.
132
+ Either install gives you an `adiff` on your PATH. Brew brings a Node 26 along with it, so everything
133
+ works the moment it finishes.
71
134
 
72
135
  The commands run on Node 22 or newer. The terminal is the one part that wants Node 26: it draws
73
136
  through opentui, which reaches its native renderer over `node:ffi`, a module Node exposes behind
@@ -75,6 +138,8 @@ through opentui, which reaches its native renderer over `node:ffi`, a module Nod
75
138
  Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and runs the terminal on that, so a
76
139
  global npm install keeps working across a version switch.
77
140
 
141
+ ## Trying it
142
+
78
143
  pnpm 12 is a Rust rewrite and still in beta, so
79
144
  [corepack cannot install it](https://pnpm.io/installation):
80
145
 
@@ -86,19 +151,21 @@ pnpm install
86
151
 
87
152
  `pnpm simulate` builds a throwaway repository with seven branches an agent has already worked on,
88
153
  from a three-file error type up to a 42-file migration of just over a thousand lines each way, and
89
- opens the terminal on it. Your real repos and `~/.adiff` are untouched, and the workspace is removed
90
- when you quit. `pnpm simulate --probe` runs the whole round trip headless and prints it:
154
+ opens the terminal on it. Your real repos and `~/.adiff` are untouched, and the workspace goes when
155
+ you quit. `pnpm simulate --probe` runs the whole round trip headless and prints it:
91
156
 
92
157
  ```
93
- branches {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3,"added":27,"removed":2,...
94
- vouch {"ok":true,"vouched":["src/api/incidents.ts"],"total":3}
95
- agent takes {"ok":true,"comments":[{"file":"src/api/incidents.ts","side":"new","start":12,"end":13,
96
- "snippet":" if (res.status === 404) throw new IncidentNotFound(id)\n if (!res.ok) ...",
97
- "body":"Two throws where one union would do."}]}
158
+ branches {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3,"added":27,"removed":2,"layers":2,...
159
+ vouch {"ok":true,"vouched":["src/api/invitations.ts"],"total":3}
160
+ agent takes {"ok":true,"comments":[{"id":"a83fc98c-8397-44f5-9c37-731a1cf3cb4c","file":"src/api/invitations.ts",
161
+ "side":"new","start":12,"end":13,"snippet":" if (res.status === 409) throw new AlreadyInvited(email)...",
162
+ "body":"Three status checks in a row. One error shape would do."}]}
98
163
  ```
99
164
 
100
165
  ## Notes
101
166
 
167
+ adiff is alpha, and one person's tool. Every release goes out under the `alpha` tag.
168
+
102
169
  Everything the terminal does is also a command, so nothing is trapped in the UI. Each command prints
103
170
  one compact JSON line on stdout and exits 0, and `--fields` trims the answer to what you read:
104
171
 
@@ -110,7 +177,7 @@ adiff branch list --repo . --fields branch,files
110
177
  Failures go to stderr as `{"ok":false,"error":{...}}`, so stdout is always parseable, with an exit
111
178
  code saying what to do about it: `2` malformed request, `3` not found, `1` unexpected. Every error
112
179
  carries a `suggestion` naming the command that resolves it, and `adiff describe` returns the whole
113
- catalog as JSON so a caller can discover the commands.
180
+ catalog as JSON so a caller can discover the rest.
114
181
 
115
182
  Project docs live in `.agents/`. `AGENTS.md` covers making a change, `ARCHITECTURE.md` how the code
116
183
  is laid out.