@eliya-oss/agent-diff 0.1.0-alpha.1 → 0.1.0-alpha.100
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/.agents/prd/README.md +2 -2
- package/CHANGELOG.md +666 -0
- package/README.md +37 -79
- package/bin/adiff.js +80 -2
- package/dist/main.js +17611 -0
- package/package.json +14 -10
- package/skills/adiff/SKILL.md +140 -26
- package/src/cli/catalog.ts +0 -178
- package/src/cli/commands.ts +0 -335
- package/src/cli/error.ts +0 -44
- package/src/cli/index.ts +0 -24
- package/src/cli/parse.ts +0 -31
- package/src/cli/report.ts +0 -96
- package/src/cli/story.ts +0 -223
- package/src/domain/narrative/coverage.ts +0 -54
- package/src/domain/narrative/index.ts +0 -4
- package/src/domain/narrative/model.ts +0 -46
- package/src/domain/narrative/version.ts +0 -63
- package/src/domain/patch/anchor.ts +0 -40
- package/src/domain/patch/index.ts +0 -7
- package/src/domain/patch/model.ts +0 -54
- package/src/domain/patch/parse.ts +0 -106
- package/src/domain/patch/render.ts +0 -48
- package/src/domain/patch/sticky.ts +0 -39
- package/src/domain/review/index.ts +0 -4
- package/src/domain/review/lifecycle.ts +0 -45
- package/src/domain/review/model.ts +0 -23
- package/src/domain/review/vouch.ts +0 -15
- package/src/main.ts +0 -186
- package/src/service/git/error.ts +0 -16
- package/src/service/git/index.ts +0 -3
- package/src/service/git/model.ts +0 -13
- package/src/service/git/run.ts +0 -27
- package/src/service/git/service.ts +0 -133
- package/src/service/store/error.ts +0 -11
- package/src/service/store/index.ts +0 -5
- package/src/service/store/model.ts +0 -33
- package/src/service/store/paths.ts +0 -25
- package/src/service/store/service.ts +0 -154
- package/src/testing/agent-surface.test.ts +0 -92
- package/src/testing/batch.test.ts +0 -93
- package/src/testing/branch-state.test.ts +0 -99
- package/src/testing/chrome-tone.test.ts +0 -57
- package/src/testing/comment-block.test.ts +0 -84
- package/src/testing/comment-walk.test.ts +0 -96
- package/src/testing/compose-box.test.ts +0 -97
- package/src/testing/compose.test.ts +0 -67
- package/src/testing/context.test.ts +0 -77
- package/src/testing/cursor.test.ts +0 -49
- package/src/testing/delivery.test.ts +0 -94
- package/src/testing/domains/agent/driver.ts +0 -50
- package/src/testing/domains/agent/index.ts +0 -2
- package/src/testing/domains/app/driver.ts +0 -168
- package/src/testing/domains/app/index.ts +0 -2
- package/src/testing/domains/branch/driver.ts +0 -51
- package/src/testing/domains/branch/index.ts +0 -3
- package/src/testing/domains/branch/model.ts +0 -39
- package/src/testing/domains/screen/driver.ts +0 -241
- package/src/testing/domains/screen/index.ts +0 -2
- package/src/testing/driver.ts +0 -31
- package/src/testing/escape.test.ts +0 -56
- package/src/testing/focus.test.ts +0 -104
- package/src/testing/footer-chips.test.ts +0 -65
- package/src/testing/footer.test.ts +0 -64
- package/src/testing/gaps.test.ts +0 -47
- package/src/testing/highlight.test.ts +0 -49
- package/src/testing/home-screen.test.ts +0 -51
- package/src/testing/index.ts +0 -4
- package/src/testing/inline-comments.test.ts +0 -131
- package/src/testing/marks.test.ts +0 -49
- package/src/testing/mouse.test.ts +0 -87
- package/src/testing/navigate.test.ts +0 -73
- package/src/testing/palette.test.ts +0 -68
- package/src/testing/pending.test.ts +0 -70
- package/src/testing/pin-align.test.ts +0 -37
- package/src/testing/progress.test.ts +0 -88
- package/src/testing/report.test.ts +0 -83
- package/src/testing/resume.test.ts +0 -39
- package/src/testing/review.test.ts +0 -181
- package/src/testing/roundtrip.test.ts +0 -70
- package/src/testing/scale.test.ts +0 -55
- package/src/testing/scroll-feel.test.ts +0 -81
- package/src/testing/sent-comments.test.ts +0 -106
- package/src/testing/state.ts +0 -55
- package/src/testing/sticky-removed.test.ts +0 -67
- package/src/testing/sticky.test.ts +0 -90
- package/src/testing/story-rail.test.ts +0 -122
- package/src/testing/story.test.ts +0 -183
- package/src/testing/stress.test.ts +0 -74
- package/src/testing/tree-collapse.test.ts +0 -108
- package/src/testing/tree-rows.test.ts +0 -66
- package/src/testing/tree.test.ts +0 -91
- package/src/testing/tui.test.ts +0 -73
- package/src/testing/typing.test.ts +0 -65
- package/src/testing/vouch-next.test.ts +0 -65
- package/src/testing/vouch-tui.test.ts +0 -77
- package/src/testing/wash.test.ts +0 -32
- package/src/testing/width.test.ts +0 -62
- package/src/tui/app.ts +0 -467
- package/src/tui/command.ts +0 -390
- package/src/tui/diffview.ts +0 -333
- package/src/tui/index.ts +0 -9
- package/src/tui/marks.ts +0 -102
- package/src/tui/match.ts +0 -34
- package/src/tui/model.ts +0 -310
- package/src/tui/reduce.ts +0 -305
- package/src/tui/render.ts +0 -897
- package/src/tui/report.ts +0 -74
- package/src/tui/session.ts +0 -32
- package/src/tui/theme.ts +0 -61
- package/src/tui/tree.ts +0 -149
package/README.md
CHANGED
|
@@ -2,112 +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">
|
|
9
|
+
<pre align="center">brew install Newbie012/tap/adiff</pre>
|
|
10
10
|
|
|
11
|
-
</
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
adiff review open --repo .
|
|
17
|
-
adiff branch list --repo . --fields branch,files
|
|
18
|
-
adiff comment add --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
|
|
19
|
-
adiff comment stage --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
|
|
20
|
-
adiff review submit --repo . --branch add-teammate-invitations
|
|
21
|
-
adiff file vouch --repo . --branch add-teammate-invitations --file src/api/invitations.ts
|
|
22
|
-
adiff story show --worktree . --fields covered,total,uncovered
|
|
23
|
-
adiff describe
|
|
24
|
-
```
|
|
11
|
+
<p align="center"><a href="docs/install.md">Other ways to install</a></p>
|
|
25
12
|
|
|
26
|
-
|
|
27
|
-
sends the whole set as one wake-up, so the agent reads a review rather than a stream of remarks.
|
|
13
|
+
<img src="assets/terminal.webp" alt="The adiff worktree list, showing seven branches with their sizes, layers and review state" width="820">
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
`adiff review open --repo .` lists the worktrees that have something to review. Enter opens one,
|
|
32
|
-
`j` and `k` move down the diff, `[` and `]` move between files, `v` starts a selection, `c` writes
|
|
33
|
-
a comment, `ctrl+s` sends it and `ctrl+a` adds it to the review instead. `m` marks a file reviewed,
|
|
34
|
-
`ctrl+p` finds any command by name, and the footer lists the keys for wherever you are.
|
|
15
|
+
</div>
|
|
35
16
|
|
|
36
|
-
##
|
|
17
|
+
## Getting started
|
|
37
18
|
|
|
38
|
-
|
|
19
|
+
Install adiff, then teach the repository what it is:
|
|
39
20
|
|
|
40
21
|
```bash
|
|
41
|
-
|
|
42
|
-
adiff
|
|
22
|
+
brew install Newbie012/tap/adiff
|
|
23
|
+
adiff init --write --skill
|
|
43
24
|
```
|
|
44
25
|
|
|
45
|
-
|
|
46
|
-
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:
|
|
47
28
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
its steps and scopes the diff to the step you are on. adiff computes the coverage itself, so a story
|
|
51
|
-
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.
|
|
52
31
|
|
|
53
|
-
|
|
54
|
-
adiff story show --worktree . --fields covered,total,uncovered
|
|
55
|
-
{"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}]}}
|
|
56
|
-
```
|
|
32
|
+
From then on the loop is: the agent hands work over, you read it, and it answers what you wrote.
|
|
57
33
|
|
|
58
|
-
##
|
|
34
|
+
## Reviewing
|
|
59
35
|
|
|
60
36
|
```bash
|
|
61
|
-
|
|
37
|
+
adiff review open --repo .
|
|
62
38
|
```
|
|
63
39
|
|
|
64
|
-
|
|
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.
|
|
65
44
|
|
|
66
|
-
##
|
|
67
|
-
|
|
68
|
-
Node 26 or newer. adiff draws through opentui, which reaches its native renderer over `node:ffi`, a
|
|
69
|
-
module Node exposes behind `--experimental-ffi` from 26 onward. Every entry point in this repo
|
|
70
|
-
passes the flag for you.
|
|
45
|
+
## For agents
|
|
71
46
|
|
|
72
|
-
|
|
73
|
-
[corepack cannot install it](https://pnpm.io/installation):
|
|
47
|
+
Three commands are the whole loop:
|
|
74
48
|
|
|
75
49
|
```bash
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
|
79
53
|
```
|
|
80
54
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
when you quit. `pnpm simulate --probe` runs the whole round trip headless and prints it:
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
branches {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3,"added":27,"removed":2,...
|
|
88
|
-
vouch {"ok":true,"vouched":["src/api/incidents.ts"],"total":3}
|
|
89
|
-
agent takes {"ok":true,"comments":[{"file":"src/api/incidents.ts","side":"new","start":12,"end":13,
|
|
90
|
-
"snippet":" if (res.status === 404) throw new IncidentNotFound(id)\n if (!res.ok) ...",
|
|
91
|
-
"body":"Two throws where one union would do."}]}
|
|
92
|
-
```
|
|
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.
|
|
93
58
|
|
|
94
|
-
##
|
|
59
|
+
## Requirements
|
|
95
60
|
|
|
96
|
-
|
|
97
|
-
|
|
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.
|
|
98
64
|
|
|
99
|
-
|
|
100
|
-
adiff branch list --repo . --fields branch,files
|
|
101
|
-
{"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3}]}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Failures go to stderr as `{"ok":false,"error":{...}}`, so stdout is always parseable, with an exit
|
|
105
|
-
code saying what to do about it: `2` malformed request, `3` not found, `1` unexpected. Every error
|
|
106
|
-
carries a `suggestion` naming the command that resolves it, and `adiff describe` returns the whole
|
|
107
|
-
catalog as JSON so a caller can discover the commands.
|
|
65
|
+
## Notes
|
|
108
66
|
|
|
109
|
-
|
|
110
|
-
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.
|
|
111
69
|
|
|
112
70
|
## License
|
|
113
71
|
|
package/bin/adiff.js
CHANGED
|
@@ -1,2 +1,80 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
import "
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process"
|
|
3
|
+
import { existsSync, readdirSync } from "node:fs"
|
|
4
|
+
import { homedir } from "node:os"
|
|
5
|
+
import { join } from "node:path"
|
|
6
|
+
import { fileURLToPath } from "node:url"
|
|
7
|
+
|
|
8
|
+
const RENDERER_FLAGS = ["--experimental-ffi", "--disable-warning=ExperimentalWarning"]
|
|
9
|
+
const RENDERER_MAJOR = 26
|
|
10
|
+
const ENTRY = fileURLToPath(new URL("../dist/main.js", import.meta.url))
|
|
11
|
+
|
|
12
|
+
const home = homedir()
|
|
13
|
+
|
|
14
|
+
const SOURCES = [
|
|
15
|
+
[process.env["FNM_DIR"] ?? join(home, ".local", "share", "fnm"), "node-versions", "installation/bin/node"],
|
|
16
|
+
[join(home, "Library", "Application Support", "fnm"), "node-versions", "installation/bin/node"],
|
|
17
|
+
[process.env["NVM_DIR"] ?? join(home, ".nvm"), "versions/node", "bin/node"],
|
|
18
|
+
[process.env["ASDF_DATA_DIR"] ?? join(home, ".asdf"), "installs/nodejs", "bin/node"],
|
|
19
|
+
[process.env["VOLTA_HOME"] ?? join(home, ".volta"), "tools/image/node", "bin/node"],
|
|
20
|
+
[process.env["HOMEBREW_PREFIX"] ?? "/opt/homebrew", "opt", "bin/node"],
|
|
21
|
+
["/usr/local", "opt", "bin/node"],
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const MESSAGE = [
|
|
25
|
+
"adiff review open draws its terminal through node:ffi, which needs Node 26 or newer.",
|
|
26
|
+
`This is Node ${process.versions.node}, and no Node ${RENDERER_MAJOR} was found on this machine.`,
|
|
27
|
+
"Every other adiff command runs here. Install Node 26 to open the terminal.",
|
|
28
|
+
].join("\n")
|
|
29
|
+
|
|
30
|
+
const watched = () => process.stdout.isTTY && process.stdin.isTTY
|
|
31
|
+
|
|
32
|
+
const drawsTerminal = (argv) => {
|
|
33
|
+
const words = argv.filter((token) => !token.startsWith("--"))
|
|
34
|
+
if (argv.length === 0) return watched()
|
|
35
|
+
return words[0] === "review" && words[1] === "open"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const rendersHere = () =>
|
|
39
|
+
process.versions.bun !== undefined ||
|
|
40
|
+
(typeof process.getBuiltinModule === "function" &&
|
|
41
|
+
process.getBuiltinModule("node:ffi") !== undefined)
|
|
42
|
+
|
|
43
|
+
const NODE_DIRECTORY = /^(?:v?\d|node)/
|
|
44
|
+
|
|
45
|
+
const majorOf = (name) => Number(/\d+/.exec(name)?.[0] ?? Number.NaN)
|
|
46
|
+
|
|
47
|
+
const listed = (directory) => {
|
|
48
|
+
try {
|
|
49
|
+
return readdirSync(directory)
|
|
50
|
+
} catch {
|
|
51
|
+
return []
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const installsUnder = ([root, versions, binary]) =>
|
|
56
|
+
listed(join(root, versions))
|
|
57
|
+
.filter((name) => NODE_DIRECTORY.test(name))
|
|
58
|
+
.map((name) => ({ major: majorOf(name), path: join(root, versions, name, binary) }))
|
|
59
|
+
|
|
60
|
+
const findRuntime = () => {
|
|
61
|
+
if (majorOf(process.versions.node) >= RENDERER_MAJOR) return process.execPath
|
|
62
|
+
const found = SOURCES.flatMap(installsUnder)
|
|
63
|
+
.filter((install) => install.major >= RENDERER_MAJOR && existsSync(install.path))
|
|
64
|
+
.toSorted((a, b) => b.major - a.major)
|
|
65
|
+
return found[0]?.path
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const relaunch = () => {
|
|
69
|
+
const runtime = findRuntime()
|
|
70
|
+
if (runtime === undefined) {
|
|
71
|
+
process.stderr.write(`${MESSAGE}\n`)
|
|
72
|
+
process.exit(1)
|
|
73
|
+
}
|
|
74
|
+
const args = [...RENDERER_FLAGS, ENTRY, ...process.argv.slice(2)]
|
|
75
|
+
const run = spawnSync(runtime, args, { stdio: "inherit" })
|
|
76
|
+
process.exit(run.status ?? 1)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (drawsTerminal(process.argv.slice(2)) && !rendersHere()) relaunch()
|
|
80
|
+
else await import(ENTRY)
|