@eliya-oss/agent-diff 0.1.0-alpha.141 → 0.1.0-alpha.143
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/.claude/skills/create-pr/SKILL.md +25 -0
- package/.claude/skills/release-notes/SKILL.md +5 -2
- package/CHANGELOG.md +91 -0
- package/README.md +8 -22
- package/dist/main.js +159 -178
- package/package.json +1 -1
|
@@ -49,6 +49,31 @@ vitest directly. A test that does not still records; it just has no captions.
|
|
|
49
49
|
The recording is driven by the test's own trace, so it cannot show something the test does not do. If
|
|
50
50
|
a test fails, nothing is recorded — a green run is the precondition, not a claim to make in prose.
|
|
51
51
|
|
|
52
|
+
## A recording replays keys, and nothing else
|
|
53
|
+
|
|
54
|
+
The replay rebuilds the world from the trace — the branch fixture and the layers, and nothing more —
|
|
55
|
+
then presses the keys. Anything a test does by another route is not there: a file changed or
|
|
56
|
+
committed after the world was built, a comment or an answer seeded through the store or the command
|
|
57
|
+
line, a preference set from outside. A test that does any of those marks its trace unreplayable, and
|
|
58
|
+
`pnpm record` skips it and says which route it took.
|
|
59
|
+
|
|
60
|
+
So a test that needs one of those things has two honest endings, and no third:
|
|
61
|
+
|
|
62
|
+
- **Write it with keys instead**, if the same rule can be reached that way. A reviewer's reply
|
|
63
|
+
exercises the same drawing rule an agent's answer does, and a reply is keys. That test records.
|
|
64
|
+
- **Let it be skipped**, and say in the PR body which behavior has no film and why.
|
|
65
|
+
|
|
66
|
+
**Never paste a recording you have not looked at.** Take the still of the same trace and read it:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm shot --trace <trace.jsonl> --test-name "<when> > <then>" --keep
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The still is the last frame of the film. If it does not show the behavior the test names, the film
|
|
73
|
+
does not either — and a film that shows the wrong screen is worse than no film, because a reviewer
|
|
74
|
+
believes it. `pnpm record` writes its trace to a temp directory and prints the path in its error
|
|
75
|
+
output; to keep one, run the tests yourself with `ADIFF_TRACE=<path>` set.
|
|
76
|
+
|
|
52
77
|
## What gets recorded
|
|
53
78
|
|
|
54
79
|
Every test the branch adds, one recording each, not a representative sample. Skip only when the
|
|
@@ -151,8 +151,6 @@ tests, or how long it took you. Those belong in the PR.
|
|
|
151
151
|
### The template
|
|
152
152
|
|
|
153
153
|
```markdown
|
|
154
|
-
One paragraph. What this changes, and what prompted it. Two or three sentences.
|
|
155
|
-
|
|
156
154
|
## What changed
|
|
157
155
|
|
|
158
156
|
### Fixed
|
|
@@ -183,6 +181,11 @@ The repro. Then what the fix was.
|
|
|
183
181
|
|
|
184
182
|
- The **title** is the entry sentence without the `kind(area):` prefix, and follows the same
|
|
185
183
|
no-gerund rule.
|
|
184
|
+
- **Nothing comes before `## What changed`.** No opening paragraph, no framing, no "two things a
|
|
185
|
+
reviewer hits". The bullets say what changed; a reader who wants the story reads the section for
|
|
186
|
+
the one that bit them. The template's paragraph is for a PR with no change intent at all.
|
|
187
|
+
- **Every section is two or three sentences.** The repro, then what it does now. A reader deciding
|
|
188
|
+
whether this is their bug does not read a fourth sentence.
|
|
186
189
|
- **`## What changed` is generated, never typed.** `node scripts/pr-summary.ts` prints it from the
|
|
187
190
|
change intents on this branch. The PR and the changelog then cannot drift apart. Commit the
|
|
188
191
|
intent first — the summary is read from the diff against `origin/main`, so an uncommitted file
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.143
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(diff): a comment stays on its line when the agent edits that line by a few characters.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
A comment was placed by matching its snippet exactly, so making the small edit the comment asked for
|
|
12
|
+
took the comment off the diff along with the old wording. Asking for `seed: (driver, network)` to
|
|
13
|
+
become `seed: ({ driver, network })` cost the reviewer both the comment and the answer to it: the
|
|
14
|
+
thread was answered, but only the review panel showed it. A line that is nearly the same — at most
|
|
15
|
+
one character changed in four — now keeps the comment. A short line still has to match exactly, so
|
|
16
|
+
nothing lands on a stray brace, and code the agent genuinely replaced still goes to the panel.
|
|
17
|
+
|
|
18
|
+
</details>
|
|
19
|
+
|
|
20
|
+
- breaking(CLI): `adiff init` is gone, and the skill is installed with `npx skills add Newbie012/agent-diff --skill adiff`.
|
|
21
|
+
|
|
22
|
+
<details><summary>What changed</summary>
|
|
23
|
+
|
|
24
|
+
`init` wrote a passage into `AGENTS.md` and a `CLAUDE.md` importing it, kept between sentinels so it
|
|
25
|
+
could be found and replaced, and wrote the skill only if you also asked for it. Editing two files a
|
|
26
|
+
whole team shares bought nothing the skill does not already do — an agent finds a skill by its
|
|
27
|
+
description without being told to look — and a command whose whole job was fetching one file had to
|
|
28
|
+
be installed, learned and kept in step with the skills CLI's own.
|
|
29
|
+
|
|
30
|
+
Getting started is now installing adiff and installing the skill. adiff writes nothing into a
|
|
31
|
+
repository. If you ran the old `init`, the block between `<!-- adiff:begin -->` and
|
|
32
|
+
`<!-- adiff:end -->` in `AGENTS.md` and `CLAUDE.md` is yours to delete; nothing reads it any more.
|
|
33
|
+
`adiff skill refresh` still brings an installed skill up to the build running beside it.
|
|
34
|
+
|
|
35
|
+
</details>
|
|
36
|
+
|
|
37
|
+
- fix(diff): the terminal shows the diff against the base it was opened with.
|
|
38
|
+
|
|
39
|
+
<details><summary>What was wrong</summary>
|
|
40
|
+
|
|
41
|
+
`adiff review open --base <ref>` took the flag, validated it, and threw it away. The terminal always
|
|
42
|
+
read the branch against the base it would have guessed, so someone reviewing the one commit they had
|
|
43
|
+
just asked for got the whole stacked branch instead — 44 files where the base gave 1 — with nothing
|
|
44
|
+
on screen to say the base had been ignored. Every command that answers in JSON honoured it, which
|
|
45
|
+
made the terminal look right until you counted the files.
|
|
46
|
+
|
|
47
|
+
</details>
|
|
48
|
+
|
|
49
|
+
fix(diff): `review pane` carries a base into the pane it opens and the command it reports.
|
|
50
|
+
|
|
51
|
+
<details><summary>What was wrong</summary>
|
|
52
|
+
|
|
53
|
+
The same flag was dropped one function over, so a pane opened for an agent showed a different diff
|
|
54
|
+
from the one the agent was told to open, and the command in the answer could not be pasted to
|
|
55
|
+
reproduce it.
|
|
56
|
+
|
|
57
|
+
</details>
|
|
58
|
+
|
|
59
|
+
## 0.1.0-alpha.142
|
|
60
|
+
|
|
61
|
+
### Patch Changes
|
|
62
|
+
|
|
63
|
+
- fix(diff): a comment moves to wherever its code went when the agent edits the file above it.
|
|
64
|
+
|
|
65
|
+
<details><summary>What was wrong</summary>
|
|
66
|
+
|
|
67
|
+
A comment was drawn at the line number it was written at. When the agent added or removed lines
|
|
68
|
+
above that code, every comment in the file stayed on its old number and pointed at whatever had
|
|
69
|
+
moved into it. A comment carries the exact snippet it was written against, and that is now what
|
|
70
|
+
places it.
|
|
71
|
+
|
|
72
|
+
</details>
|
|
73
|
+
|
|
74
|
+
fix(diff): a comment whose code the agent rewrote is not drawn against the line that took its place.
|
|
75
|
+
|
|
76
|
+
<details><summary>What was wrong</summary>
|
|
77
|
+
|
|
78
|
+
When the code a comment was about was changed rather than moved, there was nothing to move the
|
|
79
|
+
comment to, and it stayed on its old line — reading as a remark about code it was never about. Such
|
|
80
|
+
a thread is now left off the diff and kept in the review panel, which says it is not in the diff.
|
|
81
|
+
|
|
82
|
+
</details>
|
|
83
|
+
|
|
84
|
+
fix(diff): an answer with more than one line keeps its lines.
|
|
85
|
+
|
|
86
|
+
<details><summary>What was wrong</summary>
|
|
87
|
+
|
|
88
|
+
An agent's answer and a reviewer's reply were flattened to a single paragraph, so a bulleted answer
|
|
89
|
+
read as one run-on sentence. The reviewer's own comment kept its breaks, so the two sides of a
|
|
90
|
+
thread were drawn by different rules.
|
|
91
|
+
|
|
92
|
+
</details>
|
|
93
|
+
|
|
3
94
|
## 0.1.0-alpha.141
|
|
4
95
|
|
|
5
96
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -6,44 +6,30 @@ An agent finishes a piece of work and leaves you a diff. adiff puts the conversa
|
|
|
6
6
|
you comment on the lines in a terminal, the agent that wrote them answers under your words, and a
|
|
7
7
|
point stays open until you settle it.
|
|
8
8
|
|
|
9
|
-
<pre align="center">brew install Newbie012/tap/adiff</pre>
|
|
10
|
-
|
|
11
|
-
<p align="center"><a href="docs/install.md">Other ways to install</a></p>
|
|
12
|
-
|
|
13
9
|
<img src="assets/terminal.webp" alt="The adiff worktree list, showing seven branches with their sizes, layers and review state" width="820">
|
|
14
10
|
|
|
15
11
|
</div>
|
|
16
12
|
|
|
17
13
|
## Getting started
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
Two commands. The first installs adiff, the second installs the skill that teaches your agent to
|
|
16
|
+
pick up your comments:
|
|
20
17
|
|
|
21
18
|
```bash
|
|
22
19
|
brew install Newbie012/tap/adiff
|
|
23
|
-
|
|
20
|
+
npx skills add Newbie012/agent-diff --skill adiff
|
|
24
21
|
```
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
[Other ways to install](docs/install.md), if you would rather not use Homebrew. adiff writes nothing
|
|
24
|
+
into your repository — no `AGENTS.md`, no `CLAUDE.md`. Your agent finds the skill on its own.
|
|
25
|
+
|
|
26
|
+
Then ask it to walk you through it:
|
|
28
27
|
|
|
29
28
|
> Read the adiff skill and onboard me: hand your current work over for review, and tell me what to
|
|
30
29
|
> press.
|
|
31
30
|
|
|
32
31
|
From then on the loop is: the agent hands work over, you read it, and it answers what you wrote.
|
|
33
|
-
|
|
34
|
-
## Reviewing
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
adiff review open --repo .
|
|
38
|
-
```
|
|
39
|
-
|
|
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.
|
|
44
|
-
|
|
45
|
-
`,` opens the preferences and turns any of it on or off. Turn on holding and a comment waits with
|
|
46
|
-
the others until `C` sends them to the agent as one review.
|
|
32
|
+
Open a review yourself with `adiff review open --repo .`, and press `?` for every key.
|
|
47
33
|
|
|
48
34
|
## For agents
|
|
49
35
|
|
package/dist/main.js
CHANGED
|
@@ -8819,7 +8819,7 @@ var init_error$3 = __esmMin((() => {
|
|
|
8819
8819
|
}));
|
|
8820
8820
|
//#endregion
|
|
8821
8821
|
//#region src/service/forge/service.ts
|
|
8822
|
-
var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, review, ForgeLive;
|
|
8822
|
+
var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$1, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, review, ForgeLive;
|
|
8823
8823
|
var init_service$2 = __esmMin((() => {
|
|
8824
8824
|
init_dist();
|
|
8825
8825
|
init_error$3();
|
|
@@ -8940,7 +8940,7 @@ var init_service$2 = __esmMin((() => {
|
|
|
8940
8940
|
if (input !== void 0) child.stdin?.end(input);
|
|
8941
8941
|
return ended(child);
|
|
8942
8942
|
});
|
|
8943
|
-
named = fn("Forge.named")(function* (repo, branch) {
|
|
8943
|
+
named$1 = fn("Forge.named")(function* (repo, branch) {
|
|
8944
8944
|
const raw = yield* gh(repo, [
|
|
8945
8945
|
"pr",
|
|
8946
8946
|
"view",
|
|
@@ -8961,7 +8961,7 @@ var init_service$2 = __esmMin((() => {
|
|
|
8961
8961
|
}));
|
|
8962
8962
|
});
|
|
8963
8963
|
head = fn("Forge.head")(function* (repo, branch) {
|
|
8964
|
-
return (yield* named(repo, branch)).headRefOid;
|
|
8964
|
+
return (yield* named$1(repo, branch)).headRefOid;
|
|
8965
8965
|
});
|
|
8966
8966
|
sideName = (side) => side === "old" ? "LEFT" : "RIGHT";
|
|
8967
8967
|
commentBody = (one) => ({
|
|
@@ -9006,7 +9006,7 @@ var init_service$2 = __esmMin((() => {
|
|
|
9006
9006
|
});
|
|
9007
9007
|
};
|
|
9008
9008
|
review = fn("Forge.review")(function* (repo, branch, comments) {
|
|
9009
|
-
const pull = yield* named(repo, branch);
|
|
9009
|
+
const pull = yield* named$1(repo, branch);
|
|
9010
9010
|
const route = `repos/${(yield* gh(repo, [
|
|
9011
9011
|
"repo",
|
|
9012
9012
|
"view",
|
|
@@ -9592,7 +9592,7 @@ var init_model$3 = __esmMin((() => {
|
|
|
9592
9592
|
}));
|
|
9593
9593
|
//#endregion
|
|
9594
9594
|
//#region src/domain/patch/anchor.ts
|
|
9595
|
-
var sideOf, linesOn, anchorFor, rowsForRange;
|
|
9595
|
+
var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundAgain;
|
|
9596
9596
|
var init_anchor = __esmMin((() => {
|
|
9597
9597
|
init_dist();
|
|
9598
9598
|
init_model$3();
|
|
@@ -9628,6 +9628,57 @@ var init_anchor = __esmMin((() => {
|
|
|
9628
9628
|
if (first === void 0 || last === void 0) return none();
|
|
9629
9629
|
return some([first.index, last.index]);
|
|
9630
9630
|
};
|
|
9631
|
+
sideLines = (patch, side) => patch.rows.flatMap((row) => match$3(lineOn(row, side), {
|
|
9632
|
+
onNone: () => [],
|
|
9633
|
+
onSome: (line) => [{
|
|
9634
|
+
line,
|
|
9635
|
+
text: row.text
|
|
9636
|
+
}]
|
|
9637
|
+
}));
|
|
9638
|
+
runsAt = (lines, wanted, at) => wanted.every((text, step) => {
|
|
9639
|
+
const here = lines[at + step];
|
|
9640
|
+
return here !== void 0 && here.text === text && here.line === (lines[at]?.line ?? 0) + step;
|
|
9641
|
+
});
|
|
9642
|
+
nearestRun = (lines, said, near) => lines.flatMap((here, at) => runsAt(lines, said, at) ? [here.line] : []).toSorted((one, other) => Math.abs(one - near) - Math.abs(other - near))[0];
|
|
9643
|
+
SHORTEST_NEAR = 8;
|
|
9644
|
+
PER_EDIT = 4;
|
|
9645
|
+
edits = (one, other) => {
|
|
9646
|
+
let row = Array.from({ length: other.length + 1 }, (_, at) => at);
|
|
9647
|
+
for (let step = 1; step <= one.length; step += 1) {
|
|
9648
|
+
const next = [step];
|
|
9649
|
+
for (let at = 1; at <= other.length; at += 1) {
|
|
9650
|
+
const swap = (row[at - 1] ?? 0) + (one[step - 1] === other[at - 1] ? 0 : 1);
|
|
9651
|
+
next.push(Math.min(swap, (row[at] ?? 0) + 1, (next[at - 1] ?? 0) + 1));
|
|
9652
|
+
}
|
|
9653
|
+
row = next;
|
|
9654
|
+
}
|
|
9655
|
+
return row[other.length] ?? 0;
|
|
9656
|
+
};
|
|
9657
|
+
isNear = (one, other) => {
|
|
9658
|
+
const room = Math.max(one.trim().length, other.trim().length);
|
|
9659
|
+
return room >= SHORTEST_NEAR && edits(one, other) <= Math.floor(room / PER_EDIT);
|
|
9660
|
+
};
|
|
9661
|
+
nearestLike = (lines, said, near) => lines.filter((here) => isNear(here.text, said)).toSorted((one, other) => Math.abs(one.line - near) - Math.abs(other.line - near))[0]?.line;
|
|
9662
|
+
foundAgain = (patch, wanted) => {
|
|
9663
|
+
const said = wanted.snippet.split("\n");
|
|
9664
|
+
if (said.every((text) => text.trim().length === 0)) return none();
|
|
9665
|
+
const lines = sideLines(patch, wanted.side);
|
|
9666
|
+
const whole = nearestRun(lines, said, wanted.start);
|
|
9667
|
+
if (whole !== void 0) return some({
|
|
9668
|
+
side: wanted.side,
|
|
9669
|
+
start: whole,
|
|
9670
|
+
end: whole + said.length - 1
|
|
9671
|
+
});
|
|
9672
|
+
const first = said[0] ?? "";
|
|
9673
|
+
if (first.trim().length === 0) return none();
|
|
9674
|
+
const alike = (said.length === 1 ? void 0 : nearestRun(lines, [first], wanted.start)) ?? nearestLike(lines, first, wanted.start);
|
|
9675
|
+
if (alike === void 0) return none();
|
|
9676
|
+
return some({
|
|
9677
|
+
side: wanted.side,
|
|
9678
|
+
start: alike,
|
|
9679
|
+
end: alike
|
|
9680
|
+
});
|
|
9681
|
+
};
|
|
9631
9682
|
}));
|
|
9632
9683
|
//#endregion
|
|
9633
9684
|
//#region src/domain/patch/parse.ts
|
|
@@ -10243,7 +10294,7 @@ var init_error = __esmMin((() => {
|
|
|
10243
10294
|
}));
|
|
10244
10295
|
//#endregion
|
|
10245
10296
|
//#region src/cli/commands.ts
|
|
10246
|
-
var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
|
|
10297
|
+
var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$1, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, setBase, clearBase, markRead;
|
|
10247
10298
|
var init_commands = __esmMin((() => {
|
|
10248
10299
|
init_dist();
|
|
10249
10300
|
init_patch();
|
|
@@ -10462,7 +10513,7 @@ var init_commands = __esmMin((() => {
|
|
|
10462
10513
|
settled: Object.hasOwn(settled, comment.id),
|
|
10463
10514
|
removed: Object.hasOwn(removed, comment.id),
|
|
10464
10515
|
stale: comment.head !== head,
|
|
10465
|
-
outside: !shown.has(comment.file),
|
|
10516
|
+
outside: !shown.has(comment.file) || comment.placed === false,
|
|
10466
10517
|
unread: Math.max(0, said.length - seen),
|
|
10467
10518
|
asks: last?.voice === "agent" && last.asks,
|
|
10468
10519
|
...takenAt === void 0 ? {} : { takenAt },
|
|
@@ -10473,13 +10524,36 @@ var init_commands = __esmMin((() => {
|
|
|
10473
10524
|
}))
|
|
10474
10525
|
};
|
|
10475
10526
|
};
|
|
10527
|
+
whereItSitsNow$1 = (patches, comment) => {
|
|
10528
|
+
const patch = patches.find((candidate) => candidate.path === comment.file);
|
|
10529
|
+
if (patch === void 0) return {
|
|
10530
|
+
...comment,
|
|
10531
|
+
placed: false
|
|
10532
|
+
};
|
|
10533
|
+
if (comment.snippet.trim().length === 0) return {
|
|
10534
|
+
...comment,
|
|
10535
|
+
placed: true
|
|
10536
|
+
};
|
|
10537
|
+
return match$3(foundAgain(patch, comment), {
|
|
10538
|
+
onNone: () => ({
|
|
10539
|
+
...comment,
|
|
10540
|
+
placed: false
|
|
10541
|
+
}),
|
|
10542
|
+
onSome: (range) => ({
|
|
10543
|
+
...comment,
|
|
10544
|
+
start: range.start,
|
|
10545
|
+
end: range.end,
|
|
10546
|
+
placed: true
|
|
10547
|
+
})
|
|
10548
|
+
});
|
|
10549
|
+
};
|
|
10476
10550
|
sentIn = fn("Cli.sentIn")(function* (reading) {
|
|
10477
10551
|
const store = yield* Store;
|
|
10478
10552
|
const worktree = reading.worktree;
|
|
10479
10553
|
const spoken = yield* store.answers(worktree.path);
|
|
10480
10554
|
const current = yield* store.state(worktree.path);
|
|
10481
10555
|
const shown = new Set(reading.patches.map((patch) => patch.path));
|
|
10482
|
-
const held = flatten(yield* store.inbox(worktree.path));
|
|
10556
|
+
const held = flatten(yield* store.inbox(worktree.path)).map((comment) => whereItSitsNow$1(reading.patches, comment));
|
|
10483
10557
|
const replies = held.filter((comment) => comment.replyTo !== void 0);
|
|
10484
10558
|
const conversation = {
|
|
10485
10559
|
spoken,
|
|
@@ -10862,58 +10936,12 @@ var init_drafts = __esmMin((() => {
|
|
|
10862
10936
|
});
|
|
10863
10937
|
}));
|
|
10864
10938
|
//#endregion
|
|
10865
|
-
//#region src/cli/
|
|
10866
|
-
var
|
|
10867
|
-
var
|
|
10939
|
+
//#region src/cli/skill.ts
|
|
10940
|
+
var REACH, readAt, writeAt, skillSource, shippedSkill, SKILL_AT, refreshAt, settledRoot, refreshSkill;
|
|
10941
|
+
var init_skill = __esmMin((() => {
|
|
10868
10942
|
init_dist();
|
|
10869
10943
|
init_error();
|
|
10870
|
-
BEGIN = "<!-- adiff:begin -->";
|
|
10871
|
-
END = "<!-- adiff:end -->";
|
|
10872
10944
|
REACH = 5;
|
|
10873
|
-
INSTRUCTIONS = [
|
|
10874
|
-
BEGIN,
|
|
10875
|
-
"## Review",
|
|
10876
|
-
"",
|
|
10877
|
-
"Review of work in this repository happens in adiff. Before you say you are done, run",
|
|
10878
|
-
"`adiff comment take --worktree . --wait 300` in the background and handle what arrives.",
|
|
10879
|
-
"Answer a comment with `adiff comment answer --worktree . --id <id> --body <text>`.",
|
|
10880
|
-
"When you hand work over, say it is ready and name the command that opens the review:",
|
|
10881
|
-
"`adiff review open --repo <repo>`, or `adiff review pane --repo <repo>` to open it alongside.",
|
|
10882
|
-
"Publish a reading order with `adiff layers set` only when you are asked for one.",
|
|
10883
|
-
"`adiff --help` lists the rest, and `adiff describe` answers the same as JSON.",
|
|
10884
|
-
END
|
|
10885
|
-
].join("\n");
|
|
10886
|
-
IMPORT = [
|
|
10887
|
-
BEGIN,
|
|
10888
|
-
"@AGENTS.md",
|
|
10889
|
-
END
|
|
10890
|
-
].join("\n");
|
|
10891
|
-
blockIn = (text) => {
|
|
10892
|
-
const opens = text.indexOf(BEGIN);
|
|
10893
|
-
const closes = text.indexOf(END, opens);
|
|
10894
|
-
return opens === -1 || closes === -1 ? none() : some(text.slice(opens, closes + 18));
|
|
10895
|
-
};
|
|
10896
|
-
replaced = (text, block, wanted) => text.replace(block, wanted);
|
|
10897
|
-
appended = (text, wanted) => text.endsWith("\n") ? `${text}\n${wanted}\n` : `${text}\n\n${wanted}\n`;
|
|
10898
|
-
planFor = (current, wanted) => {
|
|
10899
|
-
const text = getOrUndefined$1(current);
|
|
10900
|
-
if (text === void 0) return {
|
|
10901
|
-
action: "create",
|
|
10902
|
-
next: `${wanted}\n`
|
|
10903
|
-
};
|
|
10904
|
-
const found = blockIn(text);
|
|
10905
|
-
if (isNone(found)) return {
|
|
10906
|
-
action: "append",
|
|
10907
|
-
next: appended(text, wanted)
|
|
10908
|
-
};
|
|
10909
|
-
return found.value === wanted ? {
|
|
10910
|
-
action: "unchanged",
|
|
10911
|
-
next: text
|
|
10912
|
-
} : {
|
|
10913
|
-
action: "update",
|
|
10914
|
-
next: replaced(text, found.value, wanted)
|
|
10915
|
-
};
|
|
10916
|
-
};
|
|
10917
10945
|
readAt = fn("Cli.readAt")(function* (path) {
|
|
10918
10946
|
return yield* tryPromise({
|
|
10919
10947
|
try: () => readFile(path, "utf8"),
|
|
@@ -10932,16 +10960,6 @@ var init_init = __esmMin((() => {
|
|
|
10932
10960
|
})
|
|
10933
10961
|
});
|
|
10934
10962
|
});
|
|
10935
|
-
settle = fn("Cli.settle")(function* (root, name, wanted, write) {
|
|
10936
|
-
const path = join(root, name);
|
|
10937
|
-
const current = yield* readAt(path);
|
|
10938
|
-
const plan = planFor(current, wanted);
|
|
10939
|
-
if (write && plan.action !== "unchanged") yield* writeAt(path, plan.next);
|
|
10940
|
-
return {
|
|
10941
|
-
path: name,
|
|
10942
|
-
action: plan.action
|
|
10943
|
-
};
|
|
10944
|
-
});
|
|
10945
10963
|
skillSource = () => {
|
|
10946
10964
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
10947
10965
|
return Array.from({ length: REACH }, (_, layer) => join(here, ...Array(layer).fill(".."))).map((at) => join(at, "skills", "adiff", "SKILL.md")).find((path) => existsSync(path));
|
|
@@ -10953,20 +10971,6 @@ var init_init = __esmMin((() => {
|
|
|
10953
10971
|
reason: "not found beside this build"
|
|
10954
10972
|
}) : sync(() => readFileSync(source, "utf8"));
|
|
10955
10973
|
});
|
|
10956
|
-
settleSkill = fn("Cli.settleSkill")(function* (root, write) {
|
|
10957
|
-
const name = join(".claude", "skills", "adiff", "SKILL.md");
|
|
10958
|
-
const wanted = yield* shippedSkill();
|
|
10959
|
-
const current = yield* readAt(join(root, name));
|
|
10960
|
-
const action = match$3(current, {
|
|
10961
|
-
onNone: () => "create",
|
|
10962
|
-
onSome: (text) => text === wanted ? "unchanged" : "update"
|
|
10963
|
-
});
|
|
10964
|
-
if (write && action !== "unchanged") yield* writeAt(join(root, name), wanted);
|
|
10965
|
-
return {
|
|
10966
|
-
path: name,
|
|
10967
|
-
action
|
|
10968
|
-
};
|
|
10969
|
-
});
|
|
10970
10974
|
SKILL_AT = join(".claude", "skills", "adiff", "SKILL.md");
|
|
10971
10975
|
refreshAt = fn("Cli.refreshAt")(function* (root, wanted) {
|
|
10972
10976
|
const path = join(root, SKILL_AT);
|
|
@@ -10996,23 +11000,10 @@ var init_init = __esmMin((() => {
|
|
|
10996
11000
|
for (const root of seen) found.push(...yield* refreshAt(root, wanted));
|
|
10997
11001
|
return { changes: found };
|
|
10998
11002
|
});
|
|
10999
|
-
initRepository = fn("Cli.initRepository")(function* (request) {
|
|
11000
|
-
const instructions = yield* settle(request.repo, "AGENTS.md", INSTRUCTIONS, request.write);
|
|
11001
|
-
const memory = yield* settle(request.repo, "CLAUDE.md", IMPORT, request.write);
|
|
11002
|
-
const skill = request.skill ? [yield* settleSkill(request.repo, request.write)] : [];
|
|
11003
|
-
return {
|
|
11004
|
-
wrote: request.write,
|
|
11005
|
-
changes: [
|
|
11006
|
-
instructions,
|
|
11007
|
-
memory,
|
|
11008
|
-
...skill
|
|
11009
|
-
]
|
|
11010
|
-
};
|
|
11011
|
-
});
|
|
11012
11003
|
}));
|
|
11013
11004
|
//#endregion
|
|
11014
11005
|
//#region src/cli/pane.ts
|
|
11015
|
-
var TIMEOUT_MS, set, splitters,
|
|
11006
|
+
var TIMEOUT_MS, set, splitters, named, selfInvocation, ran, split, openPane;
|
|
11016
11007
|
var init_pane = __esmMin((() => {
|
|
11017
11008
|
init_dist();
|
|
11018
11009
|
TIMEOUT_MS = 5e3;
|
|
@@ -11073,8 +11064,8 @@ var init_pane = __esmMin((() => {
|
|
|
11073
11064
|
]
|
|
11074
11065
|
}
|
|
11075
11066
|
];
|
|
11076
|
-
|
|
11077
|
-
selfInvocation = (repo, branch) => {
|
|
11067
|
+
named = (option, value) => value === void 0 ? [] : [`--${option}`, value];
|
|
11068
|
+
selfInvocation = (repo, branch, base) => {
|
|
11078
11069
|
const entry = process.argv[1];
|
|
11079
11070
|
return [
|
|
11080
11071
|
...entry === void 0 ? ["adiff"] : [
|
|
@@ -11086,18 +11077,20 @@ var init_pane = __esmMin((() => {
|
|
|
11086
11077
|
"open",
|
|
11087
11078
|
"--repo",
|
|
11088
11079
|
repo,
|
|
11089
|
-
...
|
|
11080
|
+
...named("branch", branch),
|
|
11081
|
+
...named("base", base)
|
|
11090
11082
|
];
|
|
11091
11083
|
};
|
|
11092
11084
|
ran = (binary, args) => callback$1((resume) => {
|
|
11093
11085
|
const child = execFile(binary, [...args], { timeout: TIMEOUT_MS }, (cause) => resume(succeed$1(cause === null)));
|
|
11094
11086
|
return sync(() => void child.kill());
|
|
11095
11087
|
});
|
|
11096
|
-
split = fn("Cli.split")(function* (chosen, repo, branch) {
|
|
11097
|
-
return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch)));
|
|
11088
|
+
split = fn("Cli.split")(function* (chosen, repo, branch, base) {
|
|
11089
|
+
return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch, base)));
|
|
11098
11090
|
});
|
|
11099
|
-
openPane = fn("Cli.openPane")(function* (repo, branch) {
|
|
11100
|
-
const
|
|
11091
|
+
openPane = fn("Cli.openPane")(function* (repo, branch, base) {
|
|
11092
|
+
const said = [...named("branch", branch), ...named("base", base)].join(" ");
|
|
11093
|
+
const command = `adiff review open --repo ${repo}${said.length === 0 ? "" : ` ${said}`}`;
|
|
11101
11094
|
const chosen = splitters.find((candidate) => candidate.present());
|
|
11102
11095
|
if (chosen === void 0) return {
|
|
11103
11096
|
opened: false,
|
|
@@ -11105,7 +11098,7 @@ var init_pane = __esmMin((() => {
|
|
|
11105
11098
|
command
|
|
11106
11099
|
};
|
|
11107
11100
|
return {
|
|
11108
|
-
opened: yield* split(chosen, repo, branch),
|
|
11101
|
+
opened: yield* split(chosen, repo, branch, base),
|
|
11109
11102
|
pane: chosen.pane,
|
|
11110
11103
|
command
|
|
11111
11104
|
};
|
|
@@ -11114,9 +11107,9 @@ var init_pane = __esmMin((() => {
|
|
|
11114
11107
|
//#endregion
|
|
11115
11108
|
//#region package.json
|
|
11116
11109
|
init_drafts();
|
|
11117
|
-
|
|
11110
|
+
init_skill();
|
|
11118
11111
|
init_pane();
|
|
11119
|
-
var version$1 = "0.1.0-alpha.
|
|
11112
|
+
var version$1 = "0.1.0-alpha.143";
|
|
11120
11113
|
//#endregion
|
|
11121
11114
|
//#region src/cli/upgrade.ts
|
|
11122
11115
|
var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
|
|
@@ -11738,9 +11731,10 @@ var init_layers = __esmMin((() => {
|
|
|
11738
11731
|
}));
|
|
11739
11732
|
//#endregion
|
|
11740
11733
|
//#region src/cli/threads.ts
|
|
11741
|
-
var stateOf, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without, restoreIn, restoreComment, settleRead;
|
|
11734
|
+
var stateOf, whereItSitsNow, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without, restoreIn, restoreComment, settleRead;
|
|
11742
11735
|
var init_threads = __esmMin((() => {
|
|
11743
11736
|
init_dist();
|
|
11737
|
+
init_patch();
|
|
11744
11738
|
init_store();
|
|
11745
11739
|
init_commands();
|
|
11746
11740
|
init_layers();
|
|
@@ -11752,6 +11746,27 @@ var init_threads = __esmMin((() => {
|
|
|
11752
11746
|
if (last === void 0 || last.voice === "reviewer") return "sent";
|
|
11753
11747
|
return asked ? "question" : "answered";
|
|
11754
11748
|
};
|
|
11749
|
+
whereItSitsNow = (patches, anchor) => {
|
|
11750
|
+
const patch = patches.find((candidate) => candidate.path === anchor.path);
|
|
11751
|
+
if (patch === void 0) return {
|
|
11752
|
+
...anchor,
|
|
11753
|
+
placed: false
|
|
11754
|
+
};
|
|
11755
|
+
if (anchor.snippet.trim().length === 0) return {
|
|
11756
|
+
...anchor,
|
|
11757
|
+
placed: true
|
|
11758
|
+
};
|
|
11759
|
+
return match$3(foundAgain(patch, anchor), {
|
|
11760
|
+
onNone: () => ({
|
|
11761
|
+
...anchor,
|
|
11762
|
+
placed: false
|
|
11763
|
+
}),
|
|
11764
|
+
onSome: (range) => ({
|
|
11765
|
+
...range,
|
|
11766
|
+
placed: true
|
|
11767
|
+
})
|
|
11768
|
+
});
|
|
11769
|
+
};
|
|
11755
11770
|
spoken$1 = (entry) => ({
|
|
11756
11771
|
body: entry.body,
|
|
11757
11772
|
at: entry.at,
|
|
@@ -11773,16 +11788,17 @@ var init_threads = __esmMin((() => {
|
|
|
11773
11788
|
const seen = [...ids].reduce((total, id) => total + (reading.read[id] ?? 0), 0);
|
|
11774
11789
|
const turns = turnsOf(replies, mine);
|
|
11775
11790
|
const settled = Object.hasOwn(reading.settled, comment.id);
|
|
11791
|
+
const sits = whereItSitsNow(reading.patches, comment.anchor);
|
|
11776
11792
|
return {
|
|
11777
11793
|
id: comment.id,
|
|
11778
11794
|
file: comment.anchor.path,
|
|
11779
11795
|
side: comment.anchor.side,
|
|
11780
|
-
start:
|
|
11781
|
-
end:
|
|
11796
|
+
start: sits.start,
|
|
11797
|
+
end: sits.end,
|
|
11782
11798
|
body: comment.body,
|
|
11783
11799
|
state: stateOf(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(reading.removed, comment.id)),
|
|
11784
11800
|
stale: batch.head !== reading.head,
|
|
11785
|
-
outside: !reading.shown.has(comment.anchor.path),
|
|
11801
|
+
outside: !reading.shown.has(comment.anchor.path) || !sits.placed,
|
|
11786
11802
|
unread: Math.max(0, mine.length - seen),
|
|
11787
11803
|
answers: mine.map(spoken$1),
|
|
11788
11804
|
turns,
|
|
@@ -11807,12 +11823,14 @@ var init_threads = __esmMin((() => {
|
|
|
11807
11823
|
const store = yield* Store;
|
|
11808
11824
|
const worktree = yield* findBranch(repo, branch, base);
|
|
11809
11825
|
const current = yield* store.state(worktree.path);
|
|
11826
|
+
const patches = yield* patchesOf(worktree);
|
|
11810
11827
|
return threadsIn(yield* store.inbox(worktree.path), {
|
|
11811
11828
|
answers: yield* store.answers(worktree.path),
|
|
11812
11829
|
settled: current.settled,
|
|
11813
11830
|
removed: current.removed,
|
|
11814
11831
|
head: worktree.head,
|
|
11815
|
-
shown: new Set(
|
|
11832
|
+
shown: new Set(patches.map((patch) => patch.path)),
|
|
11833
|
+
patches,
|
|
11816
11834
|
read: current.read
|
|
11817
11835
|
});
|
|
11818
11836
|
});
|
|
@@ -12365,35 +12383,6 @@ var init_catalog = __esmMin((() => {
|
|
|
12365
12383
|
dataKey: "preference",
|
|
12366
12384
|
example: "adiff config set --name hold --value on"
|
|
12367
12385
|
},
|
|
12368
|
-
{
|
|
12369
|
-
name: "init",
|
|
12370
|
-
about: "Write the review loop into this repository's agent instructions, so an agent finds it unprompted",
|
|
12371
|
-
group: SET_UP,
|
|
12372
|
-
addresses: "repo",
|
|
12373
|
-
safety: "write",
|
|
12374
|
-
options: [
|
|
12375
|
-
{
|
|
12376
|
-
name: "repo",
|
|
12377
|
-
required: true,
|
|
12378
|
-
value: "path",
|
|
12379
|
-
about: "Repository to write the loop into"
|
|
12380
|
-
},
|
|
12381
|
-
{
|
|
12382
|
-
name: "write",
|
|
12383
|
-
required: false,
|
|
12384
|
-
value: "flag",
|
|
12385
|
-
about: "Make the changes. Without it, init reports what each file would become"
|
|
12386
|
-
},
|
|
12387
|
-
{
|
|
12388
|
-
name: "skill",
|
|
12389
|
-
required: false,
|
|
12390
|
-
value: "flag",
|
|
12391
|
-
about: "Also commit the adiff skill at .claude/skills/adiff/SKILL.md"
|
|
12392
|
-
}
|
|
12393
|
-
],
|
|
12394
|
-
dataKey: "changes",
|
|
12395
|
-
example: "adiff init --repo . --write"
|
|
12396
|
-
},
|
|
12397
12386
|
{
|
|
12398
12387
|
name: "skill refresh",
|
|
12399
12388
|
about: "Rewrite the adiff skill wherever it is already installed, in this directory and in your home directory. Installs nothing that is not already there",
|
|
@@ -12709,7 +12698,7 @@ var init_report$1 = __esmMin((() => {
|
|
|
12709
12698
|
},
|
|
12710
12699
|
InitUnwritable: {
|
|
12711
12700
|
exit: 1,
|
|
12712
|
-
suggestion: "adiff
|
|
12701
|
+
suggestion: "adiff could not write the skill. Check that .claude/skills/adiff/ is somewhere you can write to.",
|
|
12713
12702
|
retriable: false
|
|
12714
12703
|
},
|
|
12715
12704
|
UnselectableRange: {
|
|
@@ -13566,7 +13555,7 @@ var init_model = __esmMin((() => {
|
|
|
13566
13555
|
const patch = selectedPatch(state);
|
|
13567
13556
|
const found = /* @__PURE__ */ new Map();
|
|
13568
13557
|
if (patch === void 0) return found;
|
|
13569
|
-
const here = state.sent.filter((entry) => entry.file === patch.path && entry.removed !== true);
|
|
13558
|
+
const here = state.sent.filter((entry) => entry.file === patch.path && entry.removed !== true && entry.outside !== true);
|
|
13570
13559
|
for (const entry of here) {
|
|
13571
13560
|
const stand = threadStand(entry);
|
|
13572
13561
|
for (const row of rowsUnder(patch, entry)) found.set(row, louder(stand, found.get(row) ?? "gone"));
|
|
@@ -13733,14 +13722,14 @@ var init_model = __esmMin((() => {
|
|
|
13733
13722
|
commentRowsIn = (state, fileIndex) => {
|
|
13734
13723
|
const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
|
|
13735
13724
|
if (patch === void 0) return [];
|
|
13736
|
-
const notes = state.sent.filter((entry) => entry.file === patch.path);
|
|
13725
|
+
const notes = state.sent.filter((entry) => entry.file === patch.path && entry.outside !== true);
|
|
13737
13726
|
return patch.rows.filter((row) => notes.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index).toSorted((left, right) => left - right);
|
|
13738
13727
|
};
|
|
13739
13728
|
threadsAtRow = (state, row) => {
|
|
13740
13729
|
const patch = selectedPatch(state);
|
|
13741
13730
|
const here = patch?.rows[row];
|
|
13742
13731
|
if (patch === void 0 || here === void 0) return [];
|
|
13743
|
-
return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && lineOnSide(here, entry.side) === entry.end);
|
|
13732
|
+
return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && entry.outside !== true && lineOnSide(here, entry.side) === entry.end);
|
|
13744
13733
|
};
|
|
13745
13734
|
stopsAtRow = (state, row) => 1 + threadsAtRow(state, row).length;
|
|
13746
13735
|
threadHere = (state) => threadChosen(state) ?? threadAtStop(state) ?? threadAtRow(state, state.cursor);
|
|
@@ -13749,12 +13738,12 @@ var init_model = __esmMin((() => {
|
|
|
13749
13738
|
const patch = selectedPatch(state);
|
|
13750
13739
|
const here = patch?.rows[row];
|
|
13751
13740
|
if (patch === void 0 || here === void 0) return void 0;
|
|
13752
|
-
return state.sent.find((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && lineOnSide(here, entry.side) === entry.end);
|
|
13741
|
+
return state.sent.find((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && entry.outside !== true && lineOnSide(here, entry.side) === entry.end);
|
|
13753
13742
|
};
|
|
13754
13743
|
openCommentRows = (state) => {
|
|
13755
13744
|
const patch = selectedPatch(state);
|
|
13756
13745
|
if (patch === void 0) return [];
|
|
13757
|
-
const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true);
|
|
13746
|
+
const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true && entry.outside !== true);
|
|
13758
13747
|
return patch.rows.filter((row) => open.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index);
|
|
13759
13748
|
};
|
|
13760
13749
|
filesWithComments = (state) => state.patches.flatMap((patch, index) => state.sent.some((entry) => entry.file === patch.path) ? [index] : []);
|
|
@@ -16443,7 +16432,7 @@ var init_diffview = __esmMin((() => {
|
|
|
16443
16432
|
return `${marks().waiting} picked up ${sinceThen(note.takenAt, note.now)}${moved}`;
|
|
16444
16433
|
};
|
|
16445
16434
|
spokenLines = (body, room, mark) => {
|
|
16446
|
-
return
|
|
16435
|
+
return body.split("\n").flatMap((line) => wrap(line, Math.max(NOTE_MIN, room - 2))).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
|
|
16447
16436
|
};
|
|
16448
16437
|
answerLines = (note, room) => note.turns.length > 0 ? note.turns.flatMap((turn) => spokenLines(turn.body, room, turn.voice === "agent" ? ANSWER_MARK : REPLY_MARK)) : note.answers.flatMap((body) => spokenLines(body, room, ANSWER_MARK));
|
|
16449
16438
|
noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
|
|
@@ -17166,7 +17155,7 @@ var init_render = __esmMin((() => {
|
|
|
17166
17155
|
notesOf = (comments, path, sent, shown = {
|
|
17167
17156
|
opened: [],
|
|
17168
17157
|
now: Date.now()
|
|
17169
|
-
}) => comments.filter((entry) => entry.file === path).map((entry) => ({
|
|
17158
|
+
}) => comments.filter((entry) => entry.file === path && entry.outside !== true).map((entry) => ({
|
|
17170
17159
|
id: entry.id ?? "",
|
|
17171
17160
|
folded: entry.settled === true && !(entry.id !== void 0 && shown.opened.includes(entry.id)),
|
|
17172
17161
|
side: entry.side,
|
|
@@ -17472,7 +17461,7 @@ var init_render = __esmMin((() => {
|
|
|
17472
17461
|
};
|
|
17473
17462
|
};
|
|
17474
17463
|
panelWhere = (entry, room) => {
|
|
17475
|
-
const where = `:${entry.comment.end}`;
|
|
17464
|
+
const where = entry.comment.outside === true ? " · not in the diff" : `:${entry.comment.end}`;
|
|
17476
17465
|
return `${clipPath(entry.comment.file, Math.max(4, room - where.length))}${where}`;
|
|
17477
17466
|
};
|
|
17478
17467
|
panelBody = (entry) => entry.comment.body.split("\n").find((line) => line.trim().length > 0) ?? "";
|
|
@@ -18518,6 +18507,7 @@ var init_app = __esmMin((() => {
|
|
|
18518
18507
|
reading;
|
|
18519
18508
|
renderer;
|
|
18520
18509
|
repo;
|
|
18510
|
+
base;
|
|
18521
18511
|
noticeMs;
|
|
18522
18512
|
roomed = 0;
|
|
18523
18513
|
sessionPath;
|
|
@@ -18542,6 +18532,7 @@ var init_app = __esmMin((() => {
|
|
|
18542
18532
|
constructor(options) {
|
|
18543
18533
|
this.renderer = options.renderer;
|
|
18544
18534
|
this.repo = options.repo;
|
|
18535
|
+
this.base = options.base;
|
|
18545
18536
|
this.noticeMs = options.noticeMs ?? NOTICE_MS;
|
|
18546
18537
|
this.sessionPath = options.sessionPath;
|
|
18547
18538
|
Object.assign(this.chosen, chosenIn({
|
|
@@ -18997,7 +18988,7 @@ var init_app = __esmMin((() => {
|
|
|
18997
18988
|
}
|
|
18998
18989
|
readBranch(name) {
|
|
18999
18990
|
return gen({ self: this }, function* () {
|
|
19000
|
-
const reading = yield* readingOf(this.repo, name);
|
|
18991
|
+
const reading = yield* readingOf(this.repo, name, this.base);
|
|
19001
18992
|
this.reading = reading;
|
|
19002
18993
|
const [progress, layers, sent] = yield* all([
|
|
19003
18994
|
progressIn(reading),
|
|
@@ -19293,7 +19284,7 @@ var init_app = __esmMin((() => {
|
|
|
19293
19284
|
fillBranches() {
|
|
19294
19285
|
return gen({ self: this }, function* () {
|
|
19295
19286
|
const here = selectedBranch(this.state)?.branch;
|
|
19296
|
-
const branches = yield* listBranches(this.repo);
|
|
19287
|
+
const branches = yield* listBranches(this.repo, this.base);
|
|
19297
19288
|
const read = withBranches(this.state, branches);
|
|
19298
19289
|
const at = branches.findIndex((candidate) => candidate.branch === here);
|
|
19299
19290
|
this.commit(at === -1 ? read : {
|
|
@@ -19306,7 +19297,7 @@ var init_app = __esmMin((() => {
|
|
|
19306
19297
|
reloadList() {
|
|
19307
19298
|
return gen({ self: this }, function* () {
|
|
19308
19299
|
const here = selectedBranch(this.state)?.branch;
|
|
19309
|
-
const branches = yield* listBranches(this.repo);
|
|
19300
|
+
const branches = yield* listBranches(this.repo, this.base);
|
|
19310
19301
|
const read = withBranches(this.state, branches);
|
|
19311
19302
|
const at = branches.findIndex((candidate) => candidate.branch === here);
|
|
19312
19303
|
const kept = at === -1 ? read : {
|
|
@@ -19335,7 +19326,7 @@ var init_app = __esmMin((() => {
|
|
|
19335
19326
|
const next = reduce(this.measured(), "back");
|
|
19336
19327
|
this.commit(next);
|
|
19337
19328
|
if (next.screen !== "branches") return;
|
|
19338
|
-
this.commit(withBranches(this.state, yield* listBranches(this.repo)));
|
|
19329
|
+
this.commit(withBranches(this.state, yield* listBranches(this.repo, this.base)));
|
|
19339
19330
|
});
|
|
19340
19331
|
}
|
|
19341
19332
|
walkComments(delta) {
|
|
@@ -19788,10 +19779,10 @@ var init_app = __esmMin((() => {
|
|
|
19788
19779
|
hold: kept["hold"] === true
|
|
19789
19780
|
};
|
|
19790
19781
|
});
|
|
19791
|
-
firstBranches = fn("Tui.firstBranches")(function* (repo, branch) {
|
|
19792
|
-
if (branch === void 0) return yield* listBranches(repo);
|
|
19793
|
-
const only = yield* summaryFor(repo, branch).pipe(orElseSucceed(() => void 0));
|
|
19794
|
-
return only === void 0 ? yield* listBranches(repo) : [only];
|
|
19782
|
+
firstBranches = fn("Tui.firstBranches")(function* (repo, branch, base) {
|
|
19783
|
+
if (branch === void 0) return yield* listBranches(repo, base);
|
|
19784
|
+
const only = yield* summaryFor(repo, branch, base).pipe(orElseSucceed(() => void 0));
|
|
19785
|
+
return only === void 0 ? yield* listBranches(repo, base) : [only];
|
|
19795
19786
|
});
|
|
19796
19787
|
missing = (branch, found) => branch !== void 0 && isNone(found) ? `no worktree here is on ${branch}` : "";
|
|
19797
19788
|
openingOn = (branches, branch) => {
|
|
@@ -19802,7 +19793,7 @@ var init_app = __esmMin((() => {
|
|
|
19802
19793
|
launch = fn("Tui.launch")(function* (asked, renderer, options = {}) {
|
|
19803
19794
|
const { noticeMs, sessionPath } = options;
|
|
19804
19795
|
const repo = yield* settledPath(asked);
|
|
19805
|
-
const branches = yield* firstBranches(repo, options.branch);
|
|
19796
|
+
const branches = yield* firstBranches(repo, options.branch, options.base);
|
|
19806
19797
|
const asOpened = openingOn(branches, options.branch);
|
|
19807
19798
|
const missed = missing(options.branch, asOpened);
|
|
19808
19799
|
const resume = isSome(asOpened) ? none() : sessionPath === void 0 ? none() : yield* readSession(sessionPath);
|
|
@@ -19822,6 +19813,7 @@ var init_app = __esmMin((() => {
|
|
|
19822
19813
|
const app = new App({
|
|
19823
19814
|
renderer,
|
|
19824
19815
|
repo,
|
|
19816
|
+
base: options.base,
|
|
19825
19817
|
display,
|
|
19826
19818
|
state,
|
|
19827
19819
|
painting,
|
|
@@ -19842,14 +19834,11 @@ var init_app = __esmMin((() => {
|
|
|
19842
19834
|
untilDestroyed = (renderer) => callback$1((resume) => {
|
|
19843
19835
|
renderer.on("destroy", () => resume(void_));
|
|
19844
19836
|
});
|
|
19845
|
-
runOn = fn("Tui.runOn")(function* (repo, renderer,
|
|
19846
|
-
yield* launch(repo, renderer,
|
|
19847
|
-
sessionPath,
|
|
19848
|
-
branch
|
|
19849
|
-
});
|
|
19837
|
+
runOn = fn("Tui.runOn")(function* (repo, renderer, options = {}) {
|
|
19838
|
+
yield* launch(repo, renderer, options);
|
|
19850
19839
|
yield* untilDestroyed(renderer);
|
|
19851
19840
|
});
|
|
19852
|
-
runTui = fn("Tui.run")(function* (repo,
|
|
19841
|
+
runTui = fn("Tui.run")(function* (repo, options = {}) {
|
|
19853
19842
|
const renderer = yield* promise(() => createCliRenderer({
|
|
19854
19843
|
exitOnCtrlC: false,
|
|
19855
19844
|
useKittyKeyboard: {
|
|
@@ -19857,7 +19846,7 @@ var init_app = __esmMin((() => {
|
|
|
19857
19846
|
allKeysAsEscapes: true
|
|
19858
19847
|
}
|
|
19859
19848
|
}));
|
|
19860
|
-
yield* ensuring(runOn(repo, renderer,
|
|
19849
|
+
yield* ensuring(runOn(repo, renderer, options), sync(() => renderer.destroy()));
|
|
19861
19850
|
});
|
|
19862
19851
|
}));
|
|
19863
19852
|
//#endregion
|
|
@@ -20047,17 +20036,6 @@ const layersShow = fn("Main.layersShow")(function* (options) {
|
|
|
20047
20036
|
const layers = yield* showLayers(yield* required(options, "worktree"));
|
|
20048
20037
|
yield* answer(options, { layers });
|
|
20049
20038
|
});
|
|
20050
|
-
const init = fn("Main.init")(function* (options) {
|
|
20051
|
-
const report = yield* initRepository({
|
|
20052
|
-
repo: yield* required(options, "repo"),
|
|
20053
|
-
write: options["write"] !== void 0,
|
|
20054
|
-
skill: options["skill"] !== void 0
|
|
20055
|
-
});
|
|
20056
|
-
yield* answer(options, {
|
|
20057
|
-
wrote: report.wrote,
|
|
20058
|
-
changes: report.changes
|
|
20059
|
-
});
|
|
20060
|
-
});
|
|
20061
20039
|
const skillRefresh = fn("Main.skillRefresh")(function* (options) {
|
|
20062
20040
|
const report = yield* refreshSkill([process.cwd(), homedir()]);
|
|
20063
20041
|
yield* answer(options, { changes: report.changes });
|
|
@@ -20075,7 +20053,7 @@ const configSet = fn("Main.configSet")(function* (options) {
|
|
|
20075
20053
|
yield* answer(options, { preference: yield* savePreference(name, wanted) });
|
|
20076
20054
|
});
|
|
20077
20055
|
const reviewPane = fn("Main.reviewPane")(function* (options) {
|
|
20078
|
-
const report = yield* openPane(yield* required(options, "repo"), options["branch"]);
|
|
20056
|
+
const report = yield* openPane(yield* required(options, "repo"), options["branch"], options["base"]);
|
|
20079
20057
|
yield* answer(options, {
|
|
20080
20058
|
opened: report.opened,
|
|
20081
20059
|
pane: report.pane,
|
|
@@ -20116,7 +20094,6 @@ const routes = {
|
|
|
20116
20094
|
"review progress": reviewStatus,
|
|
20117
20095
|
"layers set": layersSet,
|
|
20118
20096
|
"layers show": layersShow,
|
|
20119
|
-
init,
|
|
20120
20097
|
"skill refresh": skillRefresh,
|
|
20121
20098
|
upgrade: fn("Main.upgrade")(function* (options) {
|
|
20122
20099
|
const check = options["check"] !== void 0;
|
|
@@ -20185,7 +20162,11 @@ const dispatch = fn("Main.dispatch")(function* (name, given) {
|
|
|
20185
20162
|
if (name === "file review") return yield* fileReview(options);
|
|
20186
20163
|
if (name === "review open") {
|
|
20187
20164
|
const { runTui } = yield* promise(() => Promise.resolve().then(() => (init_tui(), tui_exports)));
|
|
20188
|
-
return yield* runTui(yield* required(options, "repo"),
|
|
20165
|
+
return yield* runTui(yield* required(options, "repo"), {
|
|
20166
|
+
sessionPath: process.env["ADIFF_SESSION"],
|
|
20167
|
+
branch: options["branch"],
|
|
20168
|
+
base: options["base"]
|
|
20169
|
+
});
|
|
20189
20170
|
}
|
|
20190
20171
|
return yield* unknown(name);
|
|
20191
20172
|
});
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"bin": {
|
|
24
24
|
"adiff": "./bin/adiff.js"
|
|
25
25
|
},
|
|
26
|
-
"version": "0.1.0-alpha.
|
|
26
|
+
"version": "0.1.0-alpha.143",
|
|
27
27
|
"description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|