@eliya-oss/agent-diff 0.1.0-alpha.36 → 0.1.0-alpha.38

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,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.38
4
+
5
+ ### Patch Changes
6
+
7
+ - adiff --version answers from a version built into the bundle rather than a package.json found beside it, and a Bun runtime opens the terminal itself instead of going looking for a Node it does not need.
8
+
9
+ ## 0.1.0-alpha.37
10
+
11
+ ### Patch Changes
12
+
13
+ - The footer carries the keys a review is made of, and ? lists every key the screen answers to.
14
+
3
15
  ## 0.1.0-alpha.36
4
16
 
5
17
  ### Patch Changes
package/bin/adiff.js CHANGED
@@ -33,8 +33,9 @@ const drawsTerminal = (argv) => {
33
33
  }
34
34
 
35
35
  const rendersHere = () =>
36
- typeof process.getBuiltinModule === "function" &&
37
- process.getBuiltinModule("node:ffi") !== undefined
36
+ process.versions.bun !== undefined ||
37
+ (typeof process.getBuiltinModule === "function" &&
38
+ process.getBuiltinModule("node:ffi") !== undefined)
38
39
 
39
40
  const NODE_DIRECTORY = /^(?:v?\d|node)/
40
41
 
package/dist/main.js CHANGED
@@ -8635,13 +8635,13 @@ var init_commands = __esmMin((() => {
8635
8635
  }));
8636
8636
  //#endregion
8637
8637
  //#region src/cli/init.ts
