@eliya-oss/agent-diff 0.1.0-alpha.87 → 0.1.0-alpha.88

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,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.88
4
+
5
+ ### Patch Changes
6
+
7
+ - Sending a comment, settling a thread and removing one no longer re-read the whole branch from git. On a branch of 131 files: sending 220ms to 72ms, settling 162ms to 37ms, removing 171ms to 38ms.
8
+
3
9
  ## 0.1.0-alpha.87
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8565,12 +8565,14 @@ var init_service$2 = __esmMin((() => {
8565
8565
  }
8566
8566
  return found;
8567
8567
  });
8568
- readDiff = fn("Git.diff")(function* (worktree, context) {
8568
+ readDiff = fn("Git.diff")(function* (worktree, context, only) {
8569
8569
  const target = worktree.base.length > 0 ? worktree.base : "HEAD";
8570
+ const scope = only === void 0 ? [] : ["--", only];
8570
8571
  return yield* gitOrEmpty(worktree.path, [
8571
8572
  "diff",
8572
8573
  `-U${context}`,
8573
- target
8574
+ target,
8575
+ ...scope
8574
8576
  ]);
8575
8577
  });
8576
8578
  readStat = fn("Git.stat")(function* (worktree) {
@@ -9108,7 +9110,7 @@ var init_error$1 = __esmMin((() => {
9108
9110
  }));
9109
9111
  //#endregion
9110
9112
  //#region src/cli/commands.ts
9111
- var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, AT_ONCE, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, submitComment, without$1, submitReply, listPatches, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9113
+ var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, AT_ONCE, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, sentIn, listSent, commentIn, submitComment, without$1, submitReply, listPatches, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, saveWrap, saveSticky, setBase, clearBase, markRead;
9112
9114
  var init_commands = __esmMin((() => {
9113
9115
  init_dist();
9114
9116
  init_patch();
@@ -9191,8 +9193,8 @@ var init_commands = __esmMin((() => {
9191
9193
  baseFor = fn("Cli.baseFor")(function* (repo, branch, base) {
9192
9194
  return yield* basedOn(repo, yield* worktreeNamed(repo, branch), base);
9193
9195
  });
9194
- patchesOf = fn("Cli.patchesOf")(function* (worktree, context = CONTEXT) {
9195
- const raw = yield* (yield* Git).diff(worktree, context);
9196
+ patchesOf = fn("Cli.patchesOf")(function* (worktree, context = CONTEXT, only) {
9197
+ const raw = yield* (yield* Git).diff(worktree, context, only);
9196
9198
  return parsePatches(raw);
9197
9199
  });
9198
9200
  findPatch = (patches, file) => fromNullishOr(patches.find((patch) => patch.path === file));
@@ -9354,10 +9356,10 @@ var init_commands = __esmMin((() => {
9354
9356
  listSent = fn("Cli.listSent")(function* (repo, branch, base) {
9355
9357
  return yield* sentIn(yield* readingOf(repo, branch, base));
9356
9358
  });
9357
- submitComment = fn("Cli.submitComment")(function* (request) {
9359
+ commentIn = fn("Cli.commentIn")(function* (worktree, request) {
9358
9360
  const store = yield* Store;
9359
- const worktree = yield* findBranch(request.repo, request.branch);
9360
- const patches = yield* patchesOf(worktree, WHOLE_FILE$1);
9361
+ const only = yield* patchesOf(worktree, WHOLE_FILE$1, request.file);
9362
+ const patches = only.length > 0 ? only : yield* patchesOf(worktree, WHOLE_FILE$1);
9361
9363
  const patch = findPatch(patches, request.file);
9362
9364
  const resolved = yield* match$3(patch, {
9363
9365
  onNone: () => new UnknownFile({
@@ -9391,6 +9393,9 @@ var init_commands = __esmMin((() => {
9391
9393
  yield* store.submit(worktree.path, batch);
9392
9394
  return batch;
9393
9395
  });
9396
+ submitComment = fn("Cli.submitComment")(function* (request) {
9397
+ return yield* commentIn(yield* findBranch(request.repo, request.branch), request);
9398
+ });
9394
9399
  without$1 = (held, key) => Object.fromEntries(Object.entries(held).filter(([held_]) => held_ !== key));
9395
9400
  submitReply = fn("Cli.submitReply")(function* (request) {
9396
9401
  const store = yield* Store;
@@ -9806,7 +9811,7 @@ var init_pane = __esmMin((() => {
9806
9811
  init_commands();
9807
9812
  init_init();
9808
9813
  init_pane();
9809
- var version$1 = "0.1.0-alpha.87";
9814
+ var version$1 = "0.1.0-alpha.88";
9810
9815
  //#endregion
9811
9816
  //#region src/cli/upgrade.ts
9812
9817
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -10374,7 +10379,7 @@ var init_layers = __esmMin((() => {
10374
10379
  }));
10375
10380
  //#endregion
10376
10381
  //#region src/cli/threads.ts
10377
- var stateOf$1, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleThread, removeComment, without, restoreComment, settleRead;
10382
+ var stateOf$1, spoken$1, turnsOf, threadOf, threadsIn, idsIn, isKnown, listThreads, answerComment, settleIn, settleThread, removeIn, removeComment, without, restoreComment, settleRead;
10378
10383
  var init_threads = __esmMin((() => {
10379
10384
  init_dist();
10380
10385
  init_store();
@@ -10465,9 +10470,8 @@ var init_threads = __esmMin((() => {
10465
10470
  });
10466
10471
  return { answered: (yield* store.answers(worktree.path)).filter((entry) => entry.comment === request.id).length };
10467
10472
  });
10468
- settleThread = fn("Cli.settleThread")(function* (repo, branch, id, at) {
10473
+ settleIn = fn("Cli.settleIn")(function* (worktree, id, at) {
10469
10474
  const store = yield* Store;
10470
- const worktree = yield* findBranch(repo, branch);
10471
10475
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
10472
10476
  const current = yield* store.state(worktree.path);
10473
10477
  const replies = (yield* store.answers(worktree.path)).filter((entry) => entry.comment === id);
@@ -10484,9 +10488,11 @@ var init_threads = __esmMin((() => {
10484
10488
  });
10485
10489
  return { settled: id };
10486
10490
  });
10487
- removeComment = fn("Cli.removeComment")(function* (repo, branch, id, at) {
10491
+ settleThread = fn("Cli.settleThread")(function* (repo, branch, id, at) {
10492
+ return yield* settleIn(yield* findBranch(repo, branch), id, at);
10493
+ });
10494
+ removeIn = fn("Cli.removeIn")(function* (worktree, id, at) {
10488
10495
  const store = yield* Store;
10489
- const worktree = yield* findBranch(repo, branch);
10490
10496
  const current = yield* store.state(worktree.path);
10491
10497
  if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
10492
10498
  const replies = (yield* store.answers(worktree.path)).filter((entry) => entry.comment === id);
@@ -10503,6 +10509,9 @@ var init_threads = __esmMin((() => {
10503
10509
  });
10504
10510
  return { removed: id };
10505
10511
  });
10512
+ removeComment = fn("Cli.removeComment")(function* (repo, branch, id, at) {
10513
+ return yield* removeIn(yield* findBranch(repo, branch), id, at);
10514
+ });
10506
10515
  without = (entries, id) => Object.fromEntries(Object.entries(entries).filter(([key]) => key !== id));
10507
10516
  restoreComment = fn("Cli.restoreComment")(function* (repo, branch, id) {
10508
10517
  const store = yield* Store;
@@ -16527,7 +16536,7 @@ var init_app = __esmMin((() => {
16527
16536
  this.commit(withNotice(this.state, "no thread here"));
16528
16537
  return;
16529
16538
  }
16530
- yield* settleThread(this.repo, branch.branch, id, (/* @__PURE__ */ new Date()).toISOString());
16539
+ yield* this.settling(branch.branch, id);
16531
16540
  const sent = yield* this.loadSent(branch.branch);
16532
16541
  const held = withSent({
16533
16542
  ...this.state,
@@ -16567,7 +16576,7 @@ var init_app = __esmMin((() => {
16567
16576
  this.commit(withNotice(this.state, "no thread here"));
16568
16577
  return;
16569
16578
  }
16570
- yield* removeComment(this.repo, branch.branch, id, (/* @__PURE__ */ new Date()).toISOString());
16579
+ yield* this.removing(branch.branch, id);
16571
16580
  const sent = yield* this.loadSent(branch.branch);
16572
16581
  const held = withSent({
16573
16582
  ...this.state,
@@ -16701,6 +16710,24 @@ var init_app = __esmMin((() => {
16701
16710
  this.commit(withNotice(atFile(next, target), `marked ${patch.path}`));
16702
16711
  });
16703
16712
  }
16713
+ worktreeFor(branch) {
16714
+ const reading = this.reading;
16715
+ return reading === void 0 || reading.worktree.branch !== branch ? void 0 : reading.worktree;
16716
+ }
16717
+ commenting(branch, request) {
16718
+ const worktree = this.worktreeFor(branch);
16719
+ return worktree === void 0 ? submitComment(request) : commentIn(worktree, request);
16720
+ }
16721
+ settling(branch, id) {
16722
+ const at = (/* @__PURE__ */ new Date()).toISOString();
16723
+ const worktree = this.worktreeFor(branch);
16724
+ return worktree === void 0 ? settleThread(this.repo, branch, id, at) : settleIn(worktree, id, at);
16725
+ }
16726
+ removing(branch, id) {
16727
+ const at = (/* @__PURE__ */ new Date()).toISOString();
16728
+ const worktree = this.worktreeFor(branch);
16729
+ return worktree === void 0 ? removeComment(this.repo, branch, id, at) : removeIn(worktree, id, at);
16730
+ }
16704
16731
  vouching(branch, file) {
16705
16732
  const held = this.reading;
16706
16733
  return held === void 0 || held.worktree.branch !== branch ? toggleVouch({
@@ -16710,7 +16737,8 @@ var init_app = __esmMin((() => {
16710
16737
  }) : vouchIn(held, file);
16711
16738
  }
16712
16739
  loadSent(branch) {
16713
- return listSent(this.repo, branch);
16740
+ const reading = this.reading;
16741
+ return reading === void 0 || reading.worktree.branch !== branch ? listSent(this.repo, branch) : sentIn(reading);
16714
16742
  }
16715
16743
  showPull() {
16716
16744
  return gen({ self: this }, function* () {
@@ -16841,7 +16869,7 @@ var init_app = __esmMin((() => {
16841
16869
  this.commit(withNotice(this.state, "nothing selected"));
16842
16870
  return;
16843
16871
  }
16844
- yield* submitComment({
16872
+ yield* this.commenting(branch.branch, {
16845
16873
  repo: this.repo,
16846
16874
  branch: branch.branch,
16847
16875
  file: patch.path,
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.87",
26
+ "version": "0.1.0-alpha.88",
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": {