@eliya-oss/agent-diff 0.1.0-alpha.4 → 0.1.0-alpha.5

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.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Wheel bursts move the diff once a frame, the worktree list shows which branches carry a reading order, and a story the branch has moved past says so.
8
+
9
+ - Scrolling with a trackpad settles as soon as your fingers stop.
10
+
3
11
  ## 0.1.0-alpha.4
4
12
 
5
13
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10976,9 +10976,18 @@ const waitingOn = fn("Cli.waitingOn")(function* (worktree) {
10976
10976
  const store = yield* Store;
10977
10977
  const state = yield* store.state(worktree.path);
10978
10978
  const batches = yield* store.inbox(worktree.path);
10979
+ const told = yield* store.story(worktree.path);
10979
10980
  return {
10980
10981
  staged: state.pending.length,
10981
- unread: Math.max(0, batches.length - state.consumed)
10982
+ unread: Math.max(0, batches.length - state.consumed),
10983
+ steps: match$2(told, {
10984
+ onNone: () => 0,
10985
+ onSome: (story) => story.steps.length
10986
+ }),
10987
+ stale: match$2(told, {
10988
+ onNone: () => false,
10989
+ onSome: (story) => story.head !== worktree.head
10990
+ })
10982
10991
  };
10983
10992
  });
