@eliya-oss/agent-diff 0.1.0-alpha.12 → 0.1.0-alpha.14
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 +14 -0
- package/dist/main.js +310 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- V selects the change under the cursor, o grows a selection from its other end, and g and G reach the ends of the worktree list.
|
|
8
|
+
|
|
9
|
+
- w wraps long lines in the diff, and the cursor gutter stops at the last line.
|
|
10
|
+
|
|
11
|
+
## 0.1.0-alpha.13
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Reword or withdraw a staged comment, and see when a thread describes an older commit.
|
|
16
|
+
|
|
3
17
|
## 0.1.0-alpha.12
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -10849,6 +10849,26 @@ const cursorOps = (state, saveState, inbox) => {
|
|
|
10849
10849
|
});
|
|
10850
10850
|
return pending;
|
|
10851
10851
|
}),
|
|
10852
|
+
restage: fn("Store.restage")(function* (worktreePath, comment) {
|
|
10853
|
+
const current = yield* state(worktreePath);
|
|
10854
|
+
if (!current.pending.some((entry) => entry.id === comment.id)) return none();
|
|
10855
|
+
const pending = current.pending.map((entry) => entry.id === comment.id ? comment : entry);
|
|
10856
|
+
yield* saveState(worktreePath, {
|
|
10857
|
+
...current,
|
|
10858
|
+
pending
|
|
10859
|
+
});
|
|
10860
|
+
return some(pending);
|
|
10861
|
+
}),
|
|
10862
|
+
unstage: fn("Store.unstage")(function* (worktreePath, id) {
|
|
10863
|
+
const current = yield* state(worktreePath);
|
|
10864
|
+
if (!current.pending.some((entry) => entry.id === id)) return none();
|
|
10865
|
+
const pending = current.pending.filter((entry) => entry.id !== id);
|
|
10866
|
+
yield* saveState(worktreePath, {
|
|
10867
|
+
...current,
|
|
10868
|
+
pending
|
|
10869
|
+
});
|
|
10870
|
+
return some(pending);
|
|
10871
|
+
}),
|
|
10852
10872
|
take: fn("Store.take")(function* (worktreePath) {
|
|
10853
10873
|
const batches = yield* inbox(worktreePath);
|
|
10854
10874
|
const current = yield* state(worktreePath);
|
|
@@ -11118,6 +11138,25 @@ const stageComment = fn("Cli.stageComment")(function* (request) {
|
|
|
11118
11138
|
};
|
|
11119
11139
|
return { pending: (yield* store.stage(worktree.path, entry)).length };
|
|
11120
11140
|
});
|
|
11141
|
+
const editStaged = fn("Cli.editStaged")(function* (request) {
|
|
11142
|
+
const store = yield* Store;
|
|
11143
|
+
const worktree = yield* findBranch(request.repo, request.branch);
|
|
11144
|
+
const current = yield* store.state(worktree.path);
|
|
11145
|
+
const found = current.pending.find((entry) => entry.id === request.id);
|
|
11146
|
+
if (found === void 0) return yield* new UnknownComment({ id: request.id });
|
|
11147
|
+
const pending = yield* store.restage(worktree.path, {
|
|
11148
|
+
...found,
|
|
11149
|
+
body: request.body
|
|
11150
|
+
});
|
|
11151
|
+
return { pending: getOrElse(pending, () => current.pending).length };
|
|
11152
|
+
});
|
|
11153
|
+
const dropStaged = fn("Cli.dropStaged")(function* (repo, branch, id) {
|
|
11154
|
+
const store = yield* Store;
|
|
11155
|
+
const worktree = yield* findBranch(repo, branch);
|
|
11156
|
+
const pending = yield* store.unstage(worktree.path, id);
|
|
11157
|
+
if (isNone(pending)) return yield* new UnknownComment({ id });
|
|
11158
|
+
return { pending: pending.value.length };
|
|
11159
|
+
});
|
|
11121
11160
|
const listPending = fn("Cli.listPending")(function* (repo, branch) {
|
|
11122
11161
|
const store = yield* Store;
|
|
11123
11162
|
const worktree = yield* findBranch(repo, branch);
|
|
@@ -11131,7 +11170,7 @@ const listPending = fn("Cli.listPending")(function* (repo, branch) {
|
|
|
11131
11170
|
}));
|
|
11132
11171
|
});
|
|
11133
11172
|
const bodyOf = (entry) => entry.body;
|
|
11134
|
-
const sentOf = (comment, spoken, settled) => {
|
|
11173
|
+
const sentOf = (comment, spoken, settled, head) => {
|
|
11135
11174
|
const mine = spoken.filter((entry) => entry.comment === comment.id);
|
|
11136
11175
|
return {
|
|
11137
11176
|
file: comment.file,
|
|
@@ -11140,6 +11179,7 @@ const sentOf = (comment, spoken, settled) => {
|
|
|
11140
11179
|
end: comment.end,
|
|
11141
11180
|
body: comment.body,
|
|
11142
11181
|
settled: Object.hasOwn(settled, comment.id),
|
|
11182
|
+
stale: comment.head !== head,
|
|
11143
11183
|
asks: mine.at(-1)?.asks === true,
|
|
11144
11184
|
answers: mine.map(bodyOf)
|
|
11145
11185
|
};
|
|
@@ -11149,7 +11189,7 @@ const listSent = fn("Cli.listSent")(function* (repo, branch) {
|
|
|
11149
11189
|
const worktree = yield* findBranch(repo, branch);
|
|
11150
11190
|
const spoken = yield* store.answers(worktree.path);
|
|
11151
11191
|
const current = yield* store.state(worktree.path);
|
|
11152
|
-
return flatten(yield* store.inbox(worktree.path)).map((comment) => sentOf(comment, spoken, current.settled));
|
|
11192
|
+
return flatten(yield* store.inbox(worktree.path)).map((comment) => sentOf(comment, spoken, current.settled, worktree.head));
|
|
11153
11193
|
});
|
|
11154
11194
|
const submitReview = fn("Cli.submitReview")(function* (repo, branch, id, at) {
|
|
11155
11195
|
const store = yield* Store;
|
|
@@ -11705,6 +11745,46 @@ const catalog = [
|
|
|
11705
11745
|
dataKey: "pending",
|
|
11706
11746
|
example: "adiff comment stage --repo . --branch cdr-1 --file src/api.ts --start 4 --end 4 --body \"why\""
|
|
11707
11747
|
},
|
|
11748
|
+
{
|
|
11749
|
+
name: "comment edit",
|
|
11750
|
+
about: "Reword a staged comment. It keeps its id and the lines it was written against",
|
|
11751
|
+
safety: "write",
|
|
11752
|
+
options: [
|
|
11753
|
+
repo,
|
|
11754
|
+
branch,
|
|
11755
|
+
{
|
|
11756
|
+
name: "id",
|
|
11757
|
+
required: true,
|
|
11758
|
+
value: "id",
|
|
11759
|
+
about: "The staged comment, as `review progress` reported it"
|
|
11760
|
+
},
|
|
11761
|
+
{
|
|
11762
|
+
name: "body",
|
|
11763
|
+
required: true,
|
|
11764
|
+
value: "text",
|
|
11765
|
+
about: "What it should say instead"
|
|
11766
|
+
}
|
|
11767
|
+
],
|
|
11768
|
+
dataKey: "pending",
|
|
11769
|
+
example: "adiff comment edit --repo . --branch add-teammate-invitations --id c1 --body \"why is this unused\""
|
|
11770
|
+
},
|
|
11771
|
+
{
|
|
11772
|
+
name: "comment drop",
|
|
11773
|
+
about: "Take a staged comment out of the review before it is sent",
|
|
11774
|
+
safety: "write",
|
|
11775
|
+
options: [
|
|
11776
|
+
repo,
|
|
11777
|
+
branch,
|
|
11778
|
+
{
|
|
11779
|
+
name: "id",
|
|
11780
|
+
required: true,
|
|
11781
|
+
value: "id",
|
|
11782
|
+
about: "The staged comment to withdraw"
|
|
11783
|
+
}
|
|
11784
|
+
],
|
|
11785
|
+
dataKey: "pending",
|
|
11786
|
+
example: "adiff comment drop --repo . --branch add-teammate-invitations --id c1"
|
|
11787
|
+
},
|
|
11708
11788
|
{
|
|
11709
11789
|
name: "comment take",
|
|
11710
11790
|
about: "Collect the comments this worktree has not been handed yet. Exactly-once",
|
|
@@ -11907,7 +11987,7 @@ const ADVICE = {
|
|
|
11907
11987
|
},
|
|
11908
11988
|
UnknownComment: {
|
|
11909
11989
|
exit: 3,
|
|
11910
|
-
suggestion: "No comment carries that id.
|
|
11990
|
+
suggestion: "No comment carries that id. `adiff comment take` reports the ids an agent can answer, and `adiff comment threads` reports every id on a branch.",
|
|
11911
11991
|
retriable: false
|
|
11912
11992
|
},
|
|
11913
11993
|
UnselectableRange: {
|
|
@@ -12325,6 +12405,7 @@ const initialState = (branches) => ({
|
|
|
12325
12405
|
pending: [],
|
|
12326
12406
|
sent: [],
|
|
12327
12407
|
pendingIndex: 0,
|
|
12408
|
+
editing: void 0,
|
|
12328
12409
|
viewport: 20,
|
|
12329
12410
|
context: 3,
|
|
12330
12411
|
top: 0,
|
|
@@ -12333,6 +12414,7 @@ const initialState = (branches) => ({
|
|
|
12333
12414
|
revealed: [],
|
|
12334
12415
|
focus: "diff",
|
|
12335
12416
|
navOpen: true,
|
|
12417
|
+
wrap: false,
|
|
12336
12418
|
layers: [],
|
|
12337
12419
|
layersStale: false,
|
|
12338
12420
|
pulls: {},
|
|
@@ -12498,7 +12580,13 @@ const lineOf = (row) => match$2(row.newLine, {
|
|
|
12498
12580
|
onNone: () => "-",
|
|
12499
12581
|
onSome: (line) => String(line)
|
|
12500
12582
|
});
|
|
12583
|
+
const editedComment = (state) => state.editing === void 0 ? void 0 : state.pending.find((entry) => entry.id === state.editing);
|
|
12501
12584
|
const composeTarget = (state) => {
|
|
12585
|
+
const edited = editedComment(state);
|
|
12586
|
+
if (edited !== void 0) {
|
|
12587
|
+
const span = edited.start === edited.end ? `${edited.start}` : `${edited.start}-${edited.end}`;
|
|
12588
|
+
return `Comment on ${edited.file}:${span}`;
|
|
12589
|
+
}
|
|
12502
12590
|
const patch = selectedPatch(state);
|
|
12503
12591
|
if (patch === void 0) return "";
|
|
12504
12592
|
const [from, to] = selectionRange(state);
|
|
@@ -12557,6 +12645,19 @@ const hunkStarts = (state) => {
|
|
|
12557
12645
|
const patch = selectedPatch(state);
|
|
12558
12646
|
return patch === void 0 ? [] : patch.hunks.map((hunk) => hunk.startRow);
|
|
12559
12647
|
};
|
|
12648
|
+
const changeAround = (state) => {
|
|
12649
|
+
const rows = selectedPatch(state)?.rows ?? [];
|
|
12650
|
+
const changed = (at) => {
|
|
12651
|
+
const row = rows[at];
|
|
12652
|
+
return row !== void 0 && row.kind !== "context";
|
|
12653
|
+
};
|
|
12654
|
+
if (!changed(state.cursor)) return void 0;
|
|
12655
|
+
let first = state.cursor;
|
|
12656
|
+
let last = state.cursor;
|
|
12657
|
+
while (changed(first - 1)) first -= 1;
|
|
12658
|
+
while (changed(last + 1)) last += 1;
|
|
12659
|
+
return [first, last];
|
|
12660
|
+
};
|
|
12560
12661
|
const nextUnreviewed = (state, from) => {
|
|
12561
12662
|
const order = fileOrder(state);
|
|
12562
12663
|
const start = Math.max(0, order.indexOf(from));
|
|
@@ -12767,6 +12868,40 @@ const commands = [
|
|
|
12767
12868
|
screens: ["review"],
|
|
12768
12869
|
hint: "zoom"
|
|
12769
12870
|
}),
|
|
12871
|
+
command({
|
|
12872
|
+
action: "branch.first",
|
|
12873
|
+
title: "Go to the first worktree",
|
|
12874
|
+
category: "Branches",
|
|
12875
|
+
keys: ["g"],
|
|
12876
|
+
screens: ["branches"]
|
|
12877
|
+
}),
|
|
12878
|
+
command({
|
|
12879
|
+
action: "branch.last",
|
|
12880
|
+
title: "Go to the last worktree",
|
|
12881
|
+
category: "Branches",
|
|
12882
|
+
keys: ["G"],
|
|
12883
|
+
screens: ["branches"]
|
|
12884
|
+
}),
|
|
12885
|
+
command({
|
|
12886
|
+
action: "select.hunk",
|
|
12887
|
+
title: "Select the change under the cursor",
|
|
12888
|
+
keys: ["V"],
|
|
12889
|
+
screens: ["review"]
|
|
12890
|
+
}),
|
|
12891
|
+
command({
|
|
12892
|
+
action: "select.swap",
|
|
12893
|
+
title: "Grow the selection from its other end",
|
|
12894
|
+
keys: ["o"],
|
|
12895
|
+
screens: ["review"]
|
|
12896
|
+
}),
|
|
12897
|
+
command({
|
|
12898
|
+
action: "wrap.toggle",
|
|
12899
|
+
title: "Wrap long lines",
|
|
12900
|
+
category: "General",
|
|
12901
|
+
keys: ["w"],
|
|
12902
|
+
screens: ["review"],
|
|
12903
|
+
hint: "wrap"
|
|
12904
|
+
}),
|
|
12770
12905
|
command({
|
|
12771
12906
|
action: "review.reload",
|
|
12772
12907
|
title: "Read the branch again",
|
|
@@ -12875,6 +13010,22 @@ const commands = [
|
|
|
12875
13010
|
hint: "send",
|
|
12876
13011
|
listed: false
|
|
12877
13012
|
}),
|
|
13013
|
+
command({
|
|
13014
|
+
action: "pending.edit",
|
|
13015
|
+
title: "Reword this comment",
|
|
13016
|
+
category: "Review",
|
|
13017
|
+
keys: ["e"],
|
|
13018
|
+
screens: ["pending"],
|
|
13019
|
+
hint: "reword"
|
|
13020
|
+
}),
|
|
13021
|
+
command({
|
|
13022
|
+
action: "pending.drop",
|
|
13023
|
+
title: "Withdraw this comment",
|
|
13024
|
+
category: "Review",
|
|
13025
|
+
keys: ["X"],
|
|
13026
|
+
screens: ["pending"],
|
|
13027
|
+
hint: "withdraw"
|
|
13028
|
+
}),
|
|
12878
13029
|
command({
|
|
12879
13030
|
action: "pending.next",
|
|
12880
13031
|
title: "Next staged comment",
|
|
@@ -13119,6 +13270,25 @@ const moveFile = (state, delta) => ({
|
|
|
13119
13270
|
anchorRow: 0,
|
|
13120
13271
|
selecting: false
|
|
13121
13272
|
});
|
|
13273
|
+
const selectHunk = (state) => {
|
|
13274
|
+
const found = changeAround(state);
|
|
13275
|
+
if (found === void 0) return withNotice(state, "no change under the cursor");
|
|
13276
|
+
return withCursorVisible({
|
|
13277
|
+
...state,
|
|
13278
|
+
selecting: true,
|
|
13279
|
+
anchorRow: found[0],
|
|
13280
|
+
cursor: found[1]
|
|
13281
|
+
});
|
|
13282
|
+
};
|
|
13283
|
+
const swapEnds = (state) => state.selecting ? withCursorVisible({
|
|
13284
|
+
...state,
|
|
13285
|
+
anchorRow: state.cursor,
|
|
13286
|
+
cursor: state.anchorRow
|
|
13287
|
+
}) : state;
|
|
13288
|
+
const atBranch = (state, at) => ({
|
|
13289
|
+
...state,
|
|
13290
|
+
branchIndex: clamp(at, 0, Math.max(0, state.branches.length - 1))
|
|
13291
|
+
});
|
|
13122
13292
|
const startSelection = (state) => ({
|
|
13123
13293
|
...state,
|
|
13124
13294
|
selecting: true,
|
|
@@ -13175,6 +13345,8 @@ const movePalette = (state, delta) => ({
|
|
|
13175
13345
|
const paletteMatches = (state) => searchCommands(state.returnTo, state.query);
|
|
13176
13346
|
const paletteChoice = (state) => paletteMatches(state)[state.paletteIndex]?.action;
|
|
13177
13347
|
const transitions = {
|
|
13348
|
+
"branch.first": (state) => atBranch(state, 0),
|
|
13349
|
+
"branch.last": (state) => atBranch(state, state.branches.length - 1),
|
|
13178
13350
|
"branch.next": (state) => moveBranch(state, 1),
|
|
13179
13351
|
"branch.prev": (state) => moveBranch(state, -1),
|
|
13180
13352
|
"branch.open": (state) => state,
|
|
@@ -13193,11 +13365,15 @@ const transitions = {
|
|
|
13193
13365
|
"file.next": (state) => moveFile(state, 1),
|
|
13194
13366
|
"file.prev": (state) => moveFile(state, -1),
|
|
13195
13367
|
"select.start": startSelection,
|
|
13368
|
+
"select.hunk": selectHunk,
|
|
13369
|
+
"select.swap": swapEnds,
|
|
13196
13370
|
"compose.open": openCompose,
|
|
13197
13371
|
"compose.submit": (state) => state,
|
|
13198
13372
|
"compose.stage": (state) => state,
|
|
13199
13373
|
"pending.open": (state) => state,
|
|
13200
13374
|
"pending.submit": (state) => state,
|
|
13375
|
+
"pending.edit": (state) => state,
|
|
13376
|
+
"pending.drop": (state) => state,
|
|
13201
13377
|
"pending.next": (state) => movePending(state, 1),
|
|
13202
13378
|
"pending.prev": (state) => movePending(state, -1),
|
|
13203
13379
|
"compose.newline": (state) => ({
|
|
@@ -13214,6 +13390,10 @@ const transitions = {
|
|
|
13214
13390
|
navOpen: !state.navOpen,
|
|
13215
13391
|
focus: "diff"
|
|
13216
13392
|
}),
|
|
13393
|
+
"wrap.toggle": (state) => ({
|
|
13394
|
+
...state,
|
|
13395
|
+
wrap: !state.wrap
|
|
13396
|
+
}),
|
|
13217
13397
|
"review.reload": (state) => state,
|
|
13218
13398
|
"rail.toggle": toggleRail,
|
|
13219
13399
|
"file.vouch": (state) => state,
|
|
@@ -13372,6 +13552,10 @@ const paletteClosed = (state) => ({
|
|
|
13372
13552
|
screen: state.returnTo,
|
|
13373
13553
|
query: ""
|
|
13374
13554
|
});
|
|
13555
|
+
const withNoticeHere = (state, notice) => ({
|
|
13556
|
+
...state,
|
|
13557
|
+
notice
|
|
13558
|
+
});
|
|
13375
13559
|
const withNotice = (state, notice) => ({
|
|
13376
13560
|
...state,
|
|
13377
13561
|
screen: "review",
|
|
@@ -13579,6 +13763,7 @@ var DiffView = class {
|
|
|
13579
13763
|
display = [];
|
|
13580
13764
|
starts = /* @__PURE__ */ new Map();
|
|
13581
13765
|
fitted = 1;
|
|
13766
|
+
wrapped = false;
|
|
13582
13767
|
constructor(renderer) {
|
|
13583
13768
|
this.code = new CodeRenderable(renderer, {
|
|
13584
13769
|
id: "diff-code",
|
|
@@ -13700,18 +13885,59 @@ var DiffView = class {
|
|
|
13700
13885
|
const spans = noteSpans(this.display);
|
|
13701
13886
|
this.code.onHighlight = (highlights) => [...highlights.filter((highlight) => !spans.some(([from, to]) => highlight[0] < to && highlight[1] > from)), ...spans];
|
|
13702
13887
|
}
|
|
13703
|
-
|
|
13704
|
-
|
|
13888
|
+
setWrap(on) {
|
|
13889
|
+
if (on === this.wrapped) return;
|
|
13890
|
+
this.wrapped = on;
|
|
13891
|
+
this.code.wrapMode = on ? "word" : "none";
|
|
13892
|
+
this.code.requestRender();
|
|
13893
|
+
this.numbers.requestRender();
|
|
13894
|
+
}
|
|
13895
|
+
sources() {
|
|
13896
|
+
const reported = this.code.lineInfo?.lineSources;
|
|
13897
|
+
return this.wrapped && reported !== void 0 && reported.length > 0 ? reported : [];
|
|
13898
|
+
}
|
|
13899
|
+
lineAt(visual) {
|
|
13900
|
+
const sources = this.sources();
|
|
13901
|
+
if (sources.length === 0) return visual;
|
|
13902
|
+
return sources[Math.max(0, Math.min(sources.length - 1, visual))] ?? visual;
|
|
13903
|
+
}
|
|
13904
|
+
visualOf(line) {
|
|
13905
|
+
const sources = this.sources();
|
|
13906
|
+
if (sources.length === 0) return line;
|
|
13907
|
+
let low = 0;
|
|
13908
|
+
let high = sources.length;
|
|
13909
|
+
while (low < high) {
|
|
13910
|
+
const mid = low + high >> 1;
|
|
13911
|
+
if ((sources[mid] ?? 0) < line) low = mid + 1;
|
|
13912
|
+
else high = mid;
|
|
13913
|
+
}
|
|
13914
|
+
return low;
|
|
13915
|
+
}
|
|
13916
|
+
tallest() {
|
|
13917
|
+
return this.sources().length === 0 ? this.display.length : this.sources().length;
|
|
13918
|
+
}
|
|
13919
|
+
drawn() {
|
|
13920
|
+
return this.tallest();
|
|
13921
|
+
}
|
|
13922
|
+
rowAt(visual) {
|
|
13923
|
+
const line = this.lineAt(visual);
|
|
13924
|
+
const at = Math.max(0, Math.min(this.display.length - 1, line));
|
|
13705
13925
|
return this.display[at]?.row ?? 0;
|
|
13706
13926
|
}
|
|
13707
|
-
isComment(
|
|
13708
|
-
const entry = this.display[
|
|
13927
|
+
isComment(visual) {
|
|
13928
|
+
const entry = this.display[this.lineAt(visual)];
|
|
13709
13929
|
return entry?.comment === true || entry?.prose === true;
|
|
13710
13930
|
}
|
|
13931
|
+
isRunOn(visual) {
|
|
13932
|
+
const sources = this.sources();
|
|
13933
|
+
if (sources.length === 0) return false;
|
|
13934
|
+
return visual > 0 && sources[visual] === sources[visual - 1];
|
|
13935
|
+
}
|
|
13711
13936
|
scrollTo(row, cursor) {
|
|
13712
|
-
const highest = Math.max(0, this.
|
|
13713
|
-
const wanted = this.starts.get(row) ?? row;
|
|
13714
|
-
const
|
|
13937
|
+
const highest = Math.max(0, this.tallest() - this.rows());
|
|
13938
|
+
const wanted = this.visualOf(this.starts.get(row) ?? row);
|
|
13939
|
+
const line = this.starts.get(cursor);
|
|
13940
|
+
const at = line === void 0 ? void 0 : this.visualOf(line);
|
|
13715
13941
|
const kept = cursor >= row && cursor < row + this.rows() && at !== void 0 ? Math.max(wanted, at - this.rows() + 1) : wanted;
|
|
13716
13942
|
const clamped = Math.max(0, Math.min(highest, kept));
|
|
13717
13943
|
if (this.code.scrollY !== clamped) this.code.scrollY = clamped;
|
|
@@ -13719,8 +13945,9 @@ var DiffView = class {
|
|
|
13719
13945
|
}
|
|
13720
13946
|
paint(paintOf, from, rows) {
|
|
13721
13947
|
const colors = /* @__PURE__ */ new Map();
|
|
13722
|
-
const
|
|
13723
|
-
|
|
13948
|
+
const first = this.lineAt(Math.max(0, from - OVERSCAN));
|
|
13949
|
+
const last = Math.min(this.display.length, this.lineAt(from + rows + OVERSCAN) + 1);
|
|
13950
|
+
for (let index = first; index < last; index++) {
|
|
13724
13951
|
const entry = this.display[index];
|
|
13725
13952
|
if (entry === void 0) continue;
|
|
13726
13953
|
const paint = entry.comment || entry.prose ? NOTE_PAINT : paintOf(entry.row);
|
|
@@ -13780,10 +14007,12 @@ const wrap = (text, room) => {
|
|
|
13780
14007
|
return lines;
|
|
13781
14008
|
};
|
|
13782
14009
|
const headOf = (note) => {
|
|
13783
|
-
|
|
13784
|
-
if (note.
|
|
13785
|
-
if (note.
|
|
13786
|
-
|
|
14010
|
+
const moved = note.stale ? ", the branch moved on" : "";
|
|
14011
|
+
if (note.settled) return `${marks().sent} settled${moved}`;
|
|
14012
|
+
if (note.asks) return `${marks().staged} asked back${moved}`;
|
|
14013
|
+
if (note.answers.length > 0) return `${marks().sent} answered${moved}`;
|
|
14014
|
+
if (note.sent) return `${marks().sent} sent${moved}`;
|
|
14015
|
+
return `${marks().staged} staged`;
|
|
13787
14016
|
};
|
|
13788
14017
|
const spokenLines = (body, room) => {
|
|
13789
14018
|
return wrap(body.replaceAll("\n", " "), Math.max(NOTE_MIN, room - 2)).map((text, at) => at === 0 ? `${ANSWER_MARK} ${text}` : ` ${text}`);
|
|
@@ -14164,6 +14393,7 @@ const notesOf = (comments, path, sent) => comments.filter((entry) => entry.file
|
|
|
14164
14393
|
body: entry.body,
|
|
14165
14394
|
sent,
|
|
14166
14395
|
settled: entry.settled === true,
|
|
14396
|
+
stale: entry.stale === true,
|
|
14167
14397
|
asks: entry.asks === true,
|
|
14168
14398
|
answers: entry.answers ?? []
|
|
14169
14399
|
}));
|
|
@@ -14475,6 +14705,7 @@ var Screen = class {
|
|
|
14475
14705
|
if (shown === void 0) return;
|
|
14476
14706
|
const patch = shown.patch;
|
|
14477
14707
|
this.paintSticky(state, state.top);
|
|
14708
|
+
this.view.setWrap(state.wrap);
|
|
14478
14709
|
this.view.show(patch, notesFor(state, patch.path), gapRowSet(shown), proseFor(state, patch.path));
|
|
14479
14710
|
this.view.fit(this.diffScroll.height);
|
|
14480
14711
|
const height = this.view.rows();
|
|
@@ -14638,8 +14869,10 @@ var Screen = class {
|
|
|
14638
14869
|
paintGutter(state, top, height) {
|
|
14639
14870
|
const [from, to] = selectionRange(state);
|
|
14640
14871
|
const marked = markedRows(state);
|
|
14872
|
+
const drawn = this.view.drawn();
|
|
14873
|
+
const bare = (visual) => visual >= drawn || this.view.isComment(visual) || this.view.isRunOn(visual);
|
|
14641
14874
|
const rows = Array.from({ length: height }, (_, index) => {
|
|
14642
|
-
if (
|
|
14875
|
+
if (bare(top + index)) return ` `;
|
|
14643
14876
|
const row = this.view.rowAt(top + index);
|
|
14644
14877
|
return `${row === state.cursor || state.selecting && row >= from && row <= to ? marks().cursor : " "}${marked.has(row) ? marks().comment : " "}`;
|
|
14645
14878
|
});
|
|
@@ -14876,6 +15109,8 @@ var App = class {
|
|
|
14876
15109
|
"file.vouch.next": () => this.vouch(true),
|
|
14877
15110
|
"review.reload": () => this.reloadBranch(),
|
|
14878
15111
|
"pending.open": () => this.openPending(),
|
|
15112
|
+
"pending.edit": () => this.editStagedComment(),
|
|
15113
|
+
"pending.drop": () => this.dropStagedComment(),
|
|
14879
15114
|
"pending.submit": () => this.sendReview(),
|
|
14880
15115
|
"report.open": () => this.commit(reduce(this.measured(), "report.open")),
|
|
14881
15116
|
back: () => this.goBack(),
|
|
@@ -15004,6 +15239,8 @@ var App = class {
|
|
|
15004
15239
|
};
|
|
15005
15240
|
}
|
|
15006
15241
|
async stage() {
|
|
15242
|
+
const editing = this.state.editing;
|
|
15243
|
+
if (editing !== void 0) return this.restage(editing);
|
|
15007
15244
|
const request = this.request();
|
|
15008
15245
|
if (request === void 0) return this.commit(withNotice(this.state, "nothing to stage"));
|
|
15009
15246
|
await this.run(stageComment(request));
|
|
@@ -15012,6 +15249,23 @@ var App = class {
|
|
|
15012
15249
|
const next = withPending(this.state, pending, "review");
|
|
15013
15250
|
this.commit(withNotice(next, `${pending.length} staged`));
|
|
15014
15251
|
}
|
|
15252
|
+
async restage(id) {
|
|
15253
|
+
const branch = selectedBranch(this.state);
|
|
15254
|
+
if (branch === void 0) return;
|
|
15255
|
+
await this.run(editStaged({
|
|
15256
|
+
repo: this.repo,
|
|
15257
|
+
branch: branch.branch,
|
|
15258
|
+
id,
|
|
15259
|
+
body: this.state.draft
|
|
15260
|
+
}));
|
|
15261
|
+
const pending = await this.run(listPending(this.repo, branch.branch));
|
|
15262
|
+
const next = withPending({
|
|
15263
|
+
...this.state,
|
|
15264
|
+
editing: void 0,
|
|
15265
|
+
draft: ""
|
|
15266
|
+
}, pending, "pending");
|
|
15267
|
+
this.commit(withNoticeHere(next, "reworded"));
|
|
15268
|
+
}
|
|
15015
15269
|
loadSent(branch) {
|
|
15016
15270
|
return this.run(listSent(this.repo, branch));
|
|
15017
15271
|
}
|
|
@@ -15047,6 +15301,30 @@ var App = class {
|
|
|
15047
15301
|
if (pending.length === 0) return this.commit(withNotice(this.state, "nothing staged"));
|
|
15048
15302
|
this.commit(withPending(this.state, pending, "pending"));
|
|
15049
15303
|
}
|
|
15304
|
+
editStagedComment() {
|
|
15305
|
+
const entry = this.state.pending[this.state.pendingIndex];
|
|
15306
|
+
if (entry?.id === void 0) return;
|
|
15307
|
+
this.commit({
|
|
15308
|
+
...this.state,
|
|
15309
|
+
screen: "compose",
|
|
15310
|
+
draft: entry.body,
|
|
15311
|
+
editing: entry.id
|
|
15312
|
+
});
|
|
15313
|
+
}
|
|
15314
|
+
async dropStagedComment() {
|
|
15315
|
+
const branch = selectedBranch(this.state);
|
|
15316
|
+
const entry = this.state.pending[this.state.pendingIndex];
|
|
15317
|
+
if (branch === void 0 || entry?.id === void 0) return;
|
|
15318
|
+
await this.run(dropStaged(this.repo, branch.branch, entry.id));
|
|
15319
|
+
const pending = await this.run(listPending(this.repo, branch.branch));
|
|
15320
|
+
const kept = withPending(this.state, pending, pending.length === 0 ? "review" : "pending");
|
|
15321
|
+
const at = Math.min(this.state.pendingIndex, Math.max(0, pending.length - 1));
|
|
15322
|
+
const said = pending.length === 0 ? "nothing staged" : `withdrawn — ${pending.length} left`;
|
|
15323
|
+
this.commit(withNoticeHere({
|
|
15324
|
+
...kept,
|
|
15325
|
+
pendingIndex: at
|
|
15326
|
+
}, said));
|
|
15327
|
+
}
|
|
15050
15328
|
async sendReview() {
|
|
15051
15329
|
const branch = selectedBranch(this.state);
|
|
15052
15330
|
if (branch === void 0) return;
|
|
@@ -15192,6 +15470,19 @@ const commentStage = fn("Main.commentStage")(function* (options) {
|
|
|
15192
15470
|
});
|
|
15193
15471
|
yield* answer(options, { pending: report.pending });
|
|
15194
15472
|
});
|
|
15473
|
+
const commentEdit = fn("Main.commentEdit")(function* (options) {
|
|
15474
|
+
const report = yield* editStaged({
|
|
15475
|
+
repo: yield* required(options, "repo"),
|
|
15476
|
+
branch: yield* required(options, "branch"),
|
|
15477
|
+
id: yield* required(options, "id"),
|
|
15478
|
+
body: yield* required(options, "body")
|
|
15479
|
+
});
|
|
15480
|
+
yield* answer(options, { pending: report.pending });
|
|
15481
|
+
});
|
|
15482
|
+
const commentDrop = fn("Main.commentDrop")(function* (options) {
|
|
15483
|
+
const report = yield* dropStaged(yield* required(options, "repo"), yield* required(options, "branch"), yield* required(options, "id"));
|
|
15484
|
+
yield* answer(options, { pending: report.pending });
|
|
15485
|
+
});
|
|
15195
15486
|
const reviewSubmit = fn("Main.reviewSubmit")(function* (options) {
|
|
15196
15487
|
const report = yield* submitReview(yield* required(options, "repo"), yield* required(options, "branch"), options["id"] ?? randomUUID(), options["at"] ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
15197
15488
|
yield* answer(options, { submitted: report.submitted });
|
|
@@ -15225,6 +15516,8 @@ const routes = {
|
|
|
15225
15516
|
"branch list": branchList,
|
|
15226
15517
|
"comment add": commentAdd,
|
|
15227
15518
|
"comment stage": commentStage,
|
|
15519
|
+
"comment edit": commentEdit,
|
|
15520
|
+
"comment drop": commentDrop,
|
|
15228
15521
|
"comment take": commentTake,
|
|
15229
15522
|
"comment answer": commentAnswer,
|
|
15230
15523
|
"comment threads": commentThreads,
|
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.14",
|
|
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": {
|