@eliya-oss/agent-diff 0.1.0-alpha.194 → 0.1.0-alpha.195
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/CHANGELOG.md +15 -0
- package/dist/main.js +363 -142
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.195
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(comment delivery): a comment whose lines were changed or deleted stays where the change is and is marked outdated, instead of landing on a look-alike line elsewhere in the file.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
A comment on two lines that a later commit deleted showed up on a near-identical line in another
|
|
12
|
+
method of the same file, as if it were about that code. Comments now follow their lines through
|
|
13
|
+
git's diff from the version they were written on, and `comment list` reports `outdated: true` with
|
|
14
|
+
the original snippet when the commented lines changed.
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
|
|
3
18
|
## 0.1.0-alpha.194
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -10083,7 +10083,7 @@ var init_config = __esmMin((() => {
|
|
|
10083
10083
|
//#region package.json
|
|
10084
10084
|
init_pane();
|
|
10085
10085
|
init_config();
|
|
10086
|
-
var version$1 = "0.1.0-alpha.
|
|
10086
|
+
var version$1 = "0.1.0-alpha.195";
|
|
10087
10087
|
//#endregion
|
|
10088
10088
|
//#region src/cli/error.ts
|
|
10089
10089
|
var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
|
|
@@ -10291,7 +10291,7 @@ var init_upgrade$1 = __esmMin((() => {
|
|
|
10291
10291
|
}));
|
|
10292
10292
|
//#endregion
|
|
10293
10293
|
//#region src/cli/catalog.ts
|
|
10294
|
-
var WAIT_MOST, worktreeOf$1, repoOf$1, 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;
|
|
10294
|
+
var WAIT_MOST, worktreeOf$1, repoOf$1, branchOf, fieldsOption, addressing, baseOf$1, 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;
|
|
10295
10295
|
var init_catalog = __esmMin((() => {
|
|
10296
10296
|
WAIT_MOST = 86400;
|
|
10297
10297
|
worktreeOf$1 = {
|
|
@@ -10323,13 +10323,13 @@ var init_catalog = __esmMin((() => {
|
|
|
10323
10323
|
repoOf$1,
|
|
10324
10324
|
branchOf
|
|
10325
10325
|
];
|
|
10326
|
-
baseOf = {
|
|
10326
|
+
baseOf$1 = {
|
|
10327
10327
|
name: "base",
|
|
10328
10328
|
required: false,
|
|
10329
10329
|
value: "ref",
|
|
10330
10330
|
about: "Ref to diff against, instead of the one this branch is stacked on. `auto` asks for the stacked parent explicitly"
|
|
10331
10331
|
};
|
|
10332
|
-
based = [...addressing, baseOf];
|
|
10332
|
+
based = [...addressing, baseOf$1];
|
|
10333
10333
|
repo = {
|
|
10334
10334
|
name: "repo",
|
|
10335
10335
|
required: true,
|
|
@@ -10392,7 +10392,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10392
10392
|
group: READ_A_BRANCH,
|
|
10393
10393
|
addresses: "repo",
|
|
10394
10394
|
safety: "read",
|
|
10395
|
-
options: [repo, baseOf],
|
|
10395
|
+
options: [repo, baseOf$1],
|
|
10396
10396
|
dataKey: "branches",
|
|
10397
10397
|
example: "adiff branch list --repo . --fields branch,files"
|
|
10398
10398
|
},
|
|
@@ -10405,7 +10405,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10405
10405
|
options: [
|
|
10406
10406
|
repo,
|
|
10407
10407
|
opening$2,
|
|
10408
|
-
baseOf
|
|
10408
|
+
baseOf$1
|
|
10409
10409
|
],
|
|
10410
10410
|
dataKey: "",
|
|
10411
10411
|
example: "adiff review open --repo . --branch add-invitations"
|
|
@@ -10419,7 +10419,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10419
10419
|
options: [
|
|
10420
10420
|
repo,
|
|
10421
10421
|
opening$2,
|
|
10422
|
-
baseOf
|
|
10422
|
+
baseOf$1
|
|
10423
10423
|
],
|
|
10424
10424
|
dataKey: "pane",
|
|
10425
10425
|
example: "adiff review pane --repo ."
|
|
@@ -11628,11 +11628,69 @@ var init_model$5 = __esmMin((() => {
|
|
|
11628
11628
|
lineOn = (row, side) => side === "new" ? row.newLine : row.oldLine;
|
|
11629
11629
|
}));
|
|
11630
11630
|
//#endregion
|
|
11631
|
+
//#region src/domain/patch/sticky.ts
|
|
11632
|
+
var CLOSER, COMMENT, LOOKAHEAD, indentOf, pinnable, limitFrom, enclosing, read$3, enclosedBy, scopeLines, stickyChain, kept;
|
|
11633
|
+
var init_sticky = __esmMin((() => {
|
|
11634
|
+
CLOSER = /^[)\]}>;,]/;
|
|
11635
|
+
COMMENT = /^(\/\/|\/\*|\*|#|<!--)/;
|
|
11636
|
+
LOOKAHEAD = 5;
|
|
11637
|
+
indentOf = (text) => text.length - text.trimStart().length;
|
|
11638
|
+
pinnable = (text) => {
|
|
11639
|
+
const trimmed = text.trim();
|
|
11640
|
+
if (trimmed.length === 0) return false;
|
|
11641
|
+
return !CLOSER.test(trimmed) && !COMMENT.test(trimmed);
|
|
11642
|
+
};
|
|
11643
|
+
limitFrom = (source, index) => {
|
|
11644
|
+
const here = source[index] ?? "";
|
|
11645
|
+
if (here.trim().length > 0) return indentOf(here);
|
|
11646
|
+
const ahead = source.slice(index, index + LOOKAHEAD).find((line) => line.trim().length > 0);
|
|
11647
|
+
return ahead === void 0 ? 0 : indentOf(ahead);
|
|
11648
|
+
};
|
|
11649
|
+
enclosing = (source) => {
|
|
11650
|
+
const open = [];
|
|
11651
|
+
const found = [];
|
|
11652
|
+
source.forEach((text, index) => {
|
|
11653
|
+
const limit = limitFrom(source, index);
|
|
11654
|
+
const outer = open.findLast((at) => indentOf(source[at] ?? "") < limit);
|
|
11655
|
+
found.push(outer === void 0 ? 0 : outer + 1);
|
|
11656
|
+
if (!pinnable(text)) return;
|
|
11657
|
+
const indent = indentOf(text);
|
|
11658
|
+
while (open.length > 0 && indentOf(source[open.at(-1) ?? 0] ?? "") >= indent) open.pop();
|
|
11659
|
+
open.push(index);
|
|
11660
|
+
});
|
|
11661
|
+
return found;
|
|
11662
|
+
};
|
|
11663
|
+
read$3 = /* @__PURE__ */ new WeakMap();
|
|
11664
|
+
enclosedBy = (source) => {
|
|
11665
|
+
const known = read$3.get(source);
|
|
11666
|
+
if (known !== void 0) return known;
|
|
11667
|
+
const found = enclosing(source);
|
|
11668
|
+
read$3.set(source, found);
|
|
11669
|
+
return found;
|
|
11670
|
+
};
|
|
11671
|
+
scopeLines = (source) => [...new Set(enclosedBy(source).filter((line) => line > 0))].toSorted((left, right) => left - right);
|
|
11672
|
+
stickyChain = (source, line, max) => {
|
|
11673
|
+
const index = line - 1;
|
|
11674
|
+
if (index <= 0 || index >= source.length) return [];
|
|
11675
|
+
const outer = enclosedBy(source);
|
|
11676
|
+
const chain = [];
|
|
11677
|
+
for (let at = outer[index] ?? 0; at > 0; at = outer[at - 1] ?? 0) chain.push(source[at - 1] ?? "");
|
|
11678
|
+
return kept(chain.toReversed(), max);
|
|
11679
|
+
};
|
|
11680
|
+
kept = (chain, max) => {
|
|
11681
|
+
if (chain.length <= max || max < 2) return chain.slice(0, max);
|
|
11682
|
+
const outer = chain[0] ?? "";
|
|
11683
|
+
const inner = chain.slice(chain.length - (max - 1));
|
|
11684
|
+
return [`${outer} ⋯`, ...inner];
|
|
11685
|
+
};
|
|
11686
|
+
}));
|
|
11687
|
+
//#endregion
|
|
11631
11688
|
//#region src/domain/patch/anchor.ts
|
|
11632
|
-
var sideOf$1, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundExactly,
|
|
11689
|
+
var sideOf$1, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, exactlyIn, alikeIn, againIn, foundExactly, sourceLines, foundInScope;
|
|
11633
11690
|
var init_anchor = __esmMin((() => {
|
|
11634
11691
|
init_dist();
|
|
11635
11692
|
init_model$5();
|
|
11693
|
+
init_sticky();
|
|
11636
11694
|
sideOf$1 = (rows) => rows.some((row) => isSome(row.newLine)) ? "new" : "old";
|
|
11637
11695
|
linesOn = (rows, side) => rows.flatMap((row) => match$3(lineOn(row, side), {
|
|
11638
11696
|
onNone: () => [],
|
|
@@ -11696,10 +11754,9 @@ var init_anchor = __esmMin((() => {
|
|
|
11696
11754
|
return room >= SHORTEST_NEAR && edits(one, other) <= Math.floor(room / PER_EDIT);
|
|
11697
11755
|
};
|
|
11698
11756
|
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;
|
|
11699
|
-
|
|
11757
|
+
exactlyIn = (lines, wanted) => {
|
|
11700
11758
|
const said = wanted.snippet.split("\n");
|
|
11701
11759
|
if (said.every((text) => text.trim().length === 0)) return none();
|
|
11702
|
-
const lines = sideLines(patch, wanted.side);
|
|
11703
11760
|
const whole = nearestRun(lines, said, wanted.start);
|
|
11704
11761
|
if (whole !== void 0) return some({
|
|
11705
11762
|
side: wanted.side,
|
|
@@ -11715,17 +11772,78 @@ var init_anchor = __esmMin((() => {
|
|
|
11715
11772
|
end: opening
|
|
11716
11773
|
});
|
|
11717
11774
|
};
|
|
11718
|
-
|
|
11775
|
+
alikeIn = (lines, wanted) => {
|
|
11719
11776
|
const first = wanted.snippet.split("\n")[0] ?? "";
|
|
11720
11777
|
if (first.trim().length === 0) return none();
|
|
11721
|
-
const alike = nearestLike(
|
|
11778
|
+
const alike = nearestLike(lines, first, wanted.start);
|
|
11722
11779
|
return alike === void 0 ? none() : some({
|
|
11723
11780
|
side: wanted.side,
|
|
11724
11781
|
start: alike,
|
|
11725
11782
|
end: alike
|
|
11726
11783
|
});
|
|
11727
11784
|
};
|
|
11728
|
-
|
|
11785
|
+
againIn = (lines, wanted) => orElse(exactlyIn(lines, wanted), () => alikeIn(lines, wanted));
|
|
11786
|
+
foundExactly = (patch, wanted) => exactlyIn(sideLines(patch, wanted.side), wanted);
|
|
11787
|
+
sourceLines = (source) => source.map((text, at) => ({
|
|
11788
|
+
line: at + 1,
|
|
11789
|
+
text
|
|
11790
|
+
}));
|
|
11791
|
+
foundInScope = (source, wanted) => {
|
|
11792
|
+
const outer = enclosedBy(source);
|
|
11793
|
+
const scope = outer[Math.max(1, Math.min(wanted.start, source.length)) - 1] ?? 0;
|
|
11794
|
+
const inScope = sourceLines(source).filter((here) => (outer[here.line - 1] ?? 0) === scope);
|
|
11795
|
+
return againIn(inScope, wanted);
|
|
11796
|
+
};
|
|
11797
|
+
}));
|
|
11798
|
+
//#endregion
|
|
11799
|
+
//#region src/domain/patch/follow.ts
|
|
11800
|
+
var MARKER, countOf$1, spansOf$2, changedAt, isBefore, isInside, landing, insertedWithin, within, followed;
|
|
11801
|
+
var init_follow = __esmMin((() => {
|
|
11802
|
+
MARKER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;
|
|
11803
|
+
countOf$1 = (said) => said === void 0 ? 1 : Number(said);
|
|
11804
|
+
spansOf$2 = (diff) => diff.hunks.flatMap((hunk) => {
|
|
11805
|
+
const found = MARKER.exec(hunk.marker);
|
|
11806
|
+
if (found === null) return [];
|
|
11807
|
+
return [{
|
|
11808
|
+
oldStart: Number(found[1]),
|
|
11809
|
+
oldCount: countOf$1(found[2]),
|
|
11810
|
+
newStart: Number(found[3]),
|
|
11811
|
+
newCount: countOf$1(found[4])
|
|
11812
|
+
}];
|
|
11813
|
+
});
|
|
11814
|
+
changedAt = (span) => span.newCount > 0 ? span.newStart : span.newStart + 1;
|
|
11815
|
+
isBefore = (span, line) => span.oldCount > 0 ? line < span.oldStart : line <= span.oldStart;
|
|
11816
|
+
isInside = (span, line) => span.oldCount > 0 && line >= span.oldStart && line < span.oldStart + span.oldCount;
|
|
11817
|
+
landing = (spans, line) => {
|
|
11818
|
+
let shift = 0;
|
|
11819
|
+
for (const span of spans) {
|
|
11820
|
+
if (isBefore(span, line)) return {
|
|
11821
|
+
line: line + shift,
|
|
11822
|
+
touched: false
|
|
11823
|
+
};
|
|
11824
|
+
if (isInside(span, line)) return {
|
|
11825
|
+
line: changedAt(span),
|
|
11826
|
+
touched: true
|
|
11827
|
+
};
|
|
11828
|
+
shift += span.newCount - span.oldCount;
|
|
11829
|
+
}
|
|
11830
|
+
return {
|
|
11831
|
+
line: line + shift,
|
|
11832
|
+
touched: false
|
|
11833
|
+
};
|
|
11834
|
+
};
|
|
11835
|
+
insertedWithin = (spans, start, end) => spans.some((span) => span.oldCount === 0 && span.oldStart >= start && span.oldStart < end);
|
|
11836
|
+
within = (line, length) => Math.max(1, Math.min(line, Math.max(1, length)));
|
|
11837
|
+
followed = (diff, range, length) => {
|
|
11838
|
+
const spans = spansOf$2(diff);
|
|
11839
|
+
const first = landing(spans, range.start);
|
|
11840
|
+
const last = landing(spans, range.end);
|
|
11841
|
+
return {
|
|
11842
|
+
start: within(first.line, length),
|
|
11843
|
+
end: within(Math.max(first.line, last.line), length),
|
|
11844
|
+
outdated: first.touched || last.touched || insertedWithin(spans, range.start, range.end) || spans.some((span) => span.oldCount > 0 && span.oldStart > range.start && span.oldStart < range.end)
|
|
11845
|
+
};
|
|
11846
|
+
};
|
|
11729
11847
|
}));
|
|
11730
11848
|
//#endregion
|
|
11731
11849
|
//#region src/domain/patch/reindent.ts
|
|
@@ -12032,66 +12150,10 @@ var init_parse = __esmMin((() => {
|
|
|
12032
12150
|
};
|
|
12033
12151
|
}));
|
|
12034
12152
|
//#endregion
|
|
12035
|
-
//#region src/domain/patch/sticky.ts
|
|
12036
|
-
var CLOSER, COMMENT, LOOKAHEAD, indentOf, pinnable, limitFrom, enclosing, read$3, enclosedBy, scopeLines, stickyChain, kept;
|
|
12037
|
-
var init_sticky = __esmMin((() => {
|
|
12038
|
-
CLOSER = /^[)\]}>;,]/;
|
|
12039
|
-
COMMENT = /^(\/\/|\/\*|\*|#|<!--)/;
|
|
12040
|
-
LOOKAHEAD = 5;
|
|
12041
|
-
indentOf = (text) => text.length - text.trimStart().length;
|
|
12042
|
-
pinnable = (text) => {
|
|
12043
|
-
const trimmed = text.trim();
|
|
12044
|
-
if (trimmed.length === 0) return false;
|
|
12045
|
-
return !CLOSER.test(trimmed) && !COMMENT.test(trimmed);
|
|
12046
|
-
};
|
|
12047
|
-
limitFrom = (source, index) => {
|
|
12048
|
-
const here = source[index] ?? "";
|
|
12049
|
-
if (here.trim().length > 0) return indentOf(here);
|
|
12050
|
-
const ahead = source.slice(index, index + LOOKAHEAD).find((line) => line.trim().length > 0);
|
|
12051
|
-
return ahead === void 0 ? 0 : indentOf(ahead);
|
|
12052
|
-
};
|
|
12053
|
-
enclosing = (source) => {
|
|
12054
|
-
const open = [];
|
|
12055
|
-
const found = [];
|
|
12056
|
-
source.forEach((text, index) => {
|
|
12057
|
-
const limit = limitFrom(source, index);
|
|
12058
|
-
const outer = open.findLast((at) => indentOf(source[at] ?? "") < limit);
|
|
12059
|
-
found.push(outer === void 0 ? 0 : outer + 1);
|
|
12060
|
-
if (!pinnable(text)) return;
|
|
12061
|
-
const indent = indentOf(text);
|
|
12062
|
-
while (open.length > 0 && indentOf(source[open.at(-1) ?? 0] ?? "") >= indent) open.pop();
|
|
12063
|
-
open.push(index);
|
|
12064
|
-
});
|
|
12065
|
-
return found;
|
|
12066
|
-
};
|
|
12067
|
-
read$3 = /* @__PURE__ */ new WeakMap();
|
|
12068
|
-
enclosedBy = (source) => {
|
|
12069
|
-
const known = read$3.get(source);
|
|
12070
|
-
if (known !== void 0) return known;
|
|
12071
|
-
const found = enclosing(source);
|
|
12072
|
-
read$3.set(source, found);
|
|
12073
|
-
return found;
|
|
12074
|
-
};
|
|
12075
|
-
scopeLines = (source) => [...new Set(enclosedBy(source).filter((line) => line > 0))].toSorted((left, right) => left - right);
|
|
12076
|
-
stickyChain = (source, line, max) => {
|
|
12077
|
-
const index = line - 1;
|
|
12078
|
-
if (index <= 0 || index >= source.length) return [];
|
|
12079
|
-
const outer = enclosedBy(source);
|
|
12080
|
-
const chain = [];
|
|
12081
|
-
for (let at = outer[index] ?? 0; at > 0; at = outer[at - 1] ?? 0) chain.push(source[at - 1] ?? "");
|
|
12082
|
-
return kept(chain.toReversed(), max);
|
|
12083
|
-
};
|
|
12084
|
-
kept = (chain, max) => {
|
|
12085
|
-
if (chain.length <= max || max < 2) return chain.slice(0, max);
|
|
12086
|
-
const outer = chain[0] ?? "";
|
|
12087
|
-
const inner = chain.slice(chain.length - (max - 1));
|
|
12088
|
-
return [`${outer} ⋯`, ...inner];
|
|
12089
|
-
};
|
|
12090
|
-
}));
|
|
12091
|
-
//#endregion
|
|
12092
12153
|
//#region src/domain/patch/index.ts
|
|
12093
12154
|
var init_patch = __esmMin((() => {
|
|
12094
12155
|
init_anchor();
|
|
12156
|
+
init_follow();
|
|
12095
12157
|
init_parse();
|
|
12096
12158
|
init_sticky();
|
|
12097
12159
|
init_model$5();
|
|
@@ -12297,11 +12359,12 @@ var init_service$2 = __esmMin((() => {
|
|
|
12297
12359
|
});
|
|
12298
12360
|
findKept = fn("Git.kept")(function* (worktree, blob) {
|
|
12299
12361
|
if (blob.length === 0) return none();
|
|
12362
|
+
const named = blob.includes(":") ? blob : `${blob}^{blob}`;
|
|
12300
12363
|
const found = (yield* gitOrEmpty(worktree.path, [
|
|
12301
12364
|
"rev-parse",
|
|
12302
12365
|
"--verify",
|
|
12303
12366
|
"--quiet",
|
|
12304
|
-
|
|
12367
|
+
named
|
|
12305
12368
|
])).trim();
|
|
12306
12369
|
return found.length === 0 ? none() : some(found);
|
|
12307
12370
|
});
|
|
@@ -12523,7 +12586,8 @@ var init_schema = __esmMin((() => {
|
|
|
12523
12586
|
snippet: String$1,
|
|
12524
12587
|
side: Side,
|
|
12525
12588
|
start: Int,
|
|
12526
|
-
end: Int
|
|
12589
|
+
end: Int,
|
|
12590
|
+
version: optionalKey(String$1)
|
|
12527
12591
|
});
|
|
12528
12592
|
StoredComment = Struct({
|
|
12529
12593
|
id: String$1,
|
|
@@ -13378,7 +13442,7 @@ var init_branches$1 = __esmMin((() => {
|
|
|
13378
13442
|
}));
|
|
13379
13443
|
//#endregion
|
|
13380
13444
|
//#region src/review/patches.ts
|
|
13381
|
-
var findPatch, blobOf, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
|
|
13445
|
+
var findPatch, blobOf, anchorWith, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
|
|
13382
13446
|
var init_patches = __esmMin((() => {
|
|
13383
13447
|
init_dist();
|
|
13384
13448
|
init_patch();
|
|
@@ -13387,7 +13451,7 @@ var init_patches = __esmMin((() => {
|
|
|
13387
13451
|
init_branches$1();
|
|
13388
13452
|
findPatch = (patches, file) => fromNullishOr(patches.find((patch) => patch.path === file));
|
|
13389
13453
|
blobOf = (patches, file) => map$5(findPatch(patches, file), (patch) => patch.blob);
|
|
13390
|
-
|
|
13454
|
+
anchorWith = fn("Review.Diff.anchorWith")(function* (worktree, request) {
|
|
13391
13455
|
const only = yield* patches(worktree, WHOLE_FILE, request.file);
|
|
13392
13456
|
const found = only.length > 0 ? only : yield* patches(worktree, WHOLE_FILE);
|
|
13393
13457
|
const patch = findPatch(found, request.file);
|
|
@@ -13405,9 +13469,13 @@ var init_patches = __esmMin((() => {
|
|
|
13405
13469
|
start: request.start,
|
|
13406
13470
|
end: request.end
|
|
13407
13471
|
}),
|
|
13408
|
-
onSome: succeed$1
|
|
13472
|
+
onSome: (made) => succeed$1({
|
|
13473
|
+
anchor: made,
|
|
13474
|
+
patch: resolved
|
|
13475
|
+
})
|
|
13409
13476
|
});
|
|
13410
13477
|
});
|
|
13478
|
+
anchor = (worktree, request) => map$1(anchorWith(worktree, request), (found) => found.anchor);
|
|
13411
13479
|
list$4 = patches;
|
|
13412
13480
|
source = fn("Review.Diff.source")(function* (worktree, file) {
|
|
13413
13481
|
const found = yield* (yield* Git).source(worktree, file);
|
|
@@ -13686,8 +13754,150 @@ var init_layers$1 = __esmMin((() => {
|
|
|
13686
13754
|
init_model$3();
|
|
13687
13755
|
}));
|
|
13688
13756
|
//#endregion
|
|
13757
|
+
//#region src/review/placing.ts
|
|
13758
|
+
var keptOf, baseOf, nowOnNew, nowOnOld, writtenName, unplaced, rewordedAt, standing, searched, keyOf$3, pairOf, unique$1, nowFor, placedWithout, placedThrough, placedFrom, placeOne, nowsOf, writtenOf, pairsOf, diffsOf, placedAll, versionOf;
|
|
13759
|
+
var init_placing = __esmMin((() => {
|
|
13760
|
+
init_dist();
|
|
13761
|
+
init_patch();
|
|
13762
|
+
init_git();
|
|
13763
|
+
keptOf = (found) => getOrElse(found, () => []);
|
|
13764
|
+
baseOf = (worktree) => worktree.base.length > 0 ? worktree.base : "HEAD";
|
|
13765
|
+
nowOnNew = fn("Review.Placing.nowOnNew")(function* (worktree, patch) {
|
|
13766
|
+
const git = yield* Git;
|
|
13767
|
+
if (patch.status === "deleted") return {
|
|
13768
|
+
version: none(),
|
|
13769
|
+
lines: []
|
|
13770
|
+
};
|
|
13771
|
+
const lines = keptOf(yield* git.source(worktree, patch.path));
|
|
13772
|
+
const [version] = yield* git.keep(worktree, [patch.path]);
|
|
13773
|
+
return {
|
|
13774
|
+
version: fromNullishOr(version),
|
|
13775
|
+
lines
|
|
13776
|
+
};
|
|
13777
|
+
});
|
|
13778
|
+
nowOnOld = fn("Review.Placing.nowOnOld")(function* (worktree, patch) {
|
|
13779
|
+
const git = yield* Git;
|
|
13780
|
+
if (patch.status === "added") return {
|
|
13781
|
+
version: none(),
|
|
13782
|
+
lines: []
|
|
13783
|
+
};
|
|
13784
|
+
const named = `${baseOf(worktree)}:${patch.previousPath}`;
|
|
13785
|
+
const version = yield* git.kept(worktree, named);
|
|
13786
|
+
return {
|
|
13787
|
+
version,
|
|
13788
|
+
lines: isNone(version) ? [] : keptOf(yield* git.blob(worktree, patch.previousPath))
|
|
13789
|
+
};
|
|
13790
|
+
});
|
|
13791
|
+
writtenName = (anchor) => anchor.version ?? (anchor.side === "new" ? anchor.blob : "");
|
|
13792
|
+
unplaced = (anchor) => ({
|
|
13793
|
+
start: anchor.start,
|
|
13794
|
+
end: anchor.end,
|
|
13795
|
+
placed: false,
|
|
13796
|
+
outdated: false,
|
|
13797
|
+
reworded: false
|
|
13798
|
+
});
|
|
13799
|
+
rewordedAt = (anchor, lines, start, end) => {
|
|
13800
|
+
const first = anchor.snippet.split("\n")[0] ?? "";
|
|
13801
|
+
if (first.trim().length === 0) return false;
|
|
13802
|
+
return lines.slice(start - 1, end).some((line) => line === first || isNear(line, first));
|
|
13803
|
+
};
|
|
13804
|
+
standing = (anchor) => ({
|
|
13805
|
+
...unplaced(anchor),
|
|
13806
|
+
placed: true
|
|
13807
|
+
});
|
|
13808
|
+
searched = (anchor, now) => match$3(foundInScope(now.lines, anchor), {
|
|
13809
|
+
onNone: () => unplaced(anchor),
|
|
13810
|
+
onSome: (range) => ({
|
|
13811
|
+
start: range.start,
|
|
13812
|
+
end: range.end,
|
|
13813
|
+
placed: true,
|
|
13814
|
+
outdated: true,
|
|
13815
|
+
reworded: rewordedAt(anchor, now.lines, range.start, range.end)
|
|
13816
|
+
})
|
|
13817
|
+
});
|
|
13818
|
+
keyOf$3 = (anchor) => `${anchor.side}\u0000${anchor.path}`;
|
|
13819
|
+
pairOf = (from, to) => `${from}..${to}`;
|
|
13820
|
+
unique$1 = (keys) => [...new Set(keys)];
|
|
13821
|
+
nowFor = (anchor, read) => {
|
|
13822
|
+
const now = read.nows.get(keyOf$3(anchor));
|
|
13823
|
+
return now === void 0 || isNone(now.version) ? none() : some(now);
|
|
13824
|
+
};
|
|
13825
|
+
placedWithout = (anchor, now) => anchor.snippet.trim().length === 0 ? standing(anchor) : searched(anchor, now);
|
|
13826
|
+
placedThrough = (anchor, now, diff) => {
|
|
13827
|
+
const moved = followed(diff, anchor, now.lines.length);
|
|
13828
|
+
return {
|
|
13829
|
+
...moved,
|
|
13830
|
+
placed: true,
|
|
13831
|
+
reworded: moved.outdated && rewordedAt(anchor, now.lines, moved.start, moved.end)
|
|
13832
|
+
};
|
|
13833
|
+
};
|
|
13834
|
+
placedFrom = (anchor, now, was, read) => {
|
|
13835
|
+
const version = getOrElse(now.version, () => was);
|
|
13836
|
+
if (was === version) return standing(anchor);
|
|
13837
|
+
const diff = read.diffs.get(pairOf(was, version));
|
|
13838
|
+
return diff === void 0 ? standing(anchor) : placedThrough(anchor, now, diff);
|
|
13839
|
+
};
|
|
13840
|
+
placeOne = (anchor, read) => {
|
|
13841
|
+
if (anchor.start === 1e5) return unplaced(anchor);
|
|
13842
|
+
return match$3(nowFor(anchor, read), {
|
|
13843
|
+
onNone: () => unplaced(anchor),
|
|
13844
|
+
onSome: (now) => match$3(read.written.get(writtenName(anchor)) ?? none(), {
|
|
13845
|
+
onNone: () => placedWithout(anchor, now),
|
|
13846
|
+
onSome: (was) => placedFrom(anchor, now, was, read)
|
|
13847
|
+
})
|
|
13848
|
+
});
|
|
13849
|
+
};
|
|
13850
|
+
nowsOf = (worktree, byPath, shown) => {
|
|
13851
|
+
const nowOf = (anchor, patch) => {
|
|
13852
|
+
const reading = anchor.side === "new" ? nowOnNew(worktree, patch) : nowOnOld(worktree, patch);
|
|
13853
|
+
return map$1(reading, (now) => [keyOf$3(anchor), now]);
|
|
13854
|
+
};
|
|
13855
|
+
const reads = [...new Map(shown.map((anchor) => [keyOf$3(anchor), anchor])).values()].flatMap((anchor) => {
|
|
13856
|
+
const patch = byPath.get(anchor.path);
|
|
13857
|
+
return patch === void 0 ? [] : [nowOf(anchor, patch)];
|
|
13858
|
+
});
|
|
13859
|
+
return map$1(all(reads, { concurrency: 8 }), (found) => new Map(found));
|
|
13860
|
+
};
|
|
13861
|
+
writtenOf = fn("Review.Placing.writtenOf")(function* (worktree, shown) {
|
|
13862
|
+
const git = yield* Git;
|
|
13863
|
+
const names = unique$1(shown.map(writtenName).filter((name) => name.length > 0));
|
|
13864
|
+
const keptOne = (name) => map$1(git.kept(worktree, name), (found) => [name, found]);
|
|
13865
|
+
return new Map(yield* forEach(names, keptOne, { concurrency: 8 }));
|
|
13866
|
+
});
|
|
13867
|
+
pairsOf = (shown, read) => shown.flatMap((anchor) => {
|
|
13868
|
+
const was = read.written.get(writtenName(anchor)) ?? none();
|
|
13869
|
+
const now = read.nows.get(keyOf$3(anchor))?.version ?? none();
|
|
13870
|
+
if (isNone(was) || isNone(now) || was.value === now.value) return [];
|
|
13871
|
+
return [[was.value, now.value]];
|
|
13872
|
+
});
|
|
13873
|
+
diffsOf = fn("Review.Placing.diffsOf")(function* (worktree, pairs) {
|
|
13874
|
+
const git = yield* Git;
|
|
13875
|
+
const between = ([from, to]) => map$1(git.between(worktree, from, to, 0), (raw) => [pairOf(from, to), parsePatches(raw)[0]]);
|
|
13876
|
+
const wanted = [...new Map(pairs.map((pair) => [pairOf(pair[0], pair[1]), pair])).values()];
|
|
13877
|
+
return new Map(yield* forEach(wanted, between, { concurrency: 8 }));
|
|
13878
|
+
});
|
|
13879
|
+
placedAll = fn("Review.Placing.placedAll")(function* (worktree, patches, anchors) {
|
|
13880
|
+
const byPath = new Map(patches.map((patch) => [patch.path, patch]));
|
|
13881
|
+
const shown = anchors.filter((anchor) => byPath.has(anchor.path) && anchor.start !== 1e5);
|
|
13882
|
+
const nows = yield* nowsOf(worktree, byPath, shown);
|
|
13883
|
+
const written = yield* writtenOf(worktree, shown);
|
|
13884
|
+
const read = {
|
|
13885
|
+
nows,
|
|
13886
|
+
written,
|
|
13887
|
+
diffs: yield* diffsOf(worktree, pairsOf(shown, {
|
|
13888
|
+
nows,
|
|
13889
|
+
written
|
|
13890
|
+
}))
|
|
13891
|
+
};
|
|
13892
|
+
return anchors.map((anchor) => byPath.has(anchor.path) ? placeOne(anchor, read) : unplaced(anchor));
|
|
13893
|
+
});
|
|
13894
|
+
versionOf = fn("Review.Placing.versionOf")(function* (worktree, patch, side) {
|
|
13895
|
+
return (side === "new" ? yield* nowOnNew(worktree, patch) : yield* nowOnOld(worktree, patch)).version;
|
|
13896
|
+
});
|
|
13897
|
+
}));
|
|
13898
|
+
//#endregion
|
|
13689
13899
|
//#region src/review/comments.ts
|
|
13690
|
-
var POLL, bodyOf, saidTo, spunOf, sentOf, placedNow$
|
|
13900
|
+
var POLL, bodyOf, saidTo, spunOf, sentOf, placedNow$1, linesIn, trimmedLines, NAMES_SOMETHING, worthMatching, blockAt, wholeSnippetIn, stillInFile, foundOutsideTheHunks, flatten, listSent, submitMany, submit, without$2, reply, threadBefore, layerOver, layersOn, take, awaitTaken, markRead;
|
|
13691
13901
|
var init_comments$1 = __esmMin((() => {
|
|
13692
13902
|
init_dist();
|
|
13693
13903
|
init_patch();
|
|
@@ -13697,6 +13907,7 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13697
13907
|
init_error$2();
|
|
13698
13908
|
init_branches$1();
|
|
13699
13909
|
init_patches();
|
|
13910
|
+
init_placing();
|
|
13700
13911
|
POLL = "500 millis";
|
|
13701
13912
|
bodyOf = (entry) => entry.body;
|
|
13702
13913
|
saidTo = (spoken, id) => spoken.filter((entry) => entry.comment === id).length;
|
|
@@ -13731,6 +13942,8 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13731
13942
|
settled: Object.hasOwn(settled, comment.id),
|
|
13732
13943
|
removed: Object.hasOwn(removed, comment.id),
|
|
13733
13944
|
stale: comment.head !== head,
|
|
13945
|
+
outdated: comment.placed !== false && comment.outdated === true,
|
|
13946
|
+
reworded: comment.placed !== false && comment.reworded === true,
|
|
13734
13947
|
outside: !shown.has(comment.file) || comment.placed === false,
|
|
13735
13948
|
unread: Math.max(0, said.length - seen),
|
|
13736
13949
|
asks: last?.voice === "agent" && last.asks,
|
|
@@ -13743,33 +13956,33 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13743
13956
|
}))
|
|
13744
13957
|
};
|
|
13745
13958
|
};
|
|
13746
|
-
placedNow$
|
|
13747
|
-
const
|
|
13748
|
-
|
|
13749
|
-
|
|
13750
|
-
|
|
13751
|
-
|
|
13752
|
-
|
|
13753
|
-
|
|
13754
|
-
|
|
13755
|
-
};
|
|
13756
|
-
|
|
13757
|
-
|
|
13758
|
-
placed
|
|
13759
|
-
|
|
13760
|
-
return match$3(foundAgain(patch, comment), {
|
|
13761
|
-
onNone: () => ({
|
|
13959
|
+
placedNow$1 = fn("Review.Comment.placedNow")(function* (reading, held) {
|
|
13960
|
+
const anchors = held.map((comment) => ({
|
|
13961
|
+
path: comment.file,
|
|
13962
|
+
side: comment.side,
|
|
13963
|
+
start: comment.start,
|
|
13964
|
+
end: comment.end,
|
|
13965
|
+
snippet: comment.snippet,
|
|
13966
|
+
blob: comment.blob ?? "",
|
|
13967
|
+
version: comment.version
|
|
13968
|
+
}));
|
|
13969
|
+
const placed = yield* placedAll(reading.worktree, reading.patches, anchors);
|
|
13970
|
+
return held.map((comment, at) => {
|
|
13971
|
+
const sits = placed[at];
|
|
13972
|
+
if (sits === void 0) return {
|
|
13762
13973
|
...comment,
|
|
13763
13974
|
placed: false
|
|
13764
|
-
}
|
|
13765
|
-
|
|
13975
|
+
};
|
|
13976
|
+
return {
|
|
13766
13977
|
...comment,
|
|
13767
|
-
start:
|
|
13768
|
-
end:
|
|
13769
|
-
placed:
|
|
13770
|
-
|
|
13978
|
+
start: sits.start,
|
|
13979
|
+
end: sits.end,
|
|
13980
|
+
placed: sits.placed,
|
|
13981
|
+
outdated: sits.outdated,
|
|
13982
|
+
reworded: sits.reworded
|
|
13983
|
+
};
|
|
13771
13984
|
});
|
|
13772
|
-
};
|
|
13985
|
+
});
|
|
13773
13986
|
linesIn = (found) => getOrElse(found, () => []);
|
|
13774
13987
|
trimmedLines = (snippet) => snippet.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
13775
13988
|
NAMES_SOMETHING = /[A-Za-z0-9_$]{3}/;
|
|
@@ -13813,6 +14026,8 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13813
14026
|
start: comment.anchor.start,
|
|
13814
14027
|
end: comment.anchor.end,
|
|
13815
14028
|
snippet: comment.anchor.snippet,
|
|
14029
|
+
blob: comment.anchor.blob,
|
|
14030
|
+
version: comment.anchor.version,
|
|
13816
14031
|
body: comment.body,
|
|
13817
14032
|
replyTo: comment.replyTo,
|
|
13818
14033
|
...comment.theirs === true ? { theirs: true } : {},
|
|
@@ -13824,7 +14039,7 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13824
14039
|
const spoken = yield* store.answers(worktree.path);
|
|
13825
14040
|
const current = yield* store.state(worktree.path);
|
|
13826
14041
|
const shown = new Set(reading.patches.map((patch) => patch.path));
|
|
13827
|
-
const placed = flatten(yield* store.inbox(worktree.path))
|
|
14042
|
+
const placed = yield* placedNow$1(reading, flatten(yield* store.inbox(worktree.path)));
|
|
13828
14043
|
const held = yield* foundOutsideTheHunks(worktree, placed, shown);
|
|
13829
14044
|
const replies = held.filter((comment) => comment.replyTo !== void 0);
|
|
13830
14045
|
const conversation = {
|
|
@@ -13842,10 +14057,17 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13842
14057
|
submitMany = fn("Review.Comment.submitMany")(function* (worktree, requests) {
|
|
13843
14058
|
const store = yield* Store;
|
|
13844
14059
|
const anchoring = fn("Review.Comment.anchoring")(function* (request) {
|
|
13845
|
-
const anchored = yield*
|
|
14060
|
+
const { patch, anchor: anchored } = yield* anchorWith(worktree, request);
|
|
14061
|
+
const version = yield* versionOf(worktree, patch, anchored.side);
|
|
13846
14062
|
return {
|
|
13847
14063
|
id: request.id,
|
|
13848
|
-
anchor:
|
|
14064
|
+
anchor: match$3(version, {
|
|
14065
|
+
onNone: () => anchored,
|
|
14066
|
+
onSome: (kept) => ({
|
|
14067
|
+
...anchored,
|
|
14068
|
+
version: kept
|
|
14069
|
+
})
|
|
14070
|
+
}),
|
|
13849
14071
|
body: request.body,
|
|
13850
14072
|
...request.remark === void 0 ? {} : { remark: request.remark },
|
|
13851
14073
|
...request.theirs === true ? { theirs: true } : {},
|
|
@@ -13959,12 +14181,12 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13959
14181
|
}));
|
|
13960
14182
|
//#endregion
|
|
13961
14183
|
//#region src/review/threads.ts
|
|
13962
|
-
var stateOf$2,
|
|
14184
|
+
var stateOf$2, choicesOf, answerOf, turnsOf, threadOf, threadsIn$1, idsIn, rootIn, rootOf, isKnown, known, list$3, clearDoing, doing, answer$3, repliesTo, settle, without$1, unsettle, remove, restore$1, settleRead;
|
|
13963
14185
|
var init_threads$1 = __esmMin((() => {
|
|
13964
14186
|
init_dist();
|
|
13965
|
-
init_patch();
|
|
13966
14187
|
init_store();
|
|
13967
14188
|
init_error$2();
|
|
14189
|
+
init_placing();
|
|
13968
14190
|
stateOf$2 = (turns, asked, isSettled, isRemoved) => {
|
|
13969
14191
|
if (isRemoved) return "removed";
|
|
13970
14192
|
if (isSettled) return "done";
|
|
@@ -13972,27 +14194,6 @@ var init_threads$1 = __esmMin((() => {
|
|
|
13972
14194
|
if (last === void 0 || last.voice === "reviewer") return "sent";
|
|
13973
14195
|
return asked ? "question" : "answered";
|
|
13974
14196
|
};
|
|
13975
|
-
placedNow$1 = (patches, anchor) => {
|
|
13976
|
-
const patch = patches.find((candidate) => candidate.path === anchor.path);
|
|
13977
|
-
if (patch === void 0) return {
|
|
13978
|
-
...anchor,
|
|
13979
|
-
placed: false
|
|
13980
|
-
};
|
|
13981
|
-
if (anchor.snippet.trim().length === 0) return {
|
|
13982
|
-
...anchor,
|
|
13983
|
-
placed: true
|
|
13984
|
-
};
|
|
13985
|
-
return match$3(foundAgain(patch, anchor), {
|
|
13986
|
-
onNone: () => ({
|
|
13987
|
-
...anchor,
|
|
13988
|
-
placed: false
|
|
13989
|
-
}),
|
|
13990
|
-
onSome: (range) => ({
|
|
13991
|
-
...range,
|
|
13992
|
-
placed: true
|
|
13993
|
-
})
|
|
13994
|
-
});
|
|
13995
|
-
};
|
|
13996
14197
|
choicesOf = (entry) => entry.choices === void 0 ? {} : { choices: entry.choices };
|
|
13997
14198
|
answerOf = (entry) => ({
|
|
13998
14199
|
body: entry.body,
|
|
@@ -14017,7 +14218,12 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14017
14218
|
const seen = [...ids].reduce((total, id) => total + (conversation.read[id] ?? 0), 0);
|
|
14018
14219
|
const turns = turnsOf(replies, mine);
|
|
14019
14220
|
const settled = Object.hasOwn(conversation.settled, comment.id);
|
|
14020
|
-
const sits =
|
|
14221
|
+
const sits = conversation.places.get(comment.id) ?? {
|
|
14222
|
+
...comment.anchor,
|
|
14223
|
+
placed: false,
|
|
14224
|
+
outdated: false,
|
|
14225
|
+
reworded: false
|
|
14226
|
+
};
|
|
14021
14227
|
const doing = conversation.doing[comment.id];
|
|
14022
14228
|
return {
|
|
14023
14229
|
id: comment.id,
|
|
@@ -14030,6 +14236,7 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14030
14236
|
at: batch.at,
|
|
14031
14237
|
state: stateOf$2(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(conversation.removed, comment.id)),
|
|
14032
14238
|
stale: batch.head !== conversation.head,
|
|
14239
|
+
outdated: sits.placed && sits.outdated,
|
|
14033
14240
|
outside: !conversation.shown.has(comment.anchor.path) || !sits.placed,
|
|
14034
14241
|
unread: Math.max(0, mine.length - seen),
|
|
14035
14242
|
taken: [...ids].some((id) => Object.hasOwn(conversation.taken, id)),
|
|
@@ -14067,13 +14274,22 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14067
14274
|
const store = yield* Store;
|
|
14068
14275
|
const { worktree, patches } = reading;
|
|
14069
14276
|
const current = yield* store.state(worktree.path);
|
|
14070
|
-
|
|
14277
|
+
const batches = yield* store.inbox(worktree.path);
|
|
14278
|
+
const roots = batches.flatMap((batch) => batch.comments).filter((comment) => comment.replyTo === void 0);
|
|
14279
|
+
const placed = yield* placedAll(worktree, patches, roots.map((comment) => comment.anchor));
|
|
14280
|
+
const places = new Map(roots.map((comment, at) => [comment.id, placed[at] ?? {
|
|
14281
|
+
...comment.anchor,
|
|
14282
|
+
placed: false,
|
|
14283
|
+
outdated: false,
|
|
14284
|
+
reworded: false
|
|
14285
|
+
}]));
|
|
14286
|
+
return threadsIn$1(batches, {
|
|
14071
14287
|
answers: yield* store.answers(worktree.path),
|
|
14072
14288
|
settled: current.settled,
|
|
14073
14289
|
removed: current.removed,
|
|
14074
14290
|
head: worktree.head,
|
|
14075
14291
|
shown: new Set(patches.map((patch) => patch.path)),
|
|
14076
|
-
|
|
14292
|
+
places,
|
|
14077
14293
|
read: current.read,
|
|
14078
14294
|
taken: current.taken ?? {},
|
|
14079
14295
|
doing: current.doing
|
|
@@ -17531,7 +17747,7 @@ var init_match = __esmMin((() => {
|
|
|
17531
17747
|
}));
|
|
17532
17748
|
//#endregion
|
|
17533
17749
|
//#region src/tui/state.ts
|
|
17534
|
-
var HOLDS$1, chosenNow, withChosen, EDITOR_ROW, editorRow, preferenceRows, nothingReviewed, nothingFound, initialState, selectedBranch, selectedPatch, pullHere, authorHere, theirPull, heldWhere, noteEditing, hasNoPull, onLayers, selectedLayer;
|
|
17750
|
+
var HOLDS$1, chosenNow, withChosen, EDITOR_ROW, editorRow, preferenceRows, nothingReviewed, nothingFound, initialState, selectedBranch, selectedPatch, pullHere, authorHere, theirPull, heldWhere, noteEditing, hasNoPull, onLayers, selectedLayer, movedPast;
|
|
17535
17751
|
var init_state = __esmMin((() => {
|
|
17536
17752
|
init_preferences$1();
|
|
17537
17753
|
init_gaps();
|
|
@@ -17679,6 +17895,7 @@ var init_state = __esmMin((() => {
|
|
|
17679
17895
|
hasNoPull = (state) => state.forge === "answered" && pullHere(state).length === 0;
|
|
17680
17896
|
onLayers = (state) => state.rail === "layers" && state.layers.length > 0;
|
|
17681
17897
|
selectedLayer = (state) => state.layers[state.layerIndex];
|
|
17898
|
+
movedPast = (comment) => comment.outside === true || comment.outdated === true && comment.reworded !== true;
|
|
17682
17899
|
}));
|
|
17683
17900
|
//#endregion
|
|
17684
17901
|
//#region src/tui/cursor.ts
|
|
@@ -18315,6 +18532,7 @@ var init_layerview = __esmMin((() => {
|
|
|
18315
18532
|
//#region src/tui/panel.ts
|
|
18316
18533
|
var PANEL_SECTIONS, answersIn, newerOf, lastVoice, SECTION_OF, outsideOpen, sectionOf, sentEntry, remarkRows, panelHolds, panelEntries, panelEntry, threadChosen, MINUTE, HOUR, DAY, agoText, threadStand, STAND_WEIGHT, louderOf;
|
|
18317
18534
|
var init_panel = __esmMin((() => {
|
|
18535
|
+
init_state();
|
|
18318
18536
|
PANEL_SECTIONS = [
|
|
18319
18537
|
"remarks",
|
|
18320
18538
|
"held",
|
|
@@ -18343,7 +18561,7 @@ var init_panel = __esmMin((() => {
|
|
|
18343
18561
|
answered: "answered",
|
|
18344
18562
|
waiting: "with"
|
|
18345
18563
|
};
|
|
18346
|
-
outsideOpen = (comment) => comment
|
|
18564
|
+
outsideOpen = (comment) => movedPast(comment) && comment.settled !== true && comment.removed !== true;
|
|
18347
18565
|
sectionOf = (comment) => outsideOpen(comment) ? "movedOn" : SECTION_OF[threadStand(comment)];
|
|
18348
18566
|
sentEntry = (state, comment) => {
|
|
18349
18567
|
const newer = newerOf(state, comment);
|
|
@@ -18478,7 +18696,7 @@ var init_notes = __esmMin((() => {
|
|
|
18478
18696
|
return asking.threads.flatMap((id) => {
|
|
18479
18697
|
const thread = state.sent.find((entry) => entry.id === id);
|
|
18480
18698
|
if (thread === void 0) return [];
|
|
18481
|
-
const where = thread
|
|
18699
|
+
const where = movedPast(thread) ? "not in the diff" : `line ${thread.end}`;
|
|
18482
18700
|
return [`${firstLineOf(thread.body)} · ${where}`];
|
|
18483
18701
|
});
|
|
18484
18702
|
};
|
|
@@ -18500,7 +18718,7 @@ var init_notes = __esmMin((() => {
|
|
|
18500
18718
|
const patch = selectedPatch(state);
|
|
18501
18719
|
const found = /* @__PURE__ */ new Map();
|
|
18502
18720
|
if (patch === void 0) return found;
|
|
18503
|
-
const here = [...state.sent, ...state.held].filter((entry) => entry.file === patch.path && entry.removed !== true && entry
|
|
18721
|
+
const here = [...state.sent, ...state.held].filter((entry) => entry.file === patch.path && entry.removed !== true && !movedPast(entry));
|
|
18504
18722
|
for (const entry of here) {
|
|
18505
18723
|
const stand = threadStand(entry);
|
|
18506
18724
|
for (const row of rowsUnder(patch, entry)) found.set(row, louderOf(stand, found.get(row) ?? "gone"));
|
|
@@ -18558,7 +18776,7 @@ var init_notes = __esmMin((() => {
|
|
|
18558
18776
|
commentRowsIn = (state, fileIndex) => {
|
|
18559
18777
|
const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
|
|
18560
18778
|
if (patch === void 0) return [];
|
|
18561
|
-
const notes = [...state.sent, ...state.held].filter((entry) => entry.file === patch.path && entry
|
|
18779
|
+
const notes = [...state.sent, ...state.held].filter((entry) => entry.file === patch.path && !movedPast(entry));
|
|
18562
18780
|
return patch.rows.filter((row) => notes.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index).toSorted((left, right) => left - right);
|
|
18563
18781
|
};
|
|
18564
18782
|
draftPlace = (state) => {
|
|
@@ -18580,7 +18798,7 @@ var init_notes = __esmMin((() => {
|
|
|
18580
18798
|
stop: drawn.filter((one) => one.side === note.side && one.end === note.end && drawn.indexOf(one) <= at).length
|
|
18581
18799
|
};
|
|
18582
18800
|
};
|
|
18583
|
-
notesShown = (state, path) => [...state.sent.filter((one) => one.file === path && one.removed !== true && one
|
|
18801
|
+
notesShown = (state, path) => [...state.sent.filter((one) => one.file === path && one.removed !== true && !movedPast(one)).map((one) => ({
|
|
18584
18802
|
id: one.id,
|
|
18585
18803
|
side: one.side,
|
|
18586
18804
|
end: one.end
|
|
@@ -18593,7 +18811,7 @@ var init_notes = __esmMin((() => {
|
|
|
18593
18811
|
const patch = selectedPatch(state);
|
|
18594
18812
|
const here = patch?.rows[row];
|
|
18595
18813
|
if (patch === void 0 || here === void 0) return [];
|
|
18596
|
-
return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && entry
|
|
18814
|
+
return state.sent.filter((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && !movedPast(entry) && lineOnSide(here, entry.side) === entry.end);
|
|
18597
18815
|
};
|
|
18598
18816
|
remarkShown = (remark) => remark.state === "waiting" && remark.placed;
|
|
18599
18817
|
remarksAtRow = (state, row) => {
|
|
@@ -18665,12 +18883,12 @@ var init_notes = __esmMin((() => {
|
|
|
18665
18883
|
const patch = selectedPatch(state);
|
|
18666
18884
|
const here = patch?.rows[row];
|
|
18667
18885
|
if (patch === void 0 || here === void 0) return void 0;
|
|
18668
|
-
return state.sent.find((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && entry
|
|
18886
|
+
return state.sent.find((entry) => entry.file === patch.path && entry.id !== void 0 && entry.removed !== true && !movedPast(entry) && lineOnSide(here, entry.side) === entry.end);
|
|
18669
18887
|
};
|
|
18670
18888
|
openCommentRows = (state) => {
|
|
18671
18889
|
const patch = selectedPatch(state);
|
|
18672
18890
|
if (patch === void 0) return [];
|
|
18673
|
-
const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true && entry
|
|
18891
|
+
const open = state.sent.filter((entry) => entry.file === patch.path && entry.settled !== true && entry.removed !== true && !movedPast(entry));
|
|
18674
18892
|
return patch.rows.filter((row) => open.some((note) => lineOnSide(row, note.side) === note.end) || state.remarks.some((one) => one.file === patch.path && remarkShown(one) && lineOnSide(row, one.side) === one.end)).map((row) => row.index);
|
|
18675
18893
|
};
|
|
18676
18894
|
filesWithComments = (state) => state.patches.flatMap((patch, index) => state.sent.some((entry) => entry.file === patch.path) || state.remarks.some((one) => one.file === patch.path && remarkShown(one)) ? [index] : []);
|
|
@@ -20503,7 +20721,7 @@ var init_diffview = __esmMin((() => {
|
|
|
20503
20721
|
return note.takenAt === void 0 ? `${marks().sent} sent` : `${marks().waiting} picked up ${agoText(note.takenAt, note.now)}`;
|
|
20504
20722
|
};
|
|
20505
20723
|
commentHead = (note) => {
|
|
20506
|
-
const moved = note.stale ? ", the branch moved on" : ""
|
|
20724
|
+
const moved = `${note.outdated === true ? " · outdated" : ""}${note.stale ? ", the branch moved on" : ""}`;
|
|
20507
20725
|
if (note.settled) return `${marks().done} settled${moved}`;
|
|
20508
20726
|
if (note.asks) return `${marks().asked} asked back${moved}`;
|
|
20509
20727
|
if (note.turns.at(-1)?.voice === "reviewer") return `${marks().waiting} replied${moved}`;
|
|
@@ -20729,7 +20947,7 @@ var init_notespane = __esmMin((() => {
|
|
|
20729
20947
|
notesOf = (comments, path, sent, shown = {
|
|
20730
20948
|
opened: [],
|
|
20731
20949
|
now: Date.now()
|
|
20732
|
-
}) => comments.filter((entry) => entry.file === path && entry
|
|
20950
|
+
}) => comments.filter((entry) => entry.file === path && !movedPast(entry)).toSorted((left, right) => (left.at ?? "").localeCompare(right.at ?? "")).map((entry) => ({
|
|
20733
20951
|
id: entry.id ?? "",
|
|
20734
20952
|
folded: entry.settled === true && !(entry.id !== void 0 && shown.opened.includes(entry.id)),
|
|
20735
20953
|
side: entry.side,
|
|
@@ -20738,6 +20956,7 @@ var init_notespane = __esmMin((() => {
|
|
|
20738
20956
|
sent,
|
|
20739
20957
|
settled: entry.settled === true,
|
|
20740
20958
|
stale: entry.stale === true,
|
|
20959
|
+
outdated: entry.outdated === true,
|
|
20741
20960
|
asks: entry.asks === true,
|
|
20742
20961
|
answers: entry.answers ?? [],
|
|
20743
20962
|
turns: entry.turns ?? [],
|
|
@@ -20817,7 +21036,9 @@ var init_panelpane = __esmMin((() => {
|
|
|
20817
21036
|
return remarkWhere(entry.remark, known);
|
|
20818
21037
|
}
|
|
20819
21038
|
const tail = entry.comment.rewritten === true ? " · rewritten by the agent" : entry.comment.draft === void 0 ? "" : " · asks to redraft";
|
|
20820
|
-
|
|
21039
|
+
if (movedPast(entry.comment)) return " · not in the diff";
|
|
21040
|
+
const changed = entry.comment.outdated === true ? " · outdated" : "";
|
|
21041
|
+
return `:${entry.comment.end}${changed}${tail}`;
|
|
20821
21042
|
};
|
|
20822
21043
|
panelFile = (entry) => {
|
|
20823
21044
|
if (entry.kind === "fold") return "";
|
|
@@ -20839,7 +21060,7 @@ var init_panelpane = __esmMin((() => {
|
|
|
20839
21060
|
if (entry.kind === "fold") return [];
|
|
20840
21061
|
return (entry.kind === "remark" ? entry.remark.code : (entry.comment.snippet ?? "").split("\n")).filter((line) => line.trim().length > 0);
|
|
20841
21062
|
};
|
|
20842
|
-
lostEntry = (state, entry) => entry.kind === "fold" ? false : entry.kind === "remark" ? !entry.remark.placed && state.patches.some((patch) => patch.path === entry.remark.file) : entry.comment.
|
|
21063
|
+
lostEntry = (state, entry) => entry.kind === "fold" ? false : entry.kind === "remark" ? !entry.remark.placed && state.patches.some((patch) => patch.path === entry.remark.file) : movedPast(entry.comment) || entry.comment.outdated === true;
|
|
20843
21064
|
writtenOn = (state, placed, room) => {
|
|
20844
21065
|
const { entry } = placed;
|
|
20845
21066
|
if (placed.at !== state.panelIndex || !lostEntry(state, entry)) return [];
|
|
@@ -23721,7 +23942,7 @@ var init_comments = __esmMin((() => {
|
|
|
23721
23942
|
}
|
|
23722
23943
|
yield* readRewrite(app, entry);
|
|
23723
23944
|
const at = app.state.patches.findIndex((patch) => patch.path === entry.comment.file);
|
|
23724
|
-
if (at === -1 || entry.comment
|
|
23945
|
+
if (at === -1 || movedPast(entry.comment)) {
|
|
23725
23946
|
yield* openAway(app, entry, at);
|
|
23726
23947
|
return;
|
|
23727
23948
|
}
|
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.195",
|
|
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": {
|