@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.
Files changed (48) hide show
  1. package/dist/auto-proceed-loop-guard.d.ts +31 -0
  2. package/dist/auto-proceed-loop-guard.d.ts.map +1 -1
  3. package/dist/auto-proceed-loop-guard.js +24 -1
  4. package/dist/auto-proceed-loop-guard.js.map +2 -2
  5. package/dist/bash.js +39 -23
  6. package/dist/bash.js.map +2 -2
  7. package/dist/builtin.js +278 -109
  8. package/dist/builtin.js.map +4 -4
  9. package/dist/codebase-index/generic-parser.d.ts.map +1 -1
  10. package/dist/codebase-index/index.js +48 -47
  11. package/dist/codebase-index/index.js.map +2 -2
  12. package/dist/codebase-index/indexer.d.ts.map +1 -1
  13. package/dist/codebase-index/worker.js +48 -47
  14. package/dist/codebase-index/worker.js.map +2 -2
  15. package/dist/codebase-index/writer.d.ts.map +1 -1
  16. package/dist/exec.js +39 -23
  17. package/dist/exec.js.map +2 -2
  18. package/dist/glob.d.ts.map +1 -1
  19. package/dist/glob.js +80 -30
  20. package/dist/glob.js.map +4 -4
  21. package/dist/grep.d.ts.map +1 -1
  22. package/dist/grep.js +87 -20
  23. package/dist/grep.js.map +4 -4
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +281 -109
  27. package/dist/index.js.map +4 -4
  28. package/dist/kanban-evidence-bridge.d.ts +21 -0
  29. package/dist/kanban-evidence-bridge.d.ts.map +1 -0
  30. package/dist/kanban.d.ts +17 -1
  31. package/dist/kanban.d.ts.map +1 -1
  32. package/dist/kanban.js +164 -7
  33. package/dist/kanban.js.map +3 -3
  34. package/dist/pack.js +278 -109
  35. package/dist/pack.js.map +4 -4
  36. package/dist/process-registry-persistent.d.ts.map +1 -1
  37. package/dist/ps-slash.js +39 -23
  38. package/dist/ps-slash.js.map +2 -2
  39. package/dist/tool-tier.js +278 -109
  40. package/dist/tool-tier.js.map +4 -4
  41. package/dist/tree.d.ts.map +1 -1
  42. package/dist/tree.js +2 -14
  43. package/dist/tree.js.map +2 -2
  44. package/dist/win32.d.ts +10 -0
  45. package/dist/win32.d.ts.map +1 -0
  46. package/dist/win32.js +67 -0
  47. package/dist/win32.js.map +7 -0
  48. package/package.json +7 -3
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/codebase-index/indexer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAY,WAAW,EAA0C,MAAM,aAAa,CAAC;AAcjG;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAmDD,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACrE;AA2HD,6DAA6D;AAC7D,wBAAsB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAa1F"}
1
+ {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/codebase-index/indexer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,KAAK,EAAY,WAAW,EAA0C,MAAM,aAAa,CAAC;AAcjG;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAyCD,UAAU,cAAc;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACrE;AA2HD,6DAA6D;AAC7D,wBAAsB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAa1F"}
@@ -6,7 +6,7 @@ import { expectDefined as expectDefined5 } from "@wrongstack/core/utils";
6
6
  import * as fs7 from "node:fs/promises";
7
7
  import * as path9 from "node:path";
8
8
  import { availableParallelism } from "node:os";
9
- import { indexParallelBatchSize, isFrugalPerf } from "@wrongstack/core/utils";
9
+ import { DEFAULT_WALK_IGNORE_DIRS, indexParallelBatchSize, isFrugalPerf } from "@wrongstack/core/utils";
10
10
 
11
11
  // src/codebase-index/writer.ts
12
12
  import { expectDefined } from "@wrongstack/core/utils";
@@ -1385,11 +1385,12 @@ var IndexStore = class _IndexStore {
1385
1385
  }
1386
1386
  }
1387
1387
  const refRows = this.stmt(
1388
- `SELECT r.call_type, sf.file AS from_file, st.file AS to_file
1388
+ `SELECT r.call_type, sf.file AS from_file, st.file AS to_file, COUNT(*) AS n
1389
1389
  FROM refs r
1390
1390
  JOIN symbols sf ON sf.id = r.from_id
1391
1391
  JOIN symbols st ON st.id = r.to_id
1392
- WHERE r.to_id IS NOT NULL AND r.call_type != 'import'`
1392
+ WHERE r.to_id IS NOT NULL AND r.call_type != 'import'
1393
+ GROUP BY r.call_type, sf.file, st.file`
1393
1394
  ).all();
1394
1395
  const edgeMap = /* @__PURE__ */ new Map();
1395
1396
  for (const r of refRows) {
@@ -1402,14 +1403,16 @@ var IndexStore = class _IndexStore {
1402
1403
  e = { weight: 0, types: /* @__PURE__ */ new Map() };
1403
1404
  edgeMap.set(key, e);
1404
1405
  }
1405
- e.weight++;
1406
- e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + 1);
1406
+ const n = Number(r.n) || 0;
1407
+ e.weight += n;
1408
+ e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + n);
1407
1409
  }
