@eliya-oss/agent-diff 0.1.0-alpha.157 → 0.1.0-alpha.159

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 +173 -39
  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.159
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(diff): a thread under a line marks the reviewer's own words, and two threads on one line read oldest first with a rule between them.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ The agent's answers carried an arrow and somebody else's remark carried a handle, but the reviewer's
12
+ own comment had no mark at all, so it read as a continuation of the heading above it. Two threads on
13
+ one line ran together with nothing between them, newest drawn first, so a conversation read backwards
14
+ and it was not clear who said which part.
15
+
16
+ </details>
17
+
18
+ ## 0.1.0-alpha.158
19
+
20
+ ### Patch Changes
21
+
22
+ - feat(diff): `e` opens the line under the cursor in your editor, found from the environment or set in the settings file.
23
+
24
+ <details><summary>Why</summary>
25
+
26
+ Reading a diff is where a reviewer decides to change something, and the file and line are already
27
+ under the cursor. `$VISUAL`, then `$EDITOR`, then whatever launched adiff — VS Code, Cursor,
28
+ Windsurf, Zed and JetBrains all say so in the environment — and a known editor gets its own line
29
+ flag, so `code` becomes `code --goto file:line`. Set `editor` in the settings file to override it.
30
+
31
+ </details>
32
+
3
33
  ## 0.1.0-alpha.157
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
@@ -10478,8 +10479,8 @@ var init_review = __esmMin((() => {
10478
10479
  }));
10479
10480
  //#endregion
10480
10481
  //#region src/domain/preferences/model.ts
