@eliya-oss/agent-diff 0.1.0-alpha.167 → 0.1.0-alpha.169

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,33 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.169
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(base): escape closes the base picker and leaves the base as it was.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ The picker took escape and did nothing with it. The only ways out were choosing a ref, handing the
12
+ choice back to adiff, or quitting the terminal.
13
+
14
+ </details>
15
+
16
+ fix(editor): escape closes the list of editors and opens nothing.
17
+
18
+ <details><summary>What was wrong</summary>
19
+
20
+ Pressing the key with no editor found opened the list, and escape left it on screen. A reviewer who
21
+ did not mean to choose an editor had to pick one anyway.
22
+
23
+ </details>
24
+
25
+ ## 0.1.0-alpha.168
26
+
27
+ ### Patch Changes
28
+
29
+ - feat(branches): `b` offers the last five commits as bases, each named by the message of the newest commit it takes in, so reading just what the agent last did is one keypress and a return.
30
+
3
31
  ## 0.1.0-alpha.167
4
32
 
5
33
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10216,7 +10216,7 @@ var init_run = __esmMin((() => {
10216
10216
  gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
10217
10217
  return yield* git(cwd, args).pipe(catchTag("GitCommandFailed", () => succeed$1("")));
10218
10218
  });
10219
- })), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, findDefaultBranch, partsOf$2, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, findRepo, REFS_MOST, readRefs, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
10219
+ })), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, findDefaultBranch, partsOf$2, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, findRepo, REFS_MOST, readCommits, readRefs, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
10220
10220
  var init_service = __esmMin((() => {
10221
10221
  init_dist();
10222
10222
  init_error$1();
@@ -10392,6 +10392,18 @@ var init_service = __esmMin((() => {
10392
10392
  return trimmed.length === 0 ? resolve(worktree) : resolve(trimmed, "..");
10393
10393
  });
10394
10394
  REFS_MOST = 200;
10395
+ readCommits = fn("Git.commits")(function* (repo, branch, most) {
10396
+ return (yield* gitOrEmpty(repo, [
10397
+ "log",
10398
+ `--max-count=${most}`,
10399
+ "--format=%h%x09%s",
10400
+ branch,
10401
+ "--"
10402
+ ])).split("\n").map((line) => line.split(" ")).flatMap(([sha, subject]) => sha === void 0 || sha.trim().length === 0 ? [] : [{
10403
+ sha: sha.trim(),
10404
+ said: (subject ?? "").trim()
10405
+ }]);
10406
+ });
10395
10407
  readRefs = fn("Git.refs")(function* (repo) {
10396
10408
  return (yield* gitOrEmpty(repo, [
10397
10409
  "for-each-ref",
@@ -10446,6 +10458,7 @@ var init_service = __esmMin((() => {
10446
10458
  defaultBranch: (repo) => get(caches.baseName, repo),
10447
10459
  stackParent: (repo, branch) => get(caches.baseName, repo).pipe(flatMap((fallback) => get(caches.parent, `${repo}${SPLIT}${branch}${SPLIT}${fallback}`))),
10448
10460
  refs: readRefs,
10461
+ commits: (repo, branch, most) => readCommits(repo, branch, most),
10449
10462
  resolves: refResolves,
10450
10463
  sharedWith: sharedCommit
10451
10464
  });
@@ -10579,7 +10592,7 @@ var init_error = __esmMin((() => {
10579
10592
  }));
10580
10593
  //#endregion
10581
10594
  //#region src/cli/commands.ts
10582
- var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, readParts, blobOf, vouchIn, toggleVouch, readingOf, markOpened, lastOpenedIn, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, linesIn, trimmedLines, NAMES_SOMETHING, worthMatching, blockAt, wholeSnippetIn, stillInFile, foundOutsideTheHunks, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$2, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, listRefs, setBase, clearBase, markRead;
10595
+ var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, readParts, blobOf, vouchIn, toggleVouch, readingOf, markOpened, lastOpenedIn, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, linesIn, trimmedLines, NAMES_SOMETHING, worthMatching, blockAt, wholeSnippetIn, stillInFile, foundOutsideTheHunks, sentIn, listSent, anchorIn, commentsIn, commentIn, submitComment, submitComments, without$2, submitReply, listPatches, patchIn, flatten, threadBefore, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, fileBefore, readPreferences, readPreference, ON, OFF, preferenceValue, savePreference, listRefs, forOne, recentBases, setBase, clearBase, markRead;
10583
10596
  var init_commands = __esmMin((() => {
10584
10597
  init_dist();
10585
10598
  init_patch();
@@ -11124,6 +11137,19 @@ var init_commands = __esmMin((() => {
11124
11137
  listRefs = fn("Cli.listRefs")(function* (repo) {
11125
11138
  return yield* (yield* Git).refs(repo);
11126
11139
  });
11140
+ forOne = (count) => count === 1 ? "the last commit" : `the last ${count} commits`;
11141
+ recentBases = fn("Cli.recentBases")(function* (repo, branch) {
11142
+ const found = yield* (yield* Git).commits(repo, branch, 6);
11143
+ return found.flatMap((commit, at) => {
11144
+ if (at === 0) return [];
11145
+ const oldest = found[at - 1]?.said ?? "";
11146
+ const said = at === 1 ? oldest : `back to ${oldest}`;
11147
+ return [{
11148
+ ref: commit.sha,
11149
+ said: `${forOne(at)} · ${said}`
11150
+ }];
11151
+ });
11152
+ });
11127
11153
  setBase = fn("Cli.setBase")(function* (repo, branch, base) {
11128
11154
  const store = yield* Store;
11129
11155
  const based = yield* baseFor(repo, branch, base);
@@ -11395,7 +11421,7 @@ var init_pane = __esmMin((() => {
11395
11421
  //#region package.json
11396
11422
  init_drafts();
11397
11423
  init_pane();
11398
- var version$1 = "0.1.0-alpha.167";
11424
+ var version$1 = "0.1.0-alpha.169";
11399
11425
  //#endregion
11400
11426
  //#region src/cli/upgrade.ts
11401
11427
  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$1, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
@@ -14059,7 +14085,7 @@ var init_tree = __esmMin((() => {
14059
14085
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
14060
14086
  };
14061
14087
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
14062
- })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, nothingFound, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, partHere, layersHolding, readIn, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, remarkAnswering, answerTarget, replyTarget, threadReplying, VOICES, remarkQuote, threadQuote, pickedText, takenRows, selectedLines, shownMatches, refsShown, picking, refHere, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, needingRowsIn, commentRowsIn, threadsAtRow, remarkShown, remarksAtRow, remarkRowsIn, stopsIn, stopsAtRow, remarkAtStop, remarkAtRow, remarkInPanel, remarkInDiff, remarkUnderCursor, remarkToTakeOn, remarkHere, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, movedPast, sectionOf, sentEntry, remarkRows, panelHolds, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
14088
+ })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, nothingFound, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, partHere, layersHolding, readIn, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, remarkAnswering, answerTarget, replyTarget, threadReplying, VOICES, remarkQuote, threadQuote, pickedText, takenRows, selectedLines, shownMatches, refSaidOf, refsShown, picking, refHere, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, needingRowsIn, commentRowsIn, threadsAtRow, remarkShown, remarksAtRow, remarkRowsIn, stopsIn, stopsAtRow, remarkAtStop, remarkAtRow, remarkInPanel, remarkInDiff, remarkUnderCursor, remarkToTakeOn, remarkHere, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, movedPast, sectionOf, sentEntry, remarkRows, panelHolds, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
14063
14089
  var init_model$1 = __esmMin((() => {
14064
14090
  init_dist();
14065
14091
  init_patch();
@@ -14148,6 +14174,7 @@ var init_model$1 = __esmMin((() => {
14148
14174
  vouched: [],
14149
14175
  partsRead: [],
14150
14176
  openMoved: false,
14177
+ refSaid: {},
14151
14178
  sent: [],
14152
14179
  remarks: [],
14153
14180
  viewport: 20,
@@ -14634,9 +14661,10 @@ var init_model$1 = __esmMin((() => {
14634
14661
  if (wanted.length === 0) return state.matches;
14635
14662
  return state.matches.filter((match) => `${match.path}:${match.line} ${match.text}`.toLowerCase().includes(wanted));
14636
14663
  };
14664
+ refSaidOf = (state, ref) => state.refSaid[ref] ?? "";
14637
14665
  refsShown = (state) => {
14638
14666
  const wanted = state.query.trim().toLowerCase();
14639
- const held = state.refs.filter((ref) => ref.toLowerCase().includes(wanted));
14667
+ const held = state.refs.filter((ref) => `${ref} ${refSaidOf(state, ref)}`.toLowerCase().includes(wanted));
14640
14668
  return wanted.length === 0 || held.some((ref) => ref.toLowerCase() === wanted) ? held : held.concat([state.query.trim()]);
14641
14669
  };
14642
14670
  picking = (state) => state.screen === "base" || state.screen === "editor";
@@ -15518,6 +15546,16 @@ var init_command = __esmMin((() => {
15518
15546
  screens: ["base", "editor"],
15519
15547
  listed: false
15520
15548
  }),
15549
+ command({
15550
+ action: "back",
15551
+ title: "Go back",
15552
+ category: "Branches",
15553
+ keys: ["escape"],
15554
+ screens: ["base", "editor"],
15555
+ hint: "back",
15556
+ listed: false,
15557
+ rank: 9
15558
+ }),
15521
15559
  command({
15522
15560
  action: "base.clear",
15523
15561
  title: "Hand the choice back to adiff",
@@ -16599,6 +16637,16 @@ var init_reduce = __esmMin((() => {
16599
16637
  ...state,
16600
16638
  screen: "review",
16601
16639
  replyTo: void 0
16640
+ }),
16641
+ base: (state) => ({
16642
+ ...state,
16643
+ screen: state.returnTo,
16644
+ query: ""
16645
+ }),
16646
+ editor: (state) => ({
16647
+ ...state,
16648
+ screen: state.returnTo,
16649
+ query: ""
16602
16650
  })
16603
16651
  };
16604
16652
  goBack = (state) => BACK_FROM[state.screen]?.(state) ?? outOfDiff(state);
@@ -16649,7 +16697,10 @@ var init_reduce = __esmMin((() => {
16649
16697
  refIndex: 0,
16650
16698
  query: ""
16651
16699
  });
16652
- withRefs = (state, refs) => withChoices(state, refs, "base");
16700
+ withRefs = (state, refs, said = {}) => ({
16701
+ ...withChoices(state, refs, "base"),
16702
+ refSaid: said
16703
+ });
16653
16704
  movePalette = (state, delta) => ({
16654
16705
  ...state,
16655
16706
  paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, offered(state).length - 1))
@@ -19440,7 +19491,7 @@ var init_render = __esmMin((() => {
19440
19491
  this.baseBox.query.visible = true;
19441
19492
  const tall = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), shown.length + PALETTE_CHROME + 1);
19442
19493
  const typed = state.query.trim();
19443
- this.baseBox.choices.content = listText(shown.map((ref) => clip(` ${ref}${pickedTail(state, ref, typed)}`, room - MODAL_ROOM)), Math.min(state.refIndex, Math.max(0, shown.length - 1)), Math.max(1, tall - PALETTE_CHROME - 1));
19494
+ this.baseBox.choices.content = listText(shown.map((ref) => clip(` ${ref}${refSaidOf(state, ref).length === 0 ? "" : ` ${refSaidOf(state, ref)}`}${pickedTail(state, ref, typed)}`, room - MODAL_ROOM)), Math.min(state.refIndex, Math.max(0, shown.length - 1)), Math.max(1, tall - PALETTE_CHROME - 1));
19444
19495
  this.baseBox.box.height = tall;
19445
19496
  this.baseBox.box.width = room;
19446
19497
  this.baseBox.box.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
@@ -20785,8 +20836,10 @@ var init_app = __esmMin((() => {
20785
20836
  return gen({ self: this }, function* () {
20786
20837
  const branch = selectedBranch(this.state);
20787
20838
  if (branch === void 0) return;
20788
- const refs = yield* listRefs(this.repo);
20789
- this.commit(withRefs(this.state, refs.filter((ref) => ref !== branch.branch)));
20839
+ const [refs, recent] = yield* all([listRefs(this.repo), recentBases(this.repo, branch.branch)]);
20840
+ const said = Object.fromEntries(recent.map((one) => [one.ref, one.said]));
20841
+ const kept = refs.filter((ref) => ref !== branch.branch);
20842
+ this.commit(withRefs(this.state, [...recent.map((one) => one.ref), ...kept], said));
20790
20843
  });
20791
20844
  }
20792
20845
  basedOnRef(ref) {
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.167",
26
+ "version": "0.1.0-alpha.169",
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": {