@eliya-oss/agent-diff 0.1.0-alpha.142 → 0.1.0-alpha.144

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,77 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.144
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(home screen): the branch list is headed `BRANCH` and counts `3 branches`, where it said worktree.
8
+
9
+ <details><summary>What was wrong</summary>
10
+
11
+ The list of work waiting was headed `WORKTREE`, and the line above it counted worktrees. adiff talks
12
+ about branches everywhere else, so the reviewer had two words for one thing on the first screen they
13
+ see.
14
+
15
+ </details>
16
+
17
+ fix(keys): the keys that reread the list and jump to its ends name branches, not worktrees.
18
+
19
+ ## 0.1.0-alpha.143
20
+
21
+ ### Patch Changes
22
+
23
+ - fix(diff): a comment stays on its line when the agent edits that line by a few characters.
24
+
25
+ <details><summary>What was wrong</summary>
26
+
27
+ A comment was placed by matching its snippet exactly, so making the small edit the comment asked for
28
+ took the comment off the diff along with the old wording. Asking for `seed: (driver, network)` to
29
+ become `seed: ({ driver, network })` cost the reviewer both the comment and the answer to it: the
30
+ thread was answered, but only the review panel showed it. A line that is nearly the same — at most
31
+ one character changed in four — now keeps the comment. A short line still has to match exactly, so
32
+ nothing lands on a stray brace, and code the agent genuinely replaced still goes to the panel.
33
+
34
+ </details>
35
+
36
+ - breaking(CLI): `adiff init` is gone, and the skill is installed with `npx skills add Newbie012/agent-diff --skill adiff`.
37
+
38
+ <details><summary>What changed</summary>
39
+
40
+ `init` wrote a passage into `AGENTS.md` and a `CLAUDE.md` importing it, kept between sentinels so it
41
+ could be found and replaced, and wrote the skill only if you also asked for it. Editing two files a
42
+ whole team shares bought nothing the skill does not already do — an agent finds a skill by its
43
+ description without being told to look — and a command whose whole job was fetching one file had to
44
+ be installed, learned and kept in step with the skills CLI's own.
45
+
46
+ Getting started is now installing adiff and installing the skill. adiff writes nothing into a
47
+ repository. If you ran the old `init`, the block between `<!-- adiff:begin -->` and
48
+ `<!-- adiff:end -->` in `AGENTS.md` and `CLAUDE.md` is yours to delete; nothing reads it any more.
49
+ `adiff skill refresh` still brings an installed skill up to the build running beside it.
50
+
51
+ </details>
52
+
53
+ - fix(diff): the terminal shows the diff against the base it was opened with.
54
+
55
+ <details><summary>What was wrong</summary>
56
+
57
+ `adiff review open --base <ref>` took the flag, validated it, and threw it away. The terminal always
58
+ read the branch against the base it would have guessed, so someone reviewing the one commit they had
59
+ just asked for got the whole stacked branch instead — 44 files where the base gave 1 — with nothing
60
+ on screen to say the base had been ignored. Every command that answers in JSON honoured it, which
61
+ made the terminal look right until you counted the files.
62
+
63
+ </details>
64
+
65
+ fix(diff): `review pane` carries a base into the pane it opens and the command it reports.
66
+
67
+ <details><summary>What was wrong</summary>
68
+
69
+ The same flag was dropped one function over, so a pane opened for an agent showed a different diff
70
+ from the one the agent was told to open, and the command in the answer could not be pasted to
71
+ reproduce it.
72
+
73
+ </details>
74
+
3
75
  ## 0.1.0-alpha.142
4
76
 
5
77
  ### Patch Changes
package/README.md CHANGED
@@ -16,34 +16,24 @@ point stays open until you settle it.
16
16
 
17
17
  ## Getting started
18
18
 
19
- Install adiff, then teach the repository what it is:
19
+ Two commands. The first installs adiff, the second installs the skill that teaches your agent to
20
+ pick up your comments:
20
21
 
21
22
  ```bash
22
23
  brew install Newbie012/tap/adiff
23
- adiff init --write --skill
24
+ npx skills add Newbie012/agent-diff --skill adiff
24
25
  ```
25
26
 
26
- `init` writes a short passage into `AGENTS.md` and a `CLAUDE.md` that imports it, and `--skill`
27
- writes the full skill into `.claude/skills/adiff/`. Then ask your agent to walk you through it:
27
+ adiff writes nothing into your repository — no `AGENTS.md`, no `CLAUDE.md`. Your agent finds the
28
+ skill on its own.
29
+
30
+ Then ask it to walk you through it:
28
31
 
