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

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,21 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.23
4
+
5
+ ### Patch Changes
6
+
7
+ - A pinned scope wider than the pane can be panned into view, and the command palette opens over the review list.
8
+
9
+ ## 0.1.0-alpha.22
10
+
11
+ ### Patch Changes
12
+
13
+ - A selection reaching over hidden lines reports the range it will actually comment on.
14
+
15
+ - Composing on a row that carries no line says so instead of opening a panel that cannot send.
16
+
17
+ - The stale mark on the layer rail reads in full at any width.
18
+
3
19
  ## 0.1.0-alpha.21
4
20
 
5
21
  ### 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 = [
@@ -14222,7 +14226,7 @@ const commands = [
14222
14226
  title: "Find a command",
14223
14227
  category: "General",
14224
14228
  keys: ["ctrl+p"],
14225
- screens: ["review"],
14229
+ screens: ["review", "pending"],
14226
14230
  hint: "commands",
14227
14231
  listed: false
14228
14232
  }),
@@ -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,
@@ -15219,8 +15228,11 @@ var DiffView = class {
15219
15228
  }
15220
15229
  this.fitWrapWidth();
15221
15230
  }
15231
+ panLimit() {
15232
+ return this.wrapped ? 0 : Math.max(this.code.maxScrollX, this.pinned.maxScrollX);
15233
+ }
15222
15234
  setPan(columns) {
15223
- const wanted = this.wrapped ? 0 : Math.max(0, Math.min(this.code.maxScrollX, columns));
15235
+ const wanted = Math.max(0, Math.min(this.panLimit(), columns));
15224
15236
  if (wanted !== this.held) {
15225
15237
  this.held = wanted;
15226
15238
  this.feed();
@@ -15228,9 +15240,6 @@ var DiffView = class {
15228
15240
  if (this.code.scrollX !== wanted) this.code.scrollX = wanted;
15229
15241
  if (this.pinned.scrollX !== wanted) this.pinned.scrollX = wanted;
15230
15242
  }
15231
- panned() {
15232
- return this.code.scrollX;
15233
- }
15234
15243
  fitWrapWidth() {
15235
15244
  const room = this.numbers.width - Math.max(0, this.code.x - this.numbers.x);
15236
15245
  const wanted = this.wrapped && room > 0 ? room : "100%";
@@ -15821,7 +15830,7 @@ const branchCells = (branch, here, room) => ({
15821
15830
  layers: layersCell(branch),
15822
15831
  state: ""
15823
15832
  });
15824
- const headerParts = (state, branch, path) => [
15833
+ const headerParts = (state, branch, path, pan) => [
15825
15834
  branch,
15826
15835
  path,
15827
15836
  `${state.patchIndex + 1}/${state.patches.length}`,
@@ -15829,7 +15838,7 @@ const headerParts = (state, branch, path) => [
15829
15838
  state.staged === 0 ? "" : `${state.staged} staged`,
15830
15839
  contextLabel(state.context),
15831
15840
  hiddenLines(state) === 0 ? "" : `⋯ ${hiddenLines(state)} lines hidden`,
15832
- state.pan === 0 ? "" : `→ ${state.pan} columns`
15841
+ pan === 0 ? "" : `→ ${pan} columns`
15833
15842
  ];
15834
15843
  const fallbackScope = (state, top) => {
15835
15844
  const scope = (selectedPatch(state)?.hunks.findLast((hunk) => hunk.startRow < top))?.scope ?? "";
@@ -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 {
@@ -16027,7 +16037,7 @@ var Screen = class {
16027
16037
  const branch = selectedBranch(state);
16028
16038
  if (atHome(state)) return t`${fg(palette.faint)("")}`;
16029
16039
  const patch = selectedPatch(state);
16030
- const [name = "", ...rest] = headerParts(state, branch?.branch ?? "", patch?.path ?? "").filter((part) => part.length > 0);
16040
+ const [name = "", ...rest] = headerParts(state, branch?.branch ?? "", patch?.path ?? "", Math.min(state.pan, this.view.panLimit())).filter((part) => part.length > 0);
16031
16041
  return t`${fg(palette.ink)(name)} ${fg(palette.muted)(rest.join(" "))}`;
16032
16042
  }
16033
16043
  footerText(state) {
@@ -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.23",
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": {