@eliya-oss/agent-diff 0.1.0-alpha.130 → 0.1.0-alpha.131

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.131
4
+
5
+ ### Patch Changes
6
+
7
+ - A file whose content did not change says what did. Making a file executable, or renaming it, showed a diff pane containing a single bare line number and nothing else — no cursor, no explanation, and `j` did nothing because the pane had no rows. git reports both; adiff dropped the lines. It now says `mode changed, 100644 to 100755` or `renamed from pkg/gizmo.ts`, and shows the diff underneath when there is one.
8
+
9
+ That bare line number was a patch with no rows being given one blank display row and numbering it. No patch can end up with no rows now, and a row that sits on no line of either side no longer borrows a number — which also cleans up the "no newline at end of file" marker.
10
+
3
11
  ## 0.1.0-alpha.130
4
12
 
5
13
  ### Patch Changes
package/dist/main.js CHANGED
@@ -9584,7 +9584,7 @@ var init_anchor = __esmMin((() => {
9584
9584
  }));
9585
9585
  //#endregion
9586
9586
  //#region src/domain/patch/parse.ts
9587
- var FILE_MARKER, HUNK_MARKER, BINARY_MARKER, NO_NEWLINE_MARKER, NO_NEWLINE_SAID, BINARY_SAID, BLOB_MARKER, OLD_PATH_MARKER, NEW_PATH_MARKER, HUNK_HEADER, FILE_HEADER, SIGNS$1, draftFrom, openHunk, appendRow, appendMarker, readBody, readBinary, readHeader, parsePatches;
9587
+ var FILE_MARKER, HUNK_MARKER, BINARY_MARKER, NO_NEWLINE_MARKER, NO_NEWLINE_SAID, BINARY_SAID, MODE_OLD_MARKER, MODE_NEW_MARKER, FILE_ADDED_MARKER, FILE_GONE_MARKER, EMPTY_ADDED_SAID, EMPTY_GONE_SAID, NOTHING_SAID, BLOB_MARKER, OLD_PATH_MARKER, NEW_PATH_MARKER, HUNK_HEADER, FILE_HEADER, SIGNS$1, MADE_SAID, FROM_MARKERS, draftFrom, openHunk, appendRow, appendMarker, readBody, openPlain, told$1, notesOf$1, readMode, readMeta, readBinary, readHeader, readLine, parsePatches;
9588
9588
  var init_parse$1 = __esmMin((() => {
9589
9589
  init_dist();
9590
9590
  FILE_MARKER = "diff --git ";
@@ -9593,6 +9593,13 @@ var init_parse$1 = __esmMin((() => {
9593
9593
  NO_NEWLINE_MARKER = "\";
9594
9594
  NO_NEWLINE_SAID = "no newline at end of file";
9595
9595
  BINARY_SAID = "binary file, adiff cannot show what changed in it";
9596
+ MODE_OLD_MARKER = "old mode ";
9597
+ MODE_NEW_MARKER = "new mode ";
9598
+ FILE_ADDED_MARKER = "new file mode ";
9599
+ FILE_GONE_MARKER = "deleted file mode ";
9600
+ EMPTY_ADDED_SAID = "added an empty file";
9601
+ EMPTY_GONE_SAID = "deleted an empty file";
9602
+ NOTHING_SAID = "no lines changed";
9596
9603
  BLOB_MARKER = "index ";
9597
9604
  OLD_PATH_MARKER = "--- ";
9598
9605
  NEW_PATH_MARKER = "+++ ";
@@ -9603,6 +9610,18 @@ var init_parse$1 = __esmMin((() => {
9603
9610
  "+": "added",
9604
9611
  "-": "removed"
9605
9612
  };
9613
+ MADE_SAID = {
9614
+ added: EMPTY_ADDED_SAID,
9615
+ deleted: EMPTY_GONE_SAID,
9616
+ changed: NOTHING_SAID
9617
+ };
9618
+ FROM_MARKERS = [{
9619
+ marker: "rename from ",
9620
+ said: "renamed from"
9621
+ }, {
9622
+ marker: "copy from ",
9623
+ said: "copied from"
9624
+ }];
9606
9625
  draftFrom = (line) => {
9607
9626
  const named = FILE_HEADER.exec(line);
9608
9627
  return {
@@ -9610,6 +9629,9 @@ var init_parse$1 = __esmMin((() => {
9610
9629
  previousPath: named?.[1] ?? "",
9611
9630
  blob: "",
9612
9631
  headerLines: [line],
9632
+ notes: [],
9633
+ oldMode: "",
9634
+ made: "changed",
9613
9635
  hunks: [],
9614
9636
  rows: [],
9615
9637
  added: 0,
@@ -9666,16 +9688,47 @@ var init_parse$1 = __esmMin((() => {
9666
9688
  const kind = SIGNS$1[line.slice(0, 1)];
9667
9689
  if (kind !== void 0) appendRow(draft, kind, line.slice(1));
9668
9690
  };
9669
- readBinary = (draft, line) => {
9670
- if (!line.startsWith(BINARY_MARKER)) return false;
9691
+ openPlain = (draft) => {
9671
9692
  draft.hunks.push({
9672
9693
  marker: "",
9673
9694
  scope: "",
9674
- startRow: 0,
9695
+ startRow: draft.rows.length,
9675
9696
  newStart: 1,
9676
9697
  rows: [],
9677
9698
  skipped: 0
9678
9699
  });
9700
+ };
9701
+ told$1 = (draft, said) => {
9702
+ if (draft.hunks.length > 0 || said.length === 0) return;
9703
+ openPlain(draft);
9704
+ for (const text of said) appendMarker(draft, text);
9705
+ };
9706
+ notesOf$1 = (draft) => draft.notes.length > 0 ? draft.notes : [MADE_SAID[draft.made]];
9707
+ readMode = (draft, line) => {
9708
+ if (line.startsWith(MODE_OLD_MARKER)) {
9709
+ draft.oldMode = line.slice(9).trim();
9710
+ return true;
9711
+ }
9712
+ if (!line.startsWith(MODE_NEW_MARKER)) return false;
9713
+ const now = line.slice(9).trim();
9714
+ draft.notes.push(`mode changed, ${draft.oldMode} to ${now}`);
9715
+ return true;
9716
+ };
9717
+ readMeta = (draft, line) => {
9718
+ if (readMode(draft, line)) return true;
9719
+ if (line.startsWith(FILE_ADDED_MARKER) || line.startsWith(FILE_GONE_MARKER)) {
9720
+ draft.made = line.startsWith(FILE_ADDED_MARKER) ? "added" : "deleted";
9721
+ return true;
9722
+ }
9723
+ const from = FROM_MARKERS.find((entry) => line.startsWith(entry.marker));
9724
+ if (from === void 0) return false;
9725
+ draft.notes.push(`${from.said} ${line.slice(from.marker.length)}`);
9726
+ return true;
9727
+ };
9728
+ readBinary = (draft, line) => {
9729
+ if (!line.startsWith(BINARY_MARKER)) return false;
9730
+ told$1(draft, draft.notes);
9731
+ openPlain(draft);
9679
9732
  appendRow(draft, "context", BINARY_SAID);
9680
9733
  return true;
9681
9734
  };
@@ -9691,6 +9744,17 @@ var init_parse$1 = __esmMin((() => {
9691
9744
  }
9692
9745
  return false;
9693
9746
  };
9747
+ readLine = (draft, line) => {
9748
+ if (readHeader(draft, line)) return;
9749
+ if (readMeta(draft, line)) return;
9750
+ if (readBinary(draft, line)) return;
9751
+ if (!line.startsWith(HUNK_MARKER)) {
9752
+ readBody(draft, line);
9753
+ return;
9754
+ }
9755
+ told$1(draft, draft.notes);
9756
+ openHunk(draft, line);
9757
+ };
9694
9758
  parsePatches = (diff) => {
9695
9759
  const drafts = [];
9696
9760
  for (const line of diff.split("\n")) {
@@ -9699,12 +9763,9 @@ var init_parse$1 = __esmMin((() => {
9699
9763
  continue;
9700
9764
  }
9701
9765
  const draft = drafts.at(-1);
9702
- if (draft === void 0) continue;
9703
- if (readHeader(draft, line)) continue;
9704
- if (readBinary(draft, line)) continue;
9705
- if (line.startsWith(HUNK_MARKER)) openHunk(draft, line);
9706
- else readBody(draft, line);
9766
+ if (draft !== void 0) readLine(draft, line);
9707
9767
  }
9768
+ for (const draft of drafts) told$1(draft, notesOf$1(draft));
9708
9769
  return drafts;
9709
9770
  };
9710
9771
  }));
@@ -10985,7 +11046,7 @@ var init_pane = __esmMin((() => {
10985
11046
  init_drafts();
10986
11047
  init_init();
10987
11048
  init_pane();
10988
- var version$1 = "0.1.0-alpha.130";
11049
+ var version$1 = "0.1.0-alpha.131";
10989
11050
  //#endregion
10990
11051
  //#region src/cli/upgrade.ts
10991
11052
  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;
@@ -15456,7 +15517,7 @@ var init_theme = __esmMin((() => {
15456
15517
  }));
15457
15518
  //#endregion
15458
15519
  //#region src/tui/diffview.ts
15459
- var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
15520
+ var WASH, NOTE_MIN, ANSWER_MARK, REPLY_MARK, OVERSCAN, SIGN_WIDTH, SCROLL_ROWS, PAN_COLUMNS, WAYS, notchesIn, takenOver, wheelTo, SIGNS, numberFor, DiffView, startsOf, numbered, bareOf, noteKey, keyOf, groupOf, isChrome, alike, heldAt, sameLine, NO_SPANS, lineStarts, overLine, shifted, acrossLines, spansByLine, textAt, noteSpans, NOTE_PAINT, wrap, headOf, spokenLines, answerLines, noteLines, noteRows, proseRows, freshLines, proseAt, notesAt, TRAILING, shownText, codeRow, rowsFor, replacedBy, layout, lineNumbers, BARE_SIGN, signFor, lineSigns, sideLineOf;
15460
15521
  var init_diffview = __esmMin((() => {
15461
15522
  init_dist();
15462
15523
  init_patch();
@@ -15674,7 +15735,7 @@ var init_diffview = __esmMin((() => {
15674
15735
  this.code.filetype = pathToFiletype(patch.path) ?? "text";
15675
15736
  this.feed();
15676
15737
  this.numbers.setLineNumbers(lineNumbers(patch, this.display));
15677
- this.numbers.setHideLineNumbers(bareOf(this.display));
15738
+ this.numbers.setHideLineNumbers(bareOf(patch, this.display));
15678
15739
  this.numbers.setLineSigns(lineSigns(patch, this.display));
15679
15740
  this.numbers.setLineColors(/* @__PURE__ */ new Map());
15680
15741
  }
@@ -15903,7 +15964,14 @@ var init_diffview = __esmMin((() => {
15903
15964
  for (const [index, entry] of display.entries()) if (!entry.comment && !starts.has(entry.row)) starts.set(entry.row, index);
15904
15965
  return starts;
15905
15966
  };
15906
- bareOf = (display) => new Set(display.flatMap((entry, index) => entry.comment || entry.gap || entry.prose ? [index] : []));
15967
+ numbered = (rows, entry) => {
15968
+ const row = rows.get(entry.row);
15969
+ return row !== void 0 && numberFor(row) !== void 0;
15970
+ };
15971
+ bareOf = (patch, display) => {
15972
+ const rows = new Map(patch.rows.map((row) => [row.index, row]));
15973
+ return new Set(display.flatMap((entry, index) => entry.comment || entry.gap || entry.prose || !numbered(rows, entry) ? [index] : []));
15974
+ };
15907
15975
  noteKey = (note) => [
15908
15976
  `${note.side}${note.line}:${note.folded ? "-" : "+"}${note.body}`,
15909
15977
  note.settled ? "settled" : note.asks ? "asked" : "open",
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.130",
26
+ "version": "0.1.0-alpha.131",
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": {