@eliya-oss/agent-diff 0.1.0-alpha.44 → 0.1.0-alpha.45

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,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.45
4
+
5
+ ### Patch Changes
6
+
7
+ - Use the room a wide terminal has: panels keep a whole command title and a whole match, a tall screen lists more keys, and a long worktree name is read to its end.
8
+
3
9
  ## 0.1.0-alpha.44
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9199,7 +9199,7 @@ var init_pane = __esmMin((() => {
9199
9199
  init_commands();
9200
9200
  init_init();
9201
9201
  init_pane();
9202
- var version$1 = "0.1.0-alpha.44";
9202
+ var version$1 = "0.1.0-alpha.45";
9203
9203
  //#endregion
9204
9204
  //#region src/cli/upgrade.ts
9205
9205
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, ran, here, statusOf$1, ranLine, failedLine, noteFor, offerFor, restOf, sayUpgrade, upgradeAdiff;
@@ -10848,7 +10848,7 @@ var init_tree = __esmMin((() => {
10848
10848
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
10849
10849
  };
10850
10850
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
10851
- })), initialState, 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, treeOf, treeRows, crowdedOf, directoryOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
10851
+ })), initialState, 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, treeOf, treeRows, crowdedOf, directoryOfFile, isReviewed, treeWindow, commentsOn, hiddenLines, markedRows, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, editedComment, composeTarget, selectedLines, KEYWORDS, NAME, longestName$1, searchTerm, matchHere, selectionReadout, WHOLE_FILE, CONTEXT_STEPS, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, spokenSince, hunkStarts, changeAround, nextUnreviewed, reviewedCount, fileOrder, layerFile, selectionRange;
10852
10852
  var init_model = __esmMin((() => {
10853
10853
  init_dist();
10854
10854
  init_patch();
@@ -10891,6 +10891,7 @@ var init_model = __esmMin((() => {
10891
10891
  layers: [],
10892
10892
  layersStale: false,
10893
10893
  pulls: {},
10894
+ forge: "asking",
10894
10895
  layerIndex: 0,
10895
10896
  openLayers: [],
10896
10897
  term: "",
@@ -11006,6 +11007,8 @@ var init_model = __esmMin((() => {
11006
11007
  };
11007
11008
  selectedBranch = (state) => state.branches[state.branchIndex];
11008
11009
  selectedPatch = (state) => shownOf(state)?.patch;
11010
+ pullHere = (state) => state.pulls[selectedBranch(state)?.branch ?? ""] ?? "";
11011
+ knownToHaveNoPull = (state) => state.forge === "answered" && pullHere(state).length === 0;
11009
11012
  treeOf = (state) => buildTree(state.patches.map((patch) => patch.path));
11010
11013
  treeRows = (state) => {
11011
11014
  const tree = treeOf(state);
@@ -11136,11 +11139,11 @@ var init_model = __esmMin((() => {
11136
11139
  "never"
11137
11140
  ]);
11138
11141
  NAME = /[A-Za-z_$][\w$]*/g;
11139
- longestName = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
11142
+ longestName$1 = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
11140
11143
  searchTerm = (state) => {
11141
11144
  const line = selectedLines(state).map((text) => text.trim()).find((text) => text.length > 0);
11142
11145
  if (line === void 0) return "";
11143
- return longestName(line) ?? line;
11146
+ return longestName$1(line) ?? line;
11144
11147
  };
11145
11148
  matchHere = (state) => state.matches[state.matchIndex];
11146
11149
  selectionReadout = (state) => {
@@ -11341,6 +11344,7 @@ var init_command = __esmMin((() => {
11341
11344
  counted: false,
11342
11345
  whenLayers: false,
11343
11346
  whenThread: false,
11347
+ whenPull: false,
11344
11348
  rank: 0,
11345
11349
  ...input
11346
11350
  });
@@ -11376,7 +11380,19 @@ var init_command = __esmMin((() => {
11376
11380
  category: "Branches",
11377
11381
  keys: ["p"],
11378
11382
  screens: ["branches"],
11379
- hint: "pull request"
11383
+ hint: "pull request",
11384
+ whenPull: true,
11385
+ rank: 4
11386
+ }),
11387
+ command({
11388
+ action: "branch.pull",
11389
+ title: "Open the pull request in a browser",
11390
+ category: "Review",
11391
+ keys: ["p"],
11392
+ screens: ["review"],
11393
+ hint: "pull request",
11394
+ whenPull: true,
11395
+ rank: 5
11380
11396
  }),
11381
11397
  command({
11382
11398
  action: "cursor.next",
@@ -11842,9 +11858,9 @@ var init_command = __esmMin((() => {
11842
11858
  if (key.startsWith("ctrl+")) return `^${key.slice(5)}`;
11843
11859
  return GLYPHS[key] ?? key;
11844
11860
  };
11845
- hintsFor = (screen, staged, layers = 0, onThread = false) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenStaged || staged > 0).filter((entry) => !entry.whenLayers || layers > 0).filter((entry) => !entry.whenThread || onThread).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
11861
+ hintsFor = (screen, offered) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenStaged || offered.staged > 0).filter((entry) => !entry.whenLayers || offered.layers > 0).filter((entry) => !entry.whenThread || offered.onThread).filter((entry) => !entry.whenPull || offered.pull).toSorted((left, right) => left.rank - right.rank).map((entry) => ({
11846
11862
  key: displayKey(entry.keys[0] ?? ""),
11847
- hint: entry.counted ? `${entry.hint} ${staged}` : entry.hint,
11863
+ hint: entry.counted ? `${entry.hint} ${offered.staged}` : entry.hint,
11848
11864
  press: entry.keys[0] ?? ""
11849
11865
  }));
11850
11866
  }));
@@ -11875,7 +11891,7 @@ var init_match = __esmMin((() => {
11875
11891
  }));
11876
11892
  //#endregion
11877
11893
  //#region src/tui/reduce.ts
11878
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, layerDown, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withLayers, withPulls, withBranches, withSource, withVouched, restoredTo, withPatches, typed, backspaced, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
11894
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, draggedTo, atRow, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, movePending, moveLayer, inRail, layerDown, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, moveFile, selectHunk, swapEnds, atBranch, startSelection, openCompose, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, offered, paletteChoice, transitions, reduce, atFile, withContext, withFull, revealsAfter, gapOpened, withPending, panBy, withSent, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, withPatches, typed, backspaced, paletteMoved, paletteClosed, withWaiting, withMatches, withNoticeHere, withNotice;
11879
11895
  var init_reduce = __esmMin((() => {
11880
11896
  init_dist();
11881
11897
  init_patch();
@@ -12321,7 +12337,12 @@ var init_reduce = __esmMin((() => {
12321
12337
  };
12322
12338
  withPulls = (state, pulls) => ({
12323
12339
  ...state,
12324
- pulls
12340
+ pulls,
12341
+ forge: "answered"
12342
+ });
12343
+ withSilentForge = (state) => ({
12344
+ ...state,
12345
+ forge: "silent"
12325
12346
  });
12326
12347
  withBranches = (state, branches) => ({
12327
12348
  ...state,
@@ -13012,7 +13033,7 @@ var init_diffview = __esmMin((() => {
13012
13033
  }));
13013
13034
  //#endregion
13014
13035
  //#region src/tui/render.ts
13015
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_MAX, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, BODY_BORDER, PANE_CHROME, BRANCH_WIDTH, BRANCH_NAME, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, bodyRoom, treeWidth, homeWidth, commandRow, modalWidth, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, branchHeading, atHome, layersCell, stateCell, branchCells, 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, Screen;
13036
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, 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, TREE_MAX, TREE_MIN, TREE_SHARE, DIFF_MIN, BODY_BORDER, PANE_CHROME, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, bodyRoom, treeWidth, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, stateCell, branchCells, 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, Screen;
13016
13037
  var init_render = __esmMin((() => {
13017
13038
  init_command();
13018
13039
  init_patch();
@@ -13036,12 +13057,17 @@ var init_render = __esmMin((() => {
13036
13057
  actionsText = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^a")} ${fg(palette.muted)("add to review")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("comment now")}`;
13037
13058
  SNIPPET_LINES = 4;
13038
13059
  PALETTE_KEY = 7;
13039
- PALETTE_TITLE = 34;
13060
+ PALETTE_TITLE = 60;
13040
13061
  PALETTE_GAP = 2;
13041
- PALETTE_MAX = 18;
13042
13062
  PALETTE_CHROME = 4;
13043
13063
  PENDING_CHROME = 3;
13044
13064
  PALETTE_WIDTH = 76;
13065
+ PANEL_SHARE = .62;
13066
+ PANEL_MAX = 120;
13067
+ PANEL_FLOOR = 6;
13068
+ PANEL_FOOT = 2;
13069
+ PANEL_QUARTER = 4;
13070
+ PANEL_FIFTH = 5;
13045
13071
  TREE_MAX = 34;
13046
13072
  TREE_MIN = 18;
13047
13073
  TREE_SHARE = .3;
@@ -13049,7 +13075,6 @@ var init_render = __esmMin((() => {
13049
13075
  BODY_BORDER = 2;
13050
13076
  PANE_CHROME = 3;
13051
13077
  BRANCH_WIDTH = 82;
13052
- BRANCH_NAME = 44;
13053
13078
  BRANCH_NAME_MIN = 12;
13054
13079
  BRANCH_TAIL = 45;
13055
13080
  EMPTY_LIST = " nothing to review. No worktree differs from the branch it started from.";
@@ -13060,13 +13085,18 @@ var init_render = __esmMin((() => {
13060
13085
  const wanted = Math.min(TREE_MAX, Math.max(TREE_MIN, Math.floor(room * TREE_SHARE)));
13061
13086
  return Math.max(0, Math.min(wanted, room - DIFF_MIN));
13062
13087
  };
13063
- homeWidth = (width) => Math.max(0, Math.min(BRANCH_WIDTH, width - 2));
13088
+ shareOf = (width, least) => Math.max(least, Math.min(PANEL_MAX, Math.floor(width * PANEL_SHARE)));
13089
+ homeWidth = (width, longest) => Math.max(0, Math.min(width - 2, Math.min(PANEL_MAX, Math.max(BRANCH_WIDTH, longest + BRANCH_TAIL))));
13090
+ longestName = (state) => Math.max(0, ...state.branches.map((branch) => branch.branch.length));
13064
13091
  commandRow = (entry, room) => {
13065
13092
  const key = clip(displayKey(entry.keys[0] ?? ""), 5).padEnd(PALETTE_KEY);
13066
13093
  const left = Math.max(1, Math.min(PALETTE_TITLE, room - PALETTE_KEY - entry.category.length - PALETTE_GAP));
13067
13094
  return `${key}${clip(entry.title, left - PALETTE_GAP).padEnd(left)}${entry.category}`;
13068
13095
  };
13069
13096
  modalWidth = (width, wanted) => Math.max(0, Math.min(wanted, width - MODAL_MARGIN));
13097
+ panelWidth = (width) => modalWidth(width, shareOf(width, PALETTE_WIDTH));
13098
+ panelTop = (height, part) => Math.max(2, Math.floor(height / part));
13099
+ panelRows = (height, part) => Math.max(PANEL_FLOOR, height - panelTop(height, part) - PANEL_FOOT);
13070
13100
  composeRoom = (width) => {
13071
13101
  const box = modalWidth(width, COMPOSE_WIDTH);
13072
13102
  return {
@@ -13185,7 +13215,7 @@ var init_render = __esmMin((() => {
13185
13215
  makePalette = (renderer) => {
13186
13216
  const box = makeCompose(renderer);
13187
13217
  box.id = "palette";
13188
- box.height = PALETTE_MAX;
13218
+ box.height = PANEL_FLOOR;
13189
13219
  box.width = PALETTE_WIDTH;
13190
13220
  return box;
13191
13221
  };
@@ -13422,8 +13452,10 @@ var init_render = __esmMin((() => {
13422
13452
  if (context === 3) return "";
13423
13453
  return context >= 1e5 ? "whole file" : `±${context}`;
13424
13454
  };
13425
- nameRoom = (pane) => Math.max(BRANCH_NAME_MIN, Math.min(BRANCH_NAME, pane - BRANCH_TAIL));
13455
+ nameRoom = (pane) => Math.max(BRANCH_NAME_MIN, pane - BRANCH_TAIL);
13426
13456
  columns = (cells, room) => `${clip(cells.name, room).padEnd(room)}${cells.files.padStart(5)}${cells.added.padStart(8)}${cells.gone.padStart(8)} ${cells.layers.padStart(8)} ${cells.state}`;
13457
+ FORGE_SILENT = " could not find out which of these have a pull request";
13458
+ unaskedForge = (state) => state.forge === "silent" ? [fg(palette.faint)(`\n${FORGE_SILENT}`)] : [];
13427
13459
  branchHeading = (room) => ` ${columns({
13428
13460
  name: "WORKTREE",
13429
13461
  files: "FILES",
@@ -13444,7 +13476,7 @@ var init_render = __esmMin((() => {
13444
13476
  ].filter((part) => part.length > 0).join(" ");
13445
13477
  branchCells = (branch, here, room) => ({
13446
13478
  lead: `${here ? marks().cursor : " "} `,
13447
- name: clip(branch.branch, room).padEnd(room),
13479
+ name: clipMiddle(branch.branch, room).padEnd(room),
13448
13480
  files: `${branch.files}`.padStart(5),
13449
13481
  added: `+${branch.added}`.padStart(8),
13450
13482
  gone: `-${branch.removed}`.padStart(8),
@@ -13455,6 +13487,7 @@ var init_render = __esmMin((() => {
13455
13487
  branch,
13456
13488
  path,
13457
13489
  state.patches.length === 0 ? "nothing to read" : `${state.patchIndex + 1}/${state.patches.length}`,
13490
+ pullHere(state).length === 0 ? "" : `${pullHere(state)} pull request`,
13458
13491
  state.vouched.length === 0 ? "" : reviewedCount(state),
13459
13492
  state.staged === 0 ? "" : `${state.staged} staged`,
13460
13493
  contextLabel(state.context),
@@ -13643,12 +13676,17 @@ var init_render = __esmMin((() => {
13643
13676
  }
13644
13677
  update(state) {
13645
13678
  this.shown = state;
13646
- this.chips = hintsFor(state.screen, state.staged, state.layers.length, state.stop > 0);
13679
+ this.chips = hintsFor(state.screen, {
13680
+ staged: state.staged,
13681
+ layers: state.layers.length,
13682
+ onThread: state.stop > 0,
13683
+ pull: pullHere(state).length > 0
13684
+ });
13647
13685
  this.header.content = this.headerText(state);
13648
13686
  this.footer.content = this.footerText(state);
13649
13687
  this.list.content = this.listText(state);
13650
13688
  const many = state.branches.length === 1 ? "1 worktree" : `${state.branches.length} worktrees`;
13651
- const pane = homeWidth(this.renderer.width);
13689
+ const pane = this.homeRoom(state);
13652
13690
  const room = Math.max(HOME_PATH_MIN, pane - many.length - HOME_PATH_CHROME);
13653
13691
  this.landing.content = `${elide(shortPath(this.repo), room)} · ${many}`;
13654
13692
  this.landingKeys.content = this.homeKeys(state);
@@ -13674,17 +13712,17 @@ var init_render = __esmMin((() => {
13674
13712
  const matches = paletteMatches(state);
13675
13713
  this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
13676
13714
  this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
13677
- const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
13715
+ const room = panelWidth(this.renderer.width);
13678
13716
  this.paletteChoices.options = matches.map((entry) => ({
13679
13717
  name: commandRow(entry, room - MODAL_ROOM),
13680
13718
  description: "",
13681
13719
  value: entry.action
13682
13720
  }));
13683
13721
  this.paletteChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, matches.length - 1));
13684
- this.palette.height = Math.min(PALETTE_MAX, matches.length + PALETTE_CHROME);
13722
+ this.palette.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), matches.length + PALETTE_CHROME);
13685
13723
  this.palette.width = room;
13686
13724
  this.palette.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
13687
- this.palette.top = Math.max(2, Math.floor(this.renderer.height / 4));
13725
+ this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
13688
13726
  }
13689
13727
  paintKeys(state) {
13690
13728
  this.keys.visible = state.screen === "keys";
@@ -13694,7 +13732,7 @@ var init_render = __esmMin((() => {
13694
13732
  return;
13695
13733
  }
13696
13734
  const rows = glossaryFor(state.returnTo);
13697
- const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
13735
+ const room = panelWidth(this.renderer.width);
13698
13736
  this.keysTitle.content = `Every key here, ${rows.length} of them`;
13699
13737
  this.keysChoices.options = rows.map((entry) => ({
13700
13738
  name: commandRow(entry, room - MODAL_ROOM),
@@ -13702,10 +13740,10 @@ var init_render = __esmMin((() => {
13702
13740
  value: entry.action
13703
13741
  }));
13704
13742
  this.keysChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, rows.length - 1));
13705
- this.keys.height = Math.min(PALETTE_MAX, rows.length + PENDING_CHROME);
13743
+ this.keys.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
13706
13744
  this.keys.width = room;
13707
13745
  this.keys.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
13708
- this.keys.top = Math.max(2, Math.floor(this.renderer.height / 4));
13746
+ this.keys.top = panelTop(this.renderer.height, PANEL_QUARTER);
13709
13747
  }
13710
13748
  headerText(state) {
13711
13749
  const branch = selectedBranch(state);
@@ -13781,7 +13819,7 @@ var init_render = __esmMin((() => {
13781
13819
  return;
13782
13820
  }
13783
13821
  const count = state.pending.length;
13784
- const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
13822
+ const room = panelWidth(this.renderer.width);
13785
13823
  this.pendingTitle.content = `Send ${count} comment${count === 1 ? "" : "s"} as one review, waking the agent once`;
13786
13824
  this.pendingChoices.options = state.pending.map((entry) => ({
13787
13825
  name: clip(`${entry.file}:${entry.start}-${entry.end} ${entry.body.split("\n")[0] ?? ""}`, Math.max(1, room - MODAL_ROOM)),
@@ -13789,10 +13827,10 @@ var init_render = __esmMin((() => {
13789
13827
  value: entry.file
13790
13828
  }));
13791
13829
  this.pendingChoices.selectedIndex = state.pendingIndex;
13792
- this.pending.height = Math.min(PALETTE_MAX, state.pending.length + PENDING_CHROME);
13830
+ this.pending.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), state.pending.length + PENDING_CHROME);
13793
13831
  this.pending.width = room;
13794
13832
  this.pending.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
13795
- this.pending.top = Math.max(2, Math.floor(this.renderer.height / 4));
13833
+ this.pending.top = panelTop(this.renderer.height, PANEL_QUARTER);
13796
13834
  }
13797
13835
  assemble(renderer) {
13798
13836
  this.diffScroll.add(this.view.node());
@@ -13840,7 +13878,7 @@ var init_render = __esmMin((() => {
13840
13878
  };
13841
13879
  }
13842
13880
  branchTable(state) {
13843
- const room = nameRoom(homeWidth(this.renderer.width));
13881
+ const room = nameRoom(this.homeRoom(state));
13844
13882
  if (state.branches.length === 0) return new StyledText([fg(palette.muted)(EMPTY_LIST)]);
13845
13883
  const heading = [fg(palette.faint)(`${branchHeading(room)}\n\n`)];
13846
13884
  const rows = state.branches.flatMap((branch, index) => {
@@ -13856,7 +13894,11 @@ var init_render = __esmMin((() => {
13856
13894
  fg(palette.attention)(` ${stateCell(state, branch)}\n`)
13857
13895
  ];
13858
13896
  });
13859
- return new StyledText([...heading, ...rows]);
13897
+ return new StyledText([
13898
+ ...heading,
13899
+ ...rows,
13900
+ ...unaskedForge(state)
13901
+ ]);
13860
13902
  }
13861
13903
  hover(x) {
13862
13904
  let at = 0;
@@ -13871,10 +13913,13 @@ var init_render = __esmMin((() => {
13871
13913
  this.landingKeys.content = this.chipRow();
13872
13914
  if (this.shown !== void 0) this.footer.content = this.footerText(this.shown);
13873
13915
  }
13916
+ homeRoom(state) {
13917
+ return homeWidth(this.renderer.width, longestName(state));
13918
+ }
13874
13919
  homeKeys(state) {
13875
13920
  const said = state.notice.length === 0 ? state.waiting : state.notice;
13876
13921
  const tail = said.length === 0 ? "" : ` ${said}`;
13877
- const room = Math.max(0, homeWidth(this.renderer.width) - tail.length);
13922
+ const room = Math.max(0, this.homeRoom(state) - tail.length);
13878
13923
  const chips = keptWithin(this.chipRow().chunks, room);
13879
13924
  if (tail.length === 0) return new StyledText([...chips]);
13880
13925
  const colour = state.notice.length === 0 ? palette.accent : palette.attention;
@@ -13895,7 +13940,7 @@ var init_render = __esmMin((() => {
13895
13940
  paintPane(state) {
13896
13941
  const onBranches = atHome(state);
13897
13942
  const inset = onBranches ? 0 : 1;
13898
- this.listPane.width = onBranches ? homeWidth(this.renderer.width) : this.paneRoom();
13943
+ this.listPane.width = onBranches ? this.homeRoom(state) : this.paneRoom();
13899
13944
  this.listPane.visible = onBranches || state.navOpen;
13900
13945
  this.listPane.border = onBranches ? [] : ["right"];
13901
13946
  this.listPane.paddingLeft = inset;
@@ -13928,7 +13973,7 @@ var init_render = __esmMin((() => {
13928
13973
  this.foundChoices.options = [];
13929
13974
  return;
13930
13975
  }
13931
- const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
13976
+ const room = panelWidth(this.renderer.width);
13932
13977
  const here = matchHere(state);
13933
13978
  this.foundTitle.content = `${state.term} · ${state.matches.length} elsewhere`;
13934
13979
  this.foundChoices.options = state.matches.map((match) => ({
@@ -13940,10 +13985,10 @@ var init_render = __esmMin((() => {
13940
13985
  this.foundPeek.content = (here?.around ?? []).map((line) => clip(line, Math.max(1, room - MODAL_ROOM))).join("\n");
13941
13986
  const peekRows = here?.around.length ?? 0;
13942
13987
  this.foundPeek.height = peekRows;
13943
- this.found.height = Math.min(PALETTE_MAX, state.matches.length + peekRows + PALETTE_CHROME);
13988
+ this.found.height = Math.min(panelRows(this.renderer.height, PANEL_FIFTH), state.matches.length + peekRows + PALETTE_CHROME);
13944
13989
  this.found.width = room;
13945
13990
  this.found.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
13946
- this.found.top = Math.max(2, Math.floor(this.renderer.height / 5));
13991
+ this.found.top = panelTop(this.renderer.height, PANEL_FIFTH);
13947
13992
  }
13948
13993
  paintReport(state) {
13949
13994
  this.compose.visible = state.screen === "compose" || state.screen === "report";
@@ -14122,7 +14167,7 @@ var init_upgrade = __esmMin((() => {
14122
14167
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
14123
14168
  }).pipe(withSpan("Tui.upgradeHint"));
14124
14169
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
14125
- })), PRINTABLE, KEY_HISTORY, copyToClipboard, asKey, keyName, App, settledPath, launch, told, untilDestroyed, runOn, runTui;
14170
+ })), PRINTABLE, KEY_HISTORY, copyToClipboard, asKey, openedPull, keyName, App, settledPath, launch, told, untilDestroyed, runOn, runTui;
14126
14171
  var init_app = __esmMin((() => {
14127
14172
  init_dist();
14128
14173
  init_report();
@@ -14156,6 +14201,10 @@ var init_app = __esmMin((() => {
14156
14201
  ctrl: false,
14157
14202
  shift: false
14158
14203
  };
14204
+ openedPull = (state, opened) => {
14205
+ if (!opened) return "could not reach the pull request";
14206
+ return state.length === 0 ? "opened the pull request" : `opened the ${state} pull request`;
14207
+ };
14159
14208
  keyName = (key) => {
14160
14209
  const base = key.shift && key.name.length === 1 ? key.name.toUpperCase() : key.name;
14161
14210
  return key.ctrl ? `ctrl+${base}` : base;
@@ -14729,21 +14778,21 @@ var init_app = __esmMin((() => {
14729
14778
  return gen({ self: this }, function* () {
14730
14779
  const branch = selectedBranch(this.state);
14731
14780
  if (branch === void 0) return;
14732
- const state = this.state.pulls[branch.branch];
14733
- if (state === void 0) {
14781
+ if (knownToHaveNoPull(this.state)) {
14734
14782
  this.commit(withNoticeHere(this.state, "no pull request for this branch"));
14735
14783
  return;
14736
14784
  }
14737
- const said = (yield* (yield* map(Forge, (service) => service)).openPull(this.repo, branch.branch).pipe(as(true), catchTag("ForgeUnavailable", () => succeed(false)))) ? `opened the ${state} pull request` : "could not reach the pull request";
14738
- this.commit(withNoticeHere(this.state, said));
14785
+ const opened = yield* (yield* map(Forge, (service) => service)).openPull(this.repo, branch.branch).pipe(as(true), catchTag("ForgeUnavailable", () => succeed(false)));
14786
+ this.commit(withNoticeHere(this.state, openedPull(pullHere(this.state), opened)));
14739
14787
  });
14740
14788
  }
14741
14789
  loadPulls() {
14742
14790
  return gen({ self: this }, function* () {
14743
- const pulls = yield* (yield* map(Forge, (service) => service)).pulls(this.repo).pipe(catchTag("ForgeUnavailable", () => succeed([])));
14744
- if (pulls.length === 0) return;
14745
- const found = Object.fromEntries(pulls.map((pull) => [pull.branch, pull.state]));
14746
- this.commit(withPulls(this.state, found));
14791
+ const answered = yield* (yield* map(Forge, (service) => service)).pulls(this.repo).pipe(map(some), catchTag("ForgeUnavailable", () => succeed(none())));
14792
+ this.commit(match$3(answered, {
14793
+ onNone: () => withSilentForge(this.state),
14794
+ onSome: (pulls) => withPulls(this.state, Object.fromEntries(pulls.map((pull) => [pull.branch, pull.state])))
14795
+ }));
14747
14796
  });
14748
14797
  }
14749
14798
  loadSource() {
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.44",
26
+ "version": "0.1.0-alpha.45",
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": {