@eliya-oss/agent-diff 0.1.0-alpha.185 → 0.1.0-alpha.187

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/main.js +297 -43
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @eliya-oss/agent-diff
2
2
 
3
+ ## 0.1.0-alpha.187
4
+
5
+ ### Patch Changes
6
+
7
+ - feat(CLI): `pull show`, `base list`, `branch search`, `layers ask`, `comment read` and `comment resolve --read` give every review verb the terminal has a command of its own.
8
+
9
+ <details><summary>What each one does</summary>
10
+
11
+ `pull show` names the pull request behind a branch, its address and whether somebody else opened it. `base list` offers the refs `b` offers. `branch search` is the terminal's `/`. `layers ask` files the request `L` files. `comment read` marks a thread's answers read, and `comment resolve --read` settles every answer already read, as `D` does.
12
+
13
+ </details>
14
+
15
+ feat(layers): `layers show` names the files already read in each layer, and `file review --layer <n>` marks a file two layers share read in one of them, as `m` does on the rail.
16
+
17
+ feat(comment delivery): each comment `adiff comment list` reports says whether the agent has taken it, so another program can draw ◎ and ○ as the terminal does.
18
+
19
+ ## 0.1.0-alpha.186
20
+
21
+ ### Patch Changes
22
+
23
+ - feat(CLI): `adiff comment list` takes `--base`, and each comment it lists carries the time it was sent.
24
+
3
25
  ## 0.1.0-alpha.185
4
26
 
5
27
  ### Patch Changes
