scip-query 0.4.2 → 0.4.3

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 (137) hide show
  1. package/dist/{chunk-JHVQB4Y5.js → chunk-334PCFO3.js} +12 -12
  2. package/dist/{chunk-OXX3QF24.js → chunk-46ZTW4AI.js} +2 -2
  3. package/dist/{chunk-24LF6IZB.js → chunk-4YN3PE57.js} +3 -3
  4. package/dist/{chunk-3NJSJ7TE.js → chunk-5YB6UXQ3.js} +4 -15
  5. package/dist/{chunk-Z5VSUOEE.js → chunk-6PVHJ332.js} +2 -2
  6. package/dist/{chunk-EAGKJFDX.js → chunk-7KGTWDAX.js} +3 -3
  7. package/dist/{chunk-PU2254N2.js → chunk-7OGXSMLY.js} +5 -15
  8. package/dist/{chunk-R7HPHMRZ.js → chunk-AEBM56CO.js} +3 -3
  9. package/dist/{chunk-SYQR4QGK.js → chunk-B747RITP.js} +3 -3
  10. package/dist/{chunk-A6XLXV6W.js → chunk-B7LDMCUS.js} +3 -3
  11. package/dist/{chunk-KLNKDX6A.js → chunk-C2VSV54P.js} +4 -4
  12. package/dist/{chunk-VKBOLNYN.js → chunk-DIYEUFVP.js} +10 -8
  13. package/dist/{chunk-RE7POFGI.js → chunk-E74RY6AQ.js} +2 -2
  14. package/dist/{chunk-RL74LF47.js → chunk-FIMTTUGE.js} +2 -2
  15. package/dist/{chunk-ALUFWH3U.js → chunk-FMAYH7GS.js} +116 -269
  16. package/dist/{chunk-MGNMHKX3.js → chunk-FO2CBB7U.js} +10 -2
  17. package/dist/{chunk-7BS4CPJX.js → chunk-HESWGDIV.js} +3 -3
  18. package/dist/{chunk-FVJE4MQL.js → chunk-HL2LXSBW.js} +5 -8
  19. package/dist/{chunk-KG4OFQEN.js → chunk-HW76DVE4.js} +3 -3
  20. package/dist/{chunk-RJ5GULL6.js → chunk-IC5NTO47.js} +2 -2
  21. package/dist/{chunk-VY2L4TP6.js → chunk-J34HAAEQ.js} +3 -3
  22. package/dist/{chunk-PCU455MX.js → chunk-JSXGC2EH.js} +2 -2
  23. package/dist/{chunk-NXUIWD6K.js → chunk-LQXBFCP2.js} +3 -3
  24. package/dist/{chunk-GNAMV3JC.js → chunk-NML6M5AS.js} +3 -3
  25. package/dist/{chunk-UJWI5CBB.js → chunk-NNFP4ZRF.js} +4 -7
  26. package/dist/{chunk-6ECR2FLR.js → chunk-NWXTQGUE.js} +4 -15
  27. package/dist/{chunk-ZVZAIIB5.js → chunk-NYZ6INK3.js} +3 -3
  28. package/dist/{chunk-JKXHHV4B.js → chunk-OMVF3BHY.js} +2 -2
  29. package/dist/{chunk-CBIWNZZZ.js → chunk-PGQXIAJF.js} +3 -3
  30. package/dist/{chunk-J47VSL6I.js → chunk-PKDFXASW.js} +3 -3
  31. package/dist/{chunk-POLELLNM.js → chunk-PSK5BPFE.js} +3 -3
  32. package/dist/{chunk-6CH23IAS.js → chunk-QZ4FRB65.js} +9 -7
  33. package/dist/{chunk-TWVXFKJA.js → chunk-R2QBMQQN.js} +4 -4
  34. package/dist/{chunk-5GCORUNV.js → chunk-T3ALCNCP.js} +30 -17
  35. package/dist/{chunk-QMXSLHZP.js → chunk-T6UVM534.js} +2 -2
  36. package/dist/{chunk-6UZU7DFL.js → chunk-U74VYTLX.js} +3 -3
  37. package/dist/{chunk-XUVPQDXW.js → chunk-UIRCHPOU.js} +4 -4
  38. package/dist/{chunk-43A4UCS7.js → chunk-UNS6ZQVX.js} +3 -3
  39. package/dist/{chunk-J6QXMYAQ.js → chunk-VJMTX3OR.js} +3 -3
  40. package/dist/{chunk-SVLUJSY7.js → chunk-XJSPWHNT.js} +4 -15
  41. package/dist/{chunk-W46L2BXT.js → chunk-XMZAC2VU.js} +2 -2
  42. package/dist/{chunk-ELFGD5EW.js → chunk-Y7FKURZG.js} +3 -3
  43. package/dist/{chunk-TO3L4YNK.js → chunk-YMSJCSRG.js} +5 -1
  44. package/dist/{chunk-DUJNJQPO.js → chunk-YQIWS5V6.js} +3 -3
  45. package/dist/{chunk-KYPXKV64.js → chunk-ZPEI7DRJ.js} +30 -15
  46. package/dist/cli.js +200 -373
  47. package/dist/{db-C4rPbKkI.d.ts → db-6F9R9e_t.d.ts} +0 -4
  48. package/dist/index.d.ts +2 -4
  49. package/dist/index.js +45 -57
  50. package/dist/queries/affected.d.ts +1 -1
  51. package/dist/queries/affected.js +3 -3
  52. package/dist/queries/bottlenecks.d.ts +1 -1
  53. package/dist/queries/bottlenecks.js +3 -3
  54. package/dist/queries/by-kind.d.ts +1 -1
  55. package/dist/queries/by-kind.js +3 -3
  56. package/dist/queries/call-graph.d.ts +1 -1
  57. package/dist/queries/call-graph.js +3 -3
  58. package/dist/queries/change-surface.d.ts +1 -1
  59. package/dist/queries/change-surface.js +3 -3
  60. package/dist/queries/code.d.ts +1 -1
  61. package/dist/queries/code.js +3 -3
  62. package/dist/queries/complexity-hotspots.d.ts +1 -1
  63. package/dist/queries/complexity-hotspots.js +3 -3
  64. package/dist/queries/complexity.d.ts +1 -1
  65. package/dist/queries/complexity.js +3 -3
  66. package/dist/queries/convergence.d.ts +1 -1
  67. package/dist/queries/convergence.js +3 -3
  68. package/dist/queries/coupling.d.ts +1 -1
  69. package/dist/queries/coupling.js +3 -3
  70. package/dist/queries/cycles.d.ts +1 -1
  71. package/dist/queries/cycles.js +3 -3
  72. package/dist/queries/dataflow.d.ts +1 -1
  73. package/dist/queries/dataflow.js +3 -3
  74. package/dist/queries/dead.d.ts +1 -1
  75. package/dist/queries/dead.js +4 -4
  76. package/dist/queries/deep-chains.d.ts +1 -1
  77. package/dist/queries/deep-chains.js +3 -3
  78. package/dist/queries/deps.d.ts +1 -1
  79. package/dist/queries/deps.js +3 -3
  80. package/dist/queries/diff-impact.d.ts +1 -1
  81. package/dist/queries/diff-impact.js +2 -2
  82. package/dist/queries/drift.d.ts +1 -1
  83. package/dist/queries/drift.js +3 -3
  84. package/dist/queries/extract-candidates.d.ts +1 -1
  85. package/dist/queries/extract-candidates.js +3 -3
  86. package/dist/queries/fan.d.ts +1 -1
  87. package/dist/queries/fan.js +3 -3
  88. package/dist/queries/files.d.ts +1 -1
  89. package/dist/queries/files.js +1 -1
  90. package/dist/queries/health.d.ts +1 -1
  91. package/dist/queries/health.js +14 -14
  92. package/dist/queries/hierarchy.d.ts +1 -1
  93. package/dist/queries/hierarchy.js +3 -3
  94. package/dist/queries/hotspots.d.ts +1 -1
  95. package/dist/queries/hotspots.js +3 -3
  96. package/dist/queries/imports.d.ts +1 -1
  97. package/dist/queries/imports.js +3 -3
  98. package/dist/queries/index.d.ts +1 -1
  99. package/dist/queries/index.js +45 -45
  100. package/dist/queries/isolated.d.ts +1 -1
  101. package/dist/queries/isolated.js +4 -4
  102. package/dist/queries/members.d.ts +1 -1
  103. package/dist/queries/members.js +3 -3
  104. package/dist/queries/methods.d.ts +1 -1
  105. package/dist/queries/methods.js +3 -3
  106. package/dist/queries/outline.d.ts +1 -1
  107. package/dist/queries/outline.js +3 -3
  108. package/dist/queries/passthrough-candidates.d.ts +1 -1
  109. package/dist/queries/passthrough-candidates.js +3 -3
  110. package/dist/queries/redundant-reexports.d.ts +1 -1
  111. package/dist/queries/redundant-reexports.js +4 -4
  112. package/dist/queries/refs.d.ts +1 -1
  113. package/dist/queries/refs.js +3 -3
  114. package/dist/queries/similar-chains.d.ts +1 -1
  115. package/dist/queries/similar-chains.js +3 -3
  116. package/dist/queries/similar-files.d.ts +1 -1
  117. package/dist/queries/similar-files.js +3 -3
  118. package/dist/queries/similar-signatures.d.ts +1 -1
  119. package/dist/queries/similar-signatures.js +3 -3
  120. package/dist/queries/similar.d.ts +2 -1
  121. package/dist/queries/similar.js +3 -3
  122. package/dist/queries/slice.d.ts +4 -3
  123. package/dist/queries/slice.js +3 -3
  124. package/dist/queries/stale-abstractions.d.ts +1 -1
  125. package/dist/queries/stale-abstractions.js +3 -3
  126. package/dist/queries/stats.d.ts +1 -1
  127. package/dist/queries/surface.d.ts +1 -1
  128. package/dist/queries/surface.js +3 -3
  129. package/dist/queries/symbols.d.ts +1 -1
  130. package/dist/queries/symbols.js +3 -3
  131. package/dist/queries/system.d.ts +1 -1
  132. package/dist/queries/system.js +3 -3
  133. package/dist/queries/trace.d.ts +1 -1
  134. package/dist/queries/trace.js +3 -3
  135. package/dist/queries/wrapper-candidates.d.ts +1 -1
  136. package/dist/queries/wrapper-candidates.js +3 -3
  137. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  findFirstSymbolMatch
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
  import {
5
5
  isDirectChildSymbol,
6
6
  leafSuffix,
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/members.ts
11
11
  function members(db, symbolPattern) {
@@ -34,4 +34,4 @@ function members(db, symbolPattern) {
34
34
  export {
35
35
  members
36
36
  };
37
- //# sourceMappingURL=chunk-GNAMV3JC.js.map
37
+ //# sourceMappingURL=chunk-NML6M5AS.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getDefinitionsForFile,
3
3
  resolveIndexedPaths
4
- } from "./chunk-ALUFWH3U.js";
4
+ } from "./chunk-FMAYH7GS.js";
5
5
  import {
6
- leafSuffix,
6
+ isCallableSymbol,
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/surface.ts
11
11
  function surface(db, modulePattern) {
@@ -65,11 +65,8 @@ function surface(db, modulePattern) {
65
65
  shortName: shortenSymbol(r.symbol)
66
66
  }));
67
67
  }
