@eliya-oss/agent-diff 0.1.0-alpha.138 → 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,11 @@
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
+
3
9
  ## 0.1.0-alpha.138
4
10
 
5
11
  ### 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.138";
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, 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, 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);
@@ -15118,36 +15205,40 @@ var init_reduce = __esmMin((() => {
15118
15205
  screen: "branches",
15119
15206
  selecting: false
15120
15207
  };
15121
- goBack = (state) => {
15122
- switch (state.screen) {
15123
- case "search": return {
15124
- ...state,
15125
- screen: "review",
15126
- matches: [],
15127
- term: "",
15128
- query: ""
15129
- };
15130
- case "report": return {
15131
- ...state,
15132
- screen: state.returnTo,
15133
- draft: ""
15134
- };
15135
- case "palette":
15136
- case "keys": return {
15137
- ...state,
15138
- screen: state.returnTo,
15139
- query: ""
15140
- };
15141
- case "compose": return {
15142
- ...state,
15143
- screen: "review",
15144
- replyTo: void 0
15145
- };
15146
- case "branches":
15147
- case "review": return outOfDiff(state);
15148
- default: return absurd(state.screen);
15149
- }
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
+ })
15150
15240
  };
15241
+ goBack = (state) => BACK_FROM[state.screen]?.(state) ?? outOfDiff(state);
15151
15242
  walkMatches = (state, delta) => ({
15152
15243
  ...state,
15153
15244
  matchIndex: clamp(state.matchIndex + delta, 0, Math.max(0, shownMatches(state).length - 1))
@@ -15166,6 +15257,22 @@ var init_reduce = __esmMin((() => {
15166
15257
  query: "",
15167
15258
  paletteIndex: 0
15168
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
+ };
15169
15276
  movePalette = (state, delta) => ({
15170
15277
  ...state,
15171
15278
  paletteIndex: clamp(state.paletteIndex + delta, 0, Math.max(0, offered(state).length - 1))
@@ -15263,6 +15370,10 @@ var init_reduce = __esmMin((() => {
15263
15370
  "report.send": (state) => state,
15264
15371
  "palette.open": openPalette,
15265
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,
15266
15377
  "keys.next": (state) => movePalette(state, 1),
15267
15378
  "keys.prev": (state) => movePalette(state, -1),
15268
15379
  "palette.run": (state) => state,
@@ -16386,7 +16497,7 @@ var init_diffview = __esmMin((() => {
16386
16497
  }));
16387
16498
  //#endregion
16388
16499
  //#region src/tui/render.ts
16389
- 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;
16390
16501
  var init_render = __esmMin((() => {
16391
16502
  init_dist();
16392
16503
  init_command();
@@ -16752,6 +16863,17 @@ var init_render = __esmMin((() => {
16752
16863
  }
16753
16864
  return new StyledText(drawn);
16754
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
+ };
16755
16877
  stack = (parent, children) => {
16756
16878
  for (const child of children) parent.add(child);
16757
16879
  };
@@ -16771,8 +16893,22 @@ var init_render = __esmMin((() => {
16771
16893
  makeModals = (renderer) => ({
16772
16894
  palette: makePaletteParts(renderer),
16773
16895
  found: makeFoundParts(renderer),
16774
- keys: makeKeysParts(renderer)
16896
+ keys: makeKeysParts(renderer),
16897
+ settings: makeSettingsParts(renderer)
16775
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
+ };
16776
16912
  makeKeysParts = (renderer) => {
16777
16913
  const parts = makePaletteParts(renderer);
16778
16914
  parts.box.id = "keys";
@@ -17377,6 +17513,9 @@ var init_render = __esmMin((() => {
17377
17513
  paletteChoices;
17378
17514
  keys;
17379
17515
  keysTitle;
17516
+ settings;
17517
+ settingsTitle;
17518
+ settingsChoices;
17380
17519
  keysQuery;
17381
17520
  foundQuery;
17382
17521
  keysChoices;
@@ -17423,6 +17562,9 @@ var init_render = __esmMin((() => {
17423
17562
  this.paletteQuery = modals.palette.query;
17424
17563
  this.paletteChoices = modals.palette.choices;
17425
17564
  this.keys = modals.keys.box;
17565
+ this.settings = modals.settings.box;
17566
+ this.settingsTitle = modals.settings.title;
17567
+ this.settingsChoices = modals.settings.choices;
17426
17568
  this.keysTitle = modals.keys.title;
17427
17569
  this.keysQuery = modals.keys.query;
17428
17570
  this.foundQuery = modals.found.query;
@@ -17504,11 +17646,7 @@ var init_render = __esmMin((() => {
17504
17646
  case "palette": return this.paletteQuery;
17505
17647
  case "search": return this.foundQuery;
17506
17648
  case "keys": return this.keysQuery;
17507
- case "branches":
17508
- case "review":
17509
- case "compose":
17510
- case "report": return;
17511
- default: return absurd(screen);
17649
+ default: return;
17512
17650
  }
17513
17651
  }
17514
17652
  railRows() {
@@ -17562,6 +17700,7 @@ var init_render = __esmMin((() => {
17562
17700
  this.paintCompose(state);
17563
17701
  this.paintPalette(state);
17564
17702
  this.paintKeys(state);
17703
+ this.paintSettings(state);
17565
17704
  this.paintFound(state);
17566
17705
  this.paintReport(state);
17567
17706
  this.scrim.visible = state.screen !== "branches" && state.screen !== "review";
@@ -17592,6 +17731,23 @@ var init_render = __esmMin((() => {
17592
17731
  this.palette.left = Math.max(1, Math.floor((this.renderer.width - room) / 2));
17593
17732
  this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
17594
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
+ }
17595
17751
  paintKeys(state) {
17596
17752
  this.keys.visible = state.screen === "keys";
17597
17753
  if (state.screen !== "keys") {
@@ -17760,7 +17916,8 @@ var init_render = __esmMin((() => {
17760
17916
  this.compose,
17761
17917
  this.palette,
17762
17918
  this.found,
17763
- this.keys
17919
+ this.keys,
17920
+ this.settings
17764
17921
  ]);
17765
17922
  }
17766
17923
  watchChips() {
@@ -18239,7 +18396,8 @@ var init_app = __esmMin((() => {
18239
18396
  "report",
18240
18397
  "keys",
18241
18398
  "palette",
18242
- "search"
18399
+ "search",
18400
+ "settings"
18243
18401
  ]);
18244
18402
  overReview = (screen) => OVER.has(screen);
18245
18403
  writesInto = (screen) => WRITES.has(screen);
@@ -18342,16 +18500,8 @@ var init_app = __esmMin((() => {
18342
18500
  runSync(options.display.onAsked((text) => this.askedBack(text)));
18343
18501
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
18344
18502
  renderer.keyInput.on("keyrelease", (key) => this.letGo(key));
18345
- renderer.on("destroy", () => this.stopWatching());
18346
- renderer.on("destroy", () => this.stopFading());
18347
- renderer.on("destroy", () => this.stopLooking());
18348
- renderer.on("destroy", () => this.stopTicking());
18503
+ renderer.on("destroy", () => this.letGoOfEverything());
18349
18504
  this.startTicking();
18350
- renderer.on("destroy", () => this.stopLighting());
18351
- renderer.on("destroy", () => this.stopSourcing());
18352
- renderer.on("destroy", () => void getTreeSitterClient().destroy());
18353
- renderer.on("destroy", () => this.stopPainting());
18354
- renderer.on("destroy", () => this.stopConsuming());
18355
18505
  renderer.on("frame", () => this.syncGeometry());
18356
18506
  renderer.on("resize", () => this.resized());
18357
18507
  renderer.setFrameCallback(() => runPromise(this.applying()));
@@ -19292,6 +19442,17 @@ var init_app = __esmMin((() => {
19292
19442
  this.sourcing = yield* forkDetach(this.loadSource());
19293
19443
  });
19294
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
+ }
19295
19456
  stopSourcing() {
19296
19457
  const fiber = this.sourcing;
19297
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.138",
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": {
@@ -56,6 +56,7 @@
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
58
  "pr-summary": "node scripts/pr-summary.ts",
59
- "scenario": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/scenario.ts"
59
+ "scenario": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/scenario.ts",
60
+ "record": "node --experimental-ffi --disable-warning=ExperimentalWarning scripts/record.ts"
60
61
  }
61
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,