1408
1410
  const importRows = this.stmt(
1409
- `SELECT r.to_name, s.file AS from_file
1411
+ `SELECT r.to_name, s.file AS from_file, COUNT(*) AS n
1410
1412
  FROM refs r
1411
1413
  JOIN symbols s ON s.id = r.from_id
1412
- WHERE r.call_type = 'import'`
1414
+ WHERE r.call_type = 'import'
1415
+ GROUP BY r.to_name, s.file`
1413
1416
  ).all();
1414
1417
  for (const r of importRows) {
1415
1418
  const fromPkg = fileToPkg.get(r.from_file) ?? _IndexStore.derivePackage(r.from_file) ?? "(root)";
@@ -1421,8 +1424,9 @@ var IndexStore = class _IndexStore {
1421
1424
  edge = { weight: 0, types: /* @__PURE__ */ new Map() };
1422
1425
  edgeMap.set(key, edge);
1423
1426
  }
1424
- edge.weight++;
1425
- edge.types.set("import", (edge.types.get("import") ?? 0) + 1);
1427
+ const n = Number(r.n) || 0;
1428
+ edge.weight += n;
1429
+ edge.types.set("import", (edge.types.get("import") ?? 0) + n);
1426
1430
  }
1427
1431
  const edges = [];
1428
1432
  for (const [key, e] of edgeMap) {
@@ -1487,11 +1491,12 @@ var IndexStore = class _IndexStore {
1487
1491
  }
1488
1492
  const indexedFiles = new Set(allFiles.map((f) => f.file));
1489
1493
  const refRows = this.stmt(
1490
- `SELECT r.from_id, r.to_id, r.call_type
1494
+ `SELECT r.from_id, r.to_id, r.call_type, COUNT(*) AS n
1491
1495
  FROM refs r
1492
1496
  WHERE (r.from_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders}))
1493
1497
  OR r.to_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders})))
1494
- AND r.to_id IS NOT NULL`
1498
+ AND r.to_id IS NOT NULL
1499
+ GROUP BY r.from_id, r.to_id, r.call_type`
1495
1500
  ).all(...pkgFilePaths, ...pkgFilePaths);
1496
1501
  const knownSymIds = new Set(pkgSyms.map((s) => s.id));
1497
1502
  const crossRefIds = /* @__PURE__ */ new Set();
@@ -1526,14 +1531,16 @@ var IndexStore = class _IndexStore {
1526
1531
  e = { weight: 0, types: /* @__PURE__ */ new Map() };
1527
1532
  edgeMap.set(key, e);
1528
1533
  }
1529
- e.weight++;
1530
- e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + 1);
1534
+ const n = Number(r.n) || 0;
1535
+ e.weight += n;
1536
+ e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + n);
1531
1537
  }
1532
1538
  const importRows = this.stmt(
1533
- `SELECT r.from_id, r.to_name
1539
+ `SELECT r.from_id, r.to_name, COUNT(*) AS n
1534
1540
  FROM refs r
1535
1541
  WHERE r.call_type = 'import'
1536
- AND r.from_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders}))`
1542
+ AND r.from_id IN (SELECT id FROM symbols WHERE file IN (${filePlaceholders}))
1543
+ GROUP BY r.from_id, r.to_name`
1537
1544
  ).all(...pkgFilePaths);
1538
1545
  for (const r of importRows) {
1539
1546
  const fromFile = symToFile.get(r.from_id);
@@ -1548,8 +1555,9 @@ var IndexStore = class _IndexStore {
1548
1555
  edge = { weight: 0, types: /* @__PURE__ */ new Map() };
1549
1556
  edgeMap.set(key, edge);
1550
1557
  }
1551
- edge.weight++;
1552
- edge.types.set("import", (edge.types.get("import") ?? 0) + 1);
1558
+ const n = Number(r.n) || 0;
1559
+ edge.weight += n;
1560
+ edge.types.set("import", (edge.types.get("import") ?? 0) + n);
1553
1561
  }
1554
1562
  const edges = [];
1555
1563
  for (const [key, e] of edgeMap) {
@@ -1596,22 +1604,25 @@ var IndexStore = class _IndexStore {
1596
1604
  scope: s.scope,
1597
1605
  external: s.file !== fileFilter
1598
1606
  });
1599
- const symIds = new Set(syms.map((s) => s.id));
1600
1607
  const refRows = this.stmt(
1601
- `SELECT r.from_id, r.to_id, r.to_name, r.call_type, r.line
1602
- FROM refs r
1603
- JOIN symbols s ON s.id = r.from_id
1604
- WHERE s.file = ?
1605
- UNION
1606
- SELECT r.from_id, r.to_id, r.to_name, r.call_type, r.line
1607
- FROM refs r
1608
- JOIN symbols s ON s.id = r.to_id
1609
- WHERE s.file = ?`
1608
+ `SELECT from_id, to_id, call_type, COUNT(*) AS n
1609
+ FROM (
1610
+ SELECT r.from_id, r.to_id, r.to_name, r.call_type, r.line
1611
+ FROM refs r
1612
+ JOIN symbols s ON s.id = r.from_id
1613
+ WHERE s.file = ?
1614
+ UNION
1615
+ SELECT r.from_id, r.to_id, r.to_name, r.call_type, r.line
1616
+ FROM refs r
1617
+ JOIN symbols s ON s.id = r.to_id
1618
+ WHERE s.file = ?
1619
+ )
1620
+ WHERE to_id IS NOT NULL
1621
+ GROUP BY from_id, to_id, call_type`
1610
1622
  ).all(fileFilter, fileFilter);
