@eliya-oss/agent-diff 0.1.0-alpha.105 → 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,21 @@
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
+
3
19
  ## 0.1.0-alpha.105
4
20
 
5
21
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9927,7 +9927,7 @@ var init_pane = __esmMin((() => {
9927
9927
  init_commands();
9928
9928
  init_init();
9929
9929
  init_pane();
9930
- var version$1 = "0.1.0-alpha.105";
9930
+ var version$1 = "0.1.0-alpha.106";
9931
9931
  //#endregion
9932
9932
  //#region src/cli/upgrade.ts
9933
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;
@@ -10189,7 +10189,7 @@ var init_model$1 = __esmMin((() => {
10189
10189
  }));
10190
10190
  //#endregion
10191
10191
  //#region src/domain/layers/coverage.ts
10192
- 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;
10193
10193
  var init_coverage = __esmMin((() => {
10194
10194
  init_dist();
10195
10195
  init_model$1();
@@ -10245,6 +10245,7 @@ var init_coverage = __esmMin((() => {
10245
10245
  missing: tallies.flatMap((tally) => tally.missing)
10246
10246
  };
10247
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.`;
10248
10249
  withFullCoverage = (patches, layers) => {
10249
10250
  const gap = coverage(patches, layers.layers);
10250
10251
  if (gap.missing.length === 0) return layers;
@@ -10252,7 +10253,7 @@ var init_coverage = __esmMin((() => {
10252
10253
  title: REMAINDER_TITLE,
10253
10254
  blocks: [{
10254
10255
  kind: "prose",
10255
- markdown: `${gap.missing.length} runs of changed lines the agent did not account for.`
10256
+ markdown: missingSaid(gap.missing.length)
10256
10257
  }, ...gap.missing.map((span) => codeBlockOf$1(span))]
10257
10258
  };
10258
10259
  return {
@@ -10317,7 +10318,7 @@ var init_layers$1 = __esmMin((() => {
10317
10318
  init_coverage();
10318
10319
  init_version();
10319
10320
  init_model$1();
10320
- })), 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;
10321
10322
  var init_layers = __esmMin((() => {
10322
10323
  init_dist();
10323
10324
  init_layers$1();
@@ -10332,38 +10333,61 @@ var init_layers = __esmMin((() => {
10332
10333
  start,
10333
10334
  end
10334
10335
  }));
10335
- isSpan = (value) => {
10336
+ tidyPath = (path) => path.replace(/^\.\/+/, "").replace(/^\/+/, "");
10337
+ spanFault = (value) => {
10336
10338
  const span = value;
10337
- return typeof span?.path === "string" && typeof span.start === "number" && typeof span.end === "number";
10338
- };
10339
- 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) => {
10340
10347
  const block = value;
10341
- if (block?.kind === "prose") return typeof block.markdown === "string";
10342
- 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);
10343
10351
  };
10344
10352
  codeBlockOf = (span) => ({
10345
10353
  kind: "code",
10346
- path: span.path,
10354
+ path: tidyPath(span.path),
10347
10355
  start: span.start,
10348
10356
  end: span.end
10349
10357
  });
10358
+ tidyBlock = (block) => block.kind === "code" ? {
10359
+ ...block,
10360
+ path: tidyPath(block.path)
10361
+ } : block;
10350
10362
  blocksOf = (layer) => {
10351
- if (Array.isArray(layer.blocks)) return layer.blocks.filter(isBlock);
10352
- const note = typeof layer.note === "string" ? [{
10363
+ const note = typeof layer.note === "string" && layer.note.trim().length > 0 ? [{
10353
10364
  kind: "prose",
10354
10365
  markdown: layer.note
10355
10366
  }] : [];
10356
- const spans = Array.isArray(layer.spans) ? layer.spans.filter(isSpan) : [];
10357
- return [...note, ...spans.map(codeBlockOf)];
10358
- };
10359
- layerOf = (value) => {
10360
- const layer = value;
10361
- const title = typeof layer?.title === "string" ? layer.title.trim() : "";
10362
- if (layer === void 0 || title.length === 0) return none();
10363
- const blocks = blocksOf(layer);
10364
- return blocks.length === 0 ? none() : some({
10365
- title,
10366
- 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)
10367
10391
  });
10368
10392
  };
10369
10393
  parsed = (text) => {
@@ -10380,11 +10404,13 @@ var init_layers = __esmMin((() => {
10380
10404
  onSome: succeed$1
10381
10405
  });
10382
10406
  const raw = document["layers"];
10383
- 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), {
10384
10411
  onNone: () => [],
10385
10412
  onSome: (layer) => [layer]
10386
10413
  }));
10387
- if (layers.length === 0) return yield* new MalformedLayers({ reason: "every layer needs a title and at least one span or block" });
10388
10414
  const summary = document["summary"];
10389
10415
  return {
10390
10416
  summary: typeof summary === "string" ? summary : "",
@@ -10401,13 +10427,20 @@ var init_layers = __esmMin((() => {
10401
10427
  });
10402
10428
  reportedLayers = (patches, layers) => {
10403
10429
  const present = new Set(patches.map((patch) => patch.path));
10404
- return withFullCoverage(patches, layers).layers.map((layer) => ({
10405
- title: layer.title,
10406
- note: noteOf(layer),
10407
- files: unique(spansOfLayer(layer).map((span) => span.path)).filter((path) => present.has(path)),
10408
- spans: spansOfLayer(layer),
10409
- prose: proseAnchors(layer).filter((anchor) => present.has(anchor.path))
10410
- }));
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
+ });
10411
10444
  };
10412
10445
  reportOf = (patches, layers, branchHead) => {
10413
10446
  const status = statusOf(patches, layers, branchHead);
@@ -11770,7 +11803,7 @@ var init_tree = __esmMin((() => {
11770
11803
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
11771
11804
  };
11772
11805
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
11773
- })), 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;
11774
11807
  var init_model = __esmMin((() => {
11775
11808
  init_dist();
11776
11809
  init_patch();
@@ -11840,6 +11873,7 @@ var init_model = __esmMin((() => {
11840
11873
  });
11841
11874
  TREE_MAX = 34;
11842
11875
  TREE_ROOMY = 40;
11876
+ TREE_WIDE = 52;
11843
11877
  TREE_MIN = 18;
11844
11878
  TREE_SHARE = .3;
11845
11879
  DIFF_MIN = 26;
@@ -11847,8 +11881,8 @@ var init_model = __esmMin((() => {
11847
11881
  bodyRoom = (columns) => Math.max(0, columns - 2);
11848
11882
  treeWidth = (columns) => {
11849
11883
  const room = bodyRoom(columns);
11850
- const most = room - reviewWidth() - DIFF_ROOMY >= TREE_ROOMY ? TREE_ROOMY : TREE_MAX;
11851
- 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)));
11852
11886
  return Math.max(0, Math.min(wanted, room - DIFF_MIN));
11853
11887
  };
11854
11888
  reviewWidth = () => 36;
@@ -11891,73 +11925,123 @@ var init_model = __esmMin((() => {
11891
11925
  const width = Math.max(1, room);
11892
11926
  return text.split(/\s+/).filter((word) => word.length > 0).flatMap((word) => chunked(word, width)).reduce((lines, word) => packed(lines, word, width), []);
11893
11927
  };
11894
- NO_NOTE = "no note";
11895
- noteRows$1 = (state, layerIndex, room) => {
11896
- const lines = wrapped(state.layers[layerIndex]?.note ?? "", room);
11897
- 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) => ({
11898
11935
  index: layerIndex,
11899
- kind: "note",
11936
+ kind: "title",
11900
11937
  text,
11901
- lead: false
11938
+ lead: at === 0
11902
11939
  }));
11903
11940
  };
11904
- proseRow = (layerIndex, text) => ({
11905
- index: layerIndex,
11906
- kind: "note",
11907
- text,
11908
- lead: false
11909
- });
11910
- proseRows$1 = (state, layerIndex, room) => {
11911
- 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) => {
11912
11966
  const rows = [];
11913
- for (const [at, block] of blocks.entries()) {
11914
- if (at > 0) rows.push(proseRow(layerIndex, ""));
11915
- for (const text of wrapped(block.markdown, room)) rows.push(proseRow(layerIndex, text));
11916
- 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({
11917
11971
  index: layerIndex,
11918
- kind: "file",
11919
- text: clipEnd(block.path, Math.max(1, room - FILE_LEAD)),
11972
+ kind: "dir",
11973
+ text: shortDir(dir, room.dir),
11920
11974
  lead: false
11921
11975
  });
11976
+ held = dir;
11977
+ rows.push(fileRow$1(state, layerIndex, at, room.file));
11922
11978
  }
11923
11979
  return rows;
11924
11980
  };
11925
- titleRows = (state, layerIndex, room) => wordWrapped(state.layers[layerIndex]?.title ?? "", room).map((text, at) => ({
11926
- index: layerIndex,
11927
- kind: "title",
11928
- text,
11929
- lead: at === 0
11930
- }));
11931
- clipEnd = (text, room) => {
11932
- if (text.length <= room) return text;
11933
- const parts = text.split("/");
11934
- const kept = [];
11935
- for (const part of parts.toReversed()) {
11936
- if ([part, ...kept].join("/").length + 2 > room) break;
11937
- kept.unshift(part);
11938
- }
11939
- return `…/${kept.length === 0 ? parts.at(-1) ?? text : kept.join("/")}`;
11940
- };
11941
- FILE_LEAD = 2;
11942
- fileRows = (state, layerIndex, room) => (state.layers[layerIndex]?.files ?? []).map((path) => ({
11943
- index: layerIndex,
11944
- kind: "file",
11945
- text: clipEnd(path, Math.max(1, room - FILE_LEAD)),
11946
- lead: false
11947
- }));
11948
- 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
+ };
11949
12028
  railWindow = (rows, height, layerIndex) => {
11950
12029
  if (rows.length <= height) return {
11951
12030
  rows,
11952
- more: 0
12031
+ more: 0,
12032
+ above: 0
11953
12033
  };
11954
12034
  const first = Math.max(0, rows.findIndex((row) => row.index === layerIndex));
11955
12035
  const block = rows.findLastIndex((row) => row.index === layerIndex) - first + 1;
11956
12036
  const wanted = block >= height ? first : first - Math.floor((height - block) / 2);
11957
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;
11958
12041
  return {
11959
- rows: rows.slice(start, start + height),
11960
- more: rows.length - (start + height)
12042
+ rows: shown,
12043
+ more: seen(rows.slice(start + height)),
12044
+ above: seen(rows.slice(0, start))
11961
12045
  };
11962
12046
  };
11963
12047
  selectedBranch = (state) => state.branches[state.branchIndex];
@@ -12258,9 +12342,9 @@ var init_model = __esmMin((() => {
12258
12342
  return [...order.slice(start + 1), ...order.slice(0, start + 1)].find((index) => !isReviewed(state, index));
12259
12343
  };
12260
12344
  reviewedCount = (state) => `${state.vouched.length}/${state.patches.length} reviewed`;
12261
- 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]);
12262
12346
  filePlace = (state) => {
12263
- const order = fileOrder(state);
12347
+ const order = [...new Set(fileOrder(state))];
12264
12348
  const at = order.indexOf(state.patchIndex);
12265
12349
  if (at === -1) return {
12266
12350
  at: state.patchIndex + 1,
@@ -12271,11 +12355,29 @@ var init_model = __esmMin((() => {
12271
12355
  of: order.length
12272
12356
  };
12273
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
+ };
12274
12370
  layerFile = (state, delta) => {
12275
- const order = fileOrder(state);
12276
- const position = order.indexOf(state.patchIndex);
12277
- if (position === -1) return order[0] ?? state.patchIndex;
12278
- 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;
12279
12381
  };
12280
12382
  selectionRange = (state) => state.anchorRow <= state.cursor ? [state.anchorRow, state.cursor] : [state.cursor, state.anchorRow];
12281
12383
  }));
@@ -13012,7 +13114,7 @@ var init_match = __esmMin((() => {
13012
13114
  }));
13013
13115
  //#endregion
13014
13116
  //#region src/tui/reduce.ts
13015
- 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;
13016
13118
  var init_reduce = __esmMin((() => {
13017
13119
  init_dist();
13018
13120
  init_patch();
@@ -13152,17 +13254,18 @@ var init_reduce = __esmMin((() => {
13152
13254
  };
13153
13255
  };
13154
13256
  moveLayer = (state, delta) => {
13155
- const layerIndex = clamp(state.layerIndex + delta, 0, Math.max(0, state.layers.length - 1));
13156
- const landed = {
13157
- ...state,
13158
- layerIndex
13159
- };
13160
- 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;
13161
13262
  return {
13162
- ...landed,
13163
- patchIndex,
13263
+ ...state,
13264
+ layerIndex: landed.layer,
13265
+ openLayers: state.openLayers.includes(landed.layer) ? state.openLayers : [...state.openLayers, landed.layer],
13266
+ patchIndex: landed.file,
13164
13267
  top: 0,
13165
- cursor: 0,
13268
+ cursor: landingOn(state, landed.file),
13166
13269
  anchorRow: 0,
13167
13270
  selecting: false
13168
13271
  };
@@ -13286,12 +13389,20 @@ var init_reduce = __esmMin((() => {
13286
13389
  }, patchIndex);
13287
13390
  return state.closed.filter((path) => !wanted.includes(path));
13288
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
+ };
13289
13397
  moveFile = (state, delta) => {
13398
+ if (atTheEnd(state, delta)) return withNoticeHere(state, delta > 0 ? "last file" : "first file");
13290
13399
  const next = layerFile(state, delta);
13291
- if (next === state.patchIndex) return withNoticeHere(state, delta > 0 ? "last file" : "first file");
13400
+ const layer = onLayers(state) ? layerAfter(state, delta) : state.layerIndex;
13292
13401
  return {
13293
13402
  ...state,
13294
13403
  notice: "",
13404
+ layerIndex: layer,
13405
+ openLayers: state.openLayers.includes(layer) ? state.openLayers : [...state.openLayers, layer],
13295
13406
  closed: revealing(state, next),
13296
13407
  patchIndex: next,
13297
13408
  top: 0,
@@ -13604,18 +13715,20 @@ var init_reduce = __esmMin((() => {
13604
13715
  ...state,
13605
13716
  columns
13606
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
+ });
13607
13727
  withLayers = (state, told) => {
13608
13728
  const layers = told.layers;
13609
- const opened = {
13610
- ...state,
13611
- layers,
13612
- layersStale: told.stale,
13613
- summary: told.summary ?? "",
13614
- layerIndex: 0,
13615
- openLayers: [],
13616
- rail: layers.length === 0 ? "tree" : "layers"
13617
- };
13618
- 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;
13619
13732
  return {
13620
13733
  ...opened,
13621
13734
  patchIndex: layerFiles(opened, 0)[0] ?? opened.patchIndex,
@@ -13865,7 +13978,7 @@ var init_theme = __esmMin((() => {
13865
13978
  note: "#9aa7c7",
13866
13979
  cursor: "#232936",
13867
13980
  selection: "#2b3854",
13868
- resting: "#1b2233",
13981
+ resting: "#243043",
13869
13982
  marker: blue,
13870
13983
  addedBg: "#0f2a19",
13871
13984
  removedBg: "#2e1418",
@@ -14562,9 +14675,10 @@ var init_diffview = __esmMin((() => {
14562
14675
  }));
14563
14676
  //#endregion
14564
14677
  //#region src/tui/render.ts
14565
- 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;
14566
14679
  var init_render = __esmMin((() => {
14567
14680
  init_command();
14681
+ init_layers$1();
14568
14682
  init_patch();
14569
14683
  init_diffview();
14570
14684
  init_gaps();
@@ -15076,14 +15190,15 @@ var init_render = __esmMin((() => {
15076
15190
  `…/${name}`
15077
15191
  ].find((option) => option.length <= room) ?? clipMiddle(name, room);
15078
15192
  };
15079
- SUMMARY_LINES = 3;
15080
- summaryLines = (summary, room) => {
15193
+ SUMMARY_LINES = 5;
15194
+ summaryLines = (summary, room, rail = Number.MAX_SAFE_INTEGER) => {
15081
15195
  const said = summary.trim();
15082
15196
  if (said.length === 0) return [];
15197
+ const most = Math.max(2, Math.min(SUMMARY_LINES, Math.floor(rail / 6)));
15083
15198
  const lines = wrapped(said, Math.max(1, room));
15084
- const kept = lines.slice(0, SUMMARY_LINES);
15199
+ const kept = lines.slice(0, most);
15085
15200
  const last = kept.at(-1) ?? "";
15086
- 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}`), ""];
15087
15202
  };
15088
15203
  contextLabel = (context) => {
15089
15204
  if (context === 3) return "";
@@ -15164,40 +15279,54 @@ var init_render = __esmMin((() => {
15164
15279
  const room = Math.max(4, pane - PANE_CHROME - 2 - tail.length);
15165
15280
  return `${treeMarks(state, row)}${clip(treeLabel(state, row, room), room).padEnd(room)}${tail}`;
15166
15281
  };
15167
- STEP_NUMBER = 3;
15168
- STEP_LEAD = 8;
15169
- NOTE_LEAD = 10;
15170
- STEP_GAP = 1;
15282
+ GUTTER = 3;
15283
+ DIR_LEAD = GUTTER;
15284
+ TITLE_LEAD = 4;
15285
+ FILE_LEAD = 6;
15171
15286
  STALE_ROOM = 13;
15172
15287
  STALE_LONG = "stale, the branch moved on";
15173
15288
  STALE_SHORT = "stale";
15174
- staleBanner = (room) => wrapped(room >= STALE_ROOM ? STALE_LONG : STALE_SHORT, room).map((line) => ` ${line}`).join("\n");
15175
- layerRoom = (state, pane) => {
15176
- 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);
15177
15292
  return {
15178
- title: Math.max(4, pane - PANE_CHROME - STEP_LEAD - STEP_GAP - tally),
15179
- note: Math.max(4, pane - PANE_CHROME - NOTE_LEAD),
15180
- 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)
15181
15296
  };
15182
15297
  };
15183
- layerFold = (state, index) => {
15184
- if (layerOpen(state, index)) return "▾";
15185
- 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}`;
15186
15304
  };
15187
- layerHead = (state, row) => {
15188
- if (!row.lead) return " ".repeat(STEP_LEAD);
15189
- return `${row.index === state.layerIndex ? state.focus === "tree" ? "▸" : "·" : " "} ${layerFold(state, row.index)} ${`${row.index + 1}.`.padStart(STEP_NUMBER)} `;
15305
+ layerLead = (row) => {
15306
+ if (row.kind === "file") return FILE_LEAD;
15307
+ if (row.kind === "dir") return DIR_LEAD;
15308
+ return TITLE_LEAD;
15309
+ };
15310
+ layerGutter = (state, row) => {
15311
+ return `${row.here === true ? "▎" : " "}${layerMark(state, row).padStart(2)}`;
15190
15312
  };
15191
15313
  layerText = (state, row, room) => {
15192
- if (row.kind === "file") return `${" ".repeat(NOTE_LEAD)}${marks().file} ${row.text}`;
15193
- if (row.kind === "note") return `${" ".repeat(NOTE_LEAD)}${row.text}`;
15194
- const tail = (row.lead ? `${state.layers[row.index]?.files.length ?? 0}` : "").padStart(room.tally + STEP_GAP);
15195
- 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;
15196
15325
  };
15197
15326
  layerPaint = (state, row) => {
15198
- if (row.kind === "file") return palette.ink;
15199
- if (row.kind === "note") return palette.faint;
15200
- 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);
15201
15330
  };
15202
15331
  PANEL_TITLES = {
15203
15332
  with: "With the agent",
@@ -15616,24 +15745,37 @@ var init_render = __esmMin((() => {
15616
15745
  return Math.max(1, this.listPane.height - edges);
15617
15746
  }
15618
15747
  layerRail(state) {
15619
- const room = layerRoom(state, this.paneRoom());
15620
- const said = summaryLines(state.summary, room.note);
15748
+ const room = layerRoom(this.paneRoom());
15749
+ const said = summaryLines(state.summary, room.title, this.listRoom());
15621
15750
  const banner = (state.layersStale ? 1 : 0) + said.length;
15622
15751
  const height = Math.max(1, this.listRoom() - banner);
15623
- const all = layerRows(state, room.title, room.note);
15624
- const whole = railWindow(all, height, state.layerIndex);
15625
- const window = whole.more === 0 ? whole : railWindow(all, Math.max(1, height - 1), state.layerIndex);
15626
- const rows = window.rows.map((row) => fg(layerPaint(state, row))(`${layerText(state, row, room)}\n`));
15627
- const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
15628
- 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`)] : [];
15629
15758
  const told = said.map((line) => fg(palette.muted)(`${line}\n`));
15630
15759
  return new StyledText([
15631
15760
  ...told,
15632
15761
  ...warn,
15762
+ ...above,
15633
15763
  ...rows,
15634
15764
  ...more
15635
15765
  ]);
15636
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
+ }
15637
15779
  paintDiff(state) {
15638
15780
  const shown = shownOf(state);
15639
15781
  if (shown === void 0) return;
@@ -16048,7 +16190,7 @@ var init_upgrade = __esmMin((() => {
16048
16190
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
16049
16191
  }).pipe(withSpan("Tui.upgradeHint"));
16050
16192
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
16051
- })), 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;
16052
16194
  var init_app = __esmMin((() => {
16053
16195
  init_dist();
16054
16196
  init_report();
@@ -16068,6 +16210,10 @@ var init_app = __esmMin((() => {
16068
16210
  init_upgrade();
16069
16211
  LOOK_MS = 110;
16070
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
+ };
16071
16217
  NOTICE_MS = 2200;
16072
16218
  KEY_HISTORY = 40;
16073
16219
  DRAIN_PASSES = 8;
@@ -16254,6 +16400,7 @@ var init_app = __esmMin((() => {
16254
16400
  renderer.on("destroy", () => this.stopPainting());
16255
16401
  renderer.on("destroy", () => this.stopConsuming());
16256
16402
  renderer.on("frame", () => this.syncGeometry());
16403
+ renderer.on("resize", () => this.resized());
16257
16404
  renderer.setFrameCallback(() => runPromise(this.applying()));
16258
16405
  const resume = options.resume;
16259
16406
  const opensOn = options.opensOn;
@@ -16412,6 +16559,10 @@ var init_app = __esmMin((() => {
16412
16559
  const moved = down === 0 ? this.measured() : scrolled(this.standing(), down);
16413
16560
  this.commit(across === 0 ? moved : panBy(moved, across));
16414
16561
  }
16562
+ resized() {
16563
+ runSync(this.display.paint(this.state));
16564
+ this.syncGeometry();
16565
+ }
16415
16566
  syncGeometry() {
16416
16567
  const rows = runSync(this.display.rows);
16417
16568
  if (rows !== this.state.viewport) {
@@ -17012,6 +17163,10 @@ var init_app = __esmMin((() => {
17012
17163
  const branch = selectedBranch(this.state);
17013
17164
  const patch = selectedPatch(this.state);
17014
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
+ }
17015
17170
  const report = yield* this.vouching(branch.branch, patch.path);
17016
17171
  const marked = report.vouched.includes(patch.path);
17017
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.105",
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