@eliya-oss/agent-diff 0.1.0-alpha.2 → 0.1.0-alpha.20
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/prd/README.md +2 -2
- package/CHANGELOG.md +124 -0
- package/README.md +23 -10
- package/bin/adiff.js +76 -2
- package/dist/main.js +2862 -407
- package/package.json +6 -4
- package/skills/adiff/SKILL.md +67 -18
package/.agents/prd/README.md
CHANGED
|
@@ -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
|
|
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
|
|
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,129 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Homebrew tracks each release.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.19
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- The house style lives in the linter, and a thread can be settled and folded from the terminal.
|
|
14
|
+
|
|
15
|
+
## 0.1.0-alpha.18
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- The cursor stops on a thread so it can be settled directly, and a settled thread folds to one row.
|
|
20
|
+
|
|
21
|
+
## 0.1.0-alpha.17
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Say when an agent answers, settle a thread with d, and hold the comments still while the code pans.
|
|
26
|
+
|
|
27
|
+
## 0.1.0-alpha.16
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- r reads the worktree list again, and notices reach the home screen.
|
|
32
|
+
|
|
33
|
+
## 0.1.0-alpha.15
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Pan the diff sideways to read past the right edge.
|
|
38
|
+
|
|
39
|
+
- The footer keeps the way out visible on a narrow terminal.
|
|
40
|
+
|
|
41
|
+
- Wrapping keeps every character and is remembered between sessions.
|
|
42
|
+
|
|
43
|
+
## 0.1.0-alpha.14
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 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.
|
|
48
|
+
|
|
49
|
+
- w wraps long lines in the diff, and the cursor gutter stops at the last line.
|
|
50
|
+
|
|
51
|
+
## 0.1.0-alpha.13
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- Reword or withdraw a staged comment, and see when a thread describes an older commit.
|
|
56
|
+
|
|
57
|
+
## 0.1.0-alpha.12
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- An agent can answer a comment, and a reviewer can settle the thread.
|
|
62
|
+
|
|
63
|
+
## 0.1.0-alpha.11
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- r reads the branch again, so the agent's newest work appears without leaving the review.
|
|
68
|
+
|
|
69
|
+
## 0.1.0-alpha.10
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- The rail shows a layer's prose block by block, each above the file it introduces.
|
|
74
|
+
|
|
75
|
+
- layers show says a stale layer set needs a new revision.
|
|
76
|
+
|
|
77
|
+
## 0.1.0-alpha.9
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- A seeded layer covers two files, so the demo shows what a layer spanning files looks like.
|
|
82
|
+
|
|
83
|
+
## 0.1.0-alpha.8
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- The simulator seeds layers, so a demo run shows them.
|
|
88
|
+
|
|
89
|
+
- The worktree list says whether a branch already has a pull request.
|
|
90
|
+
|
|
91
|
+
## 0.1.0-alpha.7
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- A layer's prose reads in the diff, above the code it introduces.
|
|
96
|
+
|
|
97
|
+
## 0.1.0-alpha.6
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- The diff holds still when a trackpad gesture drifts sideways.
|
|
102
|
+
|
|
103
|
+
- 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.
|
|
104
|
+
|
|
105
|
+
- A layer lists the files it covers, and the footer says how to switch between layers and files.
|
|
106
|
+
|
|
107
|
+
## 0.1.0-alpha.5
|
|
108
|
+
|
|
109
|
+
### Patch Changes
|
|
110
|
+
|
|
111
|
+
- 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.
|
|
112
|
+
|
|
113
|
+
- Scrolling with a trackpad settles as soon as your fingers stop.
|
|
114
|
+
|
|
115
|
+
## 0.1.0-alpha.4
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- Open the lines a diff leaves out one gap at a time with l, and put them away with h.
|
|
120
|
+
|
|
121
|
+
## 0.1.0-alpha.3
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- Commands run on Node 22 and up, and opening the terminal finds a Node 26 on your machine.
|
|
126
|
+
|
|
3
127
|
## 0.1.0-alpha.2
|
|
4
128
|
|
|
5
129
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -8,6 +8,10 @@ comment, and the agent picks it up.
|
|
|
8
8
|
|
|
9
9
|
<pre align="center">npm i -g @eliya-oss/agent-diff@alpha</pre>
|
|
10
10
|
|
|
11
|
+
<p align="center"><a href="docs/install.md">Other ways to install</a></p>
|
|
12
|
+
|
|
13
|
+
<img src="assets/terminal.webp" alt="The adiff worktree list, showing seven branches with their sizes, layers and review state" width="820">
|
|
14
|
+
|
|
11
15
|
</div>
|
|
12
16
|
|
|
13
17
|
## Usage
|
|
@@ -19,7 +23,7 @@ adiff comment add --repo . --branch add-teammate-invitations --file src/api
|
|
|
19
23
|
adiff comment stage --repo . --branch add-teammate-invitations --file src/api/invitations.ts --start 4 --end 5 --body "why"
|
|
20
24
|
adiff review submit --repo . --branch add-teammate-invitations
|
|
21
25
|
adiff file vouch --repo . --branch add-teammate-invitations --file src/api/invitations.ts
|
|
22
|
-
adiff
|
|
26
|
+
adiff layers show --worktree . --fields covered,total,uncovered
|
|
23
27
|
adiff describe
|
|
24
28
|
```
|
|
25
29
|
|
|
@@ -33,6 +37,10 @@ sends the whole set as one wake-up, so the agent reads a review rather than a st
|
|
|
33
37
|
a comment, `ctrl+s` sends it and `ctrl+a` adds it to the review instead. `m` marks a file reviewed,
|
|
34
38
|
`ctrl+p` finds any command by name, and the footer lists the keys for wherever you are.
|
|
35
39
|
|
|
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.
|
|
43
|
+
|
|
36
44
|
## The agent side
|
|
37
45
|
|
|
38
46
|
In the worktree being reviewed:
|
|
@@ -45,14 +53,14 @@ adiff comment take --worktree . --wait 300 # block until something arrives
|
|
|
45
53
|
Each comment carries the exact snippet it was written against, the side of the diff, and the commit
|
|
46
54
|
the diff was read at, so the agent needs no other reference. A comment is handed over once.
|
|
47
55
|
|
|
48
|
-
An agent can also record the reading order for its own work as a
|
|
49
|
-
files, set with `adiff
|
|
50
|
-
its
|
|
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
|
|
51
59
|
cannot hide code:
|
|
52
60
|
|
|
53
61
|
```bash
|
|
54
|
-
adiff
|
|
55
|
-
{"ok":true,"
|
|
62
|
+
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}]}}
|
|
56
64
|
```
|
|
57
65
|
|
|
58
66
|
## Skill
|
|
@@ -61,13 +69,18 @@ adiff story show --worktree . --fields covered,total,uncovered
|
|
|
61
69
|
npx skills add Newbie012/agent-diff --skill adiff
|
|
62
70
|
```
|
|
63
71
|
|
|
64
|
-
Teaches an agent the whole loop: collect comments, act on them, write the
|
|
72
|
+
Teaches an agent the whole loop: collect comments, act on them, write the layers.
|
|
65
73
|
|
|
66
74
|
## Requirements
|
|
67
75
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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.
|
|
78
|
+
|
|
79
|
+
The commands run on Node 22 or newer. The terminal is the one part that wants Node 26: it draws
|
|
80
|
+
through opentui, which reaches its native renderer over `node:ffi`, a module Node exposes behind
|
|
81
|
+
`--experimental-ffi` from 26 onward. When you open the terminal on an older Node, adiff looks for a
|
|
82
|
+
Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and runs the terminal on that, so a
|
|
83
|
+
global npm install keeps working across a version switch.
|
|
71
84
|
|
|
72
85
|
pnpm 12 is a Rust rewrite and still in beta, so
|
|
73
86
|
[corepack cannot install it](https://pnpm.io/installation):
|
package/bin/adiff.js
CHANGED
|
@@ -1,2 +1,76 @@
|
|
|
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 drawsTerminal = (argv) => {
|
|
31
|
+
const words = argv.filter((token) => !token.startsWith("--"))
|
|
32
|
+
return words[0] === "review" && words[1] === "open"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const rendersHere = () =>
|
|
36
|
+
typeof process.getBuiltinModule === "function" &&
|
|
37
|
+
process.getBuiltinModule("node:ffi") !== undefined
|
|
38
|
+
|
|
39
|
+
const NODE_DIRECTORY = /^(?:v?\d|node)/
|
|
40
|
+
|
|
41
|
+
const majorOf = (name) => Number(/\d+/.exec(name)?.[0] ?? Number.NaN)
|
|
42
|
+
|
|
43
|
+
const listed = (directory) => {
|
|
44
|
+
try {
|
|
45
|
+
return readdirSync(directory)
|
|
46
|
+
} catch {
|
|
47
|
+
return []
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const installsUnder = ([root, versions, binary]) =>
|
|
52
|
+
listed(join(root, versions))
|
|
53
|
+
.filter((name) => NODE_DIRECTORY.test(name))
|
|
54
|
+
.map((name) => ({ major: majorOf(name), path: join(root, versions, name, binary) }))
|
|
55
|
+
|
|
56
|
+
const findRuntime = () => {
|
|
57
|
+
if (majorOf(process.versions.node) >= RENDERER_MAJOR) return process.execPath
|
|
58
|
+
const found = SOURCES.flatMap(installsUnder)
|
|
59
|
+
.filter((install) => install.major >= RENDERER_MAJOR && existsSync(install.path))
|
|
60
|
+
.toSorted((a, b) => b.major - a.major)
|
|
61
|
+
return found[0]?.path
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const relaunch = () => {
|
|
65
|
+
const runtime = findRuntime()
|
|
66
|
+
if (runtime === undefined) {
|
|
67
|
+
process.stderr.write(`${MESSAGE}\n`)
|
|
68
|
+
process.exit(1)
|
|
69
|
+
}
|
|
70
|
+
const args = [...RENDERER_FLAGS, ENTRY, ...process.argv.slice(2)]
|
|
71
|
+
const run = spawnSync(runtime, args, { stdio: "inherit" })
|
|
72
|
+
process.exit(run.status ?? 1)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (drawsTerminal(process.argv.slice(2)) && !rendersHere()) relaunch()
|
|
76
|
+
else await import(ENTRY)
|