package/dist/main.js CHANGED
@@ -10042,7 +10042,7 @@ var init_config = __esmMin((() => {
10042
10042
  //#region package.json
10043
10043
  init_pane();
10044
10044
  init_config();
10045
- var version$1 = "0.1.0-alpha.185";
10045
+ var version$1 = "0.1.0-alpha.187";
10046
10046
  //#endregion
10047
10047
  //#region src/cli/error.ts
10048
10048
  var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered;
@@ -10381,6 +10381,41 @@ var init_catalog = __esmMin((() => {
10381
10381
  dataKey: "pane",
10382
10382
  example: "adiff review pane --repo ."
10383
10383
  },
10384
+ {
10385
+ name: "pull show",
10386
+ about: "The pull request opened from a branch: its address, its state, and whether somebody else opened it",
10387
+ group: READ_A_BRANCH,
10388
+ addresses: "review",
10389
+ safety: "read",
10390
+ options: [...addressing],
10391
+ dataKey: "pull",
10392
+ example: "adiff pull show --repo . --branch add-invitations --fields url,theirs"
10393
+ },
10394
+ {
10395
+ name: "base list",
10396
+ about: "The refs worth comparing a branch against: its last few commits, then every other ref",
10397
+ group: READ_A_BRANCH,
10398
+ addresses: "review",
10399
+ safety: "read",
10400
+ options: [...addressing],
10401
+ dataKey: "bases",
10402
+ example: "adiff base list --repo . --branch add-invitations"
10403
+ },
10404
+ {
10405
+ name: "branch search",
10406
+ about: "Search a branch's files, changed files first and declarations before uses",
10407
+ group: READ_A_BRANCH,
10408
+ addresses: "review",
10409
+ safety: "read",
10410
+ options: [...based, {
10411
+ name: "term",
10412
+ required: true,
10413
+ value: "text",
10414
+ about: "What to look for"
10415
+ }],
10416
+ dataKey: "matches",
10417
+ example: "adiff branch search --repo . --branch add-invitations --term sendInvite"
10418
+ },
10384
10419
  {
10385
10420
  name: "patch show",
10386
10421
  about: "A branch's diff as rows with line numbers on both sides, read from the same parse the terminal draws. Binary and generated files are listed and flagged",
@@ -10411,7 +10446,16 @@ var init_catalog = __esmMin((() => {
10411
10446
  group: READ_A_BRANCH,
10412
10447
  addresses: "review",
10413
10448
  safety: "write",
10414
- options: [...based, file],
10449
+ options: [
10450
+ ...based,
10451
+ file,
10452
+ {
10453
+ name: "layer",
10454
+ required: false,
10455
+ value: "number",
10456
+ about: "Mark the file read in this layer only, counting from 1, when more than one layer claims it"
10457
+ }
10458
+ ],
10415
10459
  dataKey: "reviewed",
10416
10460
  example: "adiff file review --worktree . --file src/api.ts"
10417
10461
  },
@@ -10554,6 +10598,16 @@ var init_catalog = __esmMin((() => {
10554
10598
  dataKey: "layers",
10555
10599
  example: "adiff layers show --worktree . --fields layers,uncovered"
10556
10600
  },
10601
+ {
10602
+ name: "layers ask",
10603
+ about: "Ask the agent for a reading order, or a new one, as `L` does in the terminal",
10604
+ group: WRITE_COMMENTS,
10605
+ addresses: "review",
10606
+ safety: "write",
10607
+ options: [...based],
10608
+ dataKey: "asked",
10609
+ example: "adiff layers ask --repo . --branch add-invitations"
10610
+ },
10557
10611
  {
10558
10612
  name: "draft list",
10559
10613
  about: "The comments held for this pull request, in the order they were written",
@@ -10629,7 +10683,7 @@ var init_catalog = __esmMin((() => {
10629
10683
  group: FOLLOW_UP,
10630
10684
  addresses: "review",
10631
10685
  safety: "read",
10632
- options: [...addressing],
10686
+ options: [...based],
10633
10687
  dataKey: "comments",
10634
10688
  example: "adiff comment list --worktree . --fields id,body,settled"
10635
10689
  },
@@ -10727,14 +10781,38 @@ var init_catalog = __esmMin((() => {
10727
10781
  group: FOLLOW_UP,
10728
10782
  addresses: "review",
10729
10783
  safety: "write",
10784
+ options: [
10785
+ ...addressing,
10786
+ {
10787
+ name: "id",
10788
+ required: false,
10789
+ value: "id",
10790
+ about: "The comment to settle. Pass this or --read"
10791
+ },
10792
+ {
10793
+ name: "read",
10794
+ required: false,
10795
+ value: "flag",
10796
+ about: "Settle every comment whose answers have all been read, as `D` does in the terminal"
10797
+ }
10798
+ ],
10799
+ dataKey: "settled",
10800
+ example: "adiff comment resolve --repo . --branch add-invitations --id c1"
10801
+ },
10802
+ {
10803
+ name: "comment read",
10804
+ about: "Mark the answers on a comment read, as reading them in the terminal does",
10805
+ group: FOLLOW_UP,
10806
+ addresses: "review",
10807
+ safety: "write",
10730
10808
  options: [...addressing, {
10731
10809
  name: "id",
10732
10810
  required: true,
10733
10811
  value: "id",
10734
- about: "The comment to settle"
10812
+ about: "The comment whose answers were read"
10735
10813
  }],
10736
- dataKey: "settled",
10737
- example: "adiff comment resolve --repo . --branch add-invitations --id c1"
10814
+ dataKey: "read",
10815
+ example: "adiff comment read --repo . --branch add-invitations --id c1"
10738
10816
  },
10739
10817
  {
10740
10818
  name: "comment remove",
@@ -11086,6 +11164,16 @@ var init_report$1 = __esmMin((() => {
11086
11164
  suggestion: "No layers has been written for this worktree. Write one with `adiff layers set`.",
11087
11165
  retriable: false
11088
11166
  },
11167
+ UnknownLayer: {
11168
+ exit: 3,
11169
+ suggestion: "No layer carries that number. `adiff layers show` lists them, counting from 1.",
11170
+ retriable: false
11171
+ },
11172
+ NoPull: {
11173
+ exit: 3,
11174
+ suggestion: "No pull request is open from this branch. Push it and open one, then ask again.",
11175
+ retriable: false
11176
+ },
11089
11177
  UnknownComment: {
11090
11178
  exit: 3,
11091
11179
  suggestion: "No comment carries that id. `adiff comment take` reports the ids an agent can answer, and `adiff comment list` reports every id on a review.",
@@ -12231,7 +12319,7 @@ var init_paths = __esmMin((() => {
12231
12319
  upgradePath = (root) => join(root, "upgrade.json");
12232
12320
  reportsDir = (root) => join(root, "reports");
12233
12321
  reportPath = (root, stamp) => join(reportsDir(root), `${stamp}.md`);
12234
- })), Store, ensureDir, readOptional, missing$2, damaged, jsonOf$2, decoded, unwritable, wrote, added, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeRemarks, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asRemarks, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, parseRemarks, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, branchKeyIn, wasKeyOf, there, moved, adopt, SPLIT, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, remarksOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$2, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
12322
+ })), Store, ensureDir, readOptional, missing$2, damaged, jsonOf$2, decoded, unwritable, wrote, added$1, INDENT, DRAFTS_VERSION, encoded, writes, appends, writeSettings, writeUpgradeCheck, writeState, writeLayers, writeRemarks, writeDrafts, writeBatch, writeAnswer, asSettings, asUpgradeCheck, asBatch, asAnswer, asState, asLayers, asRemarks, asDrafts, asWatching, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, parseRemarks, idsIn$1, takes, cursorOps, settingsOps, upgradeOps, reportOps, branchKeyIn, wasKeyOf, there, moved, adopt, SPLIT, ADOPT_SIZE, adopting, keyIn, answerOps, layersOps, remarksOps, inboxOps, STATE_LOCK, DRAFTS_LOCK, held$2, stale$1, stolen, taken, freed, alone, watchOps, draftsOps, stateOps, makeStore, madeStore, storeAt;
12235
12323
  var init_service$1 = __esmMin((() => {
12236
12324
  init_dist();
12237
12325
  init_git();
@@ -12279,7 +12367,7 @@ var init_service$1 = __esmMin((() => {
12279
12367
  try: () => writeFile(path, body, "utf8"),
12280
12368
  catch: unwritable(path)
12281
12369
  });
12282
- added = (path, body) => tryPromise({
12370
+ added$1 = (path, body) => tryPromise({
12283
12371
  try: () => appendFile(path, `${body}\n`, "utf8"),
12284
12372
  catch: unwritable(path)
12285
12373
  });
@@ -12295,7 +12383,7 @@ var init_service$1 = __esmMin((() => {
12295
12383
  };
12296
12384
  appends = (schema) => {
12297
12385
  const encode = encoded(schema);
12298
- return (path, value) => flatMap(encode(path, value), (wire) => added(path, JSON.stringify(wire)));
12386
+ return (path, value) => flatMap(encode(path, value), (wire) => added$1(path, JSON.stringify(wire)));
12299
12387
  };
12300
12388
  writeSettings = writes(Settings);
12301
12389
  writeUpgradeCheck = writes(UpgradeCheck, INDENT);
@@ -12676,7 +12764,7 @@ var init_store = __esmMin((() => {
12676
12764
  }));
12677
12765
  //#endregion
12678
12766
  //#region src/review/error.ts
12679
- var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
12767
+ var UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
12680
12768
  var init_error$2 = __esmMin((() => {
12681
12769
  init_dist();
12682
12770
  UnknownBranch = class extends TaggedError("UnknownBranch") {};
@@ -12697,6 +12785,8 @@ var init_error$2 = __esmMin((() => {
12697
12785
  PartlySent = class extends TaggedError("PartlySent") {};
12698
12786
  PullMoved = class extends TaggedError("PullMoved") {};
12699
12787
  NoLayers = class extends TaggedError("NoLayers") {};
12788
+ NoPull = class extends TaggedError("NoPull") {};
12789
+ UnknownLayer = class extends TaggedError("UnknownLayer") {};
12700
12790
  })), realOf, AUTO, askedFor$1, basedOn, named$3, find, basedAt, worktreeAt, patches, reading, waitingOn, summaryOf, summary, list$5, markOpened, lastOpened, repoOf, nameAt, saveReport, refs, forOne, recentBases, setBase, clearBase;
12701
12791
  var init_branches$1 = __esmMin((() => {
12702
12792
  init_dist();
@@ -12921,7 +13011,7 @@ var init_branches$1 = __esmMin((() => {
12921
13011
  }));
12922
13012
  //#endregion
12923
13013
  //#region src/review/patches.ts
12924
- var findPatch, blobOf, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, shownFile, show$2;
13014
+ var findPatch, blobOf, anchor, list$4, source, before, linesAround, GENERATED_NAME, lineOf$2, isNote$1, shownRow, shownHunk, shownFile, show$3;
12925
13015
  var init_patches = __esmMin((() => {
12926
13016
  init_dist();
12927
13017
  init_patch();
@@ -12995,7 +13085,7 @@ var init_patches = __esmMin((() => {
12995
13085
  removed: patch.removed,
12996
13086
  hunks: patch.hunks.map(shownHunk)
12997
13087
  });
12998
- show$2 = fn("Review.Diff.show")(function* (based, showing) {
13088
+ show$3 = fn("Review.Diff.show")(function* (based, showing) {
12999
13089
  const git = yield* Git;
13000
13090
  const { worktree } = based;
13001
13091
  const patches$3 = yield* patches(worktree, linesAround(showing.context), showing.file);
@@ -13507,10 +13597,12 @@ var init_threads$1 = __esmMin((() => {
13507
13597
  end: sits.end,
13508
13598
  snippet: comment.anchor.snippet,
13509
13599
  body: comment.body,
13600
+ at: batch.at,
13510
13601
  state: stateOf$2(turns, mine.at(-1)?.asks === true, settled, Object.hasOwn(conversation.removed, comment.id)),
13511
13602
  stale: batch.head !== conversation.head,
13512
13603
  outside: !conversation.shown.has(comment.anchor.path) || !sits.placed,
13513
13604
  unread: Math.max(0, mine.length - seen),
13605
+ taken: [...ids].some((id) => Object.hasOwn(conversation.taken, id)),
13514
13606
  answers: mine.map(answerOf),
13515
13607
  turns,
13516
13608
  settled
@@ -13542,7 +13634,8 @@ var init_threads$1 = __esmMin((() => {
13542
13634
  head: worktree.head,
13543
13635
  shown: new Set(patches.map((patch) => patch.path)),
13544
13636
  patches,
13545
- read: current.read
13637
+ read: current.read,
13638
+ taken: current.taken ?? {}
13546
13639
  });
13547
13640
  });
13548
13641
  answer$3 = fn("Review.Thread.answer")(function* (worktree, request) {
@@ -13647,7 +13740,7 @@ var init_error$1 = __esmMin((() => {
13647
13740
  }));
13648
13741
  //#endregion
13649
13742
  //#region src/service/forge/service.ts
13650
- var Forge, LIMIT, TIMEOUT_MS, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Author, Row, Viewer, readViewer, decode$1, SAID, stateOf$1, ended, ask, show$1, whoseOf, pullOf, read$2, viewerOf, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$2, head, sideName, commentBody, bodyFor, Landed, readLanded, jsonOf$1, keyOf$2, counted$1, acknowledged, landedIn, THREADS, Said, Thread, Page, Held$1, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, HERE, asked, whereOf, threadsIn, unresolved, PAGES, everyThread, answer$2, remarks, review, ForgeLive;
13743
+ var Forge, LIMIT, TIMEOUT_MS, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS$1, Author, Row, Viewer, readViewer, decode$1, SAID, stateOf$1, ended, ask$1, show$2, whoseOf, pullOf, read$2, viewerOf, pulls, openPull, NUMBER_FIELDS, Named, readNamed, gh, named$2, head, sideName, commentBody, bodyFor, Landed, readLanded, jsonOf$1, keyOf$2, counted$1, acknowledged, landedIn, THREADS, Said, Thread, Page, Held$1, Threads, readThreads, ANONYMOUS, heardFrom$1, someLine, hasNoLine, quotedIn, spanIn, remarkOf, ownerOf, HERE, asked, whereOf, threadsIn, unresolved, PAGES, everyThread, answer$2, remarks, review, address, ForgeLive;
13651
13744
  var init_service = __esmMin((() => {
13652
13745
  init_dist();
13653
13746
  init_error$1();
@@ -13686,7 +13779,7 @@ var init_service = __esmMin((() => {
13686
13779
  }
13687
13780
  };
13688
13781
  ended = (child) => sync(() => void child.kill());
13689
- ask = (repo) => callback$1((resume) => {
13782
+ ask$1 = (repo) => callback$1((resume) => {
13690
13783
  const child = execFile("gh", [
13691
13784
  "pr",
13692
13785
  "list",
@@ -13709,7 +13802,7 @@ var init_service = __esmMin((() => {
13709
13802
  });
13710
13803
  return ended(child);
13711
13804
  });
13712
- show$1 = (repo, branch) => callback$1((resume) => {
13805
+ show$2 = (repo, branch) => callback$1((resume) => {
13713
13806
  const child = execFile("gh", [
13714
13807
  "pr",
13715
13808
  "view",
@@ -13772,11 +13865,11 @@ var init_service = __esmMin((() => {
13772
13865
  }))).login;
13773
13866
  });
13774
13867
  pulls = fn("Forge.pulls")(function* (repo) {
13775
- const [raw, viewer] = yield* all([ask(repo), viewerOf(repo)], { concurrency: 2 });
13868
+ const [raw, viewer] = yield* all([ask$1(repo), viewerOf(repo)], { concurrency: 2 });
13776
13869
  return yield* read$2(repo, raw, viewer);
13777
13870
  });
13778
13871
  openPull = fn("Forge.openPull")(function* (repo, branch) {
13779
- yield* show$1(repo, branch);
13872
+ yield* show$2(repo, branch);
13780
13873
  });
13781
13874
  NUMBER_FIELDS = "number,headRefOid,url";
13782
13875
  Named = Struct({
@@ -14076,9 +14169,17 @@ var init_service = __esmMin((() => {
14076
14169
  url: pull.url
14077
14170
  };
14078
14171
  });
14172
+ address = fn("Forge.address")(function* (repo, branch) {
14173
+ const found = yield* named$2(repo, branch);
14174
+ return {
14175
+ number: found.number,
14176
+ url: found.url
14177
+ };
14178
+ });
14079
14179
  ForgeLive = succeed$2(Forge)({
14080
14180
  pulls,
14081
14181
  openPull,
14182
+ address,
14082
14183
  head,
14083
14184
  review,
14084
14185
  remarks,
@@ -14545,13 +14646,14 @@ var init_preferences = __esmMin((() => {
14545
14646
  }));
14546
14647
  //#endregion
14547
14648
  //#region src/review/layers.ts
14548
- var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, storedLayers, set, show, read, partsOfFile, vouchPart;
14649
+ var STALE_ADVICE, unique, spansOfLayer, tidyPath, spanFault, blockFault, codeBlockOf, tidyBlock, blocksOf, layerFault, layerOf, parsed, readLayers, fromStored, toStored, reportedLayers, reportOf, storedLayers, set, readInLayer, withRead, show$1, read, partsOfFile, vouchPart, ASK_LEAD, askingFor, ask, claims, vouchIn;
14549
14650
  var init_layers = __esmMin((() => {
14550
14651
  init_dist();
14551
14652
  init_layers$1();
14552
14653
  init_store();
14553
14654
  init_review$1();
14554
14655
  init_error$2();
14656
+ init_comments$1();
14555
14657
  init_branches$1();
14556
14658
  init_vouching$1();
14557
14659
  STALE_ADVICE = "These layers describe an older commit. Read the diff again and write a new revision with layers set.";
@@ -14714,14 +14816,37 @@ var init_layers = __esmMin((() => {
14714
14816
  yield* store.saveLayers(worktree.path, toStored(layers));
14715
14817
  return reportOf(patches$1, layers, worktree.head);
14716
14818
  });
14717
- show = fn("Review.Layers.show")(function* (worktree) {
14819
+ readInLayer = (layer, reading) => layer.files.filter((path) => {
14820
+ const blob = reading.patches.find((patch) => patch.path === path)?.blob ?? "";
14821
+ if (isVouched(reading.vouches, path, blob)) return true;
14822
+ const spans = layer.spans.filter((span) => span.path === path);
14823
+ return reading.parts.includes(partOf(path, spans));
14824
+ });
14825
+ withRead = (report, reading) => ({
14826
+ ...report,
14827
+ layers: report.layers.map((layer) => ({
14828
+ ...layer,
14829
+ read: readInLayer(layer, reading)
14830
+ }))
14831
+ });
14832
+ show$1 = fn("Review.Layers.show")(function* (worktree) {
14833
+ const store = yield* Store;
14718
14834
  const patches$2 = yield* patches(worktree);
14719
14835
  const found = yield* storedLayers(worktree);
14720
14836
  const layers = yield* match$3(found, {
14721
14837
  onNone: () => new NoLayers({ worktree: worktree.path }),
14722
14838
  onSome: succeed$1
14723
14839
  });
14724
- return reportOf(patches$2, layers, worktree.head);
14840
+ const current = yield* store.state(worktree.path);
14841
+ const files = patches$2.map((patch) => ({
14842
+ path: patch.path,
14843
+ blob: patch.blob
14844
+ }));
14845
+ return withRead(reportOf(patches$2, layers, worktree.head), {
14846
+ patches: patches$2,
14847
+ vouches: current.vouches,
14848
+ parts: readParts(current.parts, files)
14849
+ });
14725
14850
  });
14726
14851
  read = fn("Review.Layers.read")(function* (reading) {
14727
14852
  const worktree = reading.worktree;
@@ -14762,6 +14887,47 @@ var init_layers = __esmMin((() => {
14762
14887
  total: reading.patches.length
14763
14888
  };
14764
14889
  });
14890
+ ASK_LEAD = "About this branch, not about this line.";
14891
+ askingFor = (told) => {
14892
+ if (told.count === 0) return `${ASK_LEAD} Please write a reading order for it with \`adiff layers set\`, so the diff can be read in the order the change was made rather than by filename.`;
14893
+ if (told.stale) return `${ASK_LEAD} The reading order on it describes an older commit — please read the diff again and write a new one with \`adiff layers set\`.`;
14894
+ return `${ASK_LEAD} Please revise its reading order with \`adiff layers set\`.`;
14895
+ };
14896
+ ask = fn("Review.Layers.ask")(function* (reading, request) {
14897
+ const first = reading.patches[0];
14898
+ if (first === void 0) return yield* new UnknownFile({
14899
+ file: "",
14900
+ known: []
14901
+ });
14902
+ const told = yield* read(reading);
14903
+ const body = askingFor({
14904
+ count: told.layers.length,
14905
+ stale: told.stale
14906
+ });
14907
+ yield* submit(reading.worktree, {
14908
+ file: first.path,
14909
+ side: "new",
14910
+ start: 1,
14911
+ end: 1,
14912
+ body,
14913
+ id: request.id,
14914
+ at: request.at
14915
+ });
14916
+ return { asked: body };
14917
+ });
14918
+ claims = (layer, file) => layer.spans.some((span) => span.path === file);
14919
+ vouchIn = fn("Review.Layers.vouchIn")(function* (reading, file, number) {
14920
+ const held = yield* read(reading);
14921
+ const layer = held.layers[number - 1];
14922
+ if (layer === void 0) return yield* new UnknownLayer({
14923
+ layer: number,
14924
+ known: held.layers.length
14925
+ });
14926
+ const holding = held.layers.filter((one) => claims(one, file)).length;
14927
+ const spans = layer.spans.filter((span) => span.path === file);
14928
+ if (holding < 2 || spans.length === 0) return yield* toggle(reading, file);
14929
+ return yield* vouchPart(reading, file, partOf(file, spans));
14930
+ });
14765
14931
  }));
14766
14932
  //#endregion
14767
14933
  //#region src/review/drafts.ts
@@ -15113,6 +15279,29 @@ var init_search$1 = __esmMin((() => {
15113
15279
  });
15114
15280
  }));
15115
15281
  //#endregion
15282
+ //#region src/review/pulls.ts
15283
+ var show;
15284
+ var init_pulls = __esmMin((() => {
15285
+ init_dist();
15286
+ init_forge();
15287
+ init_error$2();
15288
+ show = fn("Review.Pull.show")(function* (repo, branch) {
15289
+ const forge = yield* Forge;
15290
+ const found = (yield* forge.pulls(repo)).find((pull) => pull.branch === branch);
15291
+ if (found === void 0) return yield* new NoPull({ branch });
15292
+ const where = yield* forge.address(repo, branch);
15293
+ return {
15294
+ branch,
15295
+ number: where.number,
15296
+ url: where.url,
15297
+ state: found.state,
15298
+ draft: found.state === "draft",
15299
+ author: found.author,
15300
+ theirs: found.theirs
15301
+ };
15302
+ });
15303
+ }));
15304
+ //#endregion
15116
15305
  //#region src/review/index.ts
15117
15306
  var init_review = __esmMin((() => {
15118
15307
  init_branches$1();
@@ -15125,6 +15314,7 @@ var init_review = __esmMin((() => {
15125
15314
  init_layers();
15126
15315
  init_drafts$1();
15127
15316
  init_search$1();
15317
+ init_pulls();
15128
15318
  init_error$2();
15129
15319
  }));
15130
15320
  //#endregion
@@ -15261,18 +15451,31 @@ var init_watch = __esmMin((() => {
15261
15451
  }));
15262
15452
  //#endregion
15263
15453
  //#region src/tui/grammars.ts
15264
- var besideThis, css, grammarsAdded;
15454
+ var besideThis, onDisk, embedded, compiled, added, grammarsAdded;
15265
15455
  var init_grammars = __esmMin((() => {
15266
15456
  init_dist();
15267
15457
  besideThis = (path) => fileURLToPath(new URL(`./grammars/${path}`, import.meta.url));
15268
- css = {
15269
- filetype: "css",
15270
- queries: { highlights: [besideThis("css/highlights.scm")] },
15271
- wasm: besideThis("css/tree-sitter-css.wasm")
15458
+ onDisk = sync(() => ({
15459
+ wasm: besideThis("css/tree-sitter-css.wasm"),
15460
+ highlights: besideThis("css/highlights.scm")
15461
+ }));
15462
+ embedded = all({
15463
+ wasm: promise(() => import("./grammars/css/tree-sitter-css.wasm", { with: { type: "file" } })),
15464
+ highlights: promise(() => import("./grammars/css/highlights.scm", { with: { type: "file" } }))
15465
+ }).pipe(map$1((loaded) => ({
15466
+ wasm: loaded.wasm.default,
15467
+ highlights: loaded.highlights.default
15468
+ })));
15469
+ compiled = () => process.versions["bun"] !== void 0;
15470
+ added = (found) => {
15471
+ if (!compiled() && !existsSync(found.wasm)) return;
15472
+ addDefaultParsers([{
15473
+ filetype: "css",
15474
+ queries: { highlights: [found.highlights] },
15475
+ wasm: found.wasm
15476
+ }]);
15272
15477
  };
15273
- grammarsAdded = sync(() => {
15274
- if (existsSync(css.wasm)) addDefaultParsers([css]);
15275
- });
15478
+ grammarsAdded = suspend(() => compiled() ? embedded : onDisk).pipe(map$1(added), catchCause(() => void_));
15276
15479
  }));
15277
15480
  //#endregion
15278
15481
  //#region src/tui/command.ts
@@ -22714,9 +22917,9 @@ var init_branches = __esmMin((() => {
22714
22917
  return gen(function* () {
22715
22918
  const branch = selectedBranch(app.state);
22716
22919
  if (branch === void 0) return;
22717
- const [refs$1, recent] = yield* all([refs(app.repo), recentBases(app.repo, branch.branch)]);
22920
+ const [refs$2, recent] = yield* all([refs(app.repo), recentBases(app.repo, branch.branch)]);
22718
22921
  const said = Object.fromEntries(recent.map((one) => [one.ref, one.said]));
22719
- const kept = refs$1.filter((ref) => ref !== branch.branch);
22922
+ const kept = refs$2.filter((ref) => ref !== branch.branch);
22720
22923
  app.commit(withRefs(app.state, [...recent.map((one) => one.ref), ...kept], said));
22721
22924
  });
22722
22925
  };
@@ -22797,7 +23000,7 @@ var init_branches = __esmMin((() => {
22797
23000
  }));
22798
23001
  //#endregion
22799
23002
  //#region src/tui/comments.ts
22800
- var LAYERS_ASK_LEAD, layersAsk, askedFor, compose, openOther, openPanelEntry, openAway, openThreadInFull, jumpingPastGaps, readRewrite, readAnswers, send, toAgent, sendRedraftAsk, toAuthor, sendReply, sendComment, stillListing, dropHeld, unreadSaid, keptSaid, dispatchDrafts, sendHeld, askForLayers, heldChosen, askAgent, replyHere;
23003
+ var layersAsk$1, askedFor, compose, openOther, openPanelEntry, openAway, openThreadInFull, jumpingPastGaps, readRewrite, readAnswers, send, toAgent, sendRedraftAsk, toAuthor, sendReply, sendComment, stillListing, dropHeld, unreadSaid, keptSaid, dispatchDrafts, sendHeld, askForLayers, heldChosen, askAgent, replyHere;
22801
23004
  var init_comments = __esmMin((() => {
22802
23005
  init_dist();
22803
23006
  init_patch();
@@ -22813,12 +23016,10 @@ var init_comments = __esmMin((() => {
22813
23016
  init_words();
22814
23017
  init_review();
22815
23018
  init_reading();
22816
- LAYERS_ASK_LEAD = "About this branch, not about this line.";
22817
- layersAsk = (state) => {
22818
- if (state.layers.length === 0) return `${LAYERS_ASK_LEAD} Please write a reading order for it with \`adiff layers set\`, so the diff can be read in the order the change was made rather than by filename.`;
22819
- if (state.layersStale) return `${LAYERS_ASK_LEAD} The reading order on it describes an older commit — please read the diff again and write a new one with \`adiff layers set\`.`;
22820
- return `${LAYERS_ASK_LEAD} Please revise its reading order with \`adiff layers set\`.`;
22821
- };
23019
+ layersAsk$1 = (state) => askingFor({
23020
+ count: state.layers.length,
23021
+ stale: state.layersStale
23022
+ });
22822
23023
  askedFor = (state) => state.layers.length === 0 ? "asked for a reading order" : "asked for a new reading order";
22823
23024
  compose = (app) => {
22824
23025
  return gen(function* () {
@@ -23139,7 +23340,7 @@ var init_comments = __esmMin((() => {
23139
23340
  side: "new",
23140
23341
  start: 1,
23141
23342
  end: 1,
23142
- body: layersAsk(app.state),
23343
+ body: layersAsk$1(app.state),
23143
23344
  id: randomUUID(),
23144
23345
  at: (/* @__PURE__ */ new Date()).toISOString()
23145
23346
  });
@@ -24993,9 +25194,51 @@ const commentList = fn("Main.commentList")(function* (options) {
24993
25194
  const comments = yield* list$3(yield* readingIn(options));
24994
25195
  yield* answer(options, { comments });
24995
25196
  });
25197
+ const resolveRead = fn("Main.resolveRead")(function* (options) {
25198
+ const report = yield* settleRead(yield* worktreeIn(options), stamp(options));
25199
+ yield* answer(options, { settled: report.settled });
25200
+ });
25201
+ const commentRead = fn("Main.commentRead")(function* (options) {
25202
+ const report = yield* markRead(yield* worktreeIn(options), yield* required(options, "id"));
25203
+ yield* answer(options, {
25204
+ read: report.id,
25205
+ unread: report.unread
25206
+ });
25207
+ });
25208
+ const pullShow = fn("Main.pullShow")(function* (options) {
25209
+ const pull = yield* show(yield* required(options, "repo"), yield* required(options, "branch"));
25210
+ yield* answer(options, { pull });
25211
+ });
25212
+ const baseList = fn("Main.baseList")(function* (options) {
25213
+ const repo = yield* required(options, "repo");
25214
+ const branch = yield* required(options, "branch");
25215
+ const [refs$1, recent] = yield* all([refs(repo), recentBases(repo, branch)]);
25216
+ const offered = /* @__PURE__ */ new Set([branch, ...recent.map((one) => one.ref)]);
25217
+ const rest = refs$1.filter((ref) => !offered.has(ref));
25218
+ yield* answer(options, { bases: [...recent, ...rest.map((ref) => ({
25219
+ ref,
25220
+ said: ""
25221
+ }))] });
25222
+ });
25223
+ const branchSearch = fn("Main.branchSearch")(function* (options) {
25224
+ const found = yield* files(yield* readingIn(options), yield* required(options, "term"));
25225
+ yield* answer(options, {
25226
+ matches: found.matches,
25227
+ counted: found.counted,
25228
+ left: found.left
25229
+ });
25230
+ });
25231
+ const layersAsk = fn("Main.layersAsk")(function* (options) {
25232
+ const asked = yield* ask(yield* readingIn(options), {
25233
+ id: options["id"] ?? randomUUID(),
25234
+ at: stamp(options)
25235
+ });
25236
+ yield* answer(options, { asked: asked.asked });
25237
+ });
24996
25238
  const commentResolve = fn("Main.commentResolve")(function* (options) {
25239
+ if (options["read"] !== void 0) return yield* resolveRead(options);
24997
25240
  const report = yield* settle(yield* worktreeIn(options), yield* required(options, "id"), stamp(options));
24998
- yield* answer(options, { settled: report.settled });
25241
+ return yield* answer(options, { settled: report.settled });
24999
25242
  });
25000
25243
  const commentRemove = fn("Main.commentRemove")(function* (options) {
25001
25244
  const report = yield* remove(yield* worktreeIn(options), yield* required(options, "id"), stamp(options));
@@ -25009,8 +25252,14 @@ const commentReopen = fn("Main.commentReopen")(function* (options) {
25009
25252
  const report = yield* unsettle(yield* worktreeIn(options), yield* required(options, "id"));
25010
25253
  yield* answer(options, { reopened: report.unsettled });
25011
25254
  });
25255
+ const vouched = fn("Main.vouched")(function* (options) {
25256
+ const reading = yield* readingIn(options);
25257
+ const file = yield* required(options, "file");
25258
+ if (options["layer"] === void 0) return yield* toggle(reading, file);
25259
+ return yield* vouchIn(reading, file, yield* numeric(options, "layer"));
25260
+ });
25012
25261
  const fileReview = fn("Main.fileReview")(function* (options) {
25013
- const report = yield* toggle(yield* readingIn(options), yield* required(options, "file"));
25262
+ const report = yield* vouched(options);
25014
25263
  yield* answer(options, {
25015
25264
  reviewed: report.vouched,
25016
25265
  total: report.total
@@ -25035,12 +25284,12 @@ const layersSet = fn("Main.layersSet")(function* (options) {
25035
25284
  yield* answer(options, { layers });
25036
25285
  });
25037
25286
  const layersShow = fn("Main.layersShow")(function* (options) {
25038
- const layers = yield* show(yield* worktreeNamed(options));
25287
+ const layers = yield* show$1(yield* worktreeNamed(options));
25039
25288
  yield* answer(options, { layers });
25040
25289
  });
25041
25290
  const patchShow = fn("Main.patchShow")(function* (options) {
25042
25291
  const based = yield* basedAt(yield* required(options, "worktree"), options["base"]);
25043
- const patch = yield* show$2(based, {
25292
+ const patch = yield* show$3(based, {
25044
25293
  file: options["file"],
25045
25294
  context: yield* around$1(options, "context")
25046
25295
  });
@@ -25095,6 +25344,11 @@ const routes = {
25095
25344
  "draft drop": draftDrop,
25096
25345
  "draft send": draftSend,
25097
25346
  "comment resolve": commentResolve,
25347
+ "comment read": commentRead,
25348
+ "pull show": pullShow,
25349
+ "base list": baseList,
25350
+ "branch search": branchSearch,
25351
+ "layers ask": layersAsk,
25098
25352
  "comment remove": commentRemove,
25099
25353
  "comment restore": commentRestore,
25100
25354
  "comment reopen": commentReopen,
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.185",
26
+ "version": "0.1.0-alpha.187",
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": {