8638
- var BEGIN, END, REACH$1, INSTRUCTIONS, IMPORT, blockIn, replaced, appended, planFor, readAt, writeAt, settle, skillSource, shippedSkill, settleSkill, initRepository;
8638
+ var BEGIN, END, REACH, INSTRUCTIONS, IMPORT, blockIn, replaced, appended, planFor, readAt, writeAt, settle, skillSource, shippedSkill, settleSkill, initRepository;
8639
8639
  var init_init = __esmMin((() => {
8640
8640
  init_dist();
8641
8641
  init_error$1();
8642
8642
  BEGIN = "<!-- adiff:begin -->";
8643
8643
  END = "<!-- adiff:end -->";
8644
- REACH$1 = 5;
8644
+ REACH = 5;
8645
8645
  INSTRUCTIONS = [
8646
8646
  BEGIN,
8647
8647
  "## Review",
@@ -8716,7 +8716,7 @@ var init_init = __esmMin((() => {
8716
8716
  });
8717
8717
  skillSource = () => {
8718
8718
  const here = dirname(fileURLToPath(import.meta.url));
8719
- return Array.from({ length: REACH$1 }, (_, layer) => join(here, ...Array(layer).fill(".."))).map((at) => join(at, "skills", "adiff", "SKILL.md")).find((path) => existsSync(path));
8719
+ return Array.from({ length: REACH }, (_, layer) => join(here, ...Array(layer).fill(".."))).map((at) => join(at, "skills", "adiff", "SKILL.md")).find((path) => existsSync(path));
8720
8720
  };
8721
8721
  shippedSkill = fn("Cli.shippedSkill")(function* () {
8722
8722
  const source = skillSource();
@@ -9837,21 +9837,14 @@ var init_cli = __esmMin((() => {
9837
9837
  init_error$1();
9838
9838
  }));
9839
9839
  //#endregion
9840
- //#region src/cli/help.ts
9840
+ //#region package.json
9841
9841
  init_cli();
9842
+ var version$1 = "0.1.0-alpha.38";
9843
+ //#endregion
9844
+ //#region src/cli/help.ts
9842
9845
  init_catalog();
9843
9846
  const NAME_ROOM = 18;
9844
- const REACH = 5;
9845
- const manifest = () => {
9846
- const here = dirname(fileURLToPath(import.meta.url));
9847
- return Array.from({ length: REACH }, (_, layer) => join(here, ...Array(layer).fill(".."))).map((at) => join(at, "package.json")).find((path) => existsSync(path));
9848
- };
9849
- const version = () => {
9850
- const path = manifest();
9851
- if (path === void 0) return "unknown";
9852
- const raw = readFileSync(path, "utf8");
9853
- return JSON.parse(raw).version ?? "unknown";
9854
- };
9847
+ const version = () => version$1;
9855
9848
  const line = (command) => ` ${command.name.padEnd(NAME_ROOM)}${command.about}`;
9856
9849
  const banner = () => [
9857
9850
  `adiff ${version()}`,
@@ -10750,7 +10743,7 @@ var init_watch = __esmMin((() => {
10750
10743
  }));
10751
10744
  //#endregion
10752
10745
  //#region src/tui/command.ts
10753
- var command, commands, TEXT_SCREENS, PRINTABLE_KEY, takesText, commandsFor, listableFor, actionFor, GLYPHS, displayKey, hintsFor;
10746
+ var command, commands, TEXT_SCREENS, PRINTABLE_KEY, takesText, commandsFor, listableFor, glossaryFor, actionFor, GLYPHS, displayKey, hintsFor;
10754
10747
  var init_command = __esmMin((() => {
10755
10748
  command = (input) => ({
10756
10749
  category: "Review",
@@ -10760,6 +10753,7 @@ var init_command = __esmMin((() => {
10760
10753
  counted: false,
10761
10754
  whenLayers: false,
10762
10755
  whenThread: false,
10756
+ rank: 0,
10763
10757
  ...input
10764
10758
  });
10765
10759
  commands = [
@@ -10769,7 +10763,8 @@ var init_command = __esmMin((() => {
10769
10763
  category: "Branches",
10770
10764
  keys: ["down", "j"],
10771
10765
  screens: ["branches"],
10772
- hint: "move"
10766
+ hint: "move",
10767
+ rank: 1
10773
10768
  }),
10774
10769
  command({
10775
10770
  action: "branch.prev",
@@ -10784,7 +10779,8 @@ var init_command = __esmMin((() => {
10784
10779
  category: "Branches",
10785
10780
  keys: ["return"],
10786
10781
  screens: ["branches"],
10787
- hint: "review"
10782
+ hint: "review",
10783
+ rank: 2
10788
10784
  }),
10789
10785
  command({
10790
10786
  action: "branch.pull",
@@ -10798,8 +10794,7 @@ var init_command = __esmMin((() => {
10798
10794
  action: "cursor.next",
10799
10795
  title: "Next line",
10800
10796
  keys: ["down", "j"],
10801
- screens: ["review"],
10802
- hint: "line"
10797
+ screens: ["review"]
10803
10798
  }),
10804
10799
  command({
10805
10800
  action: "cursor.prev",
@@ -10848,7 +10843,6 @@ var init_command = __esmMin((() => {
10848
10843
  title: "Next comment",
10849
10844
  keys: ["n"],
10850
10845
  screens: ["review"],
10851
- hint: "next comment",
10852
10846
  whenStaged: true
10853
10847
  }),
10854
10848
  command({
@@ -10875,7 +10869,8 @@ var init_command = __esmMin((() => {
10875
10869
  category: "Files",
10876
10870
  keys: ["]"],
10877
10871
  screens: ["review"],
10878
- hint: "file"
10872
+ hint: "file",
10873
+ rank: 1
10879
10874
  }),
10880
10875
  command({
10881
10876
  action: "file.prev",
@@ -10896,8 +10891,7 @@ var init_command = __esmMin((() => {
10896
10891
  title: "Hide the file list",
10897
10892
  category: "General",
10898
10893
  keys: ["z", "\\"],
10899
- screens: ["review"],
10900
- hint: "zoom"
10894
+ screens: ["review"]
10901
10895
  }),
10902
10896
  command({
10903
10897
  action: "branch.first",
@@ -10923,23 +10917,20 @@ var init_command = __esmMin((() => {
10923
10917
  action: "selection.copy",
10924
10918
  title: "Copy the selection",
10925
10919
  keys: ["y"],
10926
- screens: ["review"],
10927
- hint: "copy"
10920
+ screens: ["review"]
10928
10921
  }),
10929
10922
  command({
10930
10923
  action: "search.open",
10931
10924
  title: "Find the selection elsewhere",
10932
10925
  keys: ["/"],
10933
- screens: ["review"],
10934
- hint: "find"
10926
+ screens: ["review"]
10935
10927
  }),
10936
10928
  command({
10937
10929
  action: "match.next",
10938
10930
  title: "Next match",
10939
10931
  category: "Search",
10940
10932
  keys: ["j", "down"],
10941
- screens: ["search"],
10942
- hint: "move"
10933
+ screens: ["search"]
10943
10934
  }),
10944
10935
  command({
10945
10936
  action: "match.prev",
@@ -10954,7 +10945,8 @@ var init_command = __esmMin((() => {
10954
10945
  category: "Search",
10955
10946
  keys: ["return"],
10956
10947
  screens: ["search"],
10957
- hint: "open"
10948
+ hint: "open",
10949
+ rank: 2
10958
10950
  }),
10959
10951
  command({
10960
10952
  action: "select.swap",
@@ -10967,8 +10959,7 @@ var init_command = __esmMin((() => {
10967
10959
  title: "Wrap long lines",
10968
10960
  category: "General",
10969
10961
  keys: ["w"],
10970
- screens: ["review"],
10971
- hint: "wrap"
10962
+ screens: ["review"]
10972
10963
  }),
10973
10964
  command({
10974
10965
  action: "pan.right",
@@ -10982,13 +10973,21 @@ var init_command = __esmMin((() => {
10982
10973
  keys: ["<"],
10983
10974
  screens: ["review"]
10984
10975
  }),
10976
+ command({
10977
+ action: "review.reload",
10978
+ title: "Read the worktrees again",
10979
+ category: "Branches",
10980
+ keys: ["r"],
10981
+ screens: ["branches"],
10982
+ hint: "reload",
10983
+ rank: 3
10984
+ }),
10985
10985
  command({
10986
10986
  action: "review.reload",
10987
10987
  title: "Read the branch again",
10988
10988
  category: "Review",
10989
10989
  keys: ["r"],
10990
- screens: ["branches", "review"],
10991
- hint: "reload"
10990
+ screens: ["review"]
10992
10991
  }),
10993
10992
  command({
10994
10993
  action: "thread.settle",
@@ -11013,6 +11012,7 @@ var init_command = __esmMin((() => {
11013
11012
  keys: ["s"],
11014
11013
  screens: ["review"],
11015
11014
  hint: "layers",
11015
+ rank: 2,
11016
11016
  whenLayers: true
11017
11017
  }),
11018
11018
  command({
@@ -11035,7 +11035,8 @@ var init_command = __esmMin((() => {
11035
11035
  category: "Files",
11036
11036
  keys: ["m"],
11037
11037
  screens: ["review"],
11038
- hint: "reviewed"
11038
+ hint: "reviewed",
11039
+ rank: 2
11039
11040
  }),
11040
11041
  command({
11041
11042
  action: "file.vouch.next",
@@ -11049,14 +11050,16 @@ var init_command = __esmMin((() => {
11049
11050
  title: "Start a selection",
11050
11051
  keys: ["v"],
11051
11052
  screens: ["review"],
11052
- hint: "select"
11053
+ hint: "select",
11054
+ rank: 3
11053
11055
  }),
11054
11056
  command({
11055
11057
  action: "compose.open",
11056
11058
  title: "Comment on the selection",
11057
11059
  keys: ["c", "return"],
11058
11060
  screens: ["review"],
11059
- hint: "comment"
11061
+ hint: "comment",
11062
+ rank: 4
11060
11063
  }),
11061
11064
  command({
11062
11065
  action: "report.open",
@@ -11079,7 +11082,6 @@ var init_command = __esmMin((() => {
11079
11082
  category: "General",
11080
11083
  keys: ["ctrl+p"],
11081
11084
  screens: ["review", "pending"],
11082
- hint: "commands",
11083
11085
  listed: false
11084
11086
  }),
11085
11087
  command({
@@ -11097,7 +11099,8 @@ var init_command = __esmMin((() => {
11097
11099
  screens: ["review"],
11098
11100
  hint: "send",
11099
11101
  whenStaged: true,
11100
- counted: true
11102
+ counted: true,
11103
+ rank: 6
11101
11104
  }),
11102
11105
  command({
11103
11106
  action: "pending.submit",
@@ -11105,7 +11108,8 @@ var init_command = __esmMin((() => {
11105
11108
  keys: ["ctrl+s"],
11106
11109
  screens: ["pending"],
11107
11110
  hint: "send",
11108
- listed: false
11111
+ listed: false,
11112
+ rank: 2
11109
11113
  }),
11110
11114
  command({
11111
11115
  action: "pending.edit",
@@ -11113,7 +11117,8 @@ var init_command = __esmMin((() => {
11113
11117
  category: "Review",
11114
11118
  keys: ["e"],
11115
11119
  screens: ["pending"],
11116
- hint: "reword"
11120
+ hint: "reword",
11121
+ rank: 3
11117
11122
  }),
11118
11123
  command({
11119
11124
  action: "pending.drop",
@@ -11121,7 +11126,8 @@ var init_command = __esmMin((() => {
11121
11126
  category: "Review",
11122
11127
  keys: ["X"],
11123
11128
  screens: ["pending"],
11124
- hint: "withdraw"
11129
+ hint: "withdraw",
11130
+ rank: 4
11125
11131
  }),
11126
11132
  command({
11127
11133
  action: "pending.next",
@@ -11156,10 +11162,41 @@ var init_command = __esmMin((() => {
11156
11162
  action: "palette.run",
11157
11163
  title: "Run the highlighted command",
11158
11164
  keys: ["return"],
11159
- screens: ["palette"],
11165
+ screens: ["palette", "keys"],
11160
11166
  hint: "run",
11161
11167
  listed: false
11162
11168
  }),
11169
+ command({
11170
+ action: "keys.open",
11171
+ title: "List every key",
11172
+ category: "General",
11173
+ keys: ["?"],
11174
+ screens: [
11175
+ "branches",
11176
+ "review",
11177
+ "pending",
11178
+ "search"
11179
+ ],
11180
+ hint: "keys",
11181
+ rank: 5,
11182
+ listed: false
11183
+ }),
11184
+ command({
11185
+ action: "keys.next",
11186
+ title: "Next key",
11187
+ category: "General",
11188
+ keys: ["down", "j"],
11189
+ screens: ["keys"],
11190
+ listed: false
11191
+ }),
11192
+ command({
11193
+ action: "keys.prev",
11194
+ title: "Previous key",
11195
+ category: "General",
11196
+ keys: ["up", "k"],
11197
+ screens: ["keys"],
11198
+ listed: false
11199
+ }),
11163
11200
  command({
11164
11201
  action: "back",
11165
11202
  title: "Go back",
@@ -11171,10 +11208,12 @@ var init_command = __esmMin((() => {
11171
11208
  "palette",
11172
11209
  "pending",
11173
11210
  "report",
11174
- "search"
11211
+ "search",
11212
+ "keys"
11175
11213
  ],
11176
11214
  hint: "back",
11177
- listed: false
11215
+ listed: false,
11216
+ rank: 9
11178
11217
  }),
11179
11218
  command({
11180
11219
  action: "quit",
@@ -11183,7 +11222,8 @@ var init_command = __esmMin((() => {
11183
11222
  keys: ["q"],
11184
11223
  screens: ["branches"],
11185
11224
  hint: "quit",
11186
- listed: false
11225
+ listed: false,
11226
+ rank: 9
11187
11227
  })
11188
11228
  ];
11189
11229
  TEXT_SCREENS = /* @__PURE__ */ new Set([
@@ -11195,6 +11235,7 @@ var init_command = __esmMin((() => {
11195
11235
  takesText = (screen) => TEXT_SCREENS.has(screen);
11196
11236
  commandsFor = (screen) => commands.filter((entry) => entry.screens.includes(screen));
11197
11237
  listableFor = (screen) => commandsFor(screen).filter((entry) => entry.listed);
11238
+ glossaryFor = (screen) => commandsFor(screen).toSorted((left, right) => left.category.localeCompare(right.category) || left.title.localeCompare(right.title));
11198
11239
  actionFor = (screen, key) => {
11199
11240
  if (takesText(screen) && PRINTABLE_KEY.test(key)) return void 0;
11200
11241
  return commandsFor(screen).find((entry) => entry.keys.includes(key))?.action;
@@ -11213,7 +11254,7 @@ var init_command = __esmMin((() => {
11213
11254
  if (key.startsWith("ctrl+")) return `^${key.slice(5)}`;
11214
11255
  return GLYPHS[key] ?? key;
11215
11256
  };
11216
- 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).map((entry) => ({
11257
+ 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) => ({
11217
11258
  key: displayKey(entry.keys[0] ?? ""),
11218
11259
  hint: entry.counted ? `${entry.hint} ${staged}` : entry.hint,
11219
11260
  press: entry.keys[0] ?? ""
@@ -11246,10 +11287,11 @@ var init_match = __esmMin((() => {
11246
11287
  }));
11247
11288
  //#endregion
11248
11289
  //#region src/tui/reduce.ts
11249
- 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, movePalette, paletteMatches, 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;
11290
+ 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;
11250
11291
  var init_reduce = __esmMin((() => {
11251
11292
  init_dist();
11252
11293
  init_patch();
11294
+ init_command();
11253
11295
  init_gaps();
11254
11296
  init_match();
11255
11297
  init_model();
@@ -11483,6 +11525,10 @@ var init_reduce = __esmMin((() => {
11483
11525
  screen: state.returnTo,
11484
11526
  query: ""
11485
11527
  };
11528
+ if (state.screen === "keys") return {
11529
+ ...state,
11530
+ screen: state.returnTo
11531
+ };
11486
11532
  if (state.screen === "compose") return {
11487
11533
  ...state,
11488
11534
  screen: "review",
@@ -11510,12 +11556,20 @@ var init_reduce = __esmMin((() => {
11510
11556
  query: "",
11511
11557
  paletteIndex: 0
11512
11558
  });
11559
+ openKeys = (state) => ({
11560
+ ...state,
11561
+ screen: "keys",
11562
+ returnTo: state.screen,
11563
+ query: "",
11564
+ paletteIndex: 0
11565
+ });
11513
11566
  movePalette = (state, delta) => ({
11514
11567
  ...state,
11515
- paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, paletteMatches(state).length - 1))
11568
+ paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, offered(state).length - 1))
11516
11569
  });
11517
11570
  paletteMatches = (state) => searchCommands(state.returnTo, state.query);
11518
- paletteChoice = (state) => paletteMatches(state)[state.paletteIndex]?.action;
11571
+ offered = (state) => state.screen === "keys" ? glossaryFor(state.returnTo) : paletteMatches(state);
11572
+ paletteChoice = (state) => offered(state)[state.paletteIndex]?.action;
11519
11573
  transitions = {
11520
11574
  "branch.first": (state) => atBranch(state, 0),
11521
11575
  "branch.last": (state) => atBranch(state, state.branches.length - 1),
@@ -11586,6 +11640,9 @@ var init_reduce = __esmMin((() => {
11586
11640
  }),
11587
11641
  "report.send": (state) => state,
11588
11642
  "palette.open": openPalette,
11643
+ "keys.open": openKeys,
11644
+ "keys.next": (state) => movePalette(state, 1),
11645
+ "keys.prev": (state) => movePalette(state, -1),
11589
11646
  "palette.run": (state) => state,
11590
11647
  "search.open": (state) => state,
11591
11648
  "search.jump": (state) => state,
@@ -12367,7 +12424,7 @@ var init_diffview = __esmMin((() => {
12367
12424
  }));
12368
12425
  //#endregion
12369
12426
  //#region src/tui/render.ts
12370
- 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_TITLE, 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, 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, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, 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, 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;
12427
+ 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, 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, 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;
12371
12428
  var init_render = __esmMin((() => {
12372
12429
  init_command();
12373
12430
  init_patch();
@@ -12390,7 +12447,9 @@ var init_render = __esmMin((() => {
12390
12447
  reportActions = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("copy and save")}`;
12391
12448
  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")}`;
12392
12449
  SNIPPET_LINES = 4;
12450
+ PALETTE_KEY = 7;
12393
12451
  PALETTE_TITLE = 34;
12452
+ PALETTE_GAP = 2;
12394
12453
  PALETTE_MAX = 18;
12395
12454
  PALETTE_CHROME = 4;
12396
12455
  PENDING_CHROME = 3;
@@ -12414,6 +12473,11 @@ var init_render = __esmMin((() => {
12414
12473
  return Math.max(0, Math.min(wanted, room - DIFF_MIN));
12415
12474
  };
12416
12475
  homeWidth = (width) => Math.max(0, Math.min(BRANCH_WIDTH, width - 2));
12476
+ commandRow = (entry, room) => {
12477
+ const key = clip(displayKey(entry.keys[0] ?? ""), 5).padEnd(PALETTE_KEY);
12478
+ const left = Math.max(1, Math.min(PALETTE_TITLE, room - PALETTE_KEY - entry.category.length - PALETTE_GAP));
12479
+ return `${key}${clip(entry.title, left - PALETTE_GAP).padEnd(left)}${entry.category}`;
12480
+ };
12417
12481
  modalWidth = (width, wanted) => Math.max(0, Math.min(wanted, width - MODAL_MARGIN));
12418
12482
  composeRoom = (width) => {
12419
12483
  const box = modalWidth(width, COMPOSE_WIDTH);
@@ -12592,8 +12656,15 @@ var init_render = __esmMin((() => {
12592
12656
  makeModals = (renderer) => ({
12593
12657
  palette: makePaletteParts(renderer),
12594
12658
  staged: makePendingParts(renderer),
12595
- found: makeFoundParts(renderer)
12659
+ found: makeFoundParts(renderer),
12660
+ keys: makeKeysParts(renderer)
12596
12661
  });
12662
+ makeKeysParts = (renderer) => {
12663
+ const parts = makePaletteParts(renderer);
12664
+ parts.box.id = "keys";
12665
+ parts.query.height = 0;
12666
+ return parts;
12667
+ };
12597
12668
  makeFoundParts = (renderer) => {
12598
12669
  const box = makePalette(renderer);
12599
12670
  const title = bar(renderer, "found-title", palette.faint);
@@ -12763,7 +12834,7 @@ var init_render = __esmMin((() => {
12763
12834
  layers: "LAYERS",
12764
12835
  state: "STATE"
12765
12836
  }, room)}`;
12766
- atHome = (state) => state.screen === "branches" || state.screen === "palette" && state.returnTo === "branches";
12837
+ atHome = (state) => state.screen === "branches" || (state.screen === "palette" || state.screen === "keys") && state.returnTo === "branches";
12767
12838
  layersCell = (branch) => {
12768
12839
  if (branch.layers === 0) return "";
12769
12840
  return branch.stale ? `${branch.layers} stale` : `${branch.layers} layers`;
@@ -12872,6 +12943,9 @@ var init_render = __esmMin((() => {
12872
12943
  paletteQuery;
12873
12944
  paletteChoices;
12874
12945
  pending;
12946
+ keys;
12947
+ keysTitle;
12948
+ keysChoices;
12875
12949
  pendingTitle;
12876
12950
  pendingChoices;
12877
12951
  found;
@@ -12915,6 +12989,9 @@ var init_render = __esmMin((() => {
12915
12989
  this.paletteTitle = modals.palette.title;
12916
12990
  this.paletteQuery = modals.palette.query;
12917
12991
  this.paletteChoices = modals.palette.choices;
12992
+ this.keys = modals.keys.box;
12993
+ this.keysTitle = modals.keys.title;
12994
+ this.keysChoices = modals.keys.choices;
12918
12995
  this.pending = modals.staged.box;
12919
12996
  this.pendingTitle = modals.staged.title;
12920
12997
  this.pendingChoices = modals.staged.choices;
@@ -12967,11 +13044,12 @@ var init_render = __esmMin((() => {
12967
13044
  const room = Math.max(HOME_PATH_MIN, pane - many.length - HOME_PATH_CHROME);
12968
13045
  this.landing.content = `${elide(shortPath(this.repo), room)} · ${many}`;
12969
13046
  this.landingKeys.content = this.homeKeys(state);
12970
- this.diffPane.visible = state.screen !== "branches" && !(state.screen === "palette" && state.returnTo === "branches");
13047
+ this.diffPane.visible = state.screen !== "branches" && !atHome(state);
12971
13048
  if (this.diffPane.visible) this.paintDiff(state);
12972
13049
  this.paintPane(state);
12973
13050
  this.paintCompose(state);
12974
13051
  this.paintPalette(state);
13052
+ this.paintKeys(state);
12975
13053
  this.paintPending(state);
12976
13054
  this.paintFound(state);
12977
13055
  this.paintReport(state);
@@ -12988,18 +13066,39 @@ var init_render = __esmMin((() => {
12988
13066
  const matches = paletteMatches(state);
12989
13067
  this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
12990
13068
  this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
13069
+ const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
12991
13070
  this.paletteChoices.options = matches.map((entry) => ({
12992
- name: `${clip(entry.title, 32).padEnd(PALETTE_TITLE)}${entry.category}`,
13071
+ name: commandRow(entry, room - MODAL_ROOM),
12993
13072
  description: "",
12994
13073
  value: entry.action
12995
13074
  }));
12996
- const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
12997
13075
  this.paletteChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, matches.length - 1));
12998
13076
  this.palette.height = Math.min(PALETTE_MAX, matches.length + PALETTE_CHROME);
12999
13077
  this.palette.width = room;
13000
13078
  this.palette.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
13001
13079
  this.palette.top = Math.max(2, Math.floor(this.renderer.height / 4));
13002
13080
  }
13081
+ paintKeys(state) {
13082
+ this.keys.visible = state.screen === "keys";
13083
+ if (state.screen !== "keys") {
13084
+ this.keysTitle.content = "";
13085
+ this.keysChoices.options = [];
13086
+ return;
13087
+ }
13088
+ const rows = glossaryFor(state.returnTo);
13089
+ const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
13090
+ this.keysTitle.content = `Every key here, ${rows.length} of them`;
13091
+ this.keysChoices.options = rows.map((entry) => ({
13092
+ name: commandRow(entry, room - MODAL_ROOM),
13093
+ description: "",
13094
+ value: entry.action
13095
+ }));
13096
+ this.keysChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, rows.length - 1));
13097
+ this.keys.height = Math.min(PALETTE_MAX, rows.length + PENDING_CHROME);
13098
+ this.keys.width = room;
13099
+ this.keys.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
13100
+ this.keys.top = Math.max(2, Math.floor(this.renderer.height / 4));
13101
+ }
13003
13102
  headerText(state) {
13004
13103
  const branch = selectedBranch(state);
13005
13104
  if (atHome(state)) return t`${fg(palette.faint)("")}`;
@@ -13109,7 +13208,8 @@ var init_render = __esmMin((() => {
13109
13208
  this.compose,
13110
13209
  this.palette,
13111
13210
  this.pending,
13112
- this.found
13211
+ this.found,
13212
+ this.keys
13113
13213
  ]);
13114
13214
  }
13115
13215
  watchChips() {
@@ -13163,11 +13263,13 @@ var init_render = __esmMin((() => {
13163
13263
  if (this.shown !== void 0) this.footer.content = this.footerText(this.shown);
13164
13264
  }
13165
13265
  homeKeys(state) {
13166
- const chips = this.chipRow().chunks;
13167
13266
  const said = state.notice.length === 0 ? state.waiting : state.notice;
13168
- if (said.length === 0) return new StyledText(chips);
13267
+ const tail = said.length === 0 ? "" : ` ${said}`;
13268
+ const room = Math.max(0, homeWidth(this.renderer.width) - tail.length);
13269
+ const chips = keptWithin(this.chipRow().chunks, room);
13270
+ if (tail.length === 0) return new StyledText([...chips]);
13169
13271
  const colour = state.notice.length === 0 ? palette.accent : palette.attention;
13170
- return new StyledText([...chips, fg(colour)(` ${said}`)]);
13272
+ return new StyledText([...chips, fg(colour)(tail)]);
13171
13273
  }
13172
13274
  chipRow() {
13173
13275
  return new StyledText(this.chips.flatMap((chip, index) => {
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.36",
26
+ "version": "0.1.0-alpha.38",
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": {