1611
1623
  const edgeMap = /* @__PURE__ */ new Map();
1612
1624
  for (const r of refRows) {
1613
- if (r.to_id === null) continue;
1614
- if (!symIds.has(r.from_id) && !symIds.has(r.to_id)) continue;
1625
+ if (r.to_id == null) continue;
1615
1626
  relatedIds.add(r.from_id);
1616
1627
  relatedIds.add(r.to_id);
1617
1628
  const key = `${r.from_id}\0${r.to_id}`;
@@ -1620,8 +1631,9 @@ var IndexStore = class _IndexStore {
1620
1631
  e = { weight: 0, types: /* @__PURE__ */ new Map() };
1621
1632
  edgeMap.set(key, e);
1622
1633
  }
1623
- e.weight++;
1624
- e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + 1);
1634
+ const n = Number(r.n) || 0;
1635
+ e.weight += n;
1636
+ e.types.set(r.call_type, (e.types.get(r.call_type) ?? 0) + n);
1625
1637
  }
1626
1638
  const edges = [];
1627
1639
  for (const [key, e] of edgeMap) {
@@ -2343,7 +2355,7 @@ import * as path5 from "node:path";
2343
2355
  var C_LIKE = [
2344
2356
  { re: /\b(?:class|struct|enum|interface|union)\s+([A-Za-z_]\w*)/g, kind: "class" },
2345
2357
  {
2346
- 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,
2358
+ 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,
2347
2359
  kind: "function"
2348
2360
  },
2349
2361
  { re: /\b(?:namespace)\s+([A-Za-z_]\w*)/g, kind: "namespace" }
@@ -2374,7 +2386,7 @@ var LANG_PATTERNS = {
2374
2386
  java: [
2375
2387
  { re: /\b(?:class|interface|enum|record)\s+([A-Za-z_]\w*)/g, kind: "class" },
2376
2388
  {
2377
- re: /\b(?:public|private|protected|static|final|abstract|synchronized|native|default|\s)+\s*[\w.<>,\[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
2389
+ re: /\b(?:public|private|protected|static|final|abstract|synchronized|native|default|\s)+\s*[\w.<>,[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
2378
2390
  kind: "method"
2379
2391
  }
2380
2392
  ],
@@ -2382,7 +2394,7 @@ var LANG_PATTERNS = {
2382
2394
  { re: /\b(?:class|interface|struct|enum|record)\s+([A-Za-z_]\w*)/g, kind: "class" },
2383
2395
  { re: /\bnamespace\s+([A-Za-z_.\w]+)/g, kind: "namespace" },
2384
2396
  {
2385
- re: /\b(?:public|private|protected|internal|static|async|override|virtual|\s)+\s*[\w.<>,\[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
2397
+ re: /\b(?:public|private|protected|internal|static|async|override|virtual|\s)+\s*[\w.<>,[\]\s]+\s+([A-Za-z_]\w*)\s*\(/g,
2386
2398
  kind: "method"
2387
2399
  }
2388
2400
  ],
@@ -2587,8 +2599,7 @@ function parseGeneric(opts) {
2587
2599
  for (const pattern of patterns) {
2588
2600
  const re = new RegExp(pattern.re.source, pattern.re.flags.includes("g") ? pattern.re.flags : `${pattern.re.flags}g`);
2589
2601
  re.lastIndex = 0;
2590
- let match;
2591
- while ((match = re.exec(content)) !== null) {
2602
+ for (const match of content.matchAll(re)) {
2592
2603
  if (symbols.length >= maxSymbols) break;
2593
2604
  let name = (match[1] ?? match[2] ?? "").trim();
2594
2605
  if (lang === "md" && match[2]) name = match[2].trim();
@@ -3543,17 +3554,7 @@ function throwIfAborted(signal) {
3543
3554
  function isAbortError(err) {
3544
3555
  return err instanceof DOMException && err.name === "AbortError";
3545
3556
  }
3546
- var DEFAULT_IGNORE = [
3547
- "node_modules",
3548
- ".git",
3549
- "dist",
3550
- "build",
3551
- ".next",
3552
- "coverage",
3553
- ".turbo",
3554
- "__snapshots__",
3555
- ".nyc_output"
3556
- ];
3557
+ var DEFAULT_IGNORE = DEFAULT_WALK_IGNORE_DIRS;
3557
3558
  var DEFAULT_IGNORE_FILES = /* @__PURE__ */ new Set(["package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml"]);
3558
3559
  var MAX_INDEX_FILE_BYTES = 5 * 1024 * 1024;
3559
3560
  function isWithinProject(projectRoot, file) {