@eliya-oss/agent-diff 0.1.0-alpha.103 → 0.1.0-alpha.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.105
4
+
5
+ ### Patch Changes
6
+
7
+ - Looking for something no longer re-reads the whole branch on every search, and finds a name however it was capitalised.
8
+
9
+ ## 0.1.0-alpha.104
10
+
11
+ ### Patch Changes
12
+
13
+ - Looking for something shows the places as the words are typed, keeps a readable panel before there is anything to show, and never reads the clipboard.
14
+
3
15
  ## 0.1.0-alpha.103
4
16
 
5
17
  ### Minor Changes
package/dist/main.js CHANGED
@@ -3,7 +3,7 @@ import { appendFile, mkdir, readFile, realpath, rename, stat, writeFile } from "
3
3
  import { homedir, hostname, platform } from "node:os";
4
4
  import { text } from "node:stream/consumers";
5
5
  import { dirname, join, resolve } from "node:path";
6
- import { execFile, spawn, spawnSync } from "node:child_process";
6
+ import { execFile, spawn } from "node:child_process";
7
7
  import { promisify } from "node:util";
8
8
  import { existsSync, mkdirSync, readFileSync, realpathSync, watch } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
@@ -8600,6 +8600,7 @@ var init_service$2 = __esmMin((() => {
8600
8600
  "-n",
8601
8601
  "-I",
8602
8602
  "-F",
8603
+ "-i",
8603
8604
  "-w",
8604
8605
  "-C",
8605
8606
  String(GREP_CONTEXT),
@@ -9926,7 +9927,7 @@ var init_pane = __esmMin((() => {
9926
9927
  init_commands();
9927
9928
  init_init();
9928
9929
  init_pane();
9929
- var version$1 = "0.1.0-alpha.103";
9930
+ var version$1 = "0.1.0-alpha.105";
9930
9931
  //#endregion
9931
9932
  //#region src/cli/upgrade.ts
9932
9933
  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;
@@ -10122,7 +10123,7 @@ var init_upgrade$1 = __esmMin((() => {
10122
10123
  }));
10123
10124
  //#endregion
10124
10125
  //#region src/cli/search.ts
10125
- var HIT, NEAR$1, rowOf, readRows, near, byChangedFirst, searchBranch;
10126
+ var HIT, NEAR$1, rowOf, readRows, near, byChangedFirst, searchIn, searchBranch;
10126
10127
  var init_search = __esmMin((() => {
10127
10128
  init_dist();
10128
10129
  init_git();
@@ -10158,11 +10159,10 @@ var init_search = __esmMin((() => {
10158
10159
  if (left.changed !== right.changed) return left.changed ? -1 : 1;
10159
10160
  return left.path === right.path ? left.line - right.line : left.path.localeCompare(right.path);
10160
10161
  };
10161
- searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term) {
10162
+ searchIn = fn("Cli.searchIn")(function* (reading, term) {
10162
10163
  const git = yield* Git;
10163
- const worktree = yield* findBranch(repo, branch);
10164
- const patches = yield* listPatches(repo, branch);
10165
- const touched = new Set(patches.map((patch) => patch.path));
10164
+ const worktree = reading.worktree;
10165
+ const touched = new Set(reading.patches.map((patch) => patch.path));
10166
10166
  const rows = readRows(yield* git.grep(worktree, term));
10167
10167
  const found = [];
10168
10168
  for (const [at, row] of rows.entries()) {
@@ -10177,6 +10177,9 @@ var init_search = __esmMin((() => {
10177
10177
  }
10178
10178
  return found.toSorted(byChangedFirst);
10179
10179
  });
10180
+ searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term) {
10181
+ return yield* searchIn(yield* readingOf(repo, branch), term);
10182
+ });
10180
10183
  }));
10181
10184
  //#endregion
10182
10185
  //#region src/domain/layers/model.ts
@@ -14559,7 +14562,7 @@ var init_diffview = __esmMin((() => {
14559
14562
  }));
14560
14563
  //#endregion
14561
14564
  //#region src/tui/render.ts
14562
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, 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_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, 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, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, 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, 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, restingOrHere, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14565
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, 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_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, 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, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, 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, 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, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, fileRow, blockOf, aroundRow, windowedBlocks, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
14563
14566
  var init_render = __esmMin((() => {
14564
14567
  init_command();
14565
14568
  init_patch();
@@ -14756,14 +14759,14 @@ var init_render = __esmMin((() => {
14756
14759
  box.width = PALETTE_WIDTH;
14757
14760
  return box;
14758
14761
  };
14759
- asking = (renderer, id) => new TextareaRenderable(renderer, {
14762
+ asking = (renderer, id, placeholder = "Type to filter…") => new TextareaRenderable(renderer, {
14760
14763
  id,
14761
14764
  height: ROW_HEIGHT,
14762
14765
  wrapMode: "none",
14763
14766
  flexShrink: 0,
14764
14767
  marginLeft: GUTTER_X,
14765
14768
  marginRight: GUTTER_X,
14766
- placeholder: "Type to filter…",
14769
+ placeholder,
14767
14770
  placeholderColor: palette.faint,
14768
14771
  backgroundColor: palette.panel,
14769
14772
  focusedBackgroundColor: palette.panel,
@@ -14844,7 +14847,7 @@ var init_render = __esmMin((() => {
14844
14847
  makeFoundParts = (renderer) => {
14845
14848
  const box = makePalette(renderer);
14846
14849
  const title = bar(renderer, "found-title", palette.faint);
14847
- const query = asking(renderer, "found-query");
14850
+ const query = asking(renderer, "found-query", "Type what to look for…");
14848
14851
  const peek = bar(renderer, "found-peek", palette.muted);
14849
14852
  const choices = makeChoices(renderer);
14850
14853
  box.id = "found";
@@ -15204,11 +15207,16 @@ var init_render = __esmMin((() => {
15204
15207
  PANEL_LEAD = 3;
15205
15208
  PANEL_EMPTY = "No comment on this branch yet.";
15206
15209
  restingOrHere = (focused) => focused ? palette.selection : palette.resting;
15210
+ FOUND_LEAST = 6;
15211
+ nothingYet = (state, room) => {
15212
+ const wanted = state.query.trim();
15213
+ if (wanted.length === 0 || state.term.length === 0) return "".padEnd(room);
15214
+ return clip(` nothing uses ${wanted}`, room).padEnd(room);
15215
+ };
15207
15216
  foundTitle = (state) => {
15208
- const shown = shownMatches(state).length;
15209
15217
  const all = state.matches.length;
15210
- const said = shown === all ? `${all} elsewhere` : `${shown} of ${all} elsewhere`;
15211
- return `${state.term} · ${said}`;
15218
+ if (state.term.length === 0) return "Look for something";
15219
+ return `${state.term} · ${all === 1 ? "1 place" : `${all} places`}`;
15212
15220
  };
15213
15221
  fileRow = (match, room) => {
15214
15222
  const said = ` ${match.changed ? marks().comment : " "} ${clipHead(match.path, Math.max(8, room - 3))}`;
@@ -15810,11 +15818,12 @@ var init_render = __esmMin((() => {
15810
15818
  if (at === state.matchIndex) chosen = blocks.length;
15811
15819
  blocks.push(blockOf(match, wide, at === state.matchIndex));
15812
15820
  }
15813
- const window = windowedBlocks(blocks, chosen, Math.max(3, most - PALETTE_CHROME));
15814
- this.foundChoices.content = new StyledText([...window.chunks]);
15821
+ const tall = Math.max(FOUND_LEAST, most - PALETTE_CHROME);
15822
+ const window = windowedBlocks(blocks, chosen, tall);
15823
+ this.foundChoices.content = blocks.length === 0 ? new StyledText([fg(palette.faint)(nothingYet(state, wide))]) : new StyledText([...window.chunks]);
15815
15824
  this.foundPeek.content = "";
15816
15825
  this.foundPeek.height = 0;
15817
- this.found.height = Math.min(most, window.rows + PALETTE_CHROME);
15826
+ this.found.height = Math.min(most, Math.max(FOUND_LEAST, window.rows) + PALETTE_CHROME);
15818
15827
  this.found.width = room;
15819
15828
  this.found.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
15820
15829
  this.found.top = panelTop(this.renderer.height, PANEL_FIFTH);
@@ -16039,7 +16048,7 @@ var init_upgrade = __esmMin((() => {
16039
16048
  return due ? `adiff ${latest} is out · adiff upgrade` : "";
16040
16049
  }).pipe(withSpan("Tui.upgradeHint"));
16041
16050
  upgradeHint = worded.pipe(orElseSucceed(() => ""));
16042
- })), LEAVING_SAID, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, PASTERS, PASTE_MS, SEED_MOST, clipped, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
16051
+ })), LOOK_MS, LEAVING_SAID, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
16043
16052
  var init_app = __esmMin((() => {
16044
16053
  init_dist();
16045
16054
  init_report();
@@ -16057,6 +16066,7 @@ var init_app = __esmMin((() => {
16057
16066
  init_intent();
16058
16067
  init_session();
16059
16068
  init_upgrade();
16069
+ LOOK_MS = 110;
16060
16070
  LEAVING_SAID = "press ctrl+c again to leave";
16061
16071
  NOTICE_MS = 2200;
16062
16072
  KEY_HISTORY = 40;
@@ -16082,33 +16092,7 @@ var init_app = __esmMin((() => {
16082
16092
  win32: ["clip"]
16083
16093
  };
16084
16094
  wayland = () => process.env["WAYLAND_DISPLAY"] === void 0 ? void 0 : ["wl-copy"];
16085
- PASTERS = {
16086
- darwin: ["pbpaste"],
16087
- linux: [
16088
- "xclip",
16089
- "-selection",
16090
- "clipboard",
16091
- "-o"
16092
- ]
16093
- };
16094
- PASTE_MS = 300;
16095
- SEED_MOST = 120;
16096
- clipped = () => {
16097
- if (!process.stdout.isTTY) return "";
16098
- const [command, ...rest] = (process.env["WAYLAND_DISPLAY"] === void 0 ? PASTERS[platform()] : ["wl-paste"]) ?? [];
16099
- if (command === void 0) return "";
16100
- const read = spawnSync(command, [...rest], {
16101
- encoding: "utf8",
16102
- timeout: PASTE_MS
16103
- });
16104
- return read.status === 0 ? read.stdout ?? "" : "";
16105
- };
16106
- seedFor = (picked) => {
16107
- if (picked !== void 0 && picked.trim().length > 0) return picked.trim();
16108
- const held = clipped().trim();
16109
- const one = held.split("\n")[0] ?? "";
16110
- return one.length > 0 && one.length <= SEED_MOST && one === held ? one : "";
16111
- };
16095
+ seedFor = (picked) => picked?.trim() ?? "";
16112
16096
  handOver = (text) => {
16113
16097
  if (!process.stdout.isTTY) return;
16114
16098
  const named = wayland() ?? COPIERS[platform()];
@@ -16226,6 +16210,7 @@ var init_app = __esmMin((() => {
16226
16210
  chosen = {};
16227
16211
  selectingNow = false;
16228
16212
  leaving;
16213
+ looking;
16229
16214
  grewWithShift = false;
16230
16215
  keys = [];
16231
16216
  trail = [];
@@ -16263,6 +16248,7 @@ var init_app = __esmMin((() => {
16263
16248
  renderer.keyInput.on("keyrelease", (key) => this.letGo(key));
16264
16249
  renderer.on("destroy", () => this.stopWatching());
16265
16250
  renderer.on("destroy", () => this.stopFading());
16251
+ renderer.on("destroy", () => this.stopLooking());
16266
16252
  renderer.on("destroy", () => this.stopLighting());
16267
16253
  renderer.on("destroy", () => void getTreeSitterClient().destroy());
16268
16254
  renderer.on("destroy", () => this.stopPainting());
@@ -16636,6 +16622,7 @@ var init_app = __esmMin((() => {
16636
16622
  query: clean,
16637
16623
  paletteIndex: 0
16638
16624
  });
16625
+ if (this.state.screen === "search") this.lookSoon(clean);
16639
16626
  }
16640
16627
  readBack(text) {
16641
16628
  const clean = legible(stripAnsiSequences(text));
@@ -16732,10 +16719,28 @@ var init_app = __esmMin((() => {
16732
16719
  runSync(this.display.askWith(seed));
16733
16720
  });
16734
16721
  }
16722
+ lookSoon(wanted) {
16723
+ this.stopLooking();
16724
+ this.looking = setTimeout(() => {
16725
+ this.looking = void 0;
16726
+ const asked = wanted.trim();
16727
+ if (this.state.screen !== "search" || this.state.query.trim() !== asked) return;
16728
+ this.dispatchTask(asked.length === 0 ? this.forgetMatches() : this.lookFor(asked));
16729
+ }, LOOK_MS);
16730
+ }
16731
+ stopLooking() {
16732
+ if (this.looking === void 0) return;
16733
+ clearTimeout(this.looking);
16734
+ this.looking = void 0;
16735
+ }
16736
+ forgetMatches() {
16737
+ return sync(() => this.commit(withMatches(this.state, [], "")));
16738
+ }
16735
16739
  runFinder() {
16736
16740
  return gen({ self: this }, function* () {
16737
16741
  const wanted = this.state.query.trim();
16738
16742
  if (wanted.length > 0 && wanted !== this.state.term) {
16743
+ this.stopLooking();
16739
16744
  yield* this.lookFor(wanted);
16740
16745
  return;
16741
16746
  }
@@ -16746,16 +16751,11 @@ var init_app = __esmMin((() => {
16746
16751
  return gen({ self: this }, function* () {
16747
16752
  const branch = selectedBranch(this.state);
16748
16753
  if (branch === void 0) return;
16749
- const elsewhere = (yield* searchBranch(this.repo, branch.branch, wanted)).filter((match) => !this.isHere(match));
16750
- this.commit(withMatches(this.state, elsewhere, wanted));
16751
- if (elsewhere.length === 0) this.commit(withNoticeHere(this.state, `no other place uses ${wanted}`));
16754
+ const reading = this.reading;
16755
+ const found = reading === void 0 || reading.worktree.branch !== branch.branch ? yield* searchBranch(this.repo, branch.branch, wanted) : yield* searchIn(reading, wanted);
16756
+ this.commit(withMatches(this.state, found, wanted));
16752
16757
  });
16753
16758
  }
16754
- isHere(match) {
16755
- const patch = selectedPatch(this.state);
16756
- if (patch === void 0 || patch.path !== match.path) return false;
16757
- return sourceLineAt(this.state, this.state.cursor) === match.line;
16758
- }
16759
16759
  openMatch() {
16760
16760
  return gen({ self: this }, function* () {
16761
16761
  const match = matchHere(this.state);
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.103",
26
+ "version": "0.1.0-alpha.105",
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": {