@eliya-oss/agent-diff 0.1.0-alpha.137 → 0.1.0-alpha.139

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.
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: create-pr
3
+ description: Open or update an adiff pull request — a short body, a change intent, and a recording of every test the branch adds, embedded inline via GitHub user-attachments. Use when asked to create, update or fix up a PR in this repository.
4
+ ---
5
+
6
+ # Create an adiff PR
7
+
8
+ Load `release-notes` first and apply every rule in it: the change intent shape, the `kind(area):`
9
+ sentence, the no-gerund rule, and what never goes in a body. Everything here is additive.
10
+
11
+ A reviewer of an adiff PR wants two things: one line saying what changed, and a moving picture of it
12
+ working. The body carries the first. `pnpm record` carries the second.
13
+
14
+ ## One command
15
+
16
+ ```bash
17
+ pnpm record
18
+ ```
19
+
20
+ It reads the test files this branch changed against `origin/main`, runs them with tracing on, and for
21
+ each test builds its world into a real repository, boots adiff in a real terminal, replays the keys
22
+ the test pressed, encodes an mp4 and uploads it. It prints a finished `## Recorded tests` section.
23
+ Paste that under the body.
24
+
25
+ `pnpm record --test <path>` records one file instead of the whole branch.
26
+
27
+ A recording narrates itself, so somebody who has never opened adiff can follow it:
28
+
29
+ - it opens on a title card carrying the test's `when` and `then`
30
+ - each step is held for a second, with a band naming it in plain words — `open the branch`,
31
+ `leave a comment saying "worth a second look"` — and a key cap in the corner showing the key as it
32
+ is pressed, so the caption, the key and what happens on screen line up
33
+ - every `expect` stops the screen, rings the pane it is about, and says the claim as a sentence:
34
+ `the review panel contains worth a second look`
35
+
36
+ The sentence names its own subject, which is why it needs no label. Assertions running one after
37
+ another with nothing in between share a beat and the band lists them; assertions separated by
38
+ something the reviewer does each get their own. `--pace <ms>` and `--hold <ms>` change the timings.
39
+
40
+ The ring comes from the view accessor the assertion read — `reviewPanel()` rings the review panel,
41
+ `focus()` rings whichever pane the keys reach. An assertion about no single region, such as which
42
+ panes are on screen, gets the sentence and no ring.
43
+
44
+ For the caption to appear, the test must take `expect` from the testing barrel rather than from
45
+ vitest directly. A test that does not still records; it just has no captions.
46
+
47
+ The recording is driven by the test's own trace, so it cannot show something the test does not do. If
48
+ a test fails, nothing is recorded — a green run is the precondition, not a claim to make in prose.
49
+
50
+ ## What gets recorded
51
+
52
+ Every test the branch adds, one recording each, not a representative sample. Skip only when the
53
+ branch changes nothing a reviewer could see: a refactor, a type, a script, a document.
54
+
55
+ A test that presses no keys produces no recording, which is the right answer for a pure CLI or store
56
+ test. Do not invent keystrokes to make one.
57
+
58
+ ## The section it prints
59
+
60
+ ```markdown
61
+ ## Recorded tests
62
+
63
+ - when the review panel is opened
64
+
65
+ <details>
66
+ <summary><code>then the keys are already on the comments</code></summary>
67
+
68
+ <bare user-attachments URL>
69
+
70
+ </details>
71
+ ```
72
+
73
+ The `describe` is the plain-text list item and the `test` is the summary of a `<details>` nested
74
+ under it, indented two spaces so it stays inside the item. Two tests under one `when` share the list
75
+ item.
76
+
77
+ Leave the URL bare. GitHub wraps a player around a user-attachments URL on its own line; image
78
+ markdown (`![…](…)`) around a video renders nothing. The summary is the test title only — no
79
+ duration, no dimensions, no file size.
80
+
81
+ ## Where it goes
82
+
83
+ After the prose and after `## What changed`, before anything else. A reviewer reads what changed,
84
+ then watches it.
85
+
86
+ ## Nothing private, ever
87
+
88
+ This repository is public and so is every attachment. `pnpm record` is safe by construction: it
89
+ builds each world from the test's own fixture, which is invented code in an invented repository, and
90
+ it never opens a real one. Keep it that way — never point a capture at a real checkout, and never
91
+ paste a branch name, path, ticket id or line of source from private work into a body.
92
+
93
+ An attachment cannot be deleted once uploaded.
94
+
95
+ ## Before it will work
96
+
97
+ ```bash
98
+ cargo install --locked terminal-control # once
99
+ gh extension install drogers0/gh-image # once, then `gh image check-token`
100
+ ```
101
+
102
+ `termctrl` lives in `~/.cargo/bin`, which is not always on the PATH of a non-interactive shell.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.139
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(preferences): `,` opens a screen listing what adiff does, and turns any of it on or off.
8
+
9
+ ## 0.1.0-alpha.138
10
+
11
+ ### Patch Changes
12
+
13
+ - fix(review panel): the cursor keeps its place when you settle a thread, so the next one comes to it.
14
+
15
+ <details><summary>What was wrong</summary>
16
+
17
+ Settling followed the thread into the Settled section at the bottom of the panel, so closing a
18
+ column of threads meant walking back up to the top after every one.
19
+
20
+ </details>
21
+
22
+ fix(keys): tab moves to the next pane on the screen instead of bringing the file list back.
23
+
24
+ <details><summary>What was wrong</summary>
25
+
26
+ Hiding the file list with `t` and then pressing tab reopened it, so there was no way to move
27
+ between the diff and the review panel with the room the file list had been taking.
28
+
29
+ </details>
30
+
3
31
  ## 0.1.0-alpha.137
