@eliya-oss/agent-diff 0.1.0-alpha.104 → 0.1.0-alpha.106

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,27 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.106
4
+
5
+ ### Minor Changes
6
+
7
+ - A layer in the rail is a card: its title, what it says, and the files it covers, each ticked off as it is reviewed, with a count of how many are done. `]` and `[` walk that reading order from one layer into the next, and switching to the file tree survives a reload.
8
+
9
+ ### Patch Changes
10
+
11
+ - Layers read as chapters. The rail no longer repeats each layer's note word for word — the diff already shows it above the code it describes — and prints the reading order instead: a numbered title, the directories the layer touches, and the file names under them, with a tick against the ones you have read. It expands as many layers as fit rather than collapsing all but one, marks the current file in the accent colour, and says how many layers sit above and below.
12
+
13
+ - Making the terminal smaller no longer blanks the review for good. Every panel kept its old width, the draw underneath failed, and nothing was drawn again until adiff was restarted. Mark-and-go-to-next also stopped un-marking a file that was already reviewed.
14
+
15
+ - `layers set` says which layer it would not take and why, instead of one sentence for five different mistakes. Spans that end before they start, or start before line one, are refused rather than dropped in silence; a layer given both spans and blocks keeps both; `./src/one.ts` is the same path as `src/one.ts`; and `layers show` reports covered, partial and vanished for each layer, not only for the document as a whole.
16
+
17
+ - Walking a layered review reaches the end of it. Two layers naming the same file used to send `]` and `[` back to the first layer that claimed it, leaving the tail of the review unreachable, and the header counted a file once per layer that mentioned it.
18
+
19
+ ## 0.1.0-alpha.105
20
+
21
+ ### Patch Changes
22
+
23
+ - Looking for something no longer re-reads the whole branch on every search, and finds a name however it was capitalised.
24
+
3
25
  ## 0.1.0-alpha.104
4
26
 
