@eliya-oss/agent-diff 0.1.0-alpha.21 → 0.1.0-alpha.22

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.
@@ -15,6 +15,8 @@ the way it is, why it is tested the way it is. ADRs explain choices that outlive
15
15
  | [ADR-002](ADR-002-effect-v4-and-module-boundaries.md) | Effect v4, and modules sealed behind `index.ts` |
16
16
  | [ADR-003](ADR-003-blackbox-testdriver.md) | Black-box tests through a TestDriver, and no unit tests |
17
17
  | [ADR-004](ADR-004-pnpm-native-releases.md) | pnpm's own release tooling instead of Changesets |
18
+ | [ADR-005](ADR-005-a-mechanical-style-contract.md) | Style is a lint rule, not a document |
19
+ | [ADR-006](ADR-006-the-terminal-runs-on-effect.md) | The terminal runs on Effect |
18
20
 
19
21
  ## Writing one
20
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.22
4
+
5
+ ### Patch Changes
6
+
7
+ - A selection reaching over hidden lines reports the range it will actually comment on.
8
+
9
+ - Composing on a row that carries no line says so instead of opening a panel that cannot send.
10
+
11
+ - The stale mark on the layer rail reads in full at any width.
12
+
3
13
  ## 0.1.0-alpha.21
4
14
 
5
15
  ### Patch Changes
package/dist/main.js CHANGED
@@ -13743,12 +13743,15 @@ const markedRows = (state) => {
13743
13743
  })).map((row) => row.index));
13744
13744
  return new Set(rows);
13745
13745
  };
13746
- const snippetOf = (state, limit) => {
13746
+ const carriesLine = (row) => isSome(row.newLine) || isSome(row.oldLine);
13747
+ const selectedRows = (state) => {
13747
13748
  const patch = selectedPatch(state);
13748
13749
  if (patch === void 0) return [];
13749
13750
  const [from, to] = selectionRange(state);
13750
- return patch.rows.slice(from, to + 1).slice(0, limit).map((row) => `${lineOf(row).padStart(4)} ${row.text}`);
13751
+ return patch.rows.slice(from, to + 1).filter(carriesLine);
13751
13752
  };
13753
+ const snippetOf = (state, limit) => selectedRows(state).slice(0, limit).map((row) => `${lineOf(row).padStart(4)} ${row.text}`);
13754
+ const selectedLineCount = (state) => selectedRows(state).length;
13752
13755
  const lineOf = (row) => match$2(row.newLine, {
13753
13756
  onNone: () => "-",
13754
13757
  onSome: (line) => String(line)
@@ -13763,17 +13766,18 @@ const composeTarget = (state) => {
13763
13766
  const patch = selectedPatch(state);
13764
13767
  if (patch === void 0) return "";
13765
13768
  const [from, to] = selectionRange(state);
13766
- const first = sourceLineAt(state, from) ?? from + 1;
13767
- const last = sourceLineAt(state, to) ?? to + 1;
13768
- const span = first === last ? `${first}` : `${first}-${last}`;
13769
- return `Comment on ${patch.path}:${span}`;
13769
+ const anchor = anchorFor(patch, from, to);
13770
+ const span = match$2(anchor, {
13771
+ onNone: () => "",
13772
+ onSome: (found) => found.start === found.end ? `${found.start}` : `${found.start}-${found.end}`
13773
+ });
13774
+ return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
13770
13775
  };
13771
13776
  const selectionReadout = (state) => {
13772
13777
  const patch = selectedPatch(state);
13773
13778
  if (patch === void 0 || !state.selecting) return "";
13774
- const [from, to] = selectionRange(state);
13775
- const lines = to - from + 1;
13776
- return `${patch.path} ${lines} lines`;
13779
+ const lines = selectedRows(state).length;
13780
+ return `${patch.path} ${lines} ${lines === 1 ? "line" : "lines"}`;
13777
13781
  };
13778
13782
  const WHOLE_FILE = 1e5;
13779
13783
  const CONTEXT_STEPS = [
@@ -14581,12 +14585,17 @@ const startSelection = (state) => ({
14581
14585
  selecting: true,
14582
14586
  anchorRow: state.cursor
14583
14587
  });
14584
- const openCompose = (state) => ({
14585
- ...state,
14586
- screen: "compose",
14587
- draft: "",
14588
- anchorRow: state.selecting ? state.anchorRow : state.cursor
14589
- });
14588
+ const openCompose = (state) => {
14589
+ const patch = selectedPatch(state);
14590
+ const [from, to] = selectionRange(state);
14591
+ if (!(patch !== void 0 && isSome(anchorFor(patch, from, to)))) return withNoticeHere(state, "no line here to comment on");
14592
+ return {
14593
+ ...state,
14594
+ screen: "compose",
14595
+ draft: "",
14596
+ anchorRow: state.selecting ? state.anchorRow : state.cursor
14597
+ };
14598
+ };
14590
14599
  const goBack = (state) => {
14591
14600
  if (state.screen === "pending") return {
14592
14601
  ...state,
@@ -15852,6 +15861,7 @@ const STEP_NUMBER = 3;
15852
15861
  const STEP_LEAD = 8;
15853
15862
  const NOTE_LEAD = 10;
15854
15863
  const STEP_GAP = 1;
15864
+ const staleBanner = (room) => wrapped("stale, the branch moved on", room).map((line) => ` ${line}`).join("\n");
15855
15865
  const layerRoom = (state, pane) => {
15856
15866
  const tally = Math.max(1, ...state.layers.map((layer) => `${layer.files.length}`.length));
15857
15867
  return {
@@ -16066,7 +16076,7 @@ var Screen = class {
16066
16076
  const window = railWindow(layerRows(state, room.title, room.note), height, state.layerIndex);
16067
16077
  const rows = window.rows.map((row) => fg(layerPaint(state, row))(`${layerText(state, row, room)}\n`));
16068
16078
  const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
16069
- const warn = state.layersStale ? [fg(palette.attention)(` stale, the branch moved on\n\n`)] : [];
16079
+ const warn = state.layersStale ? [fg(palette.attention)(`${staleBanner(room.note)}\n`)] : [];
16070
16080
  return new StyledText([
16071
16081
  ...warn,
16072
16082
  ...rows,
@@ -16291,7 +16301,7 @@ var Screen = class {
16291
16301
  }
16292
16302
  const room = composeRoom(this.renderer.width);
16293
16303
  const snippet = snippetOf(state, SNIPPET_LINES);
16294
- const more = selectionRange(state)[1] - selectionRange(state)[0] + 1 - snippet.length;
16304
+ const more = selectedLineCount(state) - snippet.length;
16295
16305
  const tail = more > 0 ? [` … ${more} more lines`] : [];
16296
16306
  const quoted = [...snippet, ...tail].map((line) => clip(line, room.text));
16297
16307
  const written = laidOut(`${state.draft}▌`.split("\n"), room.text);
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.21",
26
+ "version": "0.1.0-alpha.22",
27
27
  "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
28
28
  "license": "MIT",
29
29
  "repository": {