10984
10993
  const listBranches = fn("Cli.listBranches")(function* (repo) {
@@ -10996,7 +11005,9 @@ const listBranches = fn("Cli.listBranches")(function* (repo) {
10996
11005
  added: stat.added,
10997
11006
  removed: stat.removed,
10998
11007
  staged: waiting.staged,
10999
- unread: waiting.unread
11008
+ unread: waiting.unread,
11009
+ steps: waiting.steps,
11010
+ stale: waiting.stale
11000
11011
  });
11001
11012
  }
11002
11013
  return summaries.filter((summary) => summary.files > 0);
@@ -11418,8 +11429,15 @@ const showStory = fn("Cli.showStory")(function* (worktreePath) {
11418
11429
  const listStorySteps = fn("Cli.listStorySteps")(function* (repo, branch) {
11419
11430
  const worktree = yield* findBranch(repo, branch);
11420
11431
  const found = yield* storyOf(worktree);
11421
- if (isNone(found)) return [];
11422
- return stepsOf(yield* patchesOf(worktree), found.value);
11432
+ if (isNone(found)) return {
11433
+ steps: [],
11434
+ stale: false
11435
+ };
11436
+ const patches = yield* patchesOf(worktree);
11437
+ return {
11438
+ steps: stepsOf(patches, found.value),
11439
+ stale: found.value.head !== worktree.head
11440
+ };
11423
11441
  });
11424
11442
  //#endregion
11425
11443
  //#region src/cli/parse.ts
@@ -12020,6 +12038,7 @@ const initialState = (branches) => ({
12020
12038
  focus: "diff",
12021
12039
  navOpen: true,
12022
12040
  steps: [],
12041
+ storyStale: false,
12023
12042
  stepIndex: 0,
12024
12043
  openSteps: [],
12025
12044
  rail: "tree"
@@ -12916,10 +12935,12 @@ const withSent = (state, sent) => ({
12916
12935
  ...state,
12917
12936
  sent
12918
12937
  });
12919
- const withStory = (state, steps) => {
12938
+ const withStory = (state, told) => {
12939
+ const steps = told.steps;
12920
12940
  const opened = {
12921
12941
  ...state,
12922
12942
  steps,
12943
+ storyStale: told.stale,
12923
12944
  stepIndex: 0,
12924
12945
  openSteps: [],
12925
12946
  rail: steps.length === 0 ? "tree" : "steps"
@@ -13444,7 +13465,7 @@ const PANE_CHROME = 3;
13444
13465
  const BRANCH_WIDTH = 82;
13445
13466
  const BRANCH_NAME = 44;
13446
13467
  const BRANCH_NAME_MIN = 12;
13447
- const BRANCH_TAIL = 35;
13468
+ const BRANCH_TAIL = 45;
13448
13469
  const MODAL_MARGIN = 4;
13449
13470
  const bodyRoom = (width) => Math.max(0, width - 2 - BODY_BORDER);
13450
13471
  const treeWidth = (width) => {
@@ -13728,21 +13749,27 @@ const contextLabel = (context) => {
13728
13749
  return context >= 1e5 ? "whole file" : `±${context}`;
13729
13750
  };
13730
13751
  const nameRoom = (pane) => Math.max(BRANCH_NAME_MIN, Math.min(BRANCH_NAME, pane - BRANCH_TAIL));
13731
- const columns = (cells, room) => `${clip(cells.name, room).padEnd(room)}${cells.files.padStart(5)}${cells.added.padStart(8)}${cells.gone.padStart(8)} ${cells.state}`;
13752
+ const columns = (cells, room) => `${clip(cells.name, room).padEnd(room)}${cells.files.padStart(5)}${cells.added.padStart(8)}${cells.gone.padStart(8)} ${cells.story.padStart(8)} ${cells.state}`;
13732
13753
  const branchHeading = (room) => ` ${columns({
13733
13754
  name: "WORKTREE",
13734
13755
  files: "FILES",
13735
13756
  added: "+",
13736
13757
  gone: "-",
13758
+ story: "STORY",
13737
13759
  state: "STATE"
13738
13760
  }, room)}`;
13739
13761
  const atHome = (state) => state.screen === "branches" || state.screen === "palette" && state.returnTo === "branches";
13762
+ const storyCell = (branch) => {
13763
+ if (branch.steps === 0) return "";
13764
+ return branch.stale ? `${branch.steps} stale` : `${branch.steps} story`;
13765
+ };
13740
13766
  const branchCells = (branch, here, room) => ({
13741
13767
  lead: `${here ? marks().cursor : " "} `,
13742
13768
  name: clip(branch.branch, room).padEnd(room),
13743
13769
  files: `${branch.files}`.padStart(5),
13744
13770
  added: `+${branch.added}`.padStart(8),
13745
13771
  gone: `-${branch.removed}`.padStart(8),
13772
+ story: storyCell(branch),
13746
13773
  state: waitingLabel(branch).trim()
13747
13774
  });
13748
13775
  const headerParts = (state, branch, path) => [
@@ -13978,7 +14005,12 @@ var Screen = class {
13978
14005
  const window = railWindow(stepRows(state, room.title, room.note), height, state.stepIndex);
13979
14006
  const rows = window.rows.map((row) => fg(stepPaint(state, row))(`${stepText(state, row, room)}\n`));
13980
14007
  const more = window.more > 0 ? [fg(palette.faint)(` … ${window.more} more`)] : [];
13981
- return new StyledText([...rows, ...more]);
14008
+ const warn = state.storyStale ? [fg(palette.attention)(` stale, the branch moved on\n\n`)] : [];
14009
+ return new StyledText([
14010
+ ...warn,
14011
+ ...rows,
14012
+ ...more
14013
+ ]);
13982
14014
  }
13983
14015
  paintDiff(state) {
13984
14016
  const shown = shownOf(state);
@@ -14069,6 +14101,7 @@ var Screen = class {
14069
14101
  fg(palette.faint)(cells.files),
14070
14102
  fg(palette.added)(cells.added),
14071
14103
  fg(palette.removed)(cells.gone),
14104
+ fg(palette.accent)(` ${cells.story.padStart(8)}`),
14072
14105
  fg(palette.attention)(` ${cells.state}\n`)
14073
14106
  ];
14074
14107
  });
@@ -14251,6 +14284,7 @@ var App = class {
14251
14284
  remembered = "";
14252
14285
  keys = [];
14253
14286
  fading;
14287
+ wheel = 0;
14254
14288
  constructor(options) {
14255
14289
  this.renderer = options.renderer;
14256
14290
  this.repo = options.repo;
@@ -14262,13 +14296,14 @@ var App = class {
14262
14296
  this.screen = new Screen(renderer, options.repo);
14263
14297
  this.screen.update(this.state);
14264
14298
  this.screen.listen({
14265
- onScroll: (delta) => this.commit(scrolled(this.measured(), delta)),
14299
+ onScroll: (delta) => this.onWheel(delta),
14266
14300
  onDrag: (from, to) => this.commit(draggedTo(this.measured(), from, to)),
14267
14301
  onChip: (key) => this.dispatchTask(() => this.onKey(asKey(key)))
14268
14302
  });
14269
14303
  renderer.keyInput.on("keypress", (key) => this.dispatch(key));
14270
14304
  renderer.on("destroy", () => this.stopFading());
14271
14305
  renderer.on("frame", () => this.syncGeometry());
14306
+ renderer.setFrameCallback(async () => this.applyWheel());
14272
14307
  const resume = options.resume;
14273
14308
  if (resume !== void 0) this.dispatchTask(() => this.resume(resume));
14274
14309
  }
@@ -14312,6 +14347,16 @@ var App = class {
14312
14347
  settled() {
14313
14348
  return this.pending;
14314
14349
  }
14350
+ onWheel(delta) {
14351
+ this.wheel += delta;
14352
+ this.renderer.requestRender();
14353
+ }
14354
+ applyWheel() {
14355
+ const delta = this.wheel;
14356
+ if (delta === 0) return;
14357
+ this.wheel = 0;
14358
+ this.commit(scrolled(this.measured(), delta));
14359
+ }
14315
14360
  syncGeometry() {
14316
14361
  const rows = this.screen.viewportRows();
14317
14362
  if (rows === this.state.viewport) return;
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "bin": {
22
22
  "adiff": "./bin/adiff.js"
23
23
  },
24
- "version": "0.1.0-alpha.4",
24
+ "version": "0.1.0-alpha.5",
25
25
  "description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
26
26
  "license": "MIT",
27
27
  "repository": {