@eliya-oss/agent-diff 0.1.0-alpha.22 → 0.1.0-alpha.24
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 +298 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- A selection can be copied, or searched for across the branch's worktree with the matches listed and peeked at.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.23
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- A pinned scope wider than the pane can be panned into view, and the command palette opens over the review list.
|
|
14
|
+
|
|
3
15
|
## 0.1.0-alpha.22
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -11750,6 +11750,7 @@ const gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
|
|
|
11750
11750
|
});
|
|
11751
11751
|
//#endregion
|
|
11752
11752
|
//#region src/service/git/service.ts
|
|
11753
|
+
const GREP_CONTEXT = 2;
|
|
11753
11754
|
const DEFAULT_BRANCH_CANDIDATES = [
|
|
11754
11755
|
"origin/master",
|
|
11755
11756
|
"origin/main",
|
|
@@ -11867,6 +11868,20 @@ const shape = {
|
|
|
11867
11868
|
source: fn("Git.source")(function* (worktree, path) {
|
|
11868
11869
|
const text = yield* readText(join(worktree.path, path), path);
|
|
11869
11870
|
return map$4(text, splitLines);
|
|
11871
|
+
}),
|
|
11872
|
+
grep: fn("Git.grep")(function* (worktree, term) {
|
|
11873
|
+
return yield* gitOrEmpty(worktree.path, [
|
|
11874
|
+
"grep",
|
|
11875
|
+
"--no-color",
|
|
11876
|
+
"-n",
|
|
11877
|
+
"-I",
|
|
11878
|
+
"-F",
|
|
11879
|
+
"-w",
|
|
11880
|
+
"-C",
|
|
11881
|
+
String(GREP_CONTEXT),
|
|
11882
|
+
"-e",
|
|
11883
|
+
term
|
|
11884
|
+
]);
|
|
11870
11885
|
})
|
|
11871
11886
|
};
|
|
11872
11887
|
const GitLive = succeed$1(Git)(shape);
|
|
@@ -12432,6 +12447,59 @@ const saveWrap = fn("Cli.saveWrap")(function* (wrap) {
|
|
|
12432
12447
|
});
|
|
12433
12448
|
});
|
|
12434
12449
|
//#endregion
|
|
12450
|
+
//#region src/cli/search.ts
|
|
12451
|
+
const HIT = /^(.+?):(\d+):(.*)$/;
|
|
12452
|
+
const NEAR = /^(.+?)-(\d+)-(.*)$/;
|
|
12453
|
+
const rowOf = (line) => {
|
|
12454
|
+
const hit = HIT.exec(line);
|
|
12455
|
+
if (hit !== null) return {
|
|
12456
|
+
path: hit[1] ?? "",
|
|
12457
|
+
line: Number(hit[2]),
|
|
12458
|
+
text: hit[3] ?? "",
|
|
12459
|
+
hit: true
|
|
12460
|
+
};
|
|
12461
|
+
const near = NEAR.exec(line);
|
|
12462
|
+
if (near === null) return void 0;
|
|
12463
|
+
return {
|
|
12464
|
+
path: near[1] ?? "",
|
|
12465
|
+
line: Number(near[2]),
|
|
12466
|
+
text: near[3] ?? "",
|
|
12467
|
+
hit: false
|
|
12468
|
+
};
|
|
12469
|
+
};
|
|
12470
|
+
const readRows = (raw) => raw.split("\n").filter((line) => line.length > 0 && line !== "--").flatMap((line) => {
|
|
12471
|
+
const row = rowOf(line);
|
|
12472
|
+
return row === void 0 ? [] : [row];
|
|
12473
|
+
});
|
|
12474
|
+
const near = (rows, at) => {
|
|
12475
|
+
const found = rows[at];
|
|
12476
|
+
if (found === void 0) return [];
|
|
12477
|
+
return rows.filter((row) => row.path === found.path && Math.abs(row.line - found.line) <= 2).map((row) => `${String(row.line).padStart(5)} ${row.text}`);
|
|
12478
|
+
};
|
|
12479
|
+
const byChangedFirst = (left, right) => {
|
|
12480
|
+
if (left.changed !== right.changed) return left.changed ? -1 : 1;
|
|
12481
|
+
return left.path === right.path ? left.line - right.line : left.path.localeCompare(right.path);
|
|
12482
|
+
};
|
|
12483
|
+
const searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term) {
|
|
12484
|
+
const git = yield* Git;
|
|
12485
|
+
const worktree = yield* findBranch(repo, branch);
|
|
12486
|
+
const patches = yield* listPatches(repo, branch);
|
|
12487
|
+
const touched = new Set(patches.map((patch) => patch.path));
|
|
12488
|
+
const rows = readRows(yield* git.grep(worktree, term));
|
|
12489
|
+
const found = [];
|
|
12490
|
+
for (const [at, row] of rows.entries()) {
|
|
12491
|
+
if (!row.hit) continue;
|
|
12492
|
+
found.push({
|
|
12493
|
+
path: row.path,
|
|
12494
|
+
line: row.line,
|
|
12495
|
+
text: row.text.trim(),
|
|
12496
|
+
changed: touched.has(row.path),
|
|
12497
|
+
around: near(rows, at)
|
|
12498
|
+
});
|
|
12499
|
+
}
|
|
12500
|
+
return found.toSorted(byChangedFirst);
|
|
12501
|
+
});
|
|
12502
|
+
//#endregion
|
|
12435
12503
|
//#region src/domain/layers/model.ts
|
|
12436
12504
|
const REMAINDER_TITLE = "not in any layer";
|
|
12437
12505
|
//#endregion
|
|
@@ -13593,6 +13661,9 @@ const initialState = (branches) => ({
|
|
|
13593
13661
|
pulls: {},
|
|
13594
13662
|
layerIndex: 0,
|
|
13595
13663
|
openLayers: [],
|
|
13664
|
+
term: "",
|
|
13665
|
+
matches: [],
|
|
13666
|
+
matchIndex: 0,
|
|
13596
13667
|
rail: "tree"
|
|
13597
13668
|
});
|
|
13598
13669
|
const onLayers = (state) => state.rail === "layers" && state.layers.length > 0;
|
|
@@ -13773,6 +13844,68 @@ const composeTarget = (state) => {
|
|
|
13773
13844
|
});
|
|
13774
13845
|
return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
|
|
13775
13846
|
};
|
|
13847
|
+
const selectedLines = (state) => {
|
|
13848
|
+
const patch = selectedPatch(state);
|
|
13849
|
+
if (patch === void 0) return [];
|
|
13850
|
+
const [from, to] = selectionRange(state);
|
|
13851
|
+
return patch.rows.slice(from, to + 1).map((row) => row.text);
|
|
13852
|
+
};
|
|
13853
|
+
const KEYWORDS = /* @__PURE__ */ new Set([
|
|
13854
|
+
"const",
|
|
13855
|
+
"let",
|
|
13856
|
+
"var",
|
|
13857
|
+
"function",
|
|
13858
|
+
"return",
|
|
13859
|
+
"export",
|
|
13860
|
+
"import",
|
|
13861
|
+
"from",
|
|
13862
|
+
"type",
|
|
13863
|
+
"interface",
|
|
13864
|
+
"class",
|
|
13865
|
+
"extends",
|
|
13866
|
+
"implements",
|
|
13867
|
+
"async",
|
|
13868
|
+
"await",
|
|
13869
|
+
"new",
|
|
13870
|
+
"this",
|
|
13871
|
+
"if",
|
|
13872
|
+
"else",
|
|
13873
|
+
"for",
|
|
13874
|
+
"while",
|
|
13875
|
+
"switch",
|
|
13876
|
+
"case",
|
|
13877
|
+
"default",
|
|
13878
|
+
"break",
|
|
13879
|
+
"continue",
|
|
13880
|
+
"throw",
|
|
13881
|
+
"try",
|
|
13882
|
+
"catch",
|
|
13883
|
+
"finally",
|
|
13884
|
+
"typeof",
|
|
13885
|
+
"readonly",
|
|
13886
|
+
"public",
|
|
13887
|
+
"private",
|
|
13888
|
+
"static",
|
|
13889
|
+
"true",
|
|
13890
|
+
"false",
|
|
13891
|
+
"null",
|
|
13892
|
+
"undefined",
|
|
13893
|
+
"void",
|
|
13894
|
+
"string",
|
|
13895
|
+
"number",
|
|
13896
|
+
"boolean",
|
|
13897
|
+
"any",
|
|
13898
|
+
"unknown",
|
|
13899
|
+
"never"
|
|
13900
|
+
]);
|
|
13901
|
+
const NAME = /[A-Za-z_$][\w$]*/g;
|
|
13902
|
+
const longestName = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
|
|
13903
|
+
const searchTerm = (state) => {
|
|
13904
|
+
const line = selectedLines(state).map((text) => text.trim()).find((text) => text.length > 0);
|
|
13905
|
+
if (line === void 0) return "";
|
|
13906
|
+
return longestName(line) ?? line;
|
|
13907
|
+
};
|
|
13908
|
+
const matchHere = (state) => state.matches[state.matchIndex];
|
|
13776
13909
|
const selectionReadout = (state) => {
|
|
13777
13910
|
const patch = selectedPatch(state);
|
|
13778
13911
|
if (patch === void 0 || !state.selecting) return "";
|
|
@@ -14112,6 +14245,43 @@ const commands = [
|
|
|
14112
14245
|
keys: ["V"],
|
|
14113
14246
|
screens: ["review"]
|
|
14114
14247
|
}),
|
|
14248
|
+
command({
|
|
14249
|
+
action: "selection.copy",
|
|
14250
|
+
title: "Copy the selection",
|
|
14251
|
+
keys: ["y"],
|
|
14252
|
+
screens: ["review"],
|
|
14253
|
+
hint: "copy"
|
|
14254
|
+
}),
|
|
14255
|
+
command({
|
|
14256
|
+
action: "search.open",
|
|
14257
|
+
title: "Find the selection elsewhere",
|
|
14258
|
+
keys: ["/"],
|
|
14259
|
+
screens: ["review"],
|
|
14260
|
+
hint: "find"
|
|
14261
|
+
}),
|
|
14262
|
+
command({
|
|
14263
|
+
action: "match.next",
|
|
14264
|
+
title: "Next match",
|
|
14265
|
+
category: "Search",
|
|
14266
|
+
keys: ["j", "down"],
|
|
14267
|
+
screens: ["search"],
|
|
14268
|
+
hint: "move"
|
|
14269
|
+
}),
|
|
14270
|
+
command({
|
|
14271
|
+
action: "match.prev",
|
|
14272
|
+
title: "Previous match",
|
|
14273
|
+
category: "Search",
|
|
14274
|
+
keys: ["k", "up"],
|
|
14275
|
+
screens: ["search"]
|
|
14276
|
+
}),
|
|
14277
|
+
command({
|
|
14278
|
+
action: "search.jump",
|
|
14279
|
+
title: "Open the file the match sits in",
|
|
14280
|
+
category: "Search",
|
|
14281
|
+
keys: ["return"],
|
|
14282
|
+
screens: ["search"],
|
|
14283
|
+
hint: "open"
|
|
14284
|
+
}),
|
|
14115
14285
|
command({
|
|
14116
14286
|
action: "select.swap",
|
|
14117
14287
|
title: "Grow the selection from its other end",
|
|
@@ -14226,7 +14396,7 @@ const commands = [
|
|
|
14226
14396
|
title: "Find a command",
|
|
14227
14397
|
category: "General",
|
|
14228
14398
|
keys: ["ctrl+p"],
|
|
14229
|
-
screens: ["review"],
|
|
14399
|
+
screens: ["review", "pending"],
|
|
14230
14400
|
hint: "commands",
|
|
14231
14401
|
listed: false
|
|
14232
14402
|
}),
|
|
@@ -14317,7 +14487,8 @@ const commands = [
|
|
|
14317
14487
|
"compose",
|
|
14318
14488
|
"palette",
|
|
14319
14489
|
"pending",
|
|
14320
|
-
"report"
|
|
14490
|
+
"report",
|
|
14491
|
+
"search"
|
|
14321
14492
|
],
|
|
14322
14493
|
hint: "back",
|
|
14323
14494
|
listed: false
|
|
@@ -14597,6 +14768,12 @@ const openCompose = (state) => {
|
|
|
14597
14768
|
};
|
|
14598
14769
|
};
|
|
14599
14770
|
const goBack = (state) => {
|
|
14771
|
+
if (state.screen === "search") return {
|
|
14772
|
+
...state,
|
|
14773
|
+
screen: "review",
|
|
14774
|
+
matches: [],
|
|
14775
|
+
term: ""
|
|
14776
|
+
};
|
|
14600
14777
|
if (state.screen === "pending") return {
|
|
14601
14778
|
...state,
|
|
14602
14779
|
screen: "review"
|
|
@@ -14627,6 +14804,10 @@ const goBack = (state) => {
|
|
|
14627
14804
|
selecting: false
|
|
14628
14805
|
};
|
|
14629
14806
|
};
|
|
14807
|
+
const walkMatches = (state, delta) => ({
|
|
14808
|
+
...state,
|
|
14809
|
+
matchIndex: clamp(state.matchIndex + delta, 0, Math.max(0, state.matches.length - 1))
|
|
14810
|
+
});
|
|
14630
14811
|
const openPalette = (state) => ({
|
|
14631
14812
|
...state,
|
|
14632
14813
|
screen: "palette",
|
|
@@ -14709,6 +14890,11 @@ const transitions = {
|
|
|
14709
14890
|
"report.send": (state) => state,
|
|
14710
14891
|
"palette.open": openPalette,
|
|
14711
14892
|
"palette.run": (state) => state,
|
|
14893
|
+
"search.open": (state) => state,
|
|
14894
|
+
"search.jump": (state) => state,
|
|
14895
|
+
"match.next": (state) => walkMatches(state, 1),
|
|
14896
|
+
"match.prev": (state) => walkMatches(state, -1),
|
|
14897
|
+
"selection.copy": (state) => state,
|
|
14712
14898
|
back: goBack,
|
|
14713
14899
|
quit: (state) => state
|
|
14714
14900
|
};
|
|
@@ -14860,6 +15046,14 @@ const withWaiting = (state, waiting) => ({
|
|
|
14860
15046
|
...state,
|
|
14861
15047
|
waiting
|
|
14862
15048
|
});
|
|
15049
|
+
const withMatches = (state, matches, term) => ({
|
|
15050
|
+
...state,
|
|
15051
|
+
screen: "search",
|
|
15052
|
+
matches,
|
|
15053
|
+
matchIndex: 0,
|
|
15054
|
+
term,
|
|
15055
|
+
selecting: false
|
|
15056
|
+
});
|
|
14863
15057
|
const withNoticeHere = (state, notice) => ({
|
|
14864
15058
|
...state,
|
|
14865
15059
|
notice
|
|
@@ -15228,8 +15422,11 @@ var DiffView = class {
|
|
|
15228
15422
|
}
|
|
15229
15423
|
this.fitWrapWidth();
|
|
15230
15424
|
}
|
|
15425
|
+
panLimit() {
|
|
15426
|
+
return this.wrapped ? 0 : Math.max(this.code.maxScrollX, this.pinned.maxScrollX);
|
|
15427
|
+
}
|
|
15231
15428
|
setPan(columns) {
|
|
15232
|
-
const wanted =
|
|
15429
|
+
const wanted = Math.max(0, Math.min(this.panLimit(), columns));
|
|
15233
15430
|
if (wanted !== this.held) {
|
|
15234
15431
|
this.held = wanted;
|
|
15235
15432
|
this.feed();
|
|
@@ -15237,9 +15434,6 @@ var DiffView = class {
|
|
|
15237
15434
|
if (this.code.scrollX !== wanted) this.code.scrollX = wanted;
|
|
15238
15435
|
if (this.pinned.scrollX !== wanted) this.pinned.scrollX = wanted;
|
|
15239
15436
|
}
|
|
15240
|
-
panned() {
|
|
15241
|
-
return this.code.scrollX;
|
|
15242
|
-
}
|
|
15243
15437
|
fitWrapWidth() {
|
|
15244
15438
|
const room = this.numbers.width - Math.max(0, this.code.x - this.numbers.x);
|
|
15245
15439
|
const wanted = this.wrapped && room > 0 ? room : "100%";
|
|
@@ -15674,8 +15868,25 @@ const makeHome = (renderer) => ({
|
|
|
15674
15868
|
});
|
|
15675
15869
|
const makeModals = (renderer) => ({
|
|
15676
15870
|
palette: makePaletteParts(renderer),
|
|
15677
|
-
staged: makePendingParts(renderer)
|
|
15871
|
+
staged: makePendingParts(renderer),
|
|
15872
|
+
found: makeFoundParts(renderer)
|
|
15678
15873
|
});
|
|
15874
|
+
const makeFoundParts = (renderer) => {
|
|
15875
|
+
const box = makePalette(renderer);
|
|
15876
|
+
const title = bar(renderer, "found-title", palette.faint);
|
|
15877
|
+
const query = bar(renderer, "found-peek", palette.muted);
|
|
15878
|
+
const choices = makeChoices(renderer);
|
|
15879
|
+
box.id = "found";
|
|
15880
|
+
box.add(title);
|
|
15881
|
+
box.add(choices);
|
|
15882
|
+
box.add(query);
|
|
15883
|
+
return {
|
|
15884
|
+
box,
|
|
15885
|
+
title,
|
|
15886
|
+
query,
|
|
15887
|
+
choices
|
|
15888
|
+
};
|
|
15889
|
+
};
|
|
15679
15890
|
const FONTS = [
|
|
15680
15891
|
"tiny",
|
|
15681
15892
|
"block",
|
|
@@ -15830,7 +16041,7 @@ const branchCells = (branch, here, room) => ({
|
|
|
15830
16041
|
layers: layersCell(branch),
|
|
15831
16042
|
state: ""
|
|
15832
16043
|
});
|
|
15833
|
-
const headerParts = (state, branch, path) => [
|
|
16044
|
+
const headerParts = (state, branch, path, pan) => [
|
|
15834
16045
|
branch,
|
|
15835
16046
|
path,
|
|
15836
16047
|
`${state.patchIndex + 1}/${state.patches.length}`,
|
|
@@ -15838,7 +16049,7 @@ const headerParts = (state, branch, path) => [
|
|
|
15838
16049
|
state.staged === 0 ? "" : `${state.staged} staged`,
|
|
15839
16050
|
contextLabel(state.context),
|
|
15840
16051
|
hiddenLines(state) === 0 ? "" : `⋯ ${hiddenLines(state)} lines hidden`,
|
|
15841
|
-
|
|
16052
|
+
pan === 0 ? "" : `→ ${pan} columns`
|
|
15842
16053
|
];
|
|
15843
16054
|
const fallbackScope = (state, top) => {
|
|
15844
16055
|
const scope = (selectedPatch(state)?.hunks.findLast((hunk) => hunk.startRow < top))?.scope ?? "";
|
|
@@ -15919,6 +16130,10 @@ var Screen = class {
|
|
|
15919
16130
|
pending;
|
|
15920
16131
|
pendingTitle;
|
|
15921
16132
|
pendingChoices;
|
|
16133
|
+
found;
|
|
16134
|
+
foundTitle;
|
|
16135
|
+
foundPeek;
|
|
16136
|
+
foundChoices;
|
|
15922
16137
|
renderer;
|
|
15923
16138
|
mouse;
|
|
15924
16139
|
dragFrom;
|
|
@@ -15959,6 +16174,10 @@ var Screen = class {
|
|
|
15959
16174
|
this.pending = modals.staged.box;
|
|
15960
16175
|
this.pendingTitle = modals.staged.title;
|
|
15961
16176
|
this.pendingChoices = modals.staged.choices;
|
|
16177
|
+
this.found = modals.found.box;
|
|
16178
|
+
this.foundTitle = modals.found.title;
|
|
16179
|
+
this.foundPeek = modals.found.query;
|
|
16180
|
+
this.foundChoices = modals.found.choices;
|
|
15962
16181
|
this.assemble(renderer);
|
|
15963
16182
|
}
|
|
15964
16183
|
listen(mouse) {
|
|
@@ -16007,6 +16226,7 @@ var Screen = class {
|
|
|
16007
16226
|
this.paintCompose(state);
|
|
16008
16227
|
this.paintPalette(state);
|
|
16009
16228
|
this.paintPending(state);
|
|
16229
|
+
this.paintFound(state);
|
|
16010
16230
|
this.paintReport(state);
|
|
16011
16231
|
this.scrim.visible = state.screen !== "branches" && state.screen !== "review";
|
|
16012
16232
|
}
|
|
@@ -16037,7 +16257,7 @@ var Screen = class {
|
|
|
16037
16257
|
const branch = selectedBranch(state);
|
|
16038
16258
|
if (atHome(state)) return t`${fg(palette.faint)("")}`;
|
|
16039
16259
|
const patch = selectedPatch(state);
|
|
16040
|
-
const [name = "", ...rest] = headerParts(state, branch?.branch ?? "", patch?.path ?? "").filter((part) => part.length > 0);
|
|
16260
|
+
const [name = "", ...rest] = headerParts(state, branch?.branch ?? "", patch?.path ?? "", Math.min(state.pan, this.view.panLimit())).filter((part) => part.length > 0);
|
|
16041
16261
|
return t`${fg(palette.ink)(name)} ${fg(palette.muted)(rest.join(" "))}`;
|
|
16042
16262
|
}
|
|
16043
16263
|
footerText(state) {
|
|
@@ -16141,7 +16361,8 @@ var Screen = class {
|
|
|
16141
16361
|
this.scrim,
|
|
16142
16362
|
this.compose,
|
|
16143
16363
|
this.palette,
|
|
16144
|
-
this.pending
|
|
16364
|
+
this.pending,
|
|
16365
|
+
this.found
|
|
16145
16366
|
]);
|
|
16146
16367
|
}
|
|
16147
16368
|
watchChips() {
|
|
@@ -16240,6 +16461,31 @@ var Screen = class {
|
|
|
16240
16461
|
this.body.justifyContent = place;
|
|
16241
16462
|
this.listPane.justifyContent = place;
|
|
16242
16463
|
}
|
|
16464
|
+
paintFound(state) {
|
|
16465
|
+
this.found.visible = state.screen === "search";
|
|
16466
|
+
if (state.screen !== "search") {
|
|
16467
|
+
this.foundTitle.content = "";
|
|
16468
|
+
this.foundPeek.content = "";
|
|
16469
|
+
this.foundChoices.options = [];
|
|
16470
|
+
return;
|
|
16471
|
+
}
|
|
16472
|
+
const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
|
|
16473
|
+
const here = matchHere(state);
|
|
16474
|
+
this.foundTitle.content = `${state.term} · ${state.matches.length} elsewhere`;
|
|
16475
|
+
this.foundChoices.options = state.matches.map((match) => ({
|
|
16476
|
+
name: clip(`${match.changed ? marks().comment : " "} ${match.path}:${match.line} ${match.text}`, Math.max(1, room - MODAL_ROOM)),
|
|
16477
|
+
description: "",
|
|
16478
|
+
value: match.path
|
|
16479
|
+
}));
|
|
16480
|
+
this.foundChoices.selectedIndex = state.matchIndex;
|
|
16481
|
+
this.foundPeek.content = (here?.around ?? []).map((line) => clip(line, Math.max(1, room - MODAL_ROOM))).join("\n");
|
|
16482
|
+
const peekRows = here?.around.length ?? 0;
|
|
16483
|
+
this.foundPeek.height = peekRows;
|
|
16484
|
+
this.found.height = Math.min(PALETTE_MAX, state.matches.length + peekRows + PALETTE_CHROME);
|
|
16485
|
+
this.found.width = room;
|
|
16486
|
+
this.found.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
|
|
16487
|
+
this.found.top = Math.max(2, Math.floor(this.renderer.height / 5));
|
|
16488
|
+
}
|
|
16243
16489
|
paintReport(state) {
|
|
16244
16490
|
this.compose.visible = state.screen === "compose" || state.screen === "report";
|
|
16245
16491
|
if (state.screen !== "report") return;
|
|
@@ -16544,6 +16790,9 @@ var App = class {
|
|
|
16544
16790
|
"file.vouch": () => this.vouch(false),
|
|
16545
16791
|
"file.vouch.next": () => this.vouch(true),
|
|
16546
16792
|
"thread.settle": () => this.settleHere(),
|
|
16793
|
+
"selection.copy": () => this.copySelection(),
|
|
16794
|
+
"search.open": () => this.findSelection(),
|
|
16795
|
+
"search.jump": () => this.openMatch(),
|
|
16547
16796
|
"review.reload": () => this.state.screen === "branches" ? this.reloadList() : this.reloadBranch(),
|
|
16548
16797
|
"pending.open": () => this.openPending(),
|
|
16549
16798
|
"pending.edit": () => this.editStagedComment(),
|
|
@@ -16612,6 +16861,44 @@ var App = class {
|
|
|
16612
16861
|
this.commit(await this.readBranch(branch.branch));
|
|
16613
16862
|
await this.loadSource();
|
|
16614
16863
|
}
|
|
16864
|
+
copySelection() {
|
|
16865
|
+
const lines = selectedLines(this.state);
|
|
16866
|
+
if (lines.length === 0) return this.commit(withNoticeHere(this.state, "nothing selected"));
|
|
16867
|
+
copyToClipboard(`${lines.join("\n")}\n`);
|
|
16868
|
+
const many = lines.length === 1 ? "1 line copied" : `${lines.length} lines copied`;
|
|
16869
|
+
this.commit(withNotice(this.state, many));
|
|
16870
|
+
}
|
|
16871
|
+
async findSelection() {
|
|
16872
|
+
const branch = selectedBranch(this.state);
|
|
16873
|
+
const term = searchTerm(this.state);
|
|
16874
|
+
if (branch === void 0 || term.length === 0) return this.commit(withNoticeHere(this.state, "nothing selected"));
|
|
16875
|
+
const elsewhere = (await this.run(searchBranch(this.repo, branch.branch, term))).filter((match) => !this.isHere(match));
|
|
16876
|
+
if (elsewhere.length === 0) return this.commit(withNotice(this.state, `no other place uses ${term}`));
|
|
16877
|
+
this.commit(withMatches(this.state, elsewhere, term));
|
|
16878
|
+
}
|
|
16879
|
+
isHere(match) {
|
|
16880
|
+
const patch = selectedPatch(this.state);
|
|
16881
|
+
if (patch === void 0 || patch.path !== match.path) return false;
|
|
16882
|
+
return sourceLineAt(this.state, this.state.cursor) === match.line;
|
|
16883
|
+
}
|
|
16884
|
+
async openMatch() {
|
|
16885
|
+
const match = matchHere(this.state);
|
|
16886
|
+
if (match === void 0) return;
|
|
16887
|
+
const at = this.state.patches.findIndex((patch) => patch.path === match.path);
|
|
16888
|
+
const patch = this.state.patches[at];
|
|
16889
|
+
if (patch === void 0) return this.commit(withNoticeHere(this.state, `${match.path} is not changed on this branch`));
|
|
16890
|
+
const landed = atFile({
|
|
16891
|
+
...this.state,
|
|
16892
|
+
screen: "review",
|
|
16893
|
+
matches: [],
|
|
16894
|
+
term: ""
|
|
16895
|
+
}, at);
|
|
16896
|
+
this.commit({
|
|
16897
|
+
...landed,
|
|
16898
|
+
cursor: rowAtSourceLine(patch, match.line)
|
|
16899
|
+
});
|
|
16900
|
+
await this.loadSource();
|
|
16901
|
+
}
|
|
16615
16902
|
async settleHere() {
|
|
16616
16903
|
const branch = selectedBranch(this.state);
|
|
16617
16904
|
const id = (threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"bin": {
|
|
24
24
|
"adiff": "./bin/adiff.js"
|
|
25
25
|
},
|
|
26
|
-
"version": "0.1.0-alpha.
|
|
26
|
+
"version": "0.1.0-alpha.24",
|
|
27
27
|
"description": "Review agent work across git worktrees like a PR, and hand the comments back to the agent.",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|