@eliya-oss/agent-diff 0.1.0-alpha.196 → 0.1.0-alpha.197

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,15 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.197
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(layers): `layers show` and `layers set` give every layer `added` and `removed`, the changed lines inside its own spans.
8
+
9
+ feat(layers rail): a folded layer's count line carries the lines it adds and removes, next to how many of its files are read.
10
+
11
+ feat(layers): `layers show` says which layer is `done` and which one is the `unclaimed` layer of lines no layer claims.
12
+
3
13
  ## 0.1.0-alpha.196
4
14
 
5
15
  ### 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.196";
10086
+ var version$1 = "0.1.0-alpha.197";
10087
10087
  //#endregion
10088
10088
  //#region src/cli/error.ts
10089
10089
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
@@ -13567,7 +13567,7 @@ var init_model$3 = __esmMin((() => {
13567
13567
  }));
13568
13568
  //#endregion
13569
13569
  //#region src/domain/layers/coverage.ts
13570
- var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, NOTHING, reachesOf, claimsOf, reaching, claimedBy, runsOf, tallyOf, changedHunks, coverage, sharedIn, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
13570
+ var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, NOTHING, reachesOf, claimsOf, reaching, claimedBy, claimedRow, claimedRows, linesClaimed, runsOf, tallyOf, changedHunks, coverage, sharedIn, sharedHunks, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
13571
13571
  var init_coverage = __esmMin((() => {
13572
13572
  init_dist();
13573
13573
  init_model$3();
@@ -13624,6 +13624,23 @@ var init_coverage = __esmMin((() => {
13624
13624
  return last !== void 0 && last.end >= line;
13625
13625
  };
13626
13626
  claimedBy = (reaches, changed) => changed.some((line) => reaching(reaches, line));
13627
+ claimedRow = (reaches, row) => row.kind !== "context" && match$3(orElse(row.newLine, () => row.oldLine), {
13628
+ onNone: () => false,
13629
+ onSome: (line) => reaching(reaches, line)
13630
+ });
13631
+ claimedRows = (claims, patch) => {
13632
+ const reaches = claims.get(patch.path) ?? NOTHING;
13633
+ if (reaches.length === 0) return [];
13634
+ return patch.hunks.flatMap((hunk) => hunk.rows).filter((row) => claimedRow(reaches, row));
13635
+ };
13636
+ linesClaimed = (patches, layer) => {
13637
+ const claims = claimsOf(spansOf$1([layer]));
13638
+ const rows = patches.flatMap((patch) => claimedRows(claims, patch));
13639
+ return {
13640
+ added: rows.filter((row) => row.kind === "added").length,
13641
+ removed: rows.filter((row) => row.kind === "removed").length
13642
+ };
13643
+ };
13627
13644
  runsOf = (path, lines) => {
13628
13645
  const runs = [];
13629
13646
  for (const line of lines.toSorted((a, b) => a - b)) {
@@ -15644,9 +15661,10 @@ var init_layers = __esmMin((() => {
15644
15661
  });
15645
15662
  reportedLayers = (patches, layers) => {
15646
15663
  const present = new Set(patches.map((patch) => patch.path));
15647
- return withFullCoverage(patches, layers).layers.map((layer) => {
15664
+ return withFullCoverage(patches, layers).layers.map((layer, at) => {
15648
15665
  const named = unique(spansOfLayer(layer).map((span) => span.path));
15649
15666
  const gap = coverage(patches, [layer]);
15667
+ const lines = linesClaimed(patches, layer);
15650
15668
  return {
15651
15669
  title: layer.title,
15652
15670
  note: noteOf(layer),
@@ -15655,7 +15673,10 @@ var init_layers = __esmMin((() => {
15655
15673
  prose: proseAnchors(layer).filter((anchor) => present.has(anchor.path)),
15656
15674
  covered: gap.covered,
15657
15675
  partial: gap.partial,
15658
- vanished: named.filter((path) => !present.has(path))
15676
+ added: lines.added,
15677
+ removed: lines.removed,
15678
+ vanished: named.filter((path) => !present.has(path)),
15679
+ unclaimed: at >= layers.layers.length
15659
15680
  };
15660
15681
  });
15661
15682
  };
@@ -15711,10 +15732,13 @@ var init_layers = __esmMin((() => {
15711
15732
  });
15712
15733
  withRead = (report, reading) => ({
15713
15734
  ...report,
15714
- layers: report.layers.map((layer) => ({
15715
- ...layer,
15716
- read: readInLayer(layer, reading)
15717
- }))
15735
+ layers: report.layers.map((layer) => {
15736
+ const read = readInLayer(layer, reading);
15737
+ return Object.assign({}, layer, {
15738
+ read,
15739
+ done: layer.files.length > 0 && read.length === layer.files.length
15740
+ });
15741
+ })
15718
15742
  });
15719
15743
  show$1 = fn("Review.Layers.show")(function* (worktree) {
15720
15744
  const store = yield* Store;
@@ -18359,7 +18383,7 @@ var init_words = __esmMin((() => {
18359
18383
  return text.split(/\s+/).filter((word) => word.length > 0).flatMap((word) => chunked(word, width)).reduce((lines, word) => packed(lines, word, width), []);
18360
18384
  };
18361
18385
  clip = (label, room) => label.length > room ? `${label.slice(0, Math.max(0, room - 1))}…` : label;
18362
- })), proseFor, layerHolding, layerOpen, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, countRow, NOTHING_LEFT, textRows, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME, layerRoomIn, railWindow, layerContext;
18386
+ })), proseFor, layerHolding, layerOpen, TITLE_ROWS, titleRows, shortDir, fileRow$1, shownFiles, dirOf, fileRows, layerRead, layerDone, NOTHING_LEFT, textRows, linesSaid, countRow, emptyRows, layerBody, holdsCursor, layerCard, layerRows, nearFirst, layerFitted, restingAt, railTop, PANE_CHROME, layerRoomIn, railWindow, layerContext;
18363
18387
  var init_layerview = __esmMin((() => {
18364
18388
  init_files();
18365
18389
  init_layout();
@@ -18445,18 +18469,6 @@ var init_layerview = __esmMin((() => {
18445
18469
  const read = layerRead(state, layerIndex);
18446
18470
  return read.all > 0 && read.done === read.all;
18447
18471
  };
18448
- countRow = (state, index, room) => {
18449
- const read = layerRead(state, index);
18450
- if (read.all === 0) return [];
18451
- const one = read.all === 1 ? "file" : "files";
18452
- const said = `${read.done} of ${read.all} ${one} read`;
18453
- return [{
18454
- index,
18455
- kind: "count",
18456
- text: clip(said, room),
18457
- lead: false
18458
- }];
18459
- };
18460
18472
  NOTHING_LEFT = "nothing in this diff";
18461
18473
  textRows = (index, text, room, kind) => wrapped(text, room).map((line) => ({
18462
18474
  index,
@@ -18464,6 +18476,18 @@ var init_layerview = __esmMin((() => {
18464
18476
  text: line,
18465
18477
  lead: false
18466
18478
  }));
18479
+ linesSaid = (layer) => {
18480
+ if (layer === void 0) return "";
18481
+ const signs = [...layer.added > 0 ? [`+${layer.added}`] : [], ...layer.removed > 0 ? [`−${layer.removed}`] : []];
18482
+ return signs.length === 0 ? "" : ` · ${signs.join(" ")}`;
18483
+ };
18484
+ countRow = (state, index, room) => {
18485
+ const read = layerRead(state, index);
18486
+ if (read.all === 0) return [];
18487
+ const one = read.all === 1 ? "file" : "files";
18488
+ const said = `${read.done} of ${read.all} ${one} read${linesSaid(state.layers[index])}`;
18489
+ return textRows(index, said, room, "count");
18490
+ };
18467
18491
  emptyRows = (state, index, room) => {
18468
18492
  const layer = state.layers[index];
18469
18493
  if (layer === void 0) return [];
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.196",
26
+ "version": "0.1.0-alpha.197",
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": {
@@ -301,12 +301,15 @@ Rules that make a layers worth reading:
301
301
  The answer to `layers set` is the honest report — check it before you claim to be done:
302
302
 
303
303
  ```json
304
- {"ok":true,"layers":{"version":1,"stale":false,"covered":7,"partial":1,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"layers":[{"title":"Add the invitation data model","files":["src/db/invites.ts"],"covered":1,"partial":0,"vanished":[]}]}}
304
+ {"ok":true,"layers":{"version":1,"stale":false,"covered":7,"partial":1,"total":9,"uncovered":[{"path":"src/api/router.ts","start":40,"end":52}],"vanished":[],"layers":[{"title":"Add the invitation data model","files":["src/db/invites.ts"],"covered":1,"partial":0,"added":42,"removed":3,"vanished":[]}]}}
305
305
 
306
306
  `covered`, `partial` and `vanished` appear per layer as well as for the document, so you can tell
307
307
  which of your own layers is the thin one. `vanished` on a layer names paths it claims that are not
308
308
  in the diff — usually a typo or a file that moved.
309
309
 
310
+ `added` and `removed` on a layer count the changed lines inside its own spans, a removed line by its
311
+ old line number. A line two layers both claim counts in each.
312
+
310
313
  `layers set` refuses a document it cannot use and says which layer is wrong and why: a span that
311
314
  ends before it starts, a span starting below line 1, a start or end that is not a whole number, a
312
315
  block with no `kind`, a layer with no title. It no longer drops a bad span quietly, so a layer that