@eliya-oss/agent-diff 0.1.0-alpha.197 → 0.1.0-alpha.199
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 +34 -0
- package/dist/main.js +497 -139
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.199
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(CLI): a change `adiff serve` reports names the file adiff wrote, not `other`, so an agent looking for comments no longer makes a second client re-read the drafts and remarks twice a second.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
adiff writes each file of a review to a temporary name first and then moves it into place. The watch named that temporary file `other`, so every write, including the agent's half-second look for comments, also read as a change to something unknown.
|
|
12
|
+
|
|
13
|
+
</details>
|
|
14
|
+
|
|
15
|
+
## 0.1.0-alpha.198
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- feat(CLI): `comment list` gives every comment its mark (`stand`), its review panel `section`, `movedPast`, `about` for a request about the whole branch, `settleable` and the `layers` it is read in, and each file its loudest open mark.
|
|
20
|
+
|
|
21
|
+
feat(layers): `layers show` gives every layer its open comments and loudest mark, and a `parts` list with each file's own added and removed lines, read mark and open comments in that layer.
|
|
22
|
+
|
|
23
|
+
feat(CLI): `patch show` lists files in the terminal's tree order as `order`, and tags each row a layer holds with that layer.
|
|
24
|
+
|
|
25
|
+
feat(CLI): `review progress` names the layers whose lines changed since a file was marked reviewed.
|
|
26
|
+
|
|
27
|
+
feat(CLI): `file review` answers with the layers as they stand after the mark.
|
|
28
|
+
|
|
29
|
+
fix(layers rail): a file marked reviewed stays read in every layer whose lines did not change since, so a change in one layer's lines asks for a re-read only there.
|
|
30
|
+
|
|
31
|
+
feat(CLI): `comment send --from new:12 --to old:14` and `draft add` with the same options file a comment on the rows a reader picked, choosing the side as the terminal does.
|
|
32
|
+
|
|
33
|
+
feat(CLI): `patch since` tags each row with the layer that holds it, as `patch show` does.
|
|
34
|
+
|
|
35
|
+
feat(CLI): a review `adiff serve` watches names what changed (`comments`, `state`, `layers`, `watch`), so a second client re-reads only that instead of the whole review on every change, and never on an agent's half-second look for comments.
|
|
36
|
+
|
|
3
37
|
## 0.1.0-alpha.197
|
|
4
38
|
|
|
5
39
|
### 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.199";
|
|
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$1, based, repo, opening$2, file,
|
|
10294
|
+
var WAIT_MOST, worktreeOf$1, repoOf$1, branchOf, fieldsOption, addressing, baseOf$1, based, repo, opening$2, file, picking, 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 = {
|
|
@@ -10348,19 +10348,31 @@ var init_catalog = __esmMin((() => {
|
|
|
10348
10348
|
value: "path",
|
|
10349
10349
|
about: "File path as it appears in the diff"
|
|
10350
10350
|
};
|
|
10351
|
-
|
|
10351
|
+
picking = [
|
|
10352
10352
|
file,
|
|
10353
10353
|
{
|
|
10354
10354
|
name: "start",
|
|
10355
|
-
required:
|
|
10355
|
+
required: false,
|
|
10356
10356
|
value: "line",
|
|
10357
|
-
about: "First line of the range"
|
|
10357
|
+
about: "First line of the range, with --end"
|
|
10358
10358
|
},
|
|
10359
10359
|
{
|
|
10360
10360
|
name: "end",
|
|
10361
|
-
required:
|
|
10361
|
+
required: false,
|
|
10362
10362
|
value: "line",
|
|
10363
|
-
about: "Last line of the range"
|
|
10363
|
+
about: "Last line of the range, with --start"
|
|
10364
|
+
},
|
|
10365
|
+
{
|
|
10366
|
+
name: "from",
|
|
10367
|
+
required: false,
|
|
10368
|
+
value: "new|old:line",
|
|
10369
|
+
about: "The first row picked in the diff, as `new:12` or `old:40`. adiff chooses the side the terminal would: the new one when any picked row has a new line"
|
|
10370
|
+
},
|
|
10371
|
+
{
|
|
10372
|
+
name: "to",
|
|
10373
|
+
required: false,
|
|
10374
|
+
value: "new|old:line",
|
|
10375
|
+
about: "The last row picked, in the form of --from"
|
|
10364
10376
|
},
|
|
10365
10377
|
{
|
|
10366
10378
|
name: "body",
|
|
@@ -10372,7 +10384,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10372
10384
|
name: "side",
|
|
10373
10385
|
required: false,
|
|
10374
10386
|
value: "new|old",
|
|
10375
|
-
about: "Which version
|
|
10387
|
+
about: "Which version --start and --end count on. Defaults to new"
|
|
10376
10388
|
}
|
|
10377
10389
|
];
|
|
10378
10390
|
READ_A_BRANCH = "Read a branch";
|
|
@@ -10564,11 +10576,11 @@ var init_catalog = __esmMin((() => {
|
|
|
10564
10576
|
},
|
|
10565
10577
|
{
|
|
10566
10578
|
name: "comment send",
|
|
10567
|
-
about: "Send one comment against a line range, straight to the agent",
|
|
10579
|
+
about: "Send one comment against a line range, straight to the agent. Name the range with --start and --end, or with the rows a reader picked, --from and --to",
|
|
10568
10580
|
group: WRITE_COMMENTS,
|
|
10569
10581
|
addresses: "review",
|
|
10570
10582
|
safety: "write",
|
|
10571
|
-
options: [...addressing, ...
|
|
10583
|
+
options: [...addressing, ...picking],
|
|
10572
10584
|
dataKey: "batch",
|
|
10573
10585
|
example: "adiff comment send --repo . --branch add-invitations --file src/api.ts --start 4 --end 5 --body \"why\""
|
|
10574
10586
|
},
|
|
@@ -10727,11 +10739,11 @@ var init_catalog = __esmMin((() => {
|
|
|
10727
10739
|
},
|
|
10728
10740
|
{
|
|
10729
10741
|
name: "draft add",
|
|
10730
|
-
about: "Hold one comment against a line range, to be sent with the rest",
|
|
10742
|
+
about: "Hold one comment against a line range, to be sent with the rest. Name the range with --start and --end, or with the rows a reader picked, --from and --to",
|
|
10731
10743
|
group: DRAFTS,
|
|
10732
10744
|
addresses: "review",
|
|
10733
10745
|
safety: "write",
|
|
10734
|
-
options: [...addressing, ...
|
|
10746
|
+
options: [...addressing, ...picking],
|
|
10735
10747
|
dataKey: "draft",
|
|
10736
10748
|
example: "adiff draft add --repo . --branch their-change --file src/api.ts --start 4 --end 5 --body \"why\""
|
|
10737
10749
|
},
|
|
@@ -11126,7 +11138,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11126
11138
|
}));
|
|
11127
11139
|
//#endregion
|
|
11128
11140
|
//#region src/cli/parse.ts
|
|
11129
|
-
var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
|
|
11141
|
+
var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, numeric, SPOT, spot, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
|
|
11130
11142
|
var init_parse$1 = __esmMin((() => {
|
|
11131
11143
|
init_dist();
|
|
11132
11144
|
init_catalog();
|
|
@@ -11213,6 +11225,20 @@ var init_parse$1 = __esmMin((() => {
|
|
|
11213
11225
|
allowed: ["a whole number of 1 or more"]
|
|
11214
11226
|
});
|
|
11215
11227
|
});
|
|
11228
|
+
SPOT = /^(?<side>new|old):(?<line>[1-9]\d*)$/;
|
|
11229
|
+
spot = fn("Cli.spot")(function* (options, name) {
|
|
11230
|
+
const raw = yield* required(options, name);
|
|
11231
|
+
const found = SPOT.exec(raw)?.groups;
|
|
11232
|
+
const side = found?.["side"] === "old" ? "old" : "new";
|
|
11233
|
+
return yield* found === void 0 ? new BadOption({
|
|
11234
|
+
option: name,
|
|
11235
|
+
given: raw,
|
|
11236
|
+
allowed: ["new:<line>", "old:<line>"]
|
|
11237
|
+
}) : succeed$1({
|
|
11238
|
+
side,
|
|
11239
|
+
line: Number(found["line"])
|
|
11240
|
+
});
|
|
11241
|
+
});
|
|
11216
11242
|
WHOLE = "all";
|
|
11217
11243
|
around$1 = fn("Cli.around")(function* (options, name) {
|
|
11218
11244
|
const raw = options[name];
|
|
@@ -11504,7 +11530,7 @@ var init_report$1 = __esmMin((() => {
|
|
|
11504
11530
|
}));
|
|
11505
11531
|
//#endregion
|
|
11506
11532
|
//#region src/cli/serve.ts
|
|
11507
|
-
var Replies, toStdout, NOT_SERVED, SETTLE_MS$1, refused, write, answering, settled$1, watching, unwatching, readRequest, handled, listen, serve;
|
|
11533
|
+
var Replies, toStdout, NOT_SERVED, SETTLE_MS$1, refused, write, answering, KIND_OF, kindOf, settled$1, watching, unwatching, readRequest, handled, listen, serve;
|
|
11508
11534
|
var init_serve = __esmMin((() => {
|
|
11509
11535
|
init_dist();
|
|
11510
11536
|
init_error$5();
|
|
@@ -11540,21 +11566,41 @@ var init_serve = __esmMin((() => {
|
|
|
11540
11566
|
answer: JSON.parse(heard.at(-1) ?? "{}")
|
|
11541
11567
|
})), catchCause((cause) => succeed$1(refused(squash(cause)))));
|
|
11542
11568
|
};
|
|
11569
|
+
KIND_OF = {
|
|
11570
|
+
"inbox.jsonl": "comments",
|
|
11571
|
+
"outbox.jsonl": "comments",
|
|
11572
|
+
"state.json": "state",
|
|
11573
|
+
"layers.json": "layers",
|
|
11574
|
+
"watch.json": "watch"
|
|
11575
|
+
};
|
|
11576
|
+
kindOf = (name) => {
|
|
11577
|
+
if (name === null) return "other";
|
|
11578
|
+
const file = Object.keys(KIND_OF).find((known) => name === known || name.startsWith(`${known}.`));
|
|
11579
|
+
return file === void 0 ? "other" : KIND_OF[file] ?? "other";
|
|
11580
|
+
};
|
|
11543
11581
|
settled$1 = (folder, tell) => {
|
|
11544
11582
|
mkdirSync(folder, { recursive: true });
|
|
11545
11583
|
let timer;
|
|
11546
|
-
const
|
|
11584
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11585
|
+
const told = () => {
|
|
11586
|
+
const what = [...seen].toSorted();
|
|
11587
|
+
seen.clear();
|
|
11588
|
+
tell(what);
|
|
11589
|
+
};
|
|
11590
|
+
const watcher = watch(folder, (_event, name) => {
|
|
11591
|
+
seen.add(kindOf(name));
|
|
11547
11592
|
if (timer !== void 0) clearTimeout(timer);
|
|
11548
|
-
timer = setTimeout(
|
|
11593
|
+
timer = setTimeout(told, SETTLE_MS$1);
|
|
11549
11594
|
});
|
|
11550
11595
|
watcher.on("error", () => void 0);
|
|
11551
11596
|
return watcher;
|
|
11552
11597
|
};
|
|
11553
11598
|
watching = (serving, request, watchers) => serving.folderOf(optionsFrom(request.watch ?? [], valuedIn("comment list"))).pipe(map$1((folder) => {
|
|
11554
11599
|
watchers.get(request.id)?.close();
|
|
11555
|
-
watchers.set(request.id, settled$1(folder, () => write({
|
|
11600
|
+
watchers.set(request.id, settled$1(folder, (what) => write({
|
|
11556
11601
|
id: request.id,
|
|
11557
|
-
event: "changed"
|
|
11602
|
+
event: "changed",
|
|
11603
|
+
what
|
|
11558
11604
|
})));
|
|
11559
11605
|
return {
|
|
11560
11606
|
exit: 0,
|
|
@@ -11855,6 +11901,51 @@ var init_follow = __esmMin((() => {
|
|
|
11855
11901
|
};
|
|
11856
11902
|
}));
|
|
11857
11903
|
//#endregion
|
|
11904
|
+
//#region src/domain/patch/order.ts
|
|
11905
|
+
var compareEntries, folder, folderAt, walk, treeOrder;
|
|
11906
|
+
var init_order = __esmMin((() => {
|
|
11907
|
+
compareEntries = (left, right) => {
|
|
11908
|
+
if (left.kind !== right.kind) return left.kind === "directory" ? -1 : 1;
|
|
11909
|
+
return left.name.localeCompare(right.name);
|
|
11910
|
+
};
|
|
11911
|
+
folder = () => ({
|
|
11912
|
+
folders: /* @__PURE__ */ new Map(),
|
|
11913
|
+
files: []
|
|
11914
|
+
});
|
|
11915
|
+
folderAt = (root, segments) => segments.reduce((at, segment) => {
|
|
11916
|
+
const found = at.folders.get(segment);
|
|
11917
|
+
if (found !== void 0) return found;
|
|
11918
|
+
const made = folder();
|
|
11919
|
+
at.folders.set(segment, made);
|
|
11920
|
+
return made;
|
|
11921
|
+
}, root);
|
|
11922
|
+
walk = (at) => [...[...at.folders].toSorted(([left], [right]) => compareEntries({
|
|
11923
|
+
name: left,
|
|
11924
|
+
kind: "directory"
|
|
11925
|
+
}, {
|
|
11926
|
+
name: right,
|
|
11927
|
+
kind: "directory"
|
|
11928
|
+
})).flatMap(([, inner]) => walk(inner)), ...at.files.toSorted((left, right) => compareEntries({
|
|
11929
|
+
...left,
|
|
11930
|
+
kind: "file"
|
|
11931
|
+
}, {
|
|
11932
|
+
...right,
|
|
11933
|
+
kind: "file"
|
|
11934
|
+
})).map((file) => file.path)];
|
|
11935
|
+
treeOrder = (paths) => {
|
|
11936
|
+
const root = folder();
|
|
11937
|
+
for (const path of paths) {
|
|
11938
|
+
const segments = path.split("/").filter((segment) => segment.length > 0);
|
|
11939
|
+
const name = segments.at(-1);
|
|
11940
|
+
if (name !== void 0) folderAt(root, segments.slice(0, -1)).files.push({
|
|
11941
|
+
name,
|
|
11942
|
+
path
|
|
11943
|
+
});
|
|
11944
|
+
}
|
|
11945
|
+
return walk(root);
|
|
11946
|
+
};
|
|
11947
|
+
}));
|
|
11948
|
+
//#endregion
|
|
11858
11949
|
//#region src/domain/patch/reindent.ts
|
|
11859
11950
|
var LCS_ROOM, body, isBlock, openBlock, sideOf, blocksOf$1, at, fillRow, lcsTable, joined, stepAt, walked, canFold, folded, rowsOf, reindexed, foldReindents;
|
|
11860
11951
|
var init_reindent = __esmMin((() => {
|
|
@@ -12163,6 +12254,7 @@ var init_parse = __esmMin((() => {
|
|
|
12163
12254
|
var init_patch = __esmMin((() => {
|
|
12164
12255
|
init_anchor();
|
|
12165
12256
|
init_follow();
|
|
12257
|
+
init_order();
|
|
12166
12258
|
init_parse();
|
|
12167
12259
|
init_sticky();
|
|
12168
12260
|
init_model$5();
|
|
@@ -13453,7 +13545,7 @@ var init_branches$1 = __esmMin((() => {
|
|
|
13453
13545
|
}));
|
|
13454
13546
|
//#endregion
|
|
13455
13547
|
//#region src/review/patches.ts
|
|
13456
|
-
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;
|
|
13548
|
+
var findPatch, blobOf, wholeFile, rowAt, picked, 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;
|
|
13457
13549
|
var init_patches = __esmMin((() => {
|
|
13458
13550
|
init_dist();
|
|
13459
13551
|
init_patch();
|
|
@@ -13462,17 +13554,42 @@ var init_patches = __esmMin((() => {
|
|
|
13462
13554
|
init_branches$1();
|
|
13463
13555
|
findPatch = (patches, file) => fromNullishOr(patches.find((patch) => patch.path === file));
|
|
13464
13556
|
blobOf = (patches, file) => map$5(findPatch(patches, file), (patch) => patch.blob);
|
|
13465
|
-
|
|
13466
|
-
const only = yield* patches(worktree, WHOLE_FILE,
|
|
13557
|
+
wholeFile = fn("Review.Diff.wholeFile")(function* (worktree, file) {
|
|
13558
|
+
const only = yield* patches(worktree, WHOLE_FILE, file);
|
|
13467
13559
|
const found = only.length > 0 ? only : yield* patches(worktree, WHOLE_FILE);
|
|
13468
|
-
|
|
13469
|
-
const resolved = yield* match$3(patch, {
|
|
13560
|
+
return yield* match$3(findPatch(found, file), {
|
|
13470
13561
|
onNone: () => new UnknownFile({
|
|
13471
|
-
file
|
|
13562
|
+
file,
|
|
13472
13563
|
known: found.map((candidate) => candidate.path)
|
|
13473
13564
|
}),
|
|
13474
13565
|
onSome: succeed$1
|
|
13475
13566
|
});
|
|
13567
|
+
});
|
|
13568
|
+
rowAt = (patch, spot) => patch.rows.findIndex((row) => match$3(lineOn(row, spot.side), {
|
|
13569
|
+
onNone: () => false,
|
|
13570
|
+
onSome: (line) => line === spot.line
|
|
13571
|
+
}));
|
|
13572
|
+
picked = fn("Review.Diff.picked")(function* (worktree, request) {
|
|
13573
|
+
const resolved = yield* wholeFile(worktree, request.file);
|
|
13574
|
+
const first = rowAt(resolved, request.from);
|
|
13575
|
+
const last = rowAt(resolved, request.to);
|
|
13576
|
+
const anchored = first === -1 || last === -1 ? none() : anchorFor(resolved, first, last);
|
|
13577
|
+
return yield* match$3(anchored, {
|
|
13578
|
+
onNone: () => new UnselectableRange({
|
|
13579
|
+
file: request.file,
|
|
13580
|
+
start: request.from.line,
|
|
13581
|
+
end: request.to.line
|
|
13582
|
+
}),
|
|
13583
|
+
onSome: (made) => succeed$1({
|
|
13584
|
+
file: request.file,
|
|
13585
|
+
side: made.side,
|
|
13586
|
+
start: made.start,
|
|
13587
|
+
end: made.end
|
|
13588
|
+
})
|
|
13589
|
+
});
|
|
13590
|
+
});
|
|
13591
|
+
anchorWith = fn("Review.Diff.anchorWith")(function* (worktree, request) {
|
|
13592
|
+
const resolved = yield* wholeFile(worktree, request.file);
|
|
13476
13593
|
const anchored = flatMap$2(rowsForRange(resolved, request), ([first, last]) => anchorFor(resolved, first, last, request.side));
|
|
13477
13594
|
return yield* match$3(anchored, {
|
|
13478
13595
|
onNone: () => new UnselectableRange({
|
|
@@ -13548,14 +13665,15 @@ var init_patches = __esmMin((() => {
|
|
|
13548
13665
|
show$3 = fn("Review.Diff.show")(function* (based, showing) {
|
|
13549
13666
|
const git = yield* Git;
|
|
13550
13667
|
const { worktree } = based;
|
|
13551
|
-
const patches$
|
|
13552
|
-
const [generated] = yield* all([git.generated(worktree, patches$
|
|
13668
|
+
const patches$2 = yield* patches(worktree, linesAround(showing.context), showing.file);
|
|
13669
|
+
const [generated] = yield* all([git.generated(worktree, patches$2.map((patch) => patch.path)), git.keep(worktree, onDisk$1(patches$2))], { concurrency: 2 });
|
|
13553
13670
|
return {
|
|
13554
13671
|
branch: worktree.branch,
|
|
13555
13672
|
base: based.base,
|
|
13556
13673
|
mergeBase: worktree.base,
|
|
13557
13674
|
head: worktree.head,
|
|
13558
|
-
files: yield* forEach(patches$
|
|
13675
|
+
files: yield* forEach(patches$2, fileShown$1(worktree, generated), { concurrency: 16 }),
|
|
13676
|
+
order: treeOrder(patches$2.map((patch) => patch.path))
|
|
13559
13677
|
};
|
|
13560
13678
|
});
|
|
13561
13679
|
}));
|
|
@@ -14208,13 +14326,81 @@ var init_comments$1 = __esmMin((() => {
|
|
|
14208
14326
|
});
|
|
14209
14327
|
}));
|
|
14210
14328
|
//#endregion
|
|
14329
|
+
//#region src/domain/review/vouch.ts
|
|
14330
|
+
var SHORTEST_BLOB, sameBlob, isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
|
|
14331
|
+
var init_vouch = __esmMin((() => {
|
|
14332
|
+
SHORTEST_BLOB = 7;
|
|
14333
|
+
sameBlob = (left, right) => {
|
|
14334
|
+
if (left === void 0 || right === void 0) return false;
|
|
14335
|
+
if (left === right) return true;
|
|
14336
|
+
if (left.length < SHORTEST_BLOB || right.length < SHORTEST_BLOB) return false;
|
|
14337
|
+
return left.startsWith(right) || right.startsWith(left);
|
|
14338
|
+
};
|
|
14339
|
+
isVouched = (vouches, path, blob) => sameBlob(vouches[path], blob);
|
|
14340
|
+
vouch$1 = (vouches, path, blob) => {
|
|
14341
|
+
if (isVouched(vouches, path, blob)) {
|
|
14342
|
+
const { [path]: _cleared, ...rest } = vouches;
|
|
14343
|
+
return rest;
|
|
14344
|
+
}
|
|
14345
|
+
return {
|
|
14346
|
+
...vouches,
|
|
14347
|
+
[path]: blob
|
|
14348
|
+
};
|
|
14349
|
+
};
|
|
14350
|
+
partOf = (path, runs) => {
|
|
14351
|
+
return `${path}@${[...runs].toSorted((left, right) => left.start - right.start || left.end - right.end).map((run) => `${run.start}-${run.end}`).join(",")}`;
|
|
14352
|
+
};
|
|
14353
|
+
isPartVouched = (vouches, part, blob) => sameBlob(vouches[part], blob);
|
|
14354
|
+
vouchPart$1 = (vouches, part, blob) => vouch$1(vouches, part, blob);
|
|
14355
|
+
}));
|
|
14356
|
+
//#endregion
|
|
14357
|
+
//#region src/domain/review/stand.ts
|
|
14358
|
+
var standOf, isMovedPast, SECTION_OF, sectionOf$1, STAND_WEIGHT, louderOf, isOpen;
|
|
14359
|
+
var init_stand = __esmMin((() => {
|
|
14360
|
+
standOf = (facts) => {
|
|
14361
|
+
if (facts.removed) return "gone";
|
|
14362
|
+
if (facts.settled) return "settled";
|
|
14363
|
+
if (facts.asks) return "asked";
|
|
14364
|
+
if (facts.answeredLast) return "answered";
|
|
14365
|
+
return facts.taken ? "waiting" : "filed";
|
|
14366
|
+
};
|
|
14367
|
+
isMovedPast = (facts) => facts.outside || facts.outdated && !facts.reworded;
|
|
14368
|
+
SECTION_OF = {
|
|
14369
|
+
filed: "filed",
|
|
14370
|
+
gone: "removed",
|
|
14371
|
+
settled: "settled",
|
|
14372
|
+
asked: "asked",
|
|
14373
|
+
answered: "answered",
|
|
14374
|
+
waiting: "with"
|
|
14375
|
+
};
|
|
14376
|
+
sectionOf$1 = (stand, movedPast) => movedPast && stand !== "settled" && stand !== "gone" ? "movedOn" : SECTION_OF[stand];
|
|
14377
|
+
STAND_WEIGHT = {
|
|
14378
|
+
gone: 0,
|
|
14379
|
+
settled: 1,
|
|
14380
|
+
filed: 2,
|
|
14381
|
+
waiting: 2,
|
|
14382
|
+
answered: 3,
|
|
14383
|
+
asked: 4
|
|
14384
|
+
};
|
|
14385
|
+
louderOf = (one, other) => STAND_WEIGHT[one] > STAND_WEIGHT[other] ? one : other;
|
|
14386
|
+
isOpen = (stand) => stand !== "settled" && stand !== "gone";
|
|
14387
|
+
}));
|
|
14388
|
+
//#endregion
|
|
14389
|
+
//#region src/domain/review/index.ts
|
|
14390
|
+
var init_review$1 = __esmMin((() => {
|
|
14391
|
+
init_vouch();
|
|
14392
|
+
init_stand();
|
|
14393
|
+
}));
|
|
14394
|
+
//#endregion
|
|
14211
14395
|
//#region src/review/threads.ts
|
|
14212
|
-
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;
|
|
14396
|
+
var ASK_LEAD, stateOf$2, choicesOf, answerOf, turnsOf, judged, factsOf, threadOf, threadsIn$1, idsIn, rootIn, rootOf, isKnown, known, list$3, clearDoing, doing, answer$3, repliesTo, settle, without$1, unsettle, remove, restore$1, settleRead, fileThreads, byFile$1;
|
|
14213
14397
|
var init_threads$1 = __esmMin((() => {
|
|
14214
14398
|
init_dist();
|
|
14215
14399
|
init_store();
|
|
14216
14400
|
init_error$2();
|
|
14217
14401
|
init_placing();
|
|
14402
|
+
init_review$1();
|
|
14403
|
+
ASK_LEAD = "About this branch, not about this line.";
|
|
14218
14404
|
stateOf$2 = (turns, asked, isSettled, isRemoved) => {
|
|
14219
14405
|
if (isRemoved) return "removed";
|
|
14220
14406
|
if (isSettled) return "done";
|
|
@@ -14239,6 +14425,41 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14239
14425
|
at: entry.at,
|
|
14240
14426
|
...choicesOf(entry)
|
|
14241
14427
|
}))].toSorted((one, other) => one.at < other.at ? -1 : one.at > other.at ? 1 : 0);
|
|
14428
|
+
judged = (facts) => {
|
|
14429
|
+
const removed = facts.state === "removed";
|
|
14430
|
+
const stand = standOf({
|
|
14431
|
+
removed,
|
|
14432
|
+
settled: facts.settled,
|
|
14433
|
+
asks: facts.asks,
|
|
14434
|
+
answeredLast: facts.agentLast && facts.answers > 0,
|
|
14435
|
+
taken: facts.taken
|
|
14436
|
+
});
|
|
14437
|
+
const movedPast = isMovedPast(facts);
|
|
14438
|
+
return {
|
|
14439
|
+
movedPast,
|
|
14440
|
+
stand,
|
|
14441
|
+
section: sectionOf$1(stand, movedPast),
|
|
14442
|
+
settleable: facts.answers > 0 && facts.unread === 0 && !facts.settled && !removed
|
|
14443
|
+
};
|
|
14444
|
+
};
|
|
14445
|
+
factsOf = (gathered, conversation) => {
|
|
14446
|
+
const { held, ids, mine, turns, sits, settled, seen } = gathered;
|
|
14447
|
+
const path = held.comment.anchor.path;
|
|
14448
|
+
const agentLast = turns.at(-1)?.voice === "agent";
|
|
14449
|
+
const asked = mine.at(-1)?.asks === true;
|
|
14450
|
+
return {
|
|
14451
|
+
state: stateOf$2(turns, asked, settled, Object.hasOwn(conversation.removed, held.comment.id)),
|
|
14452
|
+
outdated: sits.placed && sits.outdated,
|
|
14453
|
+
outside: !conversation.shown.has(path) || !sits.placed,
|
|
14454
|
+
reworded: sits.placed && sits.reworded,
|
|
14455
|
+
unread: Math.max(0, mine.length - seen),
|
|
14456
|
+
taken: [...ids].some((id) => Object.hasOwn(conversation.taken, id)),
|
|
14457
|
+
settled,
|
|
14458
|
+
asks: agentLast && asked,
|
|
14459
|
+
answers: mine.length,
|
|
14460
|
+
agentLast
|
|
14461
|
+
};
|
|
14462
|
+
};
|
|
14242
14463
|
threadOf = (held, replies, conversation) => {
|
|
14243
14464
|
const { comment, batch } = held;
|
|
14244
14465
|
const ids = /* @__PURE__ */ new Set([comment.id, ...replies.map((one) => one.comment.id)]);
|
|
@@ -14253,6 +14474,15 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14253
14474
|
reworded: false
|
|
14254
14475
|
};
|
|
14255
14476
|
const doing = conversation.doing[comment.id];
|
|
14477
|
+
const facts = factsOf({
|
|
14478
|
+
held,
|
|
14479
|
+
ids,
|
|
14480
|
+
mine,
|
|
14481
|
+
turns,
|
|
14482
|
+
sits,
|
|
14483
|
+
settled,
|
|
14484
|
+
seen
|
|
14485
|
+
}, conversation);
|
|
14256
14486
|
return {
|
|
14257
14487
|
id: comment.id,
|
|
14258
14488
|
file: comment.anchor.path,
|
|
@@ -14262,12 +14492,15 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14262
14492
|
snippet: comment.anchor.snippet,
|
|
14263
14493
|
body: comment.body,
|
|
14264
14494
|
at: batch.at,
|
|
14265
|
-
state:
|
|
14495
|
+
state: facts.state,
|
|
14266
14496
|
stale: batch.head !== conversation.head,
|
|
14267
|
-
outdated:
|
|
14268
|
-
outside:
|
|
14269
|
-
|
|
14270
|
-
|
|
14497
|
+
outdated: facts.outdated,
|
|
14498
|
+
outside: facts.outside,
|
|
14499
|
+
reworded: facts.reworded,
|
|
14500
|
+
...judged(facts),
|
|
14501
|
+
about: comment.body.startsWith("About this branch, not about this line.") ? "branch" : "line",
|
|
14502
|
+
unread: facts.unread,
|
|
14503
|
+
taken: facts.taken,
|
|
14271
14504
|
answers: mine.map(answerOf),
|
|
14272
14505
|
turns,
|
|
14273
14506
|
settled,
|
|
@@ -14451,6 +14684,18 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14451
14684
|
}));
|
|
14452
14685
|
return { settled: ripe.length };
|
|
14453
14686
|
});
|
|
14687
|
+
fileThreads = (path, threads) => {
|
|
14688
|
+
const here = threads.filter((thread) => thread.file === path);
|
|
14689
|
+
return {
|
|
14690
|
+
path,
|
|
14691
|
+
open: here.length,
|
|
14692
|
+
stand: here.reduce((stand, one) => louderOf(stand, one.stand), "gone")
|
|
14693
|
+
};
|
|
14694
|
+
};
|
|
14695
|
+
byFile$1 = (threads) => {
|
|
14696
|
+
const open = threads.filter((thread) => isOpen(thread.stand) && thread.about === "line");
|
|
14697
|
+
return [...new Set(open.map((thread) => thread.file))].map((path) => fileThreads(path, open));
|
|
14698
|
+
};
|
|
14454
14699
|
}));
|
|
14455
14700
|
//#endregion
|
|
14456
14701
|
//#region src/service/forge/error.ts
|
|
@@ -15157,41 +15402,8 @@ var init_remarks$1 = __esmMin((() => {
|
|
|
15157
15402
|
});
|
|
15158
15403
|
}));
|
|
15159
15404
|
//#endregion
|
|
15160
|
-
//#region src/domain/review/vouch.ts
|
|
15161
|
-
var SHORTEST_BLOB, sameBlob, isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
|
|
15162
|
-
var init_vouch = __esmMin((() => {
|
|
15163
|
-
SHORTEST_BLOB = 7;
|
|
15164
|
-
sameBlob = (left, right) => {
|
|
15165
|
-
if (left === void 0 || right === void 0) return false;
|
|
15166
|
-
if (left === right) return true;
|
|
15167
|
-
if (left.length < SHORTEST_BLOB || right.length < SHORTEST_BLOB) return false;
|
|
15168
|
-
return left.startsWith(right) || right.startsWith(left);
|
|
15169
|
-
};
|
|
15170
|
-
isVouched = (vouches, path, blob) => sameBlob(vouches[path], blob);
|
|
15171
|
-
vouch$1 = (vouches, path, blob) => {
|
|
15172
|
-
if (isVouched(vouches, path, blob)) {
|
|
15173
|
-
const { [path]: _cleared, ...rest } = vouches;
|
|
15174
|
-
return rest;
|
|
15175
|
-
}
|
|
15176
|
-
return {
|
|
15177
|
-
...vouches,
|
|
15178
|
-
[path]: blob
|
|
15179
|
-
};
|
|
15180
|
-
};
|
|
15181
|
-
partOf = (path, runs) => {
|
|
15182
|
-
return `${path}@${[...runs].toSorted((left, right) => left.start - right.start || left.end - right.end).map((run) => `${run.start}-${run.end}`).join(",")}`;
|
|
15183
|
-
};
|
|
15184
|
-
isPartVouched = (vouches, part, blob) => sameBlob(vouches[part], blob);
|
|
15185
|
-
vouchPart$1 = (vouches, part, blob) => vouch$1(vouches, part, blob);
|
|
15186
|
-
}));
|
|
15187
|
-
//#endregion
|
|
15188
|
-
//#region src/domain/review/index.ts
|
|
15189
|
-
var init_review$1 = __esmMin((() => {
|
|
15190
|
-
init_vouch();
|
|
15191
|
-
}));
|
|
15192
|
-
//#endregion
|
|
15193
15405
|
//#region src/review/vouching.ts
|
|
15194
|
-
var pathOfMark, changedSince, readParts, restamped, now, keepMarked, fullBlob, blobIn, stateAfter, toggle, marksOf, newestFirst, speaking, contentNow, diffSince, placesIn, counted$1, reportSince, isGone, goneSince, lapsedIn, sinceReview, progress, unchanged, markOf, since;
|
|
15406
|
+
var pathOfMark, changedSince, readParts, restamped, now, keepMarked, fullBlob, blobIn, stateAfter, toggle, marksOf, newestFirst, speaking, contentNow, diffSince, placesIn, counted$1, nearestNew$1, touchedIn, touchedLines, holdsAny, layersTouched, untouchedParts, partsStillRead, stillRead, reportSince, isGone, goneSince, lapsedIn, sinceReview, progress, unchanged, markOf, since;
|
|
15195
15407
|
var init_vouching$1 = __esmMin((() => {
|
|
15196
15408
|
init_dist();
|
|
15197
15409
|
init_patch();
|
|
@@ -15315,7 +15527,39 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
15315
15527
|
places: placesIn(found)
|
|
15316
15528
|
})
|
|
15317
15529
|
});
|
|
15318
|
-
|
|
15530
|
+
nearestNew$1 = (rows, at) => {
|
|
15531
|
+
const near = [...rows.slice(at + 1), ...rows.slice(0, at).toReversed()].find((row) => isSome(row.newLine));
|
|
15532
|
+
return near === void 0 ? [] : toArray(near.newLine);
|
|
15533
|
+
};
|
|
15534
|
+
touchedIn = (rows) => rows.flatMap((row, at) => {
|
|
15535
|
+
if (row.kind === "context") return [];
|
|
15536
|
+
return isSome(row.newLine) ? [row.newLine.value] : nearestNew$1(rows, at);
|
|
15537
|
+
});
|
|
15538
|
+
touchedLines = (patch) => patch.hunks.flatMap((hunk) => touchedIn(hunk.rows));
|
|
15539
|
+
holdsAny = (own, path, lines) => own.some((span) => span.path === path && lines.some((line) => line >= span.start && line <= span.end));
|
|
15540
|
+
layersTouched = (spans, path, patch) => {
|
|
15541
|
+
const lines = match$3(patch, {
|
|
15542
|
+
onNone: () => [],
|
|
15543
|
+
onSome: touchedLines
|
|
15544
|
+
});
|
|
15545
|
+
return spans.flatMap((own, at) => holdsAny(own, path, lines) ? [at + 1] : []);
|
|
15546
|
+
};
|
|
15547
|
+
untouchedParts = (spans, path, touched) => spans.flatMap((own, at) => {
|
|
15548
|
+
const mine = own.filter((span) => span.path === path);
|
|
15549
|
+
return mine.length === 0 || touched.includes(at + 1) ? [] : [partOf(path, mine)];
|
|
15550
|
+
});
|
|
15551
|
+
partsStillRead = fn("Review.Vouch.partsStillRead")(function* (worktree, patch, marked, spans) {
|
|
15552
|
+
const kept = yield* (yield* Git).kept(worktree, marked);
|
|
15553
|
+
if (isNone(kept)) return [];
|
|
15554
|
+
const since = yield* diffSince(worktree, patch.path, kept.value, 3);
|
|
15555
|
+
return untouchedParts(spans, patch.path, layersTouched(spans, patch.path, since));
|
|
15556
|
+
});
|
|
15557
|
+
stillRead = fn("Review.Vouch.stillRead")(function* (reading, vouches, spans) {
|
|
15558
|
+
if (spans.length === 0) return [];
|
|
15559
|
+
const lapsed = reading.patches.filter((patch) => Object.hasOwn(vouches, patch.path) && !isVouched(vouches, patch.path, patch.blob));
|
|
15560
|
+
return (yield* forEach(lapsed, (patch) => partsStillRead(reading.worktree, patch, vouches[patch.path] ?? "", spans), { concurrency: 8 })).flat();
|
|
15561
|
+
});
|
|
15562
|
+
reportSince = fn("Review.Vouch.reportSince")(function* (worktree, asked, spans) {
|
|
15319
15563
|
const git = yield* Git;
|
|
15320
15564
|
const { mark } = asked;
|
|
15321
15565
|
const told = {
|
|
@@ -15330,13 +15574,15 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
15330
15574
|
added: 0,
|
|
15331
15575
|
removed: 0,
|
|
15332
15576
|
places: 0,
|
|
15333
|
-
kept: false
|
|
15577
|
+
kept: false,
|
|
15578
|
+
layers: []
|
|
15334
15579
|
};
|
|
15335
15580
|
const patch = yield* diffSince(worktree, mark.path, kept.value, 3);
|
|
15336
15581
|
return {
|
|
15337
15582
|
...told,
|
|
15338
15583
|
...counted$1(patch),
|
|
15339
|
-
kept: true
|
|
15584
|
+
kept: true,
|
|
15585
|
+
layers: layersTouched(spans, mark.path, patch)
|
|
15340
15586
|
};
|
|
15341
15587
|
});
|
|
15342
15588
|
isGone = fn("Review.Vouch.isGone")(function* (worktree, path) {
|
|
@@ -15352,16 +15598,16 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
15352
15598
|
mark,
|
|
15353
15599
|
deleted: patch.status === "deleted"
|
|
15354
15600
|
})));
|
|
15355
|
-
sinceReview = fn("Review.Vouch.sinceReview")(function* (reading, state, changed) {
|
|
15601
|
+
sinceReview = fn("Review.Vouch.sinceReview")(function* (reading, state, changed, spans) {
|
|
15356
15602
|
const marks = marksOf(state);
|
|
15357
15603
|
const gone = yield* goneSince(reading.worktree, marks, reading.patches);
|
|
15358
15604
|
const asked = [...lapsedIn(reading.patches, marks, changed), ...gone.map((mark) => ({
|
|
15359
15605
|
mark,
|
|
15360
15606
|
deleted: true
|
|
15361
15607
|
}))];
|
|
15362
|
-
return yield* forEach(asked, (one) => reportSince(reading.worktree, one), { concurrency: 8 });
|
|
15608
|
+
return yield* forEach(asked, (one) => reportSince(reading.worktree, one, spans), { concurrency: 8 });
|
|
15363
15609
|
});
|
|
15364
|
-
progress = fn("Review.Vouch.progress")(function* (reading) {
|
|
15610
|
+
progress = fn("Review.Vouch.progress")(function* (reading, spans = []) {
|
|
15365
15611
|
const current = yield* (yield* Store).state(reading.worktree.path);
|
|
15366
15612
|
const files = reading.patches.map((patch) => ({
|
|
15367
15613
|
path: patch.path,
|
|
@@ -15370,9 +15616,9 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
15370
15616
|
const changed = changedSince([current.vouches, current.parts], files);
|
|
15371
15617
|
return {
|
|
15372
15618
|
vouched: files.filter((file) => isVouched(current.vouches, file.path, file.blob)).map((f) => f.path),
|
|
15373
|
-
parts: readParts(current.parts, files),
|
|
15619
|
+
parts: [...readParts(current.parts, files), ...yield* stillRead(reading, current.vouches, spans)],
|
|
15374
15620
|
changed,
|
|
15375
|
-
since: yield* sinceReview(reading, current, changed),
|
|
15621
|
+
since: yield* sinceReview(reading, current, changed, spans),
|
|
15376
15622
|
total: reading.patches.length
|
|
15377
15623
|
};
|
|
15378
15624
|
});
|
|
@@ -15550,7 +15796,7 @@ var init_preferences = __esmMin((() => {
|
|
|
15550
15796
|
}));
|
|
15551
15797
|
//#endregion
|
|
15552
15798
|
//#region src/review/layers.ts
|
|
15553
|
-
var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, show$1, read, partsOfFile, vouchPart,
|
|
15799
|
+
var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, partIn, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, coversThread, readsFile, lastHolding, layersHolding$1, loudest, partWithThreads, withThreads, readReport, view, show$1, placeThreads, spansIn, layersAt, taggedRow, nearestNew, lineNow, taggedHunk, taggedFile, tagSince, tagRows, read, partsOfFile, vouchPart, askingFor, ask, claims, vouchIn;
|
|
15554
15800
|
var init_layers = __esmMin((() => {
|
|
15555
15801
|
init_dist();
|
|
15556
15802
|
init_layers$1();
|
|
@@ -15558,6 +15804,7 @@ var init_layers = __esmMin((() => {
|
|
|
15558
15804
|
init_review$1();
|
|
15559
15805
|
init_error$2();
|
|
15560
15806
|
init_comments$1();
|
|
15807
|
+
init_threads$1();
|
|
15561
15808
|
init_branches$1();
|
|
15562
15809
|
init_vouching$1();
|
|
15563
15810
|
STALE_ADVICE = "These layers describe an older commit. Read the diff again and write a new revision with layers set.";
|
|
@@ -15659,16 +15906,18 @@ var init_layers = __esmMin((() => {
|
|
|
15659
15906
|
...layers,
|
|
15660
15907
|
parent: getOrUndefined$1(layers.parent)
|
|
15661
15908
|
});
|
|
15909
|
+
partIn = (patches, layer, path) => Object.assign({ path }, linesClaimed(patches.filter((patch) => patch.path === path), layer));
|
|
15662
15910
|
reportedLayers = (patches, layers) => {
|
|
15663
15911
|
const present = new Set(patches.map((patch) => patch.path));
|
|
15664
15912
|
return withFullCoverage(patches, layers).layers.map((layer, at) => {
|
|
15665
15913
|
const named = unique(spansOfLayer(layer).map((span) => span.path));
|
|
15666
15914
|
const gap = coverage(patches, [layer]);
|
|
15667
15915
|
const lines = linesClaimed(patches, layer);
|
|
15916
|
+
const files = named.filter((path) => present.has(path));
|
|
15668
15917
|
return {
|
|
15669
15918
|
title: layer.title,
|
|
15670
15919
|
note: noteOf(layer),
|
|
15671
|
-
files
|
|
15920
|
+
files,
|
|
15672
15921
|
spans: spansOfLayer(layer),
|
|
15673
15922
|
prose: proseAnchors(layer).filter((anchor) => present.has(anchor.path)),
|
|
15674
15923
|
covered: gap.covered,
|
|
@@ -15676,7 +15925,8 @@ var init_layers = __esmMin((() => {
|
|
|
15676
15925
|
added: lines.added,
|
|
15677
15926
|
removed: lines.removed,
|
|
15678
15927
|
vanished: named.filter((path) => !present.has(path)),
|
|
15679
|
-
unclaimed: at >= layers.layers.length
|
|
15928
|
+
unclaimed: at >= layers.layers.length,
|
|
15929
|
+
parts: files.map((path) => partIn(patches, layer, path))
|
|
15680
15930
|
};
|
|
15681
15931
|
});
|
|
15682
15932
|
};
|
|
@@ -15736,28 +15986,127 @@ var init_layers = __esmMin((() => {
|
|
|
15736
15986
|
const read = readInLayer(layer, reading);
|
|
15737
15987
|
return Object.assign({}, layer, {
|
|
15738
15988
|
read,
|
|
15739
|
-
done: layer.files.length > 0 && read.length === layer.files.length
|
|
15989
|
+
done: layer.files.length > 0 && read.length === layer.files.length,
|
|
15990
|
+
parts: layer.parts.map((part) => ({
|
|
15991
|
+
...part,
|
|
15992
|
+
read: read.includes(part.path)
|
|
15993
|
+
}))
|
|
15740
15994
|
});
|
|
15741
15995
|
})
|
|
15742
15996
|
});
|
|
15743
|
-
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15997
|
+
coversThread = (layer, thread) => thread.side === "new" && layer.spans.some((span) => span.path === thread.file && thread.start <= span.end && thread.end >= span.start);
|
|
15998
|
+
readsFile = (layer, file) => layer.read?.includes(file) === true;
|
|
15999
|
+
lastHolding = (layers, file, at) => layers.every((other, index) => index === at || !claims(other, file) || readsFile(other, file));
|
|
16000
|
+
layersHolding$1 = (layers, thread) => {
|
|
16001
|
+
if (thread.about === "branch") return [];
|
|
16002
|
+
const covering = layers.flatMap((layer, at) => coversThread(layer, thread) ? [at + 1] : []);
|
|
16003
|
+
if (covering.length > 0) return covering;
|
|
16004
|
+
return layers.flatMap((layer, at) => claims(layer, thread.file) && lastHolding(layers, thread.file, at) ? [at + 1] : []);
|
|
16005
|
+
};
|
|
16006
|
+
loudest = (threads) => threads.reduce((stand, thread) => louderOf(stand, thread.stand), "gone");
|
|
16007
|
+
partWithThreads = (part, threads) => {
|
|
16008
|
+
const here = threads.filter((thread) => thread.file === part.path);
|
|
16009
|
+
return Object.assign({}, part, {
|
|
16010
|
+
open: here.length,
|
|
16011
|
+
stand: loudest(here)
|
|
15750
16012
|
});
|
|
15751
|
-
|
|
15752
|
-
|
|
16013
|
+
};
|
|
16014
|
+
withThreads = (report, threads) => {
|
|
16015
|
+
const open = threads.filter((thread) => isOpen(thread.stand)).map((thread) => ({
|
|
16016
|
+
thread,
|
|
16017
|
+
layers: layersHolding$1(report.layers, thread)
|
|
16018
|
+
}));
|
|
16019
|
+
return {
|
|
16020
|
+
...report,
|
|
16021
|
+
layers: report.layers.map((layer, at) => {
|
|
16022
|
+
const mine = open.filter((one) => one.layers.includes(at + 1)).map((one) => one.thread);
|
|
16023
|
+
return Object.assign({}, layer, {
|
|
16024
|
+
open: mine.length,
|
|
16025
|
+
stand: loudest(mine),
|
|
16026
|
+
parts: layer.parts.map((part) => partWithThreads(part, mine))
|
|
16027
|
+
});
|
|
16028
|
+
})
|
|
16029
|
+
};
|
|
16030
|
+
};
|
|
16031
|
+
readReport = fn("Review.Layers.readReport")(function* (reading) {
|
|
16032
|
+
const store = yield* Store;
|
|
16033
|
+
const found = yield* storedLayers(reading.worktree);
|
|
16034
|
+
if (isNone(found)) return none();
|
|
16035
|
+
const current = yield* store.state(reading.worktree.path);
|
|
16036
|
+
const files = reading.patches.map((patch) => ({
|
|
15753
16037
|
path: patch.path,
|
|
15754
16038
|
blob: patch.blob
|
|
15755
16039
|
}));
|
|
15756
|
-
|
|
15757
|
-
|
|
16040
|
+
const report = reportOf(reading.patches, found.value, reading.worktree.head);
|
|
16041
|
+
const spans = report.layers.map((layer) => layer.spans);
|
|
16042
|
+
return some(withRead(report, {
|
|
16043
|
+
patches: reading.patches,
|
|
15758
16044
|
vouches: current.vouches,
|
|
15759
|
-
parts: readParts(current.parts, files)
|
|
16045
|
+
parts: [...readParts(current.parts, files), ...yield* stillRead(reading, current.vouches, spans)]
|
|
16046
|
+
}));
|
|
16047
|
+
});
|
|
16048
|
+
view = fn("Review.Layers.view")(function* (reading) {
|
|
16049
|
+
const found = yield* readReport(reading);
|
|
16050
|
+
if (isNone(found)) return none();
|
|
16051
|
+
return some(withThreads(found.value, yield* list$3(reading)));
|
|
16052
|
+
});
|
|
16053
|
+
show$1 = fn("Review.Layers.show")(function* (worktree) {
|
|
16054
|
+
const found = yield* view({
|
|
16055
|
+
worktree,
|
|
16056
|
+
patches: yield* patches(worktree)
|
|
16057
|
+
});
|
|
16058
|
+
return yield* match$3(found, {
|
|
16059
|
+
onNone: () => new NoLayers({ worktree: worktree.path }),
|
|
16060
|
+
onSome: succeed$1
|
|
16061
|
+
});
|
|
16062
|
+
});
|
|
16063
|
+
placeThreads = fn("Review.Layers.placeThreads")(function* (reading, threads) {
|
|
16064
|
+
const found = yield* readReport(reading);
|
|
16065
|
+
return threads.map((thread) => ({
|
|
16066
|
+
...thread,
|
|
16067
|
+
layers: match$3(found, {
|
|
16068
|
+
onNone: () => [],
|
|
16069
|
+
onSome: (report) => layersHolding$1(report.layers, thread)
|
|
16070
|
+
})
|
|
16071
|
+
}));
|
|
16072
|
+
});
|
|
16073
|
+
spansIn = fn("Review.Layers.spansIn")(function* (reading) {
|
|
16074
|
+
const found = yield* storedLayers(reading.worktree);
|
|
16075
|
+
return match$3(found, {
|
|
16076
|
+
onNone: () => [],
|
|
16077
|
+
onSome: (layers) => reportedLayers(reading.patches, layers).map((layer) => layer.spans)
|
|
16078
|
+
});
|
|
16079
|
+
});
|
|
16080
|
+
layersAt = (spans, path, line) => spans.flatMap((own, at) => own.some((span) => span.path === path && span.start <= line && span.end >= line) ? [at + 1] : []);
|
|
16081
|
+
taggedRow = (spans, path, row, line) => {
|
|
16082
|
+
if (row.kind === "note" || line === void 0) return row;
|
|
16083
|
+
const layers = layersAt(spans, path, line);
|
|
16084
|
+
return layers.length === 0 ? row : {
|
|
16085
|
+
...row,
|
|
16086
|
+
layers
|
|
16087
|
+
};
|
|
16088
|
+
};
|
|
16089
|
+
nearestNew = (rows, at) => [...rows.slice(at + 1), ...rows.slice(0, at).toReversed()].find((row) => row.new !== void 0)?.new;
|
|
16090
|
+
lineNow = (rows, row, at) => row.new ?? (row.kind === "removed" ? nearestNew(rows, at) : void 0);
|
|
16091
|
+
taggedHunk = (spans, path, hunk, newOnly = false) => Object.assign({}, hunk, { rows: hunk.rows.map((row, at) => taggedRow(spans, path, row, newOnly ? lineNow(hunk.rows, row, at) : row.new ?? row.old)) });
|
|
16092
|
+
taggedFile = (spans, file, newOnly = false) => Object.assign({}, file, { hunks: file.hunks.map((hunk) => taggedHunk(spans, file.path, hunk, newOnly)) });
|
|
16093
|
+
tagSince = fn("Review.Layers.tagSince")(function* (worktree, shown) {
|
|
16094
|
+
const spans = yield* spansIn({
|
|
16095
|
+
worktree,
|
|
16096
|
+
patches: yield* patches(worktree)
|
|
15760
16097
|
});
|
|
16098
|
+
return spans.length === 0 ? shown : taggedFile(spans, shown, true);
|
|
16099
|
+
});
|
|
16100
|
+
tagRows = fn("Review.Layers.tagRows")(function* (worktree, shown) {
|
|
16101
|
+
const spans = yield* spansIn({
|
|
16102
|
+
worktree,
|
|
16103
|
+
patches: yield* patches(worktree)
|
|
16104
|
+
});
|
|
16105
|
+
if (spans.length === 0) return shown;
|
|
16106
|
+
return {
|
|
16107
|
+
...shown,
|
|
16108
|
+
files: shown.files.map((file) => taggedFile(spans, file))
|
|
16109
|
+
};
|
|
15761
16110
|
});
|
|
15762
16111
|
read = fn("Review.Layers.read")(function* (reading) {
|
|
15763
16112
|
const worktree = reading.worktree;
|
|
@@ -15812,7 +16161,6 @@ var init_layers = __esmMin((() => {
|
|
|
15812
16161
|
total: reading.patches.length
|
|
15813
16162
|
};
|
|
15814
16163
|
});
|
|
15815
|
-
ASK_LEAD = "About this branch, not about this line.";
|
|
15816
16164
|
askingFor = (told) => {
|
|
15817
16165
|
if (told.count === 0) return `${ASK_LEAD} Please write a reading order for it with \`adiff layers set\`, so the diff can be read in the order the change was made rather than by filename.`;
|
|
15818
16166
|
if (told.stale) return `${ASK_LEAD} The reading order on it describes an older commit — please read the diff again and write a new one with \`adiff layers set\`.`;
|
|
@@ -17788,6 +18136,7 @@ var init_match = __esmMin((() => {
|
|
|
17788
18136
|
var HOLDS$1, chosenNow, withChosen, EDITOR_ROW, editorRow, preferenceRows, nothingReviewed, nothingFound, initialState, selectedBranch, selectedPatch, pullHere, authorHere, theirPull, heldWhere, noteEditing, hasNoPull, onLayers, selectedLayer, movedPast;
|
|
17789
18137
|
var init_state = __esmMin((() => {
|
|
17790
18138
|
init_preferences$1();
|
|
18139
|
+
init_review$1();
|
|
17791
18140
|
init_gaps();
|
|
17792
18141
|
HOLDS$1 = {
|
|
17793
18142
|
wrap: "wrap",
|
|
@@ -17933,7 +18282,11 @@ var init_state = __esmMin((() => {
|
|
|
17933
18282
|
hasNoPull = (state) => state.forge === "answered" && pullHere(state).length === 0;
|
|
17934
18283
|
onLayers = (state) => state.rail === "layers" && state.layers.length > 0;
|
|
17935
18284
|
selectedLayer = (state) => state.layers[state.layerIndex];
|
|
17936
|
-
movedPast = (comment) =>
|
|
18285
|
+
movedPast = (comment) => isMovedPast({
|
|
18286
|
+
outside: comment.outside === true,
|
|
18287
|
+
outdated: comment.outdated === true,
|
|
18288
|
+
reworded: comment.reworded === true
|
|
18289
|
+
});
|
|
17937
18290
|
}));
|
|
17938
18291
|
//#endregion
|
|
17939
18292
|
//#region src/tui/cursor.ts
|
|
@@ -18020,6 +18373,7 @@ var init_cursor = __esmMin((() => {
|
|
|
18020
18373
|
//#region src/tui/tree.ts
|
|
18021
18374
|
var add, directoryOf, compare, buildTree, chain, visit, flattenTree, directFiles, filesUnder, crowdedDirectories;
|
|
18022
18375
|
var init_tree = __esmMin((() => {
|
|
18376
|
+
init_patch();
|
|
18023
18377
|
add = (tree, input) => {
|
|
18024
18378
|
const id = tree.nodes.length;
|
|
18025
18379
|
tree.nodes.push({
|
|
@@ -18059,8 +18413,7 @@ var init_tree = __esmMin((() => {
|
|
|
18059
18413
|
const a = tree.nodes[left];
|
|
18060
18414
|
const b = tree.nodes[right];
|
|
18061
18415
|
if (a === void 0 || b === void 0) return 0;
|
|
18062
|
-
|
|
18063
|
-
return a.name.localeCompare(b.name);
|
|
18416
|
+
return compareEntries(a, b);
|
|
18064
18417
|
};
|
|
18065
18418
|
buildTree = (paths) => {
|
|
18066
18419
|
const tree = {
|
|
@@ -18568,9 +18921,10 @@ var init_layerview = __esmMin((() => {
|
|
|
18568
18921
|
}));
|
|
18569
18922
|
//#endregion
|
|
18570
18923
|
//#region src/tui/panel.ts
|
|
18571
|
-
var PANEL_SECTIONS, answersIn, newerOf, lastVoice,
|
|
18924
|
+
var PANEL_SECTIONS, answersIn, newerOf, lastVoice, sectionOf, sentEntry, remarkRows, panelHolds, panelEntries, panelEntry, threadChosen, MINUTE, HOUR, DAY, agoText, threadStand;
|
|
18572
18925
|
var init_panel = __esmMin((() => {
|
|
18573
18926
|
init_state();
|
|
18927
|
+
init_review$1();
|
|
18574
18928
|
PANEL_SECTIONS = [
|
|
18575
18929
|
"remarks",
|
|
18576
18930
|
"held",
|
|
@@ -18591,16 +18945,7 @@ var init_panel = __esmMin((() => {
|
|
|
18591
18945
|
return answersIn(later) > answersIn(comment) ? later : comment;
|
|
18592
18946
|
};
|
|
18593
18947
|
lastVoice = (comment) => comment.turns?.at(-1)?.voice;
|
|
18594
|
-
|
|
18595
|
-
filed: "filed",
|
|
18596
|
-
gone: "removed",
|
|
18597
|
-
settled: "settled",
|
|
18598
|
-
asked: "asked",
|
|
18599
|
-
answered: "answered",
|
|
18600
|
-
waiting: "with"
|
|
18601
|
-
};
|
|
18602
|
-
outsideOpen = (comment) => movedPast(comment) && comment.settled !== true && comment.removed !== true;
|
|
18603
|
-
sectionOf = (comment) => outsideOpen(comment) ? "movedOn" : SECTION_OF[threadStand(comment)];
|
|
18948
|
+
sectionOf = (comment) => sectionOf$1(threadStand(comment), movedPast(comment));
|
|
18604
18949
|
sentEntry = (state, comment) => {
|
|
18605
18950
|
const newer = newerOf(state, comment);
|
|
18606
18951
|
return {
|
|
@@ -18665,22 +19010,13 @@ var init_panel = __esmMin((() => {
|
|
|
18665
19010
|
if (gap < 864e5) return `${Math.floor(gap / HOUR)}h ago`;
|
|
18666
19011
|
return `${Math.floor(gap / DAY)}d ago`;
|
|
18667
19012
|
};
|
|
18668
|
-
threadStand = (thread) => {
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
};
|
|
18675
|
-
STAND_WEIGHT = {
|
|
18676
|
-
gone: 0,
|
|
18677
|
-
settled: 1,
|
|
18678
|
-
filed: 2,
|
|
18679
|
-
waiting: 2,
|
|
18680
|
-
answered: 3,
|
|
18681
|
-
asked: 4
|
|
18682
|
-
};
|
|
18683
|
-
louderOf = (one, other) => STAND_WEIGHT[one] > STAND_WEIGHT[other] ? one : other;
|
|
19013
|
+
threadStand = (thread) => standOf({
|
|
19014
|
+
removed: thread.removed === true,
|
|
19015
|
+
settled: thread.settled === true,
|
|
19016
|
+
asks: thread.asks === true,
|
|
19017
|
+
answeredLast: lastVoice(thread) === "agent" && answersIn(thread) > 0,
|
|
19018
|
+
taken: thread.takenAt !== void 0
|
|
19019
|
+
});
|
|
18684
19020
|
}));
|
|
18685
19021
|
//#endregion
|
|
18686
19022
|
//#region src/tui/notes.ts
|
|
@@ -23747,7 +24083,7 @@ var init_branches = __esmMin((() => {
|
|
|
23747
24083
|
app.reading = reading$1;
|
|
23748
24084
|
yield* markOpened(reading$1.worktree, (/* @__PURE__ */ new Date()).toISOString());
|
|
23749
24085
|
const [progress$2, layers, sent, remarks, drafts] = yield* all([
|
|
23750
|
-
progress(reading$1),
|
|
24086
|
+
flatMap(spansIn(reading$1), (spans) => progress(reading$1, spans)),
|
|
23751
24087
|
read(reading$1),
|
|
23752
24088
|
listSent(reading$1),
|
|
23753
24089
|
app.state.remarksOn ? list$2(reading$1) : succeed$1([]),
|
|
@@ -23919,7 +24255,7 @@ var init_branches = __esmMin((() => {
|
|
|
23919
24255
|
const branch = selectedBranch(app.state);
|
|
23920
24256
|
if (branch === void 0) return;
|
|
23921
24257
|
const reading = yield* readingOf(app, branch.branch);
|
|
23922
|
-
const [sent, progress$1] = yield* all([listSent(reading), progress(reading)]);
|
|
24258
|
+
const [sent, progress$1] = yield* all([listSent(reading), flatMap(spansIn(reading), (spans) => progress(reading, spans))]);
|
|
23923
24259
|
if (sameSent(app.state.sent, sent) && sameMarks(app.state, progress$1)) return;
|
|
23924
24260
|
app.commit(withVouched({
|
|
23925
24261
|
...app.state,
|
|
@@ -26021,13 +26357,25 @@ const baseClear = fn("Main.baseClear")(function* (options) {
|
|
|
26021
26357
|
const report = yield* clearBase(yield* required(options, "repo"), yield* worktreeIn(options));
|
|
26022
26358
|
yield* answer(options, { base: report });
|
|
26023
26359
|
});
|
|
26024
|
-
const
|
|
26025
|
-
const
|
|
26026
|
-
|
|
26360
|
+
const rangeIn = fn("Main.rangeIn")(function* (options, worktree) {
|
|
26361
|
+
const file = yield* required(options, "file");
|
|
26362
|
+
if (options["from"] !== void 0 || options["to"] !== void 0) return yield* picked(worktree, {
|
|
26363
|
+
file,
|
|
26364
|
+
from: yield* spot(options, "from"),
|
|
26365
|
+
to: yield* spot(options, options["to"] === void 0 ? "from" : "to")
|
|
26366
|
+
});
|
|
26367
|
+
return {
|
|
26368
|
+
file,
|
|
26027
26369
|
start: yield* numeric(options, "start"),
|
|
26028
26370
|
end: yield* numeric(options, "end"),
|
|
26371
|
+
side: yield* oneOf(options, "side", ["old", "new"], "new")
|
|
26372
|
+
};
|
|
26373
|
+
});
|
|
26374
|
+
const commentSend = fn("Main.commentSend")(function* (options) {
|
|
26375
|
+
const worktree = yield* worktreeIn(options);
|
|
26376
|
+
const batch = yield* submit(worktree, {
|
|
26377
|
+
...yield* rangeIn(options, worktree),
|
|
26029
26378
|
body: yield* required(options, "body"),
|
|
26030
|
-
side: yield* oneOf(options, "side", ["old", "new"], "new"),
|
|
26031
26379
|
id: options["id"] ?? randomUUID(),
|
|
26032
26380
|
at: stamp(options)
|
|
26033
26381
|
});
|
|
@@ -26038,12 +26386,10 @@ const draftList = fn("Main.draftList")(function* (options) {
|
|
|
26038
26386
|
yield* answer(options, { drafts });
|
|
26039
26387
|
});
|
|
26040
26388
|
const draftAdd = fn("Main.draftAdd")(function* (options) {
|
|
26041
|
-
const
|
|
26042
|
-
|
|
26043
|
-
|
|
26044
|
-
end: yield* numeric(options, "end"),
|
|
26389
|
+
const worktree = yield* worktreeIn(options);
|
|
26390
|
+
const draft = yield* add$1(worktree, {
|
|
26391
|
+
...yield* rangeIn(options, worktree),
|
|
26045
26392
|
body: yield* required(options, "body"),
|
|
26046
|
-
side: yield* oneOf(options, "side", ["old", "new"], "new"),
|
|
26047
26393
|
id: options["id"] ?? randomUUID(),
|
|
26048
26394
|
at: stamp(options),
|
|
26049
26395
|
wroteBy: "agent"
|
|
@@ -26133,8 +26479,12 @@ const remarkRestore = fn("Main.remarkRestore")(function* (options) {
|
|
|
26133
26479
|
yield* answer(options, { restored: report.restored });
|
|
26134
26480
|
});
|
|
26135
26481
|
const commentList = fn("Main.commentList")(function* (options) {
|
|
26136
|
-
const
|
|
26137
|
-
yield*
|
|
26482
|
+
const reading = yield* readingIn(options);
|
|
26483
|
+
const comments = yield* placeThreads(reading, yield* list$3(reading));
|
|
26484
|
+
yield* answer(options, {
|
|
26485
|
+
comments,
|
|
26486
|
+
files: byFile$1(comments)
|
|
26487
|
+
});
|
|
26138
26488
|
});
|
|
26139
26489
|
const resolveRead = fn("Main.resolveRead")(function* (options) {
|
|
26140
26490
|
const report = yield* settleRead(yield* worktreeIn(options), stamp(options));
|
|
@@ -26206,13 +26556,19 @@ const vouched = fn("Main.vouched")(function* (options) {
|
|
|
26206
26556
|
});
|
|
26207
26557
|
const fileReview = fn("Main.fileReview")(function* (options) {
|
|
26208
26558
|
const report = yield* vouched(options);
|
|
26559
|
+
const layers = yield* view(yield* readingIn(options));
|
|
26209
26560
|
yield* answer(options, {
|
|
26210
26561
|
reviewed: report.vouched,
|
|
26211
|
-
total: report.total
|
|
26562
|
+
total: report.total,
|
|
26563
|
+
...match$3(layers, {
|
|
26564
|
+
onNone: () => ({}),
|
|
26565
|
+
onSome: (found) => ({ layers: found })
|
|
26566
|
+
})
|
|
26212
26567
|
});
|
|
26213
26568
|
});
|
|
26214
26569
|
const reviewStatus = fn("Main.reviewStatus")(function* (options) {
|
|
26215
|
-
const
|
|
26570
|
+
const reading = yield* readingIn(options);
|
|
26571
|
+
const report = yield* progress(reading, yield* spansIn(reading));
|
|
26216
26572
|
yield* answer(options, {
|
|
26217
26573
|
reviewed: report.vouched,
|
|
26218
26574
|
changed: report.changed,
|
|
@@ -26237,15 +26593,17 @@ const layersShow = fn("Main.layersShow")(function* (options) {
|
|
|
26237
26593
|
});
|
|
26238
26594
|
const patchShow = fn("Main.patchShow")(function* (options) {
|
|
26239
26595
|
const based = yield* basedAt(yield* required(options, "worktree"), options["base"]);
|
|
26240
|
-
const
|
|
26596
|
+
const shown = yield* show$3(based, {
|
|
26241
26597
|
file: options["file"],
|
|
26242
26598
|
context: yield* around$1(options, "context")
|
|
26243
26599
|
});
|
|
26600
|
+
const patch = yield* tagRows(based.worktree, shown);
|
|
26244
26601
|
yield* answer(options, { patch });
|
|
26245
26602
|
});
|
|
26246
26603
|
const patchSince = fn("Main.patchSince")(function* (options) {
|
|
26247
26604
|
const based = yield* basedAt(yield* required(options, "worktree"), options["base"]);
|
|
26248
|
-
const
|
|
26605
|
+
const shown = yield* since(based, yield* required(options, "file"), { context: yield* around$1(options, "context") });
|
|
26606
|
+
const file = yield* tagSince(based.worktree, shown);
|
|
26249
26607
|
yield* answer(options, { file });
|
|
26250
26608
|
});
|
|
26251
26609
|
const configList = fn("Main.configList")(function* (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.199",
|
|
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": {
|