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

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,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.89
4
+
5
+ ### Patch Changes
6
+
7
+ - The worktree list shows the full name of the branch a review is stacked on, rather than cutting it into something that looks like a different branch.
8
+
9
+ ## 0.1.0-alpha.88
10
+
11
+ ### Patch Changes
12
+
13
+ - 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.
14
+
3
15
  ## 0.1.0-alpha.87
4
16
 
5
17
  ### 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.89";
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;
@@ -14399,7 +14408,7 @@ var init_diffview = __esmMin((() => {
14399
14408
  }));
14400
14409
  //#endregion
14401
14410
  //#region src/tui/render.ts
14402
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14411
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14403
14412
  var init_render = __esmMin((() => {
14404
14413
  init_command();
14405
14414
  init_patch();
@@ -14437,12 +14446,14 @@ var init_render = __esmMin((() => {
14437
14446
  PANE_INSET = 1;
14438
14447
  BRANCH_WIDTH = 82;
14439
14448
  BRANCH_NAME_MIN = 12;
14440
- BRANCH_TAIL = 45;
14449
+ BRANCH_FIXED = 36;
14450
+ STATE_MIN = 11;
14441
14451
  EMPTY_LIST = " nothing to review. No worktree differs from the branch it started from.";
14442
14452
  MODAL_MARGIN = 4;
14443
14453
  shareOf = (width, least) => Math.max(least, Math.min(PANEL_MAX, Math.floor(width * PANEL_SHARE)));
14444
- homeWidth = (width, longest) => Math.max(0, Math.min(width - 2, Math.min(PANEL_MAX, Math.max(BRANCH_WIDTH, longest + BRANCH_TAIL))));
14454
+ homeWidth = (width, longest, said = STATE_MIN) => Math.max(0, Math.min(width - 2, Math.min(PANEL_MAX, Math.max(BRANCH_WIDTH, longest + BRANCH_FIXED + Math.max(STATE_MIN, said)))));
14445
14455
  longestName = (state) => Math.max(0, ...state.branches.map((branch) => branch.branch.length));
14456
+ longestState = (state) => Math.max(0, ...state.branches.map((branch) => stateCell(state, branch).length));
14446
14457
  commandRow = (entry, room) => {
14447
14458
  const key = clip(displayKey(entry.keys[0] ?? ""), 5).padEnd(PALETTE_KEY);
14448
14459
  const left = Math.max(1, Math.min(PALETTE_TITLE, room - PALETTE_KEY - entry.category.length - PALETTE_GAP));
@@ -14912,7 +14923,8 @@ var init_render = __esmMin((() => {
14912
14923
  if (context === 3) return "";
14913
14924
  return context >= 1e5 ? "whole file" : `±${context}`;
14914
14925
  };
14915
- nameRoom = (pane) => Math.max(BRANCH_NAME_MIN, pane - BRANCH_TAIL);
14926
+ nameRoom = (pane, longest = pane) => Math.max(BRANCH_NAME_MIN, Math.min(longest, pane - BRANCH_FIXED - STATE_MIN));
14927
+ stateRoom = (pane, name) => Math.max(0, pane - name - BRANCH_FIXED);
14916
14928
  columns = (cells, room) => `${clip(cells.name, room).padEnd(room)}${cells.files.padStart(5)}${cells.added.padStart(8)}${cells.gone.padStart(8)} ${cells.layers.padStart(8)} ${cells.state}`;
14917
14929
  FORGE_SILENT = " could not find out which of these have a pull request";
14918
14930
  unaskedForge = (state) => state.forge === "silent" ? [fg(palette.faint)(`\n${FORGE_SILENT}`)] : [];
@@ -15472,7 +15484,8 @@ var init_render = __esmMin((() => {
15472
15484
  };
15473
15485
  }
15474
15486
  branchTable(state) {
15475
- const room = nameRoom(this.homeRoom(state));
15487
+ const pane = this.homeRoom(state);
15488
+ const room = nameRoom(pane, longestName(state));
15476
15489
  if (state.branches.length === 0) return new StyledText([fg(palette.muted)(EMPTY_LIST)]);
15477
15490
  const heading = [fg(palette.faint)(`${branchHeading(room)}\n\n`)];
15478
15491
  const rows = state.branches.flatMap((branch, index) => {
@@ -15485,7 +15498,7 @@ var init_render = __esmMin((() => {
15485
15498
  fg(palette.added)(cells.added),
15486
15499
  fg(palette.removed)(cells.gone),
15487
15500
  fg(palette.accent)(` ${cells.layers.padStart(8)}`),
15488
- fg(palette.attention)(` ${stateCell(state, branch)}\n`)
15501
+ fg(palette.attention)(` ${clip(stateCell(state, branch), stateRoom(pane, room))}\n`)
15489
15502
  ];
15490
15503
  });
15491
15504
  return new StyledText([
@@ -15508,7 +15521,7 @@ var init_render = __esmMin((() => {
15508
15521
  if (this.shown !== void 0) this.footer.content = this.footerText(this.shown);
15509
15522
  }
15510
15523
  homeRoom(state) {
15511
- return homeWidth(this.renderer.width, longestName(state));
15524
+ return homeWidth(this.renderer.width, longestName(state), longestState(state));
15512
15525
  }
15513
15526
  homeKeys(state) {
15514
15527
  const said = state.notice.length === 0 ? state.waiting : state.notice;
@@ -16527,7 +16540,7 @@ var init_app = __esmMin((() => {
16527
16540
  this.commit(withNotice(this.state, "no thread here"));
16528
16541
  return;
16529
16542
  }
16530
- yield* settleThread(this.repo, branch.branch, id, (/* @__PURE__ */ new Date()).toISOString());
16543
+ yield* this.settling(branch.branch, id);
16531
16544
  const sent = yield* this.loadSent(branch.branch);
16532
16545
  const held = withSent({
16533
16546
  ...this.state,
@@ -16567,7 +16580,7 @@ var init_app = __esmMin((() => {
16567
16580
  this.commit(withNotice(this.state, "no thread here"));
16568
16581
  return;
16569
16582
  }
16570
- yield* removeComment(this.repo, branch.branch, id, (/* @__PURE__ */ new Date()).toISOString());
16583
+ yield* this.removing(branch.branch, id);
16571
16584
  const sent = yield* this.loadSent(branch.branch);
16572
16585
  const held = withSent({
16573
16586
  ...this.state,
@@ -16701,6 +16714,24 @@ var init_app = __esmMin((() => {
16701
16714
  this.commit(withNotice(atFile(next, target), `marked ${patch.path}`));
16702
16715
  });
16703
16716
  }
16717
+ worktreeFor(branch) {
16718
+ const reading = this.reading;
16719
+ return reading === void 0 || reading.worktree.branch !== branch ? void 0 : reading.worktree;
16720
+ }
16721
+ commenting(branch, request) {
16722
+ const worktree = this.worktreeFor(branch);
16723
+ return worktree === void 0 ? submitComment(request) : commentIn(worktree, request);
16724
+ }
16725
+ settling(branch, id) {
16726
+ const at = (/* @__PURE__ */ new Date()).toISOString();
16727
+ const worktree = this.worktreeFor(branch);
16728
+ return worktree === void 0 ? settleThread(this.repo, branch, id, at) : settleIn(worktree, id, at);
16729
+ }
16730
+ removing(branch, id) {
16731
+ const at = (/* @__PURE__ */ new Date()).toISOString();
16732
+ const worktree = this.worktreeFor(branch);
16733
+ return worktree === void 0 ? removeComment(this.repo, branch, id, at) : removeIn(worktree, id, at);
16734
+ }
16704
16735
  vouching(branch, file) {
16705
16736
  const held = this.reading;
16706
16737
  return held === void 0 || held.worktree.branch !== branch ? toggleVouch({
@@ -16710,7 +16741,8 @@ var init_app = __esmMin((() => {
16710
16741
  }) : vouchIn(held, file);
16711
16742
  }
16712
16743
  loadSent(branch) {
16713
- return listSent(this.repo, branch);
16744
+ const reading = this.reading;
16745
+ return reading === void 0 || reading.worktree.branch !== branch ? listSent(this.repo, branch) : sentIn(reading);
16714
16746
  }
16715
16747
  showPull() {
16716
16748
  return gen({ self: this }, function* () {
@@ -16841,7 +16873,7 @@ var init_app = __esmMin((() => {
16841
16873
  this.commit(withNotice(this.state, "nothing selected"));
16842
16874
  return;
16843
16875
  }
16844
- yield* submitComment({
16876
+ yield* this.commenting(branch.branch, {
16845
16877
  repo: this.repo,
16846
16878
  branch: branch.branch,
16847
16879
  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.89",
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": {