@eliya-oss/agent-diff 0.1.0-alpha.192 → 0.1.0-alpha.194

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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.194
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(store): marking several files at the same moment never fails on a half-written review state.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ adiff wrote the review's state over the old file in place, and marking a file read that state
12
+ before taking the lock. A mark that read it mid-write saw half a file and exited with an error.
13
+ Each write now goes to a file beside it and is renamed into place, so a reader sees the old
14
+ state or the new one, never a mix.
15
+
16
+ </details>
17
+
18
+ - fix(marks): a file marked reviewed stays reviewed when git starts printing longer hashes.
19
+
20
+ <details><summary>What was wrong</summary>
21
+
22
+ git lengthens its short hashes as a repository grows, so the same content printed as `defbbd93c`
23
+ one month prints as `defbbd93c6` the next. adiff compared the hash a mark was made under with the
24
+ one it reads now as plain text, so every older mark lapsed: `review progress` listed the file as
25
+ changed since review with no line changed. Two hashes now count as the same file when one starts
26
+ with the other, and a new mark records the full hash.
27
+
28
+ </details>
29
+
30
+ ## 0.1.0-alpha.193
31
+
32
+ ### Patch Changes
33
+
34
+ - feat(CLI): `review progress` names, for each file changed since it was marked reviewed, when it was marked and how many lines changed since, and `patch since` prints that file's diff from the marked version.
35
+
36
+ feat(CLI): `file review --blob` marks the version of a file a client drew, and each file in `patch show` carries its `blob`.
37
+
3
38
  ## 0.1.0-alpha.192
4
39
 
5
40
  ### Patch Changes
package/dist/main.js CHANGED
@@ -1743,7 +1743,7 @@ var init_Order = __esmMin((() => {
1743
1743
  }));
1744
1744
  //#endregion
1745
1745
  //#region node_modules/.pnpm/effect@4.0.0-rc.110/node_modules/effect/dist/Option.js
