@eliya-oss/agent-diff 0.1.0-alpha.156 → 0.1.0-alpha.158

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/main.js +366 -52
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.158
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(diff): `e` opens the line under the cursor in your editor, found from the environment or set in the settings file.
8
+
9
+ <details><summary>Why</summary>
10
+
11
+ Reading a diff is where a reviewer decides to change something, and the file and line are already
12
+ under the cursor. `$VISUAL`, then `$EDITOR`, then whatever launched adiff — VS Code, Cursor,
13
+ Windsurf, Zed and JetBrains all say so in the environment — and a known editor gets its own line
14
+ flag, so `code` becomes `code --goto file:line`. Set `editor` in the settings file to override it.
15
+
16
+ </details>
17
+
18
+ ## 0.1.0-alpha.157
19
+
20
+ ### Patch Changes
21
+
22
+ - feat(branches): `b` sets what this branch is compared against, from the list of refs the repository has.
23
+
24
+ <details><summary>Why</summary>
25
+
26
+ A reviewer who could see the base was wrong — the row says what each branch is stacked on — had to
27
+ leave the terminal, remember `adiff base set`, and come back. `b` opens the refs newest first,
28
+ narrowed by typing, and a ref you type that is not listed is still tried, so a tag or a commit works.
29
+ `ctrl+x` hands the base back to adiff's own guess.
30
+
31
+ </details>
32
+
3
33
  ## 0.1.0-alpha.156
4
34
 
5
35
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8822,7 +8822,7 @@ var init_error$3 = __esmMin((() => {
8822
8822
  }));
8823
8823
  //#endregion
8824
8824
  //#region src/service/forge/service.ts
