@eliya-oss/agent-diff 0.1.0-alpha.29 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 0.1.0-alpha.29
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -2,9 +2,12 @@
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
+
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.
8
11
 
9
12
  <pre align="center">npm i -g @eliya-oss/agent-diff@alpha</pre>
10
13
 
@@ -14,67 +17,120 @@ comment, and the agent picks it up.
14
17
 
15
18
  </div>
16
19
 
17
- ## Usage
20
+ ## The loop
21
+
22
+ You comment on a line:
18
23
 
19
24
  ```bash
20
- adiff review open --repo .
21
- adiff branch list --repo . --fields branch,files
22
- adiff comment add --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
23
- adiff comment stage --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
24
- adiff review submit --repo . --branch add-teammate-invitations
25
- adiff file vouch --repo . --branch add-teammate-invitations --file src/api/invitations.ts
26
- adiff layers show --worktree . --fields covered,total,uncovered
27
- 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."
28
28
  ```
29
29
 
30
- `comment add` reaches the agent right away. `comment stage` holds a comment until `review submit`
31
- 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:
32
31
 
33
- ## 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
+ ```
34
39
 
35
- `adiff review open --repo .` lists the worktrees that have something to review. Enter opens one,
36
- `j` and `k` move down the diff, `[` and `]` move between files, `v` starts a selection, `c` writes
37
- a comment, `ctrl+s` sends it and `ctrl+a` adds it to the review instead. `m` marks a file reviewed,
38
- `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:
39
41
 
40
- Where the diff leaves lines out, a row says how many. Put the cursor on it and `l` brings ten of
41
- them back where you are standing, `h` puts them away again, and the rest of the file stays as small
42
- as it was. Opened lines are ordinary lines: you can select them and comment on them.
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
+ ```
43
47
 
44
- ## The agent side
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`:
45
50
 
46
- In the worktree being reviewed:
51
+ ```bash
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}]}]}
56
+ ```
57
+
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.
60
+
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:
47
68
 
48
69
  ```bash
49
- adiff comment take --worktree . # everything written since the last take
50
- adiff comment take --worktree . --wait 300 # block until something arrives
70
+ adiff layers set --worktree . --json -
51
71
  ```
52
72
 
53
- Each comment carries the exact snippet it was written against, the side of the diff, and the commit
54
- the diff was read at, so the agent needs no other reference. A comment is handed over once.
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.
55
76
 
56
- An agent can also record the reading order for its own work as a layers: ordered layers over spans of
57
- files, set with `adiff layers set --worktree . --json -`. Where a branch has one, the terminal lists
58
- its layers and scopes the diff to the layer you are on. adiff computes the coverage itself, so a layers
59
- cannot hide code:
77
+ adiff computes the coverage itself, so the reading cannot hide code:
60
78
 
61
79
  ```bash
62
80
  adiff layers show --worktree . --fields covered,total,uncovered
63
- {"ok":true,"layers":{"covered":1,"total":3,"uncovered":[{"path":"docs/incidents.md","start":1,"end":6},{"path":"src/api/errors.ts","start":1,"end":11}]}}
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
64
107
  ```
65
108
 
66
- ## Skill
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:
67
115
 
68
116
  ```bash
69
117
  npx skills add Newbie012/agent-diff --skill adiff
70
118
  ```
71
119
 
72
- Teaches an agent the whole loop: collect comments, act on them, write the layers.
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.
73
129
 
74
130
  ## Requirements
75
131
 
76
- Either install gives you an `adiff` on your PATH. Brew brings a Node 26 along with it, so
77
- 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.
78
134
 
79
135
  The commands run on Node 22 or newer. The terminal is the one part that wants Node 26: it draws
80
136
  through opentui, which reaches its native renderer over `node:ffi`, a module Node exposes behind
@@ -82,6 +138,8 @@ through opentui, which reaches its native renderer over `node:ffi`, a module Nod
82
138
  Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and runs the terminal on that, so a
83
139
  global npm install keeps working across a version switch.
84
140
 
141
+ ## Trying it
142
+
85
143
  pnpm 12 is a Rust rewrite and still in beta, so
86
144
  [corepack cannot install it](https://pnpm.io/installation):
87
145
 
@@ -93,19 +151,21 @@ pnpm install
93
151
 
94
152
  `pnpm simulate` builds a throwaway repository with seven branches an agent has already worked on,
95
153
  from a three-file error type up to a 42-file migration of just over a thousand lines each way, and
96
- opens the terminal on it. Your real repos and `~/.adiff` are untouched, and the workspace is removed
97
- 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:
98
156
 
99
157
  ```
100
- branches {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3,"added":27,"removed":2,...
101
- vouch {"ok":true,"vouched":["src/api/incidents.ts"],"total":3}
102
- agent takes {"ok":true,"comments":[{"file":"src/api/incidents.ts","side":"new","start":12,"end":13,
103
- "snippet":" if (res.status === 404) throw new IncidentNotFound(id)\n if (!res.ok) ...",
104
- "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."}]}
105
163
  ```
106
164
 
107
165
  ## Notes
108
166
 
167
+ adiff is alpha, and one person's tool. Every release goes out under the `alpha` tag.
168
+
109
169
  Everything the terminal does is also a command, so nothing is trapped in the UI. Each command prints
110
170
  one compact JSON line on stdout and exits 0, and `--fields` trims the answer to what you read:
111
171
 
@@ -117,7 +177,7 @@ adiff branch list --repo . --fields branch,files
117
177
  Failures go to stderr as `{"ok":false,"error":{...}}`, so stdout is always parseable, with an exit
118
178
  code saying what to do about it: `2` malformed request, `3` not found, `1` unexpected. Every error
119
179
  carries a `suggestion` naming the command that resolves it, and `adiff describe` returns the whole
120
- catalog as JSON so a caller can discover the commands.
180
+ catalog as JSON so a caller can discover the rest.
121
181
 
122
182
  Project docs live in `.agents/`. `AGENTS.md` covers making a change, `ARCHITECTURE.md` how the code
123
183
  is laid out.
package/dist/main.js CHANGED
@@ -20610,6 +20610,7 @@ const COMPOSE_MIN_TEXT = 8;
20610
20610
  const reportActions = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("copy and save")}`;
20611
20611
  const actionsText = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^a")} ${fg(palette.muted)("add to review")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("comment now")}`;
20612
20612
  const SNIPPET_LINES = 4;
20613
+ const PALETTE_TITLE = 34;
20613
20614
  const PALETTE_MAX = 18;
20614
20615
  const PALETTE_CHROME = 4;
20615
20616
  const PENDING_CHROME = 3;
@@ -21188,7 +21189,7 @@ var Screen = class {
21188
21189
  this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
21189
21190
  this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
21190
21191
  this.paletteChoices.options = matches.map((entry) => ({
21191
- name: `${entry.title.padEnd(34)}${entry.category}`,
21192
+ name: `${clip(entry.title, 32).padEnd(PALETTE_TITLE)}${entry.category}`,
21192
21193
  description: "",
21193
21194
  value: entry.action
21194
21195
  }));
package/package.json CHANGED
@@ -23,8 +23,8 @@
23
23
  "bin": {
24
24
  "adiff": "./bin/adiff.js"
25
25
  },
26
- "version": "0.1.0-alpha.29",
27
- "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
26
+ "version": "0.1.0-alpha.30",
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.",
28
28
  "license": "MIT",
29
29
  "repository": {
30
30
  "type": "git",