@wrongstack/tools 0.295.0 → 0.295.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/auto-proceed-loop-guard.d.ts +31 -0
- package/dist/auto-proceed-loop-guard.d.ts.map +1 -1
- package/dist/auto-proceed-loop-guard.js +24 -1
- package/dist/auto-proceed-loop-guard.js.map +2 -2
- package/dist/bash.js +39 -23
- package/dist/bash.js.map +2 -2
- package/dist/builtin.js +278 -109
- package/dist/builtin.js.map +4 -4
- package/dist/codebase-index/generic-parser.d.ts.map +1 -1
- package/dist/codebase-index/index.js +48 -47
- package/dist/codebase-index/index.js.map +2 -2
- package/dist/codebase-index/indexer.d.ts.map +1 -1
- package/dist/codebase-index/worker.js +48 -47
- package/dist/codebase-index/worker.js.map +2 -2
- package/dist/codebase-index/writer.d.ts.map +1 -1
- package/dist/exec.js +39 -23
- package/dist/exec.js.map +2 -2
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +80 -30
- package/dist/glob.js.map +4 -4
- package/dist/grep.d.ts.map +1 -1
- package/dist/grep.js +87 -20
- package/dist/grep.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +281 -109
- package/dist/index.js.map +4 -4
- package/dist/kanban-evidence-bridge.d.ts +21 -0
- package/dist/kanban-evidence-bridge.d.ts.map +1 -0
- package/dist/kanban.d.ts +17 -1
- package/dist/kanban.d.ts.map +1 -1
- package/dist/kanban.js +164 -7
- package/dist/kanban.js.map +3 -3
- package/dist/pack.js +278 -109
- package/dist/pack.js.map +4 -4
- package/dist/process-registry-persistent.d.ts.map +1 -1
- package/dist/ps-slash.js +39 -23
- package/dist/ps-slash.js.map +2 -2
- package/dist/tool-tier.js +278 -109
- package/dist/tool-tier.js.map +4 -4
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +2 -14
- package/dist/tree.js.map +2 -2
- package/dist/win32.d.ts +10 -0
- package/dist/win32.d.ts.map +1 -0
- package/dist/win32.js +67 -0
- package/dist/win32.js.map +7 -0
- package/package.json +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-parser.d.ts","sourceRoot":"","sources":["../../src/codebase-index/generic-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAqC,UAAU,EAAE,MAAM,aAAa,CAAC;AAwP9F,uFAAuF;AACvF,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,QAAa,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"generic-parser.d.ts","sourceRoot":"","sources":["../../src/codebase-index/generic-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAqC,UAAU,EAAE,MAAM,aAAa,CAAC;AAwP9F,uFAAuF;AACvF,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAC/C,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,QAAa,CAAC;AAEjD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,uEAAuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,WAAW,CAgEd;AAED,uDAAuD;AACvD,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;CAClB,GAAG,OAAO,CAAC,WAAW,CAAC,CAEvB"}
|
|
@@ -1417,11 +1417,12 @@ var IndexStore = class _IndexStore {
|
|
|
1417
1417
|
}
|
|
1418
1418
|
}
|
|
1419
1419
|
const refRows = this.stmt(
|
|
1420
|
-
`SELECT r.call_type, sf.file AS from_file, st.file AS to_file
|
|
1420
|
+
`SELECT r.call_type, sf.file AS from_file, st.file AS to_file, COUNT(*) AS n
|
|
1421
1421
|
FROM refs r
|
|
1422
1422
|
JOIN symbols sf ON sf.id = r.from_id
|
|
1423
1423
|
JOIN symbols st ON st.id = r.to_id
|
|
1424
|
-
WHERE r.to_id IS NOT NULL AND r.call_type != 'import'
|
|
1424
|
+
WHERE r.to_id IS NOT NULL AND r.call_type != 'import'
|
|
1425
|
+
GROUP BY r.call_type, sf.file, st.file`
|
|
1425
1426
|
).all();
|
|
1426
1427
|
const edgeMap = /* @__PURE__ */ new Map();
|
|
1427
1428
|
for (const r of refRows) {
|
|
@@ -1434,14 +1435,16 @@ var IndexStore = class _IndexStore {
|
|
|
1434
1435
|
e = { weight: 0, types: /* @__PURE__ */ new Map() };
|
|
1435
1436
|
edgeMap.set(key, e);
|
|
1436
1437
|
}
|
|
1437
|
-
|
|
1438
|
-
e.
|
|
1438
|
+
const n = Number(r.n) || 0;
|
|
1439
|
+
e.weight += n;
|
|
1440
|
+
e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + n);
|
|
1439
1441
|
}
|
|
1440
1442
|
const importRows = this.stmt(
|
|
1441
|
-
`SELECT r.to_name, s.file AS from_file
|
|
1443
|
+
`SELECT r.to_name, s.file AS from_file, COUNT(*) AS n
|
|
1442
1444
|
FROM refs r
|
|
1443
1445
|
JOIN symbols s ON s.id = r.from_id
|
|
1444
|
-
WHERE r.call_type = 'import'
|
|
1446
|
+
WHERE r.call_type = 'import'
|
|
1447
|
+
GROUP BY r.to_name, s.file`
|
|
1445
1448
|
).all();
|
|
1446
1449
|
for (const r of importRows) {
|
|
1447
1450
|
const fromPkg = fileToPkg.get(r.from_file) ?? _IndexStore.derivePackage(r.from_file) ?? "(root)";
|
|
@@ -1453,8 +1456,9 @@ var IndexStore = class _IndexStore {
|
|
|
1453
1456
|
edge = { weight: 0, types: /* @__PURE__ */ new Map() };
|
|
1454
1457
|
edgeMap.set(key, edge);
|
|
1455
1458
|
}
|
|
1456
|
-
|
|
1457
|
-
edge.
|
|
1459
|
+
const n = Number(r.n) || 0;
|
|
1460
|
+
edge.weight += n;
|
|
1461
|
+
edge.types.set("import", (edge.types.get("import") ?? 0) + n);
|
|
1458
1462
|
}
|
|
1459
1463
|
const edges = [];
|
|
1460
1464
|
for (const [key, e] of edgeMap) {
|
|
@@ -1519,11 +1523,12 @@ var IndexStore = class _IndexStore {
|
|
|
1519
1523
|
}
|
|
1520
1524
|
const indexedFiles = new Set(allFiles.map((f) => f.file));
|
|
1521
1525
|
const refRows = this.stmt(
|
|
1522
|
-
`SELECT r.from_id, r.to_id, r.call_type
|
|
1526
|
+
`SELECT r.from_id, r.to_id, r.call_type, COUNT(*) AS n
|
|
1523
1527
|
FROM refs r
|
|
1524
1528
|
WHERE (r.from_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders}))
|
|
1525
1529
|
OR r.to_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders})))
|
|
1526
|
-
AND r.to_id IS NOT NULL
|
|
1530
|
+
AND r.to_id IS NOT NULL
|
|
1531
|
+
GROUP BY r.from_id, r.to_id, r.call_type`
|
|
1527
1532
|
).all(...pkgFilePaths, ...pkgFilePaths);
|
|
1528
1533
|
const knownSymIds = new Set(pkgSyms.map((s) => s.id));
|
|
1529
1534
|
const crossRefIds = /* @__PURE__ */ new Set();
|
|
@@ -1558,14 +1563,16 @@ var IndexStore = class _IndexStore {
|
|
|
1558
1563
|
e = { weight: 0, types: /* @__PURE__ */ new Map() };
|
|
1559
1564
|
edgeMap.set(key, e);
|
|
1560
1565
|
}
|
|
1561
|
-
|
|
1562
|
-
e.
|
|
1566
|
+
const n = Number(r.n) || 0;
|
|
1567
|
+
e.weight += n;
|
|
1568
|
+
e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + n);
|
|
1563
1569
|
}
|
|
1564
1570
|
const importRows = this.stmt(
|
|
1565
|
-
`SELECT r.from_id, r.to_name
|
|
1571
|
+
`SELECT r.from_id, r.to_name, COUNT(*) AS n
|
|
1566
1572
|
FROM refs r
|
|
1567
1573
|
WHERE r.call_type = 'import'
|
|
1568
|
-
AND r.from_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders}))
|
|
1574
|
+
AND r.from_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders}))
|
|
1575
|
+
GROUP BY r.from_id, r.to_name`
|
|
1569
1576
|
).all(...pkgFilePaths);
|
|
1570
1577
|
for (const r of importRows) {
|
|
1571
1578
|
const fromFile = symToFile.get(r.from_id);
|
|
@@ -1580,8 +1587,9 @@ var IndexStore = class _IndexStore {
|
|
|
1580
1587
|
edge = { weight: 0, types: /* @__PURE__ */ new Map() };
|
|
1581
1588
|
edgeMap.set(key, edge);
|
|
1582
1589
|
}
|
|
1583
|
-
|
|
1584
|
-
edge.
|
|
1590
|
+
const n = Number(r.n) || 0;
|
|
1591
|
+
edge.weight += n;
|
|
1592
|
+
edge.types.set("import", (edge.types.get("import") ?? 0) + n);
|
|
1585
1593
|
}
|
|
1586
1594
|
const edges = [];
|
|
1587
1595
|
for (const [key, e] of edgeMap) {
|
|
@@ -1628,22 +1636,25 @@ var IndexStore = class _IndexStore {
|
|
|
1628
1636
|
scope: s.scope,
|
|
1629
1637
|
external: s.file !== fileFilter
|
|
1630
1638
|
});
|
|
1631
|
-
const symIds = new Set(syms.map((s) => s.id));
|
|
1632
1639
|
const refRows = this.stmt(
|
|
1633
|
-
`SELECT
|
|
1634
|
-
FROM
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1640
|
+
`SELECT from_id, to_id, call_type, COUNT(*) AS n
|
|
1641
|
+
FROM (
|
|
1642
|
+
SELECT r.from_id, r.to_id, r.to_name, r.call_type, r.line
|
|
1643
|
+
FROM refs r
|
|
1644
|
+
JOIN symbols s ON s.id = r.from_id
|
|
1645
|
+
WHERE s.file = ?
|
|
1646
|
+
UNION
|
|
1647
|
+
SELECT r.from_id, r.to_id, r.to_name, r.call_type, r.line
|
|
1648
|
+
FROM refs r
|
|
1649
|
+
JOIN symbols s ON s.id = r.to_id
|
|
1650
|
+
WHERE s.file = ?
|
|
1651
|
+
)
|
|
1652
|
+
WHERE to_id IS NOT NULL
|
|
1653
|
+
GROUP BY from_id, to_id, call_type`
|
|
1642
1654
|
).all(fileFilter, fileFilter);
|
|
1643
1655
|
const edgeMap = /* @__PURE__ */ new Map();
|
|
1644
1656
|
for (const r of refRows) {
|
|
1645
|
-
if (r.to_id
|
|
1646
|
-
if (!symIds.has(r.from_id) && !symIds.has(r.to_id)) continue;
|
|
1657
|
+
if (r.to_id == null) continue;
|
|
1647
1658
|
relatedIds.add(r.from_id);
|
|
1648
1659
|
relatedIds.add(r.to_id);
|
|
1649
1660
|
const key = `${r.from_id}\0${r.to_id}`;
|
|
@@ -1652,8 +1663,9 @@ var IndexStore = class _IndexStore {
|
|
|
1652
1663
|
e = { weight: 0, types: /* @__PURE__ */ new Map() };
|
|
1653
1664
|
edgeMap.set(key, e);
|
|
1654
1665
|
}
|
|
1655
|
-
|
|
1656
|
-
e.
|
|
1666
|
+
const n = Number(r.n) || 0;
|
|
1667
|
+
e.weight += n;
|
|
1668
|
+
e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + n);
|
|
1657
1669
|
}
|
|
1658
1670
|
const edges = [];
|
|
1659
1671
|
for (const [key, e] of edgeMap) {
|
|
@@ -1710,7 +1722,7 @@ import { expectDefined as expectDefined5 } from "@wrongstack/core/utils";
|
|
|
1710
1722
|
import * as fs7 from "node:fs/promises";
|
|
1711
1723
|
import * as path9 from "node:path";
|
|
1712
1724
|
import { availableParallelism } from "node:os";
|
|
1713
|
-
import { indexParallelBatchSize, isFrugalPerf } from "@wrongstack/core/utils";
|
|
1725
|
+
import { DEFAULT_WALK_IGNORE_DIRS, indexParallelBatchSize, isFrugalPerf } from "@wrongstack/core/utils";
|
|
1714
1726
|
|
|
1715
1727
|
// src/codebase-index/ts-parser.ts
|
|
1716
1728
|
import * as ts from "@typescript/typescript6";
|
|
@@ -2390,7 +2402,7 @@ import * as path5 from "node:path";
|
|
|
2390
2402
|
var C_LIKE = [
|
|
2391
2403
|
{ re: /\b(?:class|struct|enum|interface|union)\s+([A-Za-z_]\w*)/g, kind: "class" },
|
|
2392
2404
|
{
|
|
2393
|
-
re: /\b(?:public|private|protected|static|final|async|override|virtual|inline|export)?\s*(?:[\w
|
|
2405
|
+
re: /\b(?:public|private|protected|static|final|async|override|virtual|inline|export)?\s*(?:[\w:<>[\]\s*&]+)\s+([A-Za-z_]\w*)\s*\([^;{]*\)\s*(?:const)?\s*[{;]/g,
|
|
2394
2406
|
kind: "function"
|
|
2395
2407
|
},
|
|
2396
2408
|
{ re: /\b(?:namespace)\s+([A-Za-z_]\w*)/g, kind: "namespace" }
|
|
@@ -2421,7 +2433,7 @@ var LANG_PATTERNS = {
|
|
|
2421
2433
|
java: [
|
|
2422
2434
|
{ re: /\b(?:class|interface|enum|record)\s+([A-Za-z_]\w*)/g, kind: "class" },
|
|
2423
2435
|
{
|
|
2424
|
-
re: /\b(?:public|private|protected|static|final|abstract|synchronized|native|default|\s)+\s*[\w
|
|
2436
|
+
re: /\b(?:public|private|protected|static|final|abstract|synchronized|native|default|\s)+\s*[\w.<>,[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
|
|
2425
2437
|
kind: "method"
|
|
2426
2438
|
}
|
|
2427
2439
|
],
|
|
@@ -2429,7 +2441,7 @@ var LANG_PATTERNS = {
|
|
|
2429
2441
|
{ re: /\b(?:class|interface|struct|enum|record)\s+([A-Za-z_]\w*)/g, kind: "class" },
|
|
2430
2442
|
{ re: /\bnamespace\s+([A-Za-z_.\w]+)/g, kind: "namespace" },
|
|
2431
2443
|
{
|
|
2432
|
-
re: /\b(?:public|private|protected|internal|static|async|override|virtual|\s)+\s*[\w
|
|
2444
|
+
re: /\b(?:public|private|protected|internal|static|async|override|virtual|\s)+\s*[\w.<>,[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
|
|
2433
2445
|
kind: "method"
|
|
2434
2446
|
}
|
|
2435
2447
|
],
|
|
@@ -2634,8 +2646,7 @@ function parseGeneric(opts) {
|
|
|
2634
2646
|
for (const pattern of patterns) {
|
|
2635
2647
|
const re = new RegExp(pattern.re.source, pattern.re.flags.includes("g") ? pattern.re.flags : `${pattern.re.flags}g`);
|
|
2636
2648
|
re.lastIndex = 0;
|
|
2637
|
-
|
|
2638
|
-
while ((match = re.exec(content)) !== null) {
|
|
2649
|
+
for (const match of content.matchAll(re)) {
|
|
2639
2650
|
if (symbols.length >= maxSymbols) break;
|
|
2640
2651
|
let name = (match[1] ?? match[2] ?? "").trim();
|
|
2641
2652
|
if (lang === "md" && match[2]) name = match[2].trim();
|
|
@@ -3590,17 +3601,7 @@ function throwIfAborted(signal) {
|
|
|
3590
3601
|
function isAbortError(err) {
|
|
3591
3602
|
return err instanceof DOMException && err.name === "AbortError";
|
|
3592
3603
|
}
|
|
3593
|
-
var DEFAULT_IGNORE =
|
|
3594
|
-
"node_modules",
|
|
3595
|
-
".git",
|
|
3596
|
-
"dist",
|
|
3597
|
-
"build",
|
|
3598
|
-
".next",
|
|
3599
|
-
"coverage",
|
|
3600
|
-
".turbo",
|
|
3601
|
-
"__snapshots__",
|
|
3602
|
-
".nyc_output"
|
|
3603
|
-
];
|
|
3604
|
+
var DEFAULT_IGNORE = DEFAULT_WALK_IGNORE_DIRS;
|
|
3604
3605
|
var DEFAULT_IGNORE_FILES = /* @__PURE__ */ new Set(["package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml"]);
|
|
3605
3606
|
var MAX_INDEX_FILE_BYTES = 5 * 1024 * 1024;
|
|
3606
3607
|
function isWithinProject(projectRoot, file) {
|