@eliya-oss/agent-diff 0.1.0-alpha.151 → 0.1.0-alpha.152
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 +38 -0
- package/dist/main.js +363 -93
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @eliya-oss/agent-diff
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.152
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
<details><summary>What was wrong</summary>
|
|
10
|
+
|
|
11
|
+
Searching a monorepo for a common name handed back every place git happened to print, in git's
|
|
12
|
+
order: twenty-three thousand rows, with the file you were reading somewhere in the middle and
|
|
13
|
+
`.txt` corpora, Dockerfiles and documents above the code. The count for each distance is said now,
|
|
14
|
+
so a name with ten places in your file and twelve hundred elsewhere says both.
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
|
|
18
|
+
perf(search): searching a monorepo for a name costs one git pass over hit lines, not one per keystroke over every neighbouring line.
|
|
19
|
+
|
|
20
|
+
<details><summary>What was wrong</summary>
|
|
21
|
+
|
|
22
|
+
Every search asked git for two lines of context around every match — 6,832 lines for one name in a
|
|
23
|
+
monorepo against 1,421 hits — and then scanned all of them once per match to build the neighbours
|
|
24
|
+
of places nobody was looking at. At typing speed each keystroke started another one, so typing a
|
|
25
|
+
name of eight letters started eight, each queued behind the last. A search now reads hit lines
|
|
26
|
+
only, reads the neighbours of the one place under the cursor, waits until you have stopped typing,
|
|
27
|
+
and runs beside the terminal rather than in front of it.
|
|
28
|
+
|
|
29
|
+
</details>
|
|
30
|
+
|
|
31
|
+
fix(search): a search waits for two letters, and an answer that arrives for a word you have moved on from is dropped.
|
|
32
|
+
|
|
33
|
+
<details><summary>What was wrong</summary>
|
|
34
|
+
|
|
35
|
+
Typing `i` on the way to `identity` searched for `i`, which in a monorepo is twenty-two thousand
|
|
36
|
+
places; the answer landed after the later ones and the list then showed the places for `i` under
|
|
37
|
+
the word `identity`.
|
|
38
|
+
|
|
39
|
+
</details>
|
|
40
|
+
|
|
3
41
|
## 0.1.0-alpha.151
|
|
4
42
|
|
|
5
43
|
### 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.152";
|
|
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
|
|
@@ -13789,6 +13953,13 @@ var init_model = __esmMin((() => {
|
|
|
13789
13953
|
openLayers: [],
|
|
13790
13954
|
term: "",
|
|
13791
13955
|
matches: [],
|
|
13956
|
+
counted: {
|
|
13957
|
+
file: 0,
|
|
13958
|
+
branch: 0,
|
|
13959
|
+
worktree: 0
|
|
13960
|
+
},
|
|
13961
|
+
leftOut: 0,
|
|
13962
|
+
around: [],
|
|
13792
13963
|
matchIndex: 0,
|
|
13793
13964
|
rail: "tree"
|
|
13794
13965
|
});
|
|
@@ -15500,7 +15671,7 @@ var init_match = __esmMin((() => {
|
|
|
15500
15671
|
}));
|
|
15501
15672
|
//#endregion
|
|
15502
15673
|
//#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;
|
|
15674
|
+
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
15675
|
var init_reduce = __esmMin((() => {
|
|
15505
15676
|
init_dist();
|
|
15506
15677
|
init_patch();
|
|
@@ -16347,14 +16518,21 @@ var init_reduce = __esmMin((() => {
|
|
|
16347
16518
|
query: seed,
|
|
16348
16519
|
selecting: false
|
|
16349
16520
|
});
|
|
16350
|
-
withMatches = (state,
|
|
16521
|
+
withMatches = (state, found, term) => ({
|
|
16351
16522
|
...state,
|
|
16352
16523
|
screen: "search",
|
|
16353
|
-
matches,
|
|
16524
|
+
matches: found.matches,
|
|
16525
|
+
counted: found.counted,
|
|
16526
|
+
leftOut: found.left,
|
|
16527
|
+
around: [],
|
|
16354
16528
|
matchIndex: 0,
|
|
16355
16529
|
term,
|
|
16356
16530
|
selecting: false
|
|
16357
16531
|
});
|
|
16532
|
+
withAround = (state, around) => ({
|
|
16533
|
+
...state,
|
|
16534
|
+
around
|
|
16535
|
+
});
|
|
16358
16536
|
withNoticeHere = (state, notice) => ({
|
|
16359
16537
|
...state,
|
|
16360
16538
|
notice
|
|
@@ -17227,7 +17405,7 @@ var init_diffview = __esmMin((() => {
|
|
|
17227
17405
|
}));
|
|
17228
17406
|
//#endregion
|
|
17229
17407
|
//#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;
|
|
17408
|
+
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
17409
|
var init_render = __esmMin((() => {
|
|
17232
17410
|
init_dist();
|
|
17233
17411
|
init_command();
|
|
@@ -18132,21 +18310,69 @@ var init_render = __esmMin((() => {
|
|
|
18132
18310
|
if (wanted.length === 0 || state.term.length === 0) return "".padEnd(room);
|
|
18133
18311
|
return clip(` nothing uses ${wanted}`, room).padEnd(room);
|
|
18134
18312
|
};
|
|
18135
|
-
|
|
18136
|
-
|
|
18313
|
+
counting = (many) => many.toLocaleString("en-US");
|
|
18314
|
+
foundBlocks = (state, shown, wide) => {
|
|
18315
|
+
const blocks = [];
|
|
18316
|
+
let chosen = 0;
|
|
18317
|
+
for (const [at, match] of shown.entries()) {
|
|
18318
|
+
if (shown[at - 1]?.path !== match.path) blocks.push(fileRow(match, wide, shown.some((one) => one.path === match.path && one.declares)));
|
|
18319
|
+
if (at === state.matchIndex) chosen = blocks.length;
|
|
18320
|
+
blocks.push(blockOf(match, wide, at === state.matchIndex, state.around));
|
|
18321
|
+
}
|
|
18322
|
+
if (state.leftOut > 0 && shown.length > 0) blocks.push(leftRow(state.leftOut, wide));
|
|
18323
|
+
return {
|
|
18324
|
+
blocks,
|
|
18325
|
+
chosen
|
|
18326
|
+
};
|
|
18327
|
+
};
|
|
18328
|
+
JOIN = " · ";
|
|
18329
|
+
foundTitle = (state, room) => {
|
|
18137
18330
|
if (state.term.length === 0) return "Look for something";
|
|
18138
|
-
|
|
18331
|
+
const counted = state.counted;
|
|
18332
|
+
if (counted.worktree === 0) return state.term;
|
|
18333
|
+
const here = `${counting(counted.file)} in this file`;
|
|
18334
|
+
const branch = `${counting(counted.branch)} on this branch`;
|
|
18335
|
+
const whole = `${counting(counted.worktree)} in the worktree`;
|
|
18336
|
+
const tried = [
|
|
18337
|
+
[
|
|
18338
|
+
state.term,
|
|
18339
|
+
here,
|
|
18340
|
+
branch,
|
|
18341
|
+
whole
|
|
18342
|
+
],
|
|
18343
|
+
[
|
|
18344
|
+
state.term,
|
|
18345
|
+
here,
|
|
18346
|
+
whole
|
|
18347
|
+
],
|
|
18348
|
+
[state.term, whole],
|
|
18349
|
+
[state.term]
|
|
18350
|
+
].map((parts) => parts.join(JOIN));
|
|
18351
|
+
return tried.find((one) => one.length <= room) ?? clip(tried.at(-1) ?? "", room);
|
|
18139
18352
|
};
|
|
18140
18353
|
CHANGED_MARK = "*";
|
|
18141
|
-
|
|
18142
|
-
|
|
18354
|
+
DECLARED = "declared";
|
|
18355
|
+
fileRow = (match, room, declares) => {
|
|
18356
|
+
const lead = match.changed ? CHANGED_MARK : " ";
|
|
18357
|
+
const tail = declares ? ` ${DECLARED}` : "";
|
|
18358
|
+
const shown = ` ${lead} ${clipHead(match.path, Math.max(8, room - 3 - tail.length))}${tail}`;
|
|
18143
18359
|
return {
|
|
18144
18360
|
rows: 1,
|
|
18145
|
-
chunks: [fg(palette.accent)(
|
|
18361
|
+
chunks: [fg(palette.accent)(shown.padEnd(room)), fg(palette.faint)("\n")]
|
|
18146
18362
|
};
|
|
18147
18363
|
};
|
|
18148
|
-
|
|
18149
|
-
|
|
18364
|
+
leftRow = (left, room) => ({
|
|
18365
|
+
rows: 1,
|
|
18366
|
+
chunks: [fg(palette.faint)(clip(` … ${counting(left)} more places not shown`, room).padEnd(room)), fg(palette.faint)("\n")]
|
|
18367
|
+
});
|
|
18368
|
+
placeRow = (match, room) => {
|
|
18369
|
+
const tail = match.declares ? ` ${DECLARED}` : "";
|
|
18370
|
+
const text = clip(match.text.trim(), Math.max(1, room - 11 - tail.length));
|
|
18371
|
+
const line = ` ${String(match.line).padStart(5)} ${text}${tail}`;
|
|
18372
|
+
return fg(match.declares ? palette.ink : palette.muted)(line.padEnd(room));
|
|
18373
|
+
};
|
|
18374
|
+
blockOf = (match, room, here, around) => {
|
|
18375
|
+
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
18376
|
return {
|
|
18151
18377
|
rows: lit.length,
|
|
18152
18378
|
chunks: lit.flatMap((chunk) => [chunk, fg(palette.faint)("\n")])
|
|
@@ -18820,16 +19046,10 @@ var init_render = __esmMin((() => {
|
|
|
18820
19046
|
}
|
|
18821
19047
|
const room = panelWidth(this.renderer.width);
|
|
18822
19048
|
const wide = Math.max(1, room - MODAL_ROOM);
|
|
18823
|
-
this.foundTitle.content = foundTitle(state);
|
|
19049
|
+
this.foundTitle.content = foundTitle(state, wide);
|
|
18824
19050
|
const shown = shownMatches(state);
|
|
18825
19051
|
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
|
-
}
|
|
19052
|
+
const { blocks, chosen } = foundBlocks(state, shown, wide);
|
|
18833
19053
|
const tall = Math.max(FOUND_LEAST, most - PALETTE_CHROME);
|
|
18834
19054
|
const window = windowedBlocks(blocks, chosen, tall);
|
|
18835
19055
|
this.foundChoices.content = blocks.length === 0 ? new StyledText([fg(palette.faint)(nothingYet(state, wide))]) : new StyledText([...window.chunks]);
|
|
@@ -19065,7 +19285,7 @@ var init_upgrade = __esmMin((() => {
|
|
|
19065
19285
|
}));
|
|
19066
19286
|
//#endregion
|
|
19067
19287
|
//#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;
|
|
19288
|
+
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
19289
|
var init_app = __esmMin((() => {
|
|
19070
19290
|
init_dist();
|
|
19071
19291
|
init_report();
|
|
@@ -19084,10 +19304,16 @@ var init_app = __esmMin((() => {
|
|
|
19084
19304
|
init_session();
|
|
19085
19305
|
init_upgrade();
|
|
19086
19306
|
LEAVING_MS = 3e3;
|
|
19087
|
-
LOOK_MS =
|
|
19307
|
+
LOOK_MS = 260;
|
|
19308
|
+
LEAST_TERM = 2;
|
|
19088
19309
|
AGE_TICK_MS = 3e4;
|
|
19089
19310
|
LEAVING_SAID = "press ctrl+c again to leave";
|
|
19090
19311
|
NOTHING_WRITTEN = "nothing written yet";
|
|
19312
|
+
NOTHING_COUNTED = {
|
|
19313
|
+
file: 0,
|
|
19314
|
+
branch: 0,
|
|
19315
|
+
worktree: 0
|
|
19316
|
+
};
|
|
19091
19317
|
READING_PULL = "reading the pull request";
|
|
19092
19318
|
FORGE_QUIET = "the forge did not answer, so no remarks are shown";
|
|
19093
19319
|
countOf = (many, one) => `${many} ${one}${many === 1 ? "" : "s"}`;
|
|
@@ -19263,6 +19489,7 @@ var init_app = __esmMin((() => {
|
|
|
19263
19489
|
lighting;
|
|
19264
19490
|
sourcing;
|
|
19265
19491
|
fetching;
|
|
19492
|
+
searching;
|
|
19266
19493
|
constructor(options) {
|
|
19267
19494
|
this.renderer = options.renderer;
|
|
19268
19495
|
this.repo = options.repo;
|
|
@@ -19423,12 +19650,16 @@ var init_app = __esmMin((() => {
|
|
|
19423
19650
|
}
|
|
19424
19651
|
settled() {
|
|
19425
19652
|
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())));
|
|
19653
|
+
return runPromise(andThen(andThen(andThen(this.drained(), suspend(() => this.stillSourcing())), suspend(() => this.stillFetching())).pipe(andThen(suspend(() => this.stillSearching()))), suspend(() => this.stillLighting())));
|
|
19427
19654
|
}
|
|
19428
19655
|
stillFetching() {
|
|
19429
19656
|
const fiber = this.fetching;
|
|
19430
19657
|
return fiber === void 0 ? void_ : asVoid(await_(fiber));
|
|
19431
19658
|
}
|
|
19659
|
+
stillSearching() {
|
|
19660
|
+
const fiber = this.searching;
|
|
19661
|
+
return fiber === void 0 ? void_ : asVoid(await_(fiber));
|
|
19662
|
+
}
|
|
19432
19663
|
stillSourcing() {
|
|
19433
19664
|
const fiber = this.sourcing;
|
|
19434
19665
|
return fiber === void 0 ? void_ : asVoid(await_(fiber));
|
|
@@ -19624,9 +19855,17 @@ var init_app = __esmMin((() => {
|
|
|
19624
19855
|
"context.less": () => this.expand(-1),
|
|
19625
19856
|
"context.whole": () => this.widen(contextToggled(this.state)),
|
|
19626
19857
|
"tree.expand": () => this.unfold(1),
|
|
19627
|
-
"tree.collapse": () => this.unfold(-1)
|
|
19858
|
+
"tree.collapse": () => this.unfold(-1),
|
|
19859
|
+
"match.next": () => this.walkMatches(1),
|
|
19860
|
+
"match.prev": () => this.walkMatches(-1)
|
|
19628
19861
|
};
|
|
19629
19862
|
}
|
|
19863
|
+
walkMatches(delta) {
|
|
19864
|
+
return gen({ self: this }, function* () {
|
|
19865
|
+
this.commit(reduce(this.measured(), delta > 0 ? "match.next" : "match.prev"));
|
|
19866
|
+
yield* this.readAround();
|
|
19867
|
+
});
|
|
19868
|
+
}
|
|
19630
19869
|
unfold(delta) {
|
|
19631
19870
|
return gen({ self: this }, function* () {
|
|
19632
19871
|
const gap = this.state.focus === "diff" ? gapAtRow(this.state, this.state.cursor) : void 0;
|
|
@@ -19834,7 +20073,7 @@ var init_app = __esmMin((() => {
|
|
|
19834
20073
|
this.looking = void 0;
|
|
19835
20074
|
const asked = wanted.trim();
|
|
19836
20075
|
if (this.state.screen !== "search" || this.state.query.trim() !== asked) return;
|
|
19837
|
-
this.dispatchTask(asked.length
|
|
20076
|
+
this.dispatchTask(asked.length < LEAST_TERM ? this.forgetMatches() : this.searchAside(asked));
|
|
19838
20077
|
}, LOOK_MS);
|
|
19839
20078
|
}
|
|
19840
20079
|
stopLooking() {
|
|
@@ -19843,12 +20082,17 @@ var init_app = __esmMin((() => {
|
|
|
19843
20082
|
this.looking = void 0;
|
|
19844
20083
|
}
|
|
19845
20084
|
forgetMatches() {
|
|
19846
|
-
return sync(() => this.commit(withMatches(this.state,
|
|
20085
|
+
return sync(() => this.commit(withMatches(this.state, {
|
|
20086
|
+
matches: [],
|
|
20087
|
+
counted: NOTHING_COUNTED,
|
|
20088
|
+
left: 0
|
|
20089
|
+
}, "")));
|
|
19847
20090
|
}
|
|
19848
20091
|
runFinder() {
|
|
19849
20092
|
return gen({ self: this }, function* () {
|
|
19850
20093
|
const wanted = this.state.query.trim();
|
|
19851
|
-
if (wanted.length
|
|
20094
|
+
if (wanted.length < LEAST_TERM) return;
|
|
20095
|
+
if (wanted !== this.state.term) {
|
|
19852
20096
|
this.stopLooking();
|
|
19853
20097
|
yield* this.lookFor(wanted);
|
|
19854
20098
|
return;
|
|
@@ -19856,13 +20100,38 @@ var init_app = __esmMin((() => {
|
|
|
19856
20100
|
yield* this.openMatch();
|
|
19857
20101
|
});
|
|
19858
20102
|
}
|
|
20103
|
+
searchAside(wanted) {
|
|
20104
|
+
return gen({ self: this }, function* () {
|
|
20105
|
+
this.stopSearching();
|
|
20106
|
+
this.searching = yield* forkDetach(this.lookFor(wanted));
|
|
20107
|
+
});
|
|
20108
|
+
}
|
|
20109
|
+
stopSearching() {
|
|
20110
|
+
const fiber = this.searching;
|
|
20111
|
+
this.searching = void 0;
|
|
20112
|
+
if (fiber !== void 0) runFork(interrupt(fiber));
|
|
20113
|
+
}
|
|
19859
20114
|
lookFor(wanted) {
|
|
19860
20115
|
return gen({ self: this }, function* () {
|
|
19861
20116
|
const branch = selectedBranch(this.state);
|
|
19862
20117
|
if (branch === void 0) return;
|
|
19863
20118
|
const reading = this.reading;
|
|
19864
|
-
const
|
|
20119
|
+
const here = selectedPatch(this.state)?.path ?? "";
|
|
20120
|
+
const found = reading === void 0 || reading.worktree.branch !== branch.branch ? yield* searchBranch(this.repo, branch.branch, wanted, here) : yield* searchIn(reading, wanted, here);
|
|
20121
|
+
if (this.state.screen !== "search" || this.state.query.trim() !== wanted) return;
|
|
19865
20122
|
this.commit(withMatches(this.state, found, wanted));
|
|
20123
|
+
yield* this.readAround();
|
|
20124
|
+
});
|
|
20125
|
+
}
|
|
20126
|
+
readAround() {
|
|
20127
|
+
return gen({ self: this }, function* () {
|
|
20128
|
+
const reading = this.reading;
|
|
20129
|
+
const match = matchHere(this.state);
|
|
20130
|
+
if (reading === void 0 || match === void 0) return;
|
|
20131
|
+
const lines = yield* aroundIn(reading, match.path, match.line);
|
|
20132
|
+
const still = matchHere(this.state);
|
|
20133
|
+
if (still?.path !== match.path || still.line !== match.line) return;
|
|
20134
|
+
this.commit(withAround(this.state, lines));
|
|
19866
20135
|
});
|
|
19867
20136
|
}
|
|
19868
20137
|
openMatch() {
|
|
@@ -20411,6 +20680,7 @@ var init_app = __esmMin((() => {
|
|
|
20411
20680
|
this.stopLighting();
|
|
20412
20681
|
this.stopSourcing();
|
|
20413
20682
|
this.stopFetching();
|
|
20683
|
+
this.stopSearching();
|
|
20414
20684
|
this.stopPainting();
|
|
20415
20685
|
this.stopConsuming();
|
|
20416
20686
|
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.152",
|
|
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": {
|