4
32
 
5
33
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10164,37 +10164,44 @@ var init_model$2 = __esmMin((() => {
10164
10164
  preferences = [
10165
10165
  {
10166
10166
  name: "wrap",
10167
- about: "Wrap long lines instead of cutting them at the edge",
10167
+ title: "Wrap long lines",
10168
+ about: "Long lines wrap instead of running off the edge.",
10168
10169
  byDefault: false
10169
10170
  },
10170
10171
  {
10171
10172
  name: "sticky",
10172
- about: "Keep the heading of what you are reading in view while you scroll",
10173
+ title: "Keep the heading in view",
10174
+ about: "The class or function you are inside stays pinned as you scroll.",
10173
10175
  byDefault: true
10174
10176
  },
10175
10177
  {
10176
10178
  name: "panel",
10177
- about: "Show the review panel beside the diff",
10179
+ title: "Show the review panel",
10180
+ about: "Comments sit in their own pane beside the diff.",
10178
10181
  byDefault: true
10179
10182
  },
10180
10183
  {
10181
10184
  name: "hideReviewed",
10182
- about: "Leave files you have marked reviewed out of the file list",
10185
+ title: "Hide files already read",
10186
+ about: "The file list shows only what you have not read yet.",
10183
10187
  byDefault: false
10184
10188
  },
10185
10189
  {
10186
10190
  name: "hideSettled",
10187
- about: "Leave threads you have settled out of the review panel",
10191
+ title: "Hide threads already settled",
10192
+ about: "The review panel shows only threads still open.",
10188
10193
  byDefault: false
10189
10194
  },
10190
10195
  {
10191
10196
  name: "newestFirst",
10192
- about: "Read the review newest first, rather than oldest first",
10197
+ title: "Read the newest comment first",
10198
+ about: "The newest comment sits at the top of the panel.",
10193
10199
  byDefault: true
10194
10200
  },
10195
10201
  {
10196
10202
  name: "hold",
10197
- about: "Hold comments until you send them together, rather than sending each as it is written",
10203
+ title: "Hold comments until you send them",
10204
+ about: "Comments wait until you send them together, rather than going one at a time.",
10198
10205
  byDefault: false
10199
10206
  }
10200
10207
  ];
@@ -11098,7 +11105,7 @@ var init_pane = __esmMin((() => {
11098
11105
  init_drafts();
11099
11106
  init_init();
11100
11107
  init_pane();
11101
- var version$1 = "0.1.0-alpha.137";
11108
+ var version$1 = "0.1.0-alpha.139";
11102
11109
  //#endregion
11103
11110
  //#region src/cli/upgrade.ts
11104
11111
  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, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -12094,7 +12101,7 @@ var init_catalog = __esmMin((() => {
12094
12101
  baseOf
12095
12102
  ],
12096
12103
  dataKey: "",
12097
- example: "adiff review open --repo . --branch cdr-1"
12104
+ example: "adiff review open --repo . --branch add-invitations"
12098
12105
  },
12099
12106
  {
12100
12107
  name: "review pane",
@@ -12133,7 +12140,7 @@ var init_catalog = __esmMin((() => {
12133
12140
  about: "Ref to diff this branch against"
12134
12141
  }],
12135
12142
  dataKey: "base",
12136
- example: "adiff base set --repo . --branch cdr-2 --base cdr-1"
12143
+ example: "adiff base set --repo . --branch add-invite-emails --base add-invitations"
12137
12144
  },
12138
12145
  {
12139
12146
  name: "base clear",
@@ -12143,7 +12150,7 @@ var init_catalog = __esmMin((() => {
12143
12150
  safety: "write",
12144
12151
  options: [...addressing],
12145
12152
  dataKey: "base",
12146
- example: "adiff base clear --repo . --branch cdr-2"
12153
+ example: "adiff base clear --repo . --branch add-invite-emails"
12147
12154
  },
12148
12155
  {
12149
12156
  name: "review progress",
@@ -12153,7 +12160,7 @@ var init_catalog = __esmMin((() => {
12153
12160
  safety: "read",
12154
12161
  options: [...based],
12155
12162
  dataKey: "reviewed",
12156
- example: "adiff review progress --repo . --branch cdr-1"
12163
+ example: "adiff review progress --repo . --branch add-invitations"
12157
12164
  },
12158
12165
  {
12159
12166
  name: "comment send",
@@ -12163,7 +12170,7 @@ var init_catalog = __esmMin((() => {
12163
12170
  safety: "write",
12164
12171
  options: [...addressing, ...range],
12165
12172
  dataKey: "batch",
12166
- example: "adiff comment send --repo . --branch cdr-1 --file src/api.ts --start 4 --end 5 --body \"why\""
12173
+ example: "adiff comment send --repo . --branch add-invitations --file src/api.ts --start 4 --end 5 --body \"why\""
12167
12174
  },
12168
12175
  {
12169
12176
  name: "comment reply",
@@ -12187,7 +12194,7 @@ var init_catalog = __esmMin((() => {
12187
12194
  }
12188
12195
  ],
12189
12196
  dataKey: "batch",
12190
- example: "adiff comment reply --repo . --branch cdr-1 --to c1 --body \"the other one\""
12197
+ example: "adiff comment reply --repo . --branch add-invitations --to c1 --body \"the other one\""
12191
12198
  },
12192
12199
  {
12193
12200
  name: "comment take",
@@ -12351,7 +12358,7 @@ var init_catalog = __esmMin((() => {
12351
12358
  about: "The comment to settle"
12352
12359
  }],
12353
12360
  dataKey: "settled",
12354
- example: "adiff comment resolve --repo . --branch cdr-1 --id c1"
12361
+ example: "adiff comment resolve --repo . --branch add-invitations --id c1"
12355
12362
  },
12356
12363
  {
12357
12364
  name: "comment remove",
@@ -12366,7 +12373,7 @@ var init_catalog = __esmMin((() => {
12366
12373
  about: "The comment to withdraw"
12367
12374
  }],
12368
12375
  dataKey: "removed",
12369
- example: "adiff comment remove --repo . --branch cdr-1 --id c1"
12376
+ example: "adiff comment remove --repo . --branch add-invitations --id c1"
12370
12377
  },
12371
12378
  {
12372
12379
  name: "comment restore",
@@ -12381,7 +12388,7 @@ var init_catalog = __esmMin((() => {
12381
12388
  about: "The comment to restore"
12382
12389
  }],
12383
12390
  dataKey: "restored",
12384
- example: "adiff comment restore --repo . --branch cdr-1 --id c1"
12391
+ example: "adiff comment restore --repo . --branch add-invitations --id c1"
12385
12392
  },
12386
12393
  {
12387
12394
  name: "config list",
@@ -13132,12 +13139,40 @@ var init_tree = __esmMin((() => {
13132
13139
  return node.children.reduce((total, child) => total + filesUnder(tree, child), 0);
13133
13140
  };
13134
13141
  crowdedDirectories = (tree, limit) => tree.nodes.filter((node) => node.kind === "directory" && directFiles(tree, node.id) > limit).map((node) => node.path);
13135
- })), nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13142
+ })), HOLDS, chosenNow, withChosen, preferenceRows, nothingReviewed, initialState, TREE_MAX, TREE_ROOMY, TREE_WIDE, TREE_MIN, TREE_SHARE, DIFF_MIN, DIFF_ROOMY, bodyRoom, treeWidth, tooSmall, reviewWidth, panelFits, panelShown, onLayers, selectedLayer, proseFor, kept, layerHolds, layerFiles, layerHolding, layerOpen, chunked, packed, shortened, wordWrapped, wrapped, clip, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME$1, layerRoomIn, railWindow, selectedBranch, selectedPatch, pullHere, knownToHaveNoPull, treeOf, reviewedCountIn, CROWDED, treeRows, crowdedOf, foldersOfFile, isReviewed, treeStart, treeWindow, MINUTE, HOUR, DAY, sinceThen, threadStand, STAND_WEIGHT, louder, threadsOn, hiddenLines, rowsUnder, markedStands, carriesLine, selectedRows, snippetOf, selectedLineCount, lineOf, brokenAt, laidLine, laidDraft, COMPOSE_BOX, COMPOSE_MARGIN, COMPOSE_PAD, COMPOSE_LEAST, composeBox, composeRoom$1, composeTarget, replyTarget, threadReplying, VOICES, threadQuote, pickedText, takenRows, selectedLines, shownMatches, matchHere, selectionReadout, CONTEXT_STEPS, wholeFileOff, contextToggled, layerContext, newLineAt, sourceLineAt, rowAtSourceLine, rowShowing, lineOnSide, commentRowsIn, threadsAtRow, stopsAtRow, threadHere, threadAtStop, threadAtRow, openCommentRows, filesWithComments, answerCount, PANEL_SECTIONS, answersIn, newerOf, spokeLast, SECTION_OF, sectionOf, sentEntry, panelEntries, panelEntry, threadChosen, spokenSince, hunkStarts, openingRow, changeAround, nextUnreviewed, reviewedCount, fileOrder, filePlace, readingOrder, placeIn, layerFile, layerAfter, selectionRange;
13136
13143
  var init_model = __esmMin((() => {
13137
13144
  init_dist();
13138
13145
  init_patch();
13146
+ init_preferences();
13139
13147
  init_gaps();
13140
13148
  init_tree();
13149
+ HOLDS = {
13150
+ wrap: "wrap",
13151
+ sticky: "sticky",
13152
+ panel: "panelOpen",
13153
+ hideReviewed: "hideReviewed",
13154
+ hideSettled: "hideSettled",
13155
+ newestFirst: "newestFirst",
13156
+ hold: "hold"
13157
+ };
13158
+ chosenNow = (state) => Object.fromEntries(Object.entries(HOLDS).map(([name, held]) => [name, state[held] === true]));
13159
+ withChosen = (state, name, value) => {
13160
+ const held = HOLDS[name];
13161
+ return held === void 0 ? state : {
13162
+ ...state,
13163
+ [held]: value
13164
+ };
13165
+ };
13166
+ preferenceRows = (state) => {
13167
+ const held = chosenNow(state);
13168
+ return preferences.map((one, at) => ({
13169
+ name: one.name,
13170
+ title: one.title,
13171
+ about: one.about,
13172
+ on: held[one.name] ?? one.byDefault,
13173
+ here: at === state.settingsIndex
13174
+ }));
13175
+ };
13141
13176
  nothingReviewed = {
13142
13177
  arrived: [],
13143
13178
  panelOpen: true,
@@ -13154,6 +13189,7 @@ var init_model = __esmMin((() => {
13154
13189
  scroll: -1,
13155
13190
  railRows: 12,
13156
13191
  railScroll: -1,
13192
+ settingsIndex: 0,
13157
13193
  now: 0,
13158
13194
  focusWas: "diff"
13159
13195
  };
@@ -14551,6 +14587,56 @@ var init_command = __esmMin((() => {
14551
14587
  hint: "run",
14552
14588
  listed: false
14553
14589
  }),
14590
+ command({
14591
+ action: "settings.open",
14592
+ also: [
14593
+ "preferences",
14594
+ "settings",
14595
+ "options",
14596
+ "config"
14597
+ ],
14598
+ title: "Change what adiff does",
14599
+ category: "App",
14600
+ keys: [","],
14601
+ screens: ["branches", "review"],
14602
+ listed: false
14603
+ }),
14604
+ command({
14605
+ action: "settings.next",
14606
+ title: "Next preference",
14607
+ category: "App",
14608
+ keys: ["down", "j"],
14609
+ screens: ["settings"],
14610
+ listed: false
14611
+ }),
14612
+ command({
14613
+ action: "settings.prev",
14614
+ title: "Previous preference",
14615
+ category: "App",
14616
+ keys: ["up", "k"],
14617
+ screens: ["settings"],
14618
+ listed: false
14619
+ }),
14620
+ command({
14621
+ action: "settings.flip",
14622
+ title: "Turn it on or off",
14623
+ category: "App",
14624
+ keys: ["return", "space"],
14625
+ screens: ["settings"],
14626
+ listed: false
14627
+ }),
14628
+ command({
14629
+ action: "back",
14630
+ title: "Go back",
14631
+ category: "App",
14632
+ keys: [
14633
+ "escape",
14634
+ "q",
14635
+ ","
14636
+ ],
14637
+ screens: ["settings"],
14638
+ listed: false
14639
+ }),
14554
14640
  command({
14555
14641
  action: "keys.open",
14556
14642
  also: [
@@ -14701,13 +14787,14 @@ var init_match = __esmMin((() => {
14701
14787
  }));
14702
14788
  //#endregion
14703
14789
  //#region src/tui/reduce.ts
14704
- 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, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, goBack, walkMatches, openPalette, openKeys, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, onLayerHolding, 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;
14790
+ 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, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withSent, withArrived, withColumns, laidOver, onLayerHolding, 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;
14705
14791
  var init_reduce = __esmMin((() => {
14706
14792
  init_dist();
14707
14793
  init_patch();
14708
14794
  init_command();
14709
14795
  init_gaps();
14710
14796
  init_match();
14797
+ init_preferences();
14711
14798
  init_model();
14712
14799
  clamp = (value, low, high) => Math.max(low, Math.min(high, value));
14713
14800
  lastRow = (patch) => Math.max(0, (patch?.rows.length ?? 1) - 1);
@@ -14915,7 +15002,12 @@ var init_reduce = __esmMin((() => {
14915
15002
  "diff",
14916
15003
  "review"
14917
15004
  ];
14918
- panesShown = (state) => PANES.filter((pane) => pane !== "review" || panelShown(state));
15005
+ paneShown = (state, pane) => {
15006
+ if (pane === "review") return panelShown(state);
15007
+ if (pane === "tree") return state.navOpen;
15008
+ return true;
15009
+ };
15010
+ panesShown = (state) => PANES.filter((pane) => paneShown(state, pane));
14919
15011
  focusStepped = (state, delta) => {
14920
15012
  const shown = panesShown(state);
14921
15013
  const at = shown.indexOf(state.focus);
@@ -15113,36 +15205,40 @@ var init_reduce = __esmMin((() => {
15113
15205
  screen: "branches",
15114
15206
  selecting: false
15115
15207
  };
15116
- goBack = (state) => {
15117
- switch (state.screen) {
15118
- case "search": return {
15119
- ...state,
15120
- screen: "review",
15121
- matches: [],
15122
- term: "",
15123
- query: ""
15124
- };
15125
- case "report": return {
15126
- ...state,
15127
- screen: state.returnTo,
15128
- draft: ""
15129
- };
15130
- case "palette":
15131
- case "keys": return {
15132
- ...state,
15133
- screen: state.returnTo,
15134
- query: ""
15135
- };
15136
- case "compose": return {
15137
- ...state,
15138
- screen: "review",
15139
- replyTo: void 0
15140
- };
15141
- case "branches":
15142
- case "review": return outOfDiff(state);
15143
- default: return absurd(state.screen);
15144
- }
15208
+ BACK_FROM = {
15209
+ search: (state) => ({
15210
+ ...state,
15211
+ screen: "review",
15212
+ matches: [],
15213
+ term: "",
15214
+ query: ""
15215
+ }),
15216
+ report: (state) => ({
15217
+ ...state,
15218
+ screen: state.returnTo,
15219
+ draft: ""
15220
+ }),
15221
+ palette: (state) => ({
15222
+ ...state,
15223
+ screen: state.returnTo,
15224
+ query: ""
15225
+ }),
15226
+ keys: (state) => ({
15227
+ ...state,
15228
+ screen: state.returnTo,
15229
+ query: ""
15230
+ }),
15231
+ settings: (state) => ({
15232
+ ...state,
15233
+ screen: state.returnTo
15234
+ }),
15235
+ compose: (state) => ({
15236
+ ...state,
15237
+ screen: "review",
15238
+ replyTo: void 0
15239
+ })
15145
15240
  };
15241
+ goBack = (state) => BACK_FROM[state.screen]?.(state) ?? outOfDiff(state);
15146
15242
  walkMatches = (state, delta) => ({
15147
15243
  ...state,
15148
15244
  matchIndex: clamp(state.matchIndex + delta, 0, Math.max(0, shownMatches(state).length - 1))
@@ -15161,6 +15257,22 @@ var init_reduce = __esmMin((() => {
15161
15257
  query: "",
15162
15258
  paletteIndex: 0
15163
15259
  });
15260
+ openSettings = (state) => ({
15261
+ ...state,
15262
+ screen: "settings",
15263
+ returnTo: state.screen,
15264
+ settingsIndex: 0
15265
+ });
15266
+ moveSettings = (state, delta) => ({
15267
+ ...state,
15268
+ settingsIndex: clamp(state.settingsIndex + delta, 0, Math.max(0, preferences.length - 1))
15269
+ });
15270
+ flipSetting = (state) => {
15271
+ const wanted = preferences[state.settingsIndex];
15272
+ if (wanted === void 0) return state;
15273
+ const held = chosenNow(state);
15274
+ return withChosen(state, wanted.name, !(held[wanted.name] ?? wanted.byDefault));
15275
+ };
15164
15276
  movePalette = (state, delta) => ({
15165
15277
  ...state,
15166
15278
  paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, offered(state).length - 1))
@@ -15201,13 +15313,11 @@ var init_reduce = __esmMin((() => {
15201
15313
  "thread.reply": (state) => state,
15202
15314
  "focus.toggle": (state) => ({
15203
15315
  ...state,
15204
- focus: focusStepped(state, 1),
15205
- navOpen: true
15316
+ focus: focusStepped(state, 1)
15206
15317
  }),
15207
15318
  "focus.back": (state) => ({
15208
15319
  ...state,
15209
- focus: focusStepped(state, -1),
15210
- navOpen: true
15320
+ focus: focusStepped(state, -1)
15211
15321
  }),
15212
15322
  "panel.toggle": togglePanel,
15213
15323
  "nav.toggle": toggleNav,
@@ -15260,6 +15370,10 @@ var init_reduce = __esmMin((() => {
15260
15370
  "report.send": (state) => state,
15261
15371
  "palette.open": openPalette,
15262
15372
  "keys.open": openKeys,
15373
+ "settings.open": openSettings,
15374
+ "settings.next": (state) => moveSettings(state, 1),
15375
+ "settings.prev": (state) => moveSettings(state, -1),
15376
+ "settings.flip": flipSetting,
15263
15377
  "keys.next": (state) => movePalette(state, 1),
15264
15378
  "keys.prev": (state) => movePalette(state, -1),
15265
15379
  "palette.run": (state) => state,
@@ -16383,7 +16497,7 @@ var init_diffview = __esmMin((() => {
16383
16497
  }));
16384
16498
  //#endregion
16385
16499
  //#region src/tui/render.ts
16386
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, 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, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16500
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, chipWidth, WAYS_OUT, 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, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
16387
16501
  var init_render = __esmMin((() => {
16388
16502
  init_dist();
16389
16503
  init_command();
@@ -16749,6 +16863,17 @@ var init_render = __esmMin((() => {
16749
16863
  }
16750
16864
  return new StyledText(drawn);
16751
16865
  };
16866
+ SETTING_LEAD = 4;
16867
+ settingsText = (rows, room) => {
16868
+ const drawn = rows.flatMap((row) => {
16869
+ const mark = row.on ? marks().done : " ";
16870
+ const head = `${row.here ? marks().cursor : " "} ${mark} ${row.title}`;
16871
+ const said = `${" ".repeat(SETTING_LEAD)}${clip(row.about, Math.max(8, room - SETTING_LEAD))}`;
16872
+ const tone = row.on ? palette.added : palette.muted;
16873
+ return [row.here ? bg(palette.selection)(fg(palette.ink)(`${head.padEnd(room)}\n`)) : fg(tone)(`${head.padEnd(room)}\n`), fg(palette.faint)(`${said.padEnd(room)}\n`)];
16874
+ });
16875
+ return new StyledText(drawn);
16876
+ };
16752
16877
  stack = (parent, children) => {
16753
16878
  for (const child of children) parent.add(child);
16754
16879
  };
@@ -16768,8 +16893,22 @@ var init_render = __esmMin((() => {
16768
16893
  makeModals = (renderer) => ({
16769
16894
  palette: makePaletteParts(renderer),
16770
16895
  found: makeFoundParts(renderer),
16771
- keys: makeKeysParts(renderer)
16896
+ keys: makeKeysParts(renderer),
16897
+ settings: makeSettingsParts(renderer)
16772
16898
  });
16899
+ makeSettingsParts = (renderer) => {
16900
+ const box = makePalette(renderer);
16901
+ const title = bar(renderer, "settings-title", palette.faint);
16902
+ const choices = makeChoices(renderer);
16903
+ box.id = "settings";
16904
+ box.add(title);
16905
+ box.add(choices);
16906
+ return {
16907
+ box,
16908
+ title,
16909
+ choices
16910
+ };
16911
+ };
16773
16912
  makeKeysParts = (renderer) => {
16774
16913
  const parts = makePaletteParts(renderer);
16775
16914
  parts.box.id = "keys";
@@ -17374,6 +17513,9 @@ var init_render = __esmMin((() => {
17374
17513
  paletteChoices;
17375
17514
  keys;
17376
17515
  keysTitle;
17516
+ settings;
17517
+ settingsTitle;
17518
+ settingsChoices;
17377
17519
  keysQuery;
17378
17520
  foundQuery;
17379
17521
  keysChoices;
@@ -17420,6 +17562,9 @@ var init_render = __esmMin((() => {
17420
17562
  this.paletteQuery = modals.palette.query;
17421
17563
  this.paletteChoices = modals.palette.choices;
17422
17564
  this.keys = modals.keys.box;
17565
+ this.settings = modals.settings.box;
17566
+ this.settingsTitle = modals.settings.title;
17567
+ this.settingsChoices = modals.settings.choices;
17423
17568
  this.keysTitle = modals.keys.title;
17424
17569
  this.keysQuery = modals.keys.query;
17425
17570
  this.foundQuery = modals.found.query;
@@ -17501,11 +17646,7 @@ var init_render = __esmMin((() => {
17501
17646
  case "palette": return this.paletteQuery;
17502
17647
  case "search": return this.foundQuery;
17503
17648
  case "keys": return this.keysQuery;
17504
- case "branches":
17505
- case "review":
17506
- case "compose":
17507
- case "report": return;
17508
- default: return absurd(screen);
17649
+ default: return;
17509
17650
  }
17510
17651
  }
17511
17652
  railRows() {
@@ -17559,6 +17700,7 @@ var init_render = __esmMin((() => {
17559
17700
  this.paintCompose(state);
17560
17701
  this.paintPalette(state);
17561
17702
  this.paintKeys(state);
17703
+ this.paintSettings(state);
17562
17704
  this.paintFound(state);
17563
17705
  this.paintReport(state);
17564
17706
  this.scrim.visible = state.screen !== "branches" && state.screen !== "review";
@@ -17589,6 +17731,23 @@ var init_render = __esmMin((() => {
17589
17731
  this.palette.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
17590
17732
  this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
17591
17733
  }
17734
+ paintSettings(state) {
17735
+ this.settings.visible = state.screen === "settings";
17736
+ if (state.screen !== "settings") {
17737
+ this.settingsTitle.content = "";
17738
+ this.settingsChoices.content = "";
17739
+ return;
17740
+ }
17741
+ const rows = preferenceRows(state);
17742
+ const room = panelWidth(this.renderer.width);
17743
+ const tall = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length * 2 + PALETTE_CHROME - 1);
17744
+ this.settingsTitle.content = "What adiff does";
17745
+ this.settingsChoices.content = settingsText(rows, room - MODAL_ROOM);
17746
+ this.settings.height = tall;
17747
+ this.settings.width = room;
17748
+ this.settings.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
17749
+ this.settings.top = panelTop(this.renderer.height, PANEL_QUARTER);
17750
+ }
17592
17751
  paintKeys(state) {
17593
17752
  this.keys.visible = state.screen === "keys";
17594
17753
  if (state.screen !== "keys") {
@@ -17757,7 +17916,8 @@ var init_render = __esmMin((() => {
17757
17916
  this.compose,
17758
17917
  this.palette,
17759
17918
  this.found,
17760
- this.keys
17919
+ this.keys,
17920
+ this.settings
17761
17921
  ]);
17762
17922
  }
17763
17923
  watchChips() {
@@ -18236,7 +18396,8 @@ var init_app = __esmMin((() => {
18236
18396
  "report",
18237
18397
  "keys",
18238
18398
  "palette",
18239
- "search"
18399
+ "search",
18400
+ "settings"
18240
18401
  ]);
18241
18402
  overReview = (screen) => OVER.has(screen);
18242
18403
  writesInto = (screen) => WRITES.has(screen);
@@ -18339,16 +18500,8 @@ var init_app = __esmMin((() => {
18339
18500
  runSync(options.display.onAsked((text) => this.askedBack(text)));
18340
18501
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
18341
18502
  renderer.keyInput.on("keyrelease", (key) => this.letGo(key));
18342
- renderer.on("destroy", () => this.stopWatching());
18343
- renderer.on("destroy", () => this.stopFading());
18344
- renderer.on("destroy", () => this.stopLooking());
18345
- renderer.on("destroy", () => this.stopTicking());
18503
+ renderer.on("destroy", () => this.letGoOfEverything());
18346
18504
  this.startTicking();
18347
- renderer.on("destroy", () => this.stopLighting());
18348
- renderer.on("destroy", () => this.stopSourcing());
18349
- renderer.on("destroy", () => void getTreeSitterClient().destroy());
18350
- renderer.on("destroy", () => this.stopPainting());
18351
- renderer.on("destroy", () => this.stopConsuming());
18352
18505
  renderer.on("frame", () => this.syncGeometry());
18353
18506
  renderer.on("resize", () => this.resized());
18354
18507
  renderer.setFrameCallback(() => runPromise(this.applying()));
@@ -19010,7 +19163,7 @@ var init_app = __esmMin((() => {
19010
19163
  ...this.state,
19011
19164
  opened: this.state.opened.filter((one) => one !== id)
19012
19165
  }, sent);
19013
- this.commit(withNotice(this.staying(held, id, was), "settled"));
19166
+ this.commit(withNotice(this.staying(held, was), "settled"));
19014
19167
  });
19015
19168
  }
19016
19169
  replyHere() {
@@ -19028,13 +19181,11 @@ var init_app = __esmMin((() => {
19028
19181
  });
19029
19182
  });
19030
19183
  }
19031
- staying(state, id, was) {
19032
- const entries = panelEntries(state);
19033
- const last = Math.max(0, entries.length - 1);
19034
- const at = entries.findIndex((entry) => entry.comment.id === id);
19184
+ staying(state, was) {
19185
+ const last = Math.max(0, panelEntries(state).length - 1);
19035
19186
  return {
19036
19187
  ...state,
19037
- panelIndex: Math.min(at === -1 ? was : at, last)
19188
+ panelIndex: Math.min(was, last)
19038
19189
  };
19039
19190
  }
19040
19191
  removeHere() {
@@ -19059,7 +19210,7 @@ var init_app = __esmMin((() => {
19059
19210
  opened: this.state.opened.filter((one) => one !== id)
19060
19211
  };
19061
19212
  const said = back ? "restored" : "removed, it is under Removed in the review";
19062
- this.commit(withNotice(this.staying(withSent(kept, sent), id, was), said));
19213
+ this.commit(withNotice(this.staying(withSent(kept, sent), was), said));
19063
19214
  });
19064
19215
  }
19065
19216
  fillBranches() {
@@ -19291,6 +19442,17 @@ var init_app = __esmMin((() => {
19291
19442
  this.sourcing = yield* forkDetach(this.loadSource());
19292
19443
  });
19293
19444
  }
19445
+ letGoOfEverything() {
19446
+ this.stopWatching();
19447
+ this.stopFading();
19448
+ this.stopLooking();
19449
+ this.stopTicking();
19450
+ this.stopLighting();
19451
+ this.stopSourcing();
19452
+ this.stopPainting();
19453
+ this.stopConsuming();
19454
+ getTreeSitterClient().destroy();
19455
+ }
19294
19456
  stopSourcing() {
19295
19457
  const fiber = this.sourcing;
19296
19458
  this.sourcing = void 0;
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.137",
26
+ "version": "0.1.0-alpha.139",
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": {
@@ -55,6 +55,8 @@
55
55
  "serve": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/serve.ts",
56
56
  "play": "node --watch --watch-path=src --watch-path=scripts --experimental-ffi --disable-warning=ExperimentalWarning scripts/play.ts",
57
57
  "shot": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/shot.ts",
58
- "pr-summary": "node scripts/pr-summary.ts"
58
+ "pr-summary": "node scripts/pr-summary.ts",
59
+ "scenario": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/scenario.ts",
60
+ "record": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/record.ts"
59
61
  }
60
62
  }
@@ -134,7 +134,7 @@ It splits the pane they are already looking at, so their next move is to look ri
134
134
  type. The answer says what happened:
135
135
 
136
136
  ```json
137
- {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api --branch cdr-1"}
137
+ {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api --branch add-invitations"}
138
138
  ```
139
139
 
140
140
  `opened:false` means nothing could be split, which is ordinary: a terminal without tmux, Zellij,