@eliya-oss/agent-diff 0.1.0-alpha.10 → 0.1.0-alpha.12
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 +12 -0
- package/dist/main.js +290 -32
- package/package.json +1 -1
- package/skills/adiff/SKILL.md +27 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- An agent can answer a comment, and a reviewer can settle the thread.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- r reads the branch again, so the agent's newest work appears without leaving the review.
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.10
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -10795,7 +10795,8 @@ var StoreUnreadable = class extends TaggedError("StoreUnreadable") {};
|
|
|
10795
10795
|
const emptyBranchState = {
|
|
10796
10796
|
vouches: {},
|
|
10797
10797
|
consumed: 0,
|
|
10798
|
-
pending: []
|
|
10798
|
+
pending: [],
|
|
10799
|
+
settled: {}
|
|
10799
10800
|
};
|
|
10800
10801
|
//#endregion
|
|
10801
10802
|
//#region src/service/store/paths.ts
|
|
@@ -10804,6 +10805,7 @@ const slugOf = (worktreePath) => worktreePath.replace(NON_SLUG, "-");
|
|
|
10804
10805
|
const defaultRoot = () => join(homedir(), ".adiff");
|
|
10805
10806
|
const branchDir = (root, worktreePath) => join(root, "branches", slugOf(worktreePath));
|
|
10806
10807
|
const inboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "inbox.jsonl");
|
|
10808
|
+
const outboxPath = (root, worktreePath) => join(branchDir(root, worktreePath), "outbox.jsonl");
|
|
10807
10809
|
const statePath = (root, worktreePath) => join(branchDir(root, worktreePath), "state.json");
|
|
10808
10810
|
const layersPath = (root, worktreePath) => join(branchDir(root, worktreePath), "layers.json");
|
|
10809
10811
|
const reportsDir = (root) => join(root, "reports");
|
|
@@ -10831,6 +10833,7 @@ const readOptional = fn("Store.readOptional")(function* (path) {
|
|
|
10831
10833
|
});
|
|
10832
10834
|
const missing = succeed(none());
|
|
10833
10835
|
const parseBatches = (raw) => raw.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
|
|
10836
|
+
const parseAnswers = (raw) => raw.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
|
|
10834
10837
|
const parseState = (raw) => ({
|
|
10835
10838
|
...emptyBranchState,
|
|
10836
10839
|
...JSON.parse(raw)
|
|
@@ -10858,6 +10861,40 @@ const cursorOps = (state, saveState, inbox) => {
|
|
|
10858
10861
|
})
|
|
10859
10862
|
};
|
|
10860
10863
|
};
|
|
10864
|
+
const reportOps = (root) => fn("Store.saveReport")(function* (stamp, text) {
|
|
10865
|
+
const path = reportPath(root, stamp);
|
|
10866
|
+
yield* ensureDir(reportsDir(root));
|
|
10867
|
+
yield* tryPromise({
|
|
10868
|
+
try: () => writeFile(path, text, "utf8"),
|
|
10869
|
+
catch: (cause) => new StoreUnwritable({
|
|
10870
|
+
path,
|
|
10871
|
+
reason: String(cause)
|
|
10872
|
+
})
|
|
10873
|
+
});
|
|
10874
|
+
return path;
|
|
10875
|
+
});
|
|
10876
|
+
const answerOps = (root) => {
|
|
10877
|
+
return {
|
|
10878
|
+
answer: fn("Store.answer")(function* (worktreePath, entry) {
|
|
10879
|
+
const path = outboxPath(root, worktreePath);
|
|
10880
|
+
yield* ensureDir(branchDir(root, worktreePath));
|
|
10881
|
+
yield* tryPromise({
|
|
10882
|
+
try: () => appendFile(path, `${JSON.stringify(entry)}\n`, "utf8"),
|
|
10883
|
+
catch: (cause) => new StoreUnwritable({
|
|
10884
|
+
path,
|
|
10885
|
+
reason: String(cause)
|
|
10886
|
+
})
|
|
10887
|
+
});
|
|
10888
|
+
}),
|
|
10889
|
+
answers: fn("Store.answers")(function* (worktreePath) {
|
|
10890
|
+
const raw = yield* readOptional(outboxPath(root, worktreePath));
|
|
10891
|
+
return match$2(raw, {
|
|
10892
|
+
onNone: () => [],
|
|
10893
|
+
onSome: parseAnswers
|
|
10894
|
+
});
|
|
10895
|
+
})
|
|
10896
|
+
};
|
|
10897
|
+
};
|
|
10861
10898
|
const layersOps = (root) => {
|
|
10862
10899
|
return {
|
|
10863
10900
|
layers: fn("Store.layers")(function* (worktreePath) {
|
|
@@ -10914,18 +10951,6 @@ const makeStore = (root) => {
|
|
|
10914
10951
|
})
|
|
10915
10952
|
});
|
|
10916
10953
|
});
|
|
10917
|
-
const saveReport = fn("Store.saveReport")(function* (stamp, text) {
|
|
10918
|
-
const path = reportPath(root, stamp);
|
|
10919
|
-
yield* ensureDir(reportsDir(root));
|
|
10920
|
-
yield* tryPromise({
|
|
10921
|
-
try: () => writeFile(path, text, "utf8"),
|
|
10922
|
-
catch: (cause) => new StoreUnwritable({
|
|
10923
|
-
path,
|
|
10924
|
-
reason: String(cause)
|
|
10925
|
-
})
|
|
10926
|
-
});
|
|
10927
|
-
return path;
|
|
10928
|
-
});
|
|
10929
10954
|
const cursors = cursorOps(state, saveState, inbox);
|
|
10930
10955
|
return {
|
|
10931
10956
|
root,
|
|
@@ -10933,7 +10958,8 @@ const makeStore = (root) => {
|
|
|
10933
10958
|
inbox,
|
|
10934
10959
|
state,
|
|
10935
10960
|
saveState,
|
|
10936
|
-
saveReport,
|
|
10961
|
+
saveReport: reportOps(root),
|
|
10962
|
+
...answerOps(root),
|
|
10937
10963
|
...layersOps(root),
|
|
10938
10964
|
...cursors
|
|
10939
10965
|
};
|
|
@@ -10944,6 +10970,7 @@ storeAt(defaultRoot());
|
|
|
10944
10970
|
//#region src/cli/error.ts
|
|
10945
10971
|
var UnknownBranch = class extends TaggedError("UnknownBranch") {};
|
|
10946
10972
|
var UnknownFile = class extends TaggedError("UnknownFile") {};
|
|
10973
|
+
var UnknownComment = class extends TaggedError("UnknownComment") {};
|
|
10947
10974
|
var UnselectableRange = class extends TaggedError("UnselectableRange") {};
|
|
10948
10975
|
var UnknownCommand = class extends TaggedError("UnknownCommand") {};
|
|
10949
10976
|
var MissingOption = class extends TaggedError("MissingOption") {};
|
|
@@ -11095,6 +11122,7 @@ const listPending = fn("Cli.listPending")(function* (repo, branch) {
|
|
|
11095
11122
|
const store = yield* Store;
|
|
11096
11123
|
const worktree = yield* findBranch(repo, branch);
|
|
11097
11124
|
return (yield* store.state(worktree.path)).pending.map((entry) => ({
|
|
11125
|
+
id: entry.id,
|
|
11098
11126
|
file: entry.anchor.path,
|
|
11099
11127
|
side: entry.anchor.side,
|
|
11100
11128
|
start: entry.anchor.start,
|
|
@@ -11102,16 +11130,26 @@ const listPending = fn("Cli.listPending")(function* (repo, branch) {
|
|
|
11102
11130
|
body: entry.body
|
|
11103
11131
|
}));
|
|
11104
11132
|
});
|
|
11105
|
-
const
|
|
11106
|
-
|
|
11107
|
-
const
|
|
11108
|
-
return
|
|
11133
|
+
const bodyOf = (entry) => entry.body;
|
|
11134
|
+
const sentOf = (comment, spoken, settled) => {
|
|
11135
|
+
const mine = spoken.filter((entry) => entry.comment === comment.id);
|
|
11136
|
+
return {
|
|
11109
11137
|
file: comment.file,
|
|
11110
11138
|
side: comment.side,
|
|
11111
11139
|
start: comment.start,
|
|
11112
11140
|
end: comment.end,
|
|
11113
|
-
body: comment.body
|
|
11114
|
-
|
|
11141
|
+
body: comment.body,
|
|
11142
|
+
settled: Object.hasOwn(settled, comment.id),
|
|
11143
|
+
asks: mine.at(-1)?.asks === true,
|
|
11144
|
+
answers: mine.map(bodyOf)
|
|
11145
|
+
};
|
|
11146
|
+
};
|
|
11147
|
+
const listSent = fn("Cli.listSent")(function* (repo, branch) {
|
|
11148
|
+
const store = yield* Store;
|
|
11149
|
+
const worktree = yield* findBranch(repo, branch);
|
|
11150
|
+
const spoken = yield* store.answers(worktree.path);
|
|
11151
|
+
const current = yield* store.state(worktree.path);
|
|
11152
|
+
return flatten(yield* store.inbox(worktree.path)).map((comment) => sentOf(comment, spoken, current.settled));
|
|
11115
11153
|
});
|
|
11116
11154
|
const submitReview = fn("Cli.submitReview")(function* (repo, branch, id, at) {
|
|
11117
11155
|
const store = yield* Store;
|
|
@@ -11179,6 +11217,7 @@ const listPatches = fn("Cli.listPatches")(function* (repo, branch, context = CON
|
|
|
11179
11217
|
return parsePatches(yield* git.diff(worktree, context));
|
|
11180
11218
|
});
|
|
11181
11219
|
const flatten = (batches) => batches.flatMap((batch) => batch.comments.map((comment) => ({
|
|
11220
|
+
id: comment.id,
|
|
11182
11221
|
at: batch.at,
|
|
11183
11222
|
head: batch.head,
|
|
11184
11223
|
file: comment.anchor.path,
|
|
@@ -11472,6 +11511,76 @@ const listLayers = fn("Cli.listLayers")(function* (repo, branch) {
|
|
|
11472
11511
|
};
|
|
11473
11512
|
});
|
|
11474
11513
|
//#endregion
|
|
11514
|
+
//#region src/cli/threads.ts
|
|
11515
|
+
const stateOf$1 = (answers, isSettled) => {
|
|
11516
|
+
if (isSettled) return "done";
|
|
11517
|
+
const last = answers.at(-1);
|
|
11518
|
+
if (last === void 0) return "submitted";
|
|
11519
|
+
return last.asks ? "question" : "answered";
|
|
11520
|
+
};
|
|
11521
|
+
const spoken$1 = (entry) => ({
|
|
11522
|
+
body: entry.body,
|
|
11523
|
+
at: entry.at,
|
|
11524
|
+
asks: entry.asks
|
|
11525
|
+
});
|
|
11526
|
+
const threadOf = (comment, batch, reading) => {
|
|
11527
|
+
const mine = reading.answers.filter((entry) => entry.comment === comment.id);
|
|
11528
|
+
return {
|
|
11529
|
+
id: comment.id,
|
|
11530
|
+
file: comment.anchor.path,
|
|
11531
|
+
side: comment.anchor.side,
|
|
11532
|
+
start: comment.anchor.start,
|
|
11533
|
+
end: comment.anchor.end,
|
|
11534
|
+
body: comment.body,
|
|
11535
|
+
state: stateOf$1(mine, Object.hasOwn(reading.settled, comment.id)),
|
|
11536
|
+
stale: batch.head !== reading.head,
|
|
11537
|
+
answers: mine.map(spoken$1)
|
|
11538
|
+
};
|
|
11539
|
+
};
|
|
11540
|
+
const threadsIn = (batches, reading) => batches.flatMap((batch) => batch.comments.map((comment) => threadOf(comment, batch, reading)));
|
|
11541
|
+
const idsIn = (batches) => batches.flatMap((batch) => batch.comments.map((comment) => comment.id));
|
|
11542
|
+
const isKnown = fn("Cli.isKnown")(function* (worktreePath, id) {
|
|
11543
|
+
const store = yield* Store;
|
|
11544
|
+
return idsIn(yield* store.inbox(worktreePath)).includes(id);
|
|
11545
|
+
});
|
|
11546
|
+
const listThreads = fn("Cli.listThreads")(function* (repo, branch) {
|
|
11547
|
+
const store = yield* Store;
|
|
11548
|
+
const worktree = yield* findBranch(repo, branch);
|
|
11549
|
+
const current = yield* store.state(worktree.path);
|
|
11550
|
+
return threadsIn(yield* store.inbox(worktree.path), {
|
|
11551
|
+
answers: yield* store.answers(worktree.path),
|
|
11552
|
+
settled: current.settled,
|
|
11553
|
+
head: worktree.head
|
|
11554
|
+
});
|
|
11555
|
+
});
|
|
11556
|
+
const answerComment = fn("Cli.answerComment")(function* (request) {
|
|
11557
|
+
const store = yield* Store;
|
|
11558
|
+
const worktree = yield* worktreeAt(request.worktree);
|
|
11559
|
+
if (!(yield* isKnown(worktree.path, request.id))) return yield* new UnknownComment({ id: request.id });
|
|
11560
|
+
yield* store.answer(worktree.path, {
|
|
11561
|
+
comment: request.id,
|
|
11562
|
+
body: request.body,
|
|
11563
|
+
head: worktree.head,
|
|
11564
|
+
asks: request.asks,
|
|
11565
|
+
at: request.at
|
|
11566
|
+
});
|
|
11567
|
+
return { answered: (yield* store.answers(worktree.path)).filter((entry) => entry.comment === request.id).length };
|
|
11568
|
+
});
|
|
11569
|
+
const settleThread = fn("Cli.settleThread")(function* (repo, branch, id, at) {
|
|
11570
|
+
const store = yield* Store;
|
|
11571
|
+
const worktree = yield* findBranch(repo, branch);
|
|
11572
|
+
if (!(yield* isKnown(worktree.path, id))) return yield* new UnknownComment({ id });
|
|
11573
|
+
const current = yield* store.state(worktree.path);
|
|
11574
|
+
yield* store.saveState(worktree.path, {
|
|
11575
|
+
...current,
|
|
11576
|
+
settled: {
|
|
11577
|
+
...current.settled,
|
|
11578
|
+
[id]: at
|
|
11579
|
+
}
|
|
11580
|
+
});
|
|
11581
|
+
return { settled: id };
|
|
11582
|
+
});
|
|
11583
|
+
//#endregion
|
|
11475
11584
|
//#region src/cli/parse.ts
|
|
11476
11585
|
const optionsFrom = (argv) => {
|
|
11477
11586
|
const options = {};
|
|
@@ -11614,6 +11723,64 @@ const catalog = [
|
|
|
11614
11723
|
dataKey: "comments",
|
|
11615
11724
|
example: "adiff comment take --worktree . --wait 300"
|
|
11616
11725
|
},
|
|
11726
|
+
{
|
|
11727
|
+
name: "comment answer",
|
|
11728
|
+
about: "Say what was done about a comment, or ask the reviewer something back",
|
|
11729
|
+
safety: "write",
|
|
11730
|
+
options: [
|
|
11731
|
+
{
|
|
11732
|
+
name: "worktree",
|
|
11733
|
+
required: true,
|
|
11734
|
+
value: "path",
|
|
11735
|
+
about: "The worktree the comment was written against"
|
|
11736
|
+
},
|
|
11737
|
+
{
|
|
11738
|
+
name: "id",
|
|
11739
|
+
required: true,
|
|
11740
|
+
value: "id",
|
|
11741
|
+
about: "The comment being answered, as `comment take` reported it"
|
|
11742
|
+
},
|
|
11743
|
+
{
|
|
11744
|
+
name: "body",
|
|
11745
|
+
required: true,
|
|
11746
|
+
value: "text",
|
|
11747
|
+
about: "What was done, or what is being asked"
|
|
11748
|
+
},
|
|
11749
|
+
{
|
|
11750
|
+
name: "asks",
|
|
11751
|
+
required: false,
|
|
11752
|
+
value: "flag",
|
|
11753
|
+
about: "The answer needs a reply before the work continues"
|
|
11754
|
+
}
|
|
11755
|
+
],
|
|
11756
|
+
dataKey: "answered",
|
|
11757
|
+
example: "adiff comment answer --worktree . --id c1 --body \"dropped it, and the import with it\""
|
|
11758
|
+
},
|
|
11759
|
+
{
|
|
11760
|
+
name: "comment threads",
|
|
11761
|
+
about: "Every comment on a branch with its answers and whether it is settled",
|
|
11762
|
+
safety: "read",
|
|
11763
|
+
options: [repo, branch],
|
|
11764
|
+
dataKey: "threads",
|
|
11765
|
+
example: "adiff comment threads --repo . --branch add-teammate-invitations"
|
|
11766
|
+
},
|
|
11767
|
+
{
|
|
11768
|
+
name: "comment resolve",
|
|
11769
|
+
about: "Mark a comment settled. Only the reviewer who raised it can",
|
|
11770
|
+
safety: "write",
|
|
11771
|
+
options: [
|
|
11772
|
+
repo,
|
|
11773
|
+
branch,
|
|
11774
|
+
{
|
|
11775
|
+
name: "id",
|
|
11776
|
+
required: true,
|
|
11777
|
+
value: "id",
|
|
11778
|
+
about: "The comment to settle"
|
|
11779
|
+
}
|
|
11780
|
+
],
|
|
11781
|
+
dataKey: "settled",
|
|
11782
|
+
example: "adiff comment resolve --repo . --branch add-teammate-invitations --id c1"
|
|
11783
|
+
},
|
|
11617
11784
|
{
|
|
11618
11785
|
name: "file vouch",
|
|
11619
11786
|
about: "Toggle a file as reviewed. Lapses on its own when the file changes",
|
|
@@ -11738,6 +11905,11 @@ const ADVICE = {
|
|
|
11738
11905
|
suggestion: "No layers has been written for this worktree. Write one with `adiff layers set`.",
|
|
11739
11906
|
retriable: false
|
|
11740
11907
|
},
|
|
11908
|
+
UnknownComment: {
|
|
11909
|
+
exit: 3,
|
|
11910
|
+
suggestion: "No comment carries that id. Ids come from `adiff comment take`; answer a comment it handed you.",
|
|
11911
|
+
retriable: false
|
|
11912
|
+
},
|
|
11741
11913
|
UnselectableRange: {
|
|
11742
11914
|
exit: 2,
|
|
11743
11915
|
suggestion: "Those lines are not in the diff. Check --side: new is the working tree, old is the version being replaced.",
|
|
@@ -12595,6 +12767,14 @@ const commands = [
|
|
|
12595
12767
|
screens: ["review"],
|
|
12596
12768
|
hint: "zoom"
|
|
12597
12769
|
}),
|
|
12770
|
+
command({
|
|
12771
|
+
action: "review.reload",
|
|
12772
|
+
title: "Read the branch again",
|
|
12773
|
+
category: "Review",
|
|
12774
|
+
keys: ["r"],
|
|
12775
|
+
screens: ["review"],
|
|
12776
|
+
hint: "reload"
|
|
12777
|
+
}),
|
|
12598
12778
|
command({
|
|
12599
12779
|
action: "rail.toggle",
|
|
12600
12780
|
title: "Switch between layers and files",
|
|
@@ -13034,6 +13214,7 @@ const transitions = {
|
|
|
13034
13214
|
navOpen: !state.navOpen,
|
|
13035
13215
|
focus: "diff"
|
|
13036
13216
|
}),
|
|
13217
|
+
"review.reload": (state) => state,
|
|
13037
13218
|
"rail.toggle": toggleRail,
|
|
13038
13219
|
"file.vouch": (state) => state,
|
|
13039
13220
|
"file.vouch.next": (state) => state,
|
|
@@ -13143,6 +13324,16 @@ const withVouched = (state, vouched) => ({
|
|
|
13143
13324
|
...state,
|
|
13144
13325
|
vouched
|
|
13145
13326
|
});
|
|
13327
|
+
const restoredTo = (state, path, line) => {
|
|
13328
|
+
const index = state.patches.findIndex((patch) => patch.path === path);
|
|
13329
|
+
const patch = state.patches[index];
|
|
13330
|
+
if (patch === void 0) return state;
|
|
13331
|
+
return withCursorVisible({
|
|
13332
|
+
...state,
|
|
13333
|
+
patchIndex: index,
|
|
13334
|
+
cursor: line === void 0 ? 0 : rowAtSourceLine(patch, line)
|
|
13335
|
+
});
|
|
13336
|
+
};
|
|
13146
13337
|
const withPatches = (state, patches) => ({
|
|
13147
13338
|
...state,
|
|
13148
13339
|
screen: "review",
|
|
@@ -13358,6 +13549,7 @@ const WASH = {
|
|
|
13358
13549
|
}
|
|
13359
13550
|
};
|
|
13360
13551
|
const NOTE_MIN = 24;
|
|
13552
|
+
const ANSWER_MARK = "↳";
|
|
13361
13553
|
const OVERSCAN = 2;
|
|
13362
13554
|
const SIGN_WIDTH = 2;
|
|
13363
13555
|
const SCROLL_ROWS = 3;
|
|
@@ -13587,7 +13779,21 @@ const wrap = (text, room) => {
|
|
|
13587
13779
|
}
|
|
13588
13780
|
return lines;
|
|
13589
13781
|
};
|
|
13590
|
-
const
|
|
13782
|
+
const headOf = (note) => {
|
|
13783
|
+
if (note.settled) return `${marks().sent} settled`;
|
|
13784
|
+
if (note.asks) return `${marks().staged} asked back`;
|
|
13785
|
+
if (note.answers.length > 0) return `${marks().sent} answered`;
|
|
13786
|
+
return note.sent ? `${marks().sent} sent` : `${marks().staged} staged`;
|
|
13787
|
+
};
|
|
13788
|
+
const spokenLines = (body, room) => {
|
|
13789
|
+
return wrap(body.replaceAll("\n", " "), Math.max(NOTE_MIN, room - 2)).map((text, at) => at === 0 ? `${ANSWER_MARK} ${text}` : ` ${text}`);
|
|
13790
|
+
};
|
|
13791
|
+
const answerLines = (note, room) => note.answers.flatMap((body) => spokenLines(body, room));
|
|
13792
|
+
const noteLines = (note, room) => [
|
|
13793
|
+
headOf(note),
|
|
13794
|
+
...note.body.split("\n").flatMap((line) => wrap(line, room)),
|
|
13795
|
+
...answerLines(note, room)
|
|
13796
|
+
];
|
|
13591
13797
|
const noteRows = (note, row, room) => noteLines(note, room).map((line, index) => ({
|
|
13592
13798
|
text: `${marks().rule} ${line}`,
|
|
13593
13799
|
row,
|
|
@@ -13956,9 +14162,23 @@ const notesOf = (comments, path, sent) => comments.filter((entry) => entry.file
|
|
|
13956
14162
|
side: entry.side,
|
|
13957
14163
|
line: entry.end,
|
|
13958
14164
|
body: entry.body,
|
|
13959
|
-
sent
|
|
14165
|
+
sent,
|
|
14166
|
+
settled: entry.settled === true,
|
|
14167
|
+
asks: entry.asks === true,
|
|
14168
|
+
answers: entry.answers ?? []
|
|
13960
14169
|
}));
|
|
13961
14170
|
const notesFor = (state, path) => [...notesOf(state.sent, path, true), ...notesOf(state.pending, path, false)];
|
|
14171
|
+
const keptWithin = (chunks, room) => {
|
|
14172
|
+
const kept = [];
|
|
14173
|
+
let used = 0;
|
|
14174
|
+
for (const chunk of chunks.toReversed()) {
|
|
14175
|
+
const width = chunk.text.length;
|
|
14176
|
+
if (used + width > room) break;
|
|
14177
|
+
kept.unshift(chunk);
|
|
14178
|
+
used += width;
|
|
14179
|
+
}
|
|
14180
|
+
return kept;
|
|
14181
|
+
};
|
|
13962
14182
|
const shortPath = (path) => {
|
|
13963
14183
|
const home = process.env["HOME"] ?? "";
|
|
13964
14184
|
return home.length > 0 && path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
|
@@ -14213,11 +14433,15 @@ var Screen = class {
|
|
|
14213
14433
|
const readout = selectionReadout(state);
|
|
14214
14434
|
this.lead = readout.length === 0 ? 0 : readout.length + 3;
|
|
14215
14435
|
const lead = readout.length === 0 ? [] : [fg(palette.muted)(`${readout} `)];
|
|
14216
|
-
|
|
14436
|
+
if (state.notice.length === 0) return new StyledText([...lead, ...this.chipRow().chunks]);
|
|
14437
|
+
const tail = ` ${state.notice}`;
|
|
14438
|
+
const width = this.footer.width > 0 ? this.footer.width : this.renderer.width;
|
|
14439
|
+
const room = Math.max(0, width - this.lead - tail.length);
|
|
14440
|
+
const chips = keptWithin(this.chipRow().chunks, room);
|
|
14217
14441
|
return new StyledText([
|
|
14218
14442
|
...lead,
|
|
14219
|
-
...
|
|
14220
|
-
|
|
14443
|
+
...chips,
|
|
14444
|
+
fg(palette.attention)(tail)
|
|
14221
14445
|
]);
|
|
14222
14446
|
}
|
|
14223
14447
|
paneRoom() {
|
|
@@ -14650,6 +14874,7 @@ var App = class {
|
|
|
14650
14874
|
"rail.toggle": () => this.commitSynced("rail.toggle"),
|
|
14651
14875
|
"file.vouch": () => this.vouch(false),
|
|
14652
14876
|
"file.vouch.next": () => this.vouch(true),
|
|
14877
|
+
"review.reload": () => this.reloadBranch(),
|
|
14653
14878
|
"pending.open": () => this.openPending(),
|
|
14654
14879
|
"pending.submit": () => this.sendReview(),
|
|
14655
14880
|
"report.open": () => this.commit(reduce(this.measured(), "report.open")),
|
|
@@ -14700,16 +14925,28 @@ var App = class {
|
|
|
14700
14925
|
sequence: ""
|
|
14701
14926
|
}, chosen);
|
|
14702
14927
|
}
|
|
14928
|
+
async readBranch(name) {
|
|
14929
|
+
const patches = await this.run(listPatches(this.repo, name));
|
|
14930
|
+
const progress = await this.run(reviewProgress(this.repo, name));
|
|
14931
|
+
const pending = await this.run(listPending(this.repo, name));
|
|
14932
|
+
const layers = await this.run(listLayers(this.repo, name));
|
|
14933
|
+
const sent = await this.loadSent(name);
|
|
14934
|
+
const opened = withVouched(withPatches(this.state, patches), progress.vouched);
|
|
14935
|
+
return withLayers(withSent(withPending(opened, pending, "review"), sent), layers);
|
|
14936
|
+
}
|
|
14703
14937
|
async openBranch() {
|
|
14704
14938
|
const branch = selectedBranch(this.state);
|
|
14705
14939
|
if (branch === void 0) return;
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
const
|
|
14711
|
-
|
|
14712
|
-
|
|
14940
|
+
this.commit(await this.readBranch(branch.branch));
|
|
14941
|
+
await this.loadSource();
|
|
14942
|
+
}
|
|
14943
|
+
async reloadBranch() {
|
|
14944
|
+
const branch = selectedBranch(this.state);
|
|
14945
|
+
if (branch === void 0) return;
|
|
14946
|
+
const path = selectedPatch(this.state)?.path;
|
|
14947
|
+
const line = sourceLineAt(this.state, this.state.cursor);
|
|
14948
|
+
const read = await this.readBranch(branch.branch);
|
|
14949
|
+
this.commit(withNotice(restoredTo(read, path, line), "read the branch again"));
|
|
14713
14950
|
await this.loadSource();
|
|
14714
14951
|
}
|
|
14715
14952
|
async goBack() {
|
|
@@ -14923,6 +15160,24 @@ const commentTake = fn("Main.commentTake")(function* (options) {
|
|
|
14923
15160
|
const comments = wait > 0 ? yield* awaitComments(worktree, Date.now() + wait * WAIT_UNIT) : yield* takeComments(worktree);
|
|
14924
15161
|
yield* answer(options, { comments });
|
|
14925
15162
|
});
|
|
15163
|
+
const commentAnswer = fn("Main.commentAnswer")(function* (options) {
|
|
15164
|
+
const report = yield* answerComment({
|
|
15165
|
+
worktree: yield* required(options, "worktree"),
|
|
15166
|
+
id: yield* required(options, "id"),
|
|
15167
|
+
body: yield* required(options, "body"),
|
|
15168
|
+
asks: options["asks"] !== void 0,
|
|
15169
|
+
at: options["at"] ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
15170
|
+
});
|
|
15171
|
+
yield* answer(options, { answered: report.answered });
|
|
15172
|
+
});
|
|
15173
|
+
const commentThreads = fn("Main.commentThreads")(function* (options) {
|
|
15174
|
+
const threads = yield* listThreads(yield* required(options, "repo"), yield* required(options, "branch"));
|
|
15175
|
+
yield* answer(options, { threads });
|
|
15176
|
+
});
|
|
15177
|
+
const commentResolve = fn("Main.commentResolve")(function* (options) {
|
|
15178
|
+
const report = yield* settleThread(yield* required(options, "repo"), yield* required(options, "branch"), yield* required(options, "id"), options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
15179
|
+
yield* answer(options, { settled: report.settled });
|
|
15180
|
+
});
|
|
14926
15181
|
const commentStage = fn("Main.commentStage")(function* (options) {
|
|
14927
15182
|
const report = yield* stageComment({
|
|
14928
15183
|
repo: yield* required(options, "repo"),
|
|
@@ -14971,6 +15226,9 @@ const routes = {
|
|
|
14971
15226
|
"comment add": commentAdd,
|
|
14972
15227
|
"comment stage": commentStage,
|
|
14973
15228
|
"comment take": commentTake,
|
|
15229
|
+
"comment answer": commentAnswer,
|
|
15230
|
+
"comment threads": commentThreads,
|
|
15231
|
+
"comment resolve": commentResolve,
|
|
14974
15232
|
"review submit": reviewSubmit,
|
|
14975
15233
|
"review progress": reviewStatus,
|
|
14976
15234
|
"layers set": fn("Main.layersSet")(function* (options) {
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"bin": {
|
|
22
22
|
"adiff": "./bin/adiff.js"
|
|
23
23
|
},
|
|
24
|
-
"version": "0.1.0-alpha.
|
|
24
|
+
"version": "0.1.0-alpha.12",
|
|
25
25
|
"description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
package/skills/adiff/SKILL.md
CHANGED
|
@@ -43,6 +43,33 @@ Re-arm it after each comment you handle, and keep it running while you work. A r
|
|
|
43
43
|
their own pace, so comments arrive minutes apart, and the whole point is that they reach you as
|
|
44
44
|
events rather than by you asking. When you finish a piece of work, say you are still listening.
|
|
45
45
|
|
|
46
|
+
## Answering a comment
|
|
47
|
+
|
|
48
|
+
Say what you did, against the comment you were handed:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
adiff comment answer --worktree . --id <id> --body "Dropped it, and the import with it."
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The id comes from `comment take`. The reviewer sees the answer under their own words the next time
|
|
55
|
+
they read the branch, so this is how they learn a point was addressed rather than ignored.
|
|
56
|
+
|
|
57
|
+
Answer when the change alone does not carry the reasoning: what you did instead of what was asked,
|
|
58
|
+
what you found while doing it, or why the comment does not apply. A comment that asked a question
|
|
59
|
+
deserves an answer even when nothing changed.
|
|
60
|
+
|
|
61
|
+
Add `--asks` when you need the reviewer to decide before you continue:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
adiff comment answer --worktree . --id <id> --asks --body "Drop it, or keep it and map the error?"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
That marks the thread as waiting on them rather than on you. Do not use it to check in; use it when
|
|
68
|
+
the work genuinely stops without an answer.
|
|
69
|
+
|
|
70
|
+
Settling a thread is the reviewer's to do, not yours. They raised the point, so they decide it is
|
|
71
|
+
closed.
|
|
72
|
+
|
|
46
73
|
## Acting on a comment
|
|
47
74
|
|
|
48
75
|
Read `snippet` before opening the file: the reviewer commented on the diff, and the file may have
|