@eliya-oss/agent-diff 0.1.0-alpha.140 → 0.1.0-alpha.142
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 +12 -5
- package/CHANGELOG.md +55 -0
- package/dist/main.js +198 -106
- package/package.json +1 -1
- package/skills/adiff/SKILL.md +21 -0
|
@@ -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
|
|
@@ -124,9 +124,13 @@ Not:
|
|
|
124
124
|
- ~~`fix(diff): a binary file that adiff cannot show`~~ — a title, not a statement.
|
|
125
125
|
|
|
126
126
|
**No gerund titles.** "Saying what is not there", "Opening onto one branch", "Asking before
|
|
127
|
-
leaving" are all wrong. Write a statement with a verb in it: "a file with no newline
|
|
128
|
-
This holds for the sentence, the branch name, the changeset filename, the PR
|
|
129
|
-
filename.
|
|
127
|
+
leaving" are all wrong. Write a statement with a verb in it: "a file with no newline is drawn as
|
|
128
|
+
one line, not two". This holds for the sentence, the branch name, the changeset filename, the PR
|
|
129
|
+
title and the test filename.
|
|
130
|
+
|
|
131
|
+
Do not write "says so". It carries no meaning of its own: it borrows the subject clause beside it,
|
|
132
|
+
and the moment the sentence is split across a `describe` and a `test`, or read off a PR page or a
|
|
133
|
+
recording's title card, nothing is left. Name what is said.
|
|
130
134
|
|
|
131
135
|
For `perf`, give both numbers and what they were measured on. A speed claim with no measurement is
|
|
132
136
|
not a release note.
|
|
@@ -147,8 +151,6 @@ tests, or how long it took you. Those belong in the PR.
|
|
|
147
151
|
### The template
|
|
148
152
|
|
|
149
153
|
```markdown
|
|
150
|
-
One paragraph. What this changes, and what prompted it. Two or three sentences.
|
|
151
|
-
|
|
152
154
|
## What changed
|
|
153
155
|
|
|
154
156
|
### Fixed
|
|
@@ -179,6 +181,11 @@ The repro. Then what the fix was.
|
|
|
179
181
|
|
|
180
182
|
- The **title** is the entry sentence without the `kind(area):` prefix, and follows the same
|
|
181
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.
|
|
182
189
|
- **`## What changed` is generated, never typed.** `node scripts/pr-summary.ts` prints it from the
|
|
183
190
|
change intents on this branch. The PR and the changelog then cannot drift apart. Commit the
|
|
184
191
|
intent first — the summary is read from the diff against `origin/main`, so an uncommitted file
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.142
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(diff): a comment moves to wherever its code went when the agent edits the file above it.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
A comment was drawn at the line number it was written at. When the agent added or removed lines
|
|
12
|
+
above that code, every comment in the file stayed on its old number and pointed at whatever had
|
|
13
|
+
moved into it. A comment carries the exact snippet it was written against, and that is now what
|
|
14
|
+
places it.
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
|
|
18
|
+
fix(diff): a comment whose code the agent rewrote is not drawn against the line that took its place.
|
|
19
|
+
|
|
20
|
+
<details><summary>What was wrong</summary>
|
|
21
|
+
|
|
22
|
+
When the code a comment was about was changed rather than moved, there was nothing to move the
|
|
23
|
+
comment to, and it stayed on its old line — reading as a remark about code it was never about. Such
|
|
24
|
+
a thread is now left off the diff and kept in the review panel, which says it is not in the diff.
|
|
25
|
+
|
|
26
|
+
</details>
|
|
27
|
+
|
|
28
|
+
fix(diff): an answer with more than one line keeps its lines.
|
|
29
|
+
|
|
30
|
+
<details><summary>What was wrong</summary>
|
|
31
|
+
|
|
32
|
+
An agent's answer and a reviewer's reply were flattened to a single paragraph, so a bulleted answer
|
|
33
|
+
read as one run-on sentence. The reviewer's own comment kept its breaks, so the two sides of a
|
|
34
|
+
thread were drawn by different rules.
|
|
35
|
+
|
|
36
|
+
</details>
|
|
37
|
+
|
|
38
|
+
## 0.1.0-alpha.141
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- fix(CLI): `comment take --wait` refuses a number of seconds it cannot honour instead of answering as though nothing arrived.
|
|
43
|
+
|
|
44
|
+
<details><summary>What was wrong</summary>
|
|
45
|
+
|
|
46
|
+
`--wait` was read with nothing checking it. A value that was not a positive whole number of seconds
|
|
47
|
+
— a word, an empty value, a zero — fell through to a single poll and answered
|
|
48
|
+
`{"ok":true,"comments":[]}` at once. That is byte for byte what an expired wait answers, so an agent
|
|
49
|
+
that asked to listen for an hour was told "nothing arrived" and reported itself armed while it was
|
|
50
|
+
not listening at all.
|
|
51
|
+
|
|
52
|
+
`--wait` now takes a whole number of seconds from 1 to 86400 and refuses anything else on stderr
|
|
53
|
+
with exit 2, naming the most it takes. `--help` and `adiff describe` say the bound. An empty answer
|
|
54
|
+
now only ever means the inbox was empty.
|
|
55
|
+
|
|
56
|
+
</details>
|
|
57
|
+
|
|
3
58
|
## 0.1.0-alpha.140
|
|
4
59
|
|
|
5
60
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -2103,7 +2103,7 @@ var init_Context = __esmMin((() => {
|
|
|
2103
2103
|
}));
|
|
2104
2104
|
//#endregion
|
|
2105
2105
|
//#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Duration.js
|
|
2106
|
-
var TypeId$16, bigint0$1, bigint1, bigint2, bigint10, bigint1e3, roundTiesAwayFromZero, roundMillisToNanos, parseNanos, DURATION_REGEXP, fromInputUnsafe, invalid, zeroDurationValue, infinityDurationValue, negativeInfinityDurationValue, DurationProto, make$14, isDuration, isFinite$1, isZero, zero$1, infinity, negativeInfinity, nanos, millis, seconds, minutes, hours, days, weeks, toMillis, toNanosUnsafe, match$1, matchPair, Equivalence$2, equals;
|
|
2106
|
+
var TypeId$16, bigint0$1, bigint1, bigint2, bigint10, bigint1e3, roundTiesAwayFromZero, roundMillisToNanos, parseNanos, DURATION_REGEXP, fromInputUnsafe, invalid, zeroDurationValue, infinityDurationValue, negativeInfinityDurationValue, DurationProto, make$14, isDuration, isFinite$1, isZero, zero$1, infinity, negativeInfinity, nanos, millis, seconds$1, minutes, hours, days, weeks, toMillis, toNanosUnsafe, match$1, matchPair, Equivalence$2, equals;
|
|
2107
2107
|
var init_Duration = __esmMin((() => {
|
|
2108
2108
|
init_Equal();
|
|
2109
2109
|
init_Function();
|
|
@@ -2147,7 +2147,7 @@ var init_Duration = __esmMin((() => {
|
|
|
2147
2147
|
case "milli":
|
|
2148
2148
|
case "millis": return millis(value);
|
|
2149
2149
|
case "second":
|
|
2150
|
-
case "seconds": return seconds(value);
|
|
2150
|
+
case "seconds": return seconds$1(value);
|
|
2151
2151
|
case "minute":
|
|
2152
2152
|
case "minutes": return minutes(value);
|
|
2153
2153
|
case "hour":
|
|
@@ -2278,7 +2278,7 @@ var init_Duration = __esmMin((() => {
|
|
|
2278
2278
|
negativeInfinity = /*#__PURE__*/ make$14(-Infinity);
|
|
2279
2279
|
nanos = (nanos) => make$14(nanos);
|
|
2280
2280
|
millis = (millis) => make$14(millis);
|
|
2281
|
-
seconds = (seconds) => make$14(seconds * 1e3);
|
|
2281
|
+
seconds$1 = (seconds) => make$14(seconds * 1e3);
|
|
2282
2282
|
minutes = (minutes) => make$14(minutes * 6e4);
|
|
2283
2283
|
hours = (hours) => make$14(hours * 36e5);
|
|
2284
2284
|
days = (days) => make$14(days * 864e5);
|
|
@@ -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, foundAgain;
|
|
9596
9596
|
var init_anchor = __esmMin((() => {
|
|
9597
9597
|
init_dist();
|
|
9598
9598
|
init_model$3();
|
|
@@ -9628,6 +9628,38 @@ 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
|
+
foundAgain = (patch, wanted) => {
|
|
9644
|
+
const said = wanted.snippet.split("\n");
|
|
9645
|
+
if (said.every((text) => text.trim().length === 0)) return none();
|
|
9646
|
+
const lines = sideLines(patch, wanted.side);
|
|
9647
|
+
const whole = nearestRun(lines, said, wanted.start);
|
|
9648
|
+
if (whole !== void 0) return some({
|
|
9649
|
+
side: wanted.side,
|
|
9650
|
+
start: whole,
|
|
9651
|
+
end: whole + said.length - 1
|
|
9652
|
+
});
|
|
9653
|
+
const first = said[0] ?? "";
|
|
9654
|
+
if (said.length === 1 || first.trim().length === 0) return none();
|
|
9655
|
+
const opening = nearestRun(lines, [first], wanted.start);
|
|
9656
|
+
if (opening === void 0) return none();
|
|
9657
|
+
return some({
|
|
9658
|
+
side: wanted.side,
|
|
9659
|
+
start: opening,
|
|
9660
|
+
end: opening
|
|
9661
|
+
});
|
|
9662
|
+
};
|
|
9631
9663
|
}));
|
|
9632
9664
|
//#endregion
|
|
9633
9665
|
//#region src/domain/patch/parse.ts
|
|
@@ -10243,7 +10275,7 @@ var init_error = __esmMin((() => {
|
|
|
10243
10275
|
}));
|
|
10244
10276
|
//#endregion
|
|
10245
10277
|
//#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;
|
|
10278
|
+
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
10279
|
var init_commands = __esmMin((() => {
|
|
10248
10280
|
init_dist();
|
|
10249
10281
|
init_patch();
|
|
@@ -10462,7 +10494,7 @@ var init_commands = __esmMin((() => {
|
|
|
10462
10494
|
settled: Object.hasOwn(settled, comment.id),
|
|
10463
10495
|
removed: Object.hasOwn(removed, comment.id),
|
|
10464
10496
|
stale: comment.head !== head,
|
|
10465
|
-
outside: !shown.has(comment.file),
|
|
10497
|
+
outside: !shown.has(comment.file) || comment.placed === false,
|
|
10466
10498
|
unread: Math.max(0, said.length - seen),
|
|
10467
10499
|
asks: last?.voice === "agent" && last.asks,
|
|
10468
10500
|
...takenAt === void 0 ? {} : { takenAt },
|
|
@@ -10473,13 +10505,36 @@ var init_commands = __esmMin((() => {
|
|
|
10473
10505
|
}))
|
|
10474
10506
|
};
|
|
10475
10507
|
};
|
|
10508
|
+
whereItSitsNow$1 = (patches, comment) => {
|
|
10509
|
+
const patch = patches.find((candidate) => candidate.path === comment.file);
|
|
10510
|
+
if (patch === void 0) return {
|
|
10511
|
+
...comment,
|
|
10512
|
+
placed: false
|
|
10513
|
+
};
|
|
10514
|
+
if (comment.snippet.trim().length === 0) return {
|
|
10515
|
+
...comment,
|
|
10516
|
+
placed: true
|
|
10517
|
+
};
|
|
10518
|
+
return match$3(foundAgain(patch, comment), {
|
|
10519
|
+
onNone: () => ({
|
|
10520
|
+
...comment,
|
|
10521
|
+
placed: false
|
|
10522
|
+
}),
|
|
10523
|
+
onSome: (range) => ({
|
|
10524
|
+
...comment,
|
|
10525
|
+
start: range.start,
|
|
10526
|
+
end: range.end,
|
|
10527
|
+
placed: true
|
|
10528
|
+
})
|
|
10529
|
+
});
|
|
10530
|
+
};
|
|
10476
10531
|
sentIn = fn("Cli.sentIn")(function* (reading) {
|
|
10477
10532
|
const store = yield* Store;
|
|
10478
10533
|
const worktree = reading.worktree;
|
|
10479
10534
|
const spoken = yield* store.answers(worktree.path);
|
|
10480
10535
|
const current = yield* store.state(worktree.path);
|
|
10481
10536
|
const shown = new Set(reading.patches.map((patch) => patch.path));
|
|
10482
|
-
const held = flatten(yield* store.inbox(worktree.path));
|
|
10537
|
+
const held = flatten(yield* store.inbox(worktree.path)).map((comment) => whereItSitsNow$1(reading.patches, comment));
|
|
10483
10538
|
const replies = held.filter((comment) => comment.replyTo !== void 0);
|
|
10484
10539
|
const conversation = {
|
|
10485
10540
|
spoken,
|
|
@@ -11116,7 +11171,7 @@ var init_pane = __esmMin((() => {
|
|
|
11116
11171
|
init_drafts();
|
|
11117
11172
|
init_init();
|
|
11118
11173
|
init_pane();
|
|
11119
|
-
var version$1 = "0.1.0-alpha.
|
|
11174
|
+
var version$1 = "0.1.0-alpha.142";
|
|
11120
11175
|
//#endregion
|
|
11121
11176
|
//#region src/cli/upgrade.ts
|
|
11122
11177
|
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 +11793,10 @@ var init_layers = __esmMin((() => {
|
|
|
11738
11793
|
}));
|
|
11739
11794
|
//#endregion
|
|
11740
11795
|
//#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;
|
|
11796
|
+
var stateOf, whereItSitsNow, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without, restoreIn, restoreComment, settleRead;
|
|
11742
11797
|
var init_threads = __esmMin((() => {
|
|
11743
11798
|
init_dist();
|
|
11799
|
+
init_patch();
|
|
11744
11800
|
init_store();
|
|
11745
11801
|
init_commands();
|
|
11746
11802
|
init_layers();
|
|
@@ -11752,6 +11808,27 @@ var init_threads = __esmMin((() => {
|
|
|
11752
11808
|
if (last === void 0 || last.voice === "reviewer") return "sent";
|
|
11753
11809
|
return asked ? "question" : "answered";
|
|
11754
11810
|
};
|
|
11811
|
+
whereItSitsNow = (patches, anchor) => {
|
|
11812
|
+
const patch = patches.find((candidate) => candidate.path === anchor.path);
|
|
11813
|
+
if (patch === void 0) return {
|
|
11814
|
+
...anchor,
|
|
11815
|
+
placed: false
|
|
11816
|
+
};
|
|
11817
|
+
if (anchor.snippet.trim().length === 0) return {
|
|
11818
|
+
...anchor,
|
|
11819
|
+
placed: true
|
|
11820
|
+
};
|
|
11821
|
+
return match$3(foundAgain(patch, anchor), {
|
|
11822
|
+
onNone: () => ({
|
|
11823
|
+
...anchor,
|
|
11824
|
+
placed: false
|
|
11825
|
+
}),
|
|
11826
|
+
onSome: (range) => ({
|
|
11827
|
+
...range,
|
|
11828
|
+
placed: true
|
|
11829
|
+
})
|
|
11830
|
+
});
|
|
11831
|
+
};
|
|
11755
11832
|
spoken$1 = (entry) => ({
|
|
11756
11833
|
body: entry.body,
|
|
11757
11834
|
at: entry.at,
|
|
@@ -11773,16 +11850,17 @@ var init_threads = __esmMin((() => {
|
|
|
11773
11850
|
const seen = [...ids].reduce((total, id) => total + (reading.read[id] ?? 0), 0);
|
|
11774
11851
|
const turns = turnsOf(replies, mine);
|
|
11775
11852
|
const settled = Object.hasOwn(reading.settled, comment.id);
|
|
11853
|
+
const sits = whereItSitsNow(reading.patches, comment.anchor);
|
|
11776
11854
|
return {
|
|
11777
11855
|
id: comment.id,
|
|
11778
11856
|
file: comment.anchor.path,
|
|
11779
11857
|
side: comment.anchor.side,
|
|
11780
|
-
start:
|
|
11781
|
-
end:
|
|
11858
|
+
start: sits.start,
|
|
11859
|
+
end: sits.end,
|
|
11782
11860
|
body: comment.body,
|
|
11783
11861
|
state: stateOf(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(reading.removed, comment.id)),
|
|
11784
11862
|
stale: batch.head !== reading.head,
|
|
11785
|
-
outside: !reading.shown.has(comment.anchor.path),
|
|
11863
|
+
outside: !reading.shown.has(comment.anchor.path) || !sits.placed,
|
|
11786
11864
|
unread: Math.max(0, mine.length - seen),
|
|
11787
11865
|
answers: mine.map(spoken$1),
|
|
11788
11866
|
turns,
|
|
@@ -11807,12 +11885,14 @@ var init_threads = __esmMin((() => {
|
|
|
11807
11885
|
const store = yield* Store;
|
|
11808
11886
|
const worktree = yield* findBranch(repo, branch, base);
|
|
11809
11887
|
const current = yield* store.state(worktree.path);
|
|
11888
|
+
const patches = yield* patchesOf(worktree);
|
|
11810
11889
|
return threadsIn(yield* store.inbox(worktree.path), {
|
|
11811
11890
|
answers: yield* store.answers(worktree.path),
|
|
11812
11891
|
settled: current.settled,
|
|
11813
11892
|
removed: current.removed,
|
|
11814
11893
|
head: worktree.head,
|
|
11815
|
-
shown: new Set(
|
|
11894
|
+
shown: new Set(patches.map((patch) => patch.path)),
|
|
11895
|
+
patches,
|
|
11816
11896
|
read: current.read
|
|
11817
11897
|
});
|
|
11818
11898
|
});
|
|
@@ -11913,91 +11993,10 @@ var init_threads = __esmMin((() => {
|
|
|
11913
11993
|
});
|
|
11914
11994
|
}));
|
|
11915
11995
|
//#endregion
|
|
11916
|
-
//#region src/cli/parse.ts
|
|
11917
|
-
var FLAG, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric;
|
|
11918
|
-
var init_parse = __esmMin((() => {
|
|
11919
|
-
init_dist();
|
|
11920
|
-
init_error();
|
|
11921
|
-
FLAG = /^--(?<name>[^=]+)(?:=(?<value>[\s\S]*))?$/;
|
|
11922
|
-
flagOn = (taken, token, valued) => {
|
|
11923
|
-
const found = FLAG.exec(token)?.groups;
|
|
11924
|
-
if (found === void 0) return taken;
|
|
11925
|
-
const name = found["name"] ?? "";
|
|
11926
|
-
const given = found["value"];
|
|
11927
|
-
if (given !== void 0) return {
|
|
11928
|
-
options: {
|
|
11929
|
-
...taken.options,
|
|
11930
|
-
[name]: given
|
|
11931
|
-
},
|
|
11932
|
-
held: void 0
|
|
11933
|
-
};
|
|
11934
|
-
if (valued.has(name)) return {
|
|
11935
|
-
options: taken.options,
|
|
11936
|
-
held: name
|
|
11937
|
-
};
|
|
11938
|
-
return {
|
|
11939
|
-
options: {
|
|
11940
|
-
...taken.options,
|
|
11941
|
-
[name]: "true"
|
|
11942
|
-
},
|
|
11943
|
-
held: void 0
|
|
11944
|
-
};
|
|
11945
|
-
};
|
|
11946
|
-
tokenOn = (taken, token, valued) => taken.held === void 0 ? flagOn(taken, token, valued) : {
|
|
11947
|
-
options: {
|
|
11948
|
-
...taken.options,
|
|
11949
|
-
[taken.held]: token
|
|
11950
|
-
},
|
|
11951
|
-
held: void 0
|
|
11952
|
-
};
|
|
11953
|
-
optionsFrom = (argv, valued = /* @__PURE__ */ new Set()) => {
|
|
11954
|
-
const taken = argv.reduce((held, token) => tokenOn(held, token, valued), {
|
|
11955
|
-
options: {},
|
|
11956
|
-
held: void 0
|
|
11957
|
-
});
|
|
11958
|
-
return taken.held === void 0 ? taken.options : {
|
|
11959
|
-
...taken.options,
|
|
11960
|
-
[taken.held]: ""
|
|
11961
|
-
};
|
|
11962
|
-
};
|
|
11963
|
-
onlyKnown = (options, known) => {
|
|
11964
|
-
const strange = Object.keys(options).find((name) => !known.has(name));
|
|
11965
|
-
return strange === void 0 ? succeed$1(options) : fail(new UnknownOption({
|
|
11966
|
-
option: strange,
|
|
11967
|
-
known: [...known].toSorted()
|
|
11968
|
-
}));
|
|
11969
|
-
};
|
|
11970
|
-
oneOf = (options, name, allowed, byDefault) => {
|
|
11971
|
-
const given = options[name];
|
|
11972
|
-
if (given === void 0) return succeed$1(byDefault);
|
|
11973
|
-
const found = allowed.find((one) => one === given);
|
|
11974
|
-
return found === void 0 ? fail(new BadOption({
|
|
11975
|
-
option: name,
|
|
11976
|
-
given,
|
|
11977
|
-
allowed
|
|
11978
|
-
})) : succeed$1(found);
|
|
11979
|
-
};
|
|
11980
|
-
required = fn("Cli.required")(function* (options, name) {
|
|
11981
|
-
const value = fromNullishOr(options[name]);
|
|
11982
|
-
return yield* match$3(value, {
|
|
11983
|
-
onNone: () => new MissingOption({ option: name }),
|
|
11984
|
-
onSome: succeed$1
|
|
11985
|
-
});
|
|
11986
|
-
});
|
|
11987
|
-
numeric = fn("Cli.numeric")(function* (options, name) {
|
|
11988
|
-
const raw = yield* required(options, name);
|
|
11989
|
-
const parsed = Number(raw);
|
|
11990
|
-
return yield* Number.isInteger(parsed) && parsed >= 1 ? succeed$1(parsed) : new BadOption({
|
|
11991
|
-
option: name,
|
|
11992
|
-
given: raw,
|
|
11993
|
-
allowed: ["a whole number of 1 or more"]
|
|
11994
|
-
});
|
|
11995
|
-
});
|
|
11996
|
-
}));
|
|
11997
|
-
//#endregion
|
|
11998
11996
|
//#region src/cli/catalog.ts
|
|
11999
|
-
var worktreeOf, repoOf, branchOf, fieldsOption, addressing, baseOf, based, repo, opening$2, file, range, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, DRAFTS, SET_UP, withFields, commands$1, catalog, commandNames, findCommand, VALUED_ANYWHERE, KNOWN_ANYWHERE, valuedIn, knownIn, verbsUnder, groups, MIN_EDITS, distance, CHARS_PER_EDIT, nearestCommand;
|
|
11997
|
+
var WAIT_MOST, worktreeOf, repoOf, branchOf, fieldsOption, addressing, baseOf, based, repo, opening$2, file, range, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, DRAFTS, SET_UP, withFields, commands$1, catalog, commandNames, findCommand, VALUED_ANYWHERE, KNOWN_ANYWHERE, valuedIn, knownIn, verbsUnder, groups, MIN_EDITS, distance, CHARS_PER_EDIT, nearestCommand;
|
|
12000
11998
|
var init_catalog = __esmMin((() => {
|
|
11999
|
+
WAIT_MOST = 86400;
|
|
12001
12000
|
worktreeOf = {
|
|
12002
12001
|
name: "worktree",
|
|
12003
12002
|
required: false,
|
|
@@ -12217,7 +12216,7 @@ var init_catalog = __esmMin((() => {
|
|
|
12217
12216
|
name: "wait",
|
|
12218
12217
|
required: false,
|
|
12219
12218
|
value: "seconds",
|
|
12220
|
-
about:
|
|
12219
|
+
about: `Block until a comment arrives or the timeout elapses. A whole number of seconds from 1 to ${WAIT_MOST}; anything else is refused`
|
|
12221
12220
|
}],
|
|
12222
12221
|
dataKey: "comments",
|
|
12223
12222
|
example: "adiff comment take --worktree . --wait 300"
|
|
@@ -12567,6 +12566,99 @@ var init_catalog = __esmMin((() => {
|
|
|
12567
12566
|
})).toSorted((left, right) => left.gap - right.gap)[0];
|
|
12568
12567
|
return scored !== void 0 && scored.gap <= room ? scored.known : void 0;
|
|
12569
12568
|
};
|
|
12569
|
+
}));
|
|
12570
|
+
//#endregion
|
|
12571
|
+
//#region src/cli/parse.ts
|
|
12572
|
+
var FLAG, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, seconds;
|
|
12573
|
+
var init_parse = __esmMin((() => {
|
|
12574
|
+
init_dist();
|
|
12575
|
+
init_catalog();
|
|
12576
|
+
init_error();
|
|
12577
|
+
FLAG = /^--(?<name>[^=]+)(?:=(?<value>[\s\S]*))?$/;
|
|
12578
|
+
flagOn = (taken, token, valued) => {
|
|
12579
|
+
const found = FLAG.exec(token)?.groups;
|
|
12580
|
+
if (found === void 0) return taken;
|
|
12581
|
+
const name = found["name"] ?? "";
|
|
12582
|
+
const given = found["value"];
|
|
12583
|
+
if (given !== void 0) return {
|
|
12584
|
+
options: {
|
|
12585
|
+
...taken.options,
|
|
12586
|
+
[name]: given
|
|
12587
|
+
},
|
|
12588
|
+
held: void 0
|
|
12589
|
+
};
|
|
12590
|
+
if (valued.has(name)) return {
|
|
12591
|
+
options: taken.options,
|
|
12592
|
+
held: name
|
|
12593
|
+
};
|
|
12594
|
+
return {
|
|
12595
|
+
options: {
|
|
12596
|
+
...taken.options,
|
|
12597
|
+
[name]: "true"
|
|
12598
|
+
},
|
|
12599
|
+
held: void 0
|
|
12600
|
+
};
|
|
12601
|
+
};
|
|
12602
|
+
tokenOn = (taken, token, valued) => taken.held === void 0 ? flagOn(taken, token, valued) : {
|
|
12603
|
+
options: {
|
|
12604
|
+
...taken.options,
|
|
12605
|
+
[taken.held]: token
|
|
12606
|
+
},
|
|
12607
|
+
held: void 0
|
|
12608
|
+
};
|
|
12609
|
+
optionsFrom = (argv, valued = /* @__PURE__ */ new Set()) => {
|
|
12610
|
+
const taken = argv.reduce((held, token) => tokenOn(held, token, valued), {
|
|
12611
|
+
options: {},
|
|
12612
|
+
held: void 0
|
|
12613
|
+
});
|
|
12614
|
+
return taken.held === void 0 ? taken.options : {
|
|
12615
|
+
...taken.options,
|
|
12616
|
+
[taken.held]: ""
|
|
12617
|
+
};
|
|
12618
|
+
};
|
|
12619
|
+
onlyKnown = (options, known) => {
|
|
12620
|
+
const strange = Object.keys(options).find((name) => !known.has(name));
|
|
12621
|
+
return strange === void 0 ? succeed$1(options) : fail(new UnknownOption({
|
|
12622
|
+
option: strange,
|
|
12623
|
+
known: [...known].toSorted()
|
|
12624
|
+
}));
|
|
12625
|
+
};
|
|
12626
|
+
oneOf = (options, name, allowed, byDefault) => {
|
|
12627
|
+
const given = options[name];
|
|
12628
|
+
if (given === void 0) return succeed$1(byDefault);
|
|
12629
|
+
const found = allowed.find((one) => one === given);
|
|
12630
|
+
return found === void 0 ? fail(new BadOption({
|
|
12631
|
+
option: name,
|
|
12632
|
+
given,
|
|
12633
|
+
allowed
|
|
12634
|
+
})) : succeed$1(found);
|
|
12635
|
+
};
|
|
12636
|
+
required = fn("Cli.required")(function* (options, name) {
|
|
12637
|
+
const value = fromNullishOr(options[name]);
|
|
12638
|
+
return yield* match$3(value, {
|
|
12639
|
+
onNone: () => new MissingOption({ option: name }),
|
|
12640
|
+
onSome: succeed$1
|
|
12641
|
+
});
|
|
12642
|
+
});
|
|
12643
|
+
numeric = fn("Cli.numeric")(function* (options, name) {
|
|
12644
|
+
const raw = yield* required(options, name);
|
|
12645
|
+
const parsed = Number(raw);
|
|
12646
|
+
return yield* Number.isInteger(parsed) && parsed >= 1 ? succeed$1(parsed) : new BadOption({
|
|
12647
|
+
option: name,
|
|
12648
|
+
given: raw,
|
|
12649
|
+
allowed: ["a whole number of 1 or more"]
|
|
12650
|
+
});
|
|
12651
|
+
});
|
|
12652
|
+
seconds = fn("Cli.seconds")(function* (options, name) {
|
|
12653
|
+
const raw = options[name];
|
|
12654
|
+
if (raw === void 0) return 0;
|
|
12655
|
+
const asked = Number(raw);
|
|
12656
|
+
return yield* Number.isInteger(asked) && asked >= 1 && asked <= 86400 ? succeed$1(asked) : new BadOption({
|
|
12657
|
+
option: name,
|
|
12658
|
+
given: raw,
|
|
12659
|
+
allowed: [`a whole number of seconds from 1 to ${WAIT_MOST}`]
|
|
12660
|
+
});
|
|
12661
|
+
});
|
|
12570
12662
|
})), ADVICE, FALLBACK, tagOf, project, fieldsOf, narrow, keysIn, strangeField, sharpen, failure;
|
|
12571
12663
|
var init_report$1 = __esmMin((() => {
|
|
12572
12664
|
ADVICE = {
|
|
@@ -13554,7 +13646,7 @@ var init_model = __esmMin((() => {
|
|
|
13554
13646
|
const patch = selectedPatch(state);
|
|
13555
13647
|
const found = /* @__PURE__ */ new Map();
|
|
13556
13648
|
if (patch === void 0) return found;
|
|
13557
|
-
const here = state.sent.filter((entry) => entry.file === patch.path && entry.removed !== true);
|
|
13649
|
+
const here = state.sent.filter((entry) => entry.file === patch.path && entry.removed !== true && entry.outside !== true);
|
|
13558
13650
|
for (const entry of here) {
|
|
13559
13651
|
const stand = threadStand(entry);
|
|
13560
13652
|
for (const row of rowsUnder(patch, entry)) found.set(row, louder(stand, found.get(row) ?? "gone"));
|
|
@@ -13721,14 +13813,14 @@ var init_model = __esmMin((() => {
|
|
|
13721
13813
|
commentRowsIn = (state, fileIndex) => {
|
|
13722
13814
|
const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
|
|
13723
13815
|
if (patch === void 0) return [];
|
|
13724
|
-
const notes = state.sent.filter((entry) => entry.file === patch.path);
|
|
13816
|
+
const notes = state.sent.filter((entry) => entry.file === patch.path && entry.outside !== true);
|
|
13725
13817
|
return patch.rows.filter((row) => notes.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index).toSorted((left, right) => left - right);
|
|
13726
13818
|
};
|
|
13727
13819
|
threadsAtRow = (state, row) => {
|
|
13728
13820
|
const patch = selectedPatch(state);
|
|
13729
13821
|
const here = patch?.rows[row];
|
|
13730
13822
|
if (patch === void 0 || here === void 0) return [];
|
|
13731
|
-
return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && lineOnSide(here, entry.side) === entry.end);
|
|
13823
|
+
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);
|
|
13732
13824
|
};
|
|
13733
13825
|
stopsAtRow = (state, row) => 1 + threadsAtRow(state, row).length;
|
|
13734
13826
|
threadHere = (state) => threadChosen(state) ?? threadAtStop(state) ?? threadAtRow(state, state.cursor);
|
|
@@ -13737,12 +13829,12 @@ var init_model = __esmMin((() => {
|
|
|
13737
13829
|
const patch = selectedPatch(state);
|
|
13738
13830
|
const here = patch?.rows[row];
|
|
13739
13831
|
if (patch === void 0 || here === void 0) return void 0;
|
|
13740
|
-
return state.sent.find((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && lineOnSide(here, entry.side) === entry.end);
|
|
13832
|
+
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);
|
|
13741
13833
|
};
|
|
13742
13834
|
openCommentRows = (state) => {
|
|
13743
13835
|
const patch = selectedPatch(state);
|
|
13744
13836
|
if (patch === void 0) return [];
|
|
13745
|
-
const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true);
|
|
13837
|
+
const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true && entry.outside !== true);
|
|
13746
13838
|
return patch.rows.filter((row) => open.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index);
|
|
13747
13839
|
};
|
|
13748
13840
|
filesWithComments = (state) => state.patches.flatMap((patch, index) => state.sent.some((entry) => entry.file === patch.path) ? [index] : []);
|
|
@@ -16431,7 +16523,7 @@ var init_diffview = __esmMin((() => {
|
|
|
16431
16523
|
return `${marks().waiting} picked up ${sinceThen(note.takenAt, note.now)}${moved}`;
|
|
16432
16524
|
};
|
|
16433
16525
|
spokenLines = (body, room, mark) => {
|
|
16434
|
-
return
|
|
16526
|
+
return body.split("\n").flatMap((line) => wrap(line, Math.max(NOTE_MIN, room - 2))).map((text, at) => at === 0 ? `${mark} ${text}` : ` ${text}`);
|
|
16435
16527
|
};
|
|
16436
16528
|
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));
|
|
16437
16529
|
noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
|
|
@@ -17154,7 +17246,7 @@ var init_render = __esmMin((() => {
|
|
|
17154
17246
|
notesOf = (comments, path, sent, shown = {
|
|
17155
17247
|
opened: [],
|
|
17156
17248
|
now: Date.now()
|
|
17157
|
-
}) => comments.filter((entry) => entry.file === path).map((entry) => ({
|
|
17249
|
+
}) => comments.filter((entry) => entry.file === path && entry.outside !== true).map((entry) => ({
|
|
17158
17250
|
id: entry.id ?? "",
|
|
17159
17251
|
folded: entry.settled === true && !(entry.id !== void 0 && shown.opened.includes(entry.id)),
|
|
17160
17252
|
side: entry.side,
|
|
@@ -17460,7 +17552,7 @@ var init_render = __esmMin((() => {
|
|
|
17460
17552
|
};
|
|
17461
17553
|
};
|
|
17462
17554
|
panelWhere = (entry, room) => {
|
|
17463
|
-
const where = `:${entry.comment.end}`;
|
|
17555
|
+
const where = entry.comment.outside === true ? " · not in the diff" : `:${entry.comment.end}`;
|
|
17464
17556
|
return `${clipPath(entry.comment.file, Math.max(4, room - where.length))}${where}`;
|
|
17465
17557
|
};
|
|
17466
17558
|
panelBody = (entry) => entry.comment.body.split("\n").find((line) => line.trim().length > 0) ?? "";
|
|
@@ -19967,7 +20059,7 @@ const commentReply = fn("Main.commentReply")(function* (options) {
|
|
|
19967
20059
|
const NOTHING_WAITING = "No comment is waiting. Pass --wait <seconds> to block until one arrives, and answer what you collect with `adiff comment answer --worktree . --id <id> --body '…'`.";
|
|
19968
20060
|
const commentTake = fn("Main.commentTake")(function* (options) {
|
|
19969
20061
|
const worktree = yield* required(options, "worktree");
|
|
19970
|
-
const wait =
|
|
20062
|
+
const wait = yield* seconds(options, "wait");
|
|
19971
20063
|
const comments = wait > 0 ? yield* awaitComments(worktree, Date.now() + wait * WAIT_UNIT) : yield* takeComments(worktree);
|
|
19972
20064
|
const hint = comments.length === 0 ? { hint: NOTHING_WAITING } : {};
|
|
19973
20065
|
yield* answer(options, {
|
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.142",
|
|
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": {
|
package/skills/adiff/SKILL.md
CHANGED
|
@@ -37,6 +37,14 @@ adiff comment take --worktree . --wait 300
|
|
|
37
37
|
Blocks until a comment arrives or the timeout in seconds elapses, then returns the same envelope.
|
|
38
38
|
An empty `comments` array means the wait expired with nothing new — that is not an error.
|
|
39
39
|
|
|
40
|
+
`--wait` takes a whole number of seconds from 1 to 86400. A value outside that is refused on
|
|
41
|
+
stderr with exit 2, because an instant empty answer would read exactly like a wait that expired:
|
|
42
|
+
if a wait comes back at once, you are not waiting.
|
|
43
|
+
|
|
44
|
+
Arm the wait as the first thing you do in a turn, before the work. A turn that is interrupted
|
|
45
|
+
half-way then still leaves a listener running, and a wait armed at the end of a turn is a wait that
|
|
46
|
+
often never gets armed.
|
|
47
|
+
|
|
40
48
|
Run the wait in the background, not in the foreground. A foreground wait holds the turn, so you
|
|
41
49
|
cannot do anything else and the person you are working with cannot talk to you. Backgrounded, the
|
|
42
50
|
harness brings you back the moment a comment lands.
|
|
@@ -49,6 +57,10 @@ Re-arm it after each comment you handle, and keep it running while you work. A r
|
|
|
49
57
|
their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
|
|
50
58
|
events rather than by you asking. When you finish a piece of work, say you are still listening.
|
|
51
59
|
|
|
60
|
+
A backgrounded wait that is killed rather than expiring is not the reviewer going quiet, and not a
|
|
61
|
+
reason to stop listening. A kill loses whatever the wait would have handed you, so take once
|
|
62
|
+
without `--wait` to collect what landed, then arm a new wait.
|
|
63
|
+
|
|
52
64
|
## Answering a comment
|
|
53
65
|
|
|
54
66
|
Say what you did, against the comment you were handed:
|
|
@@ -245,6 +257,15 @@ with:
|
|
|
245
257
|
adiff layers show --worktree . --fields covered,partial,total,uncovered
|
|
246
258
|
```
|
|
247
259
|
|
|
260
|
+
`uncovered` does not always empty out by claiming lines you can see. A deleted line is counted at
|
|
261
|
+
the number it had in the old file, so a branch that cuts a file from 409 lines to 394 reports an
|
|
262
|
+
uncovered run at 395-409 — line numbers past the end of the file as it now stands. A span over the
|
|
263
|
+
new file cannot reach them; only a span whose `end` runs past the end of the file can. Write one, or
|
|
264
|
+
say the run is unreachable, rather than reading the leftover as a layer you forgot.
|
|
265
|
+
|
|
266
|
+
That is also the case for spans generally: `start` 1 to past the last line covers a file whatever
|
|
267
|
+
happens to it, while a tight range goes stale on the next push that moves the lines under it.
|
|
268
|
+
|
|
248
269
|
Setting layers again supersedes the previous set and bumps `version`; the set records the commit it
|
|
249
270
|
was written for, and adiff reports it as `stale` once the branch moves past that commit. Once a
|
|
250
271
|
reviewer has a reading order, keep it true: write it again after you address their comments.
|