1746
- var none, some, isNone, isSome, match$3, getOrElse, orElse, fromNullishOr, getOrUndefined$1, liftThrowable, map$5, flatMap$2, filter$1;
1746
+ var none, some, isNone, isSome, match$3, getOrElse, orElse, fromNullishOr, getOrUndefined$1, liftThrowable, map$5, flatMap$2, toArray, filter$3;
1747
1747
  var init_Option = __esmMin((() => {
1748
1748
  init_Function();
1749
1749
  init_option();
@@ -1765,7 +1765,8 @@ var init_Option = __esmMin((() => {
1765
1765
  };
1766
1766
  map$5 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
1767
1767
  flatMap$2 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : f(self.value));
1768
- filter$1 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
1768
+ toArray = (self) => isNone(self) ? [] : [self.value];
1769
+ filter$3 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
1769
1770
  })), succeed$6, fail$3, isFailure$1;
1770
1771
  var init_Result = __esmMin((() => {
1771
1772
  init_Function();
@@ -2685,7 +2686,7 @@ var init_references = __esmMin((() => {
2685
2686
  };
2686
2687
  };
2687
2688
  spanCleaner = /*#__PURE__*/ makeStackCleaner(3);
2688
- })), 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, 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((() => {
2689
2690
  init_Array();
2690
2691
  init_Context();
2691
2692
  init_Duration();
@@ -3501,6 +3502,12 @@ var init_references = __esmMin((() => {
3501
3502
  }));
3502
3503
  catch_ = /*#__PURE__*/ dual(2, (self, f) => catchCauseFilter(self, findError$1, (e) => f(e)));
3503
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)));
3504
3511
  catchIf = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, f, orElse) => catchCause$1(self, (cause) => {
3505
3512
  const error = findError$1(cause);
3506
3513
  if (isFailure$1(error)) return failCause$3(error.failure);
@@ -3949,6 +3956,22 @@ var init_references = __esmMin((() => {
3949
3956
  else if (state.out) state.out[index] = exit.value;
3950
3957
  }
3951
3958
  });
3959
+ filter$2 = /*#__PURE__*/ dual((args) => isIterable(args[0]) && !isEffect$1(args[0]), (elements, predicate, options) => suspend$1(() => {
3960
+ const out = [];
3961
+ return as$1(forEach$1(elements, (a, i) => {
3962
+ const result = predicate(a, i);
3963
+ if (typeof result === "boolean") {
3964
+ if (result) out.push(a);
3965
+ return void_$2;
3966
+ }
3967
+ return map$3(result, (keep) => {
3968
+ if (keep) out.push(a);
3969
+ });
3970
+ }, {
3971
+ discard: true,
3972
+ concurrency: options?.concurrency
3973
+ }), out);
3974
+ }));
3952
3975
  forkUnsafe$1 = (parent, effect, immediate = false, daemon = false, uninterruptible = false) => {
3953
3976
  const parentRuntime = parent;
3954
3977
  const interruptible = uninterruptible === "inherit" ? parentRuntime.interruptible : !uninterruptible;
@@ -4790,7 +4813,7 @@ var repeatOrElse, retryOrElse, repeat$1, retry$1, passthroughForever, buildFromO
4790
4813
  if (options.times !== void 0) schedule = while_(schedule, ({ attempt }) => succeed$5(attempt <= options.times));
4791
4814
  return schedule;
4792
4815
  };
4793
- })), 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, 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;
4794
4817
  var init_Effect = __esmMin((() => {
4795
4818
  init_Context();
4796
4819
  init_core();
@@ -4831,11 +4854,13 @@ var init_Effect = __esmMin((() => {
4831
4854
  catchDefect = catchDefect$1;
4832
4855
  mapError = mapError$1;
4833
4856
  orDie = orDie$1;
4857
+ tapError = tapError$1;
4834
4858
  retry = retry$1;
4835
4859
  ignore = ignore$1;
4836
4860
  orElseSucceed = orElseSucceed$1;
4837
4861
  sleep = sleep$1;
4838
4862
  raceFirst = raceFirst$1;
4863
+ filter$1 = filter$2;
4839
4864
  when = when$1;
4840
4865
  context = context$1;
4841
4866
  contextWith = contextWith$1;
@@ -5502,7 +5527,7 @@ function omit() {
5502
5527
  */
5503
5528
  function withDefault$1(defaultValue) {
5504
5529
  return new Getter((o) => {
5505
- const filtered = filter$1(o, isNotUndefined);
5530
+ const filtered = filter$3(o, isNotUndefined);
5506
5531
  return isSome(filtered) ? succeed$1(filtered) : mapEager(defaultValue, some);
5507
5532
  });
5508
5533
  }
@@ -10058,7 +10083,7 @@ var init_config = __esmMin((() => {
10058
10083
  //#region package.json
10059
10084
  init_pane();
10060
10085
  init_config();
10061
- var version$1 = "0.1.0-alpha.192";
10086
+ var version$1 = "0.1.0-alpha.194";
10062
10087
  //#endregion
10063
10088
  //#region src/cli/error.ts
10064
10089
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -10458,6 +10483,25 @@ var init_catalog = __esmMin((() => {
10458
10483
  dataKey: "patch",
10459
10484
  example: "adiff patch show --repo . --branch add-invitations --file src/api.ts --context all"
10460
10485
  },
10486
+ {
10487
+ name: "patch since",
10488
+ about: "One file's diff from the version the reviewer marked reviewed to the file now, in the shape of one file of `patch show`. The old side counts the marked version's lines",
10489
+ group: READ_A_BRANCH,
10490
+ addresses: "review",
10491
+ safety: "read",
10492
+ options: [
10493
+ ...based,
10494
+ file,
10495
+ {
10496
+ name: "context",
10497
+ required: false,
10498
+ value: "lines|all",
10499
+ about: "Unchanged lines around each change. Defaults to 3; `all` answers the whole file"
10500
+ }
10501
+ ],
10502
+ dataKey: "file",
10503
+ example: "adiff patch since --worktree . --file src/api.ts"
10504
+ },
10461
10505
  {
10462
10506
  name: "file review",
10463
10507
  about: "Toggle a file as reviewed. Lapses on its own when the file changes",
@@ -10472,6 +10516,12 @@ var init_catalog = __esmMin((() => {
10472
10516
  required: false,
10473
10517
  value: "number",
10474
10518
  about: "Mark the file read in this layer only, counting from 1, when more than one layer claims it"
10519
+ },
10520
+ {
10521
+ name: "blob",
10522
+ required: false,
10523
+ value: "sha",
10524
+ about: "Mark this version of the file: the `blob` patch show printed for it"
10475
10525
  }
10476
10526
  ],
10477
10527
  dataKey: "reviewed",
@@ -10504,7 +10554,7 @@ var init_catalog = __esmMin((() => {
10504
10554
  },
10505
10555
  {
10506
10556
  name: "review progress",
10507
- about: "Which files of a review are marked reviewed, and how many there are",
10557
+ about: "Which files of a review are marked reviewed, which changed since they were marked and by how much, and how many files there are",
10508
10558
  group: READ_A_BRANCH,
10509
10559
  addresses: "review",
10510
10560
  safety: "read",
@@ -11367,6 +11417,16 @@ var init_report$1 = __esmMin((() => {
11367
11417
  suggestion: "The pull request has moved since these comments were written, so they name lines that may no longer be there. Nothing was sent and nothing was lost. Read the diff again and check each draft still says what you mean.",
11368
11418
  retriable: false
11369
11419
  },
11420
+ NotVouched: {
11421
+ exit: 3,
11422
+ suggestion: "The file has no review mark, so nothing changed since one. Mark it with `adiff file review`, or read its diff against the base with `adiff patch show --file`.",
11423
+ retriable: false
11424
+ },
11425
+ VouchedVersionGone: {
11426
+ exit: 3,
11427
+ suggestion: "The version marked reviewed was not kept, as with a mark made by an older adiff. Read the file's diff against the base with `adiff patch show --file` instead.",
11428
+ retriable: false
11429
+ },
11370
11430
  UnselectableRange: {
11371
11431
  exit: 2,
11372
11432
  suggestion: "Those lines are not in the diff. Check --side: new is the working tree, old is the version being replaced.",
@@ -12071,7 +12131,7 @@ var init_run = __esmMin((() => {
12071
12131
  gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
12072
12132
  return yield* git(cwd, args).pipe(catchTag("GitCommandFailed", () => succeed$1("")));
12073
12133
  });
12074
- })), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT$1, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, verifiedIn, findDefaultBranch, partsOf$1, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, GENERATED_SAID, markedGenerated, readGenerated, askRepo, LINKED_GIT_DIR, HEAD_REF, gitDirOf, findCommonDir, readHead, REFS_MOST, readCommits, readRefs, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
12134
+ })), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT$1, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, verifiedIn, findDefaultBranch, partsOf$1, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, NO_CONTENT, keepContent, findKept, readBetween, readGrep, GENERATED_SAID, markedGenerated, readGenerated, askRepo, LINKED_GIT_DIR, HEAD_REF, gitDirOf, findCommonDir, readHead, REFS_MOST, readCommits, readRefs, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
12075
12135
  var init_service$2 = __esmMin((() => {
12076
12136
  init_dist();
12077
12137
  init_error$4();
@@ -12225,6 +12285,35 @@ var init_service$2 = __esmMin((() => {
12225
12285
  const raw = yield* gitOrEmpty(worktree.path, ["show", `${target}:${path}`]);
12226
12286
  return raw.length === 0 ? none() : some(splitLines(raw));
12227
12287
  });
12288
+ NO_CONTENT = "/dev/null";
12289
+ keepContent = fn("Git.keep")(function* (worktree, paths) {
12290
+ if (paths.length === 0) return [];
12291
+ return (yield* gitOrEmpty(worktree.path, [
12292
+ "hash-object",
12293
+ "-w",
12294
+ "--",
12295
+ ...paths
12296
+ ])).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
12297
+ });
12298
+ findKept = fn("Git.kept")(function* (worktree, blob) {
12299
+ if (blob.length === 0) return none();
12300
+ const found = (yield* gitOrEmpty(worktree.path, [
12301
+ "rev-parse",
12302
+ "--verify",
12303
+ "--quiet",
12304
+ `${blob}^{blob}`
12305
+ ])).trim();
12306
+ return found.length === 0 ? none() : some(found);
12307
+ });
12308
+ readBetween = fn("Git.between")(function* (worktree, from, to, context) {
12309
+ return yield* gitOrEmpty(worktree.path, [
12310
+ ...PLAIN_PATHS,
12311
+ "diff",
12312
+ `-U${context}`,
12313
+ from,
12314
+ to
12315
+ ]);
12316
+ });
12228
12317
  readGrep = fn("Git.grep")(function* (worktree, term) {
12229
12318
  return yield* gitOrEmpty(worktree.path, [
12230
12319
  "grep",
@@ -12371,6 +12460,9 @@ var init_service$2 = __esmMin((() => {
12371
12460
  stat: readStat,
12372
12461
  source: readSource,
12373
12462
  blob: readBlob,
12463
+ keep: keepContent,
12464
+ kept: findKept,
12465
+ between: readBetween,
12374
12466
  grep: readGrep,
12375
12467
  generated: readGenerated,
12376
12468
  defaultBranch: (repo) => get(caches.baseName, repo),
@@ -12407,6 +12499,7 @@ var init_model$4 = __esmMin((() => {
12407
12499
  taken: {},
12408
12500
  vouches: {},
12409
12501
  parts: {},
12502
+ vouchedAt: {},
12410
12503
  openedAt: "",
12411
12504
  consumed: 0,
12412
12505
  settled: {},
@@ -12477,6 +12570,7 @@ var init_schema = __esmMin((() => {
12477
12570
  taken: optionalKey(Record(String$1, String$1)),
12478
12571
  vouches: Stamps.pipe(noStamps),
12479
12572
  parts: Stamps.pipe(noStamps),
12573
+ vouchedAt: Stamps.pipe(noStamps),
12480
12574
  openedAt: String$1.pipe(withDecodingDefaultKey(succeed$1(""))),
12481
12575
  consumed: Int.pipe(withDecodingDefaultKey(succeed$1(0))),
12482
12576
  settled: Stamps.pipe(noStamps),
@@ -12576,7 +12670,7 @@ var init_paths = __esmMin((() => {
12576
12670
  }));
12577
12671
  //#endregion
12578
12672
  //#region src/service/store/service.ts
12579
- 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;
12673
+ 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;
12580
12674
  var init_service$1 = __esmMin((() => {
12581
12675
  init_dist();
12582
12676
  init_git();
@@ -12620,10 +12714,17 @@ var init_service$1 = __esmMin((() => {
12620
12714
  path,
12621
12715
  reason: String(reason)
12622
12716
  });
12623
- wrote = (path, body) => tryPromise({
12624
- try: () => writeFile(path, body, "utf8"),
12625
- catch: unwritable(path)
12626
- });
12717
+ besideOf = (path) => `${path}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
12718
+ wrote = (path, body) => {
12719
+ const beside = besideOf(path);
12720
+ return tryPromise({
12721
+ try: () => writeFile(beside, body, "utf8"),
12722
+ catch: unwritable(path)
12723
+ }).pipe(andThen(tryPromise({
12724
+ try: () => rename(beside, path),
12725
+ catch: unwritable(path)
12726
+ })), tapError(() => promise(() => rm(beside, { force: true }))));
12727
+ };
12627
12728
  added$1 = (path, body) => tryPromise({
12628
12729
  try: () => appendFile(path, `${body}\n`, "utf8"),
12629
12730
  catch: unwritable(path)
@@ -12908,13 +13009,7 @@ var init_service$1 = __esmMin((() => {
12908
13009
  const key = yield* keyOf(worktreePath);
12909
13010
  const path = watchPath(root, key);
12910
13011
  yield* ensureDir(branchDir(root, key));
12911
- yield* tryPromise({
12912
- try: () => writeFile(path, JSON.stringify({ lookedAt: at }), "utf8"),
12913
- catch: (cause) => new StoreUnwritable({
12914
- path,
12915
- reason: String(cause)
12916
- })
12917
- });
13012
+ yield* wrote(path, JSON.stringify({ lookedAt: at }));
12918
13013
  })
12919
13014
  };
12920
13015
  };
@@ -13021,13 +13116,15 @@ var init_store = __esmMin((() => {
13021
13116
  }));
13022
13117
  //#endregion
13023
13118
  //#region src/review/error.ts
13024
- var UnknownBranch, BranchMoved, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
13119
+ var UnknownBranch, BranchMoved, UnknownBase, UnknownFile, NotVouched, VouchedVersionGone, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
13025
13120
  var init_error$2 = __esmMin((() => {
13026
13121
  init_dist();
13027
13122
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
13028
13123
  BranchMoved = class extends TaggedError("BranchMoved") {};
13029
13124
  UnknownBase = class extends TaggedError("UnknownBase") {};
13030
13125
  UnknownFile = class extends TaggedError("UnknownFile") {};
13126
+ NotVouched = class extends TaggedError("NotVouched") {};
13127
+ VouchedVersionGone = class extends TaggedError("VouchedVersionGone") {};
13031
13128
  UnknownComment = class extends TaggedError("UnknownComment") {};
13032
13129
  UnknownRemark = class extends TaggedError("UnknownRemark") {};
13033
13130
  NothingSaid = class extends TaggedError("NothingSaid") {};
@@ -13281,7 +13378,7 @@ var init_branches$1 = __esmMin((() => {
13281
13378
  }));
13282
13379
  //#endregion
13283
13380
  //#region src/review/patches.ts
13284
- var findPatch, blobOf, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, show$3;
13381
+ var findPatch, blobOf, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
13285
13382
  var init_patches = __esmMin((() => {
13286
13383
  init_dist();
13287
13384
  init_patch();
@@ -13357,6 +13454,7 @@ var init_patches = __esmMin((() => {
13357
13454
  generated: generated.has(patch.path) || GENERATED_NAME.test(patch.path),
13358
13455
  added: patch.added,
13359
13456
  removed: patch.removed,
13457
+ blob: patch.blob,
13360
13458
  hunks: patch.hunks.map(shownHunk),
13361
13459
  enclosedBy: enclosedBy(lines),
13362
13460
  scopes: scopesOf(lines)
@@ -13366,11 +13464,13 @@ var init_patches = __esmMin((() => {
13366
13464
  return yield* source(worktree, patch.path);
13367
13465
  });
13368
13466
  fileShown$1 = (worktree, generated) => (patch) => map$1(sourceShown(worktree, patch), (lines) => shownFile(patch, generated, lines));
13467
+ shownAs = (patch, lines) => shownFile(patch, /* @__PURE__ */ new Set(), lines);
13468
+ onDisk$1 = (patches) => patches.filter((patch) => patch.status !== "deleted").map((patch) => patch.path);
13369
13469
  show$3 = fn("Review.Diff.show")(function* (based, showing) {
13370
13470
  const git = yield* Git;
13371
13471
  const { worktree } = based;
13372
13472
  const patches$3 = yield* patches(worktree, linesAround(showing.context), showing.file);
13373
- const generated = yield* git.generated(worktree, patches$3.map((patch) => patch.path));
13473
+ const [generated] = yield* all([git.generated(worktree, patches$3.map((patch) => patch.path)), git.keep(worktree, onDisk$1(patches$3))], { concurrency: 2 });
13374
13474
  return {
13375
13475
  branch: worktree.branch,
13376
13476
  base: based.base,
@@ -14115,7 +14215,7 @@ var init_error$1 = __esmMin((() => {
14115
14215
  }));
14116
14216
  //#endregion
14117
14217
  //#region src/service/forge/service.ts
14118
- var Forge, LIMIT, TIMEOUT_MS, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Author, Row, Viewer, readViewer, decode$1, SAID, stateOf$1, ended, ask$1, show$2, whoseOf, pullOf, read$2, viewerOf, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$2, head, sideName, commentBody, bodyFor, Landed, readLanded, jsonOf$1, keyOf$2, counted$1, acknowledged, landedIn, THREADS, Said, Thread, Page, Held$1, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, HERE, asked$1, whereOf, threadsIn, unresolved, PAGES, everyThread, answer$2, remarks, review, address, ForgeLive;
14218
+ var Forge, LIMIT, TIMEOUT_MS, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Author, Row, Viewer, readViewer, decode$1, SAID, stateOf$1, ended, ask$1, show$2, whoseOf, pullOf, read$2, viewerOf, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$2, head, sideName, commentBody, bodyFor, Landed, readLanded, jsonOf$1, keyOf$2, counted$2, acknowledged, landedIn, THREADS, Said, Thread, Page, Held$1, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, HERE, asked$1, whereOf, threadsIn, unresolved, PAGES, everyThread, answer$2, remarks, review, address, ForgeLive;
14119
14219
  var init_service = __esmMin((() => {
14120
14220
  init_dist();
14121
14221
  init_error$1();
@@ -14317,7 +14417,7 @@ var init_service = __esmMin((() => {
14317
14417
  readLanded = decodeUnknownOption(Landed);
14318
14418
  jsonOf$1 = liftThrowable((raw) => JSON.parse(raw));
14319
14419
  keyOf$2 = (path, line) => `${path}:${line}`;
14320
- counted$1 = (back) => {
14420
+ counted$2 = (back) => {
14321
14421
  const room = /* @__PURE__ */ new Map();
14322
14422
  back.forEach((one) => {
14323
14423
  const key = keyOf$2(one.path, one.line ?? 0);
@@ -14329,7 +14429,7 @@ var init_service = __esmMin((() => {
14329
14429
  landedIn = (said, asked) => {
14330
14430
  const back = acknowledged(said);
14331
14431
  if (back === void 0) return [];
14332
- const room = counted$1(back);
14432
+ const room = counted$2(back);
14333
14433
  return asked.flatMap((one, at) => {
14334
14434
  const key = keyOf$2(one.path, one.line);
14335
14435
  const left = room.get(key) ?? 0;
@@ -14812,9 +14912,16 @@ var init_remarks$1 = __esmMin((() => {
14812
14912
  }));
14813
14913
  //#endregion
14814
14914
  //#region src/domain/review/vouch.ts
14815
- var isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
14915
+ var SHORTEST_BLOB, sameBlob, isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
14816
14916
  var init_vouch = __esmMin((() => {
14817
- isVouched = (vouches, path, blob) => vouches[path] === blob;
14917
+ SHORTEST_BLOB = 7;
14918
+ sameBlob = (left, right) => {
14919
+ if (left === void 0 || right === void 0) return false;
14920
+ if (left === right) return true;
14921
+ if (left.length < SHORTEST_BLOB || right.length < SHORTEST_BLOB) return false;
14922
+ return left.startsWith(right) || right.startsWith(left);
14923
+ };
14924
+ isVouched = (vouches, path, blob) => sameBlob(vouches[path], blob);
14818
14925
  vouch$1 = (vouches, path, blob) => {
14819
14926
  if (isVouched(vouches, path, blob)) {
14820
14927
  const { [path]: _cleared, ...rest } = vouches;
@@ -14828,7 +14935,7 @@ var init_vouch = __esmMin((() => {
14828
14935
  partOf = (path, runs) => {
14829
14936
  return `${path}@${[...runs].toSorted((left, right) => left.start - right.start || left.end - right.end).map((run) => `${run.start}-${run.end}`).join(",")}`;
14830
14937
  };
14831
- isPartVouched = (vouches, part, blob) => vouches[part] === blob;
14938
+ isPartVouched = (vouches, part, blob) => sameBlob(vouches[part], blob);
14832
14939
  vouchPart$1 = (vouches, part, blob) => vouch$1(vouches, part, blob);
14833
14940
  }));
14834
14941
  //#endregion
@@ -14838,12 +14945,15 @@ var init_review$1 = __esmMin((() => {
14838
14945
  }));
14839
14946
  //#endregion
14840
14947
  //#region src/review/vouching.ts
14841
- var pathOfMark, changedSince, readParts, blobIn, toggle, progress;
14948
+ 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;
14842
14949
  var init_vouching$1 = __esmMin((() => {
14843
14950
  init_dist();
14951
+ init_patch();
14844
14952
  init_review$1();
14953
+ init_git();
14845
14954
  init_store();
14846
14955
  init_error$2();
14956
+ init_branches$1();
14847
14957
  init_patches();
14848
14958
  pathOfMark = (mark) => mark.split("@")[0] ?? "";
14849
14959
  changedSince = (marks, files) => {
@@ -14851,14 +14961,29 @@ var init_vouching$1 = __esmMin((() => {
14851
14961
  const blobsOf = (file) => recorded.filter(([mark]) => pathOfMark(mark) === file.path).map(([, blob]) => blob);
14852
14962
  const lapsed = (file) => {
14853
14963
  const blobs = blobsOf(file);
14854
- return blobs.length > 0 && !blobs.includes(file.blob);
14964
+ return blobs.length > 0 && !blobs.some((blob) => sameBlob(blob, file.blob));
14855
14965
  };
14856
14966
  return files.filter(lapsed).map((file) => file.path);
14857
14967
  };
14858
14968
  readParts = (parts, files) => {
14859
14969
  const blobs = new Map(files.map((file) => [file.path, file.blob]));
14860
- return Object.entries(parts).filter(([part, blob]) => blobs.get(pathOfMark(part)) === blob).map(([part]) => part);
14970
+ return Object.entries(parts).filter(([part, blob]) => sameBlob(blobs.get(pathOfMark(part)), blob)).map(([part]) => part);
14971
+ };
14972
+ restamped = (stamps, before, after, at) => {
14973
+ const still = Object.entries(stamps).filter(([key]) => key in after && after[key] === before[key]);
14974
+ const fresh = Object.keys(after).filter((key) => before[key] !== after[key]).map((key) => [key, at]);
14975
+ return Object.fromEntries([...still, ...fresh]);
14861
14976
  };
14977
+ now = sync(() => (/* @__PURE__ */ new Date()).toISOString());
14978
+ keepMarked = fn("Review.Vouch.keepMarked")(function* (worktree, file, marked) {
14979
+ const git = yield* Git;
14980
+ if (sameBlob(marked.blob, marked.onDisk)) yield* git.keep(worktree, [file]);
14981
+ return marked.at ?? (yield* now);
14982
+ });
14983
+ fullBlob = fn("Review.Vouch.fullBlob")(function* (worktree, blob) {
14984
+ const git = yield* Git;
14985
+ return getOrElse(yield* git.kept(worktree, blob), () => blob);
14986
+ });
14862
14987
  blobIn = fn("Review.Vouch.blobIn")(function* (reading, file) {
14863
14988
  return yield* match$3(blobOf(reading.patches, file), {
14864
14989
  onNone: () => new UnknownFile({
@@ -14868,16 +14993,36 @@ var init_vouching$1 = __esmMin((() => {
14868
14993
  onSome: succeed$1
14869
14994
  });
14870
14995
  });
14871
- toggle = fn("Review.Vouch.toggle")(function* (reading, file) {
14996
+ stateAfter = (was, file, blob, at) => {
14997
+ const vouches = vouch$1(was.vouches, file, blob);
14998
+ const before = {
14999
+ ...was.vouches,
15000
+ ...was.parts
15001
+ };
15002
+ const after = {
15003
+ ...vouches,
15004
+ ...was.parts
15005
+ };
15006
+ return {
15007
+ ...was,
15008
+ vouches,
15009
+ vouchedAt: restamped(was.vouchedAt, before, after, at)
15010
+ };
15011
+ };
15012
+ toggle = fn("Review.Vouch.toggle")(function* (reading, file, marking = {}) {
14872
15013
  const store = yield* Store;
14873
15014
  const patches = reading.patches;
14874
- const blob = yield* blobIn(reading, file);
15015
+ const onDisk = yield* blobIn(reading, file);
15016
+ const asked = marking.blob ?? onDisk;
15017
+ const at = yield* keepMarked(reading.worktree, file, {
15018
+ blob: asked,
15019
+ onDisk,
15020
+ at: marking.at
15021
+ });
15022
+ const blob = yield* fullBlob(reading.worktree, asked);
14875
15023
  const current = yield* store.state(reading.worktree.path);
14876
15024
  const next = vouch$1(current.vouches, file, blob);
14877
- yield* store.changeState(reading.worktree.path, (was) => ({
14878
- ...was,
14879
- vouches: vouch$1(was.vouches, file, blob)
14880
- }));
15025
+ yield* store.changeState(reading.worktree.path, (was) => stateAfter(was, file, blob, at));
14881
15026
  const files = patches.map((patch) => ({
14882
15027
  path: patch.path,
14883
15028
  blob: patch.blob
@@ -14888,19 +15033,146 @@ var init_vouching$1 = __esmMin((() => {
14888
15033
  total: patches.length
14889
15034
  };
14890
15035
  });
15036
+ marksOf = (state) => [...Object.entries(state.vouches), ...Object.entries(state.parts)].map(([key, blob]) => ({
15037
+ key,
15038
+ path: pathOfMark(key),
15039
+ blob,
15040
+ at: state.vouchedAt[key] ?? ""
15041
+ }));
15042
+ newestFirst = (left, right) => right.at.localeCompare(left.at);
15043
+ speaking = (marks, path, blob) => {
15044
+ const own = marks.filter((mark) => mark.path === path && (blob === void 0 || !sameBlob(mark.blob, blob)));
15045
+ const whole = own.find((mark) => mark.key === path);
15046
+ return fromNullishOr(whole ?? own.toSorted(newestFirst)[0]);
15047
+ };
15048
+ contentNow = fn("Review.Vouch.contentNow")(function* (worktree, file) {
15049
+ const git = yield* Git;
15050
+ const [found] = yield* git.keep(worktree, [file]);
15051
+ if (found !== void 0) return found;
15052
+ const [nothing] = yield* git.keep(worktree, [NO_CONTENT]);
15053
+ return nothing ?? "";
15054
+ });
15055
+ diffSince = fn("Review.Vouch.diffSince")(function* (worktree, file, kept, context) {
15056
+ const raw = yield* (yield* Git).between(worktree, kept, yield* contentNow(worktree, file), context);
15057
+ return fromNullishOr(parsePatches(raw)[0]);
15058
+ });
15059
+ placesIn = (patch) => patch.hunks.filter((hunk) => hunk.marker.length > 0).length;
15060
+ counted$1 = (patch) => match$3(patch, {
15061
+ onNone: () => ({
15062
+ added: 0,
15063
+ removed: 0,
15064
+ places: 0
15065
+ }),
15066
+ onSome: (found) => ({
15067
+ added: found.added,
15068
+ removed: found.removed,
15069
+ places: placesIn(found)
15070
+ })
15071
+ });
15072
+ reportSince = fn("Review.Vouch.reportSince")(function* (worktree, asked) {
15073
+ const git = yield* Git;
15074
+ const { mark } = asked;
15075
+ const told = {
15076
+ path: mark.path,
15077
+ at: mark.at,
15078
+ reviewed: mark.blob,
15079
+ ...asked.deleted ? { deleted: true } : {}
15080
+ };
15081
+ const kept = yield* git.kept(worktree, mark.blob);
15082
+ if (isNone(kept)) return {
15083
+ ...told,
15084
+ added: 0,
15085
+ removed: 0,
15086
+ places: 0,
15087
+ kept: false
15088
+ };
15089
+ const patch = yield* diffSince(worktree, mark.path, kept.value, 3);
15090
+ return {
15091
+ ...told,
15092
+ ...counted$1(patch),
15093
+ kept: true
15094
+ };
15095
+ });
15096
+ isGone = fn("Review.Vouch.isGone")(function* (worktree, path) {
15097
+ const git = yield* Git;
15098
+ return isNone(yield* git.source(worktree, path));
15099
+ });
15100
+ goneSince = fn("Review.Vouch.goneSince")(function* (worktree, marks, patches) {
15101
+ const inDiff = new Set(patches.map((patch) => patch.path));
15102
+ const left = [...new Set(marks.map((mark) => mark.path))].filter((path) => !inDiff.has(path));
15103
+ return (yield* filter$1(left, (path) => isGone(worktree, path))).flatMap((path) => toArray(speaking(marks, path)));
15104
+ });
15105
+ lapsedIn = (patches, marks, changed) => patches.filter((patch) => changed.includes(patch.path)).flatMap((patch) => toArray(speaking(marks, patch.path, patch.blob)).map((mark) => ({
15106
+ mark,
15107
+ deleted: patch.status === "deleted"
15108
+ })));
15109
+ sinceReview = fn("Review.Vouch.sinceReview")(function* (reading, state, changed) {
15110
+ const marks = marksOf(state);
15111
+ const gone = yield* goneSince(reading.worktree, marks, reading.patches);
15112
+ const asked = [...lapsedIn(reading.patches, marks, changed), ...gone.map((mark) => ({
15113
+ mark,
15114
+ deleted: true
15115
+ }))];
15116
+ return yield* forEach(asked, (one) => reportSince(reading.worktree, one), { concurrency: 8 });
15117
+ });
14891
15118
  progress = fn("Review.Vouch.progress")(function* (reading) {
14892
15119
  const current = yield* (yield* Store).state(reading.worktree.path);
14893
15120
  const files = reading.patches.map((patch) => ({
14894
15121
  path: patch.path,
14895
15122
  blob: patch.blob
14896
15123
  }));
15124
+ const changed = changedSince([current.vouches, current.parts], files);
14897
15125
  return {
14898
15126
  vouched: files.filter((file) => isVouched(current.vouches, file.path, file.blob)).map((f) => f.path),
14899
15127
  parts: readParts(current.parts, files),
14900
- changed: changedSince([current.vouches, current.parts], files),
15128
+ changed,
15129
+ since: yield* sinceReview(reading, current, changed),
14901
15130
  total: reading.patches.length
14902
15131
  };
14903
15132
  });
15133
+ unchanged = (file) => ({
15134
+ path: file,
15135
+ previousPath: file,
15136
+ blob: "",
15137
+ headerLines: [],
15138
+ status: "changed",
15139
+ binary: false,
15140
+ hunks: [],
15141
+ rows: [],
15142
+ added: 0,
15143
+ removed: 0
15144
+ });
15145
+ markOf = fn("Review.Vouch.markOf")(function* (worktree, file) {
15146
+ const store = yield* Store;
15147
+ const git = yield* Git;
15148
+ const state = yield* store.state(worktree.path);
15149
+ const mark = yield* match$3(speaking(marksOf(state), file), {
15150
+ onNone: () => new NotVouched({ file }),
15151
+ onSome: succeed$1
15152
+ });
15153
+ const kept = yield* git.kept(worktree, mark.blob);
15154
+ if (isNone(kept)) return yield* new VouchedVersionGone({
15155
+ file,
15156
+ blob: mark.blob
15157
+ });
15158
+ return kept.value;
15159
+ });
15160
+ since = fn("Review.Vouch.since")(function* (based, file, showing) {
15161
+ const git = yield* Git;
15162
+ const { worktree } = based;
15163
+ const kept = yield* markOf(worktree, file);
15164
+ const inDiff = (yield* patches(worktree, 3, file)).find((patch) => patch.path === file);
15165
+ const found = yield* diffSince(worktree, file, kept, linesAround(showing.context));
15166
+ const lines = yield* git.source(worktree, file);
15167
+ const patch = {
15168
+ ...getOrElse(found, () => unchanged(file)),
15169
+ path: file,
15170
+ previousPath: file,
15171
+ blob: inDiff?.blob ?? "",
15172
+ status: isNone(lines) ? "deleted" : "changed"
15173
+ };
15174
+ return shownAs(patch, getOrElse(lines, () => []));
15175
+ });
14904
15176
  }));
14905
15177
  //#endregion
14906
15178
  //#region src/domain/preferences/model.ts
@@ -15250,9 +15522,16 @@ var init_layers = __esmMin((() => {
15250
15522
  };
15251
15523
  });
15252
15524
  partsOfFile = (layers, file) => layers.map((layer) => layer.spans.filter((span) => span.path === file)).filter((spans) => spans.length > 0).map((spans) => partOf(file, spans));
15253
- vouchPart = fn("Review.Layers.vouchPart")(function* (reading, file, part) {
15525
+ vouchPart = fn("Review.Layers.vouchPart")(function* (reading, file, part, marking = {}) {
15254
15526
  const store = yield* Store;
15255
- const blob = reading.patches.find((one) => one.path === file)?.blob ?? "";
15527
+ const onDisk = reading.patches.find((one) => one.path === file)?.blob ?? "";
15528
+ const asked = marking.blob ?? onDisk;
15529
+ const at = yield* keepMarked(reading.worktree, file, {
15530
+ blob: asked,
15531
+ onDisk,
15532
+ at: marking.at
15533
+ });
15534
+ const blob = yield* fullBlob(reading.worktree, asked);
15256
15535
  const held = yield* read(reading);
15257
15536
  const wanted = partsOfFile(held.layers, file);
15258
15537
  const current = yield* store.state(reading.worktree.path);
@@ -15261,7 +15540,14 @@ var init_layers = __esmMin((() => {
15261
15540
  yield* store.changeState(reading.worktree.path, (was) => ({
15262
15541
  ...was,
15263
15542
  parts,
15264
- vouches
15543
+ vouches,
15544
+ vouchedAt: restamped(was.vouchedAt, {
15545
+ ...was.vouches,
15546
+ ...was.parts
15547
+ }, {
15548
+ ...vouches,
15549
+ ...parts
15550
+ }, at)
15265
15551
  }));
15266
15552
  const files = reading.patches.map((one) => ({
15267
15553
  path: one.path,
@@ -15302,7 +15588,7 @@ var init_layers = __esmMin((() => {
15302
15588
  return { asked: body };
15303
15589
  });
15304
15590
  claims = (layer, file) => layer.spans.some((span) => span.path === file);
15305
- vouchIn = fn("Review.Layers.vouchIn")(function* (reading, file, number) {
15591
+ vouchIn = fn("Review.Layers.vouchIn")(function* (reading, file, number, marking = {}) {
15306
15592
  const held = yield* read(reading);
15307
15593
  const layer = held.layers[number - 1];
15308
15594
  if (layer === void 0) return yield* new UnknownLayer({
@@ -15311,8 +15597,8 @@ var init_layers = __esmMin((() => {
15311
15597
  });
15312
15598
  const holding = held.layers.filter((one) => claims(one, file)).length;
15313
15599
  const spans = layer.spans.filter((span) => span.path === file);
15314
- if (holding < 2 || spans.length === 0) return yield* toggle(reading, file);
15315
- return yield* vouchPart(reading, file, partOf(file, spans));
15600
+ if (holding < 2 || spans.length === 0) return yield* toggle(reading, file, marking);
15601
+ return yield* vouchPart(reading, file, partOf(file, spans), marking);
15316
15602
  });
15317
15603
  }));
15318
15604
  //#endregion
@@ -25651,8 +25937,12 @@ const commentReopen = fn("Main.commentReopen")(function* (options) {
25651
25937
  const vouched = fn("Main.vouched")(function* (options) {
25652
25938
  const reading = yield* readingIn(options);
25653
25939
  const file = yield* required(options, "file");
25654
- if (options["layer"] === void 0) return yield* toggle(reading, file);
25655
- return yield* vouchIn(reading, file, yield* numeric(options, "layer"));
25940
+ const marking = {
25941
+ blob: options["blob"],
25942
+ at: options["at"]
25943
+ };
25944
+ if (options["layer"] === void 0) return yield* toggle(reading, file, marking);
25945
+ return yield* vouchIn(reading, file, yield* numeric(options, "layer"), marking);
25656
25946
  });
25657
25947
  const fileReview = fn("Main.fileReview")(function* (options) {
25658
25948
  const report = yield* vouched(options);
@@ -25666,6 +25956,7 @@ const reviewStatus = fn("Main.reviewStatus")(function* (options) {
25666
25956
  yield* answer(options, {
25667
25957
  reviewed: report.vouched,
25668
25958
  changed: report.changed,
25959
+ since: report.since,
25669
25960
  total: report.total
25670
25961
  });
25671
25962
  });
@@ -25692,6 +25983,11 @@ const patchShow = fn("Main.patchShow")(function* (options) {
25692
25983
  });
25693
25984
  yield* answer(options, { patch });
25694
25985
  });
25986
+ const patchSince = fn("Main.patchSince")(function* (options) {
25987
+ const based = yield* basedAt(yield* required(options, "worktree"), options["base"]);
25988
+ const file = yield* since(based, yield* required(options, "file"), { context: yield* around$1(options, "context") });
25989
+ yield* answer(options, { file });
25990
+ });
25695
25991
  const configList = fn("Main.configList")(function* (options) {
25696
25992
  yield* answer(options, { preferences: yield* list$1() });
25697
25993
  });
@@ -25758,6 +26054,7 @@ const routes = {
25758
26054
  "layers set": layersSet,
25759
26055
  "layers show": layersShow,
25760
26056
  "patch show": patchShow,
26057
+ "patch since": patchSince,
25761
26058
  upgrade: fn("Main.upgrade")(function* (options) {
25762
26059
  const check = options["check"] !== void 0;
25763
26060
  const quiet = options["json"] !== void 0;
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.192",
26
+ "version": "0.1.0-alpha.194",
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": {
@@ -237,7 +237,7 @@ adiff layers set --worktree . --json - <<'JSON'
237
237
  "layers": [
238
238
  {
239
239
  "title": "Add the invitation data model",
240
- "note": "The record every later layer leans on",
240
+ "note": "The record every later layer leans on.\n- `expiresAt` is required; nothing reads a missing one\n- One open invitation per email, enforced by an index",
241
241
  "spans": [{ "path": "src/db/invites.ts", "start": 1, "end": 48 }]
242
242
  },
243
243
  {
@@ -263,6 +263,12 @@ Rules that make a layers worth reading:
263
263
  - **A title is a claim, not a file name.** "Add the invitation API", never "changes to
264
264
  src/api/invites.ts".
265
265
  - **Line numbers are the new side of the diff**, the same numbers `adiff comment take` reports.
266
+ - **A note is a lead and a few points, not a paragraph.** The first line says how to read the
267
+ layer or what it claims, in one clause. Then up to four lines, each starting `- `, each one
268
+ decision or surprise the reviewer would otherwise miss. About 220 characters in all. Put names
269
+ from code in backticks, and a newline between points, not semicolons. Leave out the file list
270
+ (the review shows it), asides in parentheses (make one its own point if it matters) and anything
271
+ the title already says.
266
272
  - **Cover everything.** adiff computes coverage itself and answers with the changed lines no layer
267
273
  claims; those show up for the reviewer under "not in any layer" whatever you do. A layer set that
268
274
  quietly skips a third of the diff is worse than none, so put the leftovers in a final layer and