29
32
  > Read the adiff skill and onboard me: hand your current work over for review, and tell me what to
30
33
  > press.
31
34
 
32
35
  From then on the loop is: the agent hands work over, you read it, and it answers what you wrote.
33
-
34
- ## Reviewing
35
-
36
- ```bash
37
- adiff review open --repo .
38
- ```
39
-
40
- `j` and `k` move down the diff, `[` and `]` between files, `v` starts a selection and `c` writes a
41
- comment that `ctrl+s` sends. `d` settles the thread you are on, `m` marks a file reviewed, `y`
42
- copies the line you are on, and dragging over lines copies them. `?` lists every key and filters as
43
- you type. The footer carries the keys of whichever pane you are in.
44
-
45
- `,` opens the preferences and turns any of it on or off. Turn on holding and a comment waits with
46
- the others until `C` sends them to the agent as one review.
36
+ Open a review yourself with `adiff review open --repo .`, and press `?` for every key.
47
37
 
48
38
  ## For agents
49
39
 
package/dist/main.js CHANGED
@@ -8819,7 +8819,7 @@ var init_error$3 = __esmMin((() => {
8819
8819
  }));
8820
8820
  //#endregion
8821
8821
  //#region src/service/forge/service.ts
8822
- var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, review, ForgeLive;
8822
+ var Forge, LIMIT, TIMEOUT_MS$1, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Row, decode$1, SAID, stateOf$1, ended, ask, show, read, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$1, head, sideName, commentBody, bodyFor, Landed, readLanded, keyOf$2, counted, acknowledged, landedIn, review, ForgeLive;
8823
8823
  var init_service$2 = __esmMin((() => {
8824
8824
  init_dist();
8825
8825
  init_error$3();
@@ -8940,7 +8940,7 @@ var init_service$2 = __esmMin((() => {
8940
8940
  if (input !== void 0) child.stdin?.end(input);
8941
8941
  return ended(child);
8942
8942
  });
8943
- named = fn("Forge.named")(function* (repo, branch) {
8943
+ named$1 = fn("Forge.named")(function* (repo, branch) {
8944
8944
  const raw = yield* gh(repo, [
8945
8945
  "pr",
8946
8946
  "view",
@@ -8961,7 +8961,7 @@ var init_service$2 = __esmMin((() => {
8961
8961
  }));
8962
8962
  });
8963
8963
  head = fn("Forge.head")(function* (repo, branch) {
8964
- return (yield* named(repo, branch)).headRefOid;
8964
+ return (yield* named$1(repo, branch)).headRefOid;
8965
8965
  });
8966
8966
  sideName = (side) => side === "old" ? "LEFT" : "RIGHT";
8967
8967
  commentBody = (one) => ({
@@ -9006,7 +9006,7 @@ var init_service$2 = __esmMin((() => {
9006
9006
  });
9007
9007
  };
9008
9008
  review = fn("Forge.review")(function* (repo, branch, comments) {
9009
- const pull = yield* named(repo, branch);
9009
+ const pull = yield* named$1(repo, branch);
9010
9010
  const route = `repos/${(yield* gh(repo, [
9011
9011
  "repo",
9012
9012
  "view",
@@ -9592,7 +9592,7 @@ var init_model$3 = __esmMin((() => {
9592
9592
  }));
9593
9593
  //#endregion
9594
9594
  //#region src/domain/patch/anchor.ts
9595
- var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, foundAgain;
9595
+ var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundAgain;
9596
9596
  var init_anchor = __esmMin((() => {
9597
9597
  init_dist();
9598
9598
  init_model$3();
@@ -9640,6 +9640,25 @@ var init_anchor = __esmMin((() => {
9640
9640
  return here !== void 0 && here.text === text && here.line === (lines[at]?.line ?? 0) + step;
9641
9641
  });
9642
9642
  nearestRun = (lines, said, near) => lines.flatMap((here, at) => runsAt(lines, said, at) ? [here.line] : []).toSorted((one, other) => Math.abs(one - near) - Math.abs(other - near))[0];
9643
+ SHORTEST_NEAR = 8;
9644
+ PER_EDIT = 4;
9645
+ edits = (one, other) => {
9646
+ let row = Array.from({ length: other.length + 1 }, (_, at) => at);
9647
+ for (let step = 1; step <= one.length; step += 1) {
9648
+ const next = [step];
9649
+ for (let at = 1; at <= other.length; at += 1) {
9650
+ const swap = (row[at - 1] ?? 0) + (one[step - 1] === other[at - 1] ? 0 : 1);
9651
+ next.push(Math.min(swap, (row[at] ?? 0) + 1, (next[at - 1] ?? 0) + 1));
9652
+ }
9653
+ row = next;
9654
+ }
9655
+ return row[other.length] ?? 0;
9656
+ };
9657
+ isNear = (one, other) => {
9658
+ const room = Math.max(one.trim().length, other.trim().length);
9659
+ return room >= SHORTEST_NEAR && edits(one, other) <= Math.floor(room / PER_EDIT);
9660
+ };
9661
+ nearestLike = (lines, said, near) => lines.filter((here) => isNear(here.text, said)).toSorted((one, other) => Math.abs(one.line - near) - Math.abs(other.line - near))[0]?.line;
9643
9662
  foundAgain = (patch, wanted) => {
9644
9663
  const said = wanted.snippet.split("\n");
9645
9664
  if (said.every((text) => text.trim().length === 0)) return none();
@@ -9651,13 +9670,13 @@ var init_anchor = __esmMin((() => {
9651
9670
  end: whole + said.length - 1
9652
9671
  });
9653
9672
  const first = said[0] ?? "";
9654
- if (said.length === 1 || first.trim().length === 0) return none();
9655
- const opening = nearestRun(lines, [first], wanted.start);
9656
- if (opening === void 0) return none();
9673
+ if (first.trim().length === 0) return none();
9674
+ const alike = (said.length === 1 ? void 0 : nearestRun(lines, [first], wanted.start)) ?? nearestLike(lines, first, wanted.start);
9675
+ if (alike === void 0) return none();
9657
9676
  return some({
9658
9677
  side: wanted.side,
9659
- start: opening,
9660
- end: opening
9678
+ start: alike,
9679
+ end: alike
9661
9680
  });
9662
9681
  };
9663
9682
  }));
@@ -10917,58 +10936,12 @@ var init_drafts = __esmMin((() => {
10917
10936
  });
10918
10937
  }));
10919
10938
  //#endregion
10920
- //#region src/cli/init.ts
10921
- var BEGIN, END, REACH, INSTRUCTIONS, IMPORT, blockIn, replaced, appended, planFor, readAt, writeAt, settle, skillSource, shippedSkill, settleSkill, SKILL_AT, refreshAt, settledRoot, refreshSkill, initRepository;
10922
- var init_init = __esmMin((() => {
10939
+ //#region src/cli/skill.ts
10940
+ var REACH, readAt, writeAt, skillSource, shippedSkill, SKILL_AT, refreshAt, settledRoot, refreshSkill;
10941
+ var init_skill = __esmMin((() => {
10923
10942
  init_dist();
10924
10943
  init_error();
10925
- BEGIN = "<!-- adiff:begin -->";
10926
- END = "<!-- adiff:end -->";
10927
10944
  REACH = 5;
10928
- INSTRUCTIONS = [
10929
- BEGIN,
10930
- "## Review",
10931
- "",
10932
- "Review of work in this repository happens in adiff. Before you say you are done, run",
10933
- "`adiff comment take --worktree . --wait 300` in the background and handle what arrives.",
10934
- "Answer a comment with `adiff comment answer --worktree . --id <id> --body <text>`.",
10935
- "When you hand work over, say it is ready and name the command that opens the review:",
10936
- "`adiff review open --repo <repo>`, or `adiff review pane --repo <repo>` to open it alongside.",
10937
- "Publish a reading order with `adiff layers set` only when you are asked for one.",
10938
- "`adiff --help` lists the rest, and `adiff describe` answers the same as JSON.",
10939
- END
10940
- ].join("\n");
10941
- IMPORT = [
10942
- BEGIN,
10943
- "@AGENTS.md",
10944
- END
10945
- ].join("\n");
10946
- blockIn = (text) => {
10947
- const opens = text.indexOf(BEGIN);
10948
- const closes = text.indexOf(END, opens);
10949
- return opens === -1 || closes === -1 ? none() : some(text.slice(opens, closes + 18));
10950
- };
10951
- replaced = (text, block, wanted) => text.replace(block, wanted);
10952
- appended = (text, wanted) => text.endsWith("\n") ? `${text}\n${wanted}\n` : `${text}\n\n${wanted}\n`;
10953
- planFor = (current, wanted) => {
10954
- const text = getOrUndefined$1(current);
10955
- if (text === void 0) return {
10956
- action: "create",
10957
- next: `${wanted}\n`
10958
- };
10959
- const found = blockIn(text);
10960
- if (isNone(found)) return {
10961
- action: "append",
10962
- next: appended(text, wanted)
10963
- };
10964
- return found.value === wanted ? {
10965
- action: "unchanged",
10966
- next: text
10967
- } : {
10968
- action: "update",
10969
- next: replaced(text, found.value, wanted)
10970
- };
10971
- };
10972
10945
  readAt = fn("Cli.readAt")(function* (path) {
10973
10946
  return yield* tryPromise({
10974
10947
  try: () => readFile(path, "utf8"),
@@ -10987,16 +10960,6 @@ var init_init = __esmMin((() => {
10987
10960
  })
10988
10961
  });
10989
10962
  });
10990
- settle = fn("Cli.settle")(function* (root, name, wanted, write) {
10991
- const path = join(root, name);
10992
- const current = yield* readAt(path);
10993
- const plan = planFor(current, wanted);
10994
- if (write && plan.action !== "unchanged") yield* writeAt(path, plan.next);
10995
- return {
10996
- path: name,
10997
- action: plan.action
10998
- };
10999
- });
11000
10963
  skillSource = () => {
11001
10964
  const here = dirname(fileURLToPath(import.meta.url));
11002
10965
  return Array.from({ length: REACH }, (_, layer) => join(here, ...Array(layer).fill(".."))).map((at) => join(at, "skills", "adiff", "SKILL.md")).find((path) => existsSync(path));
@@ -11008,20 +10971,6 @@ var init_init = __esmMin((() => {
11008
10971
  reason: "not found beside this build"
11009
10972
  }) : sync(() => readFileSync(source, "utf8"));
11010
10973
  });
11011
- settleSkill = fn("Cli.settleSkill")(function* (root, write) {
11012
- const name = join(".claude", "skills", "adiff", "SKILL.md");
11013
- const wanted = yield* shippedSkill();
11014
- const current = yield* readAt(join(root, name));
11015
- const action = match$3(current, {
11016
- onNone: () => "create",
11017
- onSome: (text) => text === wanted ? "unchanged" : "update"
11018
- });
11019
- if (write && action !== "unchanged") yield* writeAt(join(root, name), wanted);
11020
- return {
11021
- path: name,
11022
- action
11023
- };
11024
- });
11025
10974
  SKILL_AT = join(".claude", "skills", "adiff", "SKILL.md");
11026
10975
  refreshAt = fn("Cli.refreshAt")(function* (root, wanted) {
11027
10976
  const path = join(root, SKILL_AT);
@@ -11051,23 +11000,10 @@ var init_init = __esmMin((() => {
11051
11000
  for (const root of seen) found.push(...yield* refreshAt(root, wanted));
11052
11001
  return { changes: found };
11053
11002
  });
11054
- initRepository = fn("Cli.initRepository")(function* (request) {
11055
- const instructions = yield* settle(request.repo, "AGENTS.md", INSTRUCTIONS, request.write);
11056
- const memory = yield* settle(request.repo, "CLAUDE.md", IMPORT, request.write);
11057
- const skill = request.skill ? [yield* settleSkill(request.repo, request.write)] : [];
11058
- return {
11059
- wrote: request.write,
11060
- changes: [
11061
- instructions,
11062
- memory,
11063
- ...skill
11064
- ]
11065
- };
11066
- });
11067
11003
  }));
11068
11004
  //#endregion
11069
11005
  //#region src/cli/pane.ts
11070
- var TIMEOUT_MS, set, splitters, onBranch, selfInvocation, ran, split, openPane;
11006
+ var TIMEOUT_MS, set, splitters, named, selfInvocation, ran, split, openPane;
11071
11007
  var init_pane = __esmMin((() => {
11072
11008
  init_dist();
11073
11009
  TIMEOUT_MS = 5e3;
@@ -11128,8 +11064,8 @@ var init_pane = __esmMin((() => {
11128
11064
  ]
11129
11065
  }
11130
11066
  ];
11131
- onBranch = (branch) => branch === void 0 ? [] : ["--branch", branch];
11132
- selfInvocation = (repo, branch) => {
11067
+ named = (option, value) => value === void 0 ? [] : [`--${option}`, value];
11068
+ selfInvocation = (repo, branch, base) => {
11133
11069
  const entry = process.argv[1];
11134
11070
  return [
11135
11071
  ...entry === void 0 ? ["adiff"] : [
@@ -11141,18 +11077,20 @@ var init_pane = __esmMin((() => {
11141
11077
  "open",
11142
11078
  "--repo",
11143
11079
  repo,
11144
- ...onBranch(branch)
11080
+ ...named("branch", branch),
11081
+ ...named("base", base)
11145
11082
  ];
11146
11083
  };
11147
11084
  ran = (binary, args) => callback$1((resume) => {
11148
11085
  const child = execFile(binary, [...args], { timeout: TIMEOUT_MS }, (cause) => resume(succeed$1(cause === null)));
11149
11086
  return sync(() => void child.kill());
11150
11087
  });
11151
- split = fn("Cli.split")(function* (chosen, repo, branch) {
11152
- return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch)));
11088
+ split = fn("Cli.split")(function* (chosen, repo, branch, base) {
11089
+ return yield* ran(chosen.binary, chosen.args(repo, selfInvocation(repo, branch, base)));
11153
11090
  });
11154
- openPane = fn("Cli.openPane")(function* (repo, branch) {
11155
- const command = `adiff review open --repo ${repo}${branch === void 0 ? "" : ` --branch ${branch}`}`;
11091
+ openPane = fn("Cli.openPane")(function* (repo, branch, base) {
11092
+ const said = [...named("branch", branch), ...named("base", base)].join(" ");
11093
+ const command = `adiff review open --repo ${repo}${said.length === 0 ? "" : ` ${said}`}`;
11156
11094
  const chosen = splitters.find((candidate) => candidate.present());
11157
11095
  if (chosen === void 0) return {
11158
11096
  opened: false,
@@ -11160,7 +11098,7 @@ var init_pane = __esmMin((() => {
11160
11098
  command
11161
11099
  };
11162
11100
  return {
11163
- opened: yield* split(chosen, repo, branch),
11101
+ opened: yield* split(chosen, repo, branch, base),
11164
11102
  pane: chosen.pane,
11165
11103
  command
11166
11104
  };
@@ -11169,9 +11107,9 @@ var init_pane = __esmMin((() => {
11169
11107
  //#endregion
11170
11108
  //#region package.json
11171
11109
  init_drafts();
11172
- init_init();
11110
+ init_skill();
11173
11111
  init_pane();
11174
- var version$1 = "0.1.0-alpha.142";
11112
+ var version$1 = "0.1.0-alpha.144";
11175
11113
  //#endregion
11176
11114
  //#region src/cli/upgrade.ts
11177
11115
  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, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, REFRESH_MS, refreshSkills, updatedIn, sayRefreshed, upgradeReport;
@@ -12445,35 +12383,6 @@ var init_catalog = __esmMin((() => {
12445
12383
  dataKey: "preference",
12446
12384
  example: "adiff config set --name hold --value on"
12447
12385
  },
12448
- {
12449
- name: "init",
12450
- about: "Write the review loop into this repository's agent instructions, so an agent finds it unprompted",
12451
- group: SET_UP,
12452
- addresses: "repo",
12453
- safety: "write",
12454
- options: [
12455
- {
12456
- name: "repo",
12457
- required: true,
12458
- value: "path",
12459
- about: "Repository to write the loop into"
12460
- },
12461
- {
12462
- name: "write",
12463
- required: false,
12464
- value: "flag",
12465
- about: "Make the changes. Without it, init reports what each file would become"
12466
- },
12467
- {
12468
- name: "skill",
12469
- required: false,
12470
- value: "flag",
12471
- about: "Also commit the adiff skill at .claude/skills/adiff/SKILL.md"
12472
- }
12473
- ],
12474
- dataKey: "changes",
12475
- example: "adiff init --repo . --write"
12476
- },
12477
12386
  {
12478
12387
  name: "skill refresh",
12479
12388
  about: "Rewrite the adiff skill wherever it is already installed, in this directory and in your home directory. Installs nothing that is not already there",
@@ -12789,7 +12698,7 @@ var init_report$1 = __esmMin((() => {
12789
12698
  },
12790
12699
  InitUnwritable: {
12791
12700
  exit: 1,
12792
- suggestion: "adiff init writes AGENTS.md and CLAUDE.md in the repository you point --repo at. Check that path is a directory you can write to.",
12701
+ suggestion: "adiff could not write the skill. Check that .claude/skills/adiff/ is somewhere you can write to.",
12793
12702
  retriable: false
12794
12703
  },
12795
12704
  UnselectableRange: {
@@ -14291,14 +14200,14 @@ var init_command = __esmMin((() => {
14291
14200
  }),
14292
14201
  command({
14293
14202
  action: "branch.first",
14294
- title: "Go to the first worktree",
14203
+ title: "Go to the first branch",
14295
14204
  category: "Branches",
14296
14205
  keys: ["g"],
14297
14206
  screens: ["branches"]
14298
14207
  }),
14299
14208
  command({
14300
14209
  action: "branch.last",
14301
- title: "Go to the last worktree",
14210
+ title: "Go to the last branch",
14302
14211
  category: "Branches",
14303
14212
  keys: ["G"],
14304
14213
  screens: ["branches"]
@@ -14419,7 +14328,7 @@ var init_command = __esmMin((() => {
14419
14328
  }),
14420
14329
  command({
14421
14330
  action: "review.reload",
14422
- title: "Read the worktrees again",
14331
+ title: "Read the branches again",
14423
14332
  category: "Branches",
14424
14333
  keys: ["r"],
14425
14334
  screens: ["branches"],
@@ -16686,7 +16595,7 @@ var init_render = __esmMin((() => {
16686
16595
  BRANCH_NAME_MIN = 12;
16687
16596
  BRANCH_FIXED = 36;
16688
16597
  STATE_MIN = 11;
16689
- EMPTY_LIST = " nothing to review. No worktree differs from the branch it started from.";
16598
+ EMPTY_LIST = " nothing to review. No branch differs from the one it started from.";
16690
16599
  MODAL_MARGIN = 4;
16691
16600
  shareOf = (width, least) => Math.max(least, Math.min(PANEL_MAX, Math.floor(width * PANEL_SHARE)));
16692
16601
  homeWidth = (width, longest, said = STATE_MIN) => Math.max(0, Math.min(width - 2, Math.min(PANEL_MAX, Math.max(BRANCH_WIDTH, longest + BRANCH_FIXED + Math.max(STATE_MIN, said)))));
@@ -17325,7 +17234,7 @@ var init_render = __esmMin((() => {
17325
17234
  FORGE_SILENT = " could not reach the forge, so no pull request is shown";
17326
17235
  unaskedForge = (state) => state.forge === "silent" ? [fg(palette.attention)(`\n${FORGE_SILENT}`)] : [];
17327
17236
  branchHeading = (room) => ` ${columns({
17328
- name: "WORKTREE",
17237
+ name: "BRANCH",
17329
17238
  files: "FILES",
17330
17239
  added: "+",
17331
17240
  gone: "-",
@@ -17831,7 +17740,7 @@ var init_render = __esmMin((() => {
17831
17740
  this.header.content = this.headerText(state);
17832
17741
  this.footer.content = this.footerText(state);
17833
17742
  this.list.content = this.listText(state);
17834
- const many = state.branches.length === 1 ? "1 worktree" : `${state.branches.length} worktrees`;
17743
+ const many = state.branches.length === 1 ? "1 branch" : `${state.branches.length} branches`;
17835
17744
  const pane = this.homeRoom(state);
17836
17745
  const room = Math.max(HOME_PATH_MIN, pane - many.length - HOME_PATH_CHROME);
17837
17746
  this.landing.content = `${elide(shortPath(this.repo), room)} · ${many}`;
@@ -18598,6 +18507,7 @@ var init_app = __esmMin((() => {
18598
18507
  reading;
18599
18508
  renderer;
18600
18509
  repo;
18510
+ base;
18601
18511
  noticeMs;
18602
18512
  roomed = 0;
18603
18513
  sessionPath;
@@ -18622,6 +18532,7 @@ var init_app = __esmMin((() => {
18622
18532
  constructor(options) {
18623
18533
  this.renderer = options.renderer;
18624
18534
  this.repo = options.repo;
18535
+ this.base = options.base;
18625
18536
  this.noticeMs = options.noticeMs ?? NOTICE_MS;
18626
18537
  this.sessionPath = options.sessionPath;
18627
18538
  Object.assign(this.chosen, chosenIn({
@@ -19077,7 +18988,7 @@ var init_app = __esmMin((() => {
19077
18988
  }
19078
18989
  readBranch(name) {
19079
18990
  return gen({ self: this }, function* () {
19080
- const reading = yield* readingOf(this.repo, name);
18991
+ const reading = yield* readingOf(this.repo, name, this.base);
19081
18992
  this.reading = reading;
19082
18993
  const [progress, layers, sent] = yield* all([
19083
18994
  progressIn(reading),
@@ -19373,7 +19284,7 @@ var init_app = __esmMin((() => {
19373
19284
  fillBranches() {
19374
19285
  return gen({ self: this }, function* () {
19375
19286
  const here = selectedBranch(this.state)?.branch;
19376
- const branches = yield* listBranches(this.repo);
19287
+ const branches = yield* listBranches(this.repo, this.base);
19377
19288
  const read = withBranches(this.state, branches);
19378
19289
  const at = branches.findIndex((candidate) => candidate.branch === here);
19379
19290
  this.commit(at === -1 ? read : {
@@ -19386,7 +19297,7 @@ var init_app = __esmMin((() => {
19386
19297
  reloadList() {
19387
19298
  return gen({ self: this }, function* () {
19388
19299
  const here = selectedBranch(this.state)?.branch;
19389
- const branches = yield* listBranches(this.repo);
19300
+ const branches = yield* listBranches(this.repo, this.base);
19390
19301
  const read = withBranches(this.state, branches);
19391
19302
  const at = branches.findIndex((candidate) => candidate.branch === here);
19392
19303
  const kept = at === -1 ? read : {
@@ -19415,7 +19326,7 @@ var init_app = __esmMin((() => {
19415
19326
  const next = reduce(this.measured(), "back");
19416
19327
  this.commit(next);
19417
19328
  if (next.screen !== "branches") return;
19418
- this.commit(withBranches(this.state, yield* listBranches(this.repo)));
19329
+ this.commit(withBranches(this.state, yield* listBranches(this.repo, this.base)));
19419
19330
  });
19420
19331
  }
19421
19332
  walkComments(delta) {
@@ -19868,12 +19779,12 @@ var init_app = __esmMin((() => {
19868
19779
  hold: kept["hold"] === true
19869
19780
  };
19870
19781
  });
19871
- firstBranches = fn("Tui.firstBranches")(function* (repo, branch) {
19872
- if (branch === void 0) return yield* listBranches(repo);
19873
- const only = yield* summaryFor(repo, branch).pipe(orElseSucceed(() => void 0));
19874
- return only === void 0 ? yield* listBranches(repo) : [only];
19782
+ firstBranches = fn("Tui.firstBranches")(function* (repo, branch, base) {
19783
+ if (branch === void 0) return yield* listBranches(repo, base);
19784
+ const only = yield* summaryFor(repo, branch, base).pipe(orElseSucceed(() => void 0));
19785
+ return only === void 0 ? yield* listBranches(repo, base) : [only];
19875
19786
  });
19876
- missing = (branch, found) => branch !== void 0 && isNone(found) ? `no worktree here is on ${branch}` : "";
19787
+ missing = (branch, found) => branch !== void 0 && isNone(found) ? `no branch here is called ${branch}` : "";
19877
19788
  openingOn = (branches, branch) => {
19878
19789
  if (branch === void 0) return none();
19879
19790
  const at = branches.findIndex((candidate) => candidate.branch === branch);
@@ -19882,7 +19793,7 @@ var init_app = __esmMin((() => {
19882
19793
  launch = fn("Tui.launch")(function* (asked, renderer, options = {}) {
19883
19794
  const { noticeMs, sessionPath } = options;
19884
19795
  const repo = yield* settledPath(asked);
19885
- const branches = yield* firstBranches(repo, options.branch);
19796
+ const branches = yield* firstBranches(repo, options.branch, options.base);
19886
19797
  const asOpened = openingOn(branches, options.branch);
19887
19798
  const missed = missing(options.branch, asOpened);
19888
19799
  const resume = isSome(asOpened) ? none() : sessionPath === void 0 ? none() : yield* readSession(sessionPath);
@@ -19902,6 +19813,7 @@ var init_app = __esmMin((() => {
19902
19813
  const app = new App({
19903
19814
  renderer,
19904
19815
  repo,
19816
+ base: options.base,
19905
19817
  display,
19906
19818
  state,
19907
19819
  painting,
@@ -19922,14 +19834,11 @@ var init_app = __esmMin((() => {
19922
19834
  untilDestroyed = (renderer) => callback$1((resume) => {
19923
19835
  renderer.on("destroy", () => resume(void_));
19924
19836
  });
19925
- runOn = fn("Tui.runOn")(function* (repo, renderer, sessionPath, branch) {
19926
- yield* launch(repo, renderer, {
19927
- sessionPath,
19928
- branch
19929
- });
19837
+ runOn = fn("Tui.runOn")(function* (repo, renderer, options = {}) {
19838
+ yield* launch(repo, renderer, options);
19930
19839
  yield* untilDestroyed(renderer);
19931
19840
  });
19932
- runTui = fn("Tui.run")(function* (repo, sessionPath, branch) {
19841
+ runTui = fn("Tui.run")(function* (repo, options = {}) {
19933
19842
  const renderer = yield* promise(() => createCliRenderer({
19934
19843
  exitOnCtrlC: false,
19935
19844
  useKittyKeyboard: {
@@ -19937,7 +19846,7 @@ var init_app = __esmMin((() => {
19937
19846
  allKeysAsEscapes: true
19938
19847
  }
19939
19848
  }));
19940
- yield* ensuring(runOn(repo, renderer, sessionPath, branch), sync(() => renderer.destroy()));
19849
+ yield* ensuring(runOn(repo, renderer, options), sync(() => renderer.destroy()));
19941
19850
  });
19942
19851
  }));
19943
19852
  //#endregion
@@ -20127,17 +20036,6 @@ const layersShow = fn("Main.layersShow")(function* (options) {
20127
20036
  const layers = yield* showLayers(yield* required(options, "worktree"));
20128
20037
  yield* answer(options, { layers });
20129
20038
  });
20130
- const init = fn("Main.init")(function* (options) {
20131
- const report = yield* initRepository({
20132
- repo: yield* required(options, "repo"),
20133
- write: options["write"] !== void 0,
20134
- skill: options["skill"] !== void 0
20135
- });
20136
- yield* answer(options, {
20137
- wrote: report.wrote,
20138
- changes: report.changes
20139
- });
20140
- });
20141
20039
  const skillRefresh = fn("Main.skillRefresh")(function* (options) {
20142
20040
  const report = yield* refreshSkill([process.cwd(), homedir()]);
20143
20041
  yield* answer(options, { changes: report.changes });
@@ -20155,7 +20053,7 @@ const configSet = fn("Main.configSet")(function* (options) {
20155
20053
  yield* answer(options, { preference: yield* savePreference(name, wanted) });
20156
20054
  });
20157
20055
  const reviewPane = fn("Main.reviewPane")(function* (options) {
20158
- const report = yield* openPane(yield* required(options, "repo"), options["branch"]);
20056
+ const report = yield* openPane(yield* required(options, "repo"), options["branch"], options["base"]);
20159
20057
  yield* answer(options, {
20160
20058
  opened: report.opened,
20161
20059
  pane: report.pane,
@@ -20196,7 +20094,6 @@ const routes = {
20196
20094
  "review progress": reviewStatus,
20197
20095
  "layers set": layersSet,
20198
20096
  "layers show": layersShow,
20199
- init,
20200
20097
  "skill refresh": skillRefresh,
20201
20098
  upgrade: fn("Main.upgrade")(function* (options) {
20202
20099
  const check = options["check"] !== void 0;
@@ -20265,7 +20162,11 @@ const dispatch = fn("Main.dispatch")(function* (name, given) {
20265
20162
  if (name === "file review") return yield* fileReview(options);
20266
20163
  if (name === "review open") {
20267
20164
  const { runTui } = yield* promise(() => Promise.resolve().then(() => (init_tui(), tui_exports)));
20268
- return yield* runTui(yield* required(options, "repo"), process.env["ADIFF_SESSION"], options["branch"]);
20165
+ return yield* runTui(yield* required(options, "repo"), {
20166
+ sessionPath: process.env["ADIFF_SESSION"],
20167
+ branch: options["branch"],
20168
+ base: options["base"]
20169
+ });
20269
20170
  }
20270
20171
  return yield* unknown(name);
20271
20172
  });
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.142",
26
+ "version": "0.1.0-alpha.144",
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": {