5
27
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8600,6 +8600,7 @@ var init_service$2 = __esmMin((() => {
8600
8600
  "-n",
8601
8601
  "-I",
8602
8602
  "-F",
8603
+ "-i",
8603
8604
  "-w",
8604
8605
  "-C",
8605
8606
  String(GREP_CONTEXT),
@@ -9926,7 +9927,7 @@ var init_pane = __esmMin((() => {
9926
9927
  init_commands();
9927
9928
  init_init();
9928
9929
  init_pane();
9929
- var version$1 = "0.1.0-alpha.104";
9930
+ var version$1 = "0.1.0-alpha.106";
9930
9931
  //#endregion
9931
9932
  //#region src/cli/upgrade.ts
9932
9933
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -10122,7 +10123,7 @@ var init_upgrade$1 = __esmMin((() => {
10122
10123
  }));
10123
10124
  //#endregion
10124
10125
  //#region src/cli/search.ts
10125
- var HIT, NEAR$1, rowOf, readRows, near, byChangedFirst, searchBranch;
10126
+ var HIT, NEAR$1, rowOf, readRows, near, byChangedFirst, searchIn, searchBranch;
10126
10127
  var init_search = __esmMin((() => {
10127
10128
  init_dist();
10128
10129
  init_git();
@@ -10158,11 +10159,10 @@ var init_search = __esmMin((() => {
10158
10159
  if (left.changed !== right.changed) return left.changed ? -1 : 1;
10159
10160
  return left.path === right.path ? left.line - right.line : left.path.localeCompare(right.path);
10160
10161
  };
10161
- searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term) {
10162
+ searchIn = fn("Cli.searchIn")(function* (reading, term) {
10162
10163
  const git = yield* Git;
10163
- const worktree = yield* findBranch(repo, branch);
10164
- const patches = yield* listPatches(repo, branch);
10165
- const touched = new Set(patches.map((patch) => patch.path));
10164
+ const worktree = reading.worktree;
10165
+ const touched = new Set(reading.patches.map((patch) => patch.path));
10166
10166
  const rows = readRows(yield* git.grep(worktree, term));
10167
10167
  const found = [];
10168
10168
  for (const [at, row] of rows.entries()) {
@@ -10177,6 +10177,9 @@ var init_search = __esmMin((() => {
10177
10177
  }
10178
10178
  return found.toSorted(byChangedFirst);
10179
10179
  });
10180
+ searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term) {
10181
+ return yield* searchIn(yield* readingOf(repo, branch), term);
10182
+ });
10180
10183
  }));
10181
10184
  //#endregion
10182
10185
  //#region src/domain/layers/model.ts
@@ -10186,7 +10189,7 @@ var init_model$1 = __esmMin((() => {
10186
10189
  }));
10187
10190
  //#endregion
10188
10191
  //#region src/domain/layers/coverage.ts
10189
- var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, runsOf, tallyOf, coverage, withFullCoverage, proseAnchors;
10192
+ var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, runsOf, tallyOf, coverage, missingSaid, withFullCoverage, proseAnchors;
10190
10193
  var init_coverage = __esmMin((() => {
10191
10194
  init_dist();
10192
10195
  init_model$1();
@@ -10242,6 +10245,7 @@ var init_coverage = __esmMin((() => {
10242
10245
  missing: tallies.flatMap((tally) => tally.missing)
10243
10246
  };
10244
10247
  };
10248
+ missingSaid = (count) => count === 1 ? "One run of changed lines the layers do not account for." : `${count} runs of changed lines the layers do not account for.`;
10245
10249
  withFullCoverage = (patches, layers) => {
10246
10250
  const gap = coverage(patches, layers.layers);
10247
10251
  if (gap.missing.length === 0) return layers;
@@ -10249,7 +10253,7 @@ var init_coverage = __esmMin((() => {
10249
10253
  title: REMAINDER_TITLE,
10250
10254
  blocks: [{
10251
10255
  kind: "prose",
10252
- markdown: `${gap.missing.length} runs of changed lines the agent did not account for.`
10256
+ markdown: missingSaid(gap.missing.length)
10253
10257
  }, ...gap.missing.map((span) => codeBlockOf$1(span))]
10254
10258
  };
10255
10259
  return {
@@ -10314,7 +10318,7 @@ var init_layers$1 = __esmMin((() => {
10314
10318
  init_coverage();
10315
10319
  init_version();
10316
10320
  init_model$1();
10317
- })), STALE_ADVICE, unique, spansOfLayer, isSpan, isBlock, codeBlockOf, blocksOf, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, resolve$1, resolveAll, worktreeAt, storedLayers, setLayers, showLayers, layersIn;
10321
+ })), STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, resolve$1, resolveAll, worktreeAt, storedLayers, setLayers, showLayers, layersIn;
10318
10322
  var init_layers = __esmMin((() => {
10319
10323
  init_dist();
10320
10324
  init_layers$1();
@@ -10329,38 +10333,61 @@ var init_layers = __esmMin((() => {
10329
10333
  start,
10330
10334
  end
10331
10335
  }));
10332
- isSpan = (value) => {
10336
+ tidyPath = (path) => path.replace(/^\.\/+/, "").replace(/^\/+/, "");
10337
+ spanFault = (value) => {
10333
10338
  const span = value;
10334
- return typeof span?.path === "string" && typeof span.start === "number" && typeof span.end === "number";
10335
- };
10336
- isBlock = (value) => {
10339
+ if (typeof span?.path !== "string" || span.path.trim().length === 0) return "a span needs a path";
10340
+ if (!Number.isInteger(span.start) || !Number.isInteger(span.end)) return `the span on ${span.path} needs whole numbers for start and end`;
10341
+ const start = span.start;
10342
+ const end = span.end;
10343
+ if (start < 1) return `the span on ${span.path} starts at ${start}, and lines count from 1`;
10344
+ if (end < start) return `the span on ${span.path} ends at ${end}, before it starts at ${start}`;
10345
+ };
10346
+ blockFault = (value) => {
10337
10347
  const block = value;
10338
- if (block?.kind === "prose") return typeof block.markdown === "string";
10339
- return block?.kind === "code" && isSpan(value);
10348
+ if (block?.kind === "prose") return typeof block.markdown === "string" ? void 0 : "a prose block needs markdown";
10349
+ if (block?.kind !== "code") return `a block needs a kind of prose or code, not ${String(block?.kind)}`;
10350
+ return spanFault(value);
10340
10351
  };
10341
10352
  codeBlockOf = (span) => ({
10342
10353
  kind: "code",
10343
- path: span.path,
10354
+ path: tidyPath(span.path),
10344
10355
  start: span.start,
10345
10356
  end: span.end
10346
10357
  });
10358
+ tidyBlock = (block) => block.kind === "code" ? {
10359
+ ...block,
10360
+ path: tidyPath(block.path)
10361
+ } : block;
10347
10362
  blocksOf = (layer) => {
10348
- if (Array.isArray(layer.blocks)) return layer.blocks.filter(isBlock);
10349
- const note = typeof layer.note === "string" ? [{
10363
+ const note = typeof layer.note === "string" && layer.note.trim().length > 0 ? [{
10350
10364
  kind: "prose",
10351
10365
  markdown: layer.note
10352
10366
  }] : [];
10353
- const spans = Array.isArray(layer.spans) ? layer.spans.filter(isSpan) : [];
10354
- return [...note, ...spans.map(codeBlockOf)];
10355
- };
10356
- layerOf = (value) => {
10357
- const layer = value;
10358
- const title = typeof layer?.title === "string" ? layer.title.trim() : "";
10359
- if (layer === void 0 || title.length === 0) return none();
10360
- const blocks = blocksOf(layer);
10361
- return blocks.length === 0 ? none() : some({
10362
- title,
10363
- blocks
10367
+ const given = Array.isArray(layer.blocks) ? layer.blocks.map(tidyBlock) : [];
10368
+ const spans = Array.isArray(layer.spans) ? layer.spans : [];
10369
+ return [
10370
+ ...note,
10371
+ ...given,
10372
+ ...spans.map(codeBlockOf)
10373
+ ];
10374
+ };
10375
+ layerFault = (layer, at) => {
10376
+ const named = `layer ${at + 1}`;
10377
+ if (typeof layer.title !== "string" || layer.title.trim().length === 0) return `${named} needs a title`;
10378
+ const said = `${named}, "${layer.title.trim()}",`;
10379
+ const blocks = Array.isArray(layer.blocks) ? layer.blocks : [];
10380
+ const spans = Array.isArray(layer.spans) ? layer.spans : [];
10381
+ const fault = [...blocks.map(blockFault), ...spans.map(spanFault)].find((one) => one !== void 0);
10382
+ if (fault !== void 0) return `${said} ${fault}`;
10383
+ if (blocks.length === 0 && spans.length === 0) return `${said} needs at least one span or block`;
10384
+ };
10385
+ layerOf = (value, at) => {
10386
+ const layer = value ?? {};
10387
+ if (layerFault(layer, at) !== void 0) return none();
10388
+ return some({
10389
+ title: String(layer.title).trim(),
10390
+ blocks: blocksOf(layer)
10364
10391
  });
10365
10392
  };
10366
10393
  parsed = (text) => {
@@ -10377,11 +10404,13 @@ var init_layers = __esmMin((() => {
10377
10404
  onSome: succeed$1
10378
10405
  });
10379
10406
  const raw = document["layers"];
10380
- const layers = (Array.isArray(raw) ? raw : []).flatMap((entry) => match$3(layerOf(entry), {
10407
+ if (!Array.isArray(raw) || raw.length === 0) return yield* new MalformedLayers({ reason: "the document needs a layers array" });
10408
+ const fault = raw.map((entry, at) => layerFault(entry ?? {}, at)).find((said) => said !== void 0);
10409
+ if (fault !== void 0) return yield* new MalformedLayers({ reason: fault });
10410
+ const layers = raw.flatMap((entry, at) => match$3(layerOf(entry, at), {
10381
10411
  onNone: () => [],
10382
10412
  onSome: (layer) => [layer]
10383
10413
  }));
10384
- if (layers.length === 0) return yield* new MalformedLayers({ reason: "every layer needs a title and at least one span or block" });
10385
10414
  const summary = document["summary"];
10386
10415
  return {
10387
10416
  summary: typeof summary === "string" ? summary : "",
@@ -10398,13 +10427,20 @@ var init_layers = __esmMin((() => {
10398
10427
  });
10399
10428
  reportedLayers = (patches, layers) => {
10400
10429
  const present = new Set(patches.map((patch) => patch.path));
10401
- return withFullCoverage(patches, layers).layers.map((layer) => ({
10402
- title: layer.title,
10403
- note: noteOf(layer),
10404
- files: unique(spansOfLayer(layer).map((span) => span.path)).filter((path) => present.has(path)),
10405
- spans: spansOfLayer(layer),
10406
- prose: proseAnchors(layer).filter((anchor) => present.has(anchor.path))
10407
- }));
10430
+ return withFullCoverage(patches, layers).layers.map((layer) => {
10431
+ const named = unique(spansOfLayer(layer).map((span) => span.path));
10432
+ const gap = coverage(patches, [layer]);
10433
+ return {
10434
+ title: layer.title,
10435
+ note: noteOf(layer),
10436
+ files: named.filter((path) => present.has(path)),
10437
+ spans: spansOfLayer(layer),
10438
+ prose: proseAnchors(layer).filter((anchor) => present.has(anchor.path)),
10439
+ covered: gap.covered,
10440
+ partial: gap.partial,
10441
+ vanished: named.filter((path) => !present.has(path))
10442
+ };
10443
+ });
10408
10444
  };
10409
10445
  reportOf = (patches, layers, branchHead) => {
10410
10446
  const status = statusOf(patches, layers, branchHead);
@@ -11767,7 +11803,7 @@ var init_tree = __esmMin((() => {
11767
11803
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11768
11804
  };
11769
11805
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
11770
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, NO_NOTE, noteRows$1, proseRow, proseRows$1, titleRows, clipEnd, FILE_LEAD, fileRows, layerRows, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, pickedText, selectedLines, shownMatches, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, spokeLast, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, layerFile, selectionRange;
11806
+ })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip$1, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, layerBody, layerRows, nearFirst, layerFitted, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, kept, treeOf, reviewedCountIn, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, caretRow, caretColumn, caretOn, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, pickedText, selectedLines, shownMatches, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, answersIn, newerOf, spokeLast, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
11771
11807
  var init_model = __esmMin((() => {
11772
11808
  init_dist();
11773
11809
  init_patch();
@@ -11837,6 +11873,7 @@ var init_model = __esmMin((() => {
11837
11873
  });
11838
11874
  TREE_MAX = 34;
11839
11875
  TREE_ROOMY = 40;
11876
+ TREE_WIDE = 52;
11840
11877
  TREE_MIN = 18;
11841
11878
  TREE_SHARE = .3;
11842
11879
  DIFF_MIN = 26;
@@ -11844,8 +11881,8 @@ var init_model = __esmMin((() => {
11844
11881
  bodyRoom = (columns) => Math.max(0, columns - 2);
11845
11882
  treeWidth = (columns) => {
11846
11883
  const room = bodyRoom(columns);
11847
- const most = room - reviewWidth() - DIFF_ROOMY >= TREE_ROOMY ? TREE_ROOMY : TREE_MAX;
11848
- const wanted = Math.min(most, Math.max(TREE_MIN, Math.floor(room * TREE_SHARE)));
11884
+ const spare = room - reviewWidth() - DIFF_ROOMY;
11885
+ const wanted = Math.min(spare >= TREE_WIDE ? TREE_WIDE : spare >= TREE_ROOMY ? TREE_ROOMY : TREE_MAX, Math.max(TREE_MIN, Math.floor(room * TREE_SHARE)));
11849
11886
  return Math.max(0, Math.min(wanted, room - DIFF_MIN));
11850
11887
  };
11851
11888
  reviewWidth = () => 36;
@@ -11888,73 +11925,123 @@ var init_model = __esmMin((() => {
11888
11925
  const width = Math.max(1, room);
11889
11926
  return text.split(/\s+/).filter((word) => word.length > 0).flatMap((word) => chunked(word, width)).reduce((lines, word) => packed(lines, word, width), []);
11890
11927
  };
11891
- NO_NOTE = "no note";
11892
- noteRows$1 = (state, layerIndex, room) => {
11893
- const lines = wrapped(state.layers[layerIndex]?.note ?? "", room);
11894
- return (lines.length === 0 ? [NO_NOTE] : lines).map((text) => ({
11928
+ clip$1 = (label, room) => label.length > room ? `${label.slice(0, Math.max(0, room - 1))}…` : label;
11929
+ TITLE_ROWS = 2;
11930
+ titleRows = (state, layerIndex, room) => {
11931
+ const lines = wordWrapped(state.layers[layerIndex]?.title ?? "", room);
11932
+ const kept = lines.slice(0, TITLE_ROWS);
11933
+ const last = kept.at(-1) ?? "";
11934
+ return (lines.length > TITLE_ROWS ? [...kept.slice(0, -1), clip$1(`${last} …`, room)] : kept).map((text, at) => ({
11895
11935
  index: layerIndex,
11896
- kind: "note",
11936
+ kind: "title",
11897
11937
  text,
11898
- lead: false
11938
+ lead: at === 0
11899
11939
  }));
11900
11940
  };
11901
- proseRow = (layerIndex, text) => ({
11902
- index: layerIndex,
11903
- kind: "note",
11904
- text,
11905
- lead: false
11906
- });
11907
- proseRows$1 = (state, layerIndex, room) => {
11908
- const blocks = state.layers[layerIndex]?.prose ?? [];
11941
+ shortDir = (dir, room) => {
11942
+ const whole = `${dir}/`;
11943
+ if (whole.length <= room) return whole;
11944
+ const parts = dir.split("/");
11945
+ if (parts.length < 3) return `${clip$1(dir, Math.max(1, room - 1))}/`;
11946
+ return `${parts[0] ?? ""}/…/${parts.at(-1) ?? ""}/`;
11947
+ };
11948
+ fileRow$1 = (state, layerIndex, at, room) => {
11949
+ const path = state.patches[at]?.path ?? "";
11950
+ const name = path.split("/").at(-1) ?? path;
11951
+ return {
11952
+ index: layerIndex,
11953
+ kind: "file",
11954
+ text: clip$1(name, room),
11955
+ lead: false,
11956
+ fileIndex: at,
11957
+ reviewed: isReviewed(state, at),
11958
+ here: at === state.patchIndex
11959
+ };
11960
+ };
11961
+ shownFiles = (state, layerIndex) => layerFiles(state, layerIndex).filter((at) => !(state.hideReviewed && isReviewed(state, at) && at !== state.patchIndex));
11962
+ dirOf = (state, at) => {
11963
+ return (state.patches[at]?.path ?? "").split("/").slice(0, -1).join("/");
11964
+ };
11965
+ fileRows = (state, layerIndex, room) => {
11909
11966
  const rows = [];
11910
- for (const [at, block] of blocks.entries()) {
11911
- if (at > 0) rows.push(proseRow(layerIndex, ""));
11912
- for (const text of wrapped(block.markdown, room)) rows.push(proseRow(layerIndex, text));
11913
- rows.push({
11967
+ let held;
11968
+ for (const at of shownFiles(state, layerIndex)) {
11969
+ const dir = dirOf(state, at);
11970
+ if (dir !== held && dir.length > 0) rows.push({
11914
11971
  index: layerIndex,
11915
- kind: "file",
11916
- text: clipEnd(block.path, Math.max(1, room - FILE_LEAD)),
11972
+ kind: "dir",
11973
+ text: shortDir(dir, room.dir),
11917
11974
  lead: false
11918
11975
  });
11976
+ held = dir;
11977
+ rows.push(fileRow$1(state, layerIndex, at, room.file));
11919
11978
  }
11920
11979
  return rows;
11921
11980
  };
11922
- titleRows = (state, layerIndex, room) => wordWrapped(state.layers[layerIndex]?.title ?? "", room).map((text, at) => ({
11923
- index: layerIndex,
11924
- kind: "title",
11925
- text,
11926
- lead: at === 0
11927
- }));
11928
- clipEnd = (text, room) => {
11929
- if (text.length <= room) return text;
11930
- const parts = text.split("/");
11931
- const kept = [];
11932
- for (const part of parts.toReversed()) {
11933
- if ([part, ...kept].join("/").length + 2 > room) break;
11934
- kept.unshift(part);
11935
- }
11936
- return `…/${kept.length === 0 ? parts.at(-1) ?? text : kept.join("/")}`;
11937
- };
11938
- FILE_LEAD = 2;
11939
- fileRows = (state, layerIndex, room) => (state.layers[layerIndex]?.files ?? []).map((path) => ({
11940
- index: layerIndex,
11941
- kind: "file",
11942
- text: clipEnd(path, Math.max(1, room - FILE_LEAD)),
11943
- lead: false
11944
- }));
11945
- layerRows = (state, titleRoom, noteRoom) => state.layers.flatMap((_, index) => layerOpen(state, index) ? [...titleRows(state, index, titleRoom), ...(state.layers[index]?.prose ?? []).length > 0 ? proseRows$1(state, index, noteRoom) : [...noteRows$1(state, index, noteRoom), ...fileRows(state, index, noteRoom)]] : titleRows(state, index, titleRoom));
11981
+ layerRead = (state, layerIndex) => {
11982
+ const files = layerFiles(state, layerIndex);
11983
+ return {
11984
+ done: files.filter((at) => isReviewed(state, at)).length,
11985
+ all: files.length
11986
+ };
11987
+ };
11988
+ layerDone = (state, layerIndex) => {
11989
+ const read = layerRead(state, layerIndex);
11990
+ return read.all > 0 && read.done === read.all;
11991
+ };
11992
+ countRow = (state, index, room) => {
11993
+ const read = layerRead(state, index);
11994
+ if (read.all === 0) return [];
11995
+ const one = read.all === 1 ? "file" : "files";
11996
+ const said = `${read.done} of ${read.all} ${one} read`;
11997
+ return [{
11998
+ index,
11999
+ kind: "count",
12000
+ text: clip$1(said, room),
12001
+ lead: false
12002
+ }];
12003
+ };
12004
+ layerBody = (state, index, room, shown) => layerOpen(state, index) && shown.has(index) ? fileRows(state, index, room) : countRow(state, index, room.file);
12005
+ layerRows = (state, room, shown) => state.layers.flatMap((_, index) => [
12006
+ ...index > 0 ? [{
12007
+ index,
12008
+ kind: "gap",
12009
+ text: "",
12010
+ lead: false
12011
+ }] : [],
12012
+ ...titleRows(state, index, room.title),
12013
+ ...layerBody(state, index, room, shown)
12014
+ ]);
12015
+ nearFirst = (state) => state.layers.map((_, at) => at).filter((at) => layerOpen(state, at)).toSorted((one, two) => Math.abs(one - state.layerIndex) - Math.abs(two - state.layerIndex));
12016
+ layerFitted = (state, room, height) => {
12017
+ const every = new Set(state.layers.map((_, at) => at));
12018
+ const whole = layerRows(state, room, every);
12019
+ if (whole.length <= height) return whole;
12020
+ const shown = /* @__PURE__ */ new Set([state.layerIndex]);
12021
+ for (const at of nearFirst(state)) {
12022
+ shown.add(at);
12023
+ if (layerRows(state, room, shown).length > height) shown.delete(at);
12024
+ }
12025
+ shown.add(state.layerIndex);
12026
+ return layerRows(state, room, shown);
12027
+ };
11946
12028
  railWindow = (rows, height, layerIndex) => {
11947
12029
  if (rows.length <= height) return {
11948
12030
  rows,
11949
- more: 0
12031
+ more: 0,
12032
+ above: 0
11950
12033
  };
11951
12034
  const first = Math.max(0, rows.findIndex((row) => row.index === layerIndex));
11952
12035
  const block = rows.findLastIndex((row) => row.index === layerIndex) - first + 1;
11953
12036
  const wanted = block >= height ? first : first - Math.floor((height - block) / 2);
11954
12037
  const start = Math.max(0, Math.min(rows.length - height, wanted));
12038
+ const shown = rows.slice(start, start + height);
12039
+ const here = new Set(shown.map((row) => row.index));
12040
+ const seen = (from) => new Set(from.filter((row) => !here.has(row.index)).map((row) => row.index)).size;
11955
12041
  return {
11956
- rows: rows.slice(start, start + height),
11957
- more: rows.length - (start + height)
12042
+ rows: shown,
12043
+ more: seen(rows.slice(start + height)),
12044
+ above: seen(rows.slice(0, start))
11958
12045
  };
11959
12046
  };
11960
12047
  selectedBranch = (state) => state.branches[state.branchIndex];
@@ -12255,9 +12342,9 @@ var init_model = __esmMin((() => {
12255
12342
  return [...order.slice(start + 1), ...order.slice(0, start + 1)].find((index) => !isReviewed(state, index));
12256
12343
  };
12257
12344
  reviewedCount = (state) => `${state.vouched.length}/${state.patches.length} reviewed`;
12258
- fileOrder = (state) => onLayers(state) ? layerFiles(state, state.layerIndex) : flattenTree(treeOf(state), []).flatMap((row) => row.fileIndex === void 0 ? [] : [row.fileIndex]);
12345
+ fileOrder = (state) => onLayers(state) ? state.layers.flatMap((_, at) => layerFiles(state, at)) : flattenTree(treeOf(state), []).flatMap((row) => row.fileIndex === void 0 ? [] : [row.fileIndex]);
12259
12346
  filePlace = (state) => {
12260
- const order = fileOrder(state);
12347
+ const order = [...new Set(fileOrder(state))];
12261
12348
  const at = order.indexOf(state.patchIndex);
12262
12349
  if (at === -1) return {
12263
12350
  at: state.patchIndex + 1,
@@ -12268,11 +12355,29 @@ var init_model = __esmMin((() => {
12268
12355
  of: order.length
12269
12356
  };
12270
12357
  };
12358
+ readingOrder = (state) => onLayers(state) ? state.layers.flatMap((_, layer) => layerFiles(state, layer).map((file) => ({
12359
+ layer,
12360
+ file
12361
+ }))) : fileOrder(state).map((file) => ({
12362
+ layer: state.layerIndex,
12363
+ file
12364
+ }));
12365
+ placeIn = (state) => {
12366
+ const order = readingOrder(state);
12367
+ const at = order.findIndex((one) => one.file === state.patchIndex && (!onLayers(state) || one.layer === state.layerIndex));
12368
+ return at === -1 ? order.findIndex((one) => one.file === state.patchIndex) : at;
12369
+ };
12271
12370
  layerFile = (state, delta) => {
12272
- const order = fileOrder(state);
12273
- const position = order.indexOf(state.patchIndex);
12274
- if (position === -1) return order[0] ?? state.patchIndex;
12275
- return order[Math.max(0, Math.min(order.length - 1, position + delta))] ?? state.patchIndex;
12371
+ const order = readingOrder(state);
12372
+ const at = placeIn(state);
12373
+ if (at === -1) return order[0]?.file ?? state.patchIndex;
12374
+ return order[Math.max(0, Math.min(order.length - 1, at + delta))]?.file ?? state.patchIndex;
12375
+ };
12376
+ layerAfter = (state, delta) => {
12377
+ const order = readingOrder(state);
12378
+ const at = placeIn(state);
12379
+ if (at === -1) return order[0]?.layer ?? state.layerIndex;
12380
+ return order[Math.max(0, Math.min(order.length - 1, at + delta))]?.layer ?? state.layerIndex;
12276
12381
  };
12277
12382
  selectionRange = (state) => state.anchorRow <= state.cursor ? [state.anchorRow, state.cursor] : [state.cursor, state.anchorRow];
12278
12383
  }));
@@ -13009,7 +13114,7 @@ var init_match = __esmMin((() => {
13009
13114
  }));
13010
13115
  //#endregion
13011
13116
  //#region src/tui/reduce.ts
13012
- 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, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, 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, withNoticeHere, withNotice;
13117
+ 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, PANES, panesShown, focusStepped, togglePanel, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, 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, withNoticeHere, withNotice;
13013
13118
  var init_reduce = __esmMin((() => {
13014
13119
  init_dist();
13015
13120
  init_patch();
@@ -13149,17 +13254,18 @@ var init_reduce = __esmMin((() => {
13149
13254
  };
13150
13255
  };
13151
13256
  moveLayer = (state, delta) => {
13152
- const layerIndex = clamp(state.layerIndex + delta, 0, Math.max(0, state.layers.length - 1));
13153
- const landed = {
13154
- ...state,
13155
- layerIndex
13156
- };
13157
- const patchIndex = layerFiles(landed, layerIndex)[0] ?? landed.patchIndex;
13257
+ const order = readingOrder(state);
13258
+ if (order.length === 0) return state;
13259
+ const at = placeIn(state);
13260
+ const landed = order[clamp((at === -1 ? 0 : at) + delta, 0, order.length - 1)];
13261
+ if (landed === void 0) return state;
13158
13262
  return {
13159
- ...landed,
13160
- patchIndex,
13263
+ ...state,
13264
+ layerIndex: landed.layer,
13265
+ openLayers: state.openLayers.includes(landed.layer) ? state.openLayers : [...state.openLayers, landed.layer],
13266
+ patchIndex: landed.file,
13161
13267
  top: 0,
13162
- cursor: 0,
13268
+ cursor: landingOn(state, landed.file),
13163
13269
  anchorRow: 0,
13164
13270
  selecting: false
13165
13271
  };
@@ -13283,12 +13389,20 @@ var init_reduce = __esmMin((() => {
13283
13389
  }, patchIndex);
13284
13390
  return state.closed.filter((path) => !wanted.includes(path));
13285
13391
  };
13392
+ atTheEnd = (state, delta) => {
13393
+ const at = placeIn(state);
13394
+ const wanted = at + delta;
13395
+ return at !== -1 && (wanted < 0 || wanted >= readingOrder(state).length);
13396
+ };
13286
13397
  moveFile = (state, delta) => {
13398
+ if (atTheEnd(state, delta)) return withNoticeHere(state, delta > 0 ? "last file" : "first file");
13287
13399
  const next = layerFile(state, delta);
13288
- if (next === state.patchIndex) return withNoticeHere(state, delta > 0 ? "last file" : "first file");
13400
+ const layer = onLayers(state) ? layerAfter(state, delta) : state.layerIndex;
13289
13401
  return {
13290
13402
  ...state,
13291
13403
  notice: "",
13404
+ layerIndex: layer,
13405
+ openLayers: state.openLayers.includes(layer) ? state.openLayers : [...state.openLayers, layer],
13292
13406
  closed: revealing(state, next),
13293
13407
  patchIndex: next,
13294
13408
  top: 0,
@@ -13601,18 +13715,20 @@ var init_reduce = __esmMin((() => {
13601
13715
  ...state,
13602
13716
  columns
13603
13717
  });
13718
+ laidOver = (state, told, anew) => ({
13719
+ ...state,
13720
+ layers: told.layers,
13721
+ layersStale: told.stale,
13722
+ summary: told.summary ?? "",
13723
+ layerIndex: anew ? 0 : Math.min(state.layerIndex, Math.max(0, told.layers.length - 1)),
13724
+ openLayers: anew ? told.layers.map((_, at) => at) : state.openLayers.filter((at) => at < told.layers.length),
13725
+ rail: told.layers.length === 0 ? "tree" : anew ? "layers" : state.rail
13726
+ });
13604
13727
  withLayers = (state, told) => {
13605
13728
  const layers = told.layers;
13606
- const opened = {
13607
- ...state,
13608
- layers,
13609
- layersStale: told.stale,
13610
- summary: told.summary ?? "",
13611
- layerIndex: 0,
13612
- openLayers: [],
13613
- rail: layers.length === 0 ? "tree" : "layers"
13614
- };
13615
- if (layers.length === 0) return opened;
13729
+ const anew = state.layers.length === 0;
13730
+ const opened = laidOver(state, told, anew);
13731
+ if (layers.length === 0 || !anew) return opened;
13616
13732
  return {
13617
13733
  ...opened,
13618
13734
  patchIndex: layerFiles(opened, 0)[0] ?? opened.patchIndex,
@@ -13862,7 +13978,7 @@ var init_theme = __esmMin((() => {
13862
13978
  note: "#9aa7c7",
13863
13979
  cursor: "#232936",
13864
13980
  selection: "#2b3854",
13865
- resting: "#1b2233",
13981
+ resting: "#243043",
13866
13982
  marker: blue,
13867
13983
  addedBg: "#0f2a19",
13868
13984
  removedBg: "#2e1418",
@@ -14559,9 +14675,10 @@ var init_diffview = __esmMin((() => {
14559
14675
  }));
14560
14676
  //#endregion
14561
14677
  //#region src/tui/render.ts
14562
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14678
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerMark, layerLead, layerGutter, layerText, litRow, leftOver, titlePaint, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14563
14679
  var init_render = __esmMin((() => {
14564
14680
  init_command();
14681
+ init_layers$1();
14565
14682
  init_patch();
14566
14683
  init_diffview();
14567
14684
  init_gaps();
@@ -15073,14 +15190,15 @@ var init_render = __esmMin((() => {
15073
15190
  `…/${name}`
15074
15191
  ].find((option) => option.length <= room) ?? clipMiddle(name, room);
15075
15192
  };
15076
- SUMMARY_LINES = 3;
15077
- summaryLines = (summary, room) => {
15193
+ SUMMARY_LINES = 5;
15194
+ summaryLines = (summary, room, rail = Number.MAX_SAFE_INTEGER) => {
15078
15195
  const said = summary.trim();
15079
15196
  if (said.length === 0) return [];
15197
+ const most = Math.max(2, Math.min(SUMMARY_LINES, Math.floor(rail / 6)));
15080
15198
  const lines = wrapped(said, Math.max(1, room));
15081
- const kept = lines.slice(0, SUMMARY_LINES);
15199
+ const kept = lines.slice(0, most);
15082
15200
  const last = kept.at(-1) ?? "";
15083
- return [...(lines.length > SUMMARY_LINES ? [...kept.slice(0, -1), clip(`${last}…`, room)] : kept).map((line) => ` ${line}`), ""];
15201
+ return [...(lines.length > most ? [...kept.slice(0, -1), clip(`${last}…`, room)] : kept).map((line) => ` ${line}`), ""];
15084
15202
  };
15085
15203
  contextLabel = (context) => {
15086
15204
  if (context === 3) return "";
@@ -15161,40 +15279,54 @@ var init_render = __esmMin((() => {
15161
15279
  const room = Math.max(4, pane - PANE_CHROME - 2 - tail.length);
15162
15280
  return `${treeMarks(state, row)}${clip(treeLabel(state, row, room), room).padEnd(room)}${tail}`;
15163
15281
  };
15164
- STEP_NUMBER = 3;
15165
- STEP_LEAD = 8;
15166
- NOTE_LEAD = 10;
15167
- STEP_GAP = 1;
15282
+ GUTTER = 3;
15283
+ DIR_LEAD = GUTTER;
15284
+ TITLE_LEAD = 4;
15285
+ FILE_LEAD = 6;
15168
15286
  STALE_ROOM = 13;
15169
15287
  STALE_LONG = "stale, the branch moved on";
15170
15288
  STALE_SHORT = "stale";
15171
- staleBanner = (room) => wrapped(room >= STALE_ROOM ? STALE_LONG : STALE_SHORT, room).map((line) => ` ${line}`).join("\n");
15172
- layerRoom = (state, pane) => {
15173
- const tally = Math.max(1, ...state.layers.map((layer) => `${layer.files.length}`.length));
15289
+ staleBanner = (room) => wrapped(room >= STALE_ROOM ? STALE_LONG : STALE_SHORT, room).map((line) => ` ${line}`).join("\n");
15290
+ layerRoom = (pane) => {
15291
+ const whole = Math.max(8, pane - PANE_CHROME);
15174
15292
  return {
15175
- title: Math.max(4, pane - PANE_CHROME - STEP_LEAD - STEP_GAP - tally),
15176
- note: Math.max(4, pane - PANE_CHROME - NOTE_LEAD),
15177
- tally
15293
+ title: Math.max(4, whole - TITLE_LEAD),
15294
+ dir: Math.max(4, whole - DIR_LEAD),
15295
+ file: Math.max(4, whole - FILE_LEAD)
15178
15296
  };
15179
15297
  };
15180
- layerFold = (state, index) => {
15181
- if (layerOpen(state, index)) return "▾";
15182
- return (state.layers[index]?.note ?? "").length === 0 ? " " : "▸";
15298
+ layerMark = (state, row) => {
15299
+ if (row.kind === "file") return row.reviewed === true ? marks().reviewed : " ";
15300
+ if (row.kind !== "title" || !row.lead) return " ";
15301
+ if (layerDone(state, row.index)) return marks().reviewed;
15302
+ if (leftOver(state, row.index)) return "·";
15303
+ return `${row.index + 1}`;
15304
+ };
15305
+ layerLead = (row) => {
15306
+ if (row.kind === "file") return FILE_LEAD;
15307
+ if (row.kind === "dir") return DIR_LEAD;
15308
+ return TITLE_LEAD;
15183
15309
  };
15184
- layerHead = (state, row) => {
15185
- if (!row.lead) return " ".repeat(STEP_LEAD);
15186
- return `${row.index === state.layerIndex ? state.focus === "tree" ? "▸" : "·" : " "} ${layerFold(state, row.index)} ${`${row.index + 1}.`.padStart(STEP_NUMBER)} `;
15310
+ layerGutter = (state, row) => {
15311
+ return `${row.here === true ? "▎" : " "}${layerMark(state, row).padStart(2)}`;
15187
15312
  };
15188
15313
  layerText = (state, row, room) => {
15189
- if (row.kind === "file") return `${" ".repeat(NOTE_LEAD)}${marks().file} ${row.text}`;
15190
- if (row.kind === "note") return `${" ".repeat(NOTE_LEAD)}${row.text}`;
15191
- const tail = (row.lead ? `${state.layers[row.index]?.files.length ?? 0}` : "").padStart(room.tally + STEP_GAP);
15192
- return `${layerHead(state, row)}${row.text.padEnd(room.title)}${tail}`;
15314
+ if (row.kind === "gap") return "";
15315
+ const lead = layerLead(row) - GUTTER;
15316
+ return `${layerGutter(state, row)}${" ".repeat(lead)}${row.text}`.padEnd(room.title + TITLE_LEAD);
15317
+ };
15318
+ litRow = (row, state, drawn) => row.here === true ? bg(restingOrHere(state.focus === "tree"))(drawn) : drawn;
15319
+ leftOver = (state, layerIndex) => state.layers[layerIndex]?.title === REMAINDER_TITLE;
15320
+ titlePaint = (state, layerIndex) => {
15321
+ const here = layerIndex === state.layerIndex;
15322
+ if (leftOver(state, layerIndex)) return here ? palette.attention : palette.faint;
15323
+ if (layerDone(state, layerIndex)) return palette.faint;
15324
+ return here ? palette.ink : palette.muted;
15193
15325
  };
15194
15326
  layerPaint = (state, row) => {
15195
- if (row.kind === "file") return palette.ink;
15196
- if (row.kind === "note") return palette.faint;
15197
- return row.index === state.layerIndex ? palette.ink : palette.muted;
15327
+ if (row.kind === "file") return row.reviewed === true ? palette.added : palette.ink;
15328
+ if (row.kind === "dir" || row.kind === "count") return palette.faint;
15329
+ return titlePaint(state, row.index);
15198
15330
  };
15199
15331
  PANEL_TITLES = {
15200
15332
  with: "With the agent",
@@ -15208,12 +15340,12 @@ var init_render = __esmMin((() => {
15208
15340
  nothingYet = (state, room) => {
15209
15341
  const wanted = state.query.trim();
15210
15342
  if (wanted.length === 0 || state.term.length === 0) return "".padEnd(room);
15211
- return clip(` nothing else uses ${wanted}`, room).padEnd(room);
15343
+ return clip(` nothing uses ${wanted}`, room).padEnd(room);
15212
15344
  };
15213
15345
  foundTitle = (state) => {
15214
15346
  const all = state.matches.length;
15215
15347
  if (state.term.length === 0) return "Look for something";
15216
- return `${state.term} · ${all === 1 ? "1 place" : `${all} places`} elsewhere`;
15348
+ return `${state.term} · ${all === 1 ? "1 place" : `${all} places`}`;
15217
15349
  };
15218
15350
  fileRow = (match, room) => {
15219
15351
  const said = ` ${match.changed ? marks().comment : " "} ${clipHead(match.path, Math.max(8, room - 3))}`;
@@ -15613,24 +15745,37 @@ var init_render = __esmMin((() => {
15613
15745
  return Math.max(1, this.listPane.height - edges);
15614
15746
  }
15615
15747
  layerRail(state) {
15616
- const room = layerRoom(state, this.paneRoom());
15617
- const said = summaryLines(state.summary, room.note);
15748
+ const room = layerRoom(this.paneRoom());
15749
+ const said = summaryLines(state.summary, room.title, this.listRoom());
15618
15750
  const banner = (state.layersStale ? 1 : 0) + said.length;
15619
15751
  const height = Math.max(1, this.listRoom() - banner);
15620
- const all = layerRows(state, room.title, room.note);
15621
- const whole = railWindow(all, height, state.layerIndex);
15622
- const window = whole.more === 0 ? whole : railWindow(all, Math.max(1, height - 1), state.layerIndex);
15623
- const rows = window.rows.map((row) => fg(layerPaint(state, row))(`${layerText(state, row, room)}\n`));
15624
- const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
15625
- const warn = state.layersStale ? [fg(palette.attention)(`${staleBanner(room.note)}\n`)] : [];
15752
+ const all = layerFitted(state, room, height);
15753
+ const window = this.railFitted(state, all, height);
15754
+ const rows = window.rows.flatMap((row) => this.layerLine(state, row, room));
15755
+ const above = window.above > 0 ? [fg(palette.faint)(` ▲ ${window.above} more\n`)] : [];
15756
+ const more = window.more > 0 ? [fg(palette.faint)(` ▼ ${window.more} more`)] : [];
15757
+ const warn = state.layersStale ? [fg(palette.attention)(`${staleBanner(room.title)}\n`)] : [];
15626
15758
  const told = said.map((line) => fg(palette.muted)(`${line}\n`));
15627
15759
  return new StyledText([
15628
15760
  ...told,
15629
15761
  ...warn,
15762
+ ...above,
15630
15763
  ...rows,
15631
15764
  ...more
15632
15765
  ]);
15633
15766
  }
15767
+ layerLine(state, row, room) {
15768
+ const drawn = layerText(state, row, room);
15769
+ const body = fg(layerPaint(state, row))(`${drawn.slice(1)}\n`);
15770
+ return [fg(row.here === true ? palette.marker : palette.faint)(drawn.slice(0, 1)), litRow(row, state, body)];
15771
+ }
15772
+ railFitted(state, all, height) {
15773
+ const whole = railWindow(all, height, state.layerIndex);
15774
+ if (whole.more === 0 && whole.above === 0) return whole;
15775
+ const once = railWindow(all, Math.max(1, height - 1), state.layerIndex);
15776
+ if (once.above === 0 || once.more === 0) return once;
15777
+ return railWindow(all, Math.max(1, height - 2), state.layerIndex);
15778
+ }
15634
15779
  paintDiff(state) {
15635
15780
  const shown = shownOf(state);
15636
15781
  if (shown === void 0) return;
@@ -16045,7 +16190,7 @@ var init_upgrade = __esmMin((() => {
16045
16190
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
16046
16191
  }).pipe(withSpan("Tui.upgradeHint"));
16047
16192
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
16048
- })), LOOK_MS, LEAVING_SAID, 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, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
16193
+ })), LOOK_MS, LEAVING_SAID, 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, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
16049
16194
  var init_app = __esmMin((() => {
16050
16195
  init_dist();
16051
16196
  init_report();
@@ -16063,8 +16208,12 @@ var init_app = __esmMin((() => {
16063
16208
  init_intent();
16064
16209
  init_session();
16065
16210
  init_upgrade();
16066
- LOOK_MS = 220;
16211
+ LOOK_MS = 110;
16067
16212
  LEAVING_SAID = "press ctrl+c again to leave";
16213
+ alongFrom = (state) => {
16214
+ const along = nextUnreviewed(state, state.patchIndex);
16215
+ return along === void 0 ? withNotice(state, "every file reviewed") : atFile(state, along);
16216
+ };
16068
16217
  NOTICE_MS = 2200;
16069
16218
  KEY_HISTORY = 40;
16070
16219
  DRAIN_PASSES = 8;
@@ -16251,6 +16400,7 @@ var init_app = __esmMin((() => {
16251
16400
  renderer.on("destroy", () => this.stopPainting());
16252
16401
  renderer.on("destroy", () => this.stopConsuming());
16253
16402
  renderer.on("frame", () => this.syncGeometry());
16403
+ renderer.on("resize", () => this.resized());
16254
16404
  renderer.setFrameCallback(() => runPromise(this.applying()));
16255
16405
  const resume = options.resume;
16256
16406
  const opensOn = options.opensOn;
@@ -16409,6 +16559,10 @@ var init_app = __esmMin((() => {
16409
16559
  const moved = down === 0 ? this.measured() : scrolled(this.standing(), down);
16410
16560
  this.commit(across === 0 ? moved : panBy(moved, across));
16411
16561
  }
16562
+ resized() {
16563
+ runSync(this.display.paint(this.state));
16564
+ this.syncGeometry();
16565
+ }
16412
16566
  syncGeometry() {
16413
16567
  const rows = runSync(this.display.rows);
16414
16568
  if (rows !== this.state.viewport) {
@@ -16748,16 +16902,11 @@ var init_app = __esmMin((() => {
16748
16902
  return gen({ self: this }, function* () {
16749
16903
  const branch = selectedBranch(this.state);
16750
16904
  if (branch === void 0) return;
16751
- const elsewhere = (yield* searchBranch(this.repo, branch.branch, wanted)).filter((match) => !this.isHere(match));
16752
- this.commit(withMatches(this.state, elsewhere, wanted));
16753
- if (elsewhere.length === 0) this.commit(withNoticeHere(this.state, `no other place uses ${wanted}`));
16905
+ const reading = this.reading;
16906
+ const found = reading === void 0 || reading.worktree.branch !== branch.branch ? yield* searchBranch(this.repo, branch.branch, wanted) : yield* searchIn(reading, wanted);
16907
+ this.commit(withMatches(this.state, found, wanted));
16754
16908
  });
16755
16909
  }
16756
- isHere(match) {
16757
- const patch = selectedPatch(this.state);
16758
- if (patch === void 0 || patch.path !== match.path) return false;
16759
- return sourceLineAt(this.state, this.state.cursor) === match.line;
16760
- }
16761
16910
  openMatch() {
16762
16911
  return gen({ self: this }, function* () {
16763
16912
  const match = matchHere(this.state);
@@ -17014,6 +17163,10 @@ var init_app = __esmMin((() => {
17014
17163
  const branch = selectedBranch(this.state);
17015
17164
  const patch = selectedPatch(this.state);
17016
17165
  if (branch === void 0 || patch === void 0) return;
17166
+ if (advance && isReviewed(this.state, this.state.patchIndex)) {
17167
+ this.commit(alongFrom(this.state));
17168
+ return;
17169
+ }
17017
17170
  const report = yield* this.vouching(branch.branch, patch.path);
17018
17171
  const marked = report.vouched.includes(patch.path);
17019
17172
  const next = withVouched(this.state, report.vouched);
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.104",
26
+ "version": "0.1.0-alpha.106",
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": {
@@ -231,8 +231,9 @@ was written for, and adiff reports it as `stale` once the branch moves past that
231
231
  reviewer has a reading order, keep it true: write it again after you address their comments.
232
232
 
233
233
  When you have published one, tell them the sidebar now holds it: `s` swaps between the layers and
234
- the files, `j` and `k` move between layers with the diff following, and `]` and `[` walk the files
235
- inside a layer.
234
+ the files, each layer shows the files it covers with the ones already reviewed ticked off, and `]`
235
+ and `[` walk those files in the order you put them in — from the last file of one layer into the
236
+ first of the next.
236
237
 
237
238
  ## Discovering the rest
238
239