@eliya-oss/agent-diff 0.1.0-alpha.176 → 0.1.0-alpha.178

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,24 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.178
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(diff): a removed line and an added line that differ only in their indentation are washed dimmer than a change, so a block wrapped in a new function reads as one wrapper and not as a rewrite of every line inside it.
8
+
9
+ ## 0.1.0-alpha.177
10
+
11
+ ### Patch Changes
12
+
13
+ - feat(review): `]` on the last file comes around to the first, `[` on the first to the last, and `j`/`k` in the file list do the same.
14
+
15
+ <details><summary>What was wrong</summary>
16
+
17
+ The walk stopped at either end, so getting from the last file back to the first meant pressing `[`
18
+ once per file. The footer says `around to the first file` when the walk wraps.
19
+
20
+ </details>
21
+
3
22
  ## 0.1.0-alpha.176
4
23
 
5
24
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10027,7 +10027,7 @@ var init_config = __esmMin((() => {
10027
10027
  //#region package.json
10028
10028
  init_pane();
10029
10029
  init_config();
10030
- var version$1 = "0.1.0-alpha.176";
10030
+ var version$1 = "0.1.0-alpha.178";
10031
10031
  //#endregion
10032
10032
  //#region src/cli/error.ts
10033
10033
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered;
@@ -11501,6 +11501,48 @@ var init_parse = __esmMin((() => {
11501
11501
  };
11502
11502
  }));
11503
11503
  //#endregion
11504
+ //#region src/domain/patch/reindent.ts
11505
+ var known$1, body, addedByBody, firstAbove, removedWithBody, pairsIn, reindentRows;
11506
+ var init_reindent = __esmMin((() => {
11507
+ known$1 = /* @__PURE__ */ new WeakMap();
11508
+ body = (row) => row.text.trimStart();
11509
+ addedByBody = (rows) => {
11510
+ const found = /* @__PURE__ */ new Map();
11511
+ for (const row of rows) {
11512
+ if (row.kind !== "added" || body(row).length === 0) continue;
11513
+ const text = body(row);
11514
+ const at = found.get(text);
11515
+ if (at === void 0) found.set(text, [row.index]);
11516
+ else at.push(row.index);
11517
+ }
11518
+ return found;
11519
+ };
11520
+ firstAbove = (free, floor) => {
11521
+ while (free.length > 0 && (free[0] ?? -1) <= floor) free.shift();
11522
+ return free.shift();
11523
+ };
11524
+ removedWithBody = (hunk) => hunk.rows.filter((row) => row.kind === "removed" && body(row).length > 0);
11525
+ pairsIn = (hunk, paired) => {
11526
+ const added = addedByBody(hunk.rows);
11527
+ let floor = -1;
11528
+ for (const row of removedWithBody(hunk)) {
11529
+ const match = firstAbove(added.get(body(row)) ?? [], floor);
11530
+ if (match === void 0) continue;
11531
+ floor = match;
11532
+ paired.add(row.index);
11533
+ paired.add(match);
11534
+ }
11535
+ };
11536
+ reindentRows = (patch) => {
11537
+ const had = known$1.get(patch);
11538
+ if (had !== void 0) return had;
11539
+ const paired = /* @__PURE__ */ new Set();
11540
+ for (const hunk of patch.hunks) pairsIn(hunk, paired);
11541
+ known$1.set(patch, paired);
11542
+ return paired;
11543
+ };
11544
+ }));
11545
+ //#endregion
11504
11546
  //#region src/domain/patch/sticky.ts
11505
11547
  var CLOSER, COMMENT, LOOKAHEAD, indentOf, pinnable, limitFrom, stickyChain, kept;
11506
11548
  var init_sticky = __esmMin((() => {
@@ -11547,6 +11589,7 @@ var init_sticky = __esmMin((() => {
11547
11589
  var init_patch = __esmMin((() => {
11548
11590
  init_anchor();
11549
11591
  init_parse();
11592
+ init_reindent();
11550
11593
  init_sticky();
11551
11594
  init_model$5();
11552
11595
  }));
@@ -17389,7 +17432,7 @@ var init_notes = __esmMin((() => {
17389
17432
  }));
17390
17433
  //#endregion
17391
17434
  //#region src/tui/reduce.ts
17392
- var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, atLayer, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, foldMoved, overFold, readingThread, overThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile$1, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack$1, walkMatches$1, openPalette, openKeys, openSettings, moveSettings, flipSetting, moveAsk, moveRef, withChoices, withRefs, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, 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, withAround, withNoticeHere, withNotice;
17435
+ var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, atLayer, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, foldMoved, overFold, readingThread, overThread, fold, moveBranch, landingOn, revealing, atTheEnd, aroundTheEnd, CAME_AROUND, moveFile$1, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack$1, walkMatches$1, openPalette, openKeys, openSettings, moveSettings, flipSetting, moveAsk, moveRef, withChoices, withRefs, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, 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, withAround, withNoticeHere, withNotice;
17393
17436
  var init_reduce = __esmMin((() => {
17394
17437
  init_dist();
17395
17438
  init_patch();
@@ -17775,13 +17818,22 @@ var init_reduce = __esmMin((() => {
17775
17818
  const wanted = at + delta;
17776
17819
  return at !== -1 && (wanted < 0 || wanted >= readingOrder(state).length);
17777
17820
  };
17821
+ aroundTheEnd = (state, delta) => {
17822
+ const at = placeIn(state);
17823
+ return delta > 0 ? -at : readingOrder(state).length - 1 - at;
17824
+ };
17825
+ CAME_AROUND = {
17826
+ forward: "around to the first file",
17827
+ back: "around to the last file"
17828
+ };
17778
17829
  moveFile$1 = (state, delta) => {
17779
- if (atTheEnd(state, delta)) return withNoticeHere(state, delta > 0 ? "last file" : "first file");
17780
- const next = layerFile(state, delta);
17781
- const layer = onLayers(state) ? layerAfter(state, delta) : state.layerIndex;
17830
+ const around = atTheEnd(state, delta);
17831
+ const step = around ? aroundTheEnd(state, delta) : delta;
17832
+ const next = layerFile(state, step);
17833
+ const layer = onLayers(state) ? layerAfter(state, step) : state.layerIndex;
17782
17834
  return {
17783
17835
  ...state,
17784
- notice: "",
17836
+ notice: around ? CAME_AROUND[delta > 0 ? "forward" : "back"] : "",
17785
17837
  layerIndex: layer,
17786
17838
  openLayers: state.openLayers.includes(layer) ? state.openLayers : [...state.openLayers, layer],
17787
17839
  closed: revealing(state, next),
@@ -18480,6 +18532,10 @@ var init_theme = __esmMin((() => {
18480
18532
  removedBg: "#2e1418",
18481
18533
  addedGutter: "#1d4a2b",
18482
18534
  removedGutter: "#4a1f26",
18535
+ reindentAddedBg: "#0e1c14",
18536
+ reindentRemovedBg: "#1c1216",
18537
+ reindentAddedGutter: "#16351f",
18538
+ reindentRemovedGutter: "#33191e",
18483
18539
  pickedOn: "#2b3854",
18484
18540
  pickedOnAdded: "#22432f",
18485
18541
  pickedOnRemoved: "#4a2733",
@@ -18525,7 +18581,7 @@ var init_theme = __esmMin((() => {
18525
18581
  "note.label": { fg: "#7aa2f7" },
18526
18582
  default: { fg: ink }
18527
18583
  };
18528
- })), Code, Gap, Comment, Label, DraftLine, ProseLine, $is, $match, isCode, isDraft, isProse, isSaid, isNote, isChrome, WASH, NOTE_MIN, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, firstOfEach, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, SAID_INDENT, REMARK_MARK$1, remarkHead, HELD_HEAD, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, saidLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, apart, notesAt, TRAILING, shownText, codeRow, DRAFT_STOP, draftText, draftRows, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
18584
+ })), Code, Gap, Comment, Label, DraftLine, ProseLine, $is, $match, isCode, isDraft, isProse, isSaid, isNote, isChrome, WASH, REINDENT_WASH, NOTE_MIN, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, firstOfEach, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, SAID_INDENT, REMARK_MARK$1, remarkHead, HELD_HEAD, commentHead, headOf, spokenLines, heardFrom, answerLines, REMARK_LINES, capped, bodyLines, saidLines, noteLines, REMARK_RULE, noteRows, proseRows, freshLines, proseAt, apart, notesAt, TRAILING, shownText, codeRow, DRAFT_STOP, draftText, draftRows, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
18529
18585
  var init_diffview = __esmMin((() => {
18530
18586
  init_dist();
18531
18587
  init_patch();
@@ -18549,6 +18605,16 @@ var init_diffview = __esmMin((() => {
18549
18605
  content: RGBA.fromHex(palette.removedBg)
18550
18606
  }
18551
18607
  };
18608
+ REINDENT_WASH = {
18609
+ added: {
18610
+ gutter: RGBA.fromHex(palette.reindentAddedGutter),
18611
+ content: RGBA.fromHex(palette.reindentAddedBg)
18612
+ },
18613
+ removed: {
18614
+ gutter: RGBA.fromHex(palette.reindentRemovedGutter),
18615
+ content: RGBA.fromHex(palette.reindentRemovedBg)
18616
+ }
18617
+ };
18552
18618
  NOTE_MIN = 24;
18553
18619
  OVERSCAN = 2;
18554
18620
  SIGN_WIDTH = 2;
@@ -19003,8 +19069,8 @@ var init_diffview = __esmMin((() => {
19003
19069
  }
19004
19070
  this.numbers.setLineColors(colors);
19005
19071
  }
19006
- washOf(kind) {
19007
- return WASH[kind];
19072
+ washOf(kind, reindent) {
19073
+ return reindent ? REINDENT_WASH[kind] : WASH[kind];
19008
19074
  }
19009
19075
  };
19010
19076
  startsOf = (display) => {
@@ -19978,7 +20044,7 @@ var init_paint = __esmMin((() => {
19978
20044
  if (flags.cursor) return UNDER_CURSOR[kind] ?? PLAIN_CURSOR;
19979
20045
  if (flags.selected) return PICKED[kind] ?? PLAIN_PICKED;
19980
20046
  if (flags.gap) return GAP_PAINT;
19981
- return view.washOf(kind);
20047
+ return view.washOf(kind, flags.reindent);
19982
20048
  };
19983
20049
  PLAIN_PICKED = {
19984
20050
  gutter: RGBA.fromHex(palette.pickedGutter),
@@ -21392,13 +21458,15 @@ var init_render = __esmMin((() => {
21392
21458
  const shown = shownOf(state);
21393
21459
  const rows = shown?.patch.rows ?? [];
21394
21460
  const gaps = shown === void 0 ? /* @__PURE__ */ new Set() : gapRowSet(shown);
21461
+ const reindents = shown === void 0 ? /* @__PURE__ */ new Set() : reindentRows(shown.patch);
21395
21462
  return (row) => {
21396
21463
  const kind = rows[row]?.kind;
21397
21464
  if (kind === void 0) return void 0;
21398
21465
  return pickPaint(this.view, kind, {
21399
21466
  cursor: row === state.cursor,
21400
21467
  selected: selecting && row >= from && row <= to,
21401
- gap: gaps.has(row)
21468
+ gap: gaps.has(row),
21469
+ reindent: reindents.has(row)
21402
21470
  });
21403
21471
  };
21404
21472
  }
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.176",
26
+ "version": "0.1.0-alpha.178",
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": {