@eliya-oss/agent-diff 0.1.0-alpha.72 → 0.1.0-alpha.73

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,13 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.73
4
+
5
+ ### Patch Changes
6
+
7
+ - The README is short: install, `adiff init --write --skill`, and ask your agent to onboard you. The full handover with layers and coverage moved to `docs/handover.md`. The compose panel no longer offers a key that was removed.
8
+
9
+ - Everything drawn on the screen can be selected and copied, including the palette, the sheet of keys and the search results, which were drawn by a widget that hid its text. A selection clears on the next key. The row the cursor is on is washed rather than dotted, and the arrows walk between files.
10
+
3
11
  ## 0.1.0-alpha.72
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -2,18 +2,11 @@
2
2
 
3
3
  # adiff
4
4
 
5
- An agent finishes a piece of work and leaves you a diff. You read it without knowing why any of it
6
- was written that way, and asking means describing a line back in prose and reading the reply
7
- somewhere far from the code it concerns. On a large change you carry the whole review in your head,
8
- and it ends when your patience does.
5
+ An agent finishes a piece of work and leaves you a diff. adiff puts the conversation on the code:
6
+ you comment on the lines in a terminal, the agent that wrote them answers under your words, and a
7
+ point stays open until you settle it.
9
8
 
10
- adiff puts the conversation on the code. You comment on the lines in a terminal, the agent that
11
- wrote them answers under your words, and a point stays open until you settle it.
12
-
13
- The agent can also hand you a reading order: its own diff in layers, a note on each, and a coverage
14
- check so nothing is quietly left out of the story.
15
-
16
- <pre align="center">npm i -g @eliya-oss/agent-diff@alpha</pre>
9
+ <pre align="center">brew install Newbie012/tap/adiff</pre>
17
10
 
18
11
  <p align="center"><a href="docs/install.md">Other ways to install</a></p>
19
12
 
@@ -21,174 +14,58 @@ check so nothing is quietly left out of the story.
21
14
 
22
15
  </div>
23
16
 
24
- ## The loop
17
+ ## Getting started
25
18
 
26
- You comment on a line:
19
+ Install adiff, then teach the repository what it is:
27
20
 
28
21
  ```bash
29
- adiff comment send --repo . --branch add-teammate-invitations \
30
- --file src/api/invitations.ts --start 12 --end 13 \
31
- --body "Three status checks in a row. One error shape would do."
22
+ brew install Newbie012/tap/adiff
23
+ adiff init --write --skill
32
24
  ```
33
25
 
34
- The agent in that worktree collects it, carrying the code it was written against:
35
-
36
- ```bash
37
- adiff comment take --worktree .
38
- {"ok":true,"comments":[{"id":"1c43cb55-6a09-406d-95ad-f048c43e05f5","file":"src/api/invitations.ts",
39
- "side":"new","start":12,"end":13,"head":"63c11ce3",
40
- "snippet":" if (res.status === 409) throw new AlreadyInvited(email)\n ...",
41
- "body":"Three status checks in a row. One error shape would do."}]}
42
- ```
43
-
44
- It does the work, then answers the comment it was handed:
45
-
46
- ```bash
47
- adiff comment answer --worktree . --id 1c43cb55-6a09-406d-95ad-f048c43e05f5 \
48
- --body "Folded them into one InviteRejected carrying the reason."
49
- {"ok":true,"answered":1}
50
- ```
51
-
52
- You see that answer under your own words the next time you read the branch, and the thread waits
53
- there until you settle it with `d`:
54
-
55
- ```bash
56
- adiff comment list --repo . --branch add-teammate-invitations
57
- {"ok":true,"comments":[{"id":"1c43cb55-6a09-406d-95ad-f048c43e05f5","state":"answered",
58
- "stale":false,"answers":[{"body":"Folded them into one InviteRejected carrying the reason.",
59
- "asks":false}]}]}
60
- ```
26
+ `init` writes a short passage into `AGENTS.md` and a `CLAUDE.md` that imports it, and `--skill`
27
+ writes the full skill into `.claude/skills/adiff/`. Then ask your agent to walk you through it:
61
28
 
