@eliya-oss/agent-diff 0.1.0-alpha.202 → 0.1.0-alpha.203

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,11 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.203
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(CLI): `patch show` tags each changed row with `quietIn`, the layers that keep it in place, quiet, rather than fold it.
8
+
3
9
  ## 0.1.0-alpha.202
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10083,7 +10083,7 @@ var init_config = __esmMin((() => {
10083
10083
  //#region package.json
10084
10084
  init_pane();
10085
10085
  init_config();
10086
- var version$1 = "0.1.0-alpha.202";
10086
+ var version$1 = "0.1.0-alpha.203";
10087
10087
  //#endregion
10088
10088
  //#region src/cli/error.ts
10089
10089
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -13545,7 +13545,7 @@ var init_branches$1 = __esmMin((() => {
13545
13545
  }));
13546
13546
  //#endregion
13547
13547
  //#region src/review/patches.ts
13548
- var findPatch, blobOf, wholeFile, rowAt, picked, anchorWith, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
13548
+ var findPatch, blobOf, wholeFile, rowAt, picked, anchorWith, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$3, isNote$1, shownRow, shownHunk, scopesOf, shownFile, sourceShown, fileShown$1, shownAs, onDisk$1, show$3;
13549
13549
  var init_patches = __esmMin((() => {
13550
13550
  init_dist();
13551
13551
  init_patch();
@@ -13618,7 +13618,7 @@ var init_patches = __esmMin((() => {
13618
13618
  return context ?? 3;
13619
13619
  };
13620
13620
  GENERATED_NAME = /\.generated\./;
13621
- lineOf$2 = (side, line) => match$3(line, {
13621
+ lineOf$3 = (side, line) => match$3(line, {
13622
13622
  onNone: () => ({}),
13623
13623
  onSome: (at) => ({ [side]: at })
13624
13624
  });
@@ -13628,8 +13628,8 @@ var init_patches = __esmMin((() => {
13628
13628
  text: row.text
13629
13629
  } : {
13630
13630
  kind: row.kind,
13631
- ...lineOf$2("old", row.oldLine),
13632
- ...lineOf$2("new", row.newLine),
13631
+ ...lineOf$3("old", row.oldLine),
13632
+ ...lineOf$3("new", row.newLine),
13633
13633
  text: row.text
13634
13634
  };
13635
13635
  shownHunk = (hunk) => ({
@@ -13665,15 +13665,15 @@ var init_patches = __esmMin((() => {
13665
13665
  show$3 = fn("Review.Diff.show")(function* (based, showing) {
13666
13666
  const git = yield* Git;
13667
13667
  const { worktree } = based;
13668
- const patches$2 = yield* patches(worktree, linesAround(showing.context), showing.file);
13669
- const [generated] = yield* all([git.generated(worktree, patches$2.map((patch) => patch.path)), git.keep(worktree, onDisk$1(patches$2))], { concurrency: 2 });
13668
+ const patches$3 = yield* patches(worktree, linesAround(showing.context), showing.file);
13669
+ const [generated] = yield* all([git.generated(worktree, patches$3.map((patch) => patch.path)), git.keep(worktree, onDisk$1(patches$3))], { concurrency: 2 });
13670
13670
  return {
13671
13671
  branch: worktree.branch,
13672
13672
  base: based.base,
13673
13673
  mergeBase: worktree.base,
13674
13674
  head: worktree.head,
13675
- files: yield* forEach(patches$2, fileShown$1(worktree, generated), { concurrency: 16 }),
13676
- order: treeOrder(patches$2.map((patch) => patch.path))
13675
+ files: yield* forEach(patches$3, fileShown$1(worktree, generated), { concurrency: 16 }),
13676
+ order: treeOrder(patches$3.map((patch) => patch.path))
13677
13677
  };
13678
13678
  });
13679
13679
  }));
@@ -13891,12 +13891,46 @@ var init_version = __esmMin((() => {
13891
13891
  total: gap.total
13892
13892
  };
13893
13893
  };
13894
+ })), lineOf$2, quietRows, quietKey, holds, quietFor, quietLayers;
13895
+ var init_quiet = __esmMin((() => {
13896
+ init_dist();
13897
+ lineOf$2 = (row) => getOrUndefined$1(orElse(row.newLine, () => row.oldLine));
13898
+ quietRows = (hunk, mine) => {
13899
+ const quiet = /* @__PURE__ */ new Set();
13900
+ if (!hunk.rows.some((row) => row.kind !== "context" && mine(row))) return quiet;
13901
+ let run = [];
13902
+ const flush = () => {
13903
+ if (run.length < 8) for (const row of run) quiet.add(row);
13904
+ run = [];
13905
+ };
13906
+ for (const row of hunk.rows) if (row.kind === "context" || mine(row)) flush();
13907
+ else run.push(row);
13908
+ flush();
13909
+ return quiet;
13910
+ };
13911
+ quietKey = (kind, line) => `${kind}:${line}`;
13912
+ holds = (spans, path, row) => {
13913
+ const line = lineOf$2(row);
13914
+ return line !== void 0 && spans.some((span) => span.path === path && span.start <= line && span.end >= line);
13915
+ };
13916
+ quietFor = (patch, spans) => patch.hunks.flatMap((hunk) => [...quietRows(hunk, (row) => holds(spans, patch.path, row))]);
13917
+ quietLayers = (patch, layers) => {
13918
+ const found = /* @__PURE__ */ new Map();
13919
+ for (const [at, spans] of layers.entries()) for (const row of quietFor(patch, spans)) {
13920
+ const line = lineOf$2(row);
13921
+ if (line === void 0) continue;
13922
+ const key = quietKey(row.kind, line);
13923
+ found.set(key, [...found.get(key) ?? [], at + 1]);
13924
+ }
13925
+ return found;
13926
+ };
13894
13927
  }));
13895
13928
  //#endregion
13896
13929
  //#region src/domain/layers/index.ts
13897
13930
  var init_layers$1 = __esmMin((() => {
13898
13931
  init_coverage();
13899
13932
  init_version();
13933
+ init_quiet();
13900
13934
  init_model$3();
13901
13935
  }));
13902
13936
  //#endregion
@@ -15825,7 +15859,7 @@ var init_preferences = __esmMin((() => {
15825
15859
  }));
15826
15860
  //#endregion
15827
15861
  //#region src/review/layers.ts
15828
- var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, partIn, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, coversThread, readsFile, lastHolding, layersHolding$1, loudest, partWithThreads, withThreads, readReport, view, show$1, placeThreads, spansIn, layersAt, taggedRow, nearestNew, lineNow, taggedHunk, taggedFile, tagSince, tagRows, read, partsOfFile, vouchPart, askingFor, openAskOf, askIn, seenOf, ask, claims, vouchIn;
15862
+ var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, partIn, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, coversThread, readsFile, lastHolding, layersHolding$1, loudest, partWithThreads, withThreads, readReport, view, show$1, placeThreads, spansIn, layersAt, taggedRow, nearestNew, lineNow, taggedHunk, taggedFile, tagSince, quietRow, quietFile, tagRows, read, partsOfFile, vouchPart, askingFor, openAskOf, askIn, seenOf, ask, claims, vouchIn;
15829
15863
  var init_layers = __esmMin((() => {
15830
15864
  init_dist();
15831
15865
  init_layers$1();
@@ -16126,15 +16160,31 @@ var init_layers = __esmMin((() => {
16126
16160
  });
16127
16161
  return spans.length === 0 ? shown : taggedFile(spans, shown, true);
16128
16162
  });
16163
+ quietRow = (quiet, row) => {
16164
+ const line = row.new ?? row.old;
16165
+ const quietIn = line === void 0 ? void 0 : quiet.get(quietKey(row.kind, line));
16166
+ return quietIn === void 0 ? row : {
16167
+ ...row,
16168
+ quietIn
16169
+ };
16170
+ };
16171
+ quietFile = (spans, patches, file) => {
16172
+ const patch = patches.find((one) => one.path === file.path);
16173
+ if (patch === void 0) return file;
16174
+ const quiet = quietLayers(patch, spans);
16175
+ if (quiet.size === 0) return file;
16176
+ return Object.assign({}, file, { hunks: file.hunks.map((hunk) => Object.assign({}, hunk, { rows: hunk.rows.map((row) => quietRow(quiet, row)) })) });
16177
+ };
16129
16178
  tagRows = fn("Review.Layers.tagRows")(function* (worktree, shown) {
16179
+ const patches$2 = yield* patches(worktree);
16130
16180
  const spans = yield* spansIn({
16131
16181
  worktree,
16132
- patches: yield* patches(worktree)
16182
+ patches: patches$2
16133
16183
  });
16134
16184
  if (spans.length === 0) return shown;
16135
16185
  return {
16136
16186
  ...shown,
16137
- files: shown.files.map((file) => taggedFile(spans, file))
16187
+ files: shown.files.map((file) => quietFile(spans, patches$2, taggedFile(spans, file)))
16138
16188
  };
16139
16189
  });
16140
16190
  read = fn("Review.Layers.read")(function* (reading) {
@@ -17941,11 +17991,10 @@ var init_keys = __esmMin((() => {
17941
17991
  source: "raw"
17942
17992
  });
17943
17993
  };
17944
- })), FOLDS_FROM, sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf, openAbove, openBelow, elsewhereText, markElsewhere, keepQuiet, flushed, someRows, changedIn, firstChanged, makeRows, compose$1, cache, keyOf$1, saidOf, lineOf$1, inSpans, spansFor, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
17994
+ })), sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf, openAbove, openBelow, elsewhereText, markElsewhere, flushed, stays, keep, someRows, changedIn, firstChanged, makeRows, compose$1, cache, keyOf$1, saidOf, lineOf$1, inSpans, spansFor, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
17945
17995
  var init_gaps = __esmMin((() => {
17946
17996
  init_dist();
17947
17997
  init_layers$1();
17948
- FOLDS_FROM = 8;
17949
17998
  sourceLength = (source) => source.at(-1)?.trim() === "" ? source.length - 1 : source.length;
17950
17999
  markerText = (hidden) => {
17951
18000
  const said = `⋯ ${hidden} ${hidden === 1 ? "line" : "lines"} hidden`;
@@ -18031,27 +18080,25 @@ var init_gaps = __esmMin((() => {
18031
18080
  text: elsewhereText(lines, said)
18032
18081
  });
18033
18082
  };
18034
- keepQuiet = (made, rows) => {
18035
- for (const row of rows) {
18036
- made.quiet.add(made.rows.length);
18037
- push(made, row);
18038
- }
18039
- };
18040
18083
  flushed = (made, run) => {
18041
- if (run === void 0) return void 0;
18042
- if (run.rows.length < FOLDS_FROM) keepQuiet(made, run.rows);
18043
- else markElsewhere(made, run.rows.length, run.said);
18084
+ if (run !== void 0) markElsewhere(made, run.lines, run.said);
18085
+ };
18086
+ stays = (row, claim, quiet) => row.kind === "context" || claim.mine(row) || quiet.has(row);
18087
+ keep = (made, row, quiet) => {
18088
+ if (quiet.has(row)) made.quiet.add(made.rows.length);
18089
+ push(made, row);
18044
18090
  };
18045
18091
  someRows = (made, hunk, claim) => {
18092
+ const quiet = quietRows(hunk, claim.mine);
18046
18093
  let run;
18047
18094
  for (const row of hunk.rows) {
18048
- if (row.kind === "context" || claim.mine(row)) {
18095
+ if (stays(row, claim, quiet)) {
18049
18096
  run = flushed(made, run);
18050
- push(made, row);
18097
+ keep(made, row, quiet);
18051
18098
  continue;
18052
18099
  }
18053
18100
  run = {
18054
- rows: [...run?.rows ?? [], row],
18101
+ lines: (run?.lines ?? 0) + 1,
18055
18102
  said: run?.said ?? claim.said(row)
18056
18103
  };
18057
18104
  }
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.202",
26
+ "version": "0.1.0-alpha.203",
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": {