@eliya-oss/agent-diff 0.1.0-alpha.10 → 0.1.0-alpha.11

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.11
4
+
5
+ ### Patch Changes
6
+
7
+ - r reads the branch again, so the agent's newest work appears without leaving the review.
8
+
3
9
  ## 0.1.0-alpha.10
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -12595,6 +12595,14 @@ const commands = [
12595
12595
  screens: ["review"],
12596
12596
  hint: "zoom"
12597
12597
  }),
12598
+ command({
12599
+ action: "review.reload",
12600
+ title: "Read the branch again",
12601
+ category: "Review",
12602
+ keys: ["r"],
12603
+ screens: ["review"],
12604
+ hint: "reload"
12605
+ }),
12598
12606
  command({
12599
12607
  action: "rail.toggle",
12600
12608
  title: "Switch between layers and files",
@@ -13034,6 +13042,7 @@ const transitions = {
13034
13042
  navOpen: !state.navOpen,
13035
13043
  focus: "diff"
13036
13044
  }),
13045
+ "review.reload": (state) => state,
13037
13046
  "rail.toggle": toggleRail,
13038
13047
  "file.vouch": (state) => state,
13039
13048
  "file.vouch.next": (state) => state,
@@ -13143,6 +13152,16 @@ const withVouched = (state, vouched) => ({
13143
13152
  ...state,
13144
13153
  vouched
13145
13154
  });
13155
+ const restoredTo = (state, path, line) => {
13156
+ const index = state.patches.findIndex((patch) => patch.path === path);
13157
+ const patch = state.patches[index];
13158
+ if (patch === void 0) return state;
13159
+ return withCursorVisible({
13160
+ ...state,
13161
+ patchIndex: index,
13162
+ cursor: line === void 0 ? 0 : rowAtSourceLine(patch, line)
13163
+ });
13164
+ };
13146
13165
  const withPatches = (state, patches) => ({
13147
13166
  ...state,
13148
13167
  screen: "review",
@@ -13959,6 +13978,17 @@ const notesOf = (comments, path, sent) => comments.filter((entry) => entry.file
13959
13978
  sent
13960
13979
  }));
13961
13980
  const notesFor = (state, path) => [...notesOf(state.sent, path, true), ...notesOf(state.pending, path, false)];
13981
+ const keptWithin = (chunks, room) => {
13982
+ const kept = [];
13983
+ let used = 0;
13984
+ for (const chunk of chunks.toReversed()) {
13985
+ const width = chunk.text.length;
13986
+ if (used + width > room) break;
13987
+ kept.unshift(chunk);
13988
+ used += width;
13989
+ }
13990
+ return kept;
13991
+ };
13962
13992
  const shortPath = (path) => {
13963
13993
  const home = process.env["HOME"] ?? "";
13964
13994
  return home.length > 0 && path.startsWith(home) ? `~${path.slice(home.length)}` : path;
@@ -14213,11 +14243,15 @@ var Screen = class {
14213
14243
  const readout = selectionReadout(state);
14214
14244
  this.lead = readout.length === 0 ? 0 : readout.length + 3;
14215
14245
  const lead = readout.length === 0 ? [] : [fg(palette.muted)(`${readout} `)];
14216
- const notice = state.notice.length === 0 ? [] : [fg(palette.attention)(` ${state.notice}`)];
14246
+ if (state.notice.length === 0) return new StyledText([...lead, ...this.chipRow().chunks]);
14247
+ const tail = ` ${state.notice}`;
14248
+ const width = this.footer.width > 0 ? this.footer.width : this.renderer.width;
14249
+ const room = Math.max(0, width - this.lead - tail.length);
14250
+ const chips = keptWithin(this.chipRow().chunks, room);
14217
14251
  return new StyledText([
14218
14252
  ...lead,
14219
- ...this.chipRow().chunks,
14220
- ...notice
14253
+ ...chips,
14254
+ fg(palette.attention)(tail)
14221
14255
  ]);
14222
14256
  }
14223
14257
  paneRoom() {
@@ -14650,6 +14684,7 @@ var App = class {
14650
14684
  "rail.toggle": () => this.commitSynced("rail.toggle"),
14651
14685
  "file.vouch": () => this.vouch(false),
14652
14686
  "file.vouch.next": () => this.vouch(true),
14687
+ "review.reload": () => this.reloadBranch(),
14653
14688
  "pending.open": () => this.openPending(),
14654
14689
  "pending.submit": () => this.sendReview(),
14655
14690
  "report.open": () => this.commit(reduce(this.measured(), "report.open")),
@@ -14700,16 +14735,28 @@ var App = class {
14700
14735
  sequence: ""
14701
14736
  }, chosen);
14702
14737
  }
14738
+ async readBranch(name) {
14739
+ const patches = await this.run(listPatches(this.repo, name));
14740
+ const progress = await this.run(reviewProgress(this.repo, name));
14741
+ const pending = await this.run(listPending(this.repo, name));
14742
+ const layers = await this.run(listLayers(this.repo, name));
14743
+ const sent = await this.loadSent(name);
14744
+ const opened = withVouched(withPatches(this.state, patches), progress.vouched);
14745
+ return withLayers(withSent(withPending(opened, pending, "review"), sent), layers);
14746
+ }
14703
14747
  async openBranch() {
14704
14748
  const branch = selectedBranch(this.state);
14705
14749
  if (branch === void 0) return;
14706
- const patches = await this.run(listPatches(this.repo, branch.branch));
14707
- const progress = await this.run(reviewProgress(this.repo, branch.branch));
14708
- const pending = await this.run(listPending(this.repo, branch.branch));
14709
- const layers = await this.run(listLayers(this.repo, branch.branch));
14710
- const opened = withVouched(withPatches(this.state, patches), progress.vouched);
14711
- const sent = await this.loadSent(branch.branch);
14712
- this.commit(withLayers(withSent(withPending(opened, pending, "review"), sent), layers));
14750
+ this.commit(await this.readBranch(branch.branch));
14751
+ await this.loadSource();
14752
+ }
14753
+ async reloadBranch() {
14754
+ const branch = selectedBranch(this.state);
14755
+ if (branch === void 0) return;
14756
+ const path = selectedPatch(this.state)?.path;
14757
+ const line = sourceLineAt(this.state, this.state.cursor);
14758
+ const read = await this.readBranch(branch.branch);
14759
+ this.commit(withNotice(restoredTo(read, path, line), "read the branch again"));
14713
14760
  await this.loadSource();
14714
14761
  }
14715
14762
  async goBack() {
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.10",
24
+ "version": "0.1.0-alpha.11",
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": {