@eliya-oss/agent-diff 0.1.0-alpha.55 → 0.1.0-alpha.56

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.56
4
+
5
+ ### Patch Changes
6
+
7
+ - A branch stacked on another branch shows the work it adds, not its parent's as well. The diff was always taken against the default branch, so branch B built on branch A reported A's files as B's and the reviewer walked files they had already reviewed on A. The base is now whichever local branch this one was started from, found by looking for the closest ancestor branch among the local tips, and every command that resolves a diff takes `--base <ref>` to override the guess. `branch list` reports the base and how it was chosen on each row, so a non-default base is visible rather than surprising, and the review screen says `on <branch>` beside a branch that is not on the default. `adiff base set` remembers a base for a branch and `adiff base clear` goes back to detection. A base that names no ref, or one with no shared history, fails with exit 3 and a suggestion rather than quietly falling back to the default and reporting a file count that looks right.
8
+
3
9
  ## 0.1.0-alpha.55
4
10
 
5
11
  ### Patch Changes
package/dist/main.js CHANGED
@@ -8019,7 +8019,7 @@ var init_run = __esmMin((() => {
8019
8019
  }));
8020
8020
  //#endregion
8021
8021
  //#region src/service/git/service.ts
8022
- var GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, splitLines, absent, readText, settled, listWorktrees, readDiff, readStat, readSource, readGrep, shape, GitLive;
8022
+ var GREP_CONTEXT, DEFAULT_BRANCH_CANDIDATES, STAT, Git, parseStat, readEntries, baseNames, mergeBases, findDefaultBranch, defaultBranch, mergeBaseOf, toWorktree, branchTips, parents, parentOf, splitLines, absent, readText, settled, listWorktrees, readDiff, readStat, readSource, readGrep, shape, GitLive;
8023
8023
  var init_service$2 = __esmMin((() => {
8024
8024
  init_dist();
8025
8025
  init_error$3();
@@ -8100,6 +8100,36 @@ var init_service$2 = __esmMin((() => {
8100
8100
  own
8101
8101
  };
8102
8102
  });
8103
+ branchTips = fn("Git.branchTips")(function* (repo) {
8104
+ const raw = yield* gitOrEmpty(repo, [
8105
+ "for-each-ref",
8106
+ "--format=%(objectname) %(refname:short)",
8107
+ "refs/heads"
8108
+ ]);
8109
+ const tips = /* @__PURE__ */ new Map();
8110
+ for (const line of raw.split("\n")) {
8111
+ const [sha, ...rest] = line.trim().split(" ");
8112
+ const name = rest.join(" ");
8113
+ if (sha === void 0 || sha.length === 0 || name.length === 0) continue;
8114
+ const held = tips.get(sha);
8115
+ if (held === void 0) tips.set(sha, [name]);
8116
+ else held.push(name);
8117
+ }
8118
+ return tips;
8119
+ });
8120
+ parents = /* @__PURE__ */ new Map();
8121
+ parentOf = fn("Git.parentOf")(function* (repo, branch, fallback) {
8122
+ const own = (yield* gitOrEmpty(repo, ["rev-list", `${fallback}..${branch}`])).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
8123
+ const tip = own[0];
8124
+ if (tip === void 0) return fallback;
8125
+ const key = `${repo} ${branch} ${tip} ${fallback}`;
8126
+ const known = parents.get(key);
8127
+ if (known !== void 0) return known;
8128
+ const tips = yield* branchTips(repo);
8129
+ const found = own.slice(1).flatMap((sha) => tips.get(sha) ?? []).find((name) => name !== branch);
8130
+ parents.set(key, found ?? fallback);
8131
+ return found ?? fallback;
8132
+ });
8103
8133
  splitLines = (text) => text.split("\n");
8104
8134
  absent = succeed(none());
8105
8135
  readText = fn("Git.readText")(function* (absolute, path) {
@@ -8175,7 +8205,23 @@ var init_service$2 = __esmMin((() => {
8175
8205
  diff: readDiff,
8176
8206
  stat: readStat,
8177
8207
  source: readSource,
8178
- grep: readGrep
8208
+ grep: readGrep,
8209
+ defaultBranch,
8210
+ stackParent: (repo, branch) => defaultBranch(repo).pipe(flatMap((fallback) => parentOf(repo, branch, fallback))),
8211
+ resolves: fn("Git.resolves")(function* (repo, ref) {
8212
+ return (yield* gitOrEmpty(repo, [
8213
+ "rev-parse",
8214
+ "--verify",
8215
+ `${ref}^{commit}`
8216
+ ])).trim().length > 0;
8217
+ }),
8218
+ sharedWith: fn("Git.sharedWith")(function* (repo, branch, ref) {
8219
+ return (yield* gitOrEmpty(repo, [
8220
+ "merge-base",
8221
+ branch,
8222
+ ref
8223
+ ])).trim();
8224
+ })
8179
8225
  };
8180
8226
  GitLive = succeed$1(Git)(shape);
8181
8227
  }));
@@ -8247,7 +8293,8 @@ var init_model$2 = __esmMin((() => {
8247
8293
  consumed: 0,
8248
8294
  pending: [],
8249
8295
  settled: {},
8250
- removed: {}
8296
+ removed: {},
8297
+ base: ""
8251
8298
  };
8252
8299
  }));
8253
8300
  //#endregion
@@ -8287,7 +8334,8 @@ var init_schema = __esmMin((() => {
8287
8334
  consumed: optionalKey(Int),
8288
8335
  pending: optionalKey(ArraySchema(StoredComment)),
8289
8336
  settled: optionalKey(Record(String$1, String$1)),
8290
- removed: optionalKey(Record(String$1, String$1))
8337
+ removed: optionalKey(Record(String$1, String$1)),
8338
+ base: optionalKey(String$1)
8291
8339
  });
8292
8340
  Settings = Struct({ wrap: optionalKey(Boolean) });
8293
8341
  UpgradeCheck = Struct({
@@ -8675,10 +8723,11 @@ var init_store = __esmMin((() => {
8675
8723
  }));
8676
8724
  //#endregion
8677
8725
  //#region src/cli/error.ts
8678
- var UnknownBranch, UnknownFile, UnknownComment, UnselectableRange, UnknownCommand, MissingOption, EmptyReview, UnknownWorktree, MalformedLayers, NoLayers, InitUnwritable;
8726
+ var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnselectableRange, UnknownCommand, MissingOption, EmptyReview, UnknownWorktree, MalformedLayers, NoLayers, InitUnwritable;
8679
8727
  var init_error$1 = __esmMin((() => {
8680
8728
  init_dist();
8681
8729
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
8730
+ UnknownBase = class extends TaggedError("UnknownBase") {};
8682
8731
  UnknownFile = class extends TaggedError("UnknownFile") {};
8683
8732
  UnknownComment = class extends TaggedError("UnknownComment") {};
8684
8733
  UnselectableRange = class extends TaggedError("UnselectableRange") {};
@@ -8692,7 +8741,7 @@ var init_error$1 = __esmMin((() => {
8692
8741
  }));
8693
8742
  //#endregion
8694
8743
  //#region src/cli/commands.ts
8695
- var CONTEXT, WHOLE_FILE$1, POLL, findBranch, patchesOf, findPatch, rowsCovering, waitingOn, listBranches, blobOf, toggleVouch, reviewProgress, anchorRequest, stageComment, editStaged, dropStaged, listPending, bodyOf, sentOf, listSent, submitReview, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, saveWrap;
8744
+ var CONTEXT, WHOLE_FILE$1, POLL, AUTO, askedFor, basedOn, worktreeNamed, findBranch, baseFor, patchesOf, findPatch, rowsCovering, waitingOn, listBranches, blobOf, toggleVouch, reviewProgress, anchorRequest, stageComment, editStaged, dropStaged, listPending, bodyOf, sentOf, listSent, submitReview, submitComment, listPatches, flatten, takeComments, repoOf$1, worktreeOf$1, branchAt, awaitComments, saveReport, fileSource, saveWrap, setBase, clearBase;
8696
8745
  var init_commands = __esmMin((() => {
8697
8746
  init_dist();
8698
8747
  init_patch();
@@ -8703,7 +8752,64 @@ var init_commands = __esmMin((() => {
8703
8752
  CONTEXT = 3;
8704
8753
  WHOLE_FILE$1 = 1e5;
8705
8754
  POLL = "500 millis";
8706
- findBranch = fn("Cli.findBranch")(function* (repo, branch) {
8755
+ AUTO = "auto";
8756
+ askedFor = (asked, held) => {
8757
+ if (asked !== void 0 && asked !== AUTO) return {
8758
+ ref: asked,
8759
+ basis: "set"
8760
+ };
8761
+ if (asked === AUTO) return {
8762
+ ref: "",
8763
+ basis: "stacked"
8764
+ };
8765
+ return held.length === 0 ? {
8766
+ ref: "",
8767
+ basis: "stacked"
8768
+ } : {
8769
+ ref: held,
8770
+ basis: "set"
8771
+ };
8772
+ };
8773
+ basedOn = fn("Cli.basedOn")(function* (repo, worktree, asked) {
8774
+ const git = yield* Git;
8775
+ const held = (yield* (yield* Store).state(worktree.path)).base;
8776
+ const wanted = askedFor(asked, held);
8777
+ const fallback = yield* git.defaultBranch(repo);
8778
+ const guessed = wanted.ref.length === 0;
8779
+ const ref = guessed ? yield* git.stackParent(repo, worktree.branch) : wanted.ref;
8780
+ const asItWas = {
8781
+ worktree,
8782
+ base: ref,
8783
+ basis: "default"
8784
+ };
8785
+ if (!(yield* git.resolves(repo, ref))) {
8786
+ if (guessed) return asItWas;
8787
+ return yield* new UnknownBase({
8788
+ branch: worktree.branch,
8789
+ base: ref,
8790
+ reason: "missing"
8791
+ });
8792
+ }
8793
+ const shared = yield* git.sharedWith(repo, worktree.branch, ref);
8794
+ if (shared.length === 0) {
8795
+ if (guessed) return asItWas;
8796
+ return yield* new UnknownBase({
8797
+ branch: worktree.branch,
8798
+ base: ref,
8799
+ reason: "unrelated"
8800
+ });
8801
+ }
8802
+ const basis = guessed ? ref === fallback ? "default" : "stacked" : wanted.basis;
8803
+ return {
8804
+ worktree: {
8805
+ ...worktree,
8806
+ base: shared.slice(0, 8)
8807
+ },
8808
+ base: ref,
8809
+ basis
8810
+ };
8811
+ });
8812
+ worktreeNamed = fn("Cli.worktreeNamed")(function* (repo, branch) {
8707
8813
  const worktrees = yield* (yield* Git).worktrees(repo);
8708
8814
  const found = worktrees.find((worktree) => worktree.branch === branch);
8709
8815
  return yield* found === void 0 ? new UnknownBranch({
@@ -8712,6 +8818,12 @@ var init_commands = __esmMin((() => {
8712
8818
  known: worktrees.map((w) => w.branch)
8713
8819
  }) : succeed(found);
8714
8820
  });
8821
+ findBranch = fn("Cli.findBranch")(function* (repo, branch, base) {
8822
+ return (yield* basedOn(repo, yield* worktreeNamed(repo, branch), base)).worktree;
8823
+ });
8824
+ baseFor = fn("Cli.baseFor")(function* (repo, branch, base) {
8825
+ return yield* basedOn(repo, yield* worktreeNamed(repo, branch), base);
8826
+ });
8715
8827
  patchesOf = fn("Cli.patchesOf")(function* (worktree, context = CONTEXT) {
8716
8828
  const raw = yield* (yield* Git).diff(worktree, context);
8717
8829
  return parsePatches(raw);
@@ -8739,11 +8851,13 @@ var init_commands = __esmMin((() => {
8739
8851
  })
8740
8852
  };
8741
8853
  });
8742
- listBranches = fn("Cli.listBranches")(function* (repo) {
8854
+ listBranches = fn("Cli.listBranches")(function* (repo, base) {
8743
8855
  const git = yield* Git;
8744
8856
  const worktrees = yield* git.worktrees(repo);
8745
8857
  const summaries = [];
8746
- for (const worktree of worktrees) {
8858
+ for (const found of worktrees) {
8859
+ const based = yield* basedOn(repo, found, base);
8860
+ const worktree = based.worktree;
8747
8861
  const stat = yield* git.stat(worktree);
8748
8862
  const waiting = yield* waitingOn(worktree);
8749
8863
  summaries.push({
@@ -8757,7 +8871,9 @@ var init_commands = __esmMin((() => {
8757
8871
  unread: waiting.unread,
8758
8872
  layers: waiting.layers,
8759
8873
  stale: waiting.stale,
8760
- own: worktree.own
8874
+ own: worktree.own,
8875
+ base: based.base,
8876
+ basis: based.basis
8761
8877
  });
8762
8878
  }
8763
8879
  return summaries.filter((summary) => summary.files > 0);
@@ -8788,9 +8904,9 @@ var init_commands = __esmMin((() => {
8788
8904
  total: patches.length
8789
8905
  };
8790
8906
  });
8791
- reviewProgress = fn("Cli.reviewProgress")(function* (repo, branch) {
8907
+ reviewProgress = fn("Cli.reviewProgress")(function* (repo, branch, base) {
8792
8908
  const store = yield* Store;
8793
- const worktree = yield* findBranch(repo, branch);
8909
+ const worktree = yield* findBranch(repo, branch, base);
8794
8910
  const patches = yield* patchesOf(worktree);
8795
8911
  const current = yield* store.state(worktree.path);
8796
8912
  return {
@@ -8871,7 +8987,8 @@ var init_commands = __esmMin((() => {
8871
8987
  }));
8872
8988
  });
8873
8989
  bodyOf = (entry) => entry.body;
8874
- sentOf = (comment, spoken, settled, head) => {
8990
+ sentOf = (comment, reading) => {
8991
+ const { spoken, settled, head, shown } = reading;
8875
8992
  const mine = spoken.filter((entry) => entry.comment === comment.id);
8876
8993
  return {
8877
8994
  id: comment.id,
@@ -8882,16 +8999,23 @@ var init_commands = __esmMin((() => {
8882
8999
  body: comment.body,
8883
9000
  settled: Object.hasOwn(settled, comment.id),
8884
9001
  stale: comment.head !== head,
9002
+ outside: !shown.has(comment.file),
8885
9003
  asks: mine.at(-1)?.asks === true,
8886
9004
  answers: mine.map(bodyOf)
8887
9005
  };
8888
9006
  };
8889
- listSent = fn("Cli.listSent")(function* (repo, branch) {
9007
+ listSent = fn("Cli.listSent")(function* (repo, branch, base) {
8890
9008
  const store = yield* Store;
8891
- const worktree = yield* findBranch(repo, branch);
9009
+ const worktree = yield* findBranch(repo, branch, base);
8892
9010
  const spoken = yield* store.answers(worktree.path);
8893
9011
  const current = yield* store.state(worktree.path);
8894
- return flatten(yield* store.inbox(worktree.path)).filter((comment) => !Object.hasOwn(current.removed, comment.id)).map((comment) => sentOf(comment, spoken, current.settled, worktree.head));
9012
+ const shown = new Set((yield* patchesOf(worktree)).map((patch) => patch.path));
9013
+ return flatten(yield* store.inbox(worktree.path)).filter((comment) => !Object.hasOwn(current.removed, comment.id)).map((comment) => sentOf(comment, {
9014
+ spoken,
9015
+ settled: current.settled,
9016
+ head: worktree.head,
9017
+ shown
9018
+ }));
8895
9019
  });
8896
9020
  submitReview = fn("Cli.submitReview")(function* (repo, branch, id, at) {
8897
9021
  const store = yield* Store;
@@ -9003,6 +9127,35 @@ var init_commands = __esmMin((() => {
9003
9127
  wrap
9004
9128
  });
9005
9129
  });
9130
+ setBase = fn("Cli.setBase")(function* (repo, branch, base) {
9131
+ const store = yield* Store;
9132
+ const based = yield* baseFor(repo, branch, base);
9133
+ const current = yield* store.state(based.worktree.path);
9134
+ yield* store.saveState(based.worktree.path, {
9135
+ ...current,
9136
+ base
9137
+ });
9138
+ return {
9139
+ branch,
9140
+ base: based.base,
9141
+ basis: based.basis
9142
+ };
9143
+ });
9144
+ clearBase = fn("Cli.clearBase")(function* (repo, branch) {
9145
+ const store = yield* Store;
9146
+ const worktree = yield* findBranch(repo, branch);
9147
+ const current = yield* store.state(worktree.path);
9148
+ yield* store.saveState(worktree.path, {
9149
+ ...current,
9150
+ base: ""
9151
+ });
9152
+ const based = yield* baseFor(repo, branch);
9153
+ return {
9154
+ branch,
9155
+ base: based.base,
9156
+ basis: based.basis
9157
+ };
9158
+ });
9006
9159
  }));
9007
9160
  //#endregion
9008
9161
  //#region src/cli/init.ts
@@ -9258,7 +9411,7 @@ var init_pane = __esmMin((() => {
9258
9411
  init_commands();
9259
9412
  init_init();
9260
9413
  init_pane();
9261
- var version$1 = "0.1.0-alpha.55";
9414
+ var version$1 = "0.1.0-alpha.56";
9262
9415
  //#endregion
9263
9416
  //#region src/cli/upgrade.ts
9264
9417
  var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -9762,16 +9915,18 @@ var init_layers = __esmMin((() => {
9762
9915
  };
9763
9916
  resolve$1 = (path) => realpath(path).catch(() => path);
9764
9917
  resolveAll = (paths) => Promise.all(paths.map(resolve$1));
9765
- worktreeAt = fn("Cli.worktreeAt")(function* (worktreePath) {
9918
+ worktreeAt = fn("Cli.worktreeAt")(function* (worktreePath, base) {
9766
9919
  const git = yield* Git;
9767
9920
  const asked = yield* promise(() => resolve$1(worktreePath));
9768
9921
  const worktrees = yield* git.worktrees(asked);
9769
9922
  const paths = worktrees.map((entry) => entry.path);
9770
9923
  const found = worktrees[(yield* promise(() => resolveAll(paths))).indexOf(asked)];
9771
- return yield* found === void 0 ? new UnknownWorktree({
9924
+ if (found === void 0) return yield* new UnknownWorktree({
9772
9925
  worktree: asked,
9773
9926
  known: worktrees.map((entry) => entry.path)
9774
- }) : succeed(found);
9927
+ });
9928
+ const repo = yield* git.repoOf(found.path);
9929
+ return (yield* basedOn(repo, found, base)).worktree;
9775
9930
  });
9776
9931
  storedLayers = fn("Cli.storedLayers")(function* (worktree) {
9777
9932
  const store = yield* Store;
@@ -9818,7 +9973,8 @@ var init_layers = __esmMin((() => {
9818
9973
  const patches = yield* patchesOf(worktree);
9819
9974
  return {
9820
9975
  layers: reportedLayers(patches, found.value),
9821
- stale: found.value.head !== worktree.head
9976
+ stale: found.value.head !== worktree.head,
9977
+ rebased: found.value.base !== worktree.base
9822
9978
  };
9823
9979
  });
9824
9980
  }));
@@ -9854,6 +10010,7 @@ var init_threads = __esmMin((() => {
9854
10010
  body: comment.body,
9855
10011
  state: stateOf$1(mine, Object.hasOwn(reading.settled, comment.id), Object.hasOwn(reading.removed, comment.id)),
9856
10012
  stale: batch.head !== reading.head,
10013
+ outside: !reading.shown.has(comment.anchor.path),
9857
10014
  answers: mine.map(spoken$1)
9858
10015
  };
9859
10016
  };
@@ -9872,17 +10029,19 @@ var init_threads = __esmMin((() => {
9872
10029
  body: entry.body,
9873
10030
  state: "staged",
9874
10031
  stale: false,
10032
+ outside: false,
9875
10033
  answers: []
9876
10034
  });
9877
- listThreads = fn("Cli.listThreads")(function* (repo, branch) {
10035
+ listThreads = fn("Cli.listThreads")(function* (repo, branch, base) {
9878
10036
  const store = yield* Store;
9879
- const worktree = yield* findBranch(repo, branch);
10037
+ const worktree = yield* findBranch(repo, branch, base);
9880
10038
  const current = yield* store.state(worktree.path);
9881
10039
  return [...threadsIn(yield* store.inbox(worktree.path), {
9882
10040
  answers: yield* store.answers(worktree.path),
9883
10041
  settled: current.settled,
9884
10042
  removed: current.removed,
9885
- head: worktree.head
10043
+ head: worktree.head,
10044
+ shown: new Set((yield* patchesOf(worktree)).map((patch) => patch.path))
9886
10045
  }), ...current.pending.map(stagedOf)];
9887
10046
  });
9888
10047
  answerComment = fn("Cli.answerComment")(function* (request) {
@@ -9981,7 +10140,7 @@ var init_parse = __esmMin((() => {
9981
10140
  }));
9982
10141
  //#endregion
9983
10142
  //#region src/cli/catalog.ts
9984
- var worktreeOf, repoOf, branchOf, addressing, repo, opening$1, file, range, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, SET_UP, catalog, commandNames, findCommand, verbsUnder, groups, NEAR, distance, NEAR_ENOUGH, nearestCommand;
10143
+ var worktreeOf, repoOf, branchOf, addressing, baseOf, based, repo, opening$1, file, range, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, SET_UP, catalog, commandNames, findCommand, verbsUnder, groups, NEAR, distance, NEAR_ENOUGH, nearestCommand;
9985
10144
  var init_catalog = __esmMin((() => {
9986
10145
  worktreeOf = {
9987
10146
  name: "worktree",
@@ -10006,6 +10165,13 @@ var init_catalog = __esmMin((() => {
10006
10165
  repoOf,
10007
10166
  branchOf
10008
10167
  ];
10168
+ baseOf = {
10169
+ name: "base",
10170
+ required: false,
10171
+ value: "ref",
10172
+ about: "Ref to diff against, instead of the one this branch is stacked on. `auto` asks for the stacked parent explicitly"
10173
+ };
10174
+ based = [...addressing, baseOf];
10009
10175
  repo = {
10010
10176
  name: "repo",
10011
10177
  required: true,
@@ -10063,7 +10229,7 @@ var init_catalog = __esmMin((() => {
10063
10229
  group: READ_A_BRANCH,
10064
10230
  addresses: "repo",
10065
10231
  safety: "read",
10066
- options: [repo],
10232
+ options: [repo, baseOf],
10067
10233
  dataKey: "branches",
10068
10234
  example: "adiff branch list --repo . --fields branch,files"
10069
10235
  },
@@ -10073,7 +10239,11 @@ var init_catalog = __esmMin((() => {
10073
10239
  group: READ_A_BRANCH,
10074
10240
  addresses: "repo",
10075
10241
  safety: "read",
10076
- options: [repo, opening$1],
10242
+ options: [
10243
+ repo,
10244
+ opening$1,
10245
+ baseOf
10246
+ ],
10077
10247
  dataKey: "",
10078
10248
  example: "adiff review open --repo . --branch cdr-1"
10079
10249
  },
@@ -10083,7 +10253,11 @@ var init_catalog = __esmMin((() => {
10083
10253
  group: READ_A_BRANCH,
10084
10254
  addresses: "repo",
10085
10255
  safety: "read",
10086
- options: [repo, opening$1],
10256
+ options: [
10257
+ repo,
10258
+ opening$1,
10259
+ baseOf
10260
+ ],
10087
10261
  dataKey: "pane",
10088
10262
  example: "adiff review pane --repo ."
10089
10263
  },
@@ -10093,17 +10267,42 @@ var init_catalog = __esmMin((() => {
10093
10267
  group: READ_A_BRANCH,
10094
10268
  addresses: "review",
10095
10269
  safety: "write",
10096
- options: [...addressing, file],
10270
+ options: [...based, file],
10097
10271
  dataKey: "reviewed",
10098
10272
  example: "adiff file review --worktree . --file src/api.ts"
10099
10273
  },
10274
+ {
10275
+ name: "base set",
10276
+ about: "Remember the ref this branch is diffed against, so it is not retyped on every command",
10277
+ group: READ_A_BRANCH,
10278
+ addresses: "review",
10279
+ safety: "write",
10280
+ options: [...addressing, {
10281
+ name: "base",
10282
+ required: true,
10283
+ value: "ref",
10284
+ about: "Ref to diff this branch against"
10285
+ }],
10286
+ dataKey: "base",
10287
+ example: "adiff base set --repo . --branch cdr-2 --base cdr-1"
10288
+ },
10289
+ {
10290
+ name: "base clear",
10291
+ about: "Forget a remembered base, so the branch goes back to using the one it is stacked on",
10292
+ group: READ_A_BRANCH,
10293
+ addresses: "review",
10294
+ safety: "write",
10295
+ options: [...addressing],
10296
+ dataKey: "base",
10297
+ example: "adiff base clear --repo . --branch cdr-2"
10298
+ },
10100
10299
  {
10101
10300
  name: "review progress",
10102
10301
  about: "Which files of a review are marked reviewed, and how many there are",
10103
10302
  group: READ_A_BRANCH,
10104
10303
  addresses: "review",
10105
10304
  safety: "read",
10106
- options: [...addressing],
10305
+ options: [...based],
10107
10306
  dataKey: "reviewed",
10108
10307
  example: "adiff review progress --repo . --branch cdr-1"
10109
10308
  },
@@ -10212,7 +10411,7 @@ var init_catalog = __esmMin((() => {
10212
10411
  group: ANSWER_COMMENTS,
10213
10412
  addresses: "review",
10214
10413
  safety: "write",
10215
- options: [...addressing, {
10414
+ options: [...based, {
10216
10415
  name: "json",
10217
10416
  required: true,
10218
10417
  value: "file|-",
@@ -10227,7 +10426,7 @@ var init_catalog = __esmMin((() => {
10227
10426
  group: ANSWER_COMMENTS,
10228
10427
  addresses: "review",
10229
10428
  safety: "read",
10230
- options: [...addressing],
10429
+ options: [...based],
10231
10430
  dataKey: "layers",
10232
10431
  example: "adiff layers show --worktree . --fields layers,uncovered"
10233
10432
  },
@@ -10410,6 +10609,11 @@ var init_report$1 = __esmMin((() => {
10410
10609
  suggestion: "Run `adiff branch list` for the branches that have something to review.",
10411
10610
  retriable: false
10412
10611
  },
10612
+ UnknownBase: {
10613
+ exit: 3,
10614
+ suggestion: "--base takes a ref this repository can resolve and that shares history with the branch. Run `adiff base clear --repo . --branch <name>` to go back to picking the base automatically.",
10615
+ retriable: false
10616
+ },
10413
10617
  UnknownFile: {
10414
10618
  exit: 3,
10415
10619
  suggestion: "The error lists the files this branch changed. Use one of those paths.",
@@ -13406,7 +13610,7 @@ var init_diffview = __esmMin((() => {
13406
13610
  }));
13407
13611
  //#endregion
13408
13612
  //#region src/tui/render.ts
13409
- var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
13613
+ var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, FRAME_PAD, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, COMPOSE_PAD, COMPOSE_MIN_TEXT, reportActions, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_TAIL, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut, STICKY_MAX, pickPaint, SELECTION, CURSOR, ACCENT, GAP_PAINT, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, makePaletteParts, makePendingParts, makeChoices, stack, makeBody, makeHome, makeModals, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, makeComposeParts, makeCompose, clip, clipHead, clipMiddle, clipPath, treeLabel, waitingLabel, inRange, notesOf, notesFor, paired, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, contextLabel, nameRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, headerParts, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, STEP_NUMBER, STEP_LEAD, NOTE_LEAD, STEP_GAP, STALE_ROOM, STALE_LONG, STALE_SHORT, staleBanner, layerRoom, layerFold, layerHead, layerText, layerPaint, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, panelMark, panelWhere, panelBody, panelPair, panelSection, PULL_HINT, panelText, Screen;
13410
13614
  var init_render = __esmMin((() => {
13411
13615
  init_command();
13412
13616
  init_patch();
@@ -13856,8 +14060,10 @@ var init_render = __esmMin((() => {
13856
14060
  if (branch.layers === 0) return "";
13857
14061
  return branch.stale ? `${branch.layers} stale` : `${branch.layers} layers`;
13858
14062
  };
14063
+ baseLabel = (branch) => branch.basis === "default" ? "" : `on ${branch.base}`;
13859
14064
  stateCell = (state, branch) => [
13860
14065
  branch.own ? "here" : "",
14066
+ baseLabel(branch),
13861
14067
  state.pulls[branch.branch] ?? "",
13862
14068
  waitingLabel(branch).trim()
13863
14069
  ].filter((part) => part.length > 0).join(" ");
@@ -15609,9 +15815,17 @@ const answer = (options, body) => sync(() => {
15609
15815
  })}\n`);
15610
15816
  });
15611
15817
  const branchList = fn("Main.branchList")(function* (options) {
15612
- const branches = yield* listBranches(yield* required(options, "repo"));
15818
+ const branches = yield* listBranches(yield* required(options, "repo"), options["base"]);
15613
15819
  yield* answer(options, { branches });
15614
15820
  });
15821
+ const baseSet = fn("Main.baseSet")(function* (options) {
15822
+ const report = yield* setBase(yield* required(options, "repo"), yield* required(options, "branch"), yield* required(options, "base"));
15823
+ yield* answer(options, { base: report });
15824
+ });
15825
+ const baseClear = fn("Main.baseClear")(function* (options) {
15826
+ const report = yield* clearBase(yield* required(options, "repo"), yield* required(options, "branch"));
15827
+ yield* answer(options, { base: report });
15828
+ });
15615
15829
  const commentSend = fn("Main.commentSend")(function* (options) {
15616
15830
  const batch = yield* submitComment({
15617
15831
  repo: yield* required(options, "repo"),
@@ -15706,7 +15920,7 @@ const fileReview = fn("Main.fileReview")(function* (options) {
15706
15920
  });
15707
15921
  });
15708
15922
  const reviewStatus = fn("Main.reviewStatus")(function* (options) {
15709
- const report = yield* reviewProgress(yield* required(options, "repo"), yield* required(options, "branch"));
15923
+ const report = yield* reviewProgress(yield* required(options, "repo"), yield* required(options, "branch"), options["base"]);
15710
15924
  yield* answer(options, {
15711
15925
  reviewed: report.vouched,
15712
15926
  total: report.total,
@@ -15763,6 +15977,8 @@ const saidUpgrade = fn("Main.saidUpgrade")(function* (found, ran, skills) {
15763
15977
  });
15764
15978
  const routes = {
15765
15979
  "branch list": branchList,
15980
+ "base set": baseSet,
15981
+ "base clear": baseClear,
15766
15982
  "comment send": commentSend,
15767
15983
  "comment stage": commentStage,
15768
15984
  "comment edit": commentEdit,
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.55",
26
+ "version": "0.1.0-alpha.56",
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": {