10481
- var preferences, preferenceNames, preferenceNamed, heldValue, heldValues;
10482
- var init_model$3 = __esmMin((() => {
10482
+ var preferences, preferenceNames, preferenceNamed, asFlag, heldValue, heldValues;
10483
+ var init_model$4 = __esmMin((() => {
10483
10484
  preferences = [
10484
10485
  {
10485
10486
  name: "wrap",
@@ -10532,13 +10533,14 @@ var init_model$3 = __esmMin((() => {
10532
10533
  ];
10533
10534
  preferenceNames = preferences.map((one) => one.name);
10534
10535
  preferenceNamed = (name) => preferences.find((one) => one.name === name);
10535
- 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;
10536
10538
  heldValues = (kept) => Object.fromEntries(preferences.map((one) => [one.name, heldValue(kept, one.name)]));
10537
10539
  }));
10538
10540
  //#endregion
10539
10541
  //#region src/domain/preferences/index.ts
10540
10542
  var init_preferences = __esmMin((() => {
10541
- init_model$3();
10543
+ init_model$4();
10542
10544
  })), UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
10543
10545
  var init_error = __esmMin((() => {
10544
10546
  init_dist();
@@ -10779,6 +10781,7 @@ var init_commands = __esmMin((() => {
10779
10781
  const takenAt = [...ids].flatMap((id) => taken[id] ?? []).toSorted().at(-1);
10780
10782
  return {
10781
10783
  id: comment.id,
10784
+ at: comment.at,
10782
10785
  file: comment.file,
10783
10786
  side: comment.side,
10784
10787
  start: comment.start,
@@ -11219,7 +11222,7 @@ var init_drafts = __esmMin((() => {
11219
11222
  }));
11220
11223
  //#endregion
11221
11224
  //#region src/cli/pane.ts
11222
- var TIMEOUT_MS, set, splitters, named, selfInvocation, ran, split, openPane;
11225
+ var TIMEOUT_MS, set, splitters, named$1, selfInvocation, ran, split, openPane;
11223
11226
  var init_pane = __esmMin((() => {
11224
11227
  init_dist();
11225
11228
  TIMEOUT_MS = 5e3;
@@ -11280,7 +11283,7 @@ var init_pane = __esmMin((() => {
11280
11283
  ]
11281
11284
  }
11282
11285
  ];
11283
- named = (option, value) => value === void 0 ? [] : [`--${option}`, value];
11286
+ named$1 = (option, value) => value === void 0 ? [] : [`--${option}`, value];
11284
11287
  selfInvocation = (repo, branch, base) => {
11285
11288
  const entry = process.argv[1];
11286
11289
  return [
@@ -11293,8 +11296,8 @@ var init_pane = __esmMin((() => {
11293
11296
  "open",
11294
11297
  "--repo",
11295
11298
  repo,
11296
- ...named("branch", branch),
11297
- ...named("base", base)
11299
+ ...named$1("branch", branch),
11300
+ ...named$1("base", base)
11298
11301
  ];
11299
11302
  };
11300
11303
  ran = (binary, args) => callback$1((resume) => {
@@ -11305,7 +11308,7 @@ var init_pane = __esmMin((() => {
11305
11308
  return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch, base)));
11306
11309
  });
11307
11310
  openPane = fn("Cli.openPane")(function* (repo, branch, base) {
11308
- const said = [...named("branch", branch), ...named("base", base)].join(" ");
11311
+ const said = [...named$1("branch", branch), ...named$1("base", base)].join(" ");
11309
11312
  const command = `adiff review open --repo ${repo}${said.length === 0 ? "" : ` ${said}`}`;
11310
11313
  const chosen = splitters.find((candidate) => candidate.present());
11311
11314
  if (chosen === void 0) return {
@@ -11324,7 +11327,7 @@ var init_pane = __esmMin((() => {
11324
11327
  //#region package.json
11325
11328
  init_drafts();
11326
11329
  init_pane();
11327
- var version$1 = "0.1.0-alpha.157";
11330
+ var version$1 = "0.1.0-alpha.159";
11328
11331
  //#endregion
11329
11332
  //#region src/cli/upgrade.ts
11330
11333
  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;
@@ -11494,7 +11497,7 @@ var init_upgrade$1 = __esmMin((() => {
11494
11497
  };
11495
11498
  };
11496
11499
  })), 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;
11497
- var init_model$2 = __esmMin((() => {
11500
+ var init_model$3 = __esmMin((() => {
11498
11501
  DATA_ENDS = [
11499
11502
  ".txt",
11500
11503
  ".csv",
@@ -11658,7 +11661,7 @@ var init_model$2 = __esmMin((() => {
11658
11661
  //#endregion
11659
11662
  //#region src/domain/search/index.ts
11660
11663
  var init_search$1 = __esmMin((() => {
11661
- init_model$2();
11664
+ init_model$3();
11662
11665
  }));
11663
11666
  //#endregion
11664
11667
  //#region src/cli/search.ts
@@ -11725,7 +11728,7 @@ var init_search = __esmMin((() => {
11725
11728
  //#endregion
11726
11729
  //#region src/domain/layers/model.ts
11727
11730
  var REMAINDER_TITLE;
11728
- var init_model$1 = __esmMin((() => {
11731
+ var init_model$2 = __esmMin((() => {
11729
11732
  REMAINDER_TITLE = "not in any layer";
11730
11733
  }));
11731
11734
  //#endregion
@@ -11733,7 +11736,7 @@ var init_model$1 = __esmMin((() => {
11733
11736
  var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, claimsHunk, runsOf, tallyOf, coverage, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
11734
11737
  var init_coverage = __esmMin((() => {
11735
11738
  init_dist();
11736
- init_model$1();
11739
+ init_model$2();
11737
11740
  codeBlockOf$1 = (span) => ({
11738
11741
  kind: "code",
11739
11742
  path: span.path,
@@ -11880,7 +11883,7 @@ var init_version = __esmMin((() => {
11880
11883
  var init_layers$1 = __esmMin((() => {
11881
11884
  init_coverage();
11882
11885
  init_version();
11883
- init_model$1();
11886
+ init_model$2();
11884
11887
  }));
11885
11888
  //#endregion
11886
11889
  //#region src/cli/layers.ts
@@ -13943,7 +13946,7 @@ var init_tree = __esmMin((() => {
13943
13946
  };
13944
13947
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13945
13948
  })), 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;
13946
- var init_model = __esmMin((() => {
13949
+ var init_model$1 = __esmMin((() => {
13947
13950
  init_dist();
13948
13951
  init_patch();
13949
13952
  init_preferences();
@@ -14792,7 +14795,7 @@ var init_model = __esmMin((() => {
14792
14795
  var AROUND_CURSOR, TREE_ROWS, sign, visibleRows, visibleTree, whereabouts, said$1, chosenAway, standingOn, layersLine, remarksLine, shapeLine, tookLine, facts, fenced, fully, minimal, lastFailure, buildReport;
14793
14796
  var init_report = __esmMin((() => {
14794
14797
  init_dist();
14795
- init_model();
14798
+ init_model$1();
14796
14799
  init_preferences();
14797
14800
  AROUND_CURSOR = 8;
14798
14801
  TREE_ROWS = 12;
@@ -14897,6 +14900,56 @@ var init_report = __esmMin((() => {
14897
14900
  };
14898
14901
  }));
14899
14902
  //#endregion
14903
+ //#region src/domain/editor/model.ts
14904
+ var KNOWN, LINED, named, shaped, guessed, templateFor, openingOf;
14905
+ var init_model = __esmMin((() => {
14906
+ KNOWN = [
14907
+ ["vscode", "code --goto {file}:{line}"],
14908
+ ["cursor", "cursor --goto {file}:{line}"],
14909
+ ["windsurf", "windsurf --goto {file}:{line}"],
14910
+ ["zed", "zed {file}:{line}"],
14911
+ ["jetbrains", "idea --line {line} {file}"]
14912
+ ];
14913
+ LINED = [
14914
+ ["code", "{command} --goto {file}:{line}"],
14915
+ ["cursor", "{command} --goto {file}:{line}"],
14916
+ ["zed", "{command} {file}:{line}"],
14917
+ ["idea", "{command} --line {line} {file}"],
14918
+ ["subl", "{command} {file}:{line}"],
14919
+ ["vim", "{command} +{line} {file}"],
14920
+ ["nvim", "{command} +{line} {file}"],
14921
+ ["hx", "{command} {file}:{line}"],
14922
+ ["nano", "{command} +{line} {file}"],
14923
+ ["emacs", "{command} +{line} {file}"]
14924
+ ];
14925
+ named = (said) => said.trim().split(/\s+/)[0]?.split("/").at(-1) ?? "";
14926
+ shaped = (said) => {
14927
+ if (said.includes("{file}")) return said;
14928
+ const known = LINED.find(([name]) => name === named(said));
14929
+ return known === void 0 ? `${said} {file}` : known[1].replace("{command}", said);
14930
+ };
14931
+ guessed = (told) => {
14932
+ const marks = `${told.termProgram ?? ""} ${told.terminalEmulator ?? ""}`.toLowerCase();
14933
+ return KNOWN.find(([mark]) => marks.includes(mark))?.[1];
14934
+ };
14935
+ templateFor = (told) => {
14936
+ const asked = told.editor ?? told.visual ?? told.fallback;
14937
+ return asked === void 0 || asked.trim().length === 0 ? guessed(told) : shaped(asked);
14938
+ };
14939
+ openingOf = (template, file, line) => {
14940
+ const [command, ...args] = template.replaceAll("{file}", file).replaceAll("{line}", String(line)).trim().split(/\s+/);
14941
+ return command === void 0 ? void 0 : {
14942
+ command,
14943
+ args
14944
+ };
14945
+ };
14946
+ }));
14947
+ //#endregion
14948
+ //#region src/domain/editor/index.ts
14949
+ var init_editor = __esmMin((() => {
14950
+ init_model();
14951
+ }));
14952
+ //#endregion
14900
14953
  //#region src/tui/watch.ts
14901
14954
  var OUTBOX, SETTLE_MS, WatchUnavailable, answered, opened, holding, answers;
14902
14955
  var init_watch = __esmMin((() => {
@@ -15329,6 +15382,23 @@ var init_command = __esmMin((() => {
15329
15382
  screens: ["base"],
15330
15383
  listed: false
15331
15384
  }),
15385
+ command({
15386
+ action: "line.open",
15387
+ also: [
15388
+ "editor",
15389
+ "ide",
15390
+ "vscode",
15391
+ "open in",
15392
+ "jump to"
15393
+ ],
15394
+ panes: ["diff"],
15395
+ title: "Open this line in your editor",
15396
+ category: "Reading",
15397
+ keys: ["e"],
15398
+ screens: ["review"],
15399
+ hint: "editor",
15400
+ rank: 5
15401
+ }),
15332
15402
  command({
15333
15403
  action: "review.reload",
15334
15404
  title: "Read the branches again",
@@ -15863,7 +15933,7 @@ var init_reduce = __esmMin((() => {
15863
15933
  init_gaps();
15864
15934
  init_match();
15865
15935
  init_preferences();
15866
- init_model();
15936
+ init_model$1();
15867
15937
  clamp = (value, low, high) => Math.max(low, Math.min(high, value));
15868
15938
  lastRow = (patch) => Math.max(0, (patch?.rows.length ?? 1) - 1);
15869
15939
  rowsIn = (state) => selectedPatch(state)?.rows.length ?? 0;
@@ -16430,6 +16500,7 @@ var init_reduce = __esmMin((() => {
16430
16500
  "base.clear": (state) => state,
16431
16501
  "base.next": (state) => moveRef(state, 1),
16432
16502
  "base.prev": (state) => moveRef(state, -1),
16503
+ "line.open": (state) => state,
16433
16504
  "thread.settle": (state) => state,
16434
16505
  "thread.settleRead": (state) => state,
16435
16506
  "thread.remove": (state) => state,
@@ -16910,12 +16981,12 @@ var init_theme = __esmMin((() => {
16910
16981
  }));
16911
16982
  //#endregion
16912
16983
  //#region src/tui/diffview.ts
16913
- var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, REMARK_MARK$1, remarkHead, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
16984
+ var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, REMARK_MARK$1, remarkHead, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, saidLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, apart, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
16914
16985
  var init_diffview = __esmMin((() => {
16915
16986
  init_dist();
16916
16987
  init_patch();
16917
16988
  init_marks();
16918
- init_model();
16989
+ init_model$1();
16919
16990
  init_theme();
16920
16991
  WASH = {
16921
16992
  added: {
@@ -17504,9 +17575,10 @@ var init_diffview = __esmMin((() => {
17504
17575
  const said = note.body.split("\n").flatMap((line) => wrap(line, room));
17505
17576
  return note.from === void 0 ? said : capped(said, REMARK_LINES);
17506
17577
  };
17578
+ saidLines = (note, room) => note.from === void 0 ? bodyLines(note, room).map((line, at) => at === 0 ? `${REPLY_MARK} ${line}` : ` ${line}`) : bodyLines(note, room);
17507
17579
  noteLines = (note, room) => note.folded ? [`${headOf(note)} · press l`] : [
17508
17580
  headOf(note),
17509
- ...bodyLines(note, room),
17581
+ ...saidLines(note, room),
17510
17582
  ...answerLines(note, room)
17511
17583
  ];
17512
17584
  REMARK_RULE = "┊";
@@ -17541,7 +17613,17 @@ var init_diffview = __esmMin((() => {
17541
17613
  const wanted = plan.prose.filter((entry) => entry.after === after && entry.line === line);
17542
17614
  return fresh !== void 0 ? wanted : wanted.filter(() => !plan.fresh.has(line));
17543
17615
  };
17544
- notesAt = (plan, row) => plan.notes.filter((note) => sideLineOf(row, note.side) === note.line).flatMap((note, at) => noteRows(note, row.index, plan.room, at + 1));
17616
+ apart = (row, stop) => ({
17617
+ text: marks().rule,
17618
+ row,
17619
+ stop,
17620
+ comment: true,
17621
+ sent: false,
17622
+ label: false,
17623
+ gap: false,
17624
+ prose: false
17625
+ });
17626
+ notesAt = (plan, row) => plan.notes.filter((note) => sideLineOf(row, note.side) === note.line).flatMap((note, at) => at === 0 ? noteRows(note, row.index, plan.room, at + 1) : [apart(row.index, at + 1)].concat(noteRows(note, row.index, plan.room, at + 1)));
17545
17627
  TRAILING = /[ \t]+$/;
17546
17628
  shownText = (row) => {
17547
17629
  if (row.kind === "context") return row.text;
@@ -17624,7 +17706,7 @@ var init_render = __esmMin((() => {
17624
17706
  init_diffview();
17625
17707
  init_gaps();
17626
17708
  init_reduce();
17627
- init_model();
17709
+ init_model$1();
17628
17710
  init_marks();
17629
17711
  init_theme();
17630
17712
  ROW_HEIGHT = 1;
@@ -18246,7 +18328,7 @@ var init_render = __esmMin((() => {
18246
18328
  notesOf = (comments, path, sent, shown = {
18247
18329
  opened: [],
18248
18330
  now: Date.now()
18249
- }) => comments.filter((entry) => entry.file === path && entry.outside !== true).map((entry) => ({
18331
+ }) => comments.filter((entry) => entry.file === path && entry.outside !== true).toSorted((left, right) => (left.at ?? "").localeCompare(right.at ?? "")).map((entry) => ({
18250
18332
  id: entry.id ?? "",
18251
18333
  folded: entry.settled === true && !(entry.id !== void 0 && shown.opened.includes(entry.id)),
18252
18334
  side: entry.side,
@@ -19538,11 +19620,12 @@ var init_upgrade = __esmMin((() => {
19538
19620
  }));
19539
19621
  //#endregion
19540
19622
  //#region src/tui/app.ts
19541
- 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;
19623
+ 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;
19542
19624
  var init_app = __esmMin((() => {
19543
19625
  init_dist();
19544
19626
  init_report();
19545
19627
  init_patch();
19628
+ init_editor();
19546
19629
  init_cli();
19547
19630
  init_preferences();
19548
19631
  init_store();
@@ -19550,7 +19633,7 @@ var init_app = __esmMin((() => {
19550
19633
  init_forge();
19551
19634
  init_command();
19552
19635
  init_gaps();
19553
- init_model();
19636
+ init_model$1();
19554
19637
  init_reduce();
19555
19638
  init_display();
19556
19639
  init_intent();
@@ -19562,6 +19645,7 @@ var init_app = __esmMin((() => {
19562
19645
  AGE_TICK_MS = 3e4;
19563
19646
  LEAVING_SAID = "press ctrl+c again to leave";
19564
19647
  NOTHING_WRITTEN = "nothing written yet";
19648
+ NO_EDITOR = "no editor to open it in: set $VISUAL, or editor in the settings file";
19565
19649
  WORTH_TIMING_MS = 250;
19566
19650
  TIMES_KEPT = 40;
19567
19651
  SLOWEST_KEPT = 3;
@@ -19629,6 +19713,29 @@ var init_app = __esmMin((() => {
19629
19713
  if (process.env["TMUX"] !== void 0) return `\u001BPtmux;\u001B${sequence}\u001B\\`;
19630
19714
  return process.env["STY"] === void 0 ? sequence : `\u001BP${sequence}\u001B\\`;
19631
19715
  };
19716
+ ranAside = (command, args) => {
19717
+ try {
19718
+ const child = spawn(command, [...args], {
19719
+ detached: true,
19720
+ stdio: "ignore"
19721
+ });
19722
+ child.on("error", () => void 0);
19723
+ child.unref();
19724
+ return true;
19725
+ } catch {
19726
+ return false;
19727
+ }
19728
+ };
19729
+ editorTold = gen(function* () {
19730
+ const held = (yield* (yield* Store).settings)["editor"];
19731
+ return {
19732
+ editor: typeof held === "string" ? held : void 0,
19733
+ visual: process.env["VISUAL"],
19734
+ fallback: process.env["EDITOR"],
19735
+ termProgram: process.env["TERM_PROGRAM"],
19736
+ terminalEmulator: process.env["TERMINAL_EMULATOR"]
19737
+ };
19738
+ });
19632
19739
  copyToClipboard = (text) => {
19633
19740
  const encoded = Buffer.from(text, "utf8").toString("base64");
19634
19741
  process.stdout.write(throughMultiplexer(`\u001B]52;c;${encoded}\u0007`));
@@ -20123,6 +20230,7 @@ var init_app = __esmMin((() => {
20123
20230
  "base.open": () => this.openBases(),
20124
20231
  "base.set": () => this.setBaseHere(),
20125
20232
  "base.clear": () => this.clearBaseHere(),
20233
+ "line.open": () => this.openInEditor(),
20126
20234
  "report.open": () => sync(() => this.commit(reduce(this.measured(), "report.open"))),
20127
20235
  back: () => this.goBack(),
20128
20236
  "report.send": () => this.sendReport(),
@@ -20972,10 +21080,36 @@ var init_app = __esmMin((() => {
20972
21080
  const reading = this.reading;
20973
21081
  return reading === void 0 || reading.worktree.branch !== branch ? listSent(this.repo, branch) : sentIn(reading);
20974
21082
  }
21083
+ whereTheLineIs() {
21084
+ const branch = selectedBranch(this.state);
21085
+ const patch = selectedPatch(this.state);
21086
+ if (branch === void 0 || patch === void 0) return void 0;
21087
+ const held = this.worktreeFor(branch.branch)?.path ?? this.repo;
21088
+ return {
21089
+ file: resolve(held, patch.path),
21090
+ path: patch.path,
21091
+ line: sourceLineAt(this.state, this.state.cursor) ?? 1
21092
+ };
21093
+ }
21094
+ openInEditor() {
21095
+ return gen({ self: this }, function* () {
21096
+ const where = this.whereTheLineIs();
21097
+ if (where === void 0) return;
21098
+ const template = templateFor(yield* editorTold);
21099
+ const opening = template === void 0 ? void 0 : openingOf(template, where.file, where.line);
21100
+ if (opening === void 0) {
21101
+ this.commit(withNoticeHere(this.state, NO_EDITOR));
21102
+ return;
21103
+ }
21104
+ const said = ranAside(opening.command, opening.args) ? `${where.path}:${where.line} in ${opening.command}` : `${opening.command} would not start`;
21105
+ this.commit(withNoticeHere(this.state, said));
21106
+ });
21107
+ }
20975
21108
  showPull() {
20976
21109
  return gen({ self: this }, function* () {
20977
21110
  const branch = selectedBranch(this.state);
20978
21111
  if (branch === void 0) return;
21112
+ if (pullHere(this.state).length === 0) yield* this.loadPulls();
20979
21113
  if (knownToHaveNoPull(this.state)) {
20980
21114
  this.commit(withNoticeHere(this.state, "no pull request for this branch"));
20981
21115
  return;
@@ -21369,7 +21503,7 @@ var init_tui = __esmMin((() => {
21369
21503
  init_app();
21370
21504
  init_command();
21371
21505
  init_match();
21372
- init_model();
21506
+ init_model$1();
21373
21507
  init_render();
21374
21508
  init_reduce();
21375
21509
  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.157",
26
+ "version": "0.1.0-alpha.159",
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": {