62
- `--question` on an answer marks the thread as waiting on you, for a decision the agent needs before
63
- it can carry on. Settling is yours alone: the agent that raised the answer cannot close the point.
64
-
65
- Every command that acts on a review takes either `--worktree <path>` or `--repo <path>` with
66
- `--branch <name>`, so the same command works from your checkout and from the agent's worktree.
67
-
68
- A comment is handed over exactly once, so a second `take` returns only what was written since. Add
69
- `--wait 300` and it blocks until something arrives, which costs nothing while it waits.
70
-
71
- ## The reading order
72
-
73
- An agent knows the order it built a change in. Rebuilding that order by reading forty files is the
74
- expensive way to learn something it already has, so it can publish the reading itself when you ask
75
- for one:
76
-
77
- ```bash
78
- adiff layers set --worktree . --json -
79
- ```
80
-
81
- Each layer is a claim over spans of the diff, with a note saying what the layer is for. The terminal
82
- lists them in the sidebar and scopes the diff to the layer you are on, with the prose sitting above
83
- the code it describes.
84
-
85
- adiff computes the coverage itself, so the reading cannot hide code:
86
-
87
- ```bash
88
- adiff layers show --worktree . --fields covered,total,uncovered
89
- {"ok":true,"layers":{"covered":3,"total":3,"uncovered":[]}}
90
- ```
29
+ > Read the adiff skill and onboard me: hand your current work over for review, and tell me what to
30
+ > press.
91
31
 
92
- Any hunk no layer claims is reported here and shown to you under "not in any layer". The layers
93
- record the commit they were written for, and adiff marks them stale once the branch moves past it.
32
+ From then on the loop is: the agent hands work over, you read it, and it answers what you wrote.
94
33
 
95
34
  ## Reviewing
96
35
 
97
- `adiff review open --repo .` lists the worktrees with something to review, including the checkout
98
- you are standing in. Enter opens one.
99
-
100
- `j` and `k` move down the diff, `[` and `]` between files, `v` starts a selection and `c` writes a
101
- comment, which `ctrl+s` sends. `y` copies the line you are on, and dragging over lines copies them. `m`
102
- marks a file reviewed, `d` settles the thread you are on, `s` swaps the sidebar between layers and
103
- files, `w` wraps long lines, `/` searches for what you selected, `r` reads the branch again, and
104
- `ctrl+p` finds any command by name. The footer lists the keys for wherever you are.
105
-
106
- Where the diff leaves lines out, a row says how many. Put the cursor on it and `l` brings ten of them
107
- back where you stand, `h` puts them away, and the rest of the file stays as small as it was. Opened
108
- lines are ordinary lines: select them and comment on them.
109
-
110
- ## Setting up a repository
111
-
112
36
  ```bash
113
- adiff init # shows what it would write
114
- adiff init --write # writes it
37
+ adiff review open --repo .
115
38
  ```
116
39
 
117
- Writes a short passage into `AGENTS.md` and a `CLAUDE.md` that imports it, telling any agent working
118
- in that repository how the handover runs. It sits between `<!-- adiff:begin -->` and
119
- `<!-- adiff:end -->`, so a second run changes nothing and removing it is deleting a block you can
120
- see. `--skill` also writes the full skill into `.claude/skills/adiff/`.
40
+ `j` and `k` move down the diff, `[` and `]` between files, `v` starts a selection and `c` writes a
41
+ comment that `ctrl+s` sends. `d` settles the thread you are on, `m` marks a file reviewed, `y`
42
+ copies the line you are on, and dragging over lines copies them. `?` lists every key and filters as
43
+ you type. The footer carries the keys of whichever pane you are in.
121
44
 
122
- For a per-machine install instead:
45
+ ## For agents
123
46
 
124
- ```bash
125
- npx skills add Newbie012/agent-diff --skill adiff
126
- ```
127
-
128
- When someone asks for a review, the agent can put it in front of them:
47
+ Three commands are the whole loop:
129
48
 
130
49
  ```bash
131
- adiff review pane --repo .
132
- {"ok":true,"opened":true,"pane":"tmux","command":"adiff review open --repo /work/api"}
50
+ adiff comment take --worktree . --wait 300 # what the reviewer wrote, with the code it was on
51
+ adiff comment answer --worktree . --id <id> --body "what you did about it"
52
+ adiff review pane --repo . # put the review in front of them, split in tmux
133
53
  ```
134
54
 
135
- It splits tmux, Zellij, WezTerm or kitty. Anywhere else it answers `opened:false` and carries the
136
- command to run, so the agent quotes one line rather than a paragraph.
55
+ Everything answers JSON on stdout and `{"ok":false,"error":{...}}` on stderr, with a `suggestion`
56
+ naming the command that resolves it. `adiff describe` returns the whole catalog, so nothing here has
57
+ to be memorised. [The handover in detail](docs/handover.md) covers layers, coverage and the rest.
137
58
 