68
- function isCallableSymbol(rawSymbol) {
69
- return rawSymbol.endsWith("().") || leafSuffix(rawSymbol) === "method";
70
- }
71
68
 
72
69
  export {
73
70
  surface
74
71
  };
75
- //# sourceMappingURL=chunk-UJWI5CBB.js.map
72
+ //# sourceMappingURL=chunk-NNFP4ZRF.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getCalleeRowsForSymbol,
3
- getDefinitionsForFile
4
- } from "./chunk-ALUFWH3U.js";
3
+ getScopedDefinitions
4
+ } from "./chunk-FMAYH7GS.js";
5
5
  import {
6
6
  isFunctionLikeSymbol,
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/passthrough-candidates.ts
11
11
  function passthroughCandidates(db, opts) {
@@ -39,17 +39,6 @@ function passthroughCandidates(db, opts) {
39
39
  results.sort((a, b) => a.loc - b.loc || a.file.localeCompare(b.file));
40
40
  return results.slice(0, limit);
41
41
  }
42
- function getScopedDefinitions(db, scope) {
43
- const scopeFilter = scope ? `AND relative_path LIKE '%${scope}%'` : "";
44
- return db.all(
45
- `SELECT relative_path
46
- FROM documents
47
- WHERE 1 = 1
48
- ${db.pathExclusionsFor("documents")}
49
- ${scopeFilter}
50
- ORDER BY relative_path`
51
- ).flatMap((row) => getDefinitionsForFile(db, row.relative_path)).filter((row) => !db.isIgnored(row.relativePath));
52
- }
53
42
  function definitionLoc(definition) {
54
43
  return definition.endLine - definition.startLine + 1;
55
44
  }
@@ -57,4 +46,4 @@ function definitionLoc(definition) {
57
46
  export {
58
47
  passthroughCandidates
59
48
  };
60
- //# sourceMappingURL=chunk-6ECR2FLR.js.map
49
+ //# sourceMappingURL=chunk-NWXTQGUE.js.map
@@ -5,11 +5,11 @@ import {
5
5
  findFirstSymbolMatch,
6
6
  getSourceReferenceSites,
7
7
  getSourceText
8
- } from "./chunk-ALUFWH3U.js";
8
+ } from "./chunk-FMAYH7GS.js";
9
9
  import {
10
10
  isFunctionLikeSymbol,
11
11
  shortenSymbol
12
- } from "./chunk-TO3L4YNK.js";
12
+ } from "./chunk-YMSJCSRG.js";
13
13
 
14
14
  // src/queries/trace.ts
15
15
  function trace(db, symbolPattern) {
@@ -92,4 +92,4 @@ function looksBogusSignature(signature) {
92
92
  export {
93
93
  trace
94
94
  };
95
- //# sourceMappingURL=chunk-ZVZAIIB5.js.map
95
+ //# sourceMappingURL=chunk-NYZ6INK3.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildFileDepGraph
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
 
5
5
  // src/entry-surfaces.ts
6
6
  var liveBarrelCache = /* @__PURE__ */ new WeakMap();
@@ -81,4 +81,4 @@ export {
81
81
  isEntrySurface,
82
82
  getInactiveBarrelPaths
83
83
  };
84
- //# sourceMappingURL=chunk-JKXHHV4B.js.map
84
+ //# sourceMappingURL=chunk-OMVF3BHY.js.map
@@ -2,10 +2,10 @@ import {
2
2
  getAllDefinitions,
3
3
  getCalleeRowsForSymbol,
4
4
  getCallerRowsForSymbol
5
- } from "./chunk-ALUFWH3U.js";
5
+ } from "./chunk-FMAYH7GS.js";
6
6
  import {
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/bottlenecks.ts
11
11
  function bottlenecks(db, opts = {}) {
@@ -76,4 +76,4 @@ function bottlenecks(db, opts = {}) {
76
76
  export {
77
77
  bottlenecks
78
78
  };
79
- //# sourceMappingURL=chunk-CBIWNZZZ.js.map
79
+ //# sourceMappingURL=chunk-PGQXIAJF.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  findFirstSymbolMatch,
3
3
  getCalleeRowsForSymbol
4
- } from "./chunk-ALUFWH3U.js";
4
+ } from "./chunk-FMAYH7GS.js";
5
5
  import {
6
6
  shortenSymbol
7
- } from "./chunk-TO3L4YNK.js";
7
+ } from "./chunk-YMSJCSRG.js";
8
8
 
9
9
  // src/queries/convergence.ts
10
10
  function convergence(db, symbolPatternA, symbolPatternB) {
@@ -73,4 +73,4 @@ function convergence(db, symbolPatternA, symbolPatternB) {
73
73
  export {
74
74
  convergence
75
75
  };
76
- //# sourceMappingURL=chunk-J47VSL6I.js.map
76
+ //# sourceMappingURL=chunk-PKDFXASW.js.map
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-4TYLS5XX.js";
4
4
  import {
5
5
  resolveIndexedPaths
6
- } from "./chunk-ALUFWH3U.js";
6
+ } from "./chunk-FMAYH7GS.js";
7
7
  import {
8
8
  shortenSymbol
9
- } from "./chunk-TO3L4YNK.js";
9
+ } from "./chunk-YMSJCSRG.js";
10
10
 
11
11
  // src/queries/system.ts
12
12
  function system(db, modulePattern) {
@@ -79,4 +79,4 @@ function system(db, modulePattern) {
79
79
  export {
80
80
  system
81
81
  };
82
- //# sourceMappingURL=chunk-POLELLNM.js.map
82
+ //# sourceMappingURL=chunk-PSK5BPFE.js.map
@@ -3,12 +3,12 @@ import {
3
3
  getAllDefinitions,
4
4
  getCalleeRowsForSymbol,
5
5
  getSourceText
6
- } from "./chunk-ALUFWH3U.js";
6
+ } from "./chunk-FMAYH7GS.js";
7
7
  import {
8
8
  isFunctionLikeSymbol,
9
9
  leafName,
10
10
  shortenSymbol
11
- } from "./chunk-TO3L4YNK.js";
11
+ } from "./chunk-YMSJCSRG.js";
12
12
 
13
13
  // src/queries/similar.ts
14
14
  function similar(db, symbolPattern, opts = {}) {
@@ -52,7 +52,7 @@ function similar(db, symbolPattern, opts = {}) {
52
52
  return similarBySourceShape(db, symbolPattern, { minSimilarity, limit });
53
53
  }
54
54
  function similarAll(db, opts = {}) {
55
- const { minSimilarity = 0.5, limit = 20, scope, minCallees = 4 } = opts;
55
+ const { minSimilarity = 0.5, limit = 20, scope, minCallees = 4, crossFileOnly = false } = opts;
56
56
  const all = getAllCalleeFingerprints(db, { minCallees, scope });
57
57
  const idfWeights = computeIdf(all);
58
58
  const results = [];
@@ -60,14 +60,16 @@ function similarAll(db, opts = {}) {
60
60
  for (let j = i + 1; j < all.length; j++) {
61
61
  const a = all[i];
62
62
  const b = all[j];
63
- if (a.file === b.file) continue;
63
+ if (crossFileOnly && a.file === b.file) continue;
64
64
  const { similarity, significantShared } = weightedSimilarity(
65
65
  a.callees,
66
66
  b.callees,
67
67
  idfWeights
68
68
  );
69
69
  if (similarity < minSimilarity) continue;
70
- if (significantShared.length < 2) continue;
70
+ const sharedCount = intersection(a.callees, b.callees).size;
71
+ if (significantShared.length < 2 && sharedCount < 4) continue;
72
+ const displayShared = significantShared.length > 0 ? significantShared : [...intersection(a.callees, b.callees)];
71
73
  results.push({
72
74
  symbolA: a.symbol,
73
75
  shortNameA: shortenSymbol(a.symbol),
@@ -76,7 +78,7 @@ function similarAll(db, opts = {}) {
76
78
  shortNameB: shortenSymbol(b.symbol),
77
79
  fileB: b.file,
78
80
  similarity,
79
- sharedCallees: significantShared.map(shortenSymbol),
81
+ sharedCallees: displayShared.map(shortenSymbol),
80
82
  uniqueToA: [...difference(a.callees, b.callees)].map(shortenSymbol),
81
83
  uniqueToB: [...difference(b.callees, a.callees)].map(shortenSymbol)
82
84
  });
@@ -336,4 +338,4 @@ export {
336
338
  similar,
337
339
  similarAll
338
340
  };
339
- //# sourceMappingURL=chunk-6CH23IAS.js.map
341
+ //# sourceMappingURL=chunk-QZ4FRB65.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  isLiveBarrel
3
- } from "./chunk-JKXHHV4B.js";
3
+ } from "./chunk-OMVF3BHY.js";
4
4
  import {
5
5
  getDefinitionsForFile,
6
6
  getSourceExports,
7
7
  getSourceImports
8
- } from "./chunk-ALUFWH3U.js";
8
+ } from "./chunk-FMAYH7GS.js";
9
9
  import {
10
10
  leafSuffix,
11
11
  shortenSymbol
12
- } from "./chunk-TO3L4YNK.js";
12
+ } from "./chunk-YMSJCSRG.js";
13
13
 
14
14
  // src/queries/redundant-reexports.ts
15
15
  function redundantReexports(db, opts = {}) {
@@ -182,4 +182,4 @@ function dedupeReexports(rows) {
182
182
  export {
183
183
  redundantReexports
184
184
  };
185
- //# sourceMappingURL=chunk-TWVXFKJA.js.map
185
+ //# sourceMappingURL=chunk-R2QBMQQN.js.map
@@ -1,35 +1,48 @@
1
1
  import {
2
+ findExactSymbolMatch,
2
3
  findFirstSymbolMatch,
3
4
  getCalleeRowsForSymbol
4
- } from "./chunk-ALUFWH3U.js";
5
+ } from "./chunk-FMAYH7GS.js";
5
6
  import {
6
7
  shortenSymbol
7
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
8
9
 
9
10
  // src/queries/slice.ts
10
11
  function slice(db, symbolPattern, opts = {}) {
11
- const { direction = "backward" } = opts;
12
+ const { direction = "backward", maxDepth = 3 } = opts;
12
13
  const match = findFirstSymbolMatch(db, symbolPattern);
13
14
  if (!match) return null;
14
15
  if (direction === "backward") {
15
- return backwardSlice(db, match);
16
+ return backwardSlice(db, match, maxDepth);
16
17
  } else {
17
18
  return forwardSlice(db, match);
18
19
  }
19
20
  }
20
- function backwardSlice(db, match) {
21
- const callees = getCalleeRowsForSymbol(db, match);
22
- const seen = /* @__PURE__ */ new Set();
21
+ function backwardSlice(db, match, maxDepth) {
23
22
  const connected = [];
24
- for (const c of callees) {
25
- if (seen.has(c.symbol)) continue;
26
- seen.add(c.symbol);
27
- connected.push({
28
- symbol: c.symbol,
29
- shortName: shortenSymbol(c.symbol),
30
- file: c.file,
31
- relationship: "referenced within definition (callee)"
32
- });
23
+ const visited = /* @__PURE__ */ new Set([match.symbol]);
24
+ let frontier = [match];
25
+ for (let depth = 1; depth <= maxDepth; depth++) {
26
+ if (frontier.length === 0) break;
27
+ const nextFrontier = [];
28
+ for (const current of frontier) {
29
+ const callees = getCalleeRowsForSymbol(db, current);
30
+ for (const c of callees) {
31
+ if (visited.has(c.symbol)) continue;
32
+ visited.add(c.symbol);
33
+ connected.push({
34
+ symbol: c.symbol,
35
+ shortName: shortenSymbol(c.symbol),
36
+ file: c.file,
37
+ relationship: depth === 1 ? "referenced within definition (callee)" : `depth ${depth} callee`
38
+ });
39
+ const calleeMatch = findExactSymbolMatch(db, c.symbol);
40
+ if (calleeMatch && !db.isIgnored(calleeMatch.relativePath)) {
41
+ nextFrontier.push(calleeMatch);
42
+ }
43
+ }
44
+ }
45
+ frontier = nextFrontier;
33
46
  }
34
47
  return {
35
48
  symbol: match.symbol,
@@ -97,4 +110,4 @@ function forwardSlice(db, match) {
97
110
  export {
98
111
  slice
99
112
  };
100
- //# sourceMappingURL=chunk-5GCORUNV.js.map
113
+ //# sourceMappingURL=chunk-T3ALCNCP.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildFileDepGraph
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
 
5
5
  // src/queries/similar-chains.ts
6
6
  function similarChains(db, opts = {}) {
@@ -210,4 +210,4 @@ function isSubChain(sub, full) {
210
210
  export {
211
211
  similarChains
212
212
  };
213
- //# sourceMappingURL=chunk-QMXSLHZP.js.map
213
+ //# sourceMappingURL=chunk-T6UVM534.js.map
@@ -2,10 +2,10 @@ import {
2
2
  findFirstSymbolMatch,
3
3
  getCalleeRowsForSymbol,
4
4
  getCallerRowsForSymbol
5
- } from "./chunk-ALUFWH3U.js";
5
+ } from "./chunk-FMAYH7GS.js";
6
6
  import {
7
7
  shortenSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/call-graph.ts
11
11
  function callGraph(db, symbolPattern) {
@@ -43,4 +43,4 @@ function uniqueRows(rows) {
43
43
  export {
44
44
  callGraph
45
45
  };
46
- //# sourceMappingURL=chunk-6UZU7DFL.js.map
46
+ //# sourceMappingURL=chunk-U74VYTLX.js.map
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  isEntrySurface
3
- } from "./chunk-JKXHHV4B.js";
3
+ } from "./chunk-OMVF3BHY.js";
4
4
  import {
5
5
  getAllDefinitions,
6
6
  getCalleeRowsForSymbol,
7
7
  getCallerRowsForSymbol
8
- } from "./chunk-ALUFWH3U.js";
8
+ } from "./chunk-FMAYH7GS.js";
9
9
  import {
10
10
  shortenSymbol
11
- } from "./chunk-TO3L4YNK.js";
11
+ } from "./chunk-YMSJCSRG.js";
12
12
 
13
13
  // src/queries/isolated.ts
14
14
  function isolated(db, opts = {}) {
@@ -31,4 +31,4 @@ function isolated(db, opts = {}) {
31
31
  export {
32
32
  isolated
33
33
  };
34
- //# sourceMappingURL=chunk-XUVPQDXW.js.map
34
+ //# sourceMappingURL=chunk-UIRCHPOU.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveIndexedFile
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
  import {
5
5
  shortenSymbol
6
- } from "./chunk-TO3L4YNK.js";
6
+ } from "./chunk-YMSJCSRG.js";
7
7
 
8
8
  // src/queries/change-surface.ts
9
9
  function changeSurface(db, filePattern) {
@@ -68,4 +68,4 @@ function changeSurface(db, filePattern) {
68
68
  export {
69
69
  changeSurface
70
70
  };
71
- //# sourceMappingURL=chunk-43A4UCS7.js.map
71
+ //# sourceMappingURL=chunk-UNS6ZQVX.js.map
@@ -2,10 +2,10 @@ import {
2
2
  findFirstSymbolMatch,
3
3
  getSourceReferenceSites,
4
4
  getSourceText
5
- } from "./chunk-ALUFWH3U.js";
5
+ } from "./chunk-FMAYH7GS.js";
6
6
  import {
7
7
  isFunctionLikeSymbol
8
- } from "./chunk-TO3L4YNK.js";
8
+ } from "./chunk-YMSJCSRG.js";
9
9
 
10
10
  // src/queries/refs.ts
11
11
  function refs(db, symbolPattern) {
@@ -112,4 +112,4 @@ function rubyReferenceTokens(rawSymbol) {
112
112
  export {
113
113
  refs
114
114
  };
115
- //# sourceMappingURL=chunk-J6QXMYAQ.js.map
115
+ //# sourceMappingURL=chunk-VJMTX3OR.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
- getDefinitionsForFile
3
- } from "./chunk-ALUFWH3U.js";
2
+ getScopedDefinitions
3
+ } from "./chunk-FMAYH7GS.js";
4
4
  import {
5
5
  shortenSymbol
6
- } from "./chunk-TO3L4YNK.js";
6
+ } from "./chunk-YMSJCSRG.js";
7
7
 
8
8
  // src/queries/stale-abstractions.ts
9
9
  function staleAbstractions(db, opts) {
@@ -41,17 +41,6 @@ function isTrueStaleAbstraction(row, filesWithFunctions) {
41
41
  }
42
42
  return true;
43
43
  }
44
- function getScopedDefinitions(db, scope) {
45
- const scopeFilter = scope ? `AND relative_path LIKE '%${scope}%'` : "";
46
- return db.all(
47
- `SELECT relative_path
48
- FROM documents
49
- WHERE 1 = 1
50
- ${db.pathExclusionsFor("documents")}
51
- ${scopeFilter}
52
- ORDER BY relative_path`
53
- ).flatMap((row) => getDefinitionsForFile(db, row.relative_path)).filter((row) => !db.isIgnored(row.relativePath));
54
- }
55
44
  function countCrossFileConsumers(db, definition) {
56
45
  const callers = db.all(
57
46
  `SELECT DISTINCT d.relative_path
@@ -72,4 +61,4 @@ function definitionLoc(definition) {
72
61
  export {
73
62
  staleAbstractions
74
63
  };
75
- //# sourceMappingURL=chunk-SVLUJSY7.js.map
64
+ //# sourceMappingURL=chunk-XJSPWHNT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveIndexedFile
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
 
5
5
  // src/queries/coupling.ts
6
6
  function coupling(db, file1, file2) {
@@ -81,4 +81,4 @@ export {
81
81
  coupling,
82
82
  topCoupling
83
83
  };
84
- //# sourceMappingURL=chunk-W46L2BXT.js.map
84
+ //# sourceMappingURL=chunk-XMZAC2VU.js.map
@@ -3,10 +3,10 @@ import {
3
3
  getCalleeRowsForSymbol,
4
4
  getCallerRowsForSymbol,
5
5
  testFileExclusionSql
6
- } from "./chunk-ALUFWH3U.js";
6
+ } from "./chunk-FMAYH7GS.js";
7
7
  import {
8
8
  shortenSymbol
9
- } from "./chunk-TO3L4YNK.js";
9
+ } from "./chunk-YMSJCSRG.js";
10
10
 
11
11
  // src/queries/complexity-hotspots.ts
12
12
  function complexityHotspots(db, opts) {
@@ -127,4 +127,4 @@ function complexityHotspots(db, opts) {
127
127
  export {
128
128
  complexityHotspots
129
129
  };
130
- //# sourceMappingURL=chunk-ELFGD5EW.js.map
130
+ //# sourceMappingURL=chunk-Y7FKURZG.js.map
@@ -169,6 +169,9 @@ function leafSuffix(raw) {
169
169
  const last = sym.descriptors[sym.descriptors.length - 1];
170
170
  return last?.suffix ?? null;
171
171
  }
172
+ function isCallableSymbol(raw) {
173
+ return raw.endsWith("().") || leafSuffix(raw) === "method";
174
+ }
172
175
  function isFunctionLikeSymbol(raw) {
173
176
  const suffix = leafSuffix(raw);
174
177
  return suffix === "method" || suffix === "term";
@@ -202,8 +205,9 @@ export {
202
205
  shortenSymbol,
203
206
  leafName,
204
207
  leafSuffix,
208
+ isCallableSymbol,
205
209
  isFunctionLikeSymbol,
206
210
  isModuleLikeSymbol,
207
211
  isDirectChildSymbol
208
212
  };
209
- //# sourceMappingURL=chunk-TO3L4YNK.js.map
213
+ //# sourceMappingURL=chunk-YMSJCSRG.js.map
@@ -2,12 +2,12 @@ import {
2
2
  findFirstSymbolMatch,
3
3
  getSourceImports,
4
4
  resolveIndexedFile
5
- } from "./chunk-ALUFWH3U.js";
5
+ } from "./chunk-FMAYH7GS.js";
6
6
  import {
7
7
  isModuleLikeSymbol,
8
8
  leafName,
9
9
  shortenSymbol
10
- } from "./chunk-TO3L4YNK.js";
10
+ } from "./chunk-YMSJCSRG.js";
11
11
 
12
12
  // src/queries/imports.ts
13
13
  function imports(db, filePattern) {
@@ -169,4 +169,4 @@ export {
169
169
  importedBy,
170
170
  unusedImports
171
171
  };
172
- //# sourceMappingURL=chunk-DUJNJQPO.js.map
172
+ //# sourceMappingURL=chunk-YQIWS5V6.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  resolveIndexedPaths
3
- } from "./chunk-ALUFWH3U.js";
3
+ } from "./chunk-FMAYH7GS.js";
4
4
  import {
5
5
  shortenSymbol
6
- } from "./chunk-TO3L4YNK.js";
6
+ } from "./chunk-YMSJCSRG.js";
7
7
 
8
8
  // src/queries/outline.ts
9
9
  function outline(db, filePattern) {
@@ -22,22 +22,37 @@ function outline(db, filePattern) {
22
22
  ORDER BY d.relative_path, der.start_line`,
23
23
  ...resolvedPaths
24
24
  );
25
+ const nodes = rows.map((r) => ({
26
+ symbol: r.symbol,
27
+ shortName: shortenSymbol(r.symbol),
28
+ startLine: r.start_line,
29
+ endLine: r.end_line,
30
+ children: []
31
+ }));
25
32
  const nodeMap = /* @__PURE__ */ new Map();
33
+ for (const n of nodes) nodeMap.set(n.symbol, n);
26
34
  const roots = [];
27
- for (const r of rows) {
28
- const node = {
29
- symbol: r.symbol,
30
- shortName: shortenSymbol(r.symbol),
31
- startLine: r.start_line,
32
- endLine: r.end_line,
33
- children: []
34
- };
35
- nodeMap.set(r.symbol, node);
36
- }
37
- for (const r of rows) {
38
- const node = nodeMap.get(r.symbol);
35
+ for (let i = 0; i < rows.length; i++) {
36
+ const r = rows[i];
37
+ const node = nodes[i];
39
38
  if (r.enclosing_symbol && nodeMap.has(r.enclosing_symbol)) {
40
39
  nodeMap.get(r.enclosing_symbol).children.push(node);
40
+ continue;
41
+ }
42
+ let bestParent = null;
43
+ let bestSize = Infinity;
44
+ for (const candidate of nodes) {
45
+ if (candidate === node) continue;
46
+ if (candidate.startLine <= node.startLine && candidate.endLine >= node.endLine) {
47
+ const size = candidate.endLine - candidate.startLine;
48
+ if (size < bestSize) {
49
+ bestSize = size;
50
+ bestParent = candidate;
51
+ }
52
+ }
53
+ }
54
+ if (bestParent) {
55
+ bestParent.children.push(node);
41
56
  } else {
42
57
  roots.push(node);
43
58
  }
@@ -48,4 +63,4 @@ function outline(db, filePattern) {
48
63
  export {
49
64
  outline
50
65
  };
51
- //# sourceMappingURL=chunk-KYPXKV64.js.map
66
+ //# sourceMappingURL=chunk-ZPEI7DRJ.js.map