8825
- var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$2, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$1, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, THREADS, Said, Thread, Page, Held$1, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, HERE, asked, whereOf, threadsIn$1, unresolved, PAGES, everyThread, answer$1, remarks, review, ForgeLive;
8825
+ var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$2, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$2, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, THREADS, Said, Thread, Page, Held$1, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, HERE, asked, whereOf, threadsIn$1, unresolved, PAGES, everyThread, answer$1, remarks, review, ForgeLive;
8826
8826
  var init_service$2 = __esmMin((() => {
8827
8827
  init_dist();
8828
8828
  init_error$3();
@@ -8943,7 +8943,7 @@ var init_service$2 = __esmMin((() => {
8943
8943
  if (input !== void 0) child.stdin?.end(input);
8944
8944
  return ended(child);
8945
8945
  });
8946
- named$1 = fn("Forge.named")(function* (repo, branch) {
8946
+ named$2 = fn("Forge.named")(function* (repo, branch) {
8947
8947
  const raw = yield* gh(repo, [
8948
8948
  "pr",
8949
8949
  "view",
@@ -8964,7 +8964,7 @@ var init_service$2 = __esmMin((() => {
8964
8964
  }));
8965
8965
  });
8966
8966
  head = fn("Forge.head")(function* (repo, branch) {
8967
- return (yield* named$1(repo, branch)).headRefOid;
8967
+ return (yield* named$2(repo, branch)).headRefOid;
8968
8968
  });
8969
8969
  sideName = (side) => side === "old" ? "LEFT" : "RIGHT";
8970
8970
  commentBody = (one) => ({
@@ -9122,7 +9122,7 @@ var init_service$2 = __esmMin((() => {
9122
9122
  ...after === void 0 ? [] : ["-f", `after=${after}`]
9123
9123
  ]);
9124
9124
  whereOf = fn("Forge.whereOf")(function* (repo, branch) {
9125
- const pull = yield* named$1(repo, branch);
9125
+ const pull = yield* named$2(repo, branch);
9126
9126
  const here = yield* ownerOf(repo);
9127
9127
  return {
9128
9128
  owner: here.owner,
@@ -9192,7 +9192,7 @@ var init_service$2 = __esmMin((() => {
9192
9192
  return unresolved(yield* everyThread(repo, branch));
9193
9193
  });
9194
9194
  review = fn("Forge.review")(function* (repo, branch, comments) {
9195
- const pull = yield* named$1(repo, branch);
9195
+ const pull = yield* named$2(repo, branch);
9196
9196
  const route = `repos/${(yield* gh(repo, [
9197
9197
  "repo",
9198
9198
  "view",
@@ -9240,7 +9240,7 @@ var init_error$2 = __esmMin((() => {
9240
9240
  //#endregion
9241
9241
  //#region src/service/store/model.ts
9242
9242
  var emptyBranchState;
9243
- var init_model$5 = __esmMin((() => {
9243
+ var init_model$6 = __esmMin((() => {
9244
9244
  emptyBranchState = {
9245
9245
  taken: {},
9246
9246
  vouches: {},
@@ -9343,7 +9343,8 @@ var init_schema = __esmMin((() => {
9343
9343
  hideSettled: optionalKey(Boolean),
9344
9344
  newestFirst: optionalKey(Boolean),
9345
9345
  remarks: optionalKey(Boolean),
9346
- hold: optionalKey(Boolean)
9346
+ hold: optionalKey(Boolean),
9347
+ editor: optionalKey(String$1)
9347
9348
  });
9348
9349
  Watching = Struct({ lookedAt: String$1 });
9349
9350
  UpgradeCheck = Struct({
@@ -9402,7 +9403,7 @@ var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwri
9402
9403
  var init_service$1 = __esmMin((() => {
9403
9404
  init_dist();
9404
9405
  init_error$2();
9405
- init_model$5();
9406
+ init_model$6();
9406
9407
  init_schema();
9407
9408
  init_paths();
9408
9409
  Store = class extends Service()("adiff/Store") {};
@@ -9830,12 +9831,12 @@ var init_store = __esmMin((() => {
9830
9831
  init_service$1();
9831
9832
  init_error$2();
9832
9833
  init_paths();
9833
- init_model$5();
9834
+ init_model$6();
9834
9835
  }));
9835
9836
  //#endregion
9836
9837
  //#region src/domain/patch/model.ts
9837
9838
  var WHOLE_FILE, lineOn;
9838
- var init_model$4 = __esmMin((() => {
9839
+ var init_model$5 = __esmMin((() => {
9839
9840
  WHOLE_FILE = 1e5;
9840
9841
  lineOn = (row, side) => side === "new" ? row.newLine : row.oldLine;
9841
9842
  }));
@@ -9844,7 +9845,7 @@ var init_model$4 = __esmMin((() => {
9844
9845
  var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundExactly, foundAlike, foundAgain;
9845
9846
  var init_anchor = __esmMin((() => {
9846
9847
  init_dist();
9847
- init_model$4();
9848
+ init_model$5();
9848
9849
  sideOf = (rows) => rows.some((row) => isSome(row.newLine)) ? "new" : "old";
9849
9850
  linesOn = (rows, side) => rows.flatMap((row) => match$3(lineOn(row, side), {
9850
9851
  onNone: () => [],
@@ -10174,7 +10175,7 @@ var init_patch = __esmMin((() => {
10174
10175
  init_anchor();
10175
10176
  init_parse$1();
10176
10177
  init_sticky();
10177
- init_model$4();
10178
+ init_model$5();
10178
10179
  }));
10179
10180
  //#endregion
10180
10181
  //#region src/service/git/error.ts
@@ -10211,7 +10212,7 @@ var init_run = __esmMin((() => {
10211
10212
  gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
10212
10213
  return yield* git(cwd, args).pipe(catchTag("GitCommandFailed", () => succeed$1("")));
10213
10214
  });
10214
- })), 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, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
10215
+ })), 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;
10215
10216
  var init_service = __esmMin((() => {
10216
10217
  init_dist();
10217
10218
  init_error$1();
@@ -10386,6 +10387,17 @@ var init_service = __esmMin((() => {
10386
10387
  ])).trim();
10387
10388
  return trimmed.length === 0 ? resolve(worktree) : resolve(trimmed, "..");
10388
10389
  });
10390
+ REFS_MOST = 200;
10391
+ readRefs = fn("Git.refs")(function* (repo) {
10392
+ return (yield* gitOrEmpty(repo, [
10393
+ "for-each-ref",
10394
+ "--sort=-committerdate",
10395
+ `--count=${REFS_MOST}`,
10396
+ "--format=%(refname:short)",
10397
+ "refs/heads",
10398
+ "refs/remotes"
10399
+ ])).split("\n").map((line) => line.trim()).filter((line) => line.length > 0 && !line.endsWith("/HEAD"));
10400
+ });
10389
10401
  refResolves = fn("Git.resolves")(function* (repo, ref) {
10390
10402
  return (yield* gitOrEmpty(repo, [
10391
10403
  "rev-parse",
@@ -10429,6 +10441,7 @@ var init_service = __esmMin((() => {
10429
10441
  grep: readGrep,
10430
10442
  defaultBranch: (repo) => get(caches.baseName, repo),
10431
10443
  stackParent: (repo, branch) => get(caches.baseName, repo).pipe(flatMap((fallback) => get(caches.parent, `${repo}${SPLIT}${branch}${SPLIT}${fallback}`))),
10444
+ refs: readRefs,
10432
10445
  resolves: refResolves,
10433
10446
  sharedWith: sharedCommit
10434
10447
  });
@@ -10466,8 +10479,8 @@ var init_review = __esmMin((() => {
10466
10479
  }));
10467
10480
  //#endregion
10468
10481
  //#region src/domain/preferences/model.ts
10469
- var preferences, preferenceNames, preferenceNamed, heldValue, heldValues;
10470
- var init_model$3 = __esmMin((() => {
10482
+ var preferences, preferenceNames, preferenceNamed, asFlag, heldValue, heldValues;
10483
+ var init_model$4 = __esmMin((() => {
10471
10484
  preferences = [
10472
10485
  {
10473
10486
  name: "wrap",
@@ -10520,13 +10533,14 @@ var init_model$3 = __esmMin((() => {
10520
10533
  ];
10521
10534
  preferenceNames = preferences.map((one) => one.name);
10522
10535
  preferenceNamed = (name) => preferences.find((one) => one.name === name);
10523
- heldValue = (kept, name) => kept[name] ?? preferenceNamed(name)?.byDefault ?? false;
10536
+ asFlag = (held) => typeof held === "boolean" ? held : void 0;
10537
+ heldValue = (kept, name) => asFlag(kept[name]) ?? preferenceNamed(name)?.byDefault ?? false;
10524
10538
  heldValues = (kept) => Object.fromEntries(preferences.map((one) => [one.name, heldValue(kept, one.name)]));
10525
10539
  }));
10526
10540
  //#endregion
10527
10541
  //#region src/domain/preferences/index.ts
10528
10542
  var init_preferences = __esmMin((() => {
10529
- init_model$3();
10543
+ init_model$4();
10530
10544
  })), UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
10531
10545
  var init_error = __esmMin((() => {
10532
10546
  init_dist();
@@ -10556,7 +10570,7 @@ var init_error = __esmMin((() => {
10556
10570
  }));
10557
10571
  //#endregion
10558
10572
  //#region src/cli/commands.ts
10559
- var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, 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, setBase, clearBase, markRead;
10573
+ var realOf, CONTEXT, POLL, AUTO, askedFor$1, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, waitingOn, summaryOf, summaryFor, listBranches, blobOf, vouchIn, toggleVouch, readingOf, progressIn, reviewProgress, bodyOf, saidTo, spunOf, sentOf, whereItSitsNow$1, 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;
10560
10574
  var init_commands = __esmMin((() => {
10561
10575
  init_dist();
10562
10576
  init_patch();
@@ -11038,6 +11052,9 @@ var init_commands = __esmMin((() => {
11038
11052
  byDefault: known.byDefault
11039
11053
  };
11040
11054
  });
11055
+ listRefs = fn("Cli.listRefs")(function* (repo) {
11056
+ return yield* (yield* Git).refs(repo);
11057
+ });
11041
11058
  setBase = fn("Cli.setBase")(function* (repo, branch, base) {
11042
11059
  const store = yield* Store;
11043
11060
  const based = yield* baseFor(repo, branch, base);
@@ -11204,7 +11221,7 @@ var init_drafts = __esmMin((() => {
11204
11221
  }));
11205
11222
  //#endregion
11206
11223
  //#region src/cli/pane.ts
11207
- var TIMEOUT_MS, set, splitters, named, selfInvocation, ran, split, openPane;
11224
+ var TIMEOUT_MS, set, splitters, named$1, selfInvocation, ran, split, openPane;
11208
11225
  var init_pane = __esmMin((() => {
11209
11226
  init_dist();
11210
11227
  TIMEOUT_MS = 5e3;
@@ -11265,7 +11282,7 @@ var init_pane = __esmMin((() => {
11265
11282
  ]
11266
11283
  }
11267
11284
  ];
11268
- named = (option, value) => value === void 0 ? [] : [`--${option}`, value];
11285
+ named$1 = (option, value) => value === void 0 ? [] : [`--${option}`, value];
11269
11286
  selfInvocation = (repo, branch, base) => {
11270
11287
  const entry = process.argv[1];
11271
11288
  return [
@@ -11278,8 +11295,8 @@ var init_pane = __esmMin((() => {
11278
11295
  "open",
11279
11296
  "--repo",
11280
11297
  repo,
11281
- ...named("branch", branch),
11282
- ...named("base", base)
11298
+ ...named$1("branch", branch),
11299
+ ...named$1("base", base)
11283
11300
  ];
11284
11301
  };
11285
11302
  ran = (binary, args) => callback$1((resume) => {
@@ -11290,7 +11307,7 @@ var init_pane = __esmMin((() => {
11290
11307
  return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch, base)));
11291
11308
  });
11292
11309
  openPane = fn("Cli.openPane")(function* (repo, branch, base) {
11293
- const said = [...named("branch", branch), ...named("base", base)].join(" ");
11310
+ const said = [...named$1("branch", branch), ...named$1("base", base)].join(" ");
11294
11311
  const command = `adiff review open --repo ${repo}${said.length === 0 ? "" : ` ${said}`}`;
11295
11312
  const chosen = splitters.find((candidate) => candidate.present());
11296
11313
  if (chosen === void 0) return {
@@ -11309,7 +11326,7 @@ var init_pane = __esmMin((() => {
11309
11326
  //#region package.json
11310
11327
  init_drafts();
11311
11328
  init_pane();
11312
- var version$1 = "0.1.0-alpha.156";
11329
+ var version$1 = "0.1.0-alpha.158";
11313
11330
  //#endregion
11314
11331
  //#region src/cli/upgrade.ts
11315
11332
  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;
@@ -11479,7 +11496,7 @@ var init_upgrade$1 = __esmMin((() => {
11479
11496
  };
11480
11497
  };
11481
11498
  })), DATA_ENDS, DATA_NAMES, DATA_STARTS, DATA_PARTS, TEST_PARTS, TEST_ENDS, partsOf, nameOf$1, isData, isTest, tierOf, KEYWORDS, escaped, BORROWS, declaresIn, bandOf, TIERS, BANDS, rankOf, inFile, byRank, byFile, countedIn, ranked;
11482
- var init_model$2 = __esmMin((() => {
11499
+ var init_model$3 = __esmMin((() => {
11483
11500
  DATA_ENDS = [
11484
11501
  ".txt",
11485
11502
  ".csv",
@@ -11643,7 +11660,7 @@ var init_model$2 = __esmMin((() => {
11643
11660
  //#endregion
11644
11661
  //#region src/domain/search/index.ts
11645
11662
  var init_search$1 = __esmMin((() => {
11646
- init_model$2();
11663
+ init_model$3();
11647
11664
  }));
11648
11665
  //#endregion
11649
11666
  //#region src/cli/search.ts
@@ -11710,7 +11727,7 @@ var init_search = __esmMin((() => {
11710
11727
  //#endregion
11711
11728
  //#region src/domain/layers/model.ts
11712
11729
  var REMAINDER_TITLE;
11713
- var init_model$1 = __esmMin((() => {
11730
+ var init_model$2 = __esmMin((() => {
11714
11731
  REMAINDER_TITLE = "not in any layer";
11715
11732
  }));
11716
11733
  //#endregion
@@ -11718,7 +11735,7 @@ var init_model$1 = __esmMin((() => {
11718
11735
  var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, claimsHunk, runsOf, tallyOf, coverage, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
11719
11736
  var init_coverage = __esmMin((() => {
11720
11737
  init_dist();
11721
- init_model$1();
11738
+ init_model$2();
11722
11739
  codeBlockOf$1 = (span) => ({
11723
11740
  kind: "code",
11724
11741
  path: span.path,
@@ -11865,7 +11882,7 @@ var init_version = __esmMin((() => {
11865
11882
  var init_layers$1 = __esmMin((() => {
11866
11883
  init_coverage();
11867
11884
  init_version();
11868
- init_model$1();
11885
+ init_model$2();
11869
11886
  }));
11870
11887
  //#endregion
11871
11888
  //#region src/cli/layers.ts
@@ -13927,8 +13944,8 @@ var init_tree = __esmMin((() => {
13927
13944
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13928
13945
  };
13929
13946
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13930
- })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, 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, 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, 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, sectionOf, sentEntry, remarkRows, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13931
- var init_model = __esmMin((() => {
13947
+ })), 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, 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, 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, sectionOf, sentEntry, remarkRows, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13948
+ var init_model$1 = __esmMin((() => {
13932
13949
  init_dist();
13933
13950
  init_patch();
13934
13951
  init_preferences();
@@ -13984,6 +14001,15 @@ var init_model = __esmMin((() => {
13984
14001
  now: 0,
13985
14002
  focusWas: "diff"
13986
14003
  };
14004
+ nothingFound = {
14005
+ matches: [],
14006
+ refs: [],
14007
+ refIndex: 0,
14008
+ matchIndex: 0,
14009
+ term: "",
14010
+ query: "",
14011
+ paletteIndex: 0
14012
+ };
13987
14013
  initialState = (branches) => ({
13988
14014
  ...nothingReviewed,
13989
14015
  screen: "branches",
@@ -14000,8 +14026,6 @@ var init_model = __esmMin((() => {
14000
14026
  draftAt: "",
14001
14027
  notice: "",
14002
14028
  waiting: "",
14003
- query: "",
14004
- paletteIndex: 0,
14005
14029
  returnTo: "branches",
14006
14030
  closed: [],
14007
14031
  vouched: [],
@@ -14026,8 +14050,7 @@ var init_model = __esmMin((() => {
14026
14050
  forge: "asking",
14027
14051
  layerIndex: 0,
14028
14052
  openLayers: [],
14029
- term: "",
14030
- matches: [],
14053
+ ...nothingFound,
14031
14054
  counted: {
14032
14055
  file: 0,
14033
14056
  branch: 0,
@@ -14035,7 +14058,6 @@ var init_model = __esmMin((() => {
14035
14058
  },
14036
14059
  leftOut: 0,
14037
14060
  around: [],
14038
- matchIndex: 0,
14039
14061
  rail: "tree"
14040
14062
  });
14041
14063
  TREE_MAX = 34;
@@ -14480,6 +14502,12 @@ var init_model = __esmMin((() => {
14480
14502
  if (wanted.length === 0) return state.matches;
14481
14503
  return state.matches.filter((match) => `${match.path}:${match.line} ${match.text}`.toLowerCase().includes(wanted));
14482
14504
  };
14505
+ refsShown = (state) => {
14506
+ const wanted = state.query.trim().toLowerCase();
14507
+ const held = state.refs.filter((ref) => ref.toLowerCase().includes(wanted));
14508
+ return wanted.length === 0 || held.some((ref) => ref.toLowerCase() === wanted) ? held : [...held, state.query.trim()];
14509
+ };
14510
+ refHere = (state) => refsShown(state)[state.refIndex];
14483
14511
  matchHere = (state) => shownMatches(state)[state.matchIndex];
14484
14512
  selectionReadout = (state) => {
14485
14513
  const patch = selectedPatch(state);
@@ -14766,7 +14794,7 @@ var init_model = __esmMin((() => {
14766
14794
  var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, whereabouts, said$1, chosenAway, standingOn, layersLine, remarksLine, shapeLine, tookLine, facts, fenced, fully, minimal, lastFailure, buildReport;
14767
14795
  var init_report = __esmMin((() => {
14768
14796
  init_dist();
14769
- init_model();
14797
+ init_model$1();
14770
14798
  init_preferences();
14771
14799
  AROUND_CURSOR = 8;
14772
14800
  TREE_ROWS = 12;
@@ -14871,6 +14899,56 @@ var init_report = __esmMin((() => {
14871
14899
  };
14872
14900
  }));
14873
14901
  //#endregion
14902
+ //#region src/domain/editor/model.ts
14903
+ var KNOWN, LINED, named, shaped, guessed, templateFor, openingOf;
14904
+ var init_model = __esmMin((() => {
14905
+ KNOWN = [
14906
+ ["vscode", "code --goto {file}:{line}"],
14907
+ ["cursor", "cursor --goto {file}:{line}"],
14908
+ ["windsurf", "windsurf --goto {file}:{line}"],
14909
+ ["zed", "zed {file}:{line}"],
14910
+ ["jetbrains", "idea --line {line} {file}"]
14911
+ ];
14912
+ LINED = [
14913
+ ["code", "{command} --goto {file}:{line}"],
14914
+ ["cursor", "{command} --goto {file}:{line}"],
14915
+ ["zed", "{command} {file}:{line}"],
14916
+ ["idea", "{command} --line {line} {file}"],
14917
+ ["subl", "{command} {file}:{line}"],
14918
+ ["vim", "{command} +{line} {file}"],
14919
+ ["nvim", "{command} +{line} {file}"],
14920
+ ["hx", "{command} {file}:{line}"],
14921
+ ["nano", "{command} +{line} {file}"],
14922
+ ["emacs", "{command} +{line} {file}"]
14923
+ ];
14924
+ named = (said) => said.trim().split(/\s+/)[0]?.split("/").at(-1) ?? "";
14925
+ shaped = (said) => {
14926
+ if (said.includes("{file}")) return said;
14927
+ const known = LINED.find(([name]) => name === named(said));
14928
+ return known === void 0 ? `${said} {file}` : known[1].replace("{command}", said);
14929
+ };
14930
+ guessed = (told) => {
14931
+ const marks = `${told.termProgram ?? ""} ${told.terminalEmulator ?? ""}`.toLowerCase();
14932
+ return KNOWN.find(([mark]) => marks.includes(mark))?.[1];
14933
+ };
14934
+ templateFor = (told) => {
14935
+ const asked = told.editor ?? told.visual ?? told.fallback;
14936
+ return asked === void 0 || asked.trim().length === 0 ? guessed(told) : shaped(asked);
14937
+ };
14938
+ openingOf = (template, file, line) => {
14939
+ const [command, ...args] = template.replaceAll("{file}", file).replaceAll("{line}", String(line)).trim().split(/\s+/);
14940
+ return command === void 0 ? void 0 : {
14941
+ command,
14942
+ args
14943
+ };
14944
+ };
14945
+ }));
14946
+ //#endregion
14947
+ //#region src/domain/editor/index.ts
14948
+ var init_editor = __esmMin((() => {
14949
+ init_model();
14950
+ }));
14951
+ //#endregion
14874
14952
  //#region src/tui/watch.ts
14875
14953
  var OUTBOX, SETTLE_MS, WatchUnavailable, answered, opened, holding, answers;
14876
14954
  var init_watch = __esmMin((() => {
@@ -15255,6 +15333,71 @@ var init_command = __esmMin((() => {
15255
15333
  keys: ["<"],
15256
15334
  screens: ["review"]
15257
15335
  }),
15336
+ command({
15337
+ action: "base.open",
15338
+ also: [
15339
+ "base",
15340
+ "stacked on",
15341
+ "compare against",
15342
+ "diff against"
15343
+ ],
15344
+ title: "Set what this branch is compared against",
15345
+ category: "Branches",
15346
+ keys: ["b"],
15347
+ screens: ["branches", "review"],
15348
+ hint: "base",
15349
+ rank: 5
15350
+ }),
15351
+ command({
15352
+ action: "base.set",
15353
+ title: "Use the base under the cursor",
15354
+ category: "Branches",
15355
+ keys: ["return"],
15356
+ screens: ["base"],
15357
+ listed: false
15358
+ }),
15359
+ command({
15360
+ action: "base.clear",
15361
+ title: "Let adiff work the base out again",
15362
+ category: "Branches",
15363
+ keys: ["ctrl+x"],
15364
+ screens: ["base"],
15365
+ hint: "automatic",
15366
+ listed: false
15367
+ }),
15368
+ command({
15369
+ action: "base.next",
15370
+ title: "Next base",
15371
+ category: "Branches",
15372
+ keys: ["down"],
15373
+ screens: ["base"],
15374
+ listed: false
15375
+ }),
15376
+ command({
15377
+ action: "base.prev",
15378
+ title: "Previous base",
15379
+ category: "Branches",
15380
+ keys: ["up"],
15381
+ screens: ["base"],
15382
+ listed: false
15383
+ }),
15384
+ command({
15385
+ action: "line.open",
15386
+ also: [
15387
+ "editor",
15388
+ "ide",
15389
+ "vscode",
15390
+ "open in",
15391
+ "jump to"
15392
+ ],
15393
+ panes: ["diff"],
15394
+ title: "Open this line in your editor",
15395
+ category: "Reading",
15396
+ keys: ["e"],
15397
+ screens: ["review"],
15398
+ hint: "editor",
15399
+ rank: 5
15400
+ }),
15258
15401
  command({
15259
15402
  action: "review.reload",
15260
15403
  title: "Read the branches again",
@@ -15781,7 +15924,7 @@ var init_match = __esmMin((() => {
15781
15924
  }));
15782
15925
  //#endregion
15783
15926
  //#region src/tui/reduce.ts
15784
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withAround, withNoticeHere, withNotice;
15927
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, moveRef, withRefs, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withAround, withNoticeHere, withNotice;
15785
15928
  var init_reduce = __esmMin((() => {
15786
15929
  init_dist();
15787
15930
  init_patch();
@@ -15789,7 +15932,7 @@ var init_reduce = __esmMin((() => {
15789
15932
  init_gaps();
15790
15933
  init_match();
15791
15934
  init_preferences();
15792
- init_model();
15935
+ init_model$1();
15793
15936
  clamp = (value, low, high) => Math.max(low, Math.min(high, value));
15794
15937
  lastRow = (patch) => Math.max(0, (patch?.rows.length ?? 1) - 1);
15795
15938
  rowsIn = (state) => selectedPatch(state)?.rows.length ?? 0;
@@ -16276,6 +16419,18 @@ var init_reduce = __esmMin((() => {
16276
16419
  const held = chosenNow(state);
16277
16420
  return withChosen(state, wanted.name, !(held[wanted.name] ?? wanted.byDefault));
16278
16421
  };
16422
+ moveRef = (state, delta) => ({
16423
+ ...state,
16424
+ refIndex: clamp(state.refIndex + delta, 0, Math.max(0, refsShown(state).length - 1))
16425
+ });
16426
+ withRefs = (state, refs) => ({
16427
+ ...state,
16428
+ screen: "base",
16429
+ returnTo: state.screen,
16430
+ refs,
16431
+ refIndex: 0,
16432
+ query: ""
16433
+ });
16279
16434
  movePalette = (state, delta) => ({
16280
16435
  ...state,
16281
16436
  paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, offered(state).length - 1))
@@ -16339,6 +16494,12 @@ var init_reduce = __esmMin((() => {
16339
16494
  "pan.right": (state) => panned(state, PAN_STEP),
16340
16495
  "pan.left": (state) => panned(state, -8),
16341
16496
  "review.reload": (state) => state,
16497
+ "base.open": (state) => state,
16498
+ "base.set": (state) => state,
16499
+ "base.clear": (state) => state,
16500
+ "base.next": (state) => moveRef(state, 1),
16501
+ "base.prev": (state) => moveRef(state, -1),
16502
+ "line.open": (state) => state,
16342
16503
  "thread.settle": (state) => state,
16343
16504
  "thread.settleRead": (state) => state,
16344
16505
  "thread.remove": (state) => state,
@@ -16824,7 +16985,7 @@ var init_diffview = __esmMin((() => {
16824
16985
  init_dist();
16825
16986
  init_patch();
16826
16987
  init_marks();
16827
- init_model();
16988
+ init_model$1();
16828
16989
  init_theme();
16829
16990
  WASH = {
16830
16991
  added: {
@@ -17524,7 +17685,7 @@ var init_diffview = __esmMin((() => {
17524
17685
  }));
17525
17686
  //#endregion
17526
17687
  //#region src/tui/render.ts
17527
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, SENDS, REPLIES, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, counting, foundBlocks, JOIN, foundTitle, CHANGED_MARK, DECLARED, fileRow, leftRow, placeRow, blockOf, aroundRow, windowedBlocks, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
17688
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, SENDS, REPLIES, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeBaseParts, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, counting, foundBlocks, JOIN, foundTitle, CHANGED_MARK, DECLARED, fileRow, leftRow, placeRow, blockOf, aroundRow, windowedBlocks, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
17528
17689
  var init_render = __esmMin((() => {
17529
17690
  init_dist();
17530
17691
  init_command();
@@ -17533,7 +17694,7 @@ var init_render = __esmMin((() => {
17533
17694
  init_diffview();
17534
17695
  init_gaps();
17535
17696
  init_reduce();
17536
- init_model();
17697
+ init_model$1();
17537
17698
  init_marks();
17538
17699
  init_theme();
17539
17700
  ROW_HEIGHT = 1;
@@ -17923,8 +18084,25 @@ var init_render = __esmMin((() => {
17923
18084
  palette: makePaletteParts(renderer),
17924
18085
  found: makeFoundParts(renderer),
17925
18086
  keys: makeKeysParts(renderer),
17926
- settings: makeSettingsParts(renderer)
18087
+ settings: makeSettingsParts(renderer),
18088
+ bases: makeBaseParts(renderer)
17927
18089
  });
18090
+ makeBaseParts = (renderer) => {
18091
+ const box = makePalette(renderer);
18092
+ const title = bar(renderer, "base-title", palette.faint);
18093
+ const query = asking(renderer, "base-query", "Type a branch, a tag or a commit…");
18094
+ const choices = makeChoices(renderer);
18095
+ box.id = "base";
18096
+ box.add(title);
18097
+ box.add(query);
18098
+ box.add(choices);
18099
+ return {
18100
+ box,
18101
+ title,
18102
+ query,
18103
+ choices
18104
+ };
18105
+ };
17928
18106
  makeSettingsParts = (renderer) => {
17929
18107
  const box = makePalette(renderer);
17930
18108
  const title = bar(renderer, "settings-title", palette.faint);
@@ -18653,6 +18831,7 @@ var init_render = __esmMin((() => {
18653
18831
  paletteChoices;
18654
18832
  keys;
18655
18833
  keysTitle;
18834
+ baseBox;
18656
18835
  settings;
18657
18836
  settingsTitle;
18658
18837
  settingsChoices;
@@ -18707,10 +18886,11 @@ var init_render = __esmMin((() => {
18707
18886
  this.settingsChoices = modals.settings.choices;
18708
18887
  this.keysTitle = modals.keys.title;
18709
18888
  this.keysQuery = modals.keys.query;
18710
- this.foundQuery = modals.found.query;
18711
18889
  this.keysChoices = modals.keys.choices;
18890
+ this.baseBox = modals.bases;
18712
18891
  this.found = modals.found.box;
18713
18892
  this.foundTitle = modals.found.title;
18893
+ this.foundQuery = modals.found.query;
18714
18894
  this.foundPeek = modals.found.peek;
18715
18895
  this.foundChoices = modals.found.choices;
18716
18896
  this.assemble(renderer);
@@ -18786,6 +18966,7 @@ var init_render = __esmMin((() => {
18786
18966
  case "palette": return this.paletteQuery;
18787
18967
  case "search": return this.foundQuery;
18788
18968
  case "keys": return this.keysQuery;
18969
+ case "base": return this.baseBox.query;
18789
18970
  default: return;
18790
18971
  }
18791
18972
  }
@@ -18828,6 +19009,7 @@ var init_render = __esmMin((() => {
18828
19009
  this.paintPalette(state);
18829
19010
  this.paintKeys(state);
18830
19011
  this.paintSettings(state);
19012
+ this.paintBases(state);
18831
19013
  this.paintFound(state);
18832
19014
  this.paintReport(state);
18833
19015
  this.scrim.visible = state.screen !== "branches" && state.screen !== "review";
@@ -18858,6 +19040,26 @@ var init_render = __esmMin((() => {
18858
19040
  this.palette.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
18859
19041
  this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
18860
19042
  }
19043
+ paintBases(state) {
19044
+ this.baseBox.box.visible = state.screen === "base";
19045
+ if (state.screen !== "base") {
19046
+ this.baseBox.title.content = "";
19047
+ this.baseBox.choices.content = "";
19048
+ return;
19049
+ }
19050
+ const shown = refsShown(state);
19051
+ const room = panelWidth(this.renderer.width);
19052
+ const here = selectedBranch(state);
19053
+ const on = here === void 0 ? "" : `${here.base}${here.basis === "set" ? "" : ", adiff's guess"}`;
19054
+ this.baseBox.title.content = clip(`Base for ${here?.branch ?? "this branch"}${on.length === 0 ? "" : ` — now ${on}`}`, room - MODAL_ROOM);
19055
+ this.baseBox.query.visible = true;
19056
+ const tall = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), shown.length + PALETTE_CHROME + 1);
19057
+ this.baseBox.choices.content = listText(shown.map((ref) => clip(` ${ref}`, room - MODAL_ROOM)), Math.min(state.refIndex, Math.max(0, shown.length - 1)), Math.max(1, tall - PALETTE_CHROME - 1));
19058
+ this.baseBox.box.height = tall;
19059
+ this.baseBox.box.width = room;
19060
+ this.baseBox.box.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
19061
+ this.baseBox.box.top = panelTop(this.renderer.height, PANEL_QUARTER);
19062
+ }
18861
19063
  paintSettings(state) {
18862
19064
  this.settings.visible = state.screen === "settings";
18863
19065
  if (state.screen !== "settings") {
@@ -19044,7 +19246,8 @@ var init_render = __esmMin((() => {
19044
19246
  this.palette,
19045
19247
  this.found,
19046
19248
  this.keys,
19047
- this.settings
19249
+ this.settings,
19250
+ this.baseBox.box
19048
19251
  ]);
19049
19252
  }
19050
19253
  watchChips() {
@@ -19269,7 +19472,8 @@ var init_display = __esmMin((() => {
19269
19472
  ASKING = [
19270
19473
  "palette",
19271
19474
  "keys",
19272
- "search"
19475
+ "search",
19476
+ "base"
19273
19477
  ];
19274
19478
  Display = class extends Service()("adiff/Display") {};
19275
19479
  paintWith = (screen) => fn("Tui.paint")(function* (state) {
@@ -19404,11 +19608,12 @@ var init_upgrade = __esmMin((() => {
19404
19608
  }));
19405
19609
  //#endregion
19406
19610
  //#region src/tui/app.ts
19407
- var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
19611
+ var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, NO_EDITOR, WORTH_TIMING_MS, TIMES_KEPT, SLOWEST_KEPT, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, ranAside, editorTold, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
19408
19612
  var init_app = __esmMin((() => {
19409
19613
  init_dist();
19410
19614
  init_report();
19411
19615
  init_patch();
19616
+ init_editor();
19412
19617
  init_cli();
19413
19618
  init_preferences();
19414
19619
  init_store();
@@ -19416,7 +19621,7 @@ var init_app = __esmMin((() => {
19416
19621
  init_forge();
19417
19622
  init_command();
19418
19623
  init_gaps();
19419
- init_model();
19624
+ init_model$1();
19420
19625
  init_reduce();
19421
19626
  init_display();
19422
19627
  init_intent();
@@ -19428,6 +19633,7 @@ var init_app = __esmMin((() => {
19428
19633
  AGE_TICK_MS = 3e4;
19429
19634
  LEAVING_SAID = "press ctrl+c again to leave";
19430
19635
  NOTHING_WRITTEN = "nothing written yet";
19636
+ NO_EDITOR = "no editor to open it in: set $VISUAL, or editor in the settings file";
19431
19637
  WORTH_TIMING_MS = 250;
19432
19638
  TIMES_KEPT = 40;
19433
19639
  SLOWEST_KEPT = 3;
@@ -19495,6 +19701,29 @@ var init_app = __esmMin((() => {
19495
19701
  if (process.env["TMUX"] !== void 0) return `\u001BPtmux;\u001B${sequence}\u001B\\`;
19496
19702
  return process.env["STY"] === void 0 ? sequence : `\u001BP${sequence}\u001B\\`;
19497
19703
  };
19704
+ ranAside = (command, args) => {
19705
+ try {
19706
+ const child = spawn(command, [...args], {
19707
+ detached: true,
19708
+ stdio: "ignore"
19709
+ });
19710
+ child.on("error", () => void 0);
19711
+ child.unref();
19712
+ return true;
19713
+ } catch {
19714
+ return false;
19715
+ }
19716
+ };
19717
+ editorTold = gen(function* () {
19718
+ const held = (yield* (yield* Store).settings)["editor"];
19719
+ return {
19720
+ editor: typeof held === "string" ? held : void 0,
19721
+ visual: process.env["VISUAL"],
19722
+ fallback: process.env["EDITOR"],
19723
+ termProgram: process.env["TERM_PROGRAM"],
19724
+ terminalEmulator: process.env["TERMINAL_EMULATOR"]
19725
+ };
19726
+ });
19498
19727
  copyToClipboard = (text) => {
19499
19728
  const encoded = Buffer.from(text, "utf8").toString("base64");
19500
19729
  process.stdout.write(throughMultiplexer(`\u001B]52;c;${encoded}\u0007`));
@@ -19522,7 +19751,8 @@ var init_app = __esmMin((() => {
19522
19751
  LISTENS = /* @__PURE__ */ new Set([
19523
19752
  "keys",
19524
19753
  "palette",
19525
- "search"
19754
+ "search",
19755
+ "base"
19526
19756
  ]);
19527
19757
  WRITES = /* @__PURE__ */ new Set(["compose", "report"]);
19528
19758
  OVER = /* @__PURE__ */ new Set([
@@ -19531,7 +19761,8 @@ var init_app = __esmMin((() => {
19531
19761
  "keys",
19532
19762
  "palette",
19533
19763
  "search",
19534
- "settings"
19764
+ "settings",
19765
+ "base"
19535
19766
  ]);
19536
19767
  overReview = (screen) => OVER.has(screen);
19537
19768
  writesInto = (screen) => WRITES.has(screen);
@@ -19984,6 +20215,10 @@ var init_app = __esmMin((() => {
19984
20215
  "search.open": () => this.findSelection(),
19985
20216
  "search.jump": () => this.runFinder(),
19986
20217
  "review.reload": () => this.state.screen === "branches" ? this.reloadList() : this.reloadBranch(),
20218
+ "base.open": () => this.openBases(),
20219
+ "base.set": () => this.setBaseHere(),
20220
+ "base.clear": () => this.clearBaseHere(),
20221
+ "line.open": () => this.openInEditor(),
19987
20222
  "report.open": () => sync(() => this.commit(reduce(this.measured(), "report.open"))),
19988
20223
  back: () => this.goBack(),
19989
20224
  "report.send": () => this.sendReport(),
@@ -20072,7 +20307,8 @@ var init_app = __esmMin((() => {
20072
20307
  this.commit({
20073
20308
  ...this.state,
20074
20309
  query: clean,
20075
- paletteIndex: 0
20310
+ paletteIndex: 0,
20311
+ refIndex: 0
20076
20312
  });
20077
20313
  if (this.state.screen === "search") this.lookSoon(clean);
20078
20314
  }
@@ -20085,6 +20321,58 @@ var init_app = __esmMin((() => {
20085
20321
  if (text === this.state.draft) return;
20086
20322
  this.commit(withDraft(this.state, text));
20087
20323
  }
20324
+ openBases() {
20325
+ return gen({ self: this }, function* () {
20326
+ const branch = selectedBranch(this.state);
20327
+ if (branch === void 0) return;
20328
+ const refs = yield* listRefs(this.repo);
20329
+ this.commit(withRefs(this.state, refs.filter((ref) => ref !== branch.branch)));
20330
+ });
20331
+ }
20332
+ basedOnRef(ref) {
20333
+ return gen({ self: this }, function* () {
20334
+ const branch = selectedBranch(this.state);
20335
+ if (branch === void 0) return;
20336
+ const held = yield* result(setBase(this.repo, branch.branch, ref));
20337
+ if (isFailure(held)) {
20338
+ this.commit(withNotice(this.state, `${ref} names nothing here`));
20339
+ return;
20340
+ }
20341
+ yield* this.afterBase(branch.branch, `based on ${ref}`);
20342
+ });
20343
+ }
20344
+ clearBaseHere() {
20345
+ return gen({ self: this }, function* () {
20346
+ const branch = selectedBranch(this.state);
20347
+ if (branch === void 0) return;
20348
+ yield* clearBase(this.repo, branch.branch);
20349
+ yield* this.afterBase(branch.branch, "the base is adiff's guess again");
20350
+ });
20351
+ }
20352
+ afterBase(branch, said) {
20353
+ return gen({ self: this }, function* () {
20354
+ const listed = yield* listBranches(this.repo, this.base);
20355
+ const back = {
20356
+ ...this.state,
20357
+ screen: this.state.returnTo,
20358
+ query: ""
20359
+ };
20360
+ const held = withBranches(back, listed);
20361
+ const at = listed.findIndex((one) => one.branch === branch);
20362
+ this.commit(withNotice(at === -1 ? held : {
20363
+ ...held,
20364
+ branchIndex: at
20365
+ }, said));
20366
+ if (this.state.screen !== "review") return;
20367
+ this.commit(yield* this.readBranch(branch));
20368
+ yield* this.fetchRemarks();
20369
+ yield* this.loadSource();
20370
+ });
20371
+ }
20372
+ setBaseHere() {
20373
+ const ref = refHere(this.state);
20374
+ return ref === void 0 ? void_ : this.basedOnRef(ref);
20375
+ }
20088
20376
  runChoice() {
20089
20377
  return gen({ self: this }, function* () {
20090
20378
  const chosen = paletteChoice(this.state);
@@ -20780,10 +21068,36 @@ var init_app = __esmMin((() => {
20780
21068
  const reading = this.reading;
20781
21069
  return reading === void 0 || reading.worktree.branch !== branch ? listSent(this.repo, branch) : sentIn(reading);
20782
21070
  }
21071
+ whereTheLineIs() {
21072
+ const branch = selectedBranch(this.state);
21073
+ const patch = selectedPatch(this.state);
21074
+ if (branch === void 0 || patch === void 0) return void 0;
21075
+ const held = this.worktreeFor(branch.branch)?.path ?? this.repo;
21076
+ return {
21077
+ file: resolve(held, patch.path),
21078
+ path: patch.path,
21079
+ line: sourceLineAt(this.state, this.state.cursor) ?? 1
21080
+ };
21081
+ }
21082
+ openInEditor() {
21083
+ return gen({ self: this }, function* () {
21084
+ const where = this.whereTheLineIs();
21085
+ if (where === void 0) return;
21086
+ const template = templateFor(yield* editorTold);
21087
+ const opening = template === void 0 ? void 0 : openingOf(template, where.file, where.line);
21088
+ if (opening === void 0) {
21089
+ this.commit(withNoticeHere(this.state, NO_EDITOR));
21090
+ return;
21091
+ }
21092
+ const said = ranAside(opening.command, opening.args) ? `${where.path}:${where.line} in ${opening.command}` : `${opening.command} would not start`;
21093
+ this.commit(withNoticeHere(this.state, said));
21094
+ });
21095
+ }
20783
21096
  showPull() {
20784
21097
  return gen({ self: this }, function* () {
20785
21098
  const branch = selectedBranch(this.state);
20786
21099
  if (branch === void 0) return;
21100
+ if (pullHere(this.state).length === 0) yield* this.loadPulls();
20787
21101
  if (knownToHaveNoPull(this.state)) {
20788
21102
  this.commit(withNoticeHere(this.state, "no pull request for this branch"));
20789
21103
  return;
@@ -21177,7 +21491,7 @@ var init_tui = __esmMin((() => {
21177
21491
  init_app();
21178
21492
  init_command();
21179
21493
  init_match();
21180
- init_model();
21494
+ init_model$1();
21181
21495
  init_render();
21182
21496
  init_reduce();
21183
21497
  init_theme();
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.156",
26
+ "version": "0.1.0-alpha.158",
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": {