@eliya-oss/agent-diff 0.1.0-alpha.9 → 0.1.0-alpha.91
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/.agents/adr/README.md +3 -0
- package/CHANGELOG.md +550 -0
- package/README.md +37 -89
- package/bin/adiff.js +6 -2
- package/dist/main.js +16143 -13826
- package/package.json +8 -6
- package/skills/adiff/SKILL.md +125 -33
package/README.md
CHANGED
|
@@ -2,122 +2,70 @@
|
|
|
2
2
|
|
|
3
3
|
# adiff
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
An agent finishes a piece of work and leaves you a diff. adiff puts the conversation on the code:
|
|
6
|
+
you comment on the lines in a terminal, the agent that wrote them answers under your words, and a
|
|
7
|
+
point stays open until 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
|
+
<pre align="center">brew install Newbie012/tap/adiff</pre>
|
|
11
10
|
|
|
12
|
-
</
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```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 layers show --worktree . --fields covered,total,uncovered
|
|
24
|
-
adiff describe
|
|
25
|
-
```
|
|
26
|
-
|
|
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.
|
|
11
|
+
<p align="center"><a href="docs/install.md">Other ways to install</a></p>
|
|
29
12
|
|
|
30
|
-
|
|
31
|
-
|
|
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.
|
|
13
|
+
<img src="assets/terminal.webp" alt="The adiff worktree list, showing seven branches with their sizes, layers and review state" width="820">
|
|
36
14
|
|
|
37
|
-
|
|
38
|
-
them back where you are standing, `h` puts them away again, and the rest of the file stays as small
|
|
39
|
-
as it was. Opened lines are ordinary lines: you can select them and comment on them.
|
|
15
|
+
</div>
|
|
40
16
|
|
|
41
|
-
##
|
|
17
|
+
## Getting started
|
|
42
18
|
|
|
43
|
-
|
|
19
|
+
Install adiff, then teach the repository what it is:
|
|
44
20
|
|
|
45
21
|
```bash
|
|
46
|
-
|
|
47
|
-
adiff
|
|
22
|
+
brew install Newbie012/tap/adiff
|
|
23
|
+
adiff init --write --skill
|
|
48
24
|
```
|
|
49
25
|
|
|
50
|
-
|
|
51
|
-
the
|
|
26
|
+
`init` writes a short passage into `AGENTS.md` and a `CLAUDE.md` that imports it, and `--skill`
|
|
27
|
+
writes the full skill into `.claude/skills/adiff/`. Then ask your agent to walk you through it:
|
|
52
28
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
its layers and scopes the diff to the layer you are on. adiff computes the coverage itself, so a layers
|
|
56
|
-
cannot hide code:
|
|
29
|
+
> Read the adiff skill and onboard me: hand your current work over for review, and tell me what to
|
|
30
|
+
> press.
|
|
57
31
|
|
|
58
|
-
|
|
59
|
-
adiff layers show --worktree . --fields covered,total,uncovered
|
|
60
|
-
{"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}]}}
|
|
61
|
-
```
|
|
32
|
+
From then on the loop is: the agent hands work over, you read it, and it answers what you wrote.
|
|
62
33
|
|
|
63
|
-
##
|
|
34
|
+
## Reviewing
|
|
64
35
|
|
|
65
36
|
```bash
|
|
66
|
-
|
|
37
|
+
adiff review open --repo .
|
|
67
38
|
```
|
|
68
39
|
|
|
69
|
-
|
|
40
|
+
`j` and `k` move down the diff, `[` and `]` between files, `v` starts a selection and `c` writes a
|
|
41
|
+
comment that `ctrl+s` sends. `d` settles the thread you are on, `m` marks a file reviewed, `y`
|
|
42
|
+
copies the line you are on, and dragging over lines copies them. `?` lists every key and filters as
|
|
43
|
+
you type. The footer carries the keys of whichever pane you are in.
|
|
70
44
|
|
|
71
|
-
##
|
|
72
|
-
|
|
73
|
-
Either install gives you an `adiff` on your PATH. Brew brings a Node 26 along with it, so
|
|
74
|
-
everything works the moment it finishes.
|
|
75
|
-
|
|
76
|
-
The commands run on Node 22 or newer. The terminal is the one part that wants Node 26: it draws
|
|
77
|
-
through opentui, which reaches its native renderer over `node:ffi`, a module Node exposes behind
|
|
78
|
-
`--experimental-ffi` from 26 onward. When you open the terminal on an older Node, adiff looks for a
|
|
79
|
-
Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and runs the terminal on that, so a
|
|
80
|
-
global npm install keeps working across a version switch.
|
|
45
|
+
## For agents
|
|
81
46
|
|
|
82
|
-
|
|
83
|
-
[corepack cannot install it](https://pnpm.io/installation):
|
|
47
|
+
Three commands are the whole loop:
|
|
84
48
|
|
|
85
49
|
```bash
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
`pnpm simulate` builds a throwaway repository with seven branches an agent has already worked on,
|
|
92
|
-
from a three-file error type up to a 42-file migration of just over a thousand lines each way, and
|
|
93
|
-
opens the terminal on it. Your real repos and `~/.adiff` are untouched, and the workspace is removed
|
|
94
|
-
when you quit. `pnpm simulate --probe` runs the whole round trip headless and prints it:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
branches {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3,"added":27,"removed":2,...
|
|
98
|
-
vouch {"ok":true,"vouched":["src/api/incidents.ts"],"total":3}
|
|
99
|
-
agent takes {"ok":true,"comments":[{"file":"src/api/incidents.ts","side":"new","start":12,"end":13,
|
|
100
|
-
"snippet":" if (res.status === 404) throw new IncidentNotFound(id)\n if (!res.ok) ...",
|
|
101
|
-
"body":"Two throws where one union would do."}]}
|
|
50
|
+
adiff comment take --worktree . --wait 300 # what the reviewer wrote, with the code it was on
|
|
51
|
+
adiff comment answer --worktree . --id <id> --body "what you did about it"
|
|
52
|
+
adiff review pane --repo . # put the review in front of them, split in tmux
|
|
102
53
|
```
|
|
103
54
|
|
|
104
|
-
|
|
55
|
+
Everything answers JSON on stdout and `{"ok":false,"error":{...}}` on stderr, with a `suggestion`
|
|
56
|
+
naming the command that resolves it. `adiff describe` returns the whole catalog, so nothing here has
|
|
57
|
+
to be memorised. [The handover in detail](docs/handover.md) covers layers, coverage and the rest.
|
|
105
58
|
|
|
106
|
-
|
|
107
|
-
one compact JSON line on stdout and exits 0, and `--fields` trims the answer to what you read:
|
|
59
|
+
## Requirements
|
|
108
60
|
|
|
109
|
-
|
|
110
|
-
adiff
|
|
111
|
-
|
|
112
|
-
```
|
|
61
|
+
The commands run on Node 22 or newer. The terminal wants Node 26, which Homebrew brings along; on a
|
|
62
|
+
global npm install adiff finds a Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and
|
|
63
|
+
runs the terminal on that.
|
|
113
64
|
|
|
114
|
-
|
|
115
|
-
code saying what to do about it: `2` malformed request, `3` not found, `1` unexpected. Every error
|
|
116
|
-
carries a `suggestion` naming the command that resolves it, and `adiff describe` returns the whole
|
|
117
|
-
catalog as JSON so a caller can discover the commands.
|
|
65
|
+
## Notes
|
|
118
66
|
|
|
119
|
-
|
|
120
|
-
is laid out.
|
|
67
|
+
adiff is alpha, and one person's tool. Every release goes out under the `alpha` tag. Project docs
|
|
68
|
+
live in `.agents/`: `AGENTS.md` covers making a change, `ARCHITECTURE.md` how the code is laid out.
|
|
121
69
|
|
|
122
70
|
## License
|
|
123
71
|
|
package/bin/adiff.js
CHANGED
|
@@ -27,14 +27,18 @@ const MESSAGE = [
|
|
|
27
27
|
"Every other adiff command runs here. Install Node 26 to open the terminal.",
|
|
28
28
|
].join("\n")
|
|
29
29
|
|
|
30
|
+
const watched = () => process.stdout.isTTY && process.stdin.isTTY
|
|
31
|
+
|
|
30
32
|
const drawsTerminal = (argv) => {
|
|
31
33
|
const words = argv.filter((token) => !token.startsWith("--"))
|
|
34
|
+
if (argv.length === 0) return watched()
|
|
32
35
|
return words[0] === "review" && words[1] === "open"
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
const rendersHere = () =>
|
|
36
|
-
|
|
37
|
-
process.getBuiltinModule
|
|
39
|
+
process.versions.bun !== undefined ||
|
|
40
|
+
(typeof process.getBuiltinModule === "function" &&
|
|
41
|
+
process.getBuiltinModule("node:ffi") !== undefined)
|
|
38
42
|
|
|
39
43
|
const NODE_DIRECTORY = /^(?:v?\d|node)/
|
|
40
44
|
|