@eliya-oss/agent-diff 0.1.0-alpha.193 → 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 +42 -0
- package/dist/main.js +414 -172
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
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
|
+
|
|
18
|
+
## 0.1.0-alpha.194
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- fix(store): marking several files at the same moment never fails on a half-written review state.
|
|
23
|
+
|
|
24
|
+
<details><summary>What was wrong</summary>
|
|
25
|
+
|
|
26
|
+
adiff wrote the review's state over the old file in place, and marking a file read that state
|
|
27
|
+
before taking the lock. A mark that read it mid-write saw half a file and exited with an error.
|
|
28
|
+
Each write now goes to a file beside it and is renamed into place, so a reader sees the old
|
|
29
|
+
state or the new one, never a mix.
|
|
30
|
+
|
|
31
|
+
</details>
|
|
32
|
+
|
|
33
|
+
- fix(marks): a file marked reviewed stays reviewed when git starts printing longer hashes.
|
|
34
|
+
|
|
35
|
+
<details><summary>What was wrong</summary>
|
|
36
|
+
|
|
37
|
+
git lengthens its short hashes as a repository grows, so the same content printed as `defbbd93c`
|
|
38
|
+
one month prints as `defbbd93c6` the next. adiff compared the hash a mark was made under with the
|
|
39
|
+
one it reads now as plain text, so every older mark lapsed: `review progress` listed the file as
|
|
40
|
+
changed since review with no line changed. Two hashes now count as the same file when one starts
|
|
41
|
+
with the other, and a new mark records the full hash.
|
|
42
|
+
|
|
43
|
+
</details>
|
|
44
|
+
|
|
3
45
|
## 0.1.0-alpha.193
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -2686,7 +2686,7 @@ var init_references = __esmMin((() => {
|
|
|
2686
2686
|
};
|
|
2687
2687
|
};
|
|
2688
2688
|
spanCleaner = /*#__PURE__*/ makeStackCleaner(3);
|
|
2689
|
-
})), Interrupt, causeInterrupt, findFail, findError$1, findDefect, hasInterrupts, causeFilterInterruptors, hasInterruptsOnly$1, causeCombine, causeMap, causePartition, causeSquash, causePrettyErrors, causePrettyError, causePrettyMessage, locationRegExp, cleanErrorStack, addStackAnnotations, interruptCauseStack, currentStackTrace, causePretty, renderPrettyError, renderErrorCause, FiberTypeId, fiberVariance, fiberIdStore, getCurrentFiber, FiberImpl, deferredInterruptCont, fiberMiddleware, fiberStackAnnotations, fiberAwait, fiberAwaitAll, fiberJoin, fiberInterrupt, fiberInterruptAs, fiberInterruptAll, succeed$5, failCause$3, fail$2, sync$1, suspend$1, yieldNowWith, yieldNow, succeedNone$1, failCauseSync$1, die$1, failSync, void_$2, try_$1, promise$1, tryPromise$1, withFiberId, callbackOptions, asyncFinalizer, callback$2, never, gen$1, fnUntraced$1, defineFunctionLength, fnStackCleaner, fn$1, makeFn, fnUntracedEager$1, fromIteratorEagerUnsafe, fromIteratorUnsafe, as$1, asSome, andThen$1, tap$1, asVoid$1, raceAllFirst, raceFirst$1, flatMap$1, OnSuccessProto, effectIsExit, flatMapEager$1, map$3, mapEager$1, mapErrorEager$1, catchEager$1, exitInterrupt$1, exitIsSuccess, exitIsFailure, exitFilterCause, exitHasInterrupts, exitVoid, exitMap, exitMapError, exitAsVoidAll, updateContext, updateService, context$1, getContext, contextWith$1, provideContext, provideService$1, provideServiceImpl, when$1, forever$2, catchCause$1, OnFailureProto, catchCauseFilter, catch_, catchDefect$1, catchIf, catchFilter, catchTag$1, catchTags$1, mapError$1, orDie$1, orElseSucceed$1, ignore$1, option$3, result$1, matchCauseEffect, OnSuccessAndFailureProto, matchEffect$1, match, matchEager, exit$1, exitPrimitive, ScopeTypeId, ScopeCloseableTypeId, scopeTag, scopeClose, scopeCloseUnsafe, scopeCloseFinalizers, scopeForkUnsafe, scopeAddFinalizerExit, scopeAddFinalizer, scopeAddFinalizerUnsafe, scopeRemoveFinalizerUnsafe, scopeMakeUnsafe, constScopeEmpty, scope, provideScope, scoped$1, scopedWith, acquireRelease$1, addFinalizer$2, onExitPrimitive, onExit$1, ensuring$1, onExitFilter, onError$1, onErrorFilter, onInterrupt$1, acquireUseRelease$1, interrupt$1, uninterruptible$1, setInterruptible, setInterruptibleTrue, setInterruptibleFalse, setFiberInterruptible, interruptible, uninterruptibleMask$1, all$1, whileLoop$1, forEach$1, forEachSequential, iterateEagerImpl, iterateEager, forEachConcurrent, filter$2, forkUnsafe$1, forkIn$1, forkScoped$1, runForkWith$1, runFork$1, runPromiseExitWith, runPromiseWith, runPromise$1, runSyncExitWith, runSyncExit$1, runSyncWith, runSync$1, succeedTrue, succeedFalse, Latch, makeLatchUnsafe, bigint0, NoopSpanProto, noopSpan, filterDisablePropagation, makeSpanUnsafe, provideSpanStackFrame, endSpan, useSpan, provideParentSpan, withParentSpan, withSpan$1, ClockRef, MAX_TIMER_MILLIS, ClockImpl, nanosPerMilli, monotonicNowNanos, wallTimeNanos, clockWith, sleep$1, AsyncFiberErrorTypeId, AsyncFiberError, UnknownErrorTypeId, UnknownError, ConsoleRef, logLevelToOrder, LogLevelOrder, isLogLevelGreaterThan, CurrentLoggers, LogToStderr, LoggerTypeId, LoggerProto, loggerMake, formatLabel, formatLogSpan, logWithLevel, colors, defaultDateFormat, defaultLogger, tracerLogger, init_effect = __esmMin((() => {
|
|
2689
|
+
})), Interrupt, causeInterrupt, findFail, findError$1, findDefect, hasInterrupts, causeFilterInterruptors, hasInterruptsOnly$1, causeCombine, causeMap, causePartition, causeSquash, causePrettyErrors, causePrettyError, causePrettyMessage, locationRegExp, cleanErrorStack, addStackAnnotations, interruptCauseStack, currentStackTrace, causePretty, renderPrettyError, renderErrorCause, FiberTypeId, fiberVariance, fiberIdStore, getCurrentFiber, FiberImpl, deferredInterruptCont, fiberMiddleware, fiberStackAnnotations, fiberAwait, fiberAwaitAll, fiberJoin, fiberInterrupt, fiberInterruptAs, fiberInterruptAll, succeed$5, failCause$3, fail$2, sync$1, suspend$1, yieldNowWith, yieldNow, succeedNone$1, failCauseSync$1, die$1, failSync, void_$2, try_$1, promise$1, tryPromise$1, withFiberId, callbackOptions, asyncFinalizer, callback$2, never, gen$1, fnUntraced$1, defineFunctionLength, fnStackCleaner, fn$1, makeFn, fnUntracedEager$1, fromIteratorEagerUnsafe, fromIteratorUnsafe, as$1, asSome, andThen$1, tap$1, asVoid$1, raceAllFirst, raceFirst$1, flatMap$1, OnSuccessProto, effectIsExit, flatMapEager$1, map$3, mapEager$1, mapErrorEager$1, catchEager$1, exitInterrupt$1, exitIsSuccess, exitIsFailure, exitFilterCause, exitHasInterrupts, exitVoid, exitMap, exitMapError, exitAsVoidAll, updateContext, updateService, context$1, getContext, contextWith$1, provideContext, provideService$1, provideServiceImpl, when$1, forever$2, catchCause$1, OnFailureProto, catchCauseFilter, catch_, catchDefect$1, tapCauseFilter, tapError$1, catchIf, catchFilter, catchTag$1, catchTags$1, mapError$1, orDie$1, orElseSucceed$1, ignore$1, option$3, result$1, matchCauseEffect, OnSuccessAndFailureProto, matchEffect$1, match, matchEager, exit$1, exitPrimitive, ScopeTypeId, ScopeCloseableTypeId, scopeTag, scopeClose, scopeCloseUnsafe, scopeCloseFinalizers, scopeForkUnsafe, scopeAddFinalizerExit, scopeAddFinalizer, scopeAddFinalizerUnsafe, scopeRemoveFinalizerUnsafe, scopeMakeUnsafe, constScopeEmpty, scope, provideScope, scoped$1, scopedWith, acquireRelease$1, addFinalizer$2, onExitPrimitive, onExit$1, ensuring$1, onExitFilter, onError$1, onErrorFilter, onInterrupt$1, acquireUseRelease$1, interrupt$1, uninterruptible$1, setInterruptible, setInterruptibleTrue, setInterruptibleFalse, setFiberInterruptible, interruptible, uninterruptibleMask$1, all$1, whileLoop$1, forEach$1, forEachSequential, iterateEagerImpl, iterateEager, forEachConcurrent, filter$2, forkUnsafe$1, forkIn$1, forkScoped$1, runForkWith$1, runFork$1, runPromiseExitWith, runPromiseWith, runPromise$1, runSyncExitWith, runSyncExit$1, runSyncWith, runSync$1, succeedTrue, succeedFalse, Latch, makeLatchUnsafe, bigint0, NoopSpanProto, noopSpan, filterDisablePropagation, makeSpanUnsafe, provideSpanStackFrame, endSpan, useSpan, provideParentSpan, withParentSpan, withSpan$1, ClockRef, MAX_TIMER_MILLIS, ClockImpl, nanosPerMilli, monotonicNowNanos, wallTimeNanos, clockWith, sleep$1, AsyncFiberErrorTypeId, AsyncFiberError, UnknownErrorTypeId, UnknownError, ConsoleRef, logLevelToOrder, LogLevelOrder, isLogLevelGreaterThan, CurrentLoggers, LogToStderr, LoggerTypeId, LoggerProto, loggerMake, formatLabel, formatLogSpan, logWithLevel, colors, defaultDateFormat, defaultLogger, tracerLogger, init_effect = __esmMin((() => {
|
|
2690
2690
|
init_Array();
|
|
2691
2691
|
init_Context();
|
|
2692
2692
|
init_Duration();
|
|
@@ -3502,6 +3502,12 @@ var init_references = __esmMin((() => {
|
|
|
3502
3502
|
}));
|
|
3503
3503
|
catch_ = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findError$1, (e) => f(e)));
|
|
3504
3504
|
catchDefect$1 = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findDefect, f));
|
|
3505
|
+
tapCauseFilter = /*#__PURE__*/ dual(3, (self, filter, f) => catchCause$1(self, (cause) => {
|
|
3506
|
+
const result = filter(cause);
|
|
3507
|
+
if (isFailure$1(result)) return failCause$3(cause);
|
|
3508
|
+
return andThen$1(internalCall(() => f(result.success, cause)), failCause$3(cause));
|
|
3509
|
+
}));
|
|
3510
|
+
tapError$1 = /*#__PURE__*/ dual(2, (self, f) => tapCauseFilter(self, findError$1, (e) => f(e)));
|
|
3505
3511
|
catchIf = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$1(self, (cause) => {
|
|
3506
3512
|
const error = findError$1(cause);
|
|
3507
3513
|
if (isFailure$1(error)) return failCause$3(error.failure);
|
|
@@ -4807,7 +4813,7 @@ var repeatOrElse, retryOrElse, repeat$1, retry$1, passthroughForever, buildFromO
|
|
|
4807
4813
|
if (options.times !== void 0) schedule = while_(schedule, ({ attempt }) => succeed$5(attempt <= options.times));
|
|
4808
4814
|
return schedule;
|
|
4809
4815
|
};
|
|
4810
|
-
})), isEffect, all, forEach, whileLoop, promise, tryPromise, succeed$1, succeedNone, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, die, try_, withFiber, flatMap, andThen, tap, result, option$2, exit, map$1, as, asVoid, catchTag, catchTags, catchCause, catchDefect, mapError, orDie, retry, ignore, orElseSucceed, sleep, raceFirst, filter$1, when, context, contextWith, provide, provideService, scoped, acquireRelease, acquireUseRelease, addFinalizer, ensuring, onError, onExit, interrupt, onInterrupt, uninterruptible, uninterruptibleMask, forever, repeat, withSpan, forkIn, forkScoped, runFork, runForkWith, runPromise, runSync, runSyncExit, fnUntraced, fn, mapEager, mapErrorEager, flatMapEager, catchEager, fnUntracedEager;
|
|
4816
|
+
})), isEffect, all, forEach, whileLoop, promise, tryPromise, succeed$1, succeedNone, suspend, sync, void_, callback$1, gen, fail, failCause, failCauseSync, die, try_, withFiber, flatMap, andThen, tap, result, option$2, exit, map$1, as, asVoid, catchTag, catchTags, catchCause, catchDefect, mapError, orDie, tapError, retry, ignore, orElseSucceed, sleep, raceFirst, filter$1, when, context, contextWith, provide, provideService, scoped, acquireRelease, acquireUseRelease, addFinalizer, ensuring, onError, onExit, interrupt, onInterrupt, uninterruptible, uninterruptibleMask, forever, repeat, withSpan, forkIn, forkScoped, runFork, runForkWith, runPromise, runSync, runSyncExit, fnUntraced, fn, mapEager, mapErrorEager, flatMapEager, catchEager, fnUntracedEager;
|
|
4811
4817
|
var init_Effect = __esmMin((() => {
|
|
4812
4818
|
init_Context();
|
|
4813
4819
|
init_core();
|
|
@@ -4848,6 +4854,7 @@ var init_Effect = __esmMin((() => {
|
|
|
4848
4854
|
catchDefect = catchDefect$1;
|
|
4849
4855
|
mapError = mapError$1;
|
|
4850
4856
|
orDie = orDie$1;
|
|
4857
|
+
tapError = tapError$1;
|
|
4851
4858
|
retry = retry$1;
|
|
4852
4859
|
ignore = ignore$1;
|
|
4853
4860
|
orElseSucceed = orElseSucceed$1;
|
|
@@ -10076,7 +10083,7 @@ var init_config = __esmMin((() => {
|
|
|
10076
10083
|
//#region package.json
|
|
10077
10084
|
init_pane();
|
|
10078
10085
|
init_config();
|
|
10079
|
-
var version$1 = "0.1.0-alpha.
|
|
10086
|
+
var version$1 = "0.1.0-alpha.195";
|
|
10080
10087
|
//#endregion
|
|
10081
10088
|
//#region src/cli/error.ts
|
|
10082
10089
|
var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
|
|
@@ -10284,7 +10291,7 @@ var init_upgrade$1 = __esmMin((() => {
|
|
|
10284
10291
|
}));
|
|
10285
10292
|
//#endregion
|
|
10286
10293
|
//#region src/cli/catalog.ts
|
|
10287
|
-
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;
|
|
10288
10295
|
var init_catalog = __esmMin((() => {
|
|
10289
10296
|
WAIT_MOST = 86400;
|
|
10290
10297
|
worktreeOf$1 = {
|
|
@@ -10316,13 +10323,13 @@ var init_catalog = __esmMin((() => {
|
|
|
10316
10323
|
repoOf$1,
|
|
10317
10324
|
branchOf
|
|
10318
10325
|
];
|
|
10319
|
-
baseOf = {
|
|
10326
|
+
baseOf$1 = {
|
|
10320
10327
|
name: "base",
|
|
10321
10328
|
required: false,
|
|
10322
10329
|
value: "ref",
|
|
10323
10330
|
about: "Ref to diff against, instead of the one this branch is stacked on. `auto` asks for the stacked parent explicitly"
|
|
10324
10331
|
};
|
|
10325
|
-
based = [...addressing, baseOf];
|
|
10332
|
+
based = [...addressing, baseOf$1];
|
|
10326
10333
|
repo = {
|
|
10327
10334
|
name: "repo",
|
|
10328
10335
|
required: true,
|
|
@@ -10385,7 +10392,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10385
10392
|
group: READ_A_BRANCH,
|
|
10386
10393
|
addresses: "repo",
|
|
10387
10394
|
safety: "read",
|
|
10388
|
-
options: [repo, baseOf],
|
|
10395
|
+
options: [repo, baseOf$1],
|
|
10389
10396
|
dataKey: "branches",
|
|
10390
10397
|
example: "adiff branch list --repo . --fields branch,files"
|
|
10391
10398
|
},
|
|
@@ -10398,7 +10405,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10398
10405
|
options: [
|
|
10399
10406
|
repo,
|
|
10400
10407
|
opening$2,
|
|
10401
|
-
baseOf
|
|
10408
|
+
baseOf$1
|
|
10402
10409
|
],
|
|
10403
10410
|
dataKey: "",
|
|
10404
10411
|
example: "adiff review open --repo . --branch add-invitations"
|
|
@@ -10412,7 +10419,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10412
10419
|
options: [
|
|
10413
10420
|
repo,
|
|
10414
10421
|
opening$2,
|
|
10415
|
-
baseOf
|
|
10422
|
+
baseOf$1
|
|
10416
10423
|
],
|
|
10417
10424
|
dataKey: "pane",
|
|
10418
10425
|
example: "adiff review pane --repo ."
|
|
@@ -11621,11 +11628,69 @@ var init_model$5 = __esmMin((() => {
|
|
|
11621
11628
|
lineOn = (row, side) => side === "new" ? row.newLine : row.oldLine;
|
|
11622
11629
|
}));
|
|
11623
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
|
|
11624
11688
|
//#region src/domain/patch/anchor.ts
|
|
11625
|
-
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;
|
|
11626
11690
|
var init_anchor = __esmMin((() => {
|
|
11627
11691
|
init_dist();
|
|
11628
11692
|
init_model$5();
|
|
11693
|
+
init_sticky();
|
|
11629
11694
|
sideOf$1 = (rows) => rows.some((row) => isSome(row.newLine)) ? "new" : "old";
|
|
11630
11695
|
linesOn = (rows, side) => rows.flatMap((row) => match$3(lineOn(row, side), {
|
|
11631
11696
|
onNone: () => [],
|
|
@@ -11689,10 +11754,9 @@ var init_anchor = __esmMin((() => {
|
|
|
11689
11754
|
return room >= SHORTEST_NEAR && edits(one, other) <= Math.floor(room / PER_EDIT);
|
|
11690
11755
|
};
|
|
11691
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;
|
|
11692
|
-
|
|
11757
|
+
exactlyIn = (lines, wanted) => {
|
|
11693
11758
|
const said = wanted.snippet.split("\n");
|
|
11694
11759
|
if (said.every((text) => text.trim().length === 0)) return none();
|
|
11695
|
-
const lines = sideLines(patch, wanted.side);
|
|
11696
11760
|
const whole = nearestRun(lines, said, wanted.start);
|
|
11697
11761
|
if (whole !== void 0) return some({
|
|
11698
11762
|
side: wanted.side,
|
|
@@ -11708,17 +11772,78 @@ var init_anchor = __esmMin((() => {
|
|
|
11708
11772
|
end: opening
|
|
11709
11773
|
});
|
|
11710
11774
|
};
|
|
11711
|
-
|
|
11775
|
+
alikeIn = (lines, wanted) => {
|
|
11712
11776
|
const first = wanted.snippet.split("\n")[0] ?? "";
|
|
11713
11777
|
if (first.trim().length === 0) return none();
|
|
11714
|
-
const alike = nearestLike(
|
|
11778
|
+
const alike = nearestLike(lines, first, wanted.start);
|
|
11715
11779
|
return alike === void 0 ? none() : some({
|
|
11716
11780
|
side: wanted.side,
|
|
11717
11781
|
start: alike,
|
|
11718
11782
|
end: alike
|
|
11719
11783
|
});
|
|
11720
11784
|
};
|
|
11721
|
-
|
|
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
|
+
};
|
|
11722
11847
|
}));
|
|
11723
11848
|
//#endregion
|
|
11724
11849
|
//#region src/domain/patch/reindent.ts
|
|
@@ -12025,66 +12150,10 @@ var init_parse = __esmMin((() => {
|
|
|
12025
12150
|
};
|
|
12026
12151
|
}));
|
|
12027
12152
|
//#endregion
|
|
12028
|
-
//#region src/domain/patch/sticky.ts
|
|
12029
|
-
var CLOSER, COMMENT, LOOKAHEAD, indentOf, pinnable, limitFrom, enclosing, read$3, enclosedBy, scopeLines, stickyChain, kept;
|
|
12030
|
-
var init_sticky = __esmMin((() => {
|
|
12031
|
-
CLOSER = /^[)\]}>;,]/;
|
|
12032
|
-
COMMENT = /^(\/\/|\/\*|\*|#|<!--)/;
|
|
12033
|
-
LOOKAHEAD = 5;
|
|
12034
|
-
indentOf = (text) => text.length - text.trimStart().length;
|
|
12035
|
-
pinnable = (text) => {
|
|
12036
|
-
const trimmed = text.trim();
|
|
12037
|
-
if (trimmed.length === 0) return false;
|
|
12038
|
-
return !CLOSER.test(trimmed) && !COMMENT.test(trimmed);
|
|
12039
|
-
};
|
|
12040
|
-
limitFrom = (source, index) => {
|
|
12041
|
-
const here = source[index] ?? "";
|
|
12042
|
-
if (here.trim().length > 0) return indentOf(here);
|
|
12043
|
-
const ahead = source.slice(index, index + LOOKAHEAD).find((line) => line.trim().length > 0);
|
|
12044
|
-
return ahead === void 0 ? 0 : indentOf(ahead);
|
|
12045
|
-
};
|
|
12046
|
-
enclosing = (source) => {
|
|
12047
|
-
const open = [];
|
|
12048
|
-
const found = [];
|
|
12049
|
-
source.forEach((text, index) => {
|
|
12050
|
-
const limit = limitFrom(source, index);
|
|
12051
|
-
const outer = open.findLast((at) => indentOf(source[at] ?? "") < limit);
|
|
12052
|
-
found.push(outer === void 0 ? 0 : outer + 1);
|
|
12053
|
-
if (!pinnable(text)) return;
|
|
12054
|
-
const indent = indentOf(text);
|
|
12055
|
-
while (open.length > 0 && indentOf(source[open.at(-1) ?? 0] ?? "") >= indent) open.pop();
|
|
12056
|
-
open.push(index);
|
|
12057
|
-
});
|
|
12058
|
-
return found;
|
|
12059
|
-
};
|
|
12060
|
-
read$3 = /* @__PURE__ */ new WeakMap();
|
|
12061
|
-
enclosedBy = (source) => {
|
|
12062
|
-
const known = read$3.get(source);
|
|
12063
|
-
if (known !== void 0) return known;
|
|
12064
|
-
const found = enclosing(source);
|
|
12065
|
-
read$3.set(source, found);
|
|
12066
|
-
return found;
|
|
12067
|
-
};
|
|
12068
|
-
scopeLines = (source) => [...new Set(enclosedBy(source).filter((line) => line > 0))].toSorted((left, right) => left - right);
|
|
12069
|
-
stickyChain = (source, line, max) => {
|
|
12070
|
-
const index = line - 1;
|
|
12071
|
-
if (index <= 0 || index >= source.length) return [];
|
|
12072
|
-
const outer = enclosedBy(source);
|
|
12073
|
-
const chain = [];
|
|
12074
|
-
for (let at = outer[index] ?? 0; at > 0; at = outer[at - 1] ?? 0) chain.push(source[at - 1] ?? "");
|
|
12075
|
-
return kept(chain.toReversed(), max);
|
|
12076
|
-
};
|
|
12077
|
-
kept = (chain, max) => {
|
|
12078
|
-
if (chain.length <= max || max < 2) return chain.slice(0, max);
|
|
12079
|
-
const outer = chain[0] ?? "";
|
|
12080
|
-
const inner = chain.slice(chain.length - (max - 1));
|
|
12081
|
-
return [`${outer} ⋯`, ...inner];
|
|
12082
|
-
};
|
|
12083
|
-
}));
|
|
12084
|
-
//#endregion
|
|
12085
12153
|
//#region src/domain/patch/index.ts
|
|
12086
12154
|
var init_patch = __esmMin((() => {
|
|
12087
12155
|
init_anchor();
|
|
12156
|
+
init_follow();
|
|
12088
12157
|
init_parse();
|
|
12089
12158
|
init_sticky();
|
|
12090
12159
|
init_model$5();
|
|
@@ -12290,11 +12359,12 @@ var init_service$2 = __esmMin((() => {
|
|
|
12290
12359
|
});
|
|
12291
12360
|
findKept = fn("Git.kept")(function* (worktree, blob) {
|
|
12292
12361
|
if (blob.length === 0) return none();
|
|
12362
|
+
const named = blob.includes(":") ? blob : `${blob}^{blob}`;
|
|
12293
12363
|
const found = (yield* gitOrEmpty(worktree.path, [
|
|
12294
12364
|
"rev-parse",
|
|
12295
12365
|
"--verify",
|
|
12296
12366
|
"--quiet",
|
|
12297
|
-
|
|
12367
|
+
named
|
|
12298
12368
|
])).trim();
|
|
12299
12369
|
return found.length === 0 ? none() : some(found);
|
|
12300
12370
|
});
|
|
@@ -12516,7 +12586,8 @@ var init_schema = __esmMin((() => {
|
|
|
12516
12586
|
snippet: String$1,
|
|
12517
12587
|
side: Side,
|
|
12518
12588
|
start: Int,
|
|
12519
|
-
end: Int
|
|
12589
|
+
end: Int,
|
|
12590
|
+
version: optionalKey(String$1)
|
|
12520
12591
|
});
|
|
12521
12592
|
StoredComment = Struct({
|
|
12522
12593
|
id: String$1,
|
|
@@ -12663,7 +12734,7 @@ var init_paths = __esmMin((() => {
|
|
|
12663
12734
|
}));
|
|
12664
12735
|
//#endregion
|
|
12665
12736
|
//#region src/service/store/service.ts
|
|
12666
|
-
var Store, ensureDir, readOptional, missing$2, damaged, jsonOf$2, decoded, unwritable, wrote, added$1, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeRemarks, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asRemarks, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, parseRemarks, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, branchKeyIn, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, remarksOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$2, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
|
|
12737
|
+
var Store, ensureDir, readOptional, missing$2, damaged, jsonOf$2, decoded, unwritable, besideOf, wrote, added$1, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeRemarks, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asRemarks, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, parseRemarks, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, branchKeyIn, branchKeyOf, wasKeyOf, there, moved, adopt, SPLIT, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, remarksOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$2, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
|
|
12667
12738
|
var init_service$1 = __esmMin((() => {
|
|
12668
12739
|
init_dist();
|
|
12669
12740
|
init_git();
|
|
@@ -12707,10 +12778,17 @@ var init_service$1 = __esmMin((() => {
|
|
|
12707
12778
|
path,
|
|
12708
12779
|
reason: String(reason)
|
|
12709
12780
|
});
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12713
|
-
|
|
12781
|
+
besideOf = (path) => `${path}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
12782
|
+
wrote = (path, body) => {
|
|
12783
|
+
const beside = besideOf(path);
|
|
12784
|
+
return tryPromise({
|
|
12785
|
+
try: () => writeFile(beside, body, "utf8"),
|
|
12786
|
+
catch: unwritable(path)
|
|
12787
|
+
}).pipe(andThen(tryPromise({
|
|
12788
|
+
try: () => rename(beside, path),
|
|
12789
|
+
catch: unwritable(path)
|
|
12790
|
+
})), tapError(() => promise(() => rm(beside, { force: true }))));
|
|
12791
|
+
};
|
|
12714
12792
|
added$1 = (path, body) => tryPromise({
|
|
12715
12793
|
try: () => appendFile(path, `${body}\n`, "utf8"),
|
|
12716
12794
|
catch: unwritable(path)
|
|
@@ -12995,13 +13073,7 @@ var init_service$1 = __esmMin((() => {
|
|
|
12995
13073
|
const key = yield* keyOf(worktreePath);
|
|
12996
13074
|
const path = watchPath(root, key);
|
|
12997
13075
|
yield* ensureDir(branchDir(root, key));
|
|
12998
|
-
yield*
|
|
12999
|
-
try: () => writeFile(path, JSON.stringify({ lookedAt: at }), "utf8"),
|
|
13000
|
-
catch: (cause) => new StoreUnwritable({
|
|
13001
|
-
path,
|
|
13002
|
-
reason: String(cause)
|
|
13003
|
-
})
|
|
13004
|
-
});
|
|
13076
|
+
yield* wrote(path, JSON.stringify({ lookedAt: at }));
|
|
13005
13077
|
})
|
|
13006
13078
|
};
|
|
13007
13079
|
};
|
|
@@ -13370,7 +13442,7 @@ var init_branches$1 = __esmMin((() => {
|
|
|
13370
13442
|
}));
|
|
13371
13443
|
//#endregion
|
|
13372
13444
|
//#region src/review/patches.ts
|
|
13373
|
-
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;
|
|
13374
13446
|
var init_patches = __esmMin((() => {
|
|
13375
13447
|
init_dist();
|
|
13376
13448
|
init_patch();
|
|
@@ -13379,7 +13451,7 @@ var init_patches = __esmMin((() => {
|
|
|
13379
13451
|
init_branches$1();
|
|
13380
13452
|
findPatch = (patches, file) => fromNullishOr(patches.find((patch) => patch.path === file));
|
|
13381
13453
|
blobOf = (patches, file) => map$5(findPatch(patches, file), (patch) => patch.blob);
|
|
13382
|
-
|
|
13454
|
+
anchorWith = fn("Review.Diff.anchorWith")(function* (worktree, request) {
|
|
13383
13455
|
const only = yield* patches(worktree, WHOLE_FILE, request.file);
|
|
13384
13456
|
const found = only.length > 0 ? only : yield* patches(worktree, WHOLE_FILE);
|
|
13385
13457
|
const patch = findPatch(found, request.file);
|
|
@@ -13397,9 +13469,13 @@ var init_patches = __esmMin((() => {
|
|
|
13397
13469
|
start: request.start,
|
|
13398
13470
|
end: request.end
|
|
13399
13471
|
}),
|
|
13400
|
-
onSome: succeed$1
|
|
13472
|
+
onSome: (made) => succeed$1({
|
|
13473
|
+
anchor: made,
|
|
13474
|
+
patch: resolved
|
|
13475
|
+
})
|
|
13401
13476
|
});
|
|
13402
13477
|
});
|
|
13478
|
+
anchor = (worktree, request) => map$1(anchorWith(worktree, request), (found) => found.anchor);
|
|
13403
13479
|
list$4 = patches;
|
|
13404
13480
|
source = fn("Review.Diff.source")(function* (worktree, file) {
|
|
13405
13481
|
const found = yield* (yield* Git).source(worktree, file);
|
|
@@ -13678,8 +13754,150 @@ var init_layers$1 = __esmMin((() => {
|
|
|
13678
13754
|
init_model$3();
|
|
13679
13755
|
}));
|
|
13680
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
|
|
13681
13899
|
//#region src/review/comments.ts
|
|
13682
|
-
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;
|
|
13683
13901
|
var init_comments$1 = __esmMin((() => {
|
|
13684
13902
|
init_dist();
|
|
13685
13903
|
init_patch();
|
|
@@ -13689,6 +13907,7 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13689
13907
|
init_error$2();
|
|
13690
13908
|
init_branches$1();
|
|
13691
13909
|
init_patches();
|
|
13910
|
+
init_placing();
|
|
13692
13911
|
POLL = "500 millis";
|
|
13693
13912
|
bodyOf = (entry) => entry.body;
|
|
13694
13913
|
saidTo = (spoken, id) => spoken.filter((entry) => entry.comment === id).length;
|
|
@@ -13723,6 +13942,8 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13723
13942
|
settled: Object.hasOwn(settled, comment.id),
|
|
13724
13943
|
removed: Object.hasOwn(removed, comment.id),
|
|
13725
13944
|
stale: comment.head !== head,
|
|
13945
|
+
outdated: comment.placed !== false && comment.outdated === true,
|
|
13946
|
+
reworded: comment.placed !== false && comment.reworded === true,
|
|
13726
13947
|
outside: !shown.has(comment.file) || comment.placed === false,
|
|
13727
13948
|
unread: Math.max(0, said.length - seen),
|
|
13728
13949
|
asks: last?.voice === "agent" && last.asks,
|
|
@@ -13735,33 +13956,33 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13735
13956
|
}))
|
|
13736
13957
|
};
|
|
13737
13958
|
};
|
|
13738
|
-
placedNow$
|
|
13739
|
-
const
|
|
13740
|
-
|
|
13741
|
-
|
|
13742
|
-
|
|
13743
|
-
|
|
13744
|
-
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
};
|
|
13748
|
-
|
|
13749
|
-
|
|
13750
|
-
placed
|
|
13751
|
-
|
|
13752
|
-
return match$3(foundAgain(patch, comment), {
|
|
13753
|
-
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 {
|
|
13754
13973
|
...comment,
|
|
13755
13974
|
placed: false
|
|
13756
|
-
}
|
|
13757
|
-
|
|
13975
|
+
};
|
|
13976
|
+
return {
|
|
13758
13977
|
...comment,
|
|
13759
|
-
start:
|
|
13760
|
-
end:
|
|
13761
|
-
placed:
|
|
13762
|
-
|
|
13978
|
+
start: sits.start,
|
|
13979
|
+
end: sits.end,
|
|
13980
|
+
placed: sits.placed,
|
|
13981
|
+
outdated: sits.outdated,
|
|
13982
|
+
reworded: sits.reworded
|
|
13983
|
+
};
|
|
13763
13984
|
});
|
|
13764
|
-
};
|
|
13985
|
+
});
|
|
13765
13986
|
linesIn = (found) => getOrElse(found, () => []);
|
|
13766
13987
|
trimmedLines = (snippet) => snippet.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
13767
13988
|
NAMES_SOMETHING = /[A-Za-z0-9_$]{3}/;
|
|
@@ -13805,6 +14026,8 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13805
14026
|
start: comment.anchor.start,
|
|
13806
14027
|
end: comment.anchor.end,
|
|
13807
14028
|
snippet: comment.anchor.snippet,
|
|
14029
|
+
blob: comment.anchor.blob,
|
|
14030
|
+
version: comment.anchor.version,
|
|
13808
14031
|
body: comment.body,
|
|
13809
14032
|
replyTo: comment.replyTo,
|
|
13810
14033
|
...comment.theirs === true ? { theirs: true } : {},
|
|
@@ -13816,7 +14039,7 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13816
14039
|
const spoken = yield* store.answers(worktree.path);
|
|
13817
14040
|
const current = yield* store.state(worktree.path);
|
|
13818
14041
|
const shown = new Set(reading.patches.map((patch) => patch.path));
|
|
13819
|
-
const placed = flatten(yield* store.inbox(worktree.path))
|
|
14042
|
+
const placed = yield* placedNow$1(reading, flatten(yield* store.inbox(worktree.path)));
|
|
13820
14043
|
const held = yield* foundOutsideTheHunks(worktree, placed, shown);
|
|
13821
14044
|
const replies = held.filter((comment) => comment.replyTo !== void 0);
|
|
13822
14045
|
const conversation = {
|
|
@@ -13834,10 +14057,17 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13834
14057
|
submitMany = fn("Review.Comment.submitMany")(function* (worktree, requests) {
|
|
13835
14058
|
const store = yield* Store;
|
|
13836
14059
|
const anchoring = fn("Review.Comment.anchoring")(function* (request) {
|
|
13837
|
-
const anchored = yield*
|
|
14060
|
+
const { patch, anchor: anchored } = yield* anchorWith(worktree, request);
|
|
14061
|
+
const version = yield* versionOf(worktree, patch, anchored.side);
|
|
13838
14062
|
return {
|
|
13839
14063
|
id: request.id,
|
|
13840
|
-
anchor:
|
|
14064
|
+
anchor: match$3(version, {
|
|
14065
|
+
onNone: () => anchored,
|
|
14066
|
+
onSome: (kept) => ({
|
|
14067
|
+
...anchored,
|
|
14068
|
+
version: kept
|
|
14069
|
+
})
|
|
14070
|
+
}),
|
|
13841
14071
|
body: request.body,
|
|
13842
14072
|
...request.remark === void 0 ? {} : { remark: request.remark },
|
|
13843
14073
|
...request.theirs === true ? { theirs: true } : {},
|
|
@@ -13951,12 +14181,12 @@ var init_comments$1 = __esmMin((() => {
|
|
|
13951
14181
|
}));
|
|
13952
14182
|
//#endregion
|
|
13953
14183
|
//#region src/review/threads.ts
|
|
13954
|
-
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;
|
|
13955
14185
|
var init_threads$1 = __esmMin((() => {
|
|
13956
14186
|
init_dist();
|
|
13957
|
-
init_patch();
|
|
13958
14187
|
init_store();
|
|
13959
14188
|
init_error$2();
|
|
14189
|
+
init_placing();
|
|
13960
14190
|
stateOf$2 = (turns, asked, isSettled, isRemoved) => {
|
|
13961
14191
|
if (isRemoved) return "removed";
|
|
13962
14192
|
if (isSettled) return "done";
|
|
@@ -13964,27 +14194,6 @@ var init_threads$1 = __esmMin((() => {
|
|
|
13964
14194
|
if (last === void 0 || last.voice === "reviewer") return "sent";
|
|
13965
14195
|
return asked ? "question" : "answered";
|
|
13966
14196
|
};
|
|
13967
|
-
placedNow$1 = (patches, anchor) => {
|
|
13968
|
-
const patch = patches.find((candidate) => candidate.path === anchor.path);
|
|
13969
|
-
if (patch === void 0) return {
|
|
13970
|
-
...anchor,
|
|
13971
|
-
placed: false
|
|
13972
|
-
};
|
|
13973
|
-
if (anchor.snippet.trim().length === 0) return {
|
|
13974
|
-
...anchor,
|
|
13975
|
-
placed: true
|
|
13976
|
-
};
|
|
13977
|
-
return match$3(foundAgain(patch, anchor), {
|
|
13978
|
-
onNone: () => ({
|
|
13979
|
-
...anchor,
|
|
13980
|
-
placed: false
|
|
13981
|
-
}),
|
|
13982
|
-
onSome: (range) => ({
|
|
13983
|
-
...range,
|
|
13984
|
-
placed: true
|
|
13985
|
-
})
|
|
13986
|
-
});
|
|
13987
|
-
};
|
|
13988
14197
|
choicesOf = (entry) => entry.choices === void 0 ? {} : { choices: entry.choices };
|
|
13989
14198
|
answerOf = (entry) => ({
|
|
13990
14199
|
body: entry.body,
|
|
@@ -14009,7 +14218,12 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14009
14218
|
const seen = [...ids].reduce((total, id) => total + (conversation.read[id] ?? 0), 0);
|
|
14010
14219
|
const turns = turnsOf(replies, mine);
|
|
14011
14220
|
const settled = Object.hasOwn(conversation.settled, comment.id);
|
|
14012
|
-
const sits =
|
|
14221
|
+
const sits = conversation.places.get(comment.id) ?? {
|
|
14222
|
+
...comment.anchor,
|
|
14223
|
+
placed: false,
|
|
14224
|
+
outdated: false,
|
|
14225
|
+
reworded: false
|
|
14226
|
+
};
|
|
14013
14227
|
const doing = conversation.doing[comment.id];
|
|
14014
14228
|
return {
|
|
14015
14229
|
id: comment.id,
|
|
@@ -14022,6 +14236,7 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14022
14236
|
at: batch.at,
|
|
14023
14237
|
state: stateOf$2(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(conversation.removed, comment.id)),
|
|
14024
14238
|
stale: batch.head !== conversation.head,
|
|
14239
|
+
outdated: sits.placed && sits.outdated,
|
|
14025
14240
|
outside: !conversation.shown.has(comment.anchor.path) || !sits.placed,
|
|
14026
14241
|
unread: Math.max(0, mine.length - seen),
|
|
14027
14242
|
taken: [...ids].some((id) => Object.hasOwn(conversation.taken, id)),
|
|
@@ -14059,13 +14274,22 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14059
14274
|
const store = yield* Store;
|
|
14060
14275
|
const { worktree, patches } = reading;
|
|
14061
14276
|
const current = yield* store.state(worktree.path);
|
|
14062
|
-
|
|
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, {
|
|
14063
14287
|
answers: yield* store.answers(worktree.path),
|
|
14064
14288
|
settled: current.settled,
|
|
14065
14289
|
removed: current.removed,
|
|
14066
14290
|
head: worktree.head,
|
|
14067
14291
|
shown: new Set(patches.map((patch) => patch.path)),
|
|
14068
|
-
|
|
14292
|
+
places,
|
|
14069
14293
|
read: current.read,
|
|
14070
14294
|
taken: current.taken ?? {},
|
|
14071
14295
|
doing: current.doing
|
|
@@ -14904,9 +15128,16 @@ var init_remarks$1 = __esmMin((() => {
|
|
|
14904
15128
|
}));
|
|
14905
15129
|
//#endregion
|
|
14906
15130
|
//#region src/domain/review/vouch.ts
|
|
14907
|
-
var isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
|
|
15131
|
+
var SHORTEST_BLOB, sameBlob, isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
|
|
14908
15132
|
var init_vouch = __esmMin((() => {
|
|
14909
|
-
|
|
15133
|
+
SHORTEST_BLOB = 7;
|
|
15134
|
+
sameBlob = (left, right) => {
|
|
15135
|
+
if (left === void 0 || right === void 0) return false;
|
|
15136
|
+
if (left === right) return true;
|
|
15137
|
+
if (left.length < SHORTEST_BLOB || right.length < SHORTEST_BLOB) return false;
|
|
15138
|
+
return left.startsWith(right) || right.startsWith(left);
|
|
15139
|
+
};
|
|
15140
|
+
isVouched = (vouches, path, blob) => sameBlob(vouches[path], blob);
|
|
14910
15141
|
vouch$1 = (vouches, path, blob) => {
|
|
14911
15142
|
if (isVouched(vouches, path, blob)) {
|
|
14912
15143
|
const { [path]: _cleared, ...rest } = vouches;
|
|
@@ -14920,7 +15151,7 @@ var init_vouch = __esmMin((() => {
|
|
|
14920
15151
|
partOf = (path, runs) => {
|
|
14921
15152
|
return `${path}@${[...runs].toSorted((left, right) => left.start - right.start || left.end - right.end).map((run) => `${run.start}-${run.end}`).join(",")}`;
|
|
14922
15153
|
};
|
|
14923
|
-
isPartVouched = (vouches, part, blob) => vouches[part]
|
|
15154
|
+
isPartVouched = (vouches, part, blob) => sameBlob(vouches[part], blob);
|
|
14924
15155
|
vouchPart$1 = (vouches, part, blob) => vouch$1(vouches, part, blob);
|
|
14925
15156
|
}));
|
|
14926
15157
|
//#endregion
|
|
@@ -14930,7 +15161,7 @@ var init_review$1 = __esmMin((() => {
|
|
|
14930
15161
|
}));
|
|
14931
15162
|
//#endregion
|
|
14932
15163
|
//#region src/review/vouching.ts
|
|
14933
|
-
var pathOfMark, changedSince, readParts, restamped, now, keepMarked, blobIn, stateAfter, toggle, marksOf, newestFirst, speaking, contentNow, diffSince, placesIn, counted$1, reportSince, isGone, goneSince, lapsedIn, sinceReview, progress, unchanged, markOf, since;
|
|
15164
|
+
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;
|
|
14934
15165
|
var init_vouching$1 = __esmMin((() => {
|
|
14935
15166
|
init_dist();
|
|
14936
15167
|
init_patch();
|
|
@@ -14946,13 +15177,13 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
14946
15177
|
const blobsOf = (file) => recorded.filter(([mark]) => pathOfMark(mark) === file.path).map(([, blob]) => blob);
|
|
14947
15178
|
const lapsed = (file) => {
|
|
14948
15179
|
const blobs = blobsOf(file);
|
|
14949
|
-
return blobs.length > 0 && !blobs.
|
|
15180
|
+
return blobs.length > 0 && !blobs.some((blob) => sameBlob(blob, file.blob));
|
|
14950
15181
|
};
|
|
14951
15182
|
return files.filter(lapsed).map((file) => file.path);
|
|
14952
15183
|
};
|
|
14953
15184
|
readParts = (parts, files) => {
|
|
14954
15185
|
const blobs = new Map(files.map((file) => [file.path, file.blob]));
|
|
14955
|
-
return Object.entries(parts).filter(([part, blob]) => blobs.get(pathOfMark(part))
|
|
15186
|
+
return Object.entries(parts).filter(([part, blob]) => sameBlob(blobs.get(pathOfMark(part)), blob)).map(([part]) => part);
|
|
14956
15187
|
};
|
|
14957
15188
|
restamped = (stamps, before, after, at) => {
|
|
14958
15189
|
const still = Object.entries(stamps).filter(([key]) => key in after && after[key] === before[key]);
|
|
@@ -14962,9 +15193,13 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
14962
15193
|
now = sync(() => (/* @__PURE__ */ new Date()).toISOString());
|
|
14963
15194
|
keepMarked = fn("Review.Vouch.keepMarked")(function* (worktree, file, marked) {
|
|
14964
15195
|
const git = yield* Git;
|
|
14965
|
-
if (marked.blob
|
|
15196
|
+
if (sameBlob(marked.blob, marked.onDisk)) yield* git.keep(worktree, [file]);
|
|
14966
15197
|
return marked.at ?? (yield* now);
|
|
14967
15198
|
});
|
|
15199
|
+
fullBlob = fn("Review.Vouch.fullBlob")(function* (worktree, blob) {
|
|
15200
|
+
const git = yield* Git;
|
|
15201
|
+
return getOrElse(yield* git.kept(worktree, blob), () => blob);
|
|
15202
|
+
});
|
|
14968
15203
|
blobIn = fn("Review.Vouch.blobIn")(function* (reading, file) {
|
|
14969
15204
|
return yield* match$3(blobOf(reading.patches, file), {
|
|
14970
15205
|
onNone: () => new UnknownFile({
|
|
@@ -14994,12 +15229,13 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
14994
15229
|
const store = yield* Store;
|
|
14995
15230
|
const patches = reading.patches;
|
|
14996
15231
|
const onDisk = yield* blobIn(reading, file);
|
|
14997
|
-
const
|
|
15232
|
+
const asked = marking.blob ?? onDisk;
|
|
14998
15233
|
const at = yield* keepMarked(reading.worktree, file, {
|
|
14999
|
-
blob,
|
|
15234
|
+
blob: asked,
|
|
15000
15235
|
onDisk,
|
|
15001
15236
|
at: marking.at
|
|
15002
15237
|
});
|
|
15238
|
+
const blob = yield* fullBlob(reading.worktree, asked);
|
|
15003
15239
|
const current = yield* store.state(reading.worktree.path);
|
|
15004
15240
|
const next = vouch$1(current.vouches, file, blob);
|
|
15005
15241
|
yield* store.changeState(reading.worktree.path, (was) => stateAfter(was, file, blob, at));
|
|
@@ -15021,7 +15257,7 @@ var init_vouching$1 = __esmMin((() => {
|
|
|
15021
15257
|
}));
|
|
15022
15258
|
newestFirst = (left, right) => right.at.localeCompare(left.at);
|
|
15023
15259
|
speaking = (marks, path, blob) => {
|
|
15024
|
-
const own = marks.filter((mark) => mark.path === path && mark.blob
|
|
15260
|
+
const own = marks.filter((mark) => mark.path === path && (blob === void 0 || !sameBlob(mark.blob, blob)));
|
|
15025
15261
|
const whole = own.find((mark) => mark.key === path);
|
|
15026
15262
|
return fromNullishOr(whole ?? own.toSorted(newestFirst)[0]);
|
|
15027
15263
|
};
|
|
@@ -15505,17 +15741,18 @@ var init_layers = __esmMin((() => {
|
|
|
15505
15741
|
vouchPart = fn("Review.Layers.vouchPart")(function* (reading, file, part, marking = {}) {
|
|
15506
15742
|
const store = yield* Store;
|
|
15507
15743
|
const onDisk = reading.patches.find((one) => one.path === file)?.blob ?? "";
|
|
15508
|
-
const
|
|
15744
|
+
const asked = marking.blob ?? onDisk;
|
|
15745
|
+
const at = yield* keepMarked(reading.worktree, file, {
|
|
15746
|
+
blob: asked,
|
|
15747
|
+
onDisk,
|
|
15748
|
+
at: marking.at
|
|
15749
|
+
});
|
|
15750
|
+
const blob = yield* fullBlob(reading.worktree, asked);
|
|
15509
15751
|
const held = yield* read(reading);
|
|
15510
15752
|
const wanted = partsOfFile(held.layers, file);
|
|
15511
15753
|
const current = yield* store.state(reading.worktree.path);
|
|
15512
15754
|
const parts = vouchPart$1(current.parts, part, blob);
|
|
15513
15755
|
const vouches = (wanted.length > 0 && wanted.every((one) => isPartVouched(parts, one, blob))) === isVouched(current.vouches, file, blob) ? current.vouches : vouch$1(current.vouches, file, blob);
|
|
15514
|
-
const at = yield* keepMarked(reading.worktree, file, {
|
|
15515
|
-
blob,
|
|
15516
|
-
onDisk,
|
|
15517
|
-
at: marking.at
|
|
15518
|
-
});
|
|
15519
15756
|
yield* store.changeState(reading.worktree.path, (was) => ({
|
|
15520
15757
|
...was,
|
|
15521
15758
|
parts,
|
|
@@ -17510,7 +17747,7 @@ var init_match = __esmMin((() => {
|
|
|
17510
17747
|
}));
|
|
17511
17748
|
//#endregion
|
|
17512
17749
|
//#region src/tui/state.ts
|
|
17513
|
-
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;
|
|
17514
17751
|
var init_state = __esmMin((() => {
|
|
17515
17752
|
init_preferences$1();
|
|
17516
17753
|
init_gaps();
|
|
@@ -17658,6 +17895,7 @@ var init_state = __esmMin((() => {
|
|
|
17658
17895
|
hasNoPull = (state) => state.forge === "answered" && pullHere(state).length === 0;
|
|
17659
17896
|
onLayers = (state) => state.rail === "layers" && state.layers.length > 0;
|
|
17660
17897
|
selectedLayer = (state) => state.layers[state.layerIndex];
|
|
17898
|
+
movedPast = (comment) => comment.outside === true || comment.outdated === true && comment.reworded !== true;
|
|
17661
17899
|
}));
|
|
17662
17900
|
//#endregion
|
|
17663
17901
|
//#region src/tui/cursor.ts
|
|
@@ -18294,6 +18532,7 @@ var init_layerview = __esmMin((() => {
|
|
|
18294
18532
|
//#region src/tui/panel.ts
|
|
18295
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;
|
|
18296
18534
|
var init_panel = __esmMin((() => {
|
|
18535
|
+
init_state();
|
|
18297
18536
|
PANEL_SECTIONS = [
|
|
18298
18537
|
"remarks",
|
|
18299
18538
|
"held",
|
|
@@ -18322,7 +18561,7 @@ var init_panel = __esmMin((() => {
|
|
|
18322
18561
|
answered: "answered",
|
|
18323
18562
|
waiting: "with"
|
|
18324
18563
|
};
|
|
18325
|
-
outsideOpen = (comment) => comment
|
|
18564
|
+
outsideOpen = (comment) => movedPast(comment) && comment.settled !== true && comment.removed !== true;
|
|
18326
18565
|
sectionOf = (comment) => outsideOpen(comment) ? "movedOn" : SECTION_OF[threadStand(comment)];
|
|
18327
18566
|
sentEntry = (state, comment) => {
|
|
18328
18567
|
const newer = newerOf(state, comment);
|
|
@@ -18457,7 +18696,7 @@ var init_notes = __esmMin((() => {
|
|
|
18457
18696
|
return asking.threads.flatMap((id) => {
|
|
18458
18697
|
const thread = state.sent.find((entry) => entry.id === id);
|
|
18459
18698
|
if (thread === void 0) return [];
|
|
18460
|
-
const where = thread
|
|
18699
|
+
const where = movedPast(thread) ? "not in the diff" : `line ${thread.end}`;
|
|
18461
18700
|
return [`${firstLineOf(thread.body)} · ${where}`];
|
|
18462
18701
|
});
|
|
18463
18702
|
};
|
|
@@ -18479,7 +18718,7 @@ var init_notes = __esmMin((() => {
|
|
|
18479
18718
|
const patch = selectedPatch(state);
|
|
18480
18719
|
const found = /* @__PURE__ */ new Map();
|
|
18481
18720
|
if (patch === void 0) return found;
|
|
18482
|
-
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));
|
|
18483
18722
|
for (const entry of here) {
|
|
18484
18723
|
const stand = threadStand(entry);
|
|
18485
18724
|
for (const row of rowsUnder(patch, entry)) found.set(row, louderOf(stand, found.get(row) ?? "gone"));
|
|
@@ -18537,7 +18776,7 @@ var init_notes = __esmMin((() => {
|
|
|
18537
18776
|
commentRowsIn = (state, fileIndex) => {
|
|
18538
18777
|
const patch = fileIndex === state.patchIndex ? selectedPatch(state) : state.patches[fileIndex];
|
|
18539
18778
|
if (patch === void 0) return [];
|
|
18540
|
-
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));
|
|
18541
18780
|
return patch.rows.filter((row) => notes.some((note) => lineOnSide(row, note.side) === note.end)).map((row) => row.index).toSorted((left, right) => left - right);
|
|
18542
18781
|
};
|
|
18543
18782
|
draftPlace = (state) => {
|
|
@@ -18559,7 +18798,7 @@ var init_notes = __esmMin((() => {
|
|
|
18559
18798
|
stop: drawn.filter((one) => one.side === note.side && one.end === note.end && drawn.indexOf(one) <= at).length
|
|
18560
18799
|
};
|
|
18561
18800
|
};
|
|
18562
|
-
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) => ({
|
|
18563
18802
|
id: one.id,
|
|
18564
18803
|
side: one.side,
|
|
18565
18804
|
end: one.end
|
|
@@ -18572,7 +18811,7 @@ var init_notes = __esmMin((() => {
|
|
|
18572
18811
|
const patch = selectedPatch(state);
|
|
18573
18812
|
const here = patch?.rows[row];
|
|
18574
18813
|
if (patch === void 0 || here === void 0) return [];
|
|
18575
|
-
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);
|
|
18576
18815
|
};
|
|
18577
18816
|
remarkShown = (remark) => remark.state === "waiting" && remark.placed;
|
|
18578
18817
|
remarksAtRow = (state, row) => {
|
|
@@ -18644,12 +18883,12 @@ var init_notes = __esmMin((() => {
|
|
|
18644
18883
|
const patch = selectedPatch(state);
|
|
18645
18884
|
const here = patch?.rows[row];
|
|
18646
18885
|
if (patch === void 0 || here === void 0) return void 0;
|
|
18647
|
-
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);
|
|
18648
18887
|
};
|
|
18649
18888
|
openCommentRows = (state) => {
|
|
18650
18889
|
const patch = selectedPatch(state);
|
|
18651
18890
|
if (patch === void 0) return [];
|
|
18652
|
-
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));
|
|
18653
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);
|
|
18654
18893
|
};
|
|
18655
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] : []);
|
|
@@ -20482,7 +20721,7 @@ var init_diffview = __esmMin((() => {
|
|
|
20482
20721
|
return note.takenAt === void 0 ? `${marks().sent} sent` : `${marks().waiting} picked up ${agoText(note.takenAt, note.now)}`;
|
|
20483
20722
|
};
|
|
20484
20723
|
commentHead = (note) => {
|
|
20485
|
-
const moved = note.stale ? ", the branch moved on" : ""
|
|
20724
|
+
const moved = `${note.outdated === true ? " · outdated" : ""}${note.stale ? ", the branch moved on" : ""}`;
|
|
20486
20725
|
if (note.settled) return `${marks().done} settled${moved}`;
|
|
20487
20726
|
if (note.asks) return `${marks().asked} asked back${moved}`;
|
|
20488
20727
|
if (note.turns.at(-1)?.voice === "reviewer") return `${marks().waiting} replied${moved}`;
|
|
@@ -20708,7 +20947,7 @@ var init_notespane = __esmMin((() => {
|
|
|
20708
20947
|
notesOf = (comments, path, sent, shown = {
|
|
20709
20948
|
opened: [],
|
|
20710
20949
|
now: Date.now()
|
|
20711
|
-
}) => 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) => ({
|
|
20712
20951
|
id: entry.id ?? "",
|
|
20713
20952
|
folded: entry.settled === true && !(entry.id !== void 0 && shown.opened.includes(entry.id)),
|
|
20714
20953
|
side: entry.side,
|
|
@@ -20717,6 +20956,7 @@ var init_notespane = __esmMin((() => {
|
|
|
20717
20956
|
sent,
|
|
20718
20957
|
settled: entry.settled === true,
|
|
20719
20958
|
stale: entry.stale === true,
|
|
20959
|
+
outdated: entry.outdated === true,
|
|
20720
20960
|
asks: entry.asks === true,
|
|
20721
20961
|
answers: entry.answers ?? [],
|
|
20722
20962
|
turns: entry.turns ?? [],
|
|
@@ -20796,7 +21036,9 @@ var init_panelpane = __esmMin((() => {
|
|
|
20796
21036
|
return remarkWhere(entry.remark, known);
|
|
20797
21037
|
}
|
|
20798
21038
|
const tail = entry.comment.rewritten === true ? " · rewritten by the agent" : entry.comment.draft === void 0 ? "" : " · asks to redraft";
|
|
20799
|
-
|
|
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}`;
|
|
20800
21042
|
};
|
|
20801
21043
|
panelFile = (entry) => {
|
|
20802
21044
|
if (entry.kind === "fold") return "";
|
|
@@ -20818,7 +21060,7 @@ var init_panelpane = __esmMin((() => {
|
|
|
20818
21060
|
if (entry.kind === "fold") return [];
|
|
20819
21061
|
return (entry.kind === "remark" ? entry.remark.code : (entry.comment.snippet ?? "").split("\n")).filter((line) => line.trim().length > 0);
|
|
20820
21062
|
};
|
|
20821
|
-
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;
|
|
20822
21064
|
writtenOn = (state, placed, room) => {
|
|
20823
21065
|
const { entry } = placed;
|
|
20824
21066
|
if (placed.at !== state.panelIndex || !lostEntry(state, entry)) return [];
|
|
@@ -23700,7 +23942,7 @@ var init_comments = __esmMin((() => {
|
|
|
23700
23942
|
}
|
|
23701
23943
|
yield* readRewrite(app, entry);
|
|
23702
23944
|
const at = app.state.patches.findIndex((patch) => patch.path === entry.comment.file);
|
|
23703
|
-
if (at === -1 || entry.comment
|
|
23945
|
+
if (at === -1 || movedPast(entry.comment)) {
|
|
23704
23946
|
yield* openAway(app, entry, at);
|
|
23705
23947
|
return;
|
|
23706
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": {
|