138
59
  ## Requirements
139
60
 
140
- Either install gives you an `adiff` on your PATH. Brew brings a Node 26 along with it, so everything
141
- works the moment it finishes.
142
-
143
- The commands run on Node 22 or newer. The terminal is the one part that wants Node 26: it draws
144
- through opentui, which reaches its native renderer over `node:ffi`, a module Node exposes behind
145
- `--experimental-ffi` from 26 onward. When you open the terminal on an older Node, adiff looks for a
146
- Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and runs the terminal on that, so a
147
- global npm install keeps working across a version switch.
148
-
149
- ## Trying it
150
-
151
- pnpm 12 is a Rust rewrite and still in beta, so
152
- [corepack cannot install it](https://pnpm.io/installation):
153
-
154
- ```bash
155
- corepack disable pnpm
156
- npm install -g --allow-scripts=pnpm pnpm@next-12
157
- pnpm install
158
- ```
159
-
160
- `pnpm simulate` builds a throwaway repository with seven branches an agent has already worked on,
161
- from a three-file error type up to a 42-file migration of just over a thousand lines each way, and
162
- opens the terminal on it. Your real repos and `~/.adiff` are untouched, and the workspace goes when
163
- you quit. `pnpm simulate --probe` runs the whole round trip headless and prints it:
164
-
165
- ```
166
- branches {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3,"added":27,"removed":2,"layers":2,...
167
- reviewed {"ok":true,"reviewed":["src/api/invitations.ts"],"total":3}
168
- agent takes {"ok":true,"comments":[{"id":"a83fc98c-8397-44f5-9c37-731a1cf3cb4c","file":"src/api/invitations.ts",
169
- "side":"new","start":12,"end":13,"snippet":" if (res.status === 409) throw new AlreadyInvited(email)...",
170
- "body":"Three status checks in a row. One error shape would do."}]}
171
- ```
61
+ The commands run on Node 22 or newer. The terminal wants Node 26, which Homebrew brings along; on a
62
+ global npm install adiff finds a Node 26 among your fnm, nvm, asdf, volta and Homebrew installs and
63
+ runs the terminal on that.
172
64
 
173
65
  ## Notes
174
66
 
175
- adiff is alpha, and one person's tool. Every release goes out under the `alpha` tag.
176
-
177
- Everything the terminal does is also a command, so nothing is trapped in the UI. Each command prints
178
- one compact JSON line on stdout and exits 0, and `--fields` trims the answer to what you read:
179
-
180
- ```bash
181
- adiff branch list --repo . --fields branch,files
182
- {"ok":true,"branches":[{"branch":"add-teammate-invitations","files":3}]}
183
- ```
184
-
185
- Failures go to stderr as `{"ok":false,"error":{...}}`, so stdout is always parseable, with an exit
186
- code saying what to do about it: `2` malformed request, `3` not found, `1` unexpected. Every error
187
- carries a `suggestion` naming the command that resolves it, and `adiff describe` returns the whole
188
- catalog as JSON so a caller can discover the rest.
189
-
190
- Project docs live in `.agents/`. `AGENTS.md` covers making a change, `ARCHITECTURE.md` how the code
191
- is laid out.
67
+ adiff is alpha, and one person's tool. Every release goes out under the `alpha` tag. Project docs
68
+ live in `.agents/`: `AGENTS.md` covers making a change, `ARCHITECTURE.md` how the code is laid out.
192
69
 
193
70
  ## License
194
71
 
package/dist/main.js CHANGED
@@ -5,9 +5,9 @@ import { text } from "node:stream/consumers";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { execFile, spawn } from "node:child_process";
7
7
  import { promisify } from "node:util";
8
- import { existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
8
+ import { appendFileSync, existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
10
- import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, SelectRenderable, StyledText, SyntaxStyle, TextRenderable, bg, createCliRenderer, decodePasteBytes, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
10
+ import { ASCIIFontRenderable, BoxRenderable, CodeRenderable, LineNumberRenderable, RGBA, StyledText, SyntaxStyle, TextRenderable, bg, createCliRenderer, decodePasteBytes, fg, getTreeSitterClient, pathToFiletype, stripAnsiSequences, t } from "@opentui/core";
11
11
  //#region \0rolldown/runtime.js
12
12
  var __defProp = Object.defineProperty;
13
13
  var __esmMin = (fn, res, err) => () => {
@@ -9661,7 +9661,7 @@ var init_pane = __esmMin((() => {
9661
9661
  init_commands();
9662
9662
  init_init();
9663
9663
  init_pane();
9664
- var version$1 = "0.1.0-alpha.72";
9664
+ var version$1 = "0.1.0-alpha.73";
9665
9665
  //#endregion
9666
9666
  //#region src/cli/upgrade.ts
9667
9667
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -12158,7 +12158,7 @@ var init_command = __esmMin((() => {
12158
12158
  panes: ["tree", "diff"],
12159
12159
  title: "Next file",
12160
12160
  category: "Files",
12161
- keys: ["]"],
12161
+ keys: ["]", "right"],
12162
12162
  screens: ["review"],
12163
12163
  hint: "file",
12164
12164
  rank: 1
@@ -12167,7 +12167,7 @@ var init_command = __esmMin((() => {
12167
12167
  action: "file.prev",
12168
12168
  title: "Previous file",
12169
12169
  category: "Files",
12170
- keys: ["["],
12170
+ keys: ["[", "left"],
12171
12171
  screens: ["review"]
12172
12172
  }),
12173
12173
  command({
@@ -14129,7 +14129,7 @@ var init_diffview = __esmMin((() => {
14129
14129
  }));
14130
14130
  //#endregion
14131
14131
  //#region src/tui/render.ts
14132
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14132
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14133
14133
  var init_render = __esmMin((() => {
14134
14134
  init_command();
14135
14135
  init_patch();
@@ -14150,7 +14150,7 @@ var init_render = __esmMin((() => {
14150
14150
  COMPOSE_PAD = 5;
14151
14151
  COMPOSE_MIN_TEXT = 8;
14152
14152
  reportActions = (full) => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^t")} ${fg(palette.muted)(full ? "sending everything" : "sending the least")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("copy and save")}`;
14153
- 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")}`;
14153
+ actionsText = () => t`${fg(palette.accent)("esc")} ${fg(palette.muted)("cancel")} ${fg(palette.accent)("^s")} ${fg(palette.muted)("send it")}`;
14154
14154
  SNIPPET_LINES = 4;
14155
14155
  PALETTE_KEY = 7;
14156
14156
  PALETTE_TITLE = 60;
@@ -14344,21 +14344,35 @@ var init_render = __esmMin((() => {
14344
14344
  choices
14345
14345
  };
14346
14346
  };
14347
- makeChoices = (renderer) => new SelectRenderable(renderer, {
14347
+ makeChoices = (renderer) => new TextRenderable(renderer, {
14348
14348
  id: "palette-choices",
14349
+ content: "",
14349
14350
  flexGrow: 1,
14350
- options: [],
14351
- showDescription: false,
14352
- showScrollIndicator: true,
14353
- showSelectionIndicator: true,
14354
- wrapSelection: false,
14355
- backgroundColor: palette.panel,
14356
- textColor: palette.ink,
14357
- descriptionColor: palette.faint,
14358
- selectedBackgroundColor: palette.selection,
14359
- selectedTextColor: palette.ink,
14360
- selectedDescriptionColor: palette.ink
14351
+ fg: palette.ink,
14352
+ selectable: true
14361
14353
  });
14354
+ LIST_LEAD = 2;
14355
+ windowed = (rows, at, height) => {
14356
+ if (rows.length <= height) return {
14357
+ rows,
14358
+ from: 0
14359
+ };
14360
+ const last = rows.length - height;
14361
+ const from = Math.max(0, Math.min(last, at - Math.floor(height / 2)));
14362
+ return {
14363
+ rows: rows.slice(from, from + height),
14364
+ from
14365
+ };
14366
+ };
14367
+ listText = (rows, at, height) => {
14368
+ const shown = windowed(rows, at, Math.max(1, height));
14369
+ const drawn = shown.rows.map((row, index) => {
14370
+ const here = shown.from + index === at;
14371
+ const text = `${here ? "▶ " : " "}${row}`.padEnd(LIST_LEAD);
14372
+ return here ? bg(palette.selection)(fg(palette.ink)(`${text}\n`)) : fg(palette.ink)(`${text}\n`);
14373
+ });
14374
+ return new StyledText(drawn);
14375
+ };
14362
14376
  stack = (parent, children) => {
14363
14377
  for (const child of children) parent.add(child);
14364
14378
  };
@@ -14674,12 +14688,16 @@ var init_render = __esmMin((() => {
14674
14688
  panelBody = (entry) => entry.comment.body.split("\n").find((line) => line.trim().length > 0) ?? "";
14675
14689
  panelPair = (state, placed, room) => {
14676
14690
  const { entry } = placed;
14691
+ const lead = `${panelMark(state, placed.at)}${entry.fresh || entry.unread > 0 ? marks().comment : " "} `;
14692
+ const here = placed.at === state.panelIndex;
14677
14693
  return [{
14678
- text: `${`${panelMark(state, placed.at)}${entry.fresh || entry.unread > 0 ? marks().comment : " "} `}${panelWhere(entry, room - PANEL_LEAD)}`,
14679
- tone: palette.ink
14694
+ text: `${lead}${panelWhere(entry, room - PANEL_LEAD)}`,
14695
+ tone: palette.ink,
14696
+ here
14680
14697
  }, {
14681
14698
  text: ` ${clip(panelBody(entry), Math.max(4, room - PANEL_LEAD))}`,
14682
- tone: palette.muted
14699
+ tone: palette.muted,
14700
+ here
14683
14701
  }];
14684
14702
  };
14685
14703
  panelSection = (state, placed, section, room) => {
@@ -14716,7 +14734,10 @@ var init_render = __esmMin((() => {
14716
14734
  text: PANEL_EMPTY,
14717
14735
  tone: palette.muted
14718
14736
  }] : body;
14719
- return new StyledText([...banner, ...lines].map((line) => fg(line.tone)(`${line.text}\n`)));
14737
+ return new StyledText([...banner, ...lines].map((line) => {
14738
+ const drawn = fg(line.tone)(`${line.text.padEnd(room)}\n`);
14739
+ return line.here === true ? bg(palette.selection)(drawn) : drawn;
14740
+ }));
14720
14741
  };
14721
14742
  Screen = class {
14722
14743
  header;
@@ -14924,20 +14945,16 @@ var init_render = __esmMin((() => {
14924
14945
  if (state.screen !== "palette") {
14925
14946
  this.paletteQuery.content = "";
14926
14947
  this.paletteTitle.content = "";
14927
- this.paletteChoices.options = [];
14948
+ this.paletteChoices.content = "";
14928
14949
  return;
14929
14950
  }
14930
14951
  const matches = paletteMatches(state);
14931
14952
  this.paletteTitle.content = matches.length === 0 ? "No command matches" : "Commands";
14932
14953
  this.paletteQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
14933
14954
  const room = panelWidth(this.renderer.width);
14934
- this.paletteChoices.options = matches.map((entry) => ({
14935
- name: commandRow(entry, room - MODAL_ROOM),
14936
- description: "",
14937
- value: entry.action
14938
- }));
14939
- this.paletteChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, matches.length - 1));
14940
- this.palette.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), matches.length + PALETTE_CHROME);
14955
+ const paletteRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), matches.length + PALETTE_CHROME);
14956
+ this.paletteChoices.content = listText(matches.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, matches.length - 1)), paletteRoom - PALETTE_CHROME);
14957
+ this.palette.height = paletteRoom;
14941
14958
  this.palette.width = room;
14942
14959
  this.palette.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
14943
14960
  this.palette.top = panelTop(this.renderer.height, PANEL_QUARTER);
@@ -14947,20 +14964,16 @@ var init_render = __esmMin((() => {
14947
14964
  if (state.screen !== "keys") {
14948
14965
  this.keysTitle.content = "";
14949
14966
  this.keysQuery.content = "";
14950
- this.keysChoices.options = [];
14967
+ this.keysChoices.content = "";
14951
14968
  return;
14952
14969
  }
14953
14970
  const rows = keyMatches(state);
14954
14971
  const room = panelWidth(this.renderer.width);
14955
14972
  this.keysTitle.content = rows.length === 0 ? "No key matches" : `Keys here, ${rows.length} of them`;
14956
14973
  this.keysQuery.content = state.query.length === 0 ? "Type to filter…" : `${state.query}▏`;
14957
- this.keysChoices.options = rows.map((entry) => ({
14958
- name: commandRow(entry, room - MODAL_ROOM),
14959
- description: "",
14960
- value: entry.action
14961
- }));
14962
- this.keysChoices.selectedIndex = Math.min(state.paletteIndex, Math.max(0, rows.length - 1));
14963
- this.keys.height = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
14974
+ const keysRoom = Math.min(panelRows(this.renderer.height, PANEL_QUARTER), rows.length + PENDING_CHROME);
14975
+ this.keysChoices.content = listText(rows.map((entry) => commandRow(entry, room - MODAL_ROOM)), Math.min(state.paletteIndex, Math.max(0, rows.length - 1)), keysRoom - PENDING_CHROME);
14976
+ this.keys.height = keysRoom;
14964
14977
  this.keys.width = room;
14965
14978
  this.keys.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
14966
14979
  this.keys.top = panelTop(this.renderer.height, PANEL_QUARTER);
@@ -15011,7 +15024,10 @@ var init_render = __esmMin((() => {
15011
15024
  const pane = this.paneRoom();
15012
15025
  const whole = treeWindow(state, room);
15013
15026
  const window = whole.more === 0 ? whole : treeWindow(state, Math.max(1, room - 1));
15014
- const rows = window.rows.flatMap((row) => [fg(row.kind === "file" ? palette.ink : palette.muted)(`${treeLine(state, row, pane)}\n`)]);
15027
+ const rows = window.rows.flatMap((row) => {
15028
+ const drawn = fg(row.kind === "file" ? palette.ink : palette.muted)(`${treeLine(state, row, pane)}\n`);
15029
+ return [row.fileIndex === state.patchIndex ? bg(palette.selection)(drawn) : drawn];
15030
+ });
15015
15031
  const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
15016
15032
  return new StyledText([...rows, ...more]);
15017
15033
  }
@@ -15202,18 +15218,15 @@ var init_render = __esmMin((() => {
15202
15218
  if (state.screen !== "search") {
15203
15219
  this.foundTitle.content = "";
15204
15220
  this.foundPeek.content = "";
15205
- this.foundChoices.options = [];
15221
+ this.foundChoices.content = "";
15206
15222
  return;
15207
15223
  }
15208
15224
  const room = panelWidth(this.renderer.width);
15209
15225
  const here = matchHere(state);
15210
15226
  this.foundTitle.content = `${state.term} · ${state.matches.length} elsewhere`;
15211
- this.foundChoices.options = state.matches.map((match) => ({
15212
- name: clip(`${match.changed ? marks().comment : " "} ${match.path}:${match.line} ${match.text}`, Math.max(1, room - MODAL_ROOM)),
15213
- description: "",
15214
- value: match.path
15215
- }));
15216
- this.foundChoices.selectedIndex = state.matchIndex;
15227
+ const peekHigh = here?.around.length ?? 0;
15228
+ const foundRoom = Math.min(panelRows(this.renderer.height, PANEL_FIFTH), state.matches.length + peekHigh + PALETTE_CHROME);
15229
+ this.foundChoices.content = listText(state.matches.map((match) => clip(`${match.changed ? marks().comment : " "} ${match.path}:${match.line} ${match.text}`, Math.max(1, room - MODAL_ROOM))), state.matchIndex, Math.max(1, foundRoom - peekHigh - PALETTE_CHROME));
15217
15230
  this.foundPeek.content = (here?.around ?? []).map((line) => clip(line, Math.max(1, room - MODAL_ROOM))).join("\n");
15218
15231
  const peekRows = here?.around.length ?? 0;
15219
15232
  this.foundPeek.height = peekRows;
@@ -15648,6 +15661,7 @@ var init_app = __esmMin((() => {
15648
15661
  runFork(writeSession(this.sessionPath, session));
15649
15662
  }
15650
15663
  dispatch(key) {
15664
+ if (this.renderer.hasSelection) this.renderer.clearSelection();
15651
15665
  offerUnsafe(this.intents, Intent.Key({ key }));
15652
15666
  }
15653
15667
  dispatchPaste(event) {
@@ -15939,6 +15953,11 @@ var init_app = __esmMin((() => {
15939
15953
  }
15940
15954
  copyDragged() {
15941
15955
  const taken = this.renderer.getSelection()?.getSelectedText() ?? "";
15956
+ const where = process.env["ADIFF_TRACE"];
15957
+ if (where !== void 0) {
15958
+ const holder = this.renderer.getSelectionContainer()?.id ?? "none";
15959
+ appendFileSync(where, `${this.state.screen} in=${holder} ${JSON.stringify(taken).slice(0, 70)}\n`);
15960
+ }
15942
15961
  if (taken.trim().length === 0) return;
15943
15962
  copyToClipboard(taken);
15944
15963
  const lines = taken.split("\n").length;
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.72",
26
+ "version": "0.1.0-alpha.73",
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": {