@eliya-oss/agent-diff 0.1.0-alpha.23 → 0.1.0-alpha.25
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 +311 -14
- 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.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- The terminal names the key that sends a review, and counts what is waiting.
|
|
8
|
+
|
|
9
|
+
- The repository's own working tree is reviewable and marked here.
|
|
10
|
+
|
|
11
|
+
## 0.1.0-alpha.24
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- A selection can be copied, or searched for across the branch's worktree with the matches listed and peeked at.
|
|
16
|
+
|
|
3
17
|
## 0.1.0-alpha.23
|
|
4
18
|
|
|
5
19
|
### 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",
|
|
@@ -11814,14 +11815,15 @@ const mergeBaseOf = fn("Git.mergeBase")(function* (entry, base) {
|
|
|
11814
11815
|
mergeBases.set(key, found);
|
|
11815
11816
|
return found;
|
|
11816
11817
|
});
|
|
11817
|
-
const toWorktree = fn("Git.toWorktree")(function* (entry, base) {
|
|
11818
|
+
const toWorktree = fn("Git.toWorktree")(function* (entry, base, own) {
|
|
11818
11819
|
const mergeBase = yield* mergeBaseOf(entry, base);
|
|
11819
11820
|
return {
|
|
11820
11821
|
path: entry.path,
|
|
11821
11822
|
branch: entry.detached ? `(detached ${entry.head.slice(0, 8)})` : entry.branch,
|
|
11822
11823
|
head: entry.head.slice(0, 8),
|
|
11823
11824
|
base: mergeBase.slice(0, 8),
|
|
11824
|
-
detached: entry.detached
|
|
11825
|
+
detached: entry.detached,
|
|
11826
|
+
own
|
|
11825
11827
|
};
|
|
11826
11828
|
});
|
|
11827
11829
|
const splitLines = (text) => text.split("\n");
|
|
@@ -11845,7 +11847,7 @@ const shape = {
|
|
|
11845
11847
|
const base = yield* defaultBranch(repo);
|
|
11846
11848
|
const entries = readEntries(porcelain);
|
|
11847
11849
|
const found = [];
|
|
11848
|
-
for (const entry of entries) found.push(yield* toWorktree(entry, base));
|
|
11850
|
+
for (const [index, entry] of entries.entries()) found.push(yield* toWorktree(entry, base, index === 0));
|
|
11849
11851
|
return found;
|
|
11850
11852
|
}),
|
|
11851
11853
|
diff: fn("Git.diff")(function* (worktree, context) {
|
|
@@ -11867,6 +11869,20 @@ const shape = {
|
|
|
11867
11869
|
source: fn("Git.source")(function* (worktree, path) {
|
|
11868
11870
|
const text = yield* readText(join(worktree.path, path), path);
|
|
11869
11871
|
return map$4(text, splitLines);
|
|
11872
|
+
}),
|
|
11873
|
+
grep: fn("Git.grep")(function* (worktree, term) {
|
|
11874
|
+
return yield* gitOrEmpty(worktree.path, [
|
|
11875
|
+
"grep",
|
|
11876
|
+
"--no-color",
|
|
11877
|
+
"-n",
|
|
11878
|
+
"-I",
|
|
11879
|
+
"-F",
|
|
11880
|
+
"-w",
|
|
11881
|
+
"-C",
|
|
11882
|
+
String(GREP_CONTEXT),
|
|
11883
|
+
"-e",
|
|
11884
|
+
term
|
|
11885
|
+
]);
|
|
11870
11886
|
})
|
|
11871
11887
|
};
|
|
11872
11888
|
const GitLive = succeed$1(Git)(shape);
|
|
@@ -12196,7 +12212,8 @@ const listBranches = fn("Cli.listBranches")(function* (repo) {
|
|
|
12196
12212
|
staged: waiting.staged,
|
|
12197
12213
|
unread: waiting.unread,
|
|
12198
12214
|
layers: waiting.layers,
|
|
12199
|
-
stale: waiting.stale
|
|
12215
|
+
stale: waiting.stale,
|
|
12216
|
+
own: worktree.own
|
|
12200
12217
|
});
|
|
12201
12218
|
}
|
|
12202
12219
|
return summaries.filter((summary) => summary.files > 0);
|
|
@@ -12432,6 +12449,59 @@ const saveWrap = fn("Cli.saveWrap")(function* (wrap) {
|
|
|
12432
12449
|
});
|
|
12433
12450
|
});
|
|
12434
12451
|
//#endregion
|
|
12452
|
+
//#region src/cli/search.ts
|
|
12453
|
+
const HIT = /^(.+?):(\d+):(.*)$/;
|
|
12454
|
+
const NEAR = /^(.+?)-(\d+)-(.*)$/;
|
|
12455
|
+
const rowOf = (line) => {
|
|
12456
|
+
const hit = HIT.exec(line);
|
|
12457
|
+
if (hit !== null) return {
|
|
12458
|
+
path: hit[1] ?? "",
|
|
12459
|
+
line: Number(hit[2]),
|
|
12460
|
+
text: hit[3] ?? "",
|
|
12461
|
+
hit: true
|
|
12462
|
+
};
|
|
12463
|
+
const near = NEAR.exec(line);
|
|
12464
|
+
if (near === null) return void 0;
|
|
12465
|
+
return {
|
|
12466
|
+
path: near[1] ?? "",
|
|
12467
|
+
line: Number(near[2]),
|
|
12468
|
+
text: near[3] ?? "",
|
|
12469
|
+
hit: false
|
|
12470
|
+
};
|
|
12471
|
+
};
|
|
12472
|
+
const readRows = (raw) => raw.split("\n").filter((line) => line.length > 0 && line !== "--").flatMap((line) => {
|
|
12473
|
+
const row = rowOf(line);
|
|
12474
|
+
return row === void 0 ? [] : [row];
|
|
12475
|
+
});
|
|
12476
|
+
const near = (rows, at) => {
|
|
12477
|
+
const found = rows[at];
|
|
12478
|
+
if (found === void 0) return [];
|
|
12479
|
+
return rows.filter((row) => row.path === found.path && Math.abs(row.line - found.line) <= 2).map((row) => `${String(row.line).padStart(5)} ${row.text}`);
|
|
12480
|
+
};
|
|
12481
|
+
const byChangedFirst = (left, right) => {
|
|
12482
|
+
if (left.changed !== right.changed) return left.changed ? -1 : 1;
|
|
12483
|
+
return left.path === right.path ? left.line - right.line : left.path.localeCompare(right.path);
|
|
12484
|
+
};
|
|
12485
|
+
const searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term) {
|
|
12486
|
+
const git = yield* Git;
|
|
12487
|
+
const worktree = yield* findBranch(repo, branch);
|
|
12488
|
+
const patches = yield* listPatches(repo, branch);
|
|
12489
|
+
const touched = new Set(patches.map((patch) => patch.path));
|
|
12490
|
+
const rows = readRows(yield* git.grep(worktree, term));
|
|
12491
|
+
const found = [];
|
|
12492
|
+
for (const [at, row] of rows.entries()) {
|
|
12493
|
+
if (!row.hit) continue;
|
|
12494
|
+
found.push({
|
|
12495
|
+
path: row.path,
|
|
12496
|
+
line: row.line,
|
|
12497
|
+
text: row.text.trim(),
|
|
12498
|
+
changed: touched.has(row.path),
|
|
12499
|
+
around: near(rows, at)
|
|
12500
|
+
});
|
|
12501
|
+
}
|
|
12502
|
+
return found.toSorted(byChangedFirst);
|
|
12503
|
+
});
|
|
12504
|
+
//#endregion
|
|
12435
12505
|
//#region src/domain/layers/model.ts
|
|
12436
12506
|
const REMAINDER_TITLE = "not in any layer";
|
|
12437
12507
|
//#endregion
|
|
@@ -13593,6 +13663,9 @@ const initialState = (branches) => ({
|
|
|
13593
13663
|
pulls: {},
|
|
13594
13664
|
layerIndex: 0,
|
|
13595
13665
|
openLayers: [],
|
|
13666
|
+
term: "",
|
|
13667
|
+
matches: [],
|
|
13668
|
+
matchIndex: 0,
|
|
13596
13669
|
rail: "tree"
|
|
13597
13670
|
});
|
|
13598
13671
|
const onLayers = (state) => state.rail === "layers" && state.layers.length > 0;
|
|
@@ -13773,6 +13846,68 @@ const composeTarget = (state) => {
|
|
|
13773
13846
|
});
|
|
13774
13847
|
return span === "" ? `Comment on ${patch.path}` : `Comment on ${patch.path}:${span}`;
|
|
13775
13848
|
};
|
|
13849
|
+
const selectedLines = (state) => {
|
|
13850
|
+
const patch = selectedPatch(state);
|
|
13851
|
+
if (patch === void 0) return [];
|
|
13852
|
+
const [from, to] = selectionRange(state);
|
|
13853
|
+
return patch.rows.slice(from, to + 1).map((row) => row.text);
|
|
13854
|
+
};
|
|
13855
|
+
const KEYWORDS = /* @__PURE__ */ new Set([
|
|
13856
|
+
"const",
|
|
13857
|
+
"let",
|
|
13858
|
+
"var",
|
|
13859
|
+
"function",
|
|
13860
|
+
"return",
|
|
13861
|
+
"export",
|
|
13862
|
+
"import",
|
|
13863
|
+
"from",
|
|
13864
|
+
"type",
|
|
13865
|
+
"interface",
|
|
13866
|
+
"class",
|
|
13867
|
+
"extends",
|
|
13868
|
+
"implements",
|
|
13869
|
+
"async",
|
|
13870
|
+
"await",
|
|
13871
|
+
"new",
|
|
13872
|
+
"this",
|
|
13873
|
+
"if",
|
|
13874
|
+
"else",
|
|
13875
|
+
"for",
|
|
13876
|
+
"while",
|
|
13877
|
+
"switch",
|
|
13878
|
+
"case",
|
|
13879
|
+
"default",
|
|
13880
|
+
"break",
|
|
13881
|
+
"continue",
|
|
13882
|
+
"throw",
|
|
13883
|
+
"try",
|
|
13884
|
+
"catch",
|
|
13885
|
+
"finally",
|
|
13886
|
+
"typeof",
|
|
13887
|
+
"readonly",
|
|
13888
|
+
"public",
|
|
13889
|
+
"private",
|
|
13890
|
+
"static",
|
|
13891
|
+
"true",
|
|
13892
|
+
"false",
|
|
13893
|
+
"null",
|
|
13894
|
+
"undefined",
|
|
13895
|
+
"void",
|
|
13896
|
+
"string",
|
|
13897
|
+
"number",
|
|
13898
|
+
"boolean",
|
|
13899
|
+
"any",
|
|
13900
|
+
"unknown",
|
|
13901
|
+
"never"
|
|
13902
|
+
]);
|
|
13903
|
+
const NAME = /[A-Za-z_$][\w$]*/g;
|
|
13904
|
+
const longestName = (line) => [...line.matchAll(NAME)].map((found) => found[0]).filter((name) => !KEYWORDS.has(name)).toSorted((left, right) => right.length - left.length)[0];
|
|
13905
|
+
const searchTerm = (state) => {
|
|
13906
|
+
const line = selectedLines(state).map((text) => text.trim()).find((text) => text.length > 0);
|
|
13907
|
+
if (line === void 0) return "";
|
|
13908
|
+
return longestName(line) ?? line;
|
|
13909
|
+
};
|
|
13910
|
+
const matchHere = (state) => state.matches[state.matchIndex];
|
|
13776
13911
|
const selectionReadout = (state) => {
|
|
13777
13912
|
const patch = selectedPatch(state);
|
|
13778
13913
|
if (patch === void 0 || !state.selecting) return "";
|
|
@@ -13960,6 +14095,7 @@ const command = (input) => ({
|
|
|
13960
14095
|
hint: "",
|
|
13961
14096
|
listed: true,
|
|
13962
14097
|
whenStaged: false,
|
|
14098
|
+
counted: false,
|
|
13963
14099
|
whenLayers: false,
|
|
13964
14100
|
...input
|
|
13965
14101
|
});
|
|
@@ -14112,6 +14248,43 @@ const commands = [
|
|
|
14112
14248
|
keys: ["V"],
|
|
14113
14249
|
screens: ["review"]
|
|
14114
14250
|
}),
|
|
14251
|
+
command({
|
|
14252
|
+
action: "selection.copy",
|
|
14253
|
+
title: "Copy the selection",
|
|
14254
|
+
keys: ["y"],
|
|
14255
|
+
screens: ["review"],
|
|
14256
|
+
hint: "copy"
|
|
14257
|
+
}),
|
|
14258
|
+
command({
|
|
14259
|
+
action: "search.open",
|
|
14260
|
+
title: "Find the selection elsewhere",
|
|
14261
|
+
keys: ["/"],
|
|
14262
|
+
screens: ["review"],
|
|
14263
|
+
hint: "find"
|
|
14264
|
+
}),
|
|
14265
|
+
command({
|
|
14266
|
+
action: "match.next",
|
|
14267
|
+
title: "Next match",
|
|
14268
|
+
category: "Search",
|
|
14269
|
+
keys: ["j", "down"],
|
|
14270
|
+
screens: ["search"],
|
|
14271
|
+
hint: "move"
|
|
14272
|
+
}),
|
|
14273
|
+
command({
|
|
14274
|
+
action: "match.prev",
|
|
14275
|
+
title: "Previous match",
|
|
14276
|
+
category: "Search",
|
|
14277
|
+
keys: ["k", "up"],
|
|
14278
|
+
screens: ["search"]
|
|
14279
|
+
}),
|
|
14280
|
+
command({
|
|
14281
|
+
action: "search.jump",
|
|
14282
|
+
title: "Open the file the match sits in",
|
|
14283
|
+
category: "Search",
|
|
14284
|
+
keys: ["return"],
|
|
14285
|
+
screens: ["search"],
|
|
14286
|
+
hint: "open"
|
|
14287
|
+
}),
|
|
14115
14288
|
command({
|
|
14116
14289
|
action: "select.swap",
|
|
14117
14290
|
title: "Grow the selection from its other end",
|
|
@@ -14240,11 +14413,12 @@ const commands = [
|
|
|
14240
14413
|
}),
|
|
14241
14414
|
command({
|
|
14242
14415
|
action: "pending.open",
|
|
14243
|
-
title: "
|
|
14416
|
+
title: "Send what is staged",
|
|
14244
14417
|
keys: ["S"],
|
|
14245
14418
|
screens: ["review"],
|
|
14246
|
-
hint: "
|
|
14247
|
-
whenStaged: true
|
|
14419
|
+
hint: "send",
|
|
14420
|
+
whenStaged: true,
|
|
14421
|
+
counted: true
|
|
14248
14422
|
}),
|
|
14249
14423
|
command({
|
|
14250
14424
|
action: "pending.submit",
|
|
@@ -14317,7 +14491,8 @@ const commands = [
|
|
|
14317
14491
|
"compose",
|
|
14318
14492
|
"palette",
|
|
14319
14493
|
"pending",
|
|
14320
|
-
"report"
|
|
14494
|
+
"report",
|
|
14495
|
+
"search"
|
|
14321
14496
|
],
|
|
14322
14497
|
hint: "back",
|
|
14323
14498
|
listed: false
|
|
@@ -14361,7 +14536,7 @@ const displayKey = (key) => {
|
|
|
14361
14536
|
};
|
|
14362
14537
|
const hintsFor = (screen, staged, layers = 0) => commandsFor(screen).filter((entry) => entry.hint.length > 0).filter((entry) => !entry.whenStaged || staged > 0).filter((entry) => !entry.whenLayers || layers > 0).map((entry) => ({
|
|
14363
14538
|
key: displayKey(entry.keys[0] ?? ""),
|
|
14364
|
-
hint: entry.hint,
|
|
14539
|
+
hint: entry.counted ? `${entry.hint} ${staged}` : entry.hint,
|
|
14365
14540
|
press: entry.keys[0] ?? ""
|
|
14366
14541
|
}));
|
|
14367
14542
|
//#endregion
|
|
@@ -14597,6 +14772,12 @@ const openCompose = (state) => {
|
|
|
14597
14772
|
};
|
|
14598
14773
|
};
|
|
14599
14774
|
const goBack = (state) => {
|
|
14775
|
+
if (state.screen === "search") return {
|
|
14776
|
+
...state,
|
|
14777
|
+
screen: "review",
|
|
14778
|
+
matches: [],
|
|
14779
|
+
term: ""
|
|
14780
|
+
};
|
|
14600
14781
|
if (state.screen === "pending") return {
|
|
14601
14782
|
...state,
|
|
14602
14783
|
screen: "review"
|
|
@@ -14627,6 +14808,10 @@ const goBack = (state) => {
|
|
|
14627
14808
|
selecting: false
|
|
14628
14809
|
};
|
|
14629
14810
|
};
|
|
14811
|
+
const walkMatches = (state, delta) => ({
|
|
14812
|
+
...state,
|
|
14813
|
+
matchIndex: clamp(state.matchIndex + delta, 0, Math.max(0, state.matches.length - 1))
|
|
14814
|
+
});
|
|
14630
14815
|
const openPalette = (state) => ({
|
|
14631
14816
|
...state,
|
|
14632
14817
|
screen: "palette",
|
|
@@ -14709,6 +14894,11 @@ const transitions = {
|
|
|
14709
14894
|
"report.send": (state) => state,
|
|
14710
14895
|
"palette.open": openPalette,
|
|
14711
14896
|
"palette.run": (state) => state,
|
|
14897
|
+
"search.open": (state) => state,
|
|
14898
|
+
"search.jump": (state) => state,
|
|
14899
|
+
"match.next": (state) => walkMatches(state, 1),
|
|
14900
|
+
"match.prev": (state) => walkMatches(state, -1),
|
|
14901
|
+
"selection.copy": (state) => state,
|
|
14712
14902
|
back: goBack,
|
|
14713
14903
|
quit: (state) => state
|
|
14714
14904
|
};
|
|
@@ -14860,6 +15050,14 @@ const withWaiting = (state, waiting) => ({
|
|
|
14860
15050
|
...state,
|
|
14861
15051
|
waiting
|
|
14862
15052
|
});
|
|
15053
|
+
const withMatches = (state, matches, term) => ({
|
|
15054
|
+
...state,
|
|
15055
|
+
screen: "search",
|
|
15056
|
+
matches,
|
|
15057
|
+
matchIndex: 0,
|
|
15058
|
+
term,
|
|
15059
|
+
selecting: false
|
|
15060
|
+
});
|
|
14863
15061
|
const withNoticeHere = (state, notice) => ({
|
|
14864
15062
|
...state,
|
|
14865
15063
|
notice
|
|
@@ -15489,6 +15687,7 @@ const BRANCH_WIDTH = 82;
|
|
|
15489
15687
|
const BRANCH_NAME = 44;
|
|
15490
15688
|
const BRANCH_NAME_MIN = 12;
|
|
15491
15689
|
const BRANCH_TAIL = 45;
|
|
15690
|
+
const EMPTY_LIST = " nothing to review. No worktree differs from the branch it started from.";
|
|
15492
15691
|
const MODAL_MARGIN = 4;
|
|
15493
15692
|
const bodyRoom = (width) => Math.max(0, width - 2 - BODY_BORDER);
|
|
15494
15693
|
const treeWidth = (width) => {
|
|
@@ -15674,8 +15873,25 @@ const makeHome = (renderer) => ({
|
|
|
15674
15873
|
});
|
|
15675
15874
|
const makeModals = (renderer) => ({
|
|
15676
15875
|
palette: makePaletteParts(renderer),
|
|
15677
|
-
staged: makePendingParts(renderer)
|
|
15876
|
+
staged: makePendingParts(renderer),
|
|
15877
|
+
found: makeFoundParts(renderer)
|
|
15678
15878
|
});
|
|
15879
|
+
const makeFoundParts = (renderer) => {
|
|
15880
|
+
const box = makePalette(renderer);
|
|
15881
|
+
const title = bar(renderer, "found-title", palette.faint);
|
|
15882
|
+
const query = bar(renderer, "found-peek", palette.muted);
|
|
15883
|
+
const choices = makeChoices(renderer);
|
|
15884
|
+
box.id = "found";
|
|
15885
|
+
box.add(title);
|
|
15886
|
+
box.add(choices);
|
|
15887
|
+
box.add(query);
|
|
15888
|
+
return {
|
|
15889
|
+
box,
|
|
15890
|
+
title,
|
|
15891
|
+
query,
|
|
15892
|
+
choices
|
|
15893
|
+
};
|
|
15894
|
+
};
|
|
15679
15895
|
const FONTS = [
|
|
15680
15896
|
"tiny",
|
|
15681
15897
|
"block",
|
|
@@ -15820,7 +16036,11 @@ const layersCell = (branch) => {
|
|
|
15820
16036
|
if (branch.layers === 0) return "";
|
|
15821
16037
|
return branch.stale ? `${branch.layers} stale` : `${branch.layers} layers`;
|
|
15822
16038
|
};
|
|
15823
|
-
const stateCell = (state, branch) => [
|
|
16039
|
+
const stateCell = (state, branch) => [
|
|
16040
|
+
branch.own ? "here" : "",
|
|
16041
|
+
state.pulls[branch.branch] ?? "",
|
|
16042
|
+
waitingLabel(branch).trim()
|
|
16043
|
+
].filter((part) => part.length > 0).join(" ");
|
|
15824
16044
|
const branchCells = (branch, here, room) => ({
|
|
15825
16045
|
lead: `${here ? marks().cursor : " "} `,
|
|
15826
16046
|
name: clip(branch.branch, room).padEnd(room),
|
|
@@ -15919,6 +16139,10 @@ var Screen = class {
|
|
|
15919
16139
|
pending;
|
|
15920
16140
|
pendingTitle;
|
|
15921
16141
|
pendingChoices;
|
|
16142
|
+
found;
|
|
16143
|
+
foundTitle;
|
|
16144
|
+
foundPeek;
|
|
16145
|
+
foundChoices;
|
|
15922
16146
|
renderer;
|
|
15923
16147
|
mouse;
|
|
15924
16148
|
dragFrom;
|
|
@@ -15959,6 +16183,10 @@ var Screen = class {
|
|
|
15959
16183
|
this.pending = modals.staged.box;
|
|
15960
16184
|
this.pendingTitle = modals.staged.title;
|
|
15961
16185
|
this.pendingChoices = modals.staged.choices;
|
|
16186
|
+
this.found = modals.found.box;
|
|
16187
|
+
this.foundTitle = modals.found.title;
|
|
16188
|
+
this.foundPeek = modals.found.query;
|
|
16189
|
+
this.foundChoices = modals.found.choices;
|
|
15962
16190
|
this.assemble(renderer);
|
|
15963
16191
|
}
|
|
15964
16192
|
listen(mouse) {
|
|
@@ -16007,6 +16235,7 @@ var Screen = class {
|
|
|
16007
16235
|
this.paintCompose(state);
|
|
16008
16236
|
this.paintPalette(state);
|
|
16009
16237
|
this.paintPending(state);
|
|
16238
|
+
this.paintFound(state);
|
|
16010
16239
|
this.paintReport(state);
|
|
16011
16240
|
this.scrim.visible = state.screen !== "branches" && state.screen !== "review";
|
|
16012
16241
|
}
|
|
@@ -16107,7 +16336,7 @@ var Screen = class {
|
|
|
16107
16336
|
}
|
|
16108
16337
|
const count = state.pending.length;
|
|
16109
16338
|
const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
|
|
16110
|
-
this.pendingTitle.content = `
|
|
16339
|
+
this.pendingTitle.content = `Send ${count} comment${count === 1 ? "" : "s"} as one review, waking the agent once`;
|
|
16111
16340
|
this.pendingChoices.options = state.pending.map((entry) => ({
|
|
16112
16341
|
name: clip(`${entry.file}:${entry.start}-${entry.end} ${entry.body.split("\n")[0] ?? ""}`, Math.max(1, room - MODAL_ROOM)),
|
|
16113
16342
|
description: "",
|
|
@@ -16141,7 +16370,8 @@ var Screen = class {
|
|
|
16141
16370
|
this.scrim,
|
|
16142
16371
|
this.compose,
|
|
16143
16372
|
this.palette,
|
|
16144
|
-
this.pending
|
|
16373
|
+
this.pending,
|
|
16374
|
+
this.found
|
|
16145
16375
|
]);
|
|
16146
16376
|
}
|
|
16147
16377
|
watchChips() {
|
|
@@ -16164,6 +16394,7 @@ var Screen = class {
|
|
|
16164
16394
|
}
|
|
16165
16395
|
branchTable(state) {
|
|
16166
16396
|
const room = nameRoom(homeWidth(this.renderer.width));
|
|
16397
|
+
if (state.branches.length === 0) return new StyledText([fg(palette.muted)(EMPTY_LIST)]);
|
|
16167
16398
|
const heading = [fg(palette.faint)(`${branchHeading(room)}\n\n`)];
|
|
16168
16399
|
const rows = state.branches.flatMap((branch, index) => {
|
|
16169
16400
|
const here = index === state.branchIndex;
|
|
@@ -16240,6 +16471,31 @@ var Screen = class {
|
|
|
16240
16471
|
this.body.justifyContent = place;
|
|
16241
16472
|
this.listPane.justifyContent = place;
|
|
16242
16473
|
}
|
|
16474
|
+
paintFound(state) {
|
|
16475
|
+
this.found.visible = state.screen === "search";
|
|
16476
|
+
if (state.screen !== "search") {
|
|
16477
|
+
this.foundTitle.content = "";
|
|
16478
|
+
this.foundPeek.content = "";
|
|
16479
|
+
this.foundChoices.options = [];
|
|
16480
|
+
return;
|
|
16481
|
+
}
|
|
16482
|
+
const room = modalWidth(this.renderer.width, PALETTE_WIDTH);
|
|
16483
|
+
const here = matchHere(state);
|
|
16484
|
+
this.foundTitle.content = `${state.term} · ${state.matches.length} elsewhere`;
|
|
16485
|
+
this.foundChoices.options = state.matches.map((match) => ({
|
|
16486
|
+
name: clip(`${match.changed ? marks().comment : " "} ${match.path}:${match.line} ${match.text}`, Math.max(1, room - MODAL_ROOM)),
|
|
16487
|
+
description: "",
|
|
16488
|
+
value: match.path
|
|
16489
|
+
}));
|
|
16490
|
+
this.foundChoices.selectedIndex = state.matchIndex;
|
|
16491
|
+
this.foundPeek.content = (here?.around ?? []).map((line) => clip(line, Math.max(1, room - MODAL_ROOM))).join("\n");
|
|
16492
|
+
const peekRows = here?.around.length ?? 0;
|
|
16493
|
+
this.foundPeek.height = peekRows;
|
|
16494
|
+
this.found.height = Math.min(PALETTE_MAX, state.matches.length + peekRows + PALETTE_CHROME);
|
|
16495
|
+
this.found.width = room;
|
|
16496
|
+
this.found.left = Math.max(FRAME_PAD, Math.floor((this.renderer.width - room) / 2));
|
|
16497
|
+
this.found.top = Math.max(2, Math.floor(this.renderer.height / 5));
|
|
16498
|
+
}
|
|
16243
16499
|
paintReport(state) {
|
|
16244
16500
|
this.compose.visible = state.screen === "compose" || state.screen === "report";
|
|
16245
16501
|
if (state.screen !== "report") return;
|
|
@@ -16544,6 +16800,9 @@ var App = class {
|
|
|
16544
16800
|
"file.vouch": () => this.vouch(false),
|
|
16545
16801
|
"file.vouch.next": () => this.vouch(true),
|
|
16546
16802
|
"thread.settle": () => this.settleHere(),
|
|
16803
|
+
"selection.copy": () => this.copySelection(),
|
|
16804
|
+
"search.open": () => this.findSelection(),
|
|
16805
|
+
"search.jump": () => this.openMatch(),
|
|
16547
16806
|
"review.reload": () => this.state.screen === "branches" ? this.reloadList() : this.reloadBranch(),
|
|
16548
16807
|
"pending.open": () => this.openPending(),
|
|
16549
16808
|
"pending.edit": () => this.editStagedComment(),
|
|
@@ -16612,6 +16871,44 @@ var App = class {
|
|
|
16612
16871
|
this.commit(await this.readBranch(branch.branch));
|
|
16613
16872
|
await this.loadSource();
|
|
16614
16873
|
}
|
|
16874
|
+
copySelection() {
|
|
16875
|
+
const lines = selectedLines(this.state);
|
|
16876
|
+
if (lines.length === 0) return this.commit(withNoticeHere(this.state, "nothing selected"));
|
|
16877
|
+
copyToClipboard(`${lines.join("\n")}\n`);
|
|
16878
|
+
const many = lines.length === 1 ? "1 line copied" : `${lines.length} lines copied`;
|
|
16879
|
+
this.commit(withNotice(this.state, many));
|
|
16880
|
+
}
|
|
16881
|
+
async findSelection() {
|
|
16882
|
+
const branch = selectedBranch(this.state);
|
|
16883
|
+
const term = searchTerm(this.state);
|
|
16884
|
+
if (branch === void 0 || term.length === 0) return this.commit(withNoticeHere(this.state, "nothing selected"));
|
|
16885
|
+
const elsewhere = (await this.run(searchBranch(this.repo, branch.branch, term))).filter((match) => !this.isHere(match));
|
|
16886
|
+
if (elsewhere.length === 0) return this.commit(withNotice(this.state, `no other place uses ${term}`));
|
|
16887
|
+
this.commit(withMatches(this.state, elsewhere, term));
|
|
16888
|
+
}
|
|
16889
|
+
isHere(match) {
|
|
16890
|
+
const patch = selectedPatch(this.state);
|
|
16891
|
+
if (patch === void 0 || patch.path !== match.path) return false;
|
|
16892
|
+
return sourceLineAt(this.state, this.state.cursor) === match.line;
|
|
16893
|
+
}
|
|
16894
|
+
async openMatch() {
|
|
16895
|
+
const match = matchHere(this.state);
|
|
16896
|
+
if (match === void 0) return;
|
|
16897
|
+
const at = this.state.patches.findIndex((patch) => patch.path === match.path);
|
|
16898
|
+
const patch = this.state.patches[at];
|
|
16899
|
+
if (patch === void 0) return this.commit(withNoticeHere(this.state, `${match.path} is not changed on this branch`));
|
|
16900
|
+
const landed = atFile({
|
|
16901
|
+
...this.state,
|
|
16902
|
+
screen: "review",
|
|
16903
|
+
matches: [],
|
|
16904
|
+
term: ""
|
|
16905
|
+
}, at);
|
|
16906
|
+
this.commit({
|
|
16907
|
+
...landed,
|
|
16908
|
+
cursor: rowAtSourceLine(patch, match.line)
|
|
16909
|
+
});
|
|
16910
|
+
await this.loadSource();
|
|
16911
|
+
}
|
|
16615
16912
|
async settleHere() {
|
|
16616
16913
|
const branch = selectedBranch(this.state);
|
|
16617
16914
|
const id = (threadAtStop(this.state) ?? threadAtRow(this.state, this.state.cursor))?.id;
|
|
@@ -16708,7 +17005,7 @@ var App = class {
|
|
|
16708
17005
|
const branch = selectedBranch(this.state);
|
|
16709
17006
|
const pending = branch === void 0 ? [] : await this.run(listPending(this.repo, branch.branch));
|
|
16710
17007
|
const next = withPending(this.state, pending, "review");
|
|
16711
|
-
this.commit(withNotice(next, `${pending.length} staged`));
|
|
17008
|
+
this.commit(withNotice(next, `${pending.length} staged, press S to send`));
|
|
16712
17009
|
}
|
|
16713
17010
|
async restage(id) {
|
|
16714
17011
|
const branch = selectedBranch(this.state);
|
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.25",
|
|
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": {
|