@eliya-oss/agent-diff 0.1.0-alpha.151 → 0.1.0-alpha.153
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 +52 -0
- package/dist/main.js +428 -102
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.153
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(layers): a layer shows the runs it claims, and a change another layer explains is one line saying which layer that is.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
Eleven layers over one file drew that file's whole diff eleven times, with the layer's words landing
|
|
12
|
+
somewhere different each time and nothing saying which part you were meant to be reading. A layer
|
|
13
|
+
whose runs sat at line 1,600 also opened at line 800 and left you to find them.
|
|
14
|
+
|
|
15
|
+
</details>
|
|
16
|
+
|
|
17
|
+
## 0.1.0-alpha.152
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- fix(search): what is found is ordered by how near it is to you — your file, then the branch's files, then the rest — with declarations marked and tests, prose and data last.
|
|
22
|
+
|
|
23
|
+
<details><summary>What was wrong</summary>
|
|
24
|
+
|
|
25
|
+
Searching a monorepo for a common name handed back every place git happened to print, in git's
|
|
26
|
+
order: twenty-three thousand rows, with the file you were reading somewhere in the middle and
|
|
27
|
+
`.txt` corpora, Dockerfiles and documents above the code. The count for each distance is said now,
|
|
28
|
+
so a name with ten places in your file and twelve hundred elsewhere says both.
|
|
29
|
+
|
|
30
|
+
</details>
|
|
31
|
+
|
|
32
|
+
perf(search): searching a monorepo for a name costs one git pass over hit lines, not one per keystroke over every neighbouring line.
|
|
33
|
+
|
|
34
|
+
<details><summary>What was wrong</summary>
|
|
35
|
+
|
|
36
|
+
Every search asked git for two lines of context around every match — 6,832 lines for one name in a
|
|
37
|
+
monorepo against 1,421 hits — and then scanned all of them once per match to build the neighbours
|
|
38
|
+
of places nobody was looking at. At typing speed each keystroke started another one, so typing a
|
|
39
|
+
name of eight letters started eight, each queued behind the last. A search now reads hit lines
|
|
40
|
+
only, reads the neighbours of the one place under the cursor, waits until you have stopped typing,
|
|
41
|
+
and runs beside the terminal rather than in front of it.
|
|
42
|
+
|
|
43
|
+
</details>
|
|
44
|
+
|
|
45
|
+
fix(search): a search waits for two letters, and an answer that arrives for a word you have moved on from is dropped.
|
|
46
|
+
|
|
47
|
+
<details><summary>What was wrong</summary>
|
|
48
|
+
|
|
49
|
+
Typing `i` on the way to `identity` searched for `i`, which in a monorepo is twenty-two thousand
|
|
50
|
+
places; the answer landed after the later ones and the list then showed the places for `i` under
|
|
51
|
+
the word `identity`.
|
|
52
|
+
|
|
53
|
+
</details>
|
|
54
|
+
|
|
3
55
|
## 0.1.0-alpha.151
|
|
4
56
|
|
|
5
57
|
### Patch Changes
|
package/dist/main.js
CHANGED
|
@@ -9240,7 +9240,7 @@ var init_error$2 = __esmMin((() => {
|
|
|
9240
9240
|
//#endregion
|
|
9241
9241
|
//#region src/service/store/model.ts
|
|
9242
9242
|
var emptyBranchState;
|
|
9243
|
-
var init_model$
|
|
9243
|
+
var init_model$5 = __esmMin((() => {
|
|
9244
9244
|
emptyBranchState = {
|
|
9245
9245
|
taken: {},
|
|
9246
9246
|
vouches: {},
|
|
@@ -9402,7 +9402,7 @@ var Store, ensureDir, readOptional, missing$1, damaged, jsonOf$1, decoded, unwri
|
|
|
9402
9402
|
var init_service$1 = __esmMin((() => {
|
|
9403
9403
|
init_dist();
|
|
9404
9404
|
init_error$2();
|
|
9405
|
-
init_model$
|
|
9405
|
+
init_model$5();
|
|
9406
9406
|
init_schema();
|
|
9407
9407
|
init_paths();
|
|
9408
9408
|
Store = class extends Service()("adiff/Store") {};
|
|
@@ -9830,12 +9830,12 @@ var init_store = __esmMin((() => {
|
|
|
9830
9830
|
init_service$1();
|
|
9831
9831
|
init_error$2();
|
|
9832
9832
|
init_paths();
|
|
9833
|
-
init_model$
|
|
9833
|
+
init_model$5();
|
|
9834
9834
|
}));
|
|
9835
9835
|
//#endregion
|
|
9836
9836
|
//#region src/domain/patch/model.ts
|
|
9837
9837
|
var WHOLE_FILE, lineOn;
|
|
9838
|
-
var init_model$
|
|
9838
|
+
var init_model$4 = __esmMin((() => {
|
|
9839
9839
|
WHOLE_FILE = 1e5;
|
|
9840
9840
|
lineOn = (row, side) => side === "new" ? row.newLine : row.oldLine;
|
|
9841
9841
|
}));
|
|
@@ -9844,7 +9844,7 @@ var init_model$3 = __esmMin((() => {
|
|
|
9844
9844
|
var sideOf, linesOn, anchorFor, rowsForRange, sideLines, runsAt, nearestRun, SHORTEST_NEAR, PER_EDIT, edits, isNear, nearestLike, foundExactly, foundAlike, foundAgain;
|
|
9845
9845
|
var init_anchor = __esmMin((() => {
|
|
9846
9846
|
init_dist();
|
|
9847
|
-
init_model$
|
|
9847
|
+
init_model$4();
|
|
9848
9848
|
sideOf = (rows) => rows.some((row) => isSome(row.newLine)) ? "new" : "old";
|
|
9849
9849
|
linesOn = (rows, side) => rows.flatMap((row) => match$3(lineOn(row, side), {
|
|
9850
9850
|
onNone: () => [],
|
|
@@ -10174,7 +10174,7 @@ var init_patch = __esmMin((() => {
|
|
|
10174
10174
|
init_anchor();
|
|
10175
10175
|
init_parse$1();
|
|
10176
10176
|
init_sticky();
|
|
10177
|
-
init_model$
|
|
10177
|
+
init_model$4();
|
|
10178
10178
|
}));
|
|
10179
10179
|
//#endregion
|
|
10180
10180
|
//#region src/service/git/error.ts
|
|
@@ -10211,12 +10211,11 @@ var init_run = __esmMin((() => {
|
|
|
10211
10211
|
gitOrEmpty = fn("Git.runOrEmpty")(function* (cwd, args) {
|
|
10212
10212
|
return yield* git(cwd, args).pipe(catchTag("GitCommandFailed", () => succeed$1("")));
|
|
10213
10213
|
});
|
|
10214
|
-
})),
|
|
10214
|
+
})), CACHE_SIZE, NAME_TTL, FRESH_TTL, SPLIT, DEFAULT_BRANCH_CANDIDATES, PLAIN_PATHS, STAT, Git, parseStat, readEntries, findDefaultBranch, partsOf$2, findMergeBase, toWorktree, branchTips, findParent, splitLines, absent, readText, settled, seenAs, listWorktrees, readDiff, readStat, readSource, readBlob, readGrep, findRepo, refResolves, sharedCommit, makeCaches, shapeWith, makeGit, GitLive;
|
|
10215
10215
|
var init_service = __esmMin((() => {
|
|
10216
10216
|
init_dist();
|
|
10217
10217
|
init_error$1();
|
|
10218
10218
|
init_run();
|
|
10219
|
-
GREP_CONTEXT = 2;
|
|
10220
10219
|
CACHE_SIZE = 256;
|
|
10221
10220
|
NAME_TTL = "5 minutes";
|
|
10222
10221
|
FRESH_TTL = "3 seconds";
|
|
@@ -10265,9 +10264,9 @@ var init_service = __esmMin((() => {
|
|
|
10265
10264
|
])).trim().length > 0) return candidate;
|
|
10266
10265
|
return "HEAD";
|
|
10267
10266
|
});
|
|
10268
|
-
partsOf$
|
|
10267
|
+
partsOf$2 = (key) => key.split(SPLIT);
|
|
10269
10268
|
findMergeBase = fn("Git.mergeBase")(function* (key) {
|
|
10270
|
-
const [path = "", base = ""] = partsOf$
|
|
10269
|
+
const [path = "", base = ""] = partsOf$2(key);
|
|
10271
10270
|
return (yield* gitOrEmpty(path, [
|
|
10272
10271
|
"merge-base",
|
|
10273
10272
|
base,
|
|
@@ -10303,7 +10302,7 @@ var init_service = __esmMin((() => {
|
|
|
10303
10302
|
return tips;
|
|
10304
10303
|
});
|
|
10305
10304
|
findParent = fn("Git.parentOf")(function* (key) {
|
|
10306
|
-
const [repo = "", branch = "", fallback = ""] = partsOf$
|
|
10305
|
+
const [repo = "", branch = "", fallback = ""] = partsOf$2(key);
|
|
10307
10306
|
const own = (yield* gitOrEmpty(repo, ["rev-list", `${fallback}..${branch}`])).split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
10308
10307
|
if (own[0] === void 0) return fallback;
|
|
10309
10308
|
const tips = yield* branchTips(repo);
|
|
@@ -10375,8 +10374,6 @@ var init_service = __esmMin((() => {
|
|
|
10375
10374
|
"-F",
|
|
10376
10375
|
"-i",
|
|
10377
10376
|
"-w",
|
|
10378
|
-
"-C",
|
|
10379
|
-
String(GREP_CONTEXT),
|
|
10380
10377
|
"-e",
|
|
10381
10378
|
term
|
|
10382
10379
|
]);
|
|
@@ -10470,7 +10467,7 @@ var init_review = __esmMin((() => {
|
|
|
10470
10467
|
//#endregion
|
|
10471
10468
|
//#region src/domain/preferences/model.ts
|
|
10472
10469
|
var preferences, preferenceNames, preferenceNamed, heldValue, heldValues;
|
|
10473
|
-
var init_model$
|
|
10470
|
+
var init_model$3 = __esmMin((() => {
|
|
10474
10471
|
preferences = [
|
|
10475
10472
|
{
|
|
10476
10473
|
name: "wrap",
|
|
@@ -10529,7 +10526,7 @@ var init_model$2 = __esmMin((() => {
|
|
|
10529
10526
|
//#endregion
|
|
10530
10527
|
//#region src/domain/preferences/index.ts
|
|
10531
10528
|
var init_preferences = __esmMin((() => {
|
|
10532
|
-
init_model$
|
|
10529
|
+
init_model$3();
|
|
10533
10530
|
})), UnknownBranch, UnknownBase, UnknownFile, UnknownComment, UnknownRemark, NothingSaid, RemarkTaken, UnknownPreference, UnknownPreferenceValue, UnselectableRange, UnknownCommand, MissingOption, UnknownWorktree, MalformedLayers, UnknownField, UnknownOption, BadOption, UnknownDraft, NothingDrafted, PartlySent, PullMoved, NoLayers;
|
|
10534
10531
|
var init_error = __esmMin((() => {
|
|
10535
10532
|
init_dist();
|
|
@@ -11312,10 +11309,10 @@ var init_pane = __esmMin((() => {
|
|
|
11312
11309
|
//#region package.json
|
|
11313
11310
|
init_drafts();
|
|
11314
11311
|
init_pane();
|
|
11315
|
-
var version$1 = "0.1.0-alpha.
|
|
11312
|
+
var version$1 = "0.1.0-alpha.153";
|
|
11316
11313
|
//#endregion
|
|
11317
11314
|
//#region src/cli/upgrade.ts
|
|
11318
|
-
var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
|
|
11315
|
+
var PACKAGE, TAG, RELEASES, REGISTRY, ASK_MS, RUN_MS, CELLAR, COMPILED, INSTALLED, BUN_GLOBAL, routeOf, ROUTES, asRoute, checkoutOf, assetOf, commandFor, NOTES, RUNNABLE, NUMBERS, numbersIn, compare$1, partsOf$1, newer, tagIn, fetched, askLatest, here, findUpgrade, willUpgrade, ranChild, runUpgrade, statusOf$1, sayFound, sayDone, attempted, SAY_SKILL_TOO, upgradeReport;
|
|
11319
11316
|
var init_upgrade$1 = __esmMin((() => {
|
|
11320
11317
|
init_dist();
|
|
11321
11318
|
PACKAGE = "@eliya-oss/agent-diff";
|
|
@@ -11374,7 +11371,7 @@ var init_upgrade$1 = __esmMin((() => {
|
|
|
11374
11371
|
if (head === other) return compare$1(restLeft, restRight);
|
|
11375
11372
|
return head < other ? -1 : 1;
|
|
11376
11373
|
};
|
|
11377
|
-
partsOf = (version) => {
|
|
11374
|
+
partsOf$1 = (version) => {
|
|
11378
11375
|
const [core = "", ...rest] = version.split("-");
|
|
11379
11376
|
return {
|
|
11380
11377
|
core: numbersIn(core),
|
|
@@ -11382,8 +11379,8 @@ var init_upgrade$1 = __esmMin((() => {
|
|
|
11382
11379
|
};
|
|
11383
11380
|
};
|
|
11384
11381
|
newer = (candidate, held) => {
|
|
11385
|
-
const left = partsOf(candidate);
|
|
11386
|
-
const right = partsOf(held);
|
|
11382
|
+
const left = partsOf$1(candidate);
|
|
11383
|
+
const right = partsOf$1(held);
|
|
11387
11384
|
const cores = compare$1(left.core, right.core);
|
|
11388
11385
|
if (cores !== 0) return cores > 0;
|
|
11389
11386
|
if (left.pre.length === 0 && right.pre.length === 0) return false;
|
|
@@ -11481,66 +11478,233 @@ var init_upgrade$1 = __esmMin((() => {
|
|
|
11481
11478
|
note
|
|
11482
11479
|
};
|
|
11483
11480
|
};
|
|
11481
|
+
})), DATA_ENDS, DATA_NAMES, DATA_STARTS, DATA_PARTS, TEST_PARTS, TEST_ENDS, partsOf, nameOf$1, isData, isTest, tierOf, KEYWORDS, escaped, BORROWS, declaresIn, bandOf, TIERS, BANDS, rankOf, inFile, byRank, byFile, countedIn, ranked;
|
|
11482
|
+
var init_model$2 = __esmMin((() => {
|
|
11483
|
+
DATA_ENDS = [
|
|
11484
|
+
".txt",
|
|
11485
|
+
".csv",
|
|
11486
|
+
".tsv",
|
|
11487
|
+
".log",
|
|
11488
|
+
".snap",
|
|
11489
|
+
".lock",
|
|
11490
|
+
".sum",
|
|
11491
|
+
".golden",
|
|
11492
|
+
".out",
|
|
11493
|
+
".md",
|
|
11494
|
+
".mdx",
|
|
11495
|
+
".rst",
|
|
11496
|
+
".adoc",
|
|
11497
|
+
".yml",
|
|
11498
|
+
".yaml",
|
|
11499
|
+
".json",
|
|
11500
|
+
".toml",
|
|
11501
|
+
".ini",
|
|
11502
|
+
".cfg",
|
|
11503
|
+
".conf",
|
|
11504
|
+
".env"
|
|
11505
|
+
];
|
|
11506
|
+
DATA_NAMES = /* @__PURE__ */ new Set([
|
|
11507
|
+
"package-lock.json",
|
|
11508
|
+
"pnpm-lock.yaml",
|
|
11509
|
+
"yarn.lock",
|
|
11510
|
+
"go.sum",
|
|
11511
|
+
"cargo.lock",
|
|
11512
|
+
"poetry.lock",
|
|
11513
|
+
"codeowners",
|
|
11514
|
+
".gitignore",
|
|
11515
|
+
".dockerignore",
|
|
11516
|
+
"jenkinsfile",
|
|
11517
|
+
"procfile"
|
|
11518
|
+
]);
|
|
11519
|
+
DATA_STARTS = [
|
|
11520
|
+
"dockerfile",
|
|
11521
|
+
"makefile",
|
|
11522
|
+
"docker-compose"
|
|
11523
|
+
];
|
|
11524
|
+
DATA_PARTS = /* @__PURE__ */ new Set([
|
|
11525
|
+
"fixtures",
|
|
11526
|
+
"__fixtures__",
|
|
11527
|
+
"__snapshots__",
|
|
11528
|
+
"snapshots",
|
|
11529
|
+
"testdata",
|
|
11530
|
+
"test-data",
|
|
11531
|
+
"vendor",
|
|
11532
|
+
"third_party",
|
|
11533
|
+
"node_modules",
|
|
11534
|
+
"dist",
|
|
11535
|
+
"build",
|
|
11536
|
+
"coverage"
|
|
11537
|
+
]);
|
|
11538
|
+
TEST_PARTS = /* @__PURE__ */ new Set([
|
|
11539
|
+
"test",
|
|
11540
|
+
"tests",
|
|
11541
|
+
"__tests__",
|
|
11542
|
+
"spec"
|
|
11543
|
+
]);
|
|
11544
|
+
TEST_ENDS = /(\.(spec|test)\.[a-z]+|_test\.[a-z]+|Test\.[a-z]+)$/;
|
|
11545
|
+
partsOf = (path) => path.toLowerCase().split("/");
|
|
11546
|
+
nameOf$1 = (path) => partsOf(path).at(-1) ?? "";
|
|
11547
|
+
isData = (path) => {
|
|
11548
|
+
const name = nameOf$1(path);
|
|
11549
|
+
if (DATA_NAMES.has(name)) return true;
|
|
11550
|
+
if (DATA_STARTS.some((start) => name.startsWith(start))) return true;
|
|
11551
|
+
if (DATA_ENDS.some((end) => name.endsWith(end))) return true;
|
|
11552
|
+
return partsOf(path).slice(0, -1).some((part) => DATA_PARTS.has(part));
|
|
11553
|
+
};
|
|
11554
|
+
isTest = (path) => {
|
|
11555
|
+
if (TEST_ENDS.test(path)) return true;
|
|
11556
|
+
return partsOf(path).slice(0, -1).some((part) => TEST_PARTS.has(part));
|
|
11557
|
+
};
|
|
11558
|
+
tierOf = (path) => isData(path) ? "data" : isTest(path) ? "test" : "code";
|
|
11559
|
+
KEYWORDS = [
|
|
11560
|
+
"const",
|
|
11561
|
+
"let",
|
|
11562
|
+
"var",
|
|
11563
|
+
"function",
|
|
11564
|
+
"class",
|
|
11565
|
+
"interface",
|
|
11566
|
+
"type",
|
|
11567
|
+
"enum",
|
|
11568
|
+
"struct",
|
|
11569
|
+
"def",
|
|
11570
|
+
"func",
|
|
11571
|
+
"fn",
|
|
11572
|
+
"impl",
|
|
11573
|
+
"trait",
|
|
11574
|
+
"module",
|
|
11575
|
+
"namespace",
|
|
11576
|
+
"record",
|
|
11577
|
+
"readonly",
|
|
11578
|
+
"private",
|
|
11579
|
+
"public",
|
|
11580
|
+
"protected",
|
|
11581
|
+
"static",
|
|
11582
|
+
"val"
|
|
11583
|
+
].join("|");
|
|
11584
|
+
escaped = (term) => term.replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
11585
|
+
BORROWS = /^\s*(import|export\s.*\sfrom\s|from\s|require\b|#include|using\s|use\s)/;
|
|
11586
|
+
declaresIn = (text, term) => {
|
|
11587
|
+
if (BORROWS.test(text)) return false;
|
|
11588
|
+
return new RegExp(String.raw`\b(${KEYWORDS})\b[^=]{0,40}?\b${escaped(term)}\b`, "i").test(text);
|
|
11589
|
+
};
|
|
11590
|
+
bandOf = (path, reading) => path === reading.here ? "file" : reading.changed.has(path) ? "branch" : "worktree";
|
|
11591
|
+
TIERS = {
|
|
11592
|
+
code: 0,
|
|
11593
|
+
test: 100,
|
|
11594
|
+
data: 200
|
|
11595
|
+
};
|
|
11596
|
+
BANDS = {
|
|
11597
|
+
file: 0,
|
|
11598
|
+
branch: 10,
|
|
11599
|
+
worktree: 20
|
|
11600
|
+
};
|
|
11601
|
+
rankOf = (place) => TIERS[place.tier] + BANDS[place.band] + (place.declares ? 0 : 1);
|
|
11602
|
+
inFile = (left, right) => {
|
|
11603
|
+
if (left.declares !== right.declares) return left.declares ? -1 : 1;
|
|
11604
|
+
return left.line - right.line;
|
|
11605
|
+
};
|
|
11606
|
+
byRank = (left, right) => {
|
|
11607
|
+
const [leftPath, leftPlaces] = left;
|
|
11608
|
+
const [rightPath, rightPlaces] = right;
|
|
11609
|
+
const held = Math.min(...leftPlaces.map(rankOf)) - Math.min(...rightPlaces.map(rankOf));
|
|
11610
|
+
return held === 0 ? leftPath.localeCompare(rightPath) : held;
|
|
11611
|
+
};
|
|
11612
|
+
byFile = (places) => {
|
|
11613
|
+
const held = /* @__PURE__ */ new Map();
|
|
11614
|
+
for (const place of places) {
|
|
11615
|
+
const kept = held.get(place.path);
|
|
11616
|
+
if (kept === void 0) held.set(place.path, [place]);
|
|
11617
|
+
else kept.push(place);
|
|
11618
|
+
}
|
|
11619
|
+
return [...held.entries()];
|
|
11620
|
+
};
|
|
11621
|
+
countedIn = (places) => ({
|
|
11622
|
+
file: places.filter((place) => place.band === "file").length,
|
|
11623
|
+
branch: places.filter((place) => place.band !== "worktree").length,
|
|
11624
|
+
worktree: places.length
|
|
11625
|
+
});
|
|
11626
|
+
ranked = (places) => {
|
|
11627
|
+
const files = byFile(places).map(([path, held]) => [path, held.toSorted(inFile)]).toSorted(byRank);
|
|
11628
|
+
const kept = [];
|
|
11629
|
+
let left = 0;
|
|
11630
|
+
for (const [, held] of files) {
|
|
11631
|
+
const room = Math.max(0, 200 - kept.length);
|
|
11632
|
+
const taking = held.slice(0, Math.min(20, room));
|
|
11633
|
+
kept.push(...taking);
|
|
11634
|
+
left += held.length - taking.length;
|
|
11635
|
+
}
|
|
11636
|
+
return {
|
|
11637
|
+
places: kept,
|
|
11638
|
+
counted: countedIn(places),
|
|
11639
|
+
left
|
|
11640
|
+
};
|
|
11641
|
+
};
|
|
11642
|
+
}));
|
|
11643
|
+
//#endregion
|
|
11644
|
+
//#region src/domain/search/index.ts
|
|
11645
|
+
var init_search$1 = __esmMin((() => {
|
|
11646
|
+
init_model$2();
|
|
11484
11647
|
}));
|
|
11485
11648
|
//#endregion
|
|
11486
11649
|
//#region src/cli/search.ts
|
|
11487
|
-
var HIT,
|
|
11650
|
+
var HIT, AROUND, placeIn$1, matchOf, searchIn, aroundIn, searchBranch;
|
|
11488
11651
|
var init_search = __esmMin((() => {
|
|
11489
11652
|
init_dist();
|
|
11653
|
+
init_search$1();
|
|
11490
11654
|
init_git();
|
|
11491
11655
|
init_commands();
|
|
11492
11656
|
HIT = /^(.+?):(\d+):(.*)$/;
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
const hit = HIT.exec(
|
|
11496
|
-
if (hit
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
hit: true
|
|
11501
|
-
};
|
|
11502
|
-
const near = NEAR.exec(line);
|
|
11503
|
-
if (near === null) return void 0;
|
|
11657
|
+
AROUND = 2;
|
|
11658
|
+
placeIn$1 = (raw, term, reading) => {
|
|
11659
|
+
const hit = HIT.exec(raw);
|
|
11660
|
+
if (hit === null) return void 0;
|
|
11661
|
+
const path = hit[1] ?? "";
|
|
11662
|
+
const text = (hit[3] ?? "").trim();
|
|
11663
|
+
const tier = tierOf(path);
|
|
11504
11664
|
return {
|
|
11505
|
-
path
|
|
11506
|
-
line: Number(
|
|
11507
|
-
text
|
|
11508
|
-
|
|
11665
|
+
path,
|
|
11666
|
+
line: Number(hit[2]),
|
|
11667
|
+
text,
|
|
11668
|
+
declares: tier === "data" ? false : declaresIn(text, term),
|
|
11669
|
+
band: bandOf(path, reading),
|
|
11670
|
+
tier
|
|
11509
11671
|
};
|
|
11510
11672
|
};
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11673
|
+
matchOf = (place) => ({
|
|
11674
|
+
path: place.path,
|
|
11675
|
+
line: place.line,
|
|
11676
|
+
text: place.text,
|
|
11677
|
+
changed: place.band !== "worktree",
|
|
11678
|
+
declares: place.declares,
|
|
11679
|
+
band: place.band,
|
|
11680
|
+
around: []
|
|
11514
11681
|
});
|
|
11515
|
-
|
|
11516
|
-
const found = rows[at];
|
|
11517
|
-
if (found === void 0) return [];
|
|
11518
|
-
return rows.filter((row) => row.path === found.path && Math.abs(row.line - found.line) <= 2).map((row) => `${String(row.line).padStart(5)} ${row.text}`);
|
|
11519
|
-
};
|
|
11520
|
-
byChangedFirst = (left, right) => {
|
|
11521
|
-
if (left.changed !== right.changed) return left.changed ? -1 : 1;
|
|
11522
|
-
return left.path === right.path ? left.line - right.line : left.path.localeCompare(right.path);
|
|
11523
|
-
};
|
|
11524
|
-
searchIn = fn("Cli.searchIn")(function* (reading, term) {
|
|
11682
|
+
searchIn = fn("Cli.searchIn")(function* (reading, term, here = "") {
|
|
11525
11683
|
const git = yield* Git;
|
|
11526
|
-
const
|
|
11527
|
-
const
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
if (!row.hit) continue;
|
|
11532
|
-
found.push({
|
|
11533
|
-
path: row.path,
|
|
11534
|
-
line: row.line,
|
|
11535
|
-
text: row.text.trim(),
|
|
11536
|
-
changed: touched.has(row.path),
|
|
11537
|
-
around: near(rows, at)
|
|
11684
|
+
const changed = new Set(reading.patches.map((patch) => patch.path));
|
|
11685
|
+
const places = (yield* git.grep(reading.worktree, term)).split("\n").filter((line) => line.length > 0).flatMap((line) => {
|
|
11686
|
+
const place = placeIn$1(line, term, {
|
|
11687
|
+
here,
|
|
11688
|
+
changed
|
|
11538
11689
|
});
|
|
11539
|
-
|
|
11540
|
-
|
|
11690
|
+
return place === void 0 ? [] : [place];
|
|
11691
|
+
});
|
|
11692
|
+
const found = ranked(places);
|
|
11693
|
+
return {
|
|
11694
|
+
matches: found.places.map(matchOf),
|
|
11695
|
+
counted: found.counted,
|
|
11696
|
+
left: found.left
|
|
11697
|
+
};
|
|
11541
11698
|
});
|
|
11542
|
-
|
|
11543
|
-
|
|
11699
|
+
aroundIn = fn("Cli.aroundIn")(function* (reading, path, line) {
|
|
11700
|
+
const git = yield* Git;
|
|
11701
|
+
const source = getOrElse$1(yield* git.source(reading.worktree, path), () => []);
|
|
11702
|
+
const from = Math.max(0, line - 1 - AROUND);
|
|
11703
|
+
const to = Math.min(source.length, line + AROUND);
|
|
11704
|
+
return source.slice(from, to).map((text, at) => `${String(from + at + 1).padStart(5)} ${text}`);
|
|
11705
|
+
});
|
|
11706
|
+
searchBranch = fn("Cli.searchBranch")(function* (repo, branch, term, here = "") {
|
|
11707
|
+
return yield* searchIn(yield* readingOf(repo, branch), term, here);
|
|
11544
11708
|
});
|
|
11545
11709
|
}));
|
|
11546
11710
|
//#endregion
|
|
@@ -11551,7 +11715,7 @@ var init_model$1 = __esmMin((() => {
|
|
|
11551
11715
|
}));
|
|
11552
11716
|
//#endregion
|
|
11553
11717
|
//#region src/domain/layers/coverage.ts
|
|
11554
|
-
var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, runsOf, tallyOf, coverage, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
|
|
11718
|
+
var codeBlockOf$1, codeBlocks, noteOf, spansOf$1, changedLines, holds, claimsHunk, runsOf, tallyOf, coverage, runsSaid, filesSaid, leftSaid, unordered, withFullCoverage, proseAnchors;
|
|
11555
11719
|
var init_coverage = __esmMin((() => {
|
|
11556
11720
|
init_dist();
|
|
11557
11721
|
init_model$1();
|
|
@@ -11573,6 +11737,7 @@ var init_coverage = __esmMin((() => {
|
|
|
11573
11737
|
onSome: (line) => [line]
|
|
11574
11738
|
}));
|
|
11575
11739
|
holds = (span, path, line) => span.path === path && span.start <= line && span.end >= line;
|
|
11740
|
+
claimsHunk = (spans, path, hunk) => changedLines(hunk).some((line) => spans.some((span) => holds(span, path, line)));
|
|
11576
11741
|
runsOf = (path, lines) => {
|
|
11577
11742
|
const runs = [];
|
|
11578
11743
|
for (const line of lines.toSorted((a, b) => a - b)) {
|
|
@@ -13420,9 +13585,10 @@ const helpUnder = (noun) => {
|
|
|
13420
13585
|
};
|
|
13421
13586
|
//#endregion
|
|
13422
13587
|
//#region src/tui/gaps.ts
|
|
13423
|
-
var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf$1, openAbove, openBelow, makeRows, compose, cache, keyOf$1, shownOf, gapAtRow, gapNumbered, gapRowSet;
|
|
13588
|
+
var sourceLength, markerText, lastNewLine, spansOf, linesFrom, push, markGap, openOf, countOf$1, openAbove, openBelow, changedIn, elsewhereText, markElsewhere, makeRows, compose, cache, keyOf$1, saidOf, claimOf, shownOf, gapAtRow, gapNumbered, gapRowSet;
|
|
13424
13589
|
var init_gaps = __esmMin((() => {
|
|
13425
13590
|
init_dist();
|
|
13591
|
+
init_layers$1();
|
|
13426
13592
|
sourceLength = (source) => source.at(-1)?.trim() === "" ? source.length - 1 : source.length;
|
|
13427
13593
|
markerText = (hidden) => {
|
|
13428
13594
|
const said = `⋯ ${hidden} ${hidden === 1 ? "line" : "lines"} hidden`;
|
|
@@ -13499,6 +13665,19 @@ var init_gaps = __esmMin((() => {
|
|
|
13499
13665
|
for (const row of linesFrom(build, span.lo, span.lo + open - 1)) push(made, row);
|
|
13500
13666
|
if (count - open > 0) markGap(made, index, count - open);
|
|
13501
13667
|
};
|
|
13668
|
+
changedIn = (hunk) => hunk.rows.filter((row) => row.kind !== "context").length;
|
|
13669
|
+
elsewhereText = (hunk, said) => {
|
|
13670
|
+
const lines = changedIn(hunk);
|
|
13671
|
+
return `⋯ ${lines} changed ${lines === 1 ? "line" : "lines"} · ${said}`;
|
|
13672
|
+
};
|
|
13673
|
+
markElsewhere = (made, hunk, said) => {
|
|
13674
|
+
push(made, {
|
|
13675
|
+
kind: "context",
|
|
13676
|
+
oldLine: none(),
|
|
13677
|
+
newLine: none(),
|
|
13678
|
+
text: elsewhereText(hunk, said)
|
|
13679
|
+
});
|
|
13680
|
+
};
|
|
13502
13681
|
makeRows = (build) => {
|
|
13503
13682
|
const made = {
|
|
13504
13683
|
rows: [],
|
|
@@ -13507,6 +13686,11 @@ var init_gaps = __esmMin((() => {
|
|
|
13507
13686
|
};
|
|
13508
13687
|
for (const [index, hunk] of build.base.hunks.entries()) {
|
|
13509
13688
|
const left = openAbove(made, build, index);
|
|
13689
|
+
const said = build.claim === void 0 || build.claim.claimed.has(index) ? void 0 : build.claim.explains.get(index) ?? "no layer claims them";
|
|
13690
|
+
if (said !== void 0) {
|
|
13691
|
+
markElsewhere(made, hunk, said);
|
|
13692
|
+
continue;
|
|
13693
|
+
}
|
|
13510
13694
|
const startRow = made.rows.length;
|
|
13511
13695
|
for (const row of hunk.rows) push(made, row);
|
|
13512
13696
|
made.hunks.push({
|
|
@@ -13531,18 +13715,44 @@ var init_gaps = __esmMin((() => {
|
|
|
13531
13715
|
};
|
|
13532
13716
|
};
|
|
13533
13717
|
cache = /* @__PURE__ */ new WeakMap();
|
|
13534
|
-
keyOf$1 = (total, full, reveals) => [
|
|
13718
|
+
keyOf$1 = (total, full, reveals, claim) => [
|
|
13535
13719
|
total,
|
|
13536
13720
|
full === void 0 ? 0 : full.rows.length,
|
|
13537
|
-
reveals.map((entry) => `${entry.gap}-${entry.lines}`).join(",")
|
|
13721
|
+
reveals.map((entry) => `${entry.gap}-${entry.lines}`).join(","),
|
|
13722
|
+
claim === void 0 ? "all" : [...claim.claimed].toSorted((a, b) => a - b).join("-")
|
|
13538
13723
|
].join(":");
|
|
13724
|
+
saidOf = (state, at) => {
|
|
13725
|
+
if (at === -1) return "no layer claims them";
|
|
13726
|
+
const layer = state.layers[at];
|
|
13727
|
+
if (layer === void 0 || layer.title === "not in any layer") return "no layer claims them";
|
|
13728
|
+
return `layer ${at + 1} explains them`;
|
|
13729
|
+
};
|
|
13730
|
+
claimOf = (state, base) => {
|
|
13731
|
+
if (state.rail !== "layers" || state.layers.length === 0) return void 0;
|
|
13732
|
+
const layer = state.layers[state.layerIndex];
|
|
13733
|
+
if (layer === void 0) return void 0;
|
|
13734
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
13735
|
+
const explains = /* @__PURE__ */ new Map();
|
|
13736
|
+
for (const [at, hunk] of base.hunks.entries()) {
|
|
13737
|
+
if (claimsHunk(layer.spans, base.path, hunk)) {
|
|
13738
|
+
claimed.add(at);
|
|
13739
|
+
continue;
|
|
13740
|
+
}
|
|
13741
|
+
explains.set(at, saidOf(state, state.layers.findIndex((one) => claimsHunk(one.spans, base.path, hunk))));
|
|
13742
|
+
}
|
|
13743
|
+
return claimed.size === base.hunks.length ? void 0 : {
|
|
13744
|
+
claimed,
|
|
13745
|
+
explains
|
|
13746
|
+
};
|
|
13747
|
+
};
|
|
13539
13748
|
shownOf = (state) => {
|
|
13540
13749
|
const base = state.patches[state.patchIndex];
|
|
13541
13750
|
if (base === void 0) return void 0;
|
|
13542
13751
|
const full = state.full.find((patch) => patch.path === base.path);
|
|
13543
13752
|
const total = sourceLength(state.source);
|
|
13544
13753
|
const reveals = state.revealed.filter((entry) => entry.file === base.path);
|
|
13545
|
-
const
|
|
13754
|
+
const claim = claimOf(state, base);
|
|
13755
|
+
const key = keyOf$1(total, full, reveals, claim);
|
|
13546
13756
|
const known = cache.get(base);
|
|
13547
13757
|
const found = known?.get(key);
|
|
13548
13758
|
if (found !== void 0) return found;
|
|
@@ -13550,7 +13760,8 @@ var init_gaps = __esmMin((() => {
|
|
|
13550
13760
|
base,
|
|
13551
13761
|
full,
|
|
13552
13762
|
spans: spansOf(base, total),
|
|
13553
|
-
reveals
|
|
13763
|
+
reveals,
|
|
13764
|
+
claim
|
|
13554
13765
|
});
|
|
13555
13766
|
const map = known ?? /* @__PURE__ */ new Map();
|
|
13556
13767
|
map.set(key, made);
|
|
@@ -13789,6 +14000,13 @@ var init_model = __esmMin((() => {
|
|
|
13789
14000
|
openLayers: [],
|
|
13790
14001
|
term: "",
|
|
13791
14002
|
matches: [],
|
|
14003
|
+
counted: {
|
|
14004
|
+
file: 0,
|
|
14005
|
+
branch: 0,
|
|
14006
|
+
worktree: 0
|
|
14007
|
+
},
|
|
14008
|
+
leftOut: 0,
|
|
14009
|
+
around: [],
|
|
13792
14010
|
matchIndex: 0,
|
|
13793
14011
|
rail: "tree"
|
|
13794
14012
|
});
|
|
@@ -15500,7 +15718,7 @@ var init_match = __esmMin((() => {
|
|
|
15500
15718
|
}));
|
|
15501
15719
|
//#endregion
|
|
15502
15720
|
//#region src/tui/reduce.ts
|
|
15503
|
-
var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withNoticeHere, withNotice;
|
|
15721
|
+
var clamp, lastRow, rowsIn, withCursorVisible, moveCursor, stepStop, scrolled, restingOn, draggedTo, pickedIn, atRow, noneLeft, layerHunk, nextFileWithComments, atComment, nothingOpen, layerComment, PAN_STEP, panned, moveLayer, inRail, railScrolled, movePanel, layerDown, stepsToEnd, toTop, farOff, byHalf, boundedStep, PANEL_FAR, PANES, paneShown, panesShown, focusStepped, togglePanel, toggleNav, packedAway, zoom, toggleRail, foldDirectory, foldLayer, foldThread, fold, moveBranch, landingOn, revealing, atTheEnd, moveFile, selectHunk, swapEnds, atBranch, grownBy, startSelection, draftMark, openCompose, outOfDiff, BACK_FROM, goBack, walkMatches, openPalette, openKeys, openSettings, moveSettings, flipSetting, movePalette, paletteMatches, keyMatches, offered, paletteChoice, transitions, reduce, resumedAt, atFile, withContext, withFull, allRevealed, revealsAfter, gapShown, gapOpened, panBy, withRemarks, withSent, withArrived, withColumns, laidOver, onLayerHolding, withLayers, withPulls, withSilentForge, withBranches, withSource, withVouched, restoredTo, openedAt, withPatches, TAB_WIDTH, SPACE_CODE, ERASED_FROM, ERASED_TO, readable, legible, withDraft, paletteMoved, paletteClosed, withWaiting, withFinder, withMatches, withAround, withNoticeHere, withNotice;
|
|
15504
15722
|
var init_reduce = __esmMin((() => {
|
|
15505
15723
|
init_dist();
|
|
15506
15724
|
init_patch();
|
|
@@ -15653,7 +15871,10 @@ var init_reduce = __esmMin((() => {
|
|
|
15653
15871
|
patchIndex: landed.file,
|
|
15654
15872
|
railScroll: -1,
|
|
15655
15873
|
top: 0,
|
|
15656
|
-
cursor: landingOn(
|
|
15874
|
+
cursor: landingOn({
|
|
15875
|
+
...state,
|
|
15876
|
+
layerIndex: landed.layer
|
|
15877
|
+
}, landed.file),
|
|
15657
15878
|
anchorRow: 0,
|
|
15658
15879
|
selecting: false
|
|
15659
15880
|
};
|
|
@@ -15822,7 +16043,10 @@ var init_reduce = __esmMin((() => {
|
|
|
15822
16043
|
const drawn = shownOf(held);
|
|
15823
16044
|
if (drawn === void 0) return openingRow(state, patchIndex);
|
|
15824
16045
|
const hidden = gapRowSet(drawn);
|
|
15825
|
-
const
|
|
16046
|
+
const shows = (row) => !hidden.has(row.index) && carriesLine(row);
|
|
16047
|
+
const changed = onLayers(held) ? drawn.patch.rows.findIndex((row) => shows(row) && row.kind !== "context") : -1;
|
|
16048
|
+
if (changed !== -1) return changed;
|
|
16049
|
+
const at = drawn.patch.rows.findIndex(shows);
|
|
15826
16050
|
return at === -1 ? openingRow(state, patchIndex) : at;
|
|
15827
16051
|
};
|
|
15828
16052
|
revealing = (state, patchIndex) => {
|
|
@@ -15849,7 +16073,10 @@ var init_reduce = __esmMin((() => {
|
|
|
15849
16073
|
closed: revealing(state, next),
|
|
15850
16074
|
patchIndex: next,
|
|
15851
16075
|
top: 0,
|
|
15852
|
-
cursor: landingOn(
|
|
16076
|
+
cursor: landingOn({
|
|
16077
|
+
...state,
|
|
16078
|
+
layerIndex: layer
|
|
16079
|
+
}, next),
|
|
15853
16080
|
anchorRow: 0,
|
|
15854
16081
|
selecting: false
|
|
15855
16082
|
};
|
|
@@ -16347,14 +16574,21 @@ var init_reduce = __esmMin((() => {
|
|
|
16347
16574
|
query: seed,
|
|
16348
16575
|
selecting: false
|
|
16349
16576
|
});
|
|
16350
|
-
withMatches = (state,
|
|
16577
|
+
withMatches = (state, found, term) => ({
|
|
16351
16578
|
...state,
|
|
16352
16579
|
screen: "search",
|
|
16353
|
-
matches,
|
|
16580
|
+
matches: found.matches,
|
|
16581
|
+
counted: found.counted,
|
|
16582
|
+
leftOut: found.left,
|
|
16583
|
+
around: [],
|
|
16354
16584
|
matchIndex: 0,
|
|
16355
16585
|
term,
|
|
16356
16586
|
selecting: false
|
|
16357
16587
|
});
|
|
16588
|
+
withAround = (state, around) => ({
|
|
16589
|
+
...state,
|
|
16590
|
+
around
|
|
16591
|
+
});
|
|
16358
16592
|
withNoticeHere = (state, notice) => ({
|
|
16359
16593
|
...state,
|
|
16360
16594
|
notice
|
|
@@ -17227,7 +17461,7 @@ var init_diffview = __esmMin((() => {
|
|
|
17227
17461
|
}));
|
|
17228
17462
|
//#endregion
|
|
17229
17463
|
//#region src/tui/render.ts
|
|
17230
|
-
var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, SENDS, REPLIES, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, foundTitle, CHANGED_MARK, fileRow, blockOf, aroundRow, windowedBlocks, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
|
|
17464
|
+
var ROW_HEIGHT, COMPOSE_WIDTH, GUTTER_X, CHIP_GAP, MODAL_ROOM, COMPOSE_CHROME, COMPOSE_ACTION_ROWS, reportActions, SENDS, REPLIES, actionsText, SNIPPET_LINES, PALETTE_KEY, PALETTE_TITLE, PALETTE_GAP, PALETTE_CHROME, PENDING_CHROME, keysTitle, PALETTE_WIDTH, PANEL_SHARE, PANEL_MAX, PANEL_FLOOR, PANEL_FOOT, PANEL_QUARTER, PANEL_FIFTH, PANE_CHROME, PANE_EDGES, PANE_INSET, DIFF_FLOOR, COMPOSE_EDGE, CRAMPED, CRAMPED_ROWS, DIFF_CHROME_MOST, BRANCH_WIDTH, BRANCH_NAME_MIN, BRANCH_FIXED, STATE_MIN, EMPTY_LIST, MODAL_MARGIN, shareOf, homeWidth, longestName, longestState, keysOf, commandRow, modalWidth, panelWidth, panelTop, panelRows, composeRoom, laidOut$1, STICKY_MAX, pickPaint, PLAIN_PICKED, PICKED, PLAIN_CURSOR, UNDER_CURSOR, GAP_PAINT, frameRoot, crampedBar, bar, makeList, makeDiffPane, makePanel, makeListParts, makeListText, makeGutter, makeScroller, makeScrim, makeScroll, makePalette, asking, makePaletteParts, makeChoices, LIST_LEAD, windowed, listText, SHEET_GAP, sheetRow, groupedBy, sheetBlock, splitInTwo, sheetPaint, sheetDeep, sheetText, SETTING_LEAD, settingsText, stack, makeBody, makeHome, makeModals, makeSettingsParts, makeKeysParts, makeFoundParts, FONTS, logoFont, makeLanding, makeLogo, MAC_KEYS, makeComposeParts, makeCompose, stillThere, quotedFor, clipHead, clipMiddle, clipPath, INDENT_MAX, treeLabel, waitingLabel, inRange, notesOf, remarksOf, notesFor, paired, chipWidth, WAYS_OUT, keptWithin, CHIP_CHUNKS, shortPath, HOME_PATH_MIN, HOME_PATH_CHROME, elide, SUMMARY_LINES, summaryLines, contextLabel, nameRoom, stateRoom, columns, FORGE_SILENT, unaskedForge, branchHeading, atHome, layersCell, baseLabel, stateCell, branchCells, placeLabel, headerParts, panLabel, HEADER_GAP, HEADER_PATH_MIN, headerRoom, headerFitted, fallbackScope, treeMarks, treeTail, treeLine, GUTTER, DIR_LEAD, TITLE_LEAD, FILE_LEAD, STALE_ROOM, STALE_ASKING, STALE_LONG, STALE_MIDDLE, STALE_SHORT, staleSaid, staleBanner, litRow, leftOver, titlePaint, titleMark, titleLook, fileMark, fileLook, layerLook, layerGutter, layerText, standingOnThread, standingOnRemark, standingOnDismissed, offeredIn, PANEL_TITLES, PANEL_ORDER, PANEL_LEAD, PANEL_EMPTY, restingOrHere, FOUND_LEAST, nothingYet, counting, foundBlocks, JOIN, foundTitle, CHANGED_MARK, DECLARED, fileRow, leftRow, placeRow, blockOf, aroundRow, windowedBlocks, REMARK_MARK, remarkWhere, wherePart, panelFile, panelWhere, panelBody, panelMark, panelPair, panelSection, PULL_HINT, panelWindow, moreLine, panelText, Screen;
|
|
17231
17465
|
var init_render = __esmMin((() => {
|
|
17232
17466
|
init_dist();
|
|
17233
17467
|
init_command();
|
|
@@ -18132,21 +18366,69 @@ var init_render = __esmMin((() => {
|
|
|
18132
18366
|
if (wanted.length === 0 || state.term.length === 0) return "".padEnd(room);
|
|
18133
18367
|
return clip(` nothing uses ${wanted}`, room).padEnd(room);
|
|
18134
18368
|
};
|
|
18135
|
-
|
|
18136
|
-
|
|
18369
|
+
counting = (many) => many.toLocaleString("en-US");
|
|
18370
|
+
foundBlocks = (state, shown, wide) => {
|
|
18371
|
+
const blocks = [];
|
|
18372
|
+
let chosen = 0;
|
|
18373
|
+
for (const [at, match] of shown.entries()) {
|
|
18374
|
+
if (shown[at - 1]?.path !== match.path) blocks.push(fileRow(match, wide, shown.some((one) => one.path === match.path && one.declares)));
|
|
18375
|
+
if (at === state.matchIndex) chosen = blocks.length;
|
|
18376
|
+
blocks.push(blockOf(match, wide, at === state.matchIndex, state.around));
|
|
18377
|
+
}
|
|
18378
|
+
if (state.leftOut > 0 && shown.length > 0) blocks.push(leftRow(state.leftOut, wide));
|
|
18379
|
+
return {
|
|
18380
|
+
blocks,
|
|
18381
|
+
chosen
|
|
18382
|
+
};
|
|
18383
|
+
};
|
|
18384
|
+
JOIN = " · ";
|
|
18385
|
+
foundTitle = (state, room) => {
|
|
18137
18386
|
if (state.term.length === 0) return "Look for something";
|
|
18138
|
-
|
|
18387
|
+
const counted = state.counted;
|
|
18388
|
+
if (counted.worktree === 0) return state.term;
|
|
18389
|
+
const here = `${counting(counted.file)} in this file`;
|
|
18390
|
+
const branch = `${counting(counted.branch)} on this branch`;
|
|
18391
|
+
const whole = `${counting(counted.worktree)} in the worktree`;
|
|
18392
|
+
const tried = [
|
|
18393
|
+
[
|
|
18394
|
+
state.term,
|
|
18395
|
+
here,
|
|
18396
|
+
branch,
|
|
18397
|
+
whole
|
|
18398
|
+
],
|
|
18399
|
+
[
|
|
18400
|
+
state.term,
|
|
18401
|
+
here,
|
|
18402
|
+
whole
|
|
18403
|
+
],
|
|
18404
|
+
[state.term, whole],
|
|
18405
|
+
[state.term]
|
|
18406
|
+
].map((parts) => parts.join(JOIN));
|
|
18407
|
+
return tried.find((one) => one.length <= room) ?? clip(tried.at(-1) ?? "", room);
|
|
18139
18408
|
};
|
|
18140
18409
|
CHANGED_MARK = "*";
|
|
18141
|
-
|
|
18142
|
-
|
|
18410
|
+
DECLARED = "declared";
|
|
18411
|
+
fileRow = (match, room, declares) => {
|
|
18412
|
+
const lead = match.changed ? CHANGED_MARK : " ";
|
|
18413
|
+
const tail = declares ? ` ${DECLARED}` : "";
|
|
18414
|
+
const shown = ` ${lead} ${clipHead(match.path, Math.max(8, room - 3 - tail.length))}${tail}`;
|
|
18143
18415
|
return {
|
|
18144
18416
|
rows: 1,
|
|
18145
|
-
chunks: [fg(palette.accent)(
|
|
18417
|
+
chunks: [fg(palette.accent)(shown.padEnd(room)), fg(palette.faint)("\n")]
|
|
18146
18418
|
};
|
|
18147
18419
|
};
|
|
18148
|
-
|
|
18149
|
-
|
|
18420
|
+
leftRow = (left, room) => ({
|
|
18421
|
+
rows: 1,
|
|
18422
|
+
chunks: [fg(palette.faint)(clip(` … ${counting(left)} more places not shown`, room).padEnd(room)), fg(palette.faint)("\n")]
|
|
18423
|
+
});
|
|
18424
|
+
placeRow = (match, room) => {
|
|
18425
|
+
const tail = match.declares ? ` ${DECLARED}` : "";
|
|
18426
|
+
const text = clip(match.text.trim(), Math.max(1, room - 11 - tail.length));
|
|
18427
|
+
const line = ` ${String(match.line).padStart(5)} ${text}${tail}`;
|
|
18428
|
+
return fg(match.declares ? palette.ink : palette.muted)(line.padEnd(room));
|
|
18429
|
+
};
|
|
18430
|
+
blockOf = (match, room, here, around) => {
|
|
18431
|
+
const lit = (here && around.length > 0 ? around.map((line) => aroundRow(line, match.line, room)) : [placeRow(match, room)]).map((chunk) => here ? bg(palette.selection)(chunk) : chunk);
|
|
18150
18432
|
return {
|
|
18151
18433
|
rows: lit.length,
|
|
18152
18434
|
chunks: lit.flatMap((chunk) => [chunk, fg(palette.faint)("\n")])
|
|
@@ -18820,16 +19102,10 @@ var init_render = __esmMin((() => {
|
|
|
18820
19102
|
}
|
|
18821
19103
|
const room = panelWidth(this.renderer.width);
|
|
18822
19104
|
const wide = Math.max(1, room - MODAL_ROOM);
|
|
18823
|
-
this.foundTitle.content = foundTitle(state);
|
|
19105
|
+
this.foundTitle.content = foundTitle(state, wide);
|
|
18824
19106
|
const shown = shownMatches(state);
|
|
18825
19107
|
const most = panelRows(this.renderer.height, PANEL_FIFTH);
|
|
18826
|
-
const blocks =
|
|
18827
|
-
let chosen = 0;
|
|
18828
|
-
for (const [at, match] of shown.entries()) {
|
|
18829
|
-
if (shown[at - 1]?.path !== match.path) blocks.push(fileRow(match, wide));
|
|
18830
|
-
if (at === state.matchIndex) chosen = blocks.length;
|
|
18831
|
-
blocks.push(blockOf(match, wide, at === state.matchIndex));
|
|
18832
|
-
}
|
|
19108
|
+
const { blocks, chosen } = foundBlocks(state, shown, wide);
|
|
18833
19109
|
const tall = Math.max(FOUND_LEAST, most - PALETTE_CHROME);
|
|
18834
19110
|
const window = windowedBlocks(blocks, chosen, tall);
|
|
18835
19111
|
this.foundChoices.content = blocks.length === 0 ? new StyledText([fg(palette.faint)(nothingYet(state, wide))]) : new StyledText([...window.chunks]);
|
|
@@ -19065,7 +19341,7 @@ var init_upgrade = __esmMin((() => {
|
|
|
19065
19341
|
}));
|
|
19066
19342
|
//#endregion
|
|
19067
19343
|
//#region src/tui/app.ts
|
|
19068
|
-
var LEAVING_MS, LOOK_MS, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
|
|
19344
|
+
var LEAVING_MS, LOOK_MS, LEAST_TERM, AGE_TICK_MS, LEAVING_SAID, NOTHING_WRITTEN, NOTHING_COUNTED, READING_PULL, FORGE_QUIET, countOf, leavingSaid, LAYERS_ASK_LEAD, layersAsk, askedFor, alongFrom, NOTICE_MS, KEY_HISTORY, DRAIN_PASSES, TRAIL_HISTORY, clockOf, momentOf, noticeOf, COPIERS, wayland, seedFor, handOver, throughMultiplexer, copyToClipboard, lineUnder, asKey, openedPull, LISTENS, WRITES, OVER, overReview, writesInto, listens, LETTER, laidOut, ARROWS, SHIFTED, keyName, App, sentAway, turnedOver, settledPath, restsWhereItLanded, lonelyGaps, chosenIn, settingsHeld, firstBranches, missing, openingOn, launch, told, untilDestroyed, runOn, runTui;
|
|
19069
19345
|
var init_app = __esmMin((() => {
|
|
19070
19346
|
init_dist();
|
|
19071
19347
|
init_report();
|
|
@@ -19084,10 +19360,16 @@ var init_app = __esmMin((() => {
|
|
|
19084
19360
|
init_session();
|
|
19085
19361
|
init_upgrade();
|
|
19086
19362
|
LEAVING_MS = 3e3;
|
|
19087
|
-
LOOK_MS =
|
|
19363
|
+
LOOK_MS = 260;
|
|
19364
|
+
LEAST_TERM = 2;
|
|
19088
19365
|
AGE_TICK_MS = 3e4;
|
|
19089
19366
|
LEAVING_SAID = "press ctrl+c again to leave";
|
|
19090
19367
|
NOTHING_WRITTEN = "nothing written yet";
|
|
19368
|
+
NOTHING_COUNTED = {
|
|
19369
|
+
file: 0,
|
|
19370
|
+
branch: 0,
|
|
19371
|
+
worktree: 0
|
|
19372
|
+
};
|
|
19091
19373
|
READING_PULL = "reading the pull request";
|
|
19092
19374
|
FORGE_QUIET = "the forge did not answer, so no remarks are shown";
|
|
19093
19375
|
countOf = (many, one) => `${many} ${one}${many === 1 ? "" : "s"}`;
|
|
@@ -19263,6 +19545,7 @@ var init_app = __esmMin((() => {
|
|
|
19263
19545
|
lighting;
|
|
19264
19546
|
sourcing;
|
|
19265
19547
|
fetching;
|
|
19548
|
+
searching;
|
|
19266
19549
|
constructor(options) {
|
|
19267
19550
|
this.renderer = options.renderer;
|
|
19268
19551
|
this.repo = options.repo;
|
|
@@ -19423,12 +19706,16 @@ var init_app = __esmMin((() => {
|
|
|
19423
19706
|
}
|
|
19424
19707
|
settled() {
|
|
19425
19708
|
if (this.consuming === void 0) return Promise.resolve();
|
|
19426
|
-
return runPromise(andThen(andThen(andThen(this.drained(), suspend(() => this.stillSourcing())), suspend(() => this.stillFetching())), suspend(() => this.stillLighting())));
|
|
19709
|
+
return runPromise(andThen(andThen(andThen(this.drained(), suspend(() => this.stillSourcing())), suspend(() => this.stillFetching())).pipe(andThen(suspend(() => this.stillSearching()))), suspend(() => this.stillLighting())));
|
|
19427
19710
|
}
|
|
19428
19711
|
stillFetching() {
|
|
19429
19712
|
const fiber = this.fetching;
|
|
19430
19713
|
return fiber === void 0 ? void_ : asVoid(await_(fiber));
|
|
19431
19714
|
}
|
|
19715
|
+
stillSearching() {
|
|
19716
|
+
const fiber = this.searching;
|
|
19717
|
+
return fiber === void 0 ? void_ : asVoid(await_(fiber));
|
|
19718
|
+
}
|
|
19432
19719
|
stillSourcing() {
|
|
19433
19720
|
const fiber = this.sourcing;
|
|
19434
19721
|
return fiber === void 0 ? void_ : asVoid(await_(fiber));
|
|
@@ -19624,9 +19911,17 @@ var init_app = __esmMin((() => {
|
|
|
19624
19911
|
"context.less": () => this.expand(-1),
|
|
19625
19912
|
"context.whole": () => this.widen(contextToggled(this.state)),
|
|
19626
19913
|
"tree.expand": () => this.unfold(1),
|
|
19627
|
-
"tree.collapse": () => this.unfold(-1)
|
|
19914
|
+
"tree.collapse": () => this.unfold(-1),
|
|
19915
|
+
"match.next": () => this.walkMatches(1),
|
|
19916
|
+
"match.prev": () => this.walkMatches(-1)
|
|
19628
19917
|
};
|
|
19629
19918
|
}
|
|
19919
|
+
walkMatches(delta) {
|
|
19920
|
+
return gen({ self: this }, function* () {
|
|
19921
|
+
this.commit(reduce(this.measured(), delta > 0 ? "match.next" : "match.prev"));
|
|
19922
|
+
yield* this.readAround();
|
|
19923
|
+
});
|
|
19924
|
+
}
|
|
19630
19925
|
unfold(delta) {
|
|
19631
19926
|
return gen({ self: this }, function* () {
|
|
19632
19927
|
const gap = this.state.focus === "diff" ? gapAtRow(this.state, this.state.cursor) : void 0;
|
|
@@ -19834,7 +20129,7 @@ var init_app = __esmMin((() => {
|
|
|
19834
20129
|
this.looking = void 0;
|
|
19835
20130
|
const asked = wanted.trim();
|
|
19836
20131
|
if (this.state.screen !== "search" || this.state.query.trim() !== asked) return;
|
|
19837
|
-
this.dispatchTask(asked.length
|
|
20132
|
+
this.dispatchTask(asked.length < LEAST_TERM ? this.forgetMatches() : this.searchAside(asked));
|
|
19838
20133
|
}, LOOK_MS);
|
|
19839
20134
|
}
|
|
19840
20135
|
stopLooking() {
|
|
@@ -19843,12 +20138,17 @@ var init_app = __esmMin((() => {
|
|
|
19843
20138
|
this.looking = void 0;
|
|
19844
20139
|
}
|
|
19845
20140
|
forgetMatches() {
|
|
19846
|
-
return sync(() => this.commit(withMatches(this.state,
|
|
20141
|
+
return sync(() => this.commit(withMatches(this.state, {
|
|
20142
|
+
matches: [],
|
|
20143
|
+
counted: NOTHING_COUNTED,
|
|
20144
|
+
left: 0
|
|
20145
|
+
}, "")));
|
|
19847
20146
|
}
|
|
19848
20147
|
runFinder() {
|
|
19849
20148
|
return gen({ self: this }, function* () {
|
|
19850
20149
|
const wanted = this.state.query.trim();
|
|
19851
|
-
if (wanted.length
|
|
20150
|
+
if (wanted.length < LEAST_TERM) return;
|
|
20151
|
+
if (wanted !== this.state.term) {
|
|
19852
20152
|
this.stopLooking();
|
|
19853
20153
|
yield* this.lookFor(wanted);
|
|
19854
20154
|
return;
|
|
@@ -19856,13 +20156,38 @@ var init_app = __esmMin((() => {
|
|
|
19856
20156
|
yield* this.openMatch();
|
|
19857
20157
|
});
|
|
19858
20158
|
}
|
|
20159
|
+
searchAside(wanted) {
|
|
20160
|
+
return gen({ self: this }, function* () {
|
|
20161
|
+
this.stopSearching();
|
|
20162
|
+
this.searching = yield* forkDetach(this.lookFor(wanted));
|
|
20163
|
+
});
|
|
20164
|
+
}
|
|
20165
|
+
stopSearching() {
|
|
20166
|
+
const fiber = this.searching;
|
|
20167
|
+
this.searching = void 0;
|
|
20168
|
+
if (fiber !== void 0) runFork(interrupt(fiber));
|
|
20169
|
+
}
|
|
19859
20170
|
lookFor(wanted) {
|
|
19860
20171
|
return gen({ self: this }, function* () {
|
|
19861
20172
|
const branch = selectedBranch(this.state);
|
|
19862
20173
|
if (branch === void 0) return;
|
|
19863
20174
|
const reading = this.reading;
|
|
19864
|
-
const
|
|
20175
|
+
const here = selectedPatch(this.state)?.path ?? "";
|
|
20176
|
+
const found = reading === void 0 || reading.worktree.branch !== branch.branch ? yield* searchBranch(this.repo, branch.branch, wanted, here) : yield* searchIn(reading, wanted, here);
|
|
20177
|
+
if (this.state.screen !== "search" || this.state.query.trim() !== wanted) return;
|
|
19865
20178
|
this.commit(withMatches(this.state, found, wanted));
|
|
20179
|
+
yield* this.readAround();
|
|
20180
|
+
});
|
|
20181
|
+
}
|
|
20182
|
+
readAround() {
|
|
20183
|
+
return gen({ self: this }, function* () {
|
|
20184
|
+
const reading = this.reading;
|
|
20185
|
+
const match = matchHere(this.state);
|
|
20186
|
+
if (reading === void 0 || match === void 0) return;
|
|
20187
|
+
const lines = yield* aroundIn(reading, match.path, match.line);
|
|
20188
|
+
const still = matchHere(this.state);
|
|
20189
|
+
if (still?.path !== match.path || still.line !== match.line) return;
|
|
20190
|
+
this.commit(withAround(this.state, lines));
|
|
19866
20191
|
});
|
|
19867
20192
|
}
|
|
19868
20193
|
openMatch() {
|
|
@@ -20411,6 +20736,7 @@ var init_app = __esmMin((() => {
|
|
|
20411
20736
|
this.stopLighting();
|
|
20412
20737
|
this.stopSourcing();
|
|
20413
20738
|
this.stopFetching();
|
|
20739
|
+
this.stopSearching();
|
|
20414
20740
|
this.stopPainting();
|
|
20415
20741
|
this.stopConsuming();
|
|
20416
20742
|
getTreeSitterClient().destroy();
|
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.153",
|
|
27
27
|
"description": "Review the work an agent left you without losing the thread: comments live on the lines, the agent answers them, and each point stays open until you settle it.",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"repository": {
|