@wrongstack/tools 0.318.0 → 0.319.1
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/dist/_edit-match.d.ts +1 -3
- package/dist/_util.d.ts +20 -0
- package/dist/audit.js +4 -4
- package/dist/bash.js +2 -2
- package/dist/builtin.d.ts +10 -0
- package/dist/builtin.js +46 -44
- package/dist/{chunk-TKA4VEX2.js → chunk-2OXHS3KZ.js} +17 -5
- package/dist/{chunk-X5K3U6GI.js → chunk-3M7LLN7W.js} +71 -7
- package/dist/{chunk-4AEZIFOW.js → chunk-5EUJF3WC.js} +36 -8
- package/dist/{chunk-CVALEVGA.js → chunk-64VIJPFV.js} +34 -13
- package/dist/{chunk-ZE6KLBUO.js → chunk-6AAOT4PW.js} +58 -10
- package/dist/{chunk-A6BRWIXN.js → chunk-6IEBD27U.js} +20 -5
- package/dist/{chunk-HTYEO67J.js → chunk-AKHYMB4V.js} +36 -12
- package/dist/{chunk-4E42D7UF.js → chunk-ATSKPZUK.js} +2 -2
- package/dist/{chunk-H6AWAZ2Y.js → chunk-B4HTSV6Z.js} +57 -6
- package/dist/{chunk-5ZYEGP2P.js → chunk-BK732J7I.js} +72 -27
- package/dist/{chunk-WI3VDXHD.js → chunk-BSJSNVGA.js} +108 -19
- package/dist/{chunk-UKGMDCXT.js → chunk-C2DQKVLO.js} +61 -28
- package/dist/{chunk-CIFAIIHI.js → chunk-CFLJFDYV.js} +100 -58
- package/dist/{chunk-JJQB6R7Y.js → chunk-CMOUCKGC.js} +6 -6
- package/dist/{chunk-MX25MTDJ.js → chunk-DC4KMPJO.js} +2 -2
- package/dist/{chunk-VZLX2JZG.js → chunk-DP6CXMJZ.js} +3 -3
- package/dist/{chunk-3QQSBUXR.js → chunk-EADULOZV.js} +36 -12
- package/dist/{chunk-6RNIFLG4.js → chunk-ELRRTWNP.js} +38 -6
- package/dist/{chunk-CPSAF2AU.js → chunk-FQNXYA6W.js} +45 -6
- package/dist/{chunk-ZZT45EHF.js → chunk-GMZYW52L.js} +3 -3
- package/dist/{chunk-ZLTFLC25.js → chunk-IIF5HIVF.js} +2 -2
- package/dist/{chunk-EMRGN4KM.js → chunk-IU4DV2PA.js} +18 -8
- package/dist/{chunk-AGUSOFNI.js → chunk-IWS56OY7.js} +30 -7
- package/dist/{chunk-MRZOVQ5D.js → chunk-IYKXK356.js} +98 -11
- package/dist/{chunk-6GZPSWP3.js → chunk-JDPQOR7C.js} +14 -7
- package/dist/{chunk-BLCSYKNN.js → chunk-KY4PXYSO.js} +10 -15
- package/dist/{chunk-WJYXMB2R.js → chunk-LOBRWKCR.js} +63 -14
- package/dist/{chunk-J5SKD6LN.js → chunk-MNP3GE7H.js} +38 -27
- package/dist/{chunk-S2GBLQ5S.js → chunk-O44IMQCN.js} +31 -7
- package/dist/{chunk-P7ZQ2FAJ.js → chunk-OG2BEUBY.js} +69 -34
- package/dist/{chunk-K23JNFE3.js → chunk-OTINMOKK.js} +233 -45
- package/dist/{chunk-PQTONQ4P.js → chunk-QPNYDH5B.js} +19 -5
- package/dist/{chunk-UE3UBMCP.js → chunk-RLMX75EM.js} +19 -8
- package/dist/{chunk-3U4H6ZRF.js → chunk-RNWUCZ2U.js} +53 -25
- package/dist/{chunk-YF3D5INN.js → chunk-RTZWBNTY.js} +121 -91
- package/dist/{chunk-SOG7XIRF.js → chunk-TTZOK6IY.js} +2 -2
- package/dist/{chunk-6GVXZCQV.js → chunk-UDVKRX5R.js} +2 -2
- package/dist/{chunk-CPVLVQYT.js → chunk-UQQS3VNT.js} +43 -9
- package/dist/{chunk-VB3MJGCV.js → chunk-VD2LV5WO.js} +82 -13
- package/dist/{chunk-5WNDJHT6.js → chunk-VPALDFYM.js} +2 -2
- package/dist/{chunk-FJEQZHZN.js → chunk-W2CECGTG.js} +24 -14
- package/dist/{chunk-CISOLTOP.js → chunk-X5FOFGXX.js} +72 -33
- package/dist/{chunk-CWALNI6K.js → chunk-X6KXNHUO.js} +1 -1
- package/dist/{chunk-EEOFQDT6.js → chunk-XRNN44QY.js} +46 -2
- package/dist/{chunk-EOOFNYIT.js → chunk-YOKD4GWJ.js} +67 -27
- package/dist/{chunk-D33S4RQG.js → chunk-ZUFHAHTE.js} +18 -6
- package/dist/codebase-index/generic-parser.d.ts +8 -1
- package/dist/codebase-index/index.js +9 -9
- package/dist/codebase-index/parser-worker-script.js +3 -3
- package/dist/codebase-index/project-server.js +5 -5
- package/dist/codebase-index/worker.js +4 -4
- package/dist/codebase-index/writer-refs.d.ts +1 -1
- package/dist/design.d.ts +1 -1
- package/dist/design.js +1 -1
- package/dist/diff.js +3 -2
- package/dist/document.js +2 -2
- package/dist/e2e.js +2 -2
- package/dist/edit.js +8 -8
- package/dist/exec.js +2 -2
- package/dist/fetch.js +2 -2
- package/dist/format.js +4 -4
- package/dist/{generic-parser-VUXDIAOZ.js → generic-parser-WFMIRHBX.js} +2 -2
- package/dist/git.js +2 -2
- package/dist/glob.js +2 -2
- package/dist/grep.d.ts +2 -0
- package/dist/grep.js +4 -2
- package/dist/index.js +46 -46
- package/dist/install.js +4 -4
- package/dist/json.js +2 -2
- package/dist/kanban-tool-types.d.ts +2 -0
- package/dist/kanban.js +2 -2
- package/dist/languages/index.js +2 -2
- package/dist/{legacy-bridge-SFNXIRAP.js → legacy-bridge-3T7SR4SK.js} +4 -4
- package/dist/lint.js +4 -4
- package/dist/logs.js +2 -2
- package/dist/outdated.js +4 -2
- package/dist/pack.js +45 -45
- package/dist/{parser-dispatch-X62UWXJS.js → parser-dispatch-QGC4HSP5.js} +4 -4
- package/dist/patch.js +8 -8
- package/dist/plan.js +4 -4
- package/dist/{py-parser-TDXSQZBC.js → py-parser-RFWG2HYI.js} +3 -3
- package/dist/read.js +8 -8
- package/dist/replace.js +9 -8
- package/dist/scaffold.js +2 -2
- package/dist/search.js +1 -1
- package/dist/session-kanban.js +1 -1
- package/dist/task.js +4 -4
- package/dist/test.js +4 -4
- package/dist/todo.js +3 -3
- package/dist/tool-tier.js +46 -46
- package/dist/{tree-sitter-parser-AIERW3YI.js → tree-sitter-parser-GILYQLS4.js} +2 -2
- package/dist/tree.js +2 -2
- package/dist/typecheck.js +4 -4
- package/dist/write.js +8 -8
- package/package.json +5 -5
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
// src/codebase-index/tree-sitter-parser.ts
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
2
4
|
import * as path from "node:path";
|
|
3
5
|
import { fileURLToPath } from "node:url";
|
|
4
6
|
|
|
@@ -759,6 +761,43 @@ function emitSymbol(node, kind, file, lang, scopeStack, content, nlOffsets, quer
|
|
|
759
761
|
// src/codebase-index/tree-sitter-parser.ts
|
|
760
762
|
var WASM_DIR = fileURLToPath(new URL("./wasm/", import.meta.url));
|
|
761
763
|
var RUNTIME_WASM = path.join(WASM_DIR, "tree-sitter-runtime.wasm");
|
|
764
|
+
var CHECKSUMS_PATH = path.join(WASM_DIR, "checksums.json");
|
|
765
|
+
var cachedChecksums;
|
|
766
|
+
function expectedChecksums() {
|
|
767
|
+
if (cachedChecksums !== void 0) return cachedChecksums;
|
|
768
|
+
try {
|
|
769
|
+
cachedChecksums = JSON.parse(readFileSync(CHECKSUMS_PATH, "utf8"));
|
|
770
|
+
} catch (err) {
|
|
771
|
+
if (err.code === "ENOENT") {
|
|
772
|
+
cachedChecksums = null;
|
|
773
|
+
} else {
|
|
774
|
+
console.error(
|
|
775
|
+
`[tree-sitter] grammar checksum manifest is unreadable (${CHECKSUMS_PATH}): ${err instanceof Error ? err.message : String(err)}. Treating as an integrity failure \u2014 tree-sitter grammars will not load.`
|
|
776
|
+
);
|
|
777
|
+
cachedChecksums = {};
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return cachedChecksums;
|
|
781
|
+
}
|
|
782
|
+
function verifyWasmIntegrity(wasmPath) {
|
|
783
|
+
const manifest = expectedChecksums();
|
|
784
|
+
if (manifest === null) return;
|
|
785
|
+
const rel = path.relative(WASM_DIR, wasmPath).split(path.sep).join("/");
|
|
786
|
+
const expected = manifest[rel];
|
|
787
|
+
if (expected === void 0) {
|
|
788
|
+
console.error(
|
|
789
|
+
`[tree-sitter] grammar ${rel} is not pinned in checksums.json. Refusing to load; falling back to the regex parser. If this change is intentional, regenerate wasm/checksums.json via scripts/check-tree-sitter-wasm.mjs --write and review the diff.`
|
|
790
|
+
);
|
|
791
|
+
throw new Error(`tree-sitter grammar not pinned: ${rel}`);
|
|
792
|
+
}
|
|
793
|
+
const actual = createHash("sha256").update(readFileSync(wasmPath)).digest("hex");
|
|
794
|
+
if (actual !== expected) {
|
|
795
|
+
console.error(
|
|
796
|
+
`[tree-sitter] grammar integrity FAILED for ${rel}: expected sha256 ${expected}, found ${actual}. Refusing to load; falling back to the regex parser. If this change is intentional, regenerate wasm/checksums.json via scripts/check-tree-sitter-wasm.mjs --write and review the diff.`
|
|
797
|
+
);
|
|
798
|
+
throw new Error(`tree-sitter grammar integrity failure: ${rel}`);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
762
801
|
var LANG_TO_GRAMMAR = {
|
|
763
802
|
c: "c",
|
|
764
803
|
cpp: "cpp",
|
|
@@ -786,7 +825,10 @@ function getRuntime() {
|
|
|
786
825
|
if (!runtimePromise) {
|
|
787
826
|
runtimePromise = (async () => {
|
|
788
827
|
const mod = await import("web-tree-sitter");
|
|
789
|
-
const init = () =>
|
|
828
|
+
const init = () => {
|
|
829
|
+
verifyWasmIntegrity(RUNTIME_WASM);
|
|
830
|
+
return mod.Parser.init({ locateFile: () => RUNTIME_WASM });
|
|
831
|
+
};
|
|
790
832
|
return { Parser: mod.Parser, Language: mod.Language, init };
|
|
791
833
|
})();
|
|
792
834
|
}
|
|
@@ -803,6 +845,7 @@ async function loadLanguage(lang) {
|
|
|
803
845
|
const wasmPath = path.join(WASM_DIR, grammarName, `tree-sitter-${grammarName}.wasm`);
|
|
804
846
|
const { Language, init } = await getRuntime();
|
|
805
847
|
await init();
|
|
848
|
+
verifyWasmIntegrity(wasmPath);
|
|
806
849
|
const languageObj = await Language.load(wasmPath);
|
|
807
850
|
return { lang, Language: languageObj };
|
|
808
851
|
})();
|
|
@@ -874,6 +917,7 @@ async function parseTreeSitterAst(opts) {
|
|
|
874
917
|
const { Parser, Language, init } = await getRuntime();
|
|
875
918
|
await init();
|
|
876
919
|
const wasmPath = path.join(WASM_DIR, grammar, `tree-sitter-${grammar}.wasm`);
|
|
920
|
+
verifyWasmIntegrity(wasmPath);
|
|
877
921
|
const languageObj = await Language.load(wasmPath);
|
|
878
922
|
const parser = new Parser();
|
|
879
923
|
parser.setLanguage(languageObj);
|
|
@@ -895,4 +939,4 @@ export {
|
|
|
895
939
|
__smokeRootType,
|
|
896
940
|
parseTreeSitterAst
|
|
897
941
|
};
|
|
898
|
-
//# sourceMappingURL=chunk-
|
|
942
|
+
//# sourceMappingURL=chunk-XRNN44QY.js.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
isBinaryBuffer,
|
|
13
13
|
safeResolveReal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZUFHAHTE.js";
|
|
15
15
|
|
|
16
16
|
// src/grep.ts
|
|
17
17
|
import { spawn } from "node:child_process";
|
|
@@ -125,6 +125,9 @@ var rgAvailabilityCache;
|
|
|
125
125
|
function __resetRgDetectionForTests() {
|
|
126
126
|
rgAvailabilityCache = void 0;
|
|
127
127
|
}
|
|
128
|
+
function __setRgAvailableForTests(available) {
|
|
129
|
+
rgAvailabilityCache = available !== void 0 ? Promise.resolve(available) : void 0;
|
|
130
|
+
}
|
|
128
131
|
function detectRg() {
|
|
129
132
|
rgAvailabilityCache ??= new Promise((resolve) => {
|
|
130
133
|
try {
|
|
@@ -143,7 +146,19 @@ function detectRg() {
|
|
|
143
146
|
return rgAvailabilityCache;
|
|
144
147
|
}
|
|
145
148
|
async function* runRgStream(input, base, mode, limit, signal) {
|
|
146
|
-
|
|
149
|
+
if (signal.aborted) {
|
|
150
|
+
yield {
|
|
151
|
+
type: "final",
|
|
152
|
+
output: {
|
|
153
|
+
matches: [],
|
|
154
|
+
count: 0,
|
|
155
|
+
truncated: false,
|
|
156
|
+
used: "rg"
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const args = ["--no-heading", "--with-filename"];
|
|
147
162
|
if (input.case_insensitive) args.push("-i");
|
|
148
163
|
if (mode === "files_with_matches") args.push("-l");
|
|
149
164
|
if (mode === "count") args.push("-c");
|
|
@@ -161,7 +176,14 @@ async function* runRgStream(input, base, mode, limit, signal) {
|
|
|
161
176
|
)) {
|
|
162
177
|
args.push("--ignore-file", gitignorePath);
|
|
163
178
|
}
|
|
164
|
-
if (input.glob)
|
|
179
|
+
if (input.glob) {
|
|
180
|
+
const g = input.glob.trim();
|
|
181
|
+
if (g.startsWith("!") || g.startsWith("**/") || g.startsWith("*")) {
|
|
182
|
+
args.push("--glob", g);
|
|
183
|
+
} else {
|
|
184
|
+
args.push("--glob", `**/${g}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
165
187
|
args.push("--", input.pattern, base);
|
|
166
188
|
const matches = [];
|
|
167
189
|
let buf = "";
|
|
@@ -319,11 +341,22 @@ async function* runRgStream(input, base, mode, limit, signal) {
|
|
|
319
341
|
}
|
|
320
342
|
function parseRgCountLine(line) {
|
|
321
343
|
const idx = line.lastIndexOf(":");
|
|
322
|
-
if (idx === -1)
|
|
344
|
+
if (idx === -1) {
|
|
345
|
+
const direct = Number.parseInt(line.trim(), 10);
|
|
346
|
+
return Number.isFinite(direct) ? direct : 0;
|
|
347
|
+
}
|
|
323
348
|
const n = Number.parseInt(line.slice(idx + 1), 10);
|
|
324
349
|
return Number.isFinite(n) ? n : 0;
|
|
325
350
|
}
|
|
326
351
|
async function runNative(input, base, mode, limit, signal) {
|
|
352
|
+
if (signal.aborted) {
|
|
353
|
+
return {
|
|
354
|
+
matches: [],
|
|
355
|
+
count: 0,
|
|
356
|
+
truncated: false,
|
|
357
|
+
used: "native"
|
|
358
|
+
};
|
|
359
|
+
}
|
|
327
360
|
const flags = input.case_insensitive ? "i" : "";
|
|
328
361
|
const compiled = compileUserRegex(input.pattern, flags);
|
|
329
362
|
if (!compiled.ok) {
|
|
@@ -337,13 +370,19 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
337
370
|
const isGitIgnored = await loadGitignoreMatcher(base);
|
|
338
371
|
const matches = [];
|
|
339
372
|
const countOnlyFirstHit = mode === "count" && limit === 1;
|
|
340
|
-
const maxBytes =
|
|
373
|
+
const maxBytes = NATIVE_MAX_FILE_BYTES;
|
|
341
374
|
let total = 0;
|
|
342
375
|
let stopped = false;
|
|
343
|
-
const scanFile = async (full, name) => {
|
|
376
|
+
const scanFile = async (full, name, rel) => {
|
|
344
377
|
if (stopped || signal.aborted) return;
|
|
345
|
-
if (globRe
|
|
346
|
-
|
|
378
|
+
if (globRe) {
|
|
379
|
+
globRe.lastIndex = 0;
|
|
380
|
+
const normRel = rel.replace(/\\/g, "/");
|
|
381
|
+
const normFull = full.replace(/\\/g, "/");
|
|
382
|
+
const matchesGlob = globRe.test(name) || globRe.test(normRel) || globRe.test(normFull);
|
|
383
|
+
globRe.lastIndex = 0;
|
|
384
|
+
if (!matchesGlob) return;
|
|
385
|
+
}
|
|
347
386
|
try {
|
|
348
387
|
const stat2 = await fs.stat(full);
|
|
349
388
|
if (!stat2.isFile() || stat2.size > maxBytes || stopped || signal.aborted) return;
|
|
@@ -376,8 +415,8 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
376
415
|
for (const rawLine of lines) {
|
|
377
416
|
if (stopped || signal.aborted) break;
|
|
378
417
|
lineNumber++;
|
|
379
|
-
const ln = capSubject(rawLine);
|
|
380
|
-
re.lastIndex = 0;
|
|
418
|
+
const ln = rawLine.length > 4096 ? capSubject(rawLine) : rawLine;
|
|
419
|
+
if (re.global || re.sticky) re.lastIndex = 0;
|
|
381
420
|
if (!re.test(ln)) continue;
|
|
382
421
|
fileHits++;
|
|
383
422
|
total++;
|
|
@@ -386,10 +425,8 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
386
425
|
} else if (mode === "files_with_matches") {
|
|
387
426
|
if (fileHits === 1 && matches.length < limit) matches.push(full);
|
|
388
427
|
break;
|
|
389
|
-
} else if (fileHits === 1 && matches.length < limit) {
|
|
390
|
-
matches.push(`${full}:${countOnlyFirstHit ? 1 : 0}`);
|
|
391
428
|
}
|
|
392
|
-
if (countOnlyFirstHit || mode
|
|
429
|
+
if (countOnlyFirstHit || mode === "content" && matches.length >= limit) {
|
|
393
430
|
stopped = true;
|
|
394
431
|
break;
|
|
395
432
|
}
|
|
@@ -398,8 +435,8 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
398
435
|
}
|
|
399
436
|
if (!stopped && !signal.aborted && leftover.length > 0) {
|
|
400
437
|
lineNumber++;
|
|
401
|
-
const ln = capSubject(leftover);
|
|
402
|
-
re.lastIndex = 0;
|
|
438
|
+
const ln = leftover.length > 4096 ? capSubject(leftover) : leftover;
|
|
439
|
+
if (re.global || re.sticky) re.lastIndex = 0;
|
|
403
440
|
if (re.test(ln)) {
|
|
404
441
|
fileHits++;
|
|
405
442
|
total++;
|
|
@@ -407,21 +444,17 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
407
444
|
if (matches.length < limit) matches.push(`${full}:${lineNumber}:${ln}`);
|
|
408
445
|
} else if (mode === "files_with_matches") {
|
|
409
446
|
if (matches.length < limit) matches.push(full);
|
|
410
|
-
} else if (matches.length < limit) {
|
|
411
|
-
matches.push(`${full}:${countOnlyFirstHit ? 1 : fileHits}`);
|
|
412
447
|
}
|
|
413
448
|
}
|
|
414
449
|
}
|
|
415
450
|
if (fileHits > 0) {
|
|
416
|
-
if (mode === "count") {
|
|
417
|
-
|
|
418
|
-
if (idx !== -1) matches[idx] = `${full}:${fileHits}`;
|
|
451
|
+
if (mode === "count" && matches.length < limit) {
|
|
452
|
+
matches.push(`${full}:${fileHits}`);
|
|
419
453
|
}
|
|
420
454
|
if (mode === "files_with_matches" && matches.length >= limit) stopped = true;
|
|
421
455
|
}
|
|
422
456
|
if (mode === "content" && matches.length >= limit) stopped = true;
|
|
423
|
-
if (mode === "count" && matches.length >= limit &&
|
|
424
|
-
stopped = true;
|
|
457
|
+
if (mode === "count" && matches.length >= limit && countOnlyFirstHit) stopped = true;
|
|
425
458
|
} finally {
|
|
426
459
|
await file.close();
|
|
427
460
|
}
|
|
@@ -449,13 +482,13 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
449
482
|
subdirs.push({ full, rel });
|
|
450
483
|
} else if (e.isFile()) {
|
|
451
484
|
if (isGitIgnored(rel, false)) continue;
|
|
452
|
-
files.push({ full, name: e.name });
|
|
485
|
+
files.push({ full, name: e.name, rel });
|
|
453
486
|
}
|
|
454
487
|
}
|
|
455
488
|
await mapWithConcurrency(
|
|
456
489
|
files,
|
|
457
490
|
NATIVE_SCAN_CONCURRENCY,
|
|
458
|
-
({ full, name }) => scanFile(full, name)
|
|
491
|
+
({ full, name, rel }) => scanFile(full, name, rel)
|
|
459
492
|
);
|
|
460
493
|
await mapWithConcurrency(
|
|
461
494
|
subdirs,
|
|
@@ -463,7 +496,13 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
463
496
|
({ full, rel }) => walk(full, rel)
|
|
464
497
|
);
|
|
465
498
|
};
|
|
466
|
-
await
|
|
499
|
+
const baseStat = await fs.stat(base).catch(() => null);
|
|
500
|
+
if (baseStat?.isFile()) {
|
|
501
|
+
const rel = input.path ? input.path.replace(/\\/g, "/") : path.basename(base);
|
|
502
|
+
await scanFile(base, path.basename(base), rel);
|
|
503
|
+
} else {
|
|
504
|
+
await walk(base, "");
|
|
505
|
+
}
|
|
467
506
|
return {
|
|
468
507
|
matches,
|
|
469
508
|
count: total,
|
|
@@ -474,6 +513,7 @@ async function runNative(input, base, mode, limit, signal) {
|
|
|
474
513
|
|
|
475
514
|
export {
|
|
476
515
|
grepTool,
|
|
477
|
-
__resetRgDetectionForTests
|
|
516
|
+
__resetRgDetectionForTests,
|
|
517
|
+
__setRgAvailableForTests
|
|
478
518
|
};
|
|
479
|
-
//# sourceMappingURL=chunk-
|
|
519
|
+
//# sourceMappingURL=chunk-YOKD4GWJ.js.map
|
|
@@ -107,6 +107,11 @@ async function safeResolveReal(input, ctx) {
|
|
|
107
107
|
const abs = safeResolve(input, ctx);
|
|
108
108
|
return await resolveRealInsideRoot(abs, ctx);
|
|
109
109
|
}
|
|
110
|
+
async function safeResolveProjectPath(input, ctx) {
|
|
111
|
+
const root = ctx.projectRoot ?? ctx.cwd ?? process.cwd();
|
|
112
|
+
const abs = path.isAbsolute(input) ? input : path.resolve(root, input);
|
|
113
|
+
return await safeResolveReal(abs, ctx);
|
|
114
|
+
}
|
|
110
115
|
function truncateDiffPayload(diff, maxBytes) {
|
|
111
116
|
const total = Buffer.byteLength(diff, "utf8");
|
|
112
117
|
if (total <= maxBytes) return { text: diff, truncated: false };
|
|
@@ -122,11 +127,17 @@ function truncateDiffPayload(diff, maxBytes) {
|
|
|
122
127
|
};
|
|
123
128
|
}
|
|
124
129
|
function truncateMiddle(s, max) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
+
const total = Buffer.byteLength(s, "utf8");
|
|
131
|
+
if (total <= max) return s;
|
|
132
|
+
const MARKER_RESERVE = 64;
|
|
133
|
+
const avail = Math.max(0, max - MARKER_RESERVE);
|
|
134
|
+
if (avail === 0) return takeHeadBytes(s, max);
|
|
135
|
+
const head = takeHeadBytes(s, Math.floor(avail / 2));
|
|
136
|
+
const tail = takeTailBytes(s, avail - Buffer.byteLength(head, "utf8"));
|
|
137
|
+
const kept = Buffer.byteLength(head, "utf8") + Buffer.byteLength(tail, "utf8");
|
|
138
|
+
return `${head}
|
|
139
|
+
\u2026[truncated ${total - kept} bytes from middle]\u2026
|
|
140
|
+
${tail}`;
|
|
130
141
|
}
|
|
131
142
|
function isBinaryBuffer(buf) {
|
|
132
143
|
const len = Math.min(buf.length, 8192);
|
|
@@ -213,10 +224,11 @@ export {
|
|
|
213
224
|
assertRealInsideRoot,
|
|
214
225
|
resolveRealInsideRoot,
|
|
215
226
|
safeResolveReal,
|
|
227
|
+
safeResolveProjectPath,
|
|
216
228
|
truncateDiffPayload,
|
|
217
229
|
truncateMiddle,
|
|
218
230
|
isBinaryBuffer,
|
|
219
231
|
COMMAND_OUTPUT_MAX_BYTES,
|
|
220
232
|
normalizeCommandOutput
|
|
221
233
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
234
|
+
//# sourceMappingURL=chunk-ZUFHAHTE.js.map
|
|
@@ -12,7 +12,14 @@
|
|
|
12
12
|
import type { FileSymbols, SymbolLang } from './schema.js';
|
|
13
13
|
/** Soft default: enough for normal sources without runaway regex on minified blobs. */
|
|
14
14
|
export declare const GENERIC_MAX_SYMBOLS_DEFAULT = 500;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Only the leading window is scanned — huge generated files stay cheap.
|
|
17
|
+
* H-10 (security report VF-11): lowered from 512 KB. The fallback regex
|
|
18
|
+
* extractor is a last resort (tree-sitter missing/failed), and a whitespace
|
|
19
|
+
* bomb under the old window needed only ~500 bytes to stall the indexer for
|
|
20
|
+
* seconds — the remaining risk scales with window size, so the window itself
|
|
21
|
+
* is bounded well below real source-file sizes.
|
|
22
|
+
*/
|
|
16
23
|
export declare const GENERIC_MAX_FILE_CHARS: number;
|
|
17
24
|
/**
|
|
18
25
|
* Extract symbols with language-tuned regexes. Never throws.
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
polyglotInvariantEngine,
|
|
19
19
|
replaceSymbolInFile,
|
|
20
20
|
runDeadCodeScan
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
21
|
+
} from "../chunk-RTZWBNTY.js";
|
|
22
|
+
import "../chunk-XRNN44QY.js";
|
|
23
23
|
import "../chunk-ZHH3BEWU.js";
|
|
24
24
|
import "../chunk-2VSZC6QM.js";
|
|
25
25
|
import "../chunk-3PVYQFRQ.js";
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
shutdownCodebaseIndexHost,
|
|
46
46
|
shutdownCodebaseIndexServer,
|
|
47
47
|
symbolGraphService
|
|
48
|
-
} from "../chunk-
|
|
48
|
+
} from "../chunk-DP6CXMJZ.js";
|
|
49
49
|
import {
|
|
50
50
|
projectIndexServerEndpoint,
|
|
51
51
|
projectIndexServerMetadataPath
|
|
52
|
-
} from "../chunk-
|
|
52
|
+
} from "../chunk-UDVKRX5R.js";
|
|
53
53
|
import {
|
|
54
54
|
CircuitOpenError,
|
|
55
55
|
IndexCircuitBreaker,
|
|
@@ -66,10 +66,10 @@ import {
|
|
|
66
66
|
resolveIndexDir,
|
|
67
67
|
runIndexer,
|
|
68
68
|
tokenise
|
|
69
|
-
} from "../chunk-
|
|
70
|
-
import "../chunk-
|
|
71
|
-
import "../chunk-
|
|
72
|
-
import "../chunk-
|
|
69
|
+
} from "../chunk-KY4PXYSO.js";
|
|
70
|
+
import "../chunk-CMOUCKGC.js";
|
|
71
|
+
import "../chunk-IIF5HIVF.js";
|
|
72
|
+
import "../chunk-6IEBD27U.js";
|
|
73
73
|
import "../chunk-UCYQTZ7F.js";
|
|
74
74
|
import {
|
|
75
75
|
INDEXABLE_EXTENSIONS,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
loadGitignoreMatcher
|
|
82
82
|
} from "../chunk-DTQ75VBC.js";
|
|
83
83
|
import "../chunk-V43EQ6VR.js";
|
|
84
|
-
import "../chunk-
|
|
84
|
+
import "../chunk-ZUFHAHTE.js";
|
|
85
85
|
export {
|
|
86
86
|
CircuitOpenError,
|
|
87
87
|
INDEXABLE_EXTENSIONS,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseFilesContent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-CMOUCKGC.js";
|
|
4
|
+
import "../chunk-IIF5HIVF.js";
|
|
5
|
+
import "../chunk-6IEBD27U.js";
|
|
6
6
|
import "../chunk-UCYQTZ7F.js";
|
|
7
7
|
import "../chunk-YOHO4DVT.js";
|
|
8
8
|
import "../chunk-V43EQ6VR.js";
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
projectIndexServerBuildId,
|
|
11
11
|
projectIndexServerEndpoint,
|
|
12
12
|
projectIndexServerMetadataPath
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-UDVKRX5R.js";
|
|
14
14
|
import {
|
|
15
15
|
fileGraphService,
|
|
16
16
|
incomingCallsService,
|
|
@@ -22,10 +22,10 @@ import {
|
|
|
22
22
|
searchService,
|
|
23
23
|
statsService,
|
|
24
24
|
symbolGraphService
|
|
25
|
-
} from "../chunk-
|
|
26
|
-
import "../chunk-
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
25
|
+
} from "../chunk-KY4PXYSO.js";
|
|
26
|
+
import "../chunk-CMOUCKGC.js";
|
|
27
|
+
import "../chunk-IIF5HIVF.js";
|
|
28
|
+
import "../chunk-6IEBD27U.js";
|
|
29
29
|
import "../chunk-UCYQTZ7F.js";
|
|
30
30
|
import {
|
|
31
31
|
isIndexablePath
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
searchService,
|
|
8
8
|
statsService,
|
|
9
9
|
symbolGraphService
|
|
10
|
-
} from "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
10
|
+
} from "../chunk-KY4PXYSO.js";
|
|
11
|
+
import "../chunk-CMOUCKGC.js";
|
|
12
|
+
import "../chunk-IIF5HIVF.js";
|
|
13
|
+
import "../chunk-6IEBD27U.js";
|
|
14
14
|
import "../chunk-UCYQTZ7F.js";
|
|
15
15
|
import "../chunk-YOHO4DVT.js";
|
|
16
16
|
import "../chunk-DTQ75VBC.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const FAMILY_MATCH_SQL = "(\n sym.lang = refs.lang\n OR EXISTS (\n SELECT 1 FROM lang_family lf1\n JOIN lang_family lf2 ON lf1.family = lf2.family\n WHERE lf1.lang = sym.lang AND lf2.lang = refs.lang\n )\n OR ? IN (\n SELECT family FROM lang_family WHERE lang = refs.lang\n )\n)";
|
|
1
|
+
export declare const FAMILY_MATCH_SQL = "(\n sym.lang = refs.lang\n OR refs.lang = ''\n OR EXISTS (\n SELECT 1 FROM lang_family lf1\n JOIN lang_family lf2 ON lf1.family = lf2.family\n WHERE lf1.lang = sym.lang AND lf2.lang = refs.lang\n )\n OR ? IN (\n SELECT family FROM lang_family WHERE lang = refs.lang\n )\n)";
|
|
2
2
|
export declare function getNamespaceDeclarationsWithStatement(stmtFn: (sql: string) => {
|
|
3
3
|
all: () => unknown[];
|
|
4
4
|
}): Array<{
|
package/dist/design.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ interface DesignInput {
|
|
|
14
14
|
/** action "materialize": overwrite an existing file. */
|
|
15
15
|
force?: boolean | undefined;
|
|
16
16
|
/** action "verify": explicit files to scan (project-relative). Defaults to a UI-file walk. */
|
|
17
|
-
files?: string[] | undefined;
|
|
17
|
+
files?: string | string[] | undefined;
|
|
18
18
|
}
|
|
19
19
|
interface DesignOutput {
|
|
20
20
|
action: string;
|
package/dist/design.js
CHANGED
package/dist/diff.js
CHANGED
package/dist/document.js
CHANGED
package/dist/e2e.js
CHANGED
package/dist/edit.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
editTool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CFLJFDYV.js";
|
|
4
4
|
import "./chunk-FQZOHLG3.js";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-DP6CXMJZ.js";
|
|
6
|
+
import "./chunk-UDVKRX5R.js";
|
|
7
|
+
import "./chunk-KY4PXYSO.js";
|
|
8
|
+
import "./chunk-CMOUCKGC.js";
|
|
9
|
+
import "./chunk-IIF5HIVF.js";
|
|
10
|
+
import "./chunk-6IEBD27U.js";
|
|
11
11
|
import "./chunk-UCYQTZ7F.js";
|
|
12
12
|
import "./chunk-YOHO4DVT.js";
|
|
13
13
|
import "./chunk-DTQ75VBC.js";
|
|
14
14
|
import "./chunk-V43EQ6VR.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-ZUFHAHTE.js";
|
|
16
16
|
export {
|
|
17
17
|
editTool
|
|
18
18
|
};
|
package/dist/exec.js
CHANGED
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
isExecCommandAllowed,
|
|
8
8
|
resetDangerBypass,
|
|
9
9
|
resetExecPolicy
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BSJSNVGA.js";
|
|
11
11
|
import "./chunk-BTSFTGIL.js";
|
|
12
12
|
import "./chunk-NKNOBUBU.js";
|
|
13
13
|
import "./chunk-2VSZC6QM.js";
|
|
14
14
|
import "./chunk-3PVYQFRQ.js";
|
|
15
15
|
import "./chunk-HFXSNKCV.js";
|
|
16
16
|
import "./chunk-V43EQ6VR.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-ZUFHAHTE.js";
|
|
18
18
|
export {
|
|
19
19
|
configureDangerBypass,
|
|
20
20
|
configureExecPolicy,
|
package/dist/fetch.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchTool
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-C2DQKVLO.js";
|
|
4
4
|
import {
|
|
5
5
|
guardedFetch,
|
|
6
6
|
guardedLookup
|
|
7
7
|
} from "./chunk-NBDZMMG2.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ZUFHAHTE.js";
|
|
9
9
|
export {
|
|
10
10
|
fetchTool,
|
|
11
11
|
guardedFetch,
|
package/dist/format.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatTool
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-EADULOZV.js";
|
|
4
|
+
import "./chunk-ATSKPZUK.js";
|
|
5
|
+
import "./chunk-TTZOK6IY.js";
|
|
6
6
|
import "./chunk-ZHH3BEWU.js";
|
|
7
7
|
import "./chunk-2VSZC6QM.js";
|
|
8
8
|
import "./chunk-3PVYQFRQ.js";
|
|
9
9
|
import "./chunk-HFXSNKCV.js";
|
|
10
10
|
import "./chunk-V43EQ6VR.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-ZUFHAHTE.js";
|
|
12
12
|
export {
|
|
13
13
|
formatTool
|
|
14
14
|
};
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
GENERIC_MAX_SYMBOLS_DEFAULT,
|
|
4
4
|
parseGeneric,
|
|
5
5
|
parseSymbols
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6IEBD27U.js";
|
|
7
7
|
export {
|
|
8
8
|
GENERIC_MAX_FILE_CHARS,
|
|
9
9
|
GENERIC_MAX_SYMBOLS_DEFAULT,
|
|
10
10
|
parseGeneric,
|
|
11
11
|
parseSymbols
|
|
12
12
|
};
|
|
13
|
-
//# sourceMappingURL=generic-parser-
|
|
13
|
+
//# sourceMappingURL=generic-parser-WFMIRHBX.js.map
|
package/dist/git.js
CHANGED
package/dist/glob.js
CHANGED
package/dist/grep.d.ts
CHANGED
|
@@ -17,5 +17,7 @@ interface GrepOutput {
|
|
|
17
17
|
export declare const grepTool: Tool<GrepInput, GrepOutput>;
|
|
18
18
|
/** Test-only: forget the cached rg availability so mocks can vary per test. */
|
|
19
19
|
export declare function __resetRgDetectionForTests(): void;
|
|
20
|
+
/** Test-only: explicitly set rg availability to test both engines. */
|
|
21
|
+
export declare function __setRgAvailableForTests(available: boolean | undefined): void;
|
|
20
22
|
export {};
|
|
21
23
|
//# sourceMappingURL=grep.d.ts.map
|
package/dist/grep.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__resetRgDetectionForTests,
|
|
3
|
+
__setRgAvailableForTests,
|
|
3
4
|
grepTool
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YOKD4GWJ.js";
|
|
5
6
|
import "./chunk-Q5JPPCZC.js";
|
|
6
7
|
import "./chunk-NWZ6XGBJ.js";
|
|
7
8
|
import "./chunk-DTQ75VBC.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ZUFHAHTE.js";
|
|
9
10
|
export {
|
|
10
11
|
__resetRgDetectionForTests,
|
|
12
|
+
__setRgAvailableForTests,
|
|
11
13
|
grepTool
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=grep.js.map
|