@eliya-oss/agent-diff 0.1.0-alpha.205 → 0.1.0-alpha.207
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 +62 -0
- package/dist/main.js +564 -163
- package/package.json +1 -1
- package/skills/adiff/SKILL.md +40 -13
package/dist/main.js
CHANGED
|
@@ -4,8 +4,8 @@ import { text } from "node:stream/consumers";
|
|
|
4
4
|
import { execFile, spawn } from "node:child_process";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { existsSync, mkdirSync, watch } from "node:fs";
|
|
7
|
+
import { dirname, join, resolve } from "node:path";
|
|
7
8
|
import { createInterface } from "node:readline";
|
|
8
|
-
import { join, resolve } from "node:path";
|
|
9
9
|
import { promisify } from "node:util";
|
|
10
10
|
import { homedir, hostname, platform } from "node:os";
|
|
11
11
|
import { Language, Parser } from "web-tree-sitter";
|
|
@@ -10114,16 +10114,20 @@ var init_config = __esmMin((() => {
|
|
|
10114
10114
|
//#region package.json
|
|
10115
10115
|
init_pane();
|
|
10116
10116
|
init_config();
|
|
10117
|
-
var version$1 = "0.1.0-alpha.
|
|
10117
|
+
var version$1 = "0.1.0-alpha.207";
|
|
10118
10118
|
//#endregion
|
|
10119
10119
|
//#region src/cli/error.ts
|
|
10120
|
-
var UnknownCommand, MissingOption, UnknownField, UnknownOption, BadOption, RegistryUnanswered, NotServed, BadRequest;
|
|
10120
|
+
var UnknownCommand, MissingOption, UnknownField, UnknownOption, RemovedOption, UnexpectedArgument, SeveralIds, IdGivenTwice, BadOption, RegistryUnanswered, NotServed, BadRequest;
|
|
10121
10121
|
var init_error$6 = __esmMin((() => {
|
|
10122
10122
|
init_dist();
|
|
10123
10123
|
UnknownCommand = class extends TaggedError("UnknownCommand") {};
|
|
10124
10124
|
MissingOption = class extends TaggedError("MissingOption") {};
|
|
10125
10125
|
UnknownField = class extends TaggedError("UnknownField") {};
|
|
10126
10126
|
UnknownOption = class extends TaggedError("UnknownOption") {};
|
|
10127
|
+
RemovedOption = class extends TaggedError("RemovedOption") {};
|
|
10128
|
+
UnexpectedArgument = class extends TaggedError("UnexpectedArgument") {};
|
|
10129
|
+
SeveralIds = class extends TaggedError("SeveralIds") {};
|
|
10130
|
+
IdGivenTwice = class extends TaggedError("IdGivenTwice") {};
|
|
10127
10131
|
BadOption = class extends TaggedError("BadOption") {};
|
|
10128
10132
|
RegistryUnanswered = class extends TaggedError("RegistryUnanswered") {};
|
|
10129
10133
|
NotServed = class extends TaggedError("NotServed") {};
|
|
@@ -10322,14 +10326,15 @@ var init_upgrade$1 = __esmMin((() => {
|
|
|
10322
10326
|
}));
|
|
10323
10327
|
//#endregion
|
|
10324
10328
|
//#region src/cli/catalog.ts
|
|
10325
|
-
var WAIT_MOST, worktreeOf$1, repoOf$1, branchOf, fieldsOption, addressing, baseOf$1, based, repo, opening$2, file, picking, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, DRAFTS, SET_UP, withFields, commands$1, catalog, commandNames, findCommand, VALUED_ANYWHERE, KNOWN_ANYWHERE, valuedIn, knownIn, verbsUnder, groups, MIN_EDITS, distance, CHARS_PER_EDIT, nearestCommand;
|
|
10329
|
+
var WAIT_MOST, DOING_BY_DEFAULT, worktreeOf$1, repoOf$1, branchOf, fieldsOption, addressing, baseOf$1, based, repo, opening$2, file, picking, READ_A_BRANCH, WRITE_COMMENTS, ANSWER_COMMENTS, FOLLOW_UP, DRAFTS, SET_UP, withFields, commands$1, catalog, commandNames, findCommand, VALUED_ANYWHERE, KNOWN_ANYWHERE, valuedIn, RETIRED, ANSWERS_JSON, takesJson, retiredOf, removedIn, retiredIn, renamedIn, renamedFrom, knownIn, takesId, optionsOf, verbsUnder, groups, MIN_EDITS, distance, CHARS_PER_EDIT, SAME_VERB, sameVerb, nearest, nearestCommand, SAME_OPTION, OPTION_EDITS, nearestOption;
|
|
10326
10330
|
var init_catalog = __esmMin((() => {
|
|
10327
10331
|
WAIT_MOST = 86400;
|
|
10332
|
+
DOING_BY_DEFAULT = "Working on it";
|
|
10328
10333
|
worktreeOf$1 = {
|
|
10329
10334
|
name: "worktree",
|
|
10330
10335
|
required: false,
|
|
10331
10336
|
value: "path",
|
|
10332
|
-
about: "The worktree under review. Give this, or --repo with --branch"
|
|
10337
|
+
about: "The worktree under review. Give this, or --repo with --branch, or neither from inside the worktree"
|
|
10333
10338
|
};
|
|
10334
10339
|
repoOf$1 = {
|
|
10335
10340
|
name: "repo",
|
|
@@ -10431,6 +10436,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10431
10436
|
commands$1 = [
|
|
10432
10437
|
{
|
|
10433
10438
|
name: "branch list",
|
|
10439
|
+
audience: "anyone",
|
|
10434
10440
|
about: "Branches with changes against their merge base, and how large each is",
|
|
10435
10441
|
group: READ_A_BRANCH,
|
|
10436
10442
|
addresses: "repo",
|
|
@@ -10441,6 +10447,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10441
10447
|
},
|
|
10442
10448
|
{
|
|
10443
10449
|
name: "review open",
|
|
10450
|
+
audience: "reviewer",
|
|
10444
10451
|
about: "Open the review terminal. With --branch it opens on that branch rather than the worktree list. The only command that does not answer in JSON",
|
|
10445
10452
|
group: READ_A_BRANCH,
|
|
10446
10453
|
addresses: "repo",
|
|
@@ -10455,6 +10462,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10455
10462
|
},
|
|
10456
10463
|
{
|
|
10457
10464
|
name: "review pane",
|
|
10465
|
+
audience: "reviewer",
|
|
10458
10466
|
about: "Open the review beside the conversation, in whichever multiplexer is running. With --branch it opens on that branch. Answers with the command when none is",
|
|
10459
10467
|
group: READ_A_BRANCH,
|
|
10460
10468
|
addresses: "repo",
|
|
@@ -10469,6 +10477,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10469
10477
|
},
|
|
10470
10478
|
{
|
|
10471
10479
|
name: "pull show",
|
|
10480
|
+
audience: "anyone",
|
|
10472
10481
|
about: "The pull request opened from a branch: its address, its state, and whether somebody else opened it",
|
|
10473
10482
|
group: READ_A_BRANCH,
|
|
10474
10483
|
addresses: "review",
|
|
@@ -10479,6 +10488,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10479
10488
|
},
|
|
10480
10489
|
{
|
|
10481
10490
|
name: "base list",
|
|
10491
|
+
audience: "anyone",
|
|
10482
10492
|
about: "The refs worth comparing a branch against: its last few commits, then every other ref",
|
|
10483
10493
|
group: READ_A_BRANCH,
|
|
10484
10494
|
addresses: "review",
|
|
@@ -10489,6 +10499,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10489
10499
|
},
|
|
10490
10500
|
{
|
|
10491
10501
|
name: "branch search",
|
|
10502
|
+
audience: "anyone",
|
|
10492
10503
|
about: "Search a branch's files, changed files first and declarations before uses",
|
|
10493
10504
|
group: READ_A_BRANCH,
|
|
10494
10505
|
addresses: "review",
|
|
@@ -10504,6 +10515,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10504
10515
|
},
|
|
10505
10516
|
{
|
|
10506
10517
|
name: "patch show",
|
|
10518
|
+
audience: "anyone",
|
|
10507
10519
|
about: "A branch's diff as rows with line numbers on both sides, read from the same parse the terminal draws, with the scope each line of a file sits in. Binary and generated files are listed and flagged",
|
|
10508
10520
|
group: READ_A_BRANCH,
|
|
10509
10521
|
addresses: "review",
|
|
@@ -10528,6 +10540,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10528
10540
|
},
|
|
10529
10541
|
{
|
|
10530
10542
|
name: "patch since",
|
|
10543
|
+
audience: "anyone",
|
|
10531
10544
|
about: "One file's diff from the version the reviewer marked reviewed to the file now, in the shape of one file of `patch show`. The old side counts the marked version's lines",
|
|
10532
10545
|
group: READ_A_BRANCH,
|
|
10533
10546
|
addresses: "review",
|
|
@@ -10547,6 +10560,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10547
10560
|
},
|
|
10548
10561
|
{
|
|
10549
10562
|
name: "file review",
|
|
10563
|
+
audience: "reviewer",
|
|
10550
10564
|
about: "Toggle a file as reviewed. Lapses on its own when the file changes",
|
|
10551
10565
|
group: READ_A_BRANCH,
|
|
10552
10566
|
addresses: "review",
|
|
@@ -10572,6 +10586,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10572
10586
|
},
|
|
10573
10587
|
{
|
|
10574
10588
|
name: "base set",
|
|
10589
|
+
audience: "reviewer",
|
|
10575
10590
|
about: "Remember the ref this branch is diffed against, so it is not retyped on every command",
|
|
10576
10591
|
group: READ_A_BRANCH,
|
|
10577
10592
|
addresses: "review",
|
|
@@ -10587,6 +10602,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10587
10602
|
},
|
|
10588
10603
|
{
|
|
10589
10604
|
name: "base clear",
|
|
10605
|
+
audience: "reviewer",
|
|
10590
10606
|
about: "Forget a remembered base, so the branch goes back to using the one it is stacked on",
|
|
10591
10607
|
group: READ_A_BRANCH,
|
|
10592
10608
|
addresses: "review",
|
|
@@ -10597,6 +10613,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10597
10613
|
},
|
|
10598
10614
|
{
|
|
10599
10615
|
name: "review progress",
|
|
10616
|
+
audience: "anyone",
|
|
10600
10617
|
about: "Which files of a review are marked reviewed, which changed since they were marked and by how much, and how many files there are",
|
|
10601
10618
|
group: READ_A_BRANCH,
|
|
10602
10619
|
addresses: "review",
|
|
@@ -10607,6 +10624,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10607
10624
|
},
|
|
10608
10625
|
{
|
|
10609
10626
|
name: "comment send",
|
|
10627
|
+
audience: "reviewer",
|
|
10610
10628
|
about: "Send one comment against a line range, straight to the agent. Name the range with --start and --end, or with the rows a reader picked, --from and --to",
|
|
10611
10629
|
group: WRITE_COMMENTS,
|
|
10612
10630
|
addresses: "review",
|
|
@@ -10617,6 +10635,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10617
10635
|
},
|
|
10618
10636
|
{
|
|
10619
10637
|
name: "comment reply",
|
|
10638
|
+
audience: "reviewer",
|
|
10620
10639
|
about: "Write back to a comment already sent, continuing its thread",
|
|
10621
10640
|
group: WRITE_COMMENTS,
|
|
10622
10641
|
addresses: "review",
|
|
@@ -10641,30 +10660,23 @@ var init_catalog = __esmMin((() => {
|
|
|
10641
10660
|
},
|
|
10642
10661
|
{
|
|
10643
10662
|
name: "comment take",
|
|
10663
|
+
audience: "agent",
|
|
10644
10664
|
about: "Collect the comments this review is still owed an answer on. Repeats until answered",
|
|
10645
10665
|
group: ANSWER_COMMENTS,
|
|
10646
10666
|
addresses: "review",
|
|
10647
10667
|
safety: "read",
|
|
10648
|
-
options: [
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
about: `Block until a comment arrives or the timeout elapses. A whole number of seconds from 1 to ${WAIT_MOST}; anything else is refused`
|
|
10655
|
-
},
|
|
10656
|
-
{
|
|
10657
|
-
name: "new",
|
|
10658
|
-
required: false,
|
|
10659
|
-
value: "flag",
|
|
10660
|
-
about: "Hand over only comments this review has not handed over before, so a wait ends on something new"
|
|
10661
|
-
}
|
|
10662
|
-
],
|
|
10668
|
+
options: [...addressing, {
|
|
10669
|
+
name: "wait",
|
|
10670
|
+
required: false,
|
|
10671
|
+
value: "seconds",
|
|
10672
|
+
about: `Block until a comment this review has not handed over before arrives, or the timeout elapses. One wait listens per worktree: a newer wait ends this one, which then answers with replaced. A whole number of seconds from 1 to ${WAIT_MOST}; anything else is refused`
|
|
10673
|
+
}],
|
|
10663
10674
|
dataKey: "comments",
|
|
10664
|
-
example: "adiff comment take --worktree . --
|
|
10675
|
+
example: "adiff comment take --worktree . --wait 6900"
|
|
10665
10676
|
},
|
|
10666
10677
|
{
|
|
10667
10678
|
name: "comment answer",
|
|
10679
|
+
audience: "agent",
|
|
10668
10680
|
about: "Say what was done about a comment, or ask the reviewer something back",
|
|
10669
10681
|
group: ANSWER_COMMENTS,
|
|
10670
10682
|
addresses: "review",
|
|
@@ -10701,6 +10713,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10701
10713
|
},
|
|
10702
10714
|
{
|
|
10703
10715
|
name: "comment doing",
|
|
10716
|
+
audience: "agent",
|
|
10704
10717
|
about: "Say in one line what you are doing on a comment you took. Replaces the last line; an answer clears it",
|
|
10705
10718
|
group: ANSWER_COMMENTS,
|
|
10706
10719
|
addresses: "review",
|
|
@@ -10715,31 +10728,33 @@ var init_catalog = __esmMin((() => {
|
|
|
10715
10728
|
},
|
|
10716
10729
|
{
|
|
10717
10730
|
name: "body",
|
|
10718
|
-
required:
|
|
10731
|
+
required: false,
|
|
10719
10732
|
value: "text",
|
|
10720
|
-
about:
|
|
10733
|
+
about: `One short line, such as Editing driver.ts. Without it the line reads ${DOING_BY_DEFAULT}`
|
|
10721
10734
|
}
|
|
10722
10735
|
],
|
|
10723
10736
|
dataKey: "doing",
|
|
10724
|
-
example: "adiff comment doing
|
|
10737
|
+
example: "adiff comment doing c1 --body \"Editing driver.ts\""
|
|
10725
10738
|
},
|
|
10726
10739
|
{
|
|
10727
10740
|
name: "layers set",
|
|
10741
|
+
audience: "agent",
|
|
10728
10742
|
about: "Write the reading order for this review's diff: ordered layers over spans of files",
|
|
10729
10743
|
group: ANSWER_COMMENTS,
|
|
10730
10744
|
addresses: "review",
|
|
10731
10745
|
safety: "write",
|
|
10732
10746
|
options: [...based, {
|
|
10733
|
-
name: "
|
|
10747
|
+
name: "file",
|
|
10734
10748
|
required: true,
|
|
10735
|
-
value: "
|
|
10749
|
+
value: "path|-",
|
|
10736
10750
|
about: "The document, as a file path or - to read stdin: {\"summary\":\"…\",\"layers\":[{\"title\":\"…\",\"note\":\"…\",\"spans\":[{\"path\":\"…\",\"start\":1,\"end\":9}]}]}. A layer may carry blocks instead of spans, interleaving {\"kind\":\"prose\",\"markdown\":\"…\"} with {\"kind\":\"code\",\"path\":\"…\",\"start\":1,\"end\":9}"
|
|
10737
10751
|
}],
|
|
10738
10752
|
dataKey: "layers",
|
|
10739
|
-
example: "adiff layers set --
|
|
10753
|
+
example: "adiff layers set --file -"
|
|
10740
10754
|
},
|
|
10741
10755
|
{
|
|
10742
10756
|
name: "layers show",
|
|
10757
|
+
audience: "anyone",
|
|
10743
10758
|
about: "The layers of a review, with the hunks no layer claims",
|
|
10744
10759
|
group: ANSWER_COMMENTS,
|
|
10745
10760
|
addresses: "review",
|
|
@@ -10750,6 +10765,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10750
10765
|
},
|
|
10751
10766
|
{
|
|
10752
10767
|
name: "layers ask",
|
|
10768
|
+
audience: "reviewer",
|
|
10753
10769
|
about: "Ask the agent for a reading order, or a new one, as `L` does in the terminal",
|
|
10754
10770
|
group: WRITE_COMMENTS,
|
|
10755
10771
|
addresses: "review",
|
|
@@ -10760,6 +10776,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10760
10776
|
},
|
|
10761
10777
|
{
|
|
10762
10778
|
name: "draft list",
|
|
10779
|
+
audience: "anyone",
|
|
10763
10780
|
about: "The comments held for this pull request, in the order they were written",
|
|
10764
10781
|
group: DRAFTS,
|
|
10765
10782
|
addresses: "review",
|
|
@@ -10770,6 +10787,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10770
10787
|
},
|
|
10771
10788
|
{
|
|
10772
10789
|
name: "draft add",
|
|
10790
|
+
audience: "anyone",
|
|
10773
10791
|
about: "Hold one comment against a line range, to be sent with the rest. Name the range with --start and --end, or with the rows a reader picked, --from and --to",
|
|
10774
10792
|
group: DRAFTS,
|
|
10775
10793
|
addresses: "review",
|
|
@@ -10780,6 +10798,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10780
10798
|
},
|
|
10781
10799
|
{
|
|
10782
10800
|
name: "draft edit",
|
|
10801
|
+
audience: "anyone",
|
|
10783
10802
|
about: "Rewrite a held comment before it is sent",
|
|
10784
10803
|
group: DRAFTS,
|
|
10785
10804
|
addresses: "review",
|
|
@@ -10804,6 +10823,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10804
10823
|
},
|
|
10805
10824
|
{
|
|
10806
10825
|
name: "draft drop",
|
|
10826
|
+
audience: "anyone",
|
|
10807
10827
|
about: "Throw away a held comment rather than sending it",
|
|
10808
10828
|
group: DRAFTS,
|
|
10809
10829
|
addresses: "review",
|
|
@@ -10819,6 +10839,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10819
10839
|
},
|
|
10820
10840
|
{
|
|
10821
10841
|
name: "draft send",
|
|
10842
|
+
audience: "reviewer",
|
|
10822
10843
|
about: "Send every held comment to the pull request, as one review",
|
|
10823
10844
|
group: DRAFTS,
|
|
10824
10845
|
addresses: "review",
|
|
@@ -10829,6 +10850,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10829
10850
|
},
|
|
10830
10851
|
{
|
|
10831
10852
|
name: "comment list",
|
|
10853
|
+
audience: "anyone",
|
|
10832
10854
|
about: "Every comment on a review, with its answers and whether it is settled",
|
|
10833
10855
|
group: FOLLOW_UP,
|
|
10834
10856
|
addresses: "review",
|
|
@@ -10839,6 +10861,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10839
10861
|
},
|
|
10840
10862
|
{
|
|
10841
10863
|
name: "remark list",
|
|
10864
|
+
audience: "anyone",
|
|
10842
10865
|
about: "Every remark on the branch's pull request, with who left it and whether it is triaged",
|
|
10843
10866
|
group: FOLLOW_UP,
|
|
10844
10867
|
addresses: "review",
|
|
@@ -10849,6 +10872,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10849
10872
|
},
|
|
10850
10873
|
{
|
|
10851
10874
|
name: "remark accept",
|
|
10875
|
+
audience: "reviewer",
|
|
10852
10876
|
about: "Take a remark on as your own comment, so the agent picks it up",
|
|
10853
10877
|
group: FOLLOW_UP,
|
|
10854
10878
|
addresses: "review",
|
|
@@ -10873,6 +10897,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10873
10897
|
},
|
|
10874
10898
|
{
|
|
10875
10899
|
name: "remark reply",
|
|
10900
|
+
audience: "reviewer",
|
|
10876
10901
|
about: "Answer a remark in its thread on the pull request",
|
|
10877
10902
|
group: FOLLOW_UP,
|
|
10878
10903
|
addresses: "review",
|
|
@@ -10897,6 +10922,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10897
10922
|
},
|
|
10898
10923
|
{
|
|
10899
10924
|
name: "remark dismiss",
|
|
10925
|
+
audience: "reviewer",
|
|
10900
10926
|
about: "Take a remark out of this review. It stays on the pull request",
|
|
10901
10927
|
group: FOLLOW_UP,
|
|
10902
10928
|
addresses: "review",
|
|
@@ -10912,6 +10938,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10912
10938
|
},
|
|
10913
10939
|
{
|
|
10914
10940
|
name: "remark restore",
|
|
10941
|
+
audience: "reviewer",
|
|
10915
10942
|
about: "Put a dismissed remark back into this review",
|
|
10916
10943
|
group: FOLLOW_UP,
|
|
10917
10944
|
addresses: "review",
|
|
@@ -10927,6 +10954,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10927
10954
|
},
|
|
10928
10955
|
{
|
|
10929
10956
|
name: "comment resolve",
|
|
10957
|
+
audience: "reviewer",
|
|
10930
10958
|
about: "Mark a comment settled. Only the reviewer who raised it can",
|
|
10931
10959
|
group: FOLLOW_UP,
|
|
10932
10960
|
addresses: "review",
|
|
@@ -10951,6 +10979,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10951
10979
|
},
|
|
10952
10980
|
{
|
|
10953
10981
|
name: "comment read",
|
|
10982
|
+
audience: "reviewer",
|
|
10954
10983
|
about: "Mark the answers on a comment read, as reading them in the terminal does",
|
|
10955
10984
|
group: FOLLOW_UP,
|
|
10956
10985
|
addresses: "review",
|
|
@@ -10966,6 +10995,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10966
10995
|
},
|
|
10967
10996
|
{
|
|
10968
10997
|
name: "comment remove",
|
|
10998
|
+
audience: "reviewer",
|
|
10969
10999
|
about: "Take a comment out of the review, leaving what was already delivered on the record",
|
|
10970
11000
|
group: FOLLOW_UP,
|
|
10971
11001
|
addresses: "review",
|
|
@@ -10981,6 +11011,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10981
11011
|
},
|
|
10982
11012
|
{
|
|
10983
11013
|
name: "comment restore",
|
|
11014
|
+
audience: "reviewer",
|
|
10984
11015
|
about: "Put a removed comment back into the review",
|
|
10985
11016
|
group: FOLLOW_UP,
|
|
10986
11017
|
addresses: "review",
|
|
@@ -10996,6 +11027,7 @@ var init_catalog = __esmMin((() => {
|
|
|
10996
11027
|
},
|
|
10997
11028
|
{
|
|
10998
11029
|
name: "comment reopen",
|
|
11030
|
+
audience: "reviewer",
|
|
10999
11031
|
about: "Take a settled comment back into the review, so the agent is owed an answer again",
|
|
11000
11032
|
group: FOLLOW_UP,
|
|
11001
11033
|
addresses: "review",
|
|
@@ -11011,6 +11043,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11011
11043
|
},
|
|
11012
11044
|
{
|
|
11013
11045
|
name: "config list",
|
|
11046
|
+
audience: "anyone",
|
|
11014
11047
|
about: "Every preference adiff keeps, with its value and what it does",
|
|
11015
11048
|
group: SET_UP,
|
|
11016
11049
|
addresses: "none",
|
|
@@ -11021,6 +11054,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11021
11054
|
},
|
|
11022
11055
|
{
|
|
11023
11056
|
name: "config get",
|
|
11057
|
+
audience: "anyone",
|
|
11024
11058
|
about: "What one preference is set to",
|
|
11025
11059
|
group: SET_UP,
|
|
11026
11060
|
addresses: "none",
|
|
@@ -11036,6 +11070,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11036
11070
|
},
|
|
11037
11071
|
{
|
|
11038
11072
|
name: "config set",
|
|
11073
|
+
audience: "reviewer",
|
|
11039
11074
|
about: "Turn one preference on or off, for every repository on this machine",
|
|
11040
11075
|
group: SET_UP,
|
|
11041
11076
|
addresses: "none",
|
|
@@ -11056,6 +11091,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11056
11091
|
},
|
|
11057
11092
|
{
|
|
11058
11093
|
name: "upgrade",
|
|
11094
|
+
audience: "reviewer",
|
|
11059
11095
|
about: "Upgrade this install to the newest build, using whatever installed it. Answers a person in plain text, and a caller in JSON with --json",
|
|
11060
11096
|
group: SET_UP,
|
|
11061
11097
|
addresses: "none",
|
|
@@ -11069,13 +11105,14 @@ var init_catalog = __esmMin((() => {
|
|
|
11069
11105
|
name: "json",
|
|
11070
11106
|
required: false,
|
|
11071
11107
|
value: "flag",
|
|
11072
|
-
about: "Answer with the usual envelope instead of plain text. This is the only command that
|
|
11108
|
+
about: "Answer with the usual envelope instead of plain text. This is the only command that takes it"
|
|
11073
11109
|
}],
|
|
11074
11110
|
dataKey: "upgrade",
|
|
11075
11111
|
example: "adiff upgrade --check --json --fields route,latest,current"
|
|
11076
11112
|
},
|
|
11077
11113
|
{
|
|
11078
11114
|
name: "serve",
|
|
11115
|
+
audience: "anyone",
|
|
11079
11116
|
about: "Answer commands one JSON line at a time on stdin and stdout, and report changes to the reviews a client watches. For a program that asks adiff often, such as a review page",
|
|
11080
11117
|
group: SET_UP,
|
|
11081
11118
|
addresses: "repo",
|
|
@@ -11086,6 +11123,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11086
11123
|
},
|
|
11087
11124
|
{
|
|
11088
11125
|
name: "resume",
|
|
11126
|
+
audience: "reviewer",
|
|
11089
11127
|
about: "Open the review you left last in this repository. Opens the terminal, like `review open`, on the branch it was opened on most recently",
|
|
11090
11128
|
group: SET_UP,
|
|
11091
11129
|
addresses: "none",
|
|
@@ -11106,6 +11144,7 @@ var init_catalog = __esmMin((() => {
|
|
|
11106
11144
|
},
|
|
11107
11145
|
{
|
|
11108
11146
|
name: "describe",
|
|
11147
|
+
audience: "anyone",
|
|
11109
11148
|
about: "This catalog, as JSON",
|
|
11110
11149
|
group: SET_UP,
|
|
11111
11150
|
addresses: "none",
|
|
@@ -11131,12 +11170,51 @@ var init_catalog = __esmMin((() => {
|
|
|
11131
11170
|
KNOWN_ANYWHERE = [
|
|
11132
11171
|
...VALUED_ANYWHERE,
|
|
11133
11172
|
"help",
|
|
11134
|
-
"json",
|
|
11135
11173
|
"run",
|
|
11136
11174
|
"quiet"
|
|
11137
11175
|
];
|
|
11138
|
-
valuedIn = (name) => /* @__PURE__ */ new Set([
|
|
11176
|
+
valuedIn = (name) => /* @__PURE__ */ new Set([
|
|
11177
|
+
...VALUED_ANYWHERE,
|
|
11178
|
+
...renamedFrom(name),
|
|
11179
|
+
...(findCommand(name)?.options ?? []).filter((option) => option.value !== "flag").map((option) => option.name)
|
|
11180
|
+
]);
|
|
11181
|
+
RETIRED = {
|
|
11182
|
+
"comment take": { new: {
|
|
11183
|
+
reason: "A take with no --wait hands over every comment still owed an answer. To hand over only new comments, give --wait: every wait does that now.",
|
|
11184
|
+
meantWith: "wait"
|
|
11185
|
+
} },
|
|
11186
|
+
"layers set": { json: {
|
|
11187
|
+
reason: "layers set reads its document from --file: give --file <path>, or --file - to read stdin.",
|
|
11188
|
+
meantWith: "file",
|
|
11189
|
+
renamedTo: "file"
|
|
11190
|
+
} }
|
|
11191
|
+
};
|
|
11192
|
+
ANSWERS_JSON = {
|
|
11193
|
+
reason: "This command answers in JSON with or without --json. Run it again without --json.",
|
|
11194
|
+
meantWith: ""
|
|
11195
|
+
};
|
|
11196
|
+
takesJson = (name) => (findCommand(name)?.options ?? []).some((option) => option.name === "json");
|
|
11197
|
+
retiredOf = (name) => ({
|
|
11198
|
+
...takesJson(name) ? {} : { json: ANSWERS_JSON },
|
|
11199
|
+
...RETIRED[name]
|
|
11200
|
+
});
|
|
11201
|
+
removedIn = (name, given) => {
|
|
11202
|
+
const retired = retiredOf(name);
|
|
11203
|
+
const option = given.find((one) => Object.hasOwn(retired, one) && retired[one]?.renamedTo === void 0 && !given.includes(retired[one]?.meantWith ?? ""));
|
|
11204
|
+
return option === void 0 ? void 0 : {
|
|
11205
|
+
option,
|
|
11206
|
+
reason: retired[option]?.reason ?? ""
|
|
11207
|
+
};
|
|
11208
|
+
};
|
|
11209
|
+
retiredIn = (name, given) => given.filter((one) => Object.hasOwn(retiredOf(name), one));
|
|
11210
|
+
renamedIn = (name, given) => Object.fromEntries(given.flatMap((one) => {
|
|
11211
|
+
const to = retiredOf(name)[one]?.renamedTo;
|
|
11212
|
+
return to === void 0 || given.includes(to) ? [] : [[one, to]];
|
|
11213
|
+
}));
|
|
11214
|
+
renamedFrom = (name) => Object.entries(RETIRED[name] ?? {}).filter(([, retired]) => retired.renamedTo !== void 0).map(([old]) => old);
|
|
11139
11215
|
knownIn = (name) => /* @__PURE__ */ new Set([...KNOWN_ANYWHERE, ...(findCommand(name)?.options ?? []).map((option) => option.name)]);
|
|
11216
|
+
takesId = (command) => command.options.some((option) => option.name === "id");
|
|
11217
|
+
optionsOf = (command) => [...command.options.map((option) => option.name), "help"];
|
|
11140
11218
|
verbsUnder = (noun) => commandNames.filter((name) => name.startsWith(`${noun} `));
|
|
11141
11219
|
groups = [...new Set(catalog.map((command) => command.group))];
|
|
11142
11220
|
MIN_EDITS = 3;
|
|
@@ -11155,21 +11233,48 @@ var init_catalog = __esmMin((() => {
|
|
|
11155
11233
|
return previous[right.length] ?? 0;
|
|
11156
11234
|
};
|
|
11157
11235
|
CHARS_PER_EDIT = 3;
|
|
11236
|
+
SAME_VERB = {
|
|
11237
|
+
get: ["show", "list"],
|
|
11238
|
+
view: ["show", "list"],
|
|
11239
|
+
ls: ["list"],
|
|
11240
|
+
delete: ["remove", "drop"],
|
|
11241
|
+
rm: ["remove", "drop"]
|
|
11242
|
+
};
|
|
11243
|
+
sameVerb = (name, under) => {
|
|
11244
|
+
const [noun = "", verb = ""] = name.split(" ");
|
|
11245
|
+
return (SAME_VERB[verb] ?? []).map((same) => `${noun} ${same}`).find((known) => under.includes(known));
|
|
11246
|
+
};
|
|
11247
|
+
nearest = (given, candidates, room) => {
|
|
11248
|
+
const scored = candidates.map((known) => ({
|
|
11249
|
+
known,
|
|
11250
|
+
gap: distance(given, known)
|
|
11251
|
+
})).toSorted((left, right) => left.gap - right.gap)[0];
|
|
11252
|
+
return scored !== void 0 && scored.gap <= room ? scored.known : void 0;
|
|
11253
|
+
};
|
|
11158
11254
|
nearestCommand = (name) => {
|
|
11159
11255
|
const noun = name.split(" ")[0] ?? "";
|
|
11160
11256
|
const under = verbsUnder(noun);
|
|
11161
11257
|
const candidates = under.length === 0 ? commandNames : under;
|
|
11162
11258
|
const room = Math.max(MIN_EDITS, Math.floor(name.length / CHARS_PER_EDIT));
|
|
11163
|
-
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11259
|
+
return sameVerb(name, under) ?? nearest(name, candidates, room);
|
|
11260
|
+
};
|
|
11261
|
+
SAME_OPTION = {
|
|
11262
|
+
comment: ["id"],
|
|
11263
|
+
"comment-id": ["id"],
|
|
11264
|
+
thread: ["id"],
|
|
11265
|
+
message: ["body"],
|
|
11266
|
+
text: ["body"],
|
|
11267
|
+
path: ["file", "worktree"]
|
|
11268
|
+
};
|
|
11269
|
+
OPTION_EDITS = 2;
|
|
11270
|
+
nearestOption = (command, given) => {
|
|
11271
|
+
const taken = command.options.map((option) => option.name);
|
|
11272
|
+
return (SAME_OPTION[given] ?? []).find((known) => taken.includes(known)) ?? nearest(given, taken, Math.min(OPTION_EDITS, Math.floor(given.length / 2)));
|
|
11168
11273
|
};
|
|
11169
11274
|
}));
|
|
11170
11275
|
//#endregion
|
|
11171
11276
|
//#region src/cli/parse.ts
|
|
11172
|
-
var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, optionsFrom, onlyKnown, oneOf, required, STDIN, text$1, numeric, SPOT, spot, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
|
|
11277
|
+
var FLAG, REPEATED, MANY, withValue, flagOn, tokenOn, takenFrom, optionsFrom, bareIn, onlyKnown, oneOf, required, STDIN, text$1, numeric, SPOT, spot, WHOLE, around$1, seconds, many, CHOICES_FEWEST, CHOICES_MOST, choices, oneLine;
|
|
11173
11278
|
var init_parse$1 = __esmMin((() => {
|
|
11174
11279
|
init_dist();
|
|
11175
11280
|
init_catalog();
|
|
@@ -11190,39 +11295,46 @@ var init_parse$1 = __esmMin((() => {
|
|
|
11190
11295
|
};
|
|
11191
11296
|
flagOn = (taken, token, valued) => {
|
|
11192
11297
|
const found = FLAG.exec(token)?.groups;
|
|
11193
|
-
if (found === void 0) return
|
|
11298
|
+
if (found === void 0) return {
|
|
11299
|
+
...taken,
|
|
11300
|
+
bare: [...taken.bare, token]
|
|
11301
|
+
};
|
|
11194
11302
|
const name = found["name"] ?? "";
|
|
11195
11303
|
const value = found["value"];
|
|
11196
11304
|
if (value !== void 0) return {
|
|
11197
|
-
|
|
11198
|
-
|
|
11305
|
+
...taken,
|
|
11306
|
+
options: withValue(taken.options, name, value)
|
|
11199
11307
|
};
|
|
11200
11308
|
if (valued.has(name)) return {
|
|
11201
|
-
|
|
11309
|
+
...taken,
|
|
11202
11310
|
held: name
|
|
11203
11311
|
};
|
|
11204
11312
|
return {
|
|
11313
|
+
...taken,
|
|
11205
11314
|
options: {
|
|
11206
11315
|
...taken.options,
|
|
11207
11316
|
[name]: "true"
|
|
11208
|
-
}
|
|
11209
|
-
held: void 0
|
|
11317
|
+
}
|
|
11210
11318
|
};
|
|
11211
11319
|
};
|
|
11212
11320
|
tokenOn = (taken, token, valued) => taken.held === void 0 ? flagOn(taken, token, valued) : {
|
|
11321
|
+
...taken,
|
|
11213
11322
|
options: withValue(taken.options, taken.held, token),
|
|
11214
11323
|
held: void 0
|
|
11215
11324
|
};
|
|
11325
|
+
takenFrom = (argv, valued) => argv.reduce((held, token) => tokenOn(held, token, valued), {
|
|
11326
|
+
options: {},
|
|
11327
|
+
held: void 0,
|
|
11328
|
+
bare: []
|
|
11329
|
+
});
|
|
11216
11330
|
optionsFrom = (argv, valued = /* @__PURE__ */ new Set()) => {
|
|
11217
|
-
const taken = argv
|
|
11218
|
-
options: {},
|
|
11219
|
-
held: void 0
|
|
11220
|
-
});
|
|
11331
|
+
const taken = takenFrom(argv, valued);
|
|
11221
11332
|
return taken.held === void 0 ? taken.options : {
|
|
11222
11333
|
...taken.options,
|
|
11223
11334
|
[taken.held]: ""
|
|
11224
11335
|
};
|
|
11225
11336
|
};
|
|
11337
|
+
bareIn = (argv, valued = /* @__PURE__ */ new Set()) => takenFrom(argv, valued).bare;
|
|
11226
11338
|
onlyKnown = (options, known) => {
|
|
11227
11339
|
const strange = Object.keys(options).find((name) => !known.has(name));
|
|
11228
11340
|
return strange === void 0 ? succeed$1(options) : fail(new UnknownOption({
|
|
@@ -11325,7 +11437,7 @@ var init_parse$1 = __esmMin((() => {
|
|
|
11325
11437
|
allowed: ["one line of text, not empty"]
|
|
11326
11438
|
});
|
|
11327
11439
|
});
|
|
11328
|
-
})), ADVICE, FALLBACK, tagOf, project, fieldsOf, narrow, keysIn, strangeField, sharpen, failure;
|
|
11440
|
+
})), ADVICE, FALLBACK, tagOf, project, fieldsOf, OK, beyondOk, onlyOk, narrow, keysIn, strangeField, wordIn, unknownCommand, unknownOption, naming, SHARPER, sharpen, failure;
|
|
11329
11441
|
var init_report$1 = __esmMin((() => {
|
|
11330
11442
|
ADVICE = {
|
|
11331
11443
|
UnknownCommand: {
|
|
@@ -11365,7 +11477,7 @@ var init_report$1 = __esmMin((() => {
|
|
|
11365
11477
|
},
|
|
11366
11478
|
UnknownWorktree: {
|
|
11367
11479
|
exit: 3,
|
|
11368
|
-
suggestion: "--worktree takes the path of a worktree of the repository under review. The error lists the ones that exist; pass one of those, or run the command from inside
|
|
11480
|
+
suggestion: "--worktree takes the path of a worktree of the repository under review. The error lists the ones that exist; pass one of those, or run the command from inside the worktree with no --worktree.",
|
|
11369
11481
|
retriable: false
|
|
11370
11482
|
},
|
|
11371
11483
|
MalformedLayers: {
|
|
@@ -11433,6 +11545,31 @@ var init_report$1 = __esmMin((() => {
|
|
|
11433
11545
|
suggestion: "That option is not one this command takes. `adiff <command> --help` lists the options it does.",
|
|
11434
11546
|
retriable: false
|
|
11435
11547
|
},
|
|
11548
|
+
RemovedOption: {
|
|
11549
|
+
exit: 2,
|
|
11550
|
+
suggestion: "This command no longer takes that option. Run it again without the option; the reason is named above.",
|
|
11551
|
+
retriable: false
|
|
11552
|
+
},
|
|
11553
|
+
UnexpectedArgument: {
|
|
11554
|
+
exit: 2,
|
|
11555
|
+
suggestion: "This command takes options only, each written as --name. Run `adiff <command> --help` for the ones it takes.",
|
|
11556
|
+
retriable: false
|
|
11557
|
+
},
|
|
11558
|
+
SeveralIds: {
|
|
11559
|
+
exit: 2,
|
|
11560
|
+
suggestion: "This command takes one id. Run it once for each id.",
|
|
11561
|
+
retriable: false
|
|
11562
|
+
},
|
|
11563
|
+
IdGivenTwice: {
|
|
11564
|
+
exit: 2,
|
|
11565
|
+
suggestion: "The id was given twice, once bare and once with --id. Give it one way.",
|
|
11566
|
+
retriable: false
|
|
11567
|
+
},
|
|
11568
|
+
AmbiguousId: {
|
|
11569
|
+
exit: 2,
|
|
11570
|
+
suggestion: "Several ids start that way. They are listed under matches; give enough of one to tell it apart.",
|
|
11571
|
+
retriable: false
|
|
11572
|
+
},
|
|
11436
11573
|
BadOption: {
|
|
11437
11574
|
exit: 2,
|
|
11438
11575
|
suggestion: "That value is not one the option allows. The allowed ones are named above.",
|
|
@@ -11525,7 +11662,10 @@ var init_report$1 = __esmMin((() => {
|
|
|
11525
11662
|
const raw = options["fields"];
|
|
11526
11663
|
return raw === void 0 || raw === "true" ? [] : raw.split(",").map((field) => field.trim());
|
|
11527
11664
|
};
|
|
11528
|
-
|
|
11665
|
+
OK = "ok";
|
|
11666
|
+
beyondOk = (fields) => fields.filter((field) => field !== OK);
|
|
11667
|
+
onlyOk = (fields) => fields.length > 0 && beyondOk(fields).length === 0;
|
|
11668
|
+
narrow = (value, fields) => fields.length === 0 ? value : project(value, beyondOk(fields));
|
|
11529
11669
|
keysIn = (value) => {
|
|
11530
11670
|
if (Array.isArray(value)) return value.flatMap((one) => keysIn(one));
|
|
11531
11671
|
if (typeof value !== "object" || value === null) return [];
|
|
@@ -11535,21 +11675,40 @@ var init_report$1 = __esmMin((() => {
|
|
|
11535
11675
|
if (fields.length === 0) return void 0;
|
|
11536
11676
|
const known = [...new Set(Object.values(body).flatMap((value) => keysIn(value)))];
|
|
11537
11677
|
if (known.length === 0) return void 0;
|
|
11538
|
-
const field = fields.find((one) => !known.includes(one));
|
|
11678
|
+
const field = beyondOk(fields).find((one) => !known.includes(one));
|
|
11539
11679
|
return field === void 0 ? void 0 : {
|
|
11540
11680
|
field,
|
|
11541
11681
|
known: known.toSorted()
|
|
11542
11682
|
};
|
|
11543
11683
|
};
|
|
11544
|
-
|
|
11545
|
-
const
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
return
|
|
11684
|
+
wordIn = (detail, key) => {
|
|
11685
|
+
const found = detail[key];
|
|
11686
|
+
return typeof found === "string" ? found : void 0;
|
|
11687
|
+
};
|
|
11688
|
+
unknownCommand = (detail) => {
|
|
11689
|
+
const meant = wordIn(detail, "didYouMean");
|
|
11690
|
+
const named = wordIn(detail, "name");
|
|
11691
|
+
if (meant !== void 0) return `Did you mean \`adiff ${meant}\`? Run \`adiff ${meant} --help\` for what it needs, or \`adiff --help\` for every command.`;
|
|
11692
|
+
return Array.isArray(detail["verbs"]) && named !== void 0 ? `\`${named}\` needs a verb after it. Run \`adiff ${named} --help\` for the ones it has.` : void 0;
|
|
11693
|
+
};
|
|
11694
|
+
unknownOption = (detail) => {
|
|
11695
|
+
const command = wordIn(detail, "command");
|
|
11696
|
+
const meant = wordIn(detail, "didYouMean");
|
|
11697
|
+
if (command === void 0) return void 0;
|
|
11698
|
+
if (meant !== void 0) return `Did you mean \`--${meant}\`? The options \`${command}\` takes are listed under known.`;
|
|
11699
|
+
return `The options \`${command}\` takes are listed under known. Run \`adiff ${command} --help\` for what each one does.`;
|
|
11700
|
+
};
|
|
11701
|
+
naming = (write) => (detail) => {
|
|
11702
|
+
const command = wordIn(detail, "command");
|
|
11703
|
+
return command === void 0 ? void 0 : write(command);
|
|
11552
11704
|
};
|
|
11705
|
+
SHARPER = {
|
|
11706
|
+
UnknownCommand: unknownCommand,
|
|
11707
|
+
UnknownOption: unknownOption,
|
|
11708
|
+
SeveralIds: naming((command) => `\`${command}\` takes one id. Run it once for each id.`),
|
|
11709
|
+
MissingOption: naming((command) => `Run \`adiff ${command} --help\` for what it needs.`)
|
|
11710
|
+
};
|
|
11711
|
+
sharpen = (tag, detail, fallback) => SHARPER[tag]?.(detail) ?? fallback;
|
|
11553
11712
|
failure = (cause) => {
|
|
11554
11713
|
const tag = tagOf(cause);
|
|
11555
11714
|
const advice = ADVICE[tag] ?? FALLBACK;
|
|
@@ -11570,14 +11729,24 @@ var init_report$1 = __esmMin((() => {
|
|
|
11570
11729
|
};
|
|
11571
11730
|
}));
|
|
11572
11731
|
//#endregion
|
|
11732
|
+
//#region src/cli/standing.ts
|
|
11733
|
+
var holdsGit, worktreeAbove;
|
|
11734
|
+
var init_standing = __esmMin((() => {
|
|
11735
|
+
holdsGit = (folder) => existsSync(join(folder, ".git"));
|
|
11736
|
+
worktreeAbove = (from) => {
|
|
11737
|
+
const folder = resolve(from);
|
|
11738
|
+
if (holdsGit(folder)) return folder;
|
|
11739
|
+
const parent = dirname(folder);
|
|
11740
|
+
return parent === folder ? void 0 : worktreeAbove(parent);
|
|
11741
|
+
};
|
|
11742
|
+
}));
|
|
11743
|
+
//#endregion
|
|
11573
11744
|
//#region src/cli/serve.ts
|
|
11574
|
-
var Replies, toStdout, NOT_SERVED, SETTLE_MS$1, refused, write, answering, KIND_OF, kindOf, settled$1, watching, unwatching, readRequest, handled, listen, serve;
|
|
11745
|
+
var Replies, toStdout, NOT_SERVED, SETTLE_MS$1, refused, write, answering, KIND_OF, heldOpen, kindOf, settled$1, watching, unwatching, readRequest, handled, listen, serve;
|
|
11575
11746
|
var init_serve = __esmMin((() => {
|
|
11576
11747
|
init_dist();
|
|
11577
11748
|
init_error$6();
|
|
11578
11749
|
init_report$1();
|
|
11579
|
-
init_parse$1();
|
|
11580
|
-
init_catalog();
|
|
11581
11750
|
Replies = class extends Service()("adiff/Replies") {};
|
|
11582
11751
|
toStdout = succeed$2(Replies)({ say: (line) => sync(() => void process.stdout.write(`${line}\n`)) });
|
|
11583
11752
|
NOT_SERVED = /* @__PURE__ */ new Set([
|
|
@@ -11602,7 +11771,7 @@ var init_serve = __esmMin((() => {
|
|
|
11602
11771
|
const name = serving.nameOf(args);
|
|
11603
11772
|
if (NOT_SERVED.has(name)) return succeed$1(refused(new NotServed({ command: name })));
|
|
11604
11773
|
const heard = [];
|
|
11605
|
-
return serving.run(name,
|
|
11774
|
+
return serving.run(name, args).pipe(provideService(Replies, { say: (line) => sync(() => void heard.push(line)) }), map$1(() => ({
|
|
11606
11775
|
exit: 0,
|
|
11607
11776
|
answer: JSON.parse(heard.at(-1) ?? "{}")
|
|
11608
11777
|
})), catchCause((cause) => succeed$1(refused(squash(cause)))));
|
|
@@ -11612,8 +11781,10 @@ var init_serve = __esmMin((() => {
|
|
|
11612
11781
|
"outbox.jsonl": "comments",
|
|
11613
11782
|
"state.json": "state",
|
|
11614
11783
|
"layers.json": "layers",
|
|
11615
|
-
"watch.json": "watch"
|
|
11784
|
+
"watch.json": "watch",
|
|
11785
|
+
"wait.json": "watch"
|
|
11616
11786
|
};
|
|
11787
|
+
heldOpen = (name) => name !== null && name.endsWith(".lock");
|
|
11617
11788
|
kindOf = (name) => {
|
|
11618
11789
|
if (name === null) return "other";
|
|
11619
11790
|
const file = Object.keys(KIND_OF).find((known) => name === known || name.startsWith(`${known}.`));
|
|
@@ -11629,6 +11800,7 @@ var init_serve = __esmMin((() => {
|
|
|
11629
11800
|
tell(what);
|
|
11630
11801
|
};
|
|
11631
11802
|
const watcher = watch(folder, (_event, name) => {
|
|
11803
|
+
if (heldOpen(name)) return;
|
|
11632
11804
|
seen.add(kindOf(name));
|
|
11633
11805
|
if (timer !== void 0) clearTimeout(timer);
|
|
11634
11806
|
timer = setTimeout(told, SETTLE_MS$1);
|
|
@@ -11636,7 +11808,7 @@ var init_serve = __esmMin((() => {
|
|
|
11636
11808
|
watcher.on("error", () => void 0);
|
|
11637
11809
|
return watcher;
|
|
11638
11810
|
};
|
|
11639
|
-
watching = (serving, request, watchers) => serving.folderOf(
|
|
11811
|
+
watching = (serving, request, watchers) => serving.folderOf(request.watch ?? []).pipe(map$1((folder) => {
|
|
11640
11812
|
watchers.get(request.id)?.close();
|
|
11641
11813
|
watchers.set(request.id, settled$1(folder, (what) => write({
|
|
11642
11814
|
id: request.id,
|
|
@@ -11713,6 +11885,7 @@ var init_cli = __esmMin((() => {
|
|
|
11713
11885
|
init_parse$1();
|
|
11714
11886
|
init_catalog();
|
|
11715
11887
|
init_report$1();
|
|
11888
|
+
init_standing();
|
|
11716
11889
|
init_error$6();
|
|
11717
11890
|
init_serve();
|
|
11718
11891
|
}));
|
|
@@ -12718,7 +12891,7 @@ var init_model$4 = __esmMin((() => {
|
|
|
12718
12891
|
}));
|
|
12719
12892
|
//#endregion
|
|
12720
12893
|
//#region src/service/store/schema.ts
|
|
12721
|
-
var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, Doing, noStamps, BranchState, StoredSaid, StoredRemark, StoredRemarks, Settings, Watching, UpgradeCheck, Prose, Code$1, Split, StoredLayer, StoredLayers;
|
|
12894
|
+
var Side, Anchor, StoredComment, StoredDraft, Drafts, StoredAnswer, Batch, Stamps, Counts, Doing, noStamps, BranchState, StoredSaid, StoredRemark, StoredRemarks, Settings, Watching, Listening, UpgradeCheck, Prose, Code$1, Split, StoredLayer, StoredLayers;
|
|
12722
12895
|
var init_schema = __esmMin((() => {
|
|
12723
12896
|
init_dist();
|
|
12724
12897
|
Side = Literals(["old", "new"]);
|
|
@@ -12824,6 +12997,10 @@ var init_schema = __esmMin((() => {
|
|
|
12824
12997
|
editor: optionalKey(String$1)
|
|
12825
12998
|
});
|
|
12826
12999
|
Watching = Struct({ lookedAt: String$1 });
|
|
13000
|
+
Listening = Struct({
|
|
13001
|
+
wait: String$1,
|
|
13002
|
+
since: String$1
|
|
13003
|
+
});
|
|
12827
13004
|
UpgradeCheck = Struct({
|
|
12828
13005
|
note: optionalKey(String$1),
|
|
12829
13006
|
checkedAt: optionalKey(String$1),
|
|
@@ -12866,7 +13043,7 @@ var init_schema = __esmMin((() => {
|
|
|
12866
13043
|
}));
|
|
12867
13044
|
//#endregion
|
|
12868
13045
|
//#region src/service/store/paths.ts
|
|
12869
|
-
var NON_SLUG, slugOf, defaultRoot, branchDir, inboxPath, outboxPath, statePath, watchPath, draftsPath, layersPath, remarksPath, settingsPath, upgradePath, reportsDir, reportPath;
|
|
13046
|
+
var NON_SLUG, slugOf, defaultRoot, branchDir, inboxPath, outboxPath, statePath, watchPath, waitPath, draftsPath, layersPath, remarksPath, settingsPath, upgradePath, reportsDir, reportPath;
|
|
12870
13047
|
var init_paths = __esmMin((() => {
|
|
12871
13048
|
NON_SLUG = /[^a-zA-Z0-9]+/g;
|
|
12872
13049
|
slugOf = (worktreePath) => worktreePath.replace(NON_SLUG, "-");
|
|
@@ -12876,6 +13053,7 @@ var init_paths = __esmMin((() => {
|
|
|
12876
13053
|
outboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "outbox.jsonl");
|
|
12877
13054
|
statePath = (root, worktreePath) => join(branchDir(root, worktreePath), "state.json");
|
|
12878
13055
|
watchPath = (root, worktreePath) => join(branchDir(root, worktreePath), "watch.json");
|
|
13056
|
+
waitPath = (root, worktreePath) => join(branchDir(root, worktreePath), "wait.json");
|
|
12879
13057
|
draftsPath = (root, worktreePath) => join(branchDir(root, worktreePath), "drafts.json");
|
|
12880
13058
|
layersPath = (root, worktreePath) => join(branchDir(root, worktreePath), "layers.json");
|
|
12881
13059
|
remarksPath = (root, worktreePath) => join(branchDir(root, worktreePath), "remarks.json");
|
|
@@ -12886,7 +13064,7 @@ var init_paths = __esmMin((() => {
|
|
|
12886
13064
|
}));
|
|
12887
13065
|
//#endregion
|
|
12888
13066
|
//#region src/service/store/service.ts
|
|
12889
|
-
var Store, ensureDir, readOptional, missing$2, damaged, jsonOf$2, decoded, unwritable, besideOf$1, 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, branchKeyOf, 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;
|
|
13067
|
+
var Store, ensureDir, readOptional, missing$2, damaged, jsonOf$2, decoded, unwritable, besideOf$1, 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, asListening, linesOf, readLines, parseSettings, parseUpgradeCheck, parseState, parseLayers, parseRemarks, idsIn$1, takes, handedOps, cursorOps, waitOps, settingsOps, upgradeOps, reportOps, branchKeyIn, branchKeyOf, 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;
|
|
12890
13068
|
var init_service$2 = __esmMin((() => {
|
|
12891
13069
|
init_dist();
|
|
12892
13070
|
init_git();
|
|
@@ -12976,6 +13154,7 @@ var init_service$2 = __esmMin((() => {
|
|
|
12976
13154
|
asRemarks = decoded(StoredRemarks);
|
|
12977
13155
|
asDrafts = decoded(Drafts);
|
|
12978
13156
|
asWatching = decoded(Watching);
|
|
13157
|
+
asListening = decoded(Listening);
|
|
12979
13158
|
linesOf = (raw) => raw.split("\n").filter((line) => line.trim().length > 0);
|
|
12980
13159
|
readLines = (path, raw, as) => forEach(linesOf(raw), (line) => jsonOf$2(path, line).pipe(flatMap((value) => as(path, value))));
|
|
12981
13160
|
parseSettings = fn("Store.parseSettings")(function* (path, raw) {
|
|
@@ -13003,34 +13182,52 @@ var init_service$2 = __esmMin((() => {
|
|
|
13003
13182
|
...was.taken
|
|
13004
13183
|
}
|
|
13005
13184
|
});
|
|
13006
|
-
|
|
13007
|
-
const
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
}];
|
|
13021
|
-
});
|
|
13185
|
+
handedOps = (state, inbox, spoken) => fn("Store.handedIn")(function* (worktreePath, handing) {
|
|
13186
|
+
const batches = yield* inbox(worktreePath);
|
|
13187
|
+
const current = yield* state(worktreePath);
|
|
13188
|
+
const answered = new Set((yield* spoken(worktreePath)).map((entry) => entry.comment));
|
|
13189
|
+
const taken = current.taken ?? {};
|
|
13190
|
+
const owed = (comment) => !answered.has(comment.id) && !Object.hasOwn(current.settled, comment.id) && !Object.hasOwn(current.removed, comment.id) && (handing === "owed" || !Object.hasOwn(taken, comment.id));
|
|
13191
|
+
return batches.flatMap((batch) => {
|
|
13192
|
+
const comments = batch.comments.filter(owed);
|
|
13193
|
+
return comments.length === 0 ? [] : [{
|
|
13194
|
+
id: batch.id,
|
|
13195
|
+
at: batch.at,
|
|
13196
|
+
head: batch.head,
|
|
13197
|
+
comments
|
|
13198
|
+
}];
|
|
13022
13199
|
});
|
|
13200
|
+
});
|
|
13201
|
+
cursorOps = (handedIn, state, saveState, holdingState) => {
|
|
13023
13202
|
const owedIn = (worktreePath) => handedIn(worktreePath, "owed");
|
|
13203
|
+
const marked = fn("Store.marked")(function* (worktreePath, at, handing) {
|
|
13204
|
+
const batches = yield* handedIn(worktreePath, handing);
|
|
13205
|
+
const ids = idsIn$1(batches);
|
|
13206
|
+
if (ids.length > 0) yield* saveState(worktreePath, takes(ids, at)(yield* state(worktreePath)));
|
|
13207
|
+
return batches;
|
|
13208
|
+
});
|
|
13024
13209
|
return {
|
|
13025
|
-
take: fn("Store.take")(function* (worktreePath, at
|
|
13026
|
-
const
|
|
13027
|
-
|
|
13028
|
-
if (ids.length > 0) yield* changeState(worktreePath, takes(ids, at));
|
|
13029
|
-
return batches;
|
|
13210
|
+
take: fn("Store.take")(function* (worktreePath, at) {
|
|
13211
|
+
const seen = yield* handedIn(worktreePath, "owed");
|
|
13212
|
+
return seen.length === 0 ? seen : yield* holdingState(worktreePath, marked(worktreePath, at, "owed"));
|
|
13030
13213
|
}),
|
|
13214
|
+
marked,
|
|
13031
13215
|
owed: owedIn
|
|
13032
13216
|
};
|
|
13033
13217
|
};
|
|
13218
|
+
waitOps = (handedIn, marked, holdingState, listening) => {
|
|
13219
|
+
const heldBy = (worktreePath, wait) => map$1(listening(worktreePath), (found) => isSome(found) && found.value.wait === wait);
|
|
13220
|
+
const markedFor = fn("Store.markedFor")(function* (worktreePath, at, wait) {
|
|
13221
|
+
if (!(yield* heldBy(worktreePath, wait))) return none();
|
|
13222
|
+
return some(yield* marked(worktreePath, at, "new"));
|
|
13223
|
+
});
|
|
13224
|
+
return { takeListening: fn("Store.takeListening")(function* (worktreePath, at, wait) {
|
|
13225
|
+
if (!(yield* heldBy(worktreePath, wait))) return none();
|
|
13226
|
+
const seen = yield* handedIn(worktreePath, "new");
|
|
13227
|
+
if (seen.length === 0) return some(seen);
|
|
13228
|
+
return yield* holdingState(worktreePath, markedFor(worktreePath, at, wait));
|
|
13229
|
+
}) };
|
|
13230
|
+
};
|
|
13034
13231
|
settingsOps = (root) => {
|
|
13035
13232
|
return {
|
|
13036
13233
|
settings: gen(function* () {
|
|
@@ -13228,6 +13425,14 @@ var init_service$2 = __esmMin((() => {
|
|
|
13228
13425
|
const path = watchPath(root, key);
|
|
13229
13426
|
yield* ensureDir(branchDir(root, key));
|
|
13230
13427
|
yield* wrote(path, JSON.stringify({ lookedAt: at }));
|
|
13428
|
+
}),
|
|
13429
|
+
listening: fn("Store.listening")(function* (worktreePath) {
|
|
13430
|
+
const key = yield* keyOf(worktreePath);
|
|
13431
|
+
const path = waitPath(root, key);
|
|
13432
|
+
const raw = yield* readOptional(path);
|
|
13433
|
+
if (isNone(raw)) return none();
|
|
13434
|
+
const value = yield* jsonOf$2(path, raw.value);
|
|
13435
|
+
return some(yield* asListening(path, value));
|
|
13231
13436
|
})
|
|
13232
13437
|
};
|
|
13233
13438
|
};
|
|
@@ -13276,10 +13481,13 @@ var init_service$2 = __esmMin((() => {
|
|
|
13276
13481
|
yield* ensureDir(branchDir(root, key));
|
|
13277
13482
|
yield* writeState(path, next);
|
|
13278
13483
|
});
|
|
13279
|
-
const
|
|
13484
|
+
const holdingState = (worktreePath, work) => gen(function* () {
|
|
13280
13485
|
const key = yield* keyOf(worktreePath);
|
|
13281
13486
|
yield* ensureDir(branchDir(root, key));
|
|
13282
|
-
yield* alone(`${statePath(root, key)}.lock`, STATE_LOCK,
|
|
13487
|
+
return yield* alone(`${statePath(root, key)}.lock`, STATE_LOCK, work);
|
|
13488
|
+
}).pipe(withSpan("Store.holdingState"));
|
|
13489
|
+
const changeState = fn("Store.changeState")(function* (worktreePath, change) {
|
|
13490
|
+
yield* holdingState(worktreePath, under(worktreePath, change));
|
|
13283
13491
|
});
|
|
13284
13492
|
const under = fn("Store.under")(function* (worktreePath, change) {
|
|
13285
13493
|
yield* saveState(worktreePath, change(yield* state(worktreePath)));
|
|
@@ -13287,14 +13495,25 @@ var init_service$2 = __esmMin((() => {
|
|
|
13287
13495
|
return {
|
|
13288
13496
|
state,
|
|
13289
13497
|
saveState,
|
|
13290
|
-
changeState
|
|
13498
|
+
changeState,
|
|
13499
|
+
holdingState
|
|
13291
13500
|
};
|
|
13292
13501
|
};
|
|
13293
13502
|
makeStore = (root, git, keyOf) => {
|
|
13294
13503
|
const { submit, inbox } = inboxOps(root, keyOf);
|
|
13295
|
-
const { state, saveState, changeState } = stateOps(root, keyOf);
|
|
13504
|
+
const { state, saveState, changeState, holdingState } = stateOps(root, keyOf);
|
|
13296
13505
|
const talk = answerOps(root, keyOf);
|
|
13297
|
-
const
|
|
13506
|
+
const watch = watchOps(root, keyOf);
|
|
13507
|
+
const handedIn = handedOps(state, inbox, talk.answers);
|
|
13508
|
+
const { marked, ...cursors } = cursorOps(handedIn, state, saveState, holdingState);
|
|
13509
|
+
const waits = waitOps(handedIn, marked, holdingState, watch.listening);
|
|
13510
|
+
const listen = fn("Store.listen")(function* (worktreePath, wait, since) {
|
|
13511
|
+
const key = yield* keyOf(worktreePath);
|
|
13512
|
+
yield* holdingState(worktreePath, wrote(waitPath(root, key), JSON.stringify({
|
|
13513
|
+
wait,
|
|
13514
|
+
since
|
|
13515
|
+
})));
|
|
13516
|
+
});
|
|
13298
13517
|
return {
|
|
13299
13518
|
root,
|
|
13300
13519
|
branchAt: git.headOf,
|
|
@@ -13309,9 +13528,11 @@ var init_service$2 = __esmMin((() => {
|
|
|
13309
13528
|
...talk,
|
|
13310
13529
|
...layersOps(root, keyOf),
|
|
13311
13530
|
...remarksOps(root, keyOf),
|
|
13312
|
-
...
|
|
13531
|
+
...watch,
|
|
13532
|
+
listen,
|
|
13313
13533
|
...draftsOps(root, keyOf),
|
|
13314
|
-
...cursors
|
|
13534
|
+
...cursors,
|
|
13535
|
+
...waits
|
|
13315
13536
|
};
|
|
13316
13537
|
};
|
|
13317
13538
|
madeStore = fn("Store.make")(function* (root) {
|
|
@@ -13334,7 +13555,7 @@ var init_store = __esmMin((() => {
|
|
|
13334
13555
|
}));
|
|
13335
13556
|
//#endregion
|
|
13336
13557
|
//#region src/review/error.ts
|
|
13337
|
-
var UnknownBranch, BranchMoved, UnknownBase, UnknownFile, NotVouched, VouchedVersionGone, UnknownComment, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
|
|
13558
|
+
var UnknownBranch, BranchMoved, UnknownBase, UnknownFile, NotVouched, VouchedVersionGone, UnknownComment, AmbiguousId, UnknownRemark, NothingSaid, ThreadOpen, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownWorktree, MalformedLayers, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers, NoPull, UnknownLayer;
|
|
13338
13559
|
var init_error$3 = __esmMin((() => {
|
|
13339
13560
|
init_dist();
|
|
13340
13561
|
UnknownBranch = class extends TaggedError("UnknownBranch") {};
|
|
@@ -13344,6 +13565,7 @@ var init_error$3 = __esmMin((() => {
|
|
|
13344
13565
|
NotVouched = class extends TaggedError("NotVouched") {};
|
|
13345
13566
|
VouchedVersionGone = class extends TaggedError("VouchedVersionGone") {};
|
|
13346
13567
|
UnknownComment = class extends TaggedError("UnknownComment") {};
|
|
13568
|
+
AmbiguousId = class extends TaggedError("AmbiguousId") {};
|
|
13347
13569
|
UnknownRemark = class extends TaggedError("UnknownRemark") {};
|
|
13348
13570
|
NothingSaid = class extends TaggedError("NothingSaid") {};
|
|
13349
13571
|
ThreadOpen = class extends TaggedError("ThreadOpen") {};
|
|
@@ -14186,7 +14408,7 @@ var init_placing = __esmMin((() => {
|
|
|
14186
14408
|
}));
|
|
14187
14409
|
//#endregion
|
|
14188
14410
|
//#region src/review/comments.ts
|
|
14189
|
-
var POLL, bodyOf, saidTo, spunOf, sentOf, placedNow$1, linesIn, trimmedLines, NAMES_SOMETHING, worthMatching, blockAt, wholeSnippetIn, stillInFile, foundOutsideTheHunks, flatten, listSent, submitMany, submit, without$2, reply, threadBefore, layerOver, layersOn, take, awaitTaken, markRead;
|
|
14411
|
+
var POLL, bodyOf, saidTo, spunOf, sentOf, placedNow$1, linesIn, trimmedLines, NAMES_SOMETHING, worthMatching, blockAt, wholeSnippetIn, stillInFile, foundOutsideTheHunks, flatten, listSent, submitMany, submit, without$2, reply, threadBefore, layerOver, layersOn, dressed, take, REPLACED, listened, awaitTaken, markRead;
|
|
14190
14412
|
var init_comments$1 = __esmMin((() => {
|
|
14191
14413
|
init_dist();
|
|
14192
14414
|
init_patch();
|
|
@@ -14424,12 +14646,9 @@ var init_comments$1 = __esmMin((() => {
|
|
|
14424
14646
|
onSome: (held) => held.layers
|
|
14425
14647
|
});
|
|
14426
14648
|
});
|
|
14427
|
-
|
|
14649
|
+
dressed = fn("Review.Comment.dressed")(function* (resolved, batches) {
|
|
14428
14650
|
const store = yield* Store;
|
|
14429
|
-
const
|
|
14430
|
-
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
14431
|
-
yield* ignore(store.noteWatching(resolved, at));
|
|
14432
|
-
const owed = flatten(yield* store.take(resolved, at, handing));
|
|
14651
|
+
const owed = flatten(batches);
|
|
14433
14652
|
if (owed.length === 0) return owed;
|
|
14434
14653
|
const layers = yield* layersOn(resolved);
|
|
14435
14654
|
const under = (one) => {
|
|
@@ -14442,7 +14661,40 @@ var init_comments$1 = __esmMin((() => {
|
|
|
14442
14661
|
const carried = (one) => one.replyTo === void 0 ? one : Object.assign({}, one, { thread: threadBefore(one, held, spoken) });
|
|
14443
14662
|
return owed.map(carried).map(under);
|
|
14444
14663
|
});
|
|
14445
|
-
|
|
14664
|
+
take = fn("Review.Comment.take")(function* (worktreePath) {
|
|
14665
|
+
const store = yield* Store;
|
|
14666
|
+
const resolved = yield* realOf(worktreePath);
|
|
14667
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
14668
|
+
yield* ignore(store.noteWatching(resolved, at));
|
|
14669
|
+
return yield* dressed(resolved, yield* store.take(resolved, at));
|
|
14670
|
+
});
|
|
14671
|
+
REPLACED = {
|
|
14672
|
+
comments: [],
|
|
14673
|
+
replaced: true
|
|
14674
|
+
};
|
|
14675
|
+
listened = (listen) => gen(function* () {
|
|
14676
|
+
const store = yield* Store;
|
|
14677
|
+
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
14678
|
+
yield* ignore(store.noteWatching(listen.resolved, at));
|
|
14679
|
+
const taken = yield* store.takeListening(listen.resolved, at, listen.wait);
|
|
14680
|
+
if (isNone(taken)) return REPLACED;
|
|
14681
|
+
const comments = yield* dressed(listen.resolved, taken.value);
|
|
14682
|
+
if (comments.length > 0 || Date.now() >= listen.deadline) return {
|
|
14683
|
+
comments,
|
|
14684
|
+
replaced: false
|
|
14685
|
+
};
|
|
14686
|
+
return yield* sleep(POLL).pipe(flatMap(() => listened(listen)));
|
|
14687
|
+
});
|
|
14688
|
+
awaitTaken = fn("Review.Comment.awaitTaken")(function* (worktreePath, deadline, wait) {
|
|
14689
|
+
const store = yield* Store;
|
|
14690
|
+
const resolved = yield* realOf(worktreePath);
|
|
14691
|
+
yield* store.listen(resolved, wait, (/* @__PURE__ */ new Date()).toISOString());
|
|
14692
|
+
return yield* listened({
|
|
14693
|
+
resolved,
|
|
14694
|
+
deadline,
|
|
14695
|
+
wait
|
|
14696
|
+
});
|
|
14697
|
+
});
|
|
14446
14698
|
markRead = fn("Review.Comment.markRead")(function* (worktree, id) {
|
|
14447
14699
|
const store = yield* Store;
|
|
14448
14700
|
const spoken = yield* store.answers(worktree.path);
|
|
@@ -14469,6 +14721,21 @@ var init_comments$1 = __esmMin((() => {
|
|
|
14469
14721
|
});
|
|
14470
14722
|
}));
|
|
14471
14723
|
//#endregion
|
|
14724
|
+
//#region src/review/ids.ts
|
|
14725
|
+
var startingWith;
|
|
14726
|
+
var init_ids = __esmMin((() => {
|
|
14727
|
+
init_dist();
|
|
14728
|
+
init_error$3();
|
|
14729
|
+
startingWith = (ids, given) => {
|
|
14730
|
+
if (given.length === 0 || ids.includes(given)) return succeed$1(given);
|
|
14731
|
+
const matches = ids.filter((id) => id.startsWith(given));
|
|
14732
|
+
return matches.length > 1 ? fail(new AmbiguousId({
|
|
14733
|
+
id: given,
|
|
14734
|
+
matches
|
|
14735
|
+
})) : succeed$1(matches[0] ?? given);
|
|
14736
|
+
};
|
|
14737
|
+
}));
|
|
14738
|
+
//#endregion
|
|
14472
14739
|
//#region src/domain/review/vouch.ts
|
|
14473
14740
|
var SHORTEST_BLOB, sameBlob, isVouched, vouch$1, partOf, isPartVouched, vouchPart$1;
|
|
14474
14741
|
var init_vouch = __esmMin((() => {
|
|
@@ -14536,11 +14803,12 @@ var init_review$1 = __esmMin((() => {
|
|
|
14536
14803
|
}));
|
|
14537
14804
|
//#endregion
|
|
14538
14805
|
//#region src/review/threads.ts
|
|
14539
|
-
var ASK_LEAD, stateOf$2, choicesOf, answerOf, turnsOf, judged, factsOf, threadOf, threadsIn$1, idsIn, rootIn, rootOf, isKnown, known, list$3, clearDoing, doing, answer$3, repliesTo, settle, without$1, unsettle, remove, restore$1, settleRead, countsOf, loudestOf, drawnOnALine, settledOnALine, fileThreads, byFile$1, lineThreads, byLine;
|
|
14806
|
+
var ASK_LEAD, stateOf$2, choicesOf, answerOf, turnsOf, judged, factsOf, threadOf, threadsIn$1, idsIn, rootIn, rootOf, idStarting$2, isKnown, known, list$3, clearDoing, doing, answer$3, repliesTo, settle, without$1, unsettle, remove, restore$1, settleRead, countsOf, loudestOf, drawnOnALine, settledOnALine, fileThreads, byFile$1, lineThreads, byLine;
|
|
14540
14807
|
var init_threads$1 = __esmMin((() => {
|
|
14541
14808
|
init_dist();
|
|
14542
14809
|
init_store();
|
|
14543
14810
|
init_error$3();
|
|
14811
|
+
init_ids();
|
|
14544
14812
|
init_placing();
|
|
14545
14813
|
init_review$1();
|
|
14546
14814
|
ASK_LEAD = "About this branch, not about this line.";
|
|
@@ -14669,6 +14937,10 @@ var init_threads$1 = __esmMin((() => {
|
|
|
14669
14937
|
const root = rootIn(yield* store.inbox(worktree.path), id);
|
|
14670
14938
|
return root === void 0 ? yield* new UnknownComment({ id }) : root;
|
|
14671
14939
|
});
|
|
14940
|
+
idStarting$2 = fn("Review.Thread.idStarting")(function* (worktree, given) {
|
|
14941
|
+
const store = yield* Store;
|
|
14942
|
+
return yield* startingWith(idsIn(yield* store.inbox(worktree.path)), given);
|
|
14943
|
+
});
|
|
14672
14944
|
isKnown = fn("Review.Thread.isKnown")(function* (worktree, id) {
|
|
14673
14945
|
const store = yield* Store;
|
|
14674
14946
|
return idsIn(yield* store.inbox(worktree.path)).includes(id);
|
|
@@ -14878,7 +15150,7 @@ var init_error$2 = __esmMin((() => {
|
|
|
14878
15150
|
}));
|
|
14879
15151
|
//#endregion
|
|
14880
15152
|
//#region src/service/forge/service.ts
|
|
14881
|
-
var Forge, LIMIT, TIMEOUT_MS, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS
|
|
15153
|
+
var Forge, LIMIT, TIMEOUT_MS, SEND_TIMEOUT_MS, MOST_OUTPUT, FIELDS, 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$2, 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;
|
|
14882
15154
|
var init_service$1 = __esmMin((() => {
|
|
14883
15155
|
init_dist();
|
|
14884
15156
|
init_error$2();
|
|
@@ -14887,7 +15159,7 @@ var init_service$1 = __esmMin((() => {
|
|
|
14887
15159
|
TIMEOUT_MS = 4e3;
|
|
14888
15160
|
SEND_TIMEOUT_MS = 2e4;
|
|
14889
15161
|
MOST_OUTPUT = 4194304;
|
|
14890
|
-
FIELDS
|
|
15162
|
+
FIELDS = "headRefName,state,isDraft,author";
|
|
14891
15163
|
Author = Struct({
|
|
14892
15164
|
login: String$1,
|
|
14893
15165
|
is_bot: optionalKey(Boolean)
|
|
@@ -14926,7 +15198,7 @@ var init_service$1 = __esmMin((() => {
|
|
|
14926
15198
|
"--limit",
|
|
14927
15199
|
LIMIT,
|
|
14928
15200
|
"--json",
|
|
14929
|
-
FIELDS
|
|
15201
|
+
FIELDS
|
|
14930
15202
|
], {
|
|
14931
15203
|
cwd: repo,
|
|
14932
15204
|
timeout: TIMEOUT_MS,
|
|
@@ -15204,7 +15476,7 @@ var init_service$1 = __esmMin((() => {
|
|
|
15204
15476
|
"-F",
|
|
15205
15477
|
"name={repo}"
|
|
15206
15478
|
];
|
|
15207
|
-
asked
|
|
15479
|
+
asked = (repo, branch, after) => gh(repo, [
|
|
15208
15480
|
"api",
|
|
15209
15481
|
"graphql",
|
|
15210
15482
|
"-f",
|
|
@@ -15245,7 +15517,7 @@ var init_service$1 = __esmMin((() => {
|
|
|
15245
15517
|
const held = [];
|
|
15246
15518
|
let after;
|
|
15247
15519
|
for (let page = 0; page < PAGES; page += 1) {
|
|
15248
|
-
const raw = yield* asked
|
|
15520
|
+
const raw = yield* asked(repo, branch, after);
|
|
15249
15521
|
const found = yield* threadsIn(repo, raw);
|
|
15250
15522
|
if (found === void 0) return held;
|
|
15251
15523
|
held.push(...found.nodes);
|
|
@@ -15329,13 +15601,14 @@ var init_service$1 = __esmMin((() => {
|
|
|
15329
15601
|
var init_forge = __esmMin((() => {
|
|
15330
15602
|
init_service$1();
|
|
15331
15603
|
init_error$2();
|
|
15332
|
-
})), VERSION, OPENING, CLOSING, heldOf$1, bared, dropped, quotedCode, snippetOf$1, spokenWithout, spanOf, showsLine, placedNow, stateOf, heldPair, accepted, shownOf$1, fetch$1, held$1, against, list$2, named$1, without, notTaken, dismiss, restore, quoted, anchorFrom, takingOn, accept, answer$1;
|
|
15604
|
+
})), VERSION, OPENING, CLOSING, heldOf$1, bared, dropped, quotedCode, snippetOf$1, spokenWithout, spanOf, showsLine, placedNow, stateOf, heldPair, accepted, shownOf$1, fetch$1, held$1, against, list$2, idStarting$1, named$1, without, notTaken, dismiss, restore, quoted, anchorFrom, takingOn, accept, answer$1;
|
|
15333
15605
|
var init_remarks$1 = __esmMin((() => {
|
|
15334
15606
|
init_dist();
|
|
15335
15607
|
init_patch();
|
|
15336
15608
|
init_forge();
|
|
15337
15609
|
init_store();
|
|
15338
15610
|
init_error$3();
|
|
15611
|
+
init_ids();
|
|
15339
15612
|
VERSION = 1;
|
|
15340
15613
|
OPENING = /^```suggestion[^\n]*\n?/gm;
|
|
15341
15614
|
CLOSING = /^```[ \t]*$/gm;
|
|
@@ -15465,6 +15738,10 @@ var init_remarks$1 = __esmMin((() => {
|
|
|
15465
15738
|
list$2 = fn("Review.Remark.list")(function* (reading) {
|
|
15466
15739
|
return yield* against(reading.worktree, reading.patches);
|
|
15467
15740
|
});
|
|
15741
|
+
idStarting$1 = fn("Review.Remark.idStarting")(function* (worktree, given) {
|
|
15742
|
+
const kept = yield* held$1(worktree);
|
|
15743
|
+
return yield* startingWith(kept.map((one) => one.id), given);
|
|
15744
|
+
});
|
|
15468
15745
|
named$1 = fn("Review.Remark.named")(function* (worktree, id) {
|
|
15469
15746
|
const kept = yield* held$1(worktree);
|
|
15470
15747
|
const found = kept.find((one) => one.id === id);
|
|
@@ -16619,12 +16896,13 @@ var init_layers = __esmMin((() => {
|
|
|
16619
16896
|
}));
|
|
16620
16897
|
//#endregion
|
|
16621
16898
|
//#region src/review/drafts.ts
|
|
16622
|
-
var unreadIn, reported, list, markSeen, add$1, edit, drop, sameCommit, commentOf, sending, dispatch$1;
|
|
16899
|
+
var unreadIn, reported, list, markSeen, add$1, idStarting, edit, drop, sameCommit, commentOf, sending, dispatch$1;
|
|
16623
16900
|
var init_drafts$1 = __esmMin((() => {
|
|
16624
16901
|
init_dist();
|
|
16625
16902
|
init_forge();
|
|
16626
16903
|
init_store();
|
|
16627
16904
|
init_error$3();
|
|
16905
|
+
init_ids();
|
|
16628
16906
|
init_patches();
|
|
16629
16907
|
unreadIn = (draft, seen) => {
|
|
16630
16908
|
if (draft.wroteBy !== "agent") return false;
|
|
@@ -16671,6 +16949,10 @@ var init_drafts$1 = __esmMin((() => {
|
|
|
16671
16949
|
yield* store.saveDrafts(worktree.path, [...held, one]);
|
|
16672
16950
|
return reported(one, {});
|
|
16673
16951
|
});
|
|
16952
|
+
idStarting = fn("Review.Draft.idStarting")(function* (worktree, given) {
|
|
16953
|
+
const held = yield* (yield* Store).drafts(worktree.path);
|
|
16954
|
+
return yield* startingWith(held.map((one) => one.id), given);
|
|
16955
|
+
});
|
|
16674
16956
|
edit = fn("Review.Draft.edit")(function* (worktree, rewrite) {
|
|
16675
16957
|
const store = yield* Store;
|
|
16676
16958
|
const held = yield* store.drafts(worktree.path);
|
|
@@ -17014,7 +17296,8 @@ const NAME_ROOM = 18;
|
|
|
17014
17296
|
const OPTION_ROOM = 24;
|
|
17015
17297
|
const version = () => version$1;
|
|
17016
17298
|
const opening$1 = (about) => about.split(". ")[0] ?? about;
|
|
17017
|
-
const
|
|
17299
|
+
const REVIEWERS = "[reviewer]";
|
|
17300
|
+
const line = (command) => ` ${command.name.padEnd(NAME_ROOM)}${opening$1(command.about)}${command.audience === "reviewer" ? ` ${REVIEWERS}` : ""}`;
|
|
17018
17301
|
const banner = () => [
|
|
17019
17302
|
`adiff ${version()}`,
|
|
17020
17303
|
"",
|
|
@@ -17026,12 +17309,13 @@ const banner = () => [
|
|
|
17026
17309
|
"",
|
|
17027
17310
|
"An agent working in that worktree answers them:",
|
|
17028
17311
|
"",
|
|
17029
|
-
" adiff comment take
|
|
17030
|
-
" adiff comment take --
|
|
17031
|
-
" adiff comment answer
|
|
17032
|
-
" adiff layers set --
|
|
17312
|
+
" adiff comment take collect every comment owed an answer",
|
|
17313
|
+
" adiff comment take --wait 6900 block until a new comment arrives",
|
|
17314
|
+
" adiff comment answer <id> --body '…'",
|
|
17315
|
+
" adiff layers set --file - publish a reading order, when asked",
|
|
17033
17316
|
"",
|
|
17034
17317
|
"Every comment carries an id, and an answer goes back to the reviewer under it.",
|
|
17318
|
+
"Run inside the worktree, a command acts on that worktree's review.",
|
|
17035
17319
|
"",
|
|
17036
17320
|
"adiff --help lists every command. adiff describe answers the same as JSON,",
|
|
17037
17321
|
"and describe --command 'comment take' answers for one."
|
|
@@ -17048,40 +17332,42 @@ const help = () => [
|
|
|
17048
17332
|
" adiff <command> [options]",
|
|
17049
17333
|
"",
|
|
17050
17334
|
...groups.flatMap(under),
|
|
17335
|
+
`${REVIEWERS} marks a command that speaks for the person reviewing. An agent leaves those to them.`,
|
|
17336
|
+
"",
|
|
17051
17337
|
"Run `adiff <command> --help` for what it needs, or `adiff describe` for the same as JSON."
|
|
17052
17338
|
].join("\n");
|
|
17053
17339
|
const placeholder = (spec) => spec.value === "flag" ? `--${spec.name}` : `--${spec.name} <${spec.value}>`;
|
|
17054
17340
|
const wanted = (spec) => spec.required ? placeholder(spec) : `[${placeholder(spec)}]`;
|
|
17055
|
-
const REVIEW = "
|
|
17341
|
+
const REVIEW = "[--worktree <path> | --repo <path> --branch <name>]";
|
|
17056
17342
|
const addressed = (name) => addressing.some((spec) => spec.name === name);
|
|
17057
17343
|
const usageOf = (command) => {
|
|
17058
17344
|
const own = command.options.filter((spec) => !addressed(spec.name)).map(wanted);
|
|
17059
17345
|
const parts = command.addresses === "review" ? [REVIEW, ...own] : own;
|
|
17060
17346
|
return [`adiff ${command.name}`, ...parts].join(" ");
|
|
17061
17347
|
};
|
|
17062
|
-
const FIELDS = {
|
|
17063
|
-
name: "fields",
|
|
17064
|
-
required: false,
|
|
17065
|
-
value: "a,b",
|
|
17066
|
-
about: "Narrow the answer to these fields, at every level"
|
|
17067
|
-
};
|
|
17068
17348
|
const option = (spec) => ` ${placeholder(spec).padEnd(OPTION_ROOM)}${spec.about}${spec.required ? " (required)" : ""}`;
|
|
17349
|
+
const FOR = {
|
|
17350
|
+
reviewer: "For the reviewer. It speaks for the person reviewing, so an agent leaves it to them.",
|
|
17351
|
+
agent: "For the agent working in the worktree under review.",
|
|
17352
|
+
anyone: "For the reviewer and the agent alike."
|
|
17353
|
+
};
|
|
17069
17354
|
const answers$1 = (command) => command.dataKey === "" ? ["Answers by handing the terminal to the reviewer, not in JSON."] : [`Answers {"ok":true,"${command.dataKey}":…}`];
|
|
17070
17355
|
const helpFor = (name) => {
|
|
17071
17356
|
const command = findCommand(name);
|
|
17072
17357
|
if (command === void 0) return void 0;
|
|
17073
|
-
const shown = command.dataKey === "" ? command.options : [...command.options, FIELDS];
|
|
17074
17358
|
return [
|
|
17075
17359
|
`adiff ${command.name}`,
|
|
17076
17360
|
"",
|
|
17077
17361
|
command.about,
|
|
17078
17362
|
"",
|
|
17363
|
+
FOR[command.audience],
|
|
17364
|
+
"",
|
|
17079
17365
|
"Usage",
|
|
17080
17366
|
` ${usageOf(command)}`,
|
|
17081
|
-
...command.addresses === "review" ? ["", "
|
|
17367
|
+
...command.addresses === "review" ? ["", "Name the review with --worktree, or with --repo and --branch. With neither, the review is the worktree this command is run in."] : [],
|
|
17082
17368
|
"",
|
|
17083
17369
|
"Options",
|
|
17084
|
-
...
|
|
17370
|
+
...command.options.map(option),
|
|
17085
17371
|
"",
|
|
17086
17372
|
"Example",
|
|
17087
17373
|
` ${command.example}`,
|
|
@@ -26793,7 +27079,7 @@ const answer = fn("Main.answer")(function* (options, body) {
|
|
|
26793
27079
|
const fields = fieldsOf(options);
|
|
26794
27080
|
const strange = strangeField(body, fields);
|
|
26795
27081
|
if (strange !== void 0) return yield* new UnknownField(strange);
|
|
26796
|
-
const narrowed = Object.fromEntries(Object.entries(body).map(([key, value]) => [key, narrow(value, fields)]));
|
|
27082
|
+
const narrowed = onlyOk(fields) ? {} : Object.fromEntries(Object.entries(body).map(([key, value]) => [key, narrow(value, fields)]));
|
|
26797
27083
|
return yield* (yield* Replies).say(JSON.stringify({
|
|
26798
27084
|
ok: true,
|
|
26799
27085
|
...narrowed
|
|
@@ -26808,6 +27094,15 @@ const readingIn = fn("Main.readingIn")(function* (options) {
|
|
|
26808
27094
|
const worktreeNamed = fn("Main.worktreeNamed")(function* (options) {
|
|
26809
27095
|
return yield* worktreeAt(yield* required(options, "worktree"));
|
|
26810
27096
|
});
|
|
27097
|
+
const commentIn = fn("Main.commentIn")(function* (worktree, options, name = "id") {
|
|
27098
|
+
return yield* idStarting$2(worktree, yield* required(options, name));
|
|
27099
|
+
});
|
|
27100
|
+
const draftIn = fn("Main.draftIn")(function* (worktree, options) {
|
|
27101
|
+
return yield* idStarting(worktree, yield* required(options, "id"));
|
|
27102
|
+
});
|
|
27103
|
+
const remarkIn = fn("Main.remarkIn")(function* (worktree, options) {
|
|
27104
|
+
return yield* idStarting$1(worktree, yield* required(options, "id"));
|
|
27105
|
+
});
|
|
26811
27106
|
const stamp = (options) => options["at"] ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
26812
27107
|
const branchList = fn("Main.branchList")(function* (options) {
|
|
26813
27108
|
const branches = yield* list$5(yield* required(options, "repo"), options["base"]);
|
|
@@ -26861,8 +27156,9 @@ const draftAdd = fn("Main.draftAdd")(function* (options) {
|
|
|
26861
27156
|
yield* answer(options, { draft });
|
|
26862
27157
|
});
|
|
26863
27158
|
const draftEdit = fn("Main.draftEdit")(function* (options) {
|
|
26864
|
-
const
|
|
26865
|
-
|
|
27159
|
+
const worktree = yield* worktreeIn(options);
|
|
27160
|
+
const draft = yield* edit(worktree, {
|
|
27161
|
+
id: yield* draftIn(worktree, options),
|
|
26866
27162
|
body: yield* text$1(options, "body"),
|
|
26867
27163
|
at: stamp(options),
|
|
26868
27164
|
by: "agent"
|
|
@@ -26870,7 +27166,8 @@ const draftEdit = fn("Main.draftEdit")(function* (options) {
|
|
|
26870
27166
|
yield* answer(options, { draft });
|
|
26871
27167
|
});
|
|
26872
27168
|
const draftDrop = fn("Main.draftDrop")(function* (options) {
|
|
26873
|
-
const
|
|
27169
|
+
const worktree = yield* worktreeIn(options);
|
|
27170
|
+
const dropped = yield* drop(worktree, yield* draftIn(worktree, options));
|
|
26874
27171
|
yield* answer(options, { dropped });
|
|
26875
27172
|
});
|
|
26876
27173
|
const draftSend = fn("Main.draftSend")(function* (options) {
|
|
@@ -26878,30 +27175,42 @@ const draftSend = fn("Main.draftSend")(function* (options) {
|
|
|
26878
27175
|
yield* answer(options, { dispatched });
|
|
26879
27176
|
});
|
|
26880
27177
|
const commentReply = fn("Main.commentReply")(function* (options) {
|
|
26881
|
-
const
|
|
26882
|
-
|
|
27178
|
+
const worktree = yield* worktreeIn(options);
|
|
27179
|
+
const batch = yield* reply(worktree, {
|
|
27180
|
+
to: yield* commentIn(worktree, options, "to"),
|
|
26883
27181
|
body: yield* text$1(options, "body"),
|
|
26884
27182
|
id: options["id"] ?? randomUUID(),
|
|
26885
27183
|
at: stamp(options)
|
|
26886
27184
|
});
|
|
26887
27185
|
yield* answer(options, { batch });
|
|
26888
27186
|
});
|
|
26889
|
-
const NOTHING_WAITING = "No comment is waiting. Pass --
|
|
27187
|
+
const NOTHING_WAITING = "No comment is waiting. Pass --wait <seconds> to block until a new one arrives, and answer what you collect with `adiff comment answer --worktree . --id <id> --body '…'`.";
|
|
27188
|
+
const WAIT_REPLACED = "A newer wait on this worktree took over, so this wait ended and handed over nothing. Leave this wait ended: the newer wait is the one listening.";
|
|
27189
|
+
const noteOn = (waited) => {
|
|
27190
|
+
if (waited.replaced) return {
|
|
27191
|
+
replaced: true,
|
|
27192
|
+
hint: WAIT_REPLACED
|
|
27193
|
+
};
|
|
27194
|
+
return waited.comments.length === 0 ? { hint: NOTHING_WAITING } : {};
|
|
27195
|
+
};
|
|
26890
27196
|
const commentTake = fn("Main.commentTake")(function* (options) {
|
|
26891
27197
|
const worktree = yield* required(options, "worktree");
|
|
26892
27198
|
const wait = yield* seconds(options, "wait");
|
|
26893
|
-
const
|
|
26894
|
-
|
|
26895
|
-
|
|
27199
|
+
const waited = wait > 0 ? yield* awaitTaken(worktree, Date.now() + wait * WAIT_UNIT, randomUUID()) : {
|
|
27200
|
+
comments: yield* take(worktree),
|
|
27201
|
+
replaced: false
|
|
27202
|
+
};
|
|
27203
|
+
const branch = yield* nameAt(worktree);
|
|
26896
27204
|
yield* answer(options, {
|
|
26897
|
-
comments,
|
|
26898
|
-
branch
|
|
26899
|
-
...
|
|
27205
|
+
comments: waited.comments,
|
|
27206
|
+
branch,
|
|
27207
|
+
...noteOn(waited)
|
|
26900
27208
|
});
|
|
26901
27209
|
});
|
|
26902
27210
|
const commentAnswer = fn("Main.commentAnswer")(function* (options) {
|
|
26903
|
-
const
|
|
26904
|
-
|
|
27211
|
+
const worktree = yield* worktreeNamed(options);
|
|
27212
|
+
const report = yield* answer$3(worktree, {
|
|
27213
|
+
id: yield* commentIn(worktree, options),
|
|
26905
27214
|
body: yield* text$1(options, "body"),
|
|
26906
27215
|
asks: options["question"] !== void 0,
|
|
26907
27216
|
at: stamp(options),
|
|
@@ -26910,9 +27219,10 @@ const commentAnswer = fn("Main.commentAnswer")(function* (options) {
|
|
|
26910
27219
|
yield* answer(options, { answered: report.answered });
|
|
26911
27220
|
});
|
|
26912
27221
|
const commentDoing = fn("Main.commentDoing")(function* (options) {
|
|
26913
|
-
const
|
|
26914
|
-
|
|
26915
|
-
|
|
27222
|
+
const worktree = yield* worktreeNamed(options);
|
|
27223
|
+
const report = yield* doing(worktree, {
|
|
27224
|
+
id: yield* commentIn(worktree, options),
|
|
27225
|
+
body: options["body"] === void 0 ? DOING_BY_DEFAULT : yield* oneLine(options, "body"),
|
|
26916
27226
|
at: stamp(options)
|
|
26917
27227
|
});
|
|
26918
27228
|
yield* answer(options, report);
|
|
@@ -26922,8 +27232,9 @@ const remarkList = fn("Main.remarkList")(function* (options) {
|
|
|
26922
27232
|
yield* answer(options, { remarks });
|
|
26923
27233
|
});
|
|
26924
27234
|
const remarkAccept = fn("Main.remarkAccept")(function* (options) {
|
|
26925
|
-
const
|
|
26926
|
-
|
|
27235
|
+
const reading = yield* readingIn(options);
|
|
27236
|
+
const report = yield* accept(reading, {
|
|
27237
|
+
id: yield* remarkIn(reading.worktree, options),
|
|
26927
27238
|
body: options["body"] === void 0 ? void 0 : yield* text$1(options, "body"),
|
|
26928
27239
|
at: stamp(options),
|
|
26929
27240
|
commentId: options["comment"] ?? randomUUID()
|
|
@@ -26931,15 +27242,18 @@ const remarkAccept = fn("Main.remarkAccept")(function* (options) {
|
|
|
26931
27242
|
yield* answer(options, report);
|
|
26932
27243
|
});
|
|
26933
27244
|
const remarkReply = fn("Main.remarkReply")(function* (options) {
|
|
26934
|
-
const
|
|
27245
|
+
const worktree = yield* worktreeIn(options);
|
|
27246
|
+
const report = yield* answer$1(yield* required(options, "repo"), worktree, yield* remarkIn(worktree, options), yield* text$1(options, "body"));
|
|
26935
27247
|
yield* answer(options, { answered: report.answered });
|
|
26936
27248
|
});
|
|
26937
27249
|
const remarkDismiss = fn("Main.remarkDismiss")(function* (options) {
|
|
26938
|
-
const
|
|
27250
|
+
const worktree = yield* worktreeIn(options);
|
|
27251
|
+
const report = yield* dismiss(worktree, yield* remarkIn(worktree, options), stamp(options));
|
|
26939
27252
|
yield* answer(options, { dismissed: report.dismissed });
|
|
26940
27253
|
});
|
|
26941
27254
|
const remarkRestore = fn("Main.remarkRestore")(function* (options) {
|
|
26942
|
-
const
|
|
27255
|
+
const worktree = yield* worktreeIn(options);
|
|
27256
|
+
const report = yield* restore(worktree, yield* remarkIn(worktree, options));
|
|
26943
27257
|
yield* answer(options, { restored: report.restored });
|
|
26944
27258
|
});
|
|
26945
27259
|
const commentList = fn("Main.commentList")(function* (options) {
|
|
@@ -26957,7 +27271,8 @@ const resolveRead = fn("Main.resolveRead")(function* (options) {
|
|
|
26957
27271
|
yield* answer(options, { settled: report.settled });
|
|
26958
27272
|
});
|
|
26959
27273
|
const commentRead = fn("Main.commentRead")(function* (options) {
|
|
26960
|
-
const
|
|
27274
|
+
const worktree = yield* worktreeIn(options);
|
|
27275
|
+
const report = yield* markRead(worktree, yield* commentIn(worktree, options));
|
|
26961
27276
|
yield* answer(options, {
|
|
26962
27277
|
read: report.id,
|
|
26963
27278
|
unread: report.unread
|
|
@@ -26995,19 +27310,23 @@ const layersAsk = fn("Main.layersAsk")(function* (options) {
|
|
|
26995
27310
|
});
|
|
26996
27311
|
const commentResolve = fn("Main.commentResolve")(function* (options) {
|
|
26997
27312
|
if (options["read"] !== void 0) return yield* resolveRead(options);
|
|
26998
|
-
const
|
|
27313
|
+
const worktree = yield* worktreeIn(options);
|
|
27314
|
+
const report = yield* settle(worktree, yield* commentIn(worktree, options), stamp(options));
|
|
26999
27315
|
return yield* answer(options, { settled: report.settled });
|
|
27000
27316
|
});
|
|
27001
27317
|
const commentRemove = fn("Main.commentRemove")(function* (options) {
|
|
27002
|
-
const
|
|
27318
|
+
const worktree = yield* worktreeIn(options);
|
|
27319
|
+
const report = yield* remove(worktree, yield* commentIn(worktree, options), stamp(options));
|
|
27003
27320
|
yield* answer(options, { removed: report.removed });
|
|
27004
27321
|
});
|
|
27005
27322
|
const commentRestore = fn("Main.commentRestore")(function* (options) {
|
|
27006
|
-
const
|
|
27323
|
+
const worktree = yield* worktreeIn(options);
|
|
27324
|
+
const report = yield* restore$1(worktree, yield* commentIn(worktree, options));
|
|
27007
27325
|
yield* answer(options, { restored: report.restored });
|
|
27008
27326
|
});
|
|
27009
27327
|
const commentReopen = fn("Main.commentReopen")(function* (options) {
|
|
27010
|
-
const
|
|
27328
|
+
const worktree = yield* worktreeIn(options);
|
|
27329
|
+
const report = yield* unsettle(worktree, yield* commentIn(worktree, options));
|
|
27011
27330
|
yield* answer(options, { reopened: report.unsettled });
|
|
27012
27331
|
});
|
|
27013
27332
|
const vouched = fn("Main.vouched")(function* (options) {
|
|
@@ -27049,7 +27368,7 @@ const documentAt = fn("Main.documentAt")(function* (source) {
|
|
|
27049
27368
|
});
|
|
27050
27369
|
});
|
|
27051
27370
|
const layersSet = fn("Main.layersSet")(function* (options) {
|
|
27052
|
-
const document = yield* documentAt(yield* required(options, "
|
|
27371
|
+
const document = yield* documentAt(yield* required(options, "file"));
|
|
27053
27372
|
const layers = yield* set(yield* worktreeNamed(options), document, stamp(options));
|
|
27054
27373
|
yield* answer(options, { layers });
|
|
27055
27374
|
});
|
|
@@ -27165,9 +27484,15 @@ const unknown = (name) => {
|
|
|
27165
27484
|
verbs
|
|
27166
27485
|
});
|
|
27167
27486
|
const didYouMean = nearestCommand(name);
|
|
27168
|
-
|
|
27487
|
+
if (didYouMean === void 0) return new UnknownCommand({ name });
|
|
27488
|
+
const beside = verbsUnder(name.split(" ")[0] ?? "");
|
|
27489
|
+
return beside.length === 0 ? new UnknownCommand({
|
|
27169
27490
|
name,
|
|
27170
27491
|
didYouMean
|
|
27492
|
+
}) : new UnknownCommand({
|
|
27493
|
+
name,
|
|
27494
|
+
didYouMean,
|
|
27495
|
+
verbs: beside
|
|
27171
27496
|
});
|
|
27172
27497
|
};
|
|
27173
27498
|
const byBranch = fn("Main.byBranch")(function* (options, repo, branch) {
|
|
@@ -27176,6 +27501,10 @@ const byBranch = fn("Main.byBranch")(function* (options, repo, branch) {
|
|
|
27176
27501
|
worktree: (yield* find(repo, branch)).path
|
|
27177
27502
|
};
|
|
27178
27503
|
});
|
|
27504
|
+
const byHere = (options, repo, branch) => byBranch({
|
|
27505
|
+
...options,
|
|
27506
|
+
repo
|
|
27507
|
+
}, repo, branch);
|
|
27179
27508
|
const byWorktree = fn("Main.byWorktree")(function* (options, worktree) {
|
|
27180
27509
|
return {
|
|
27181
27510
|
...options,
|
|
@@ -27183,14 +27512,22 @@ const byWorktree = fn("Main.byWorktree")(function* (options, worktree) {
|
|
|
27183
27512
|
branch: yield* nameAt(worktree)
|
|
27184
27513
|
};
|
|
27185
27514
|
});
|
|
27515
|
+
const standingIn = fn("Main.standingIn")(function* (options) {
|
|
27516
|
+
const standing = worktreeAbove(process.cwd());
|
|
27517
|
+
const branch = options["branch"];
|
|
27518
|
+
if (standing === void 0 || options["repo"] !== void 0) return yield* new MissingOption({ option: addressing[0]?.name ?? "worktree" });
|
|
27519
|
+
return branch === void 0 ? yield* byWorktree({
|
|
27520
|
+
...options,
|
|
27521
|
+
worktree: standing
|
|
27522
|
+
}, standing) : yield* byHere(options, yield* repoOf(standing), branch);
|
|
27523
|
+
});
|
|
27186
27524
|
const addressOf = fn("Main.addressOf")(function* (name, options) {
|
|
27187
27525
|
if (findCommand(name)?.addresses !== "review") return options;
|
|
27188
27526
|
const repo = options["repo"];
|
|
27189
27527
|
const branch = options["branch"];
|
|
27190
27528
|
if (repo !== void 0 && branch !== void 0) return yield* byBranch(options, repo, branch);
|
|
27191
27529
|
const worktree = options["worktree"];
|
|
27192
|
-
|
|
27193
|
-
return yield* new MissingOption({ option: addressing[0]?.name ?? "worktree" });
|
|
27530
|
+
return worktree === void 0 ? yield* standingIn(options) : yield* byWorktree(options, worktree);
|
|
27194
27531
|
});
|
|
27195
27532
|
const RESUME_ADVICE = "Nothing has been opened here yet. Run `adiff review open --repo .` and pick a branch.";
|
|
27196
27533
|
const resume = fn("Main.resume")(function* (options) {
|
|
@@ -27235,7 +27572,66 @@ const wanting = (name) => (error) => {
|
|
|
27235
27572
|
usage: usageOf(command)
|
|
27236
27573
|
}));
|
|
27237
27574
|
};
|
|
27238
|
-
const
|
|
27575
|
+
const stillTaken = (name, options) => {
|
|
27576
|
+
const removed = removedIn(name, Object.keys(options));
|
|
27577
|
+
if (removed !== void 0) return fail(new RemovedOption({
|
|
27578
|
+
option: removed.option,
|
|
27579
|
+
command: name,
|
|
27580
|
+
reason: removed.reason
|
|
27581
|
+
}));
|
|
27582
|
+
const renames = renamedIn(name, Object.keys(options));
|
|
27583
|
+
const retired = new Set(retiredIn(name, Object.keys(options)));
|
|
27584
|
+
return succeed$1(Object.fromEntries(Object.entries(options).flatMap(([key, value]) => {
|
|
27585
|
+
const to = renames[key];
|
|
27586
|
+
if (to !== void 0) return [[to, value]];
|
|
27587
|
+
return retired.has(key) ? [] : [[key, value]];
|
|
27588
|
+
})));
|
|
27589
|
+
};
|
|
27590
|
+
const strange = (command) => (error) => {
|
|
27591
|
+
const didYouMean = nearestOption(command, error.option);
|
|
27592
|
+
return fail(new UnknownOption({
|
|
27593
|
+
option: error.option,
|
|
27594
|
+
known: optionsOf(command),
|
|
27595
|
+
command: command.name,
|
|
27596
|
+
usage: usageOf(command),
|
|
27597
|
+
...didYouMean === void 0 ? {} : { didYouMean }
|
|
27598
|
+
}));
|
|
27599
|
+
};
|
|
27600
|
+
const withBareId = fn("Main.withBareId")(function* (command, options, bare) {
|
|
27601
|
+
const [first] = bare;
|
|
27602
|
+
if (first === void 0) return options;
|
|
27603
|
+
if (!takesId(command)) return yield* new UnexpectedArgument({
|
|
27604
|
+
argument: first,
|
|
27605
|
+
command: command.name,
|
|
27606
|
+
usage: usageOf(command)
|
|
27607
|
+
});
|
|
27608
|
+
if (bare.length > 1) return yield* new SeveralIds({
|
|
27609
|
+
ids: bare,
|
|
27610
|
+
command: command.name
|
|
27611
|
+
});
|
|
27612
|
+
const id = options["id"];
|
|
27613
|
+
if (id !== void 0) return yield* new IdGivenTwice({
|
|
27614
|
+
bare: first,
|
|
27615
|
+
id,
|
|
27616
|
+
command: command.name
|
|
27617
|
+
});
|
|
27618
|
+
return {
|
|
27619
|
+
...options,
|
|
27620
|
+
id: first
|
|
27621
|
+
};
|
|
27622
|
+
});
|
|
27623
|
+
const optionsAsked = fn("Main.optionsAsked")(function* (command, args) {
|
|
27624
|
+
const rest = args.slice(command.name.split(" ").length);
|
|
27625
|
+
const valued = valuedIn(command.name);
|
|
27626
|
+
const kept = yield* stillTaken(command.name, optionsFrom(rest, valued));
|
|
27627
|
+
const options = yield* onlyKnown(kept, knownIn(command.name)).pipe(catchTag("UnknownOption", strange(command)));
|
|
27628
|
+
return yield* withBareId(command, options, bareIn(rest, valued));
|
|
27629
|
+
});
|
|
27630
|
+
const run = (name, args) => {
|
|
27631
|
+
const command = findCommand(name);
|
|
27632
|
+
if (command === void 0) return fail(unknown(name));
|
|
27633
|
+
return optionsAsked(command, args).pipe(flatMap((options) => dispatch(name, options)), catchTag("MissingOption", wanting(name)));
|
|
27634
|
+
};
|
|
27239
27635
|
const leading = (argv) => {
|
|
27240
27636
|
const stop = argv.findIndex((token) => token.startsWith("-"));
|
|
27241
27637
|
return stop === -1 ? argv : argv.slice(0, stop);
|
|
@@ -27247,8 +27643,8 @@ const nameOf = (argv) => {
|
|
|
27247
27643
|
return words.length > 1 ? pair : words[0] ?? "";
|
|
27248
27644
|
};
|
|
27249
27645
|
const storeRoot = () => process.env["ADIFF_ROOT"] ?? defaultRoot();
|
|
27250
|
-
const folderOf = fn("Main.folderOf")(function* (
|
|
27251
|
-
const options = yield* addressOf("comment list",
|
|
27646
|
+
const folderOf = fn("Main.folderOf")(function* (args) {
|
|
27647
|
+
const options = yield* addressOf("comment list", optionsFrom(args, valuedIn("comment list")));
|
|
27252
27648
|
const worktree = yield* find(yield* required(options, "repo"), yield* required(options, "branch"));
|
|
27253
27649
|
return branchDir(storeRoot(), yield* branchKeyOf(worktree.path));
|
|
27254
27650
|
});
|
|
@@ -27291,8 +27687,13 @@ const reportFailure = (cause) => sync(() => {
|
|
|
27291
27687
|
process.stderr.write(`${reported.line}\n`);
|
|
27292
27688
|
process.exitCode = reported.exit;
|
|
27293
27689
|
});
|
|
27294
|
-
const
|
|
27295
|
-
const started =
|
|
27690
|
+
const called = opening ? "review open" : nameOf(argv);
|
|
27691
|
+
const started = called === "serve" ? serving() : run(called, opening ? [
|
|
27692
|
+
"review",
|
|
27693
|
+
"open",
|
|
27694
|
+
"--repo",
|
|
27695
|
+
"."
|
|
27696
|
+
] : argv);
|
|
27296
27697
|
runFork(started.pipe(provide(layer), catchCause(reportFailure)));
|
|
27297
27698
|
//#endregion
|
|
27298
27699
|
export {};
|