scip-query 0.5.0 → 0.6.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/README.md +14 -7
- package/dist/chunk-2DSS2NGF.js +10 -0
- package/dist/chunk-2RLP74AO.js +2 -0
- package/dist/chunk-4QJ7LVW5.js +2 -0
- package/dist/chunk-4TYGGOLO.js +5 -0
- package/dist/chunk-5IADAU5B.js +7 -0
- package/dist/chunk-7754WFFV.js +18 -0
- package/dist/chunk-7VOF4ZG6.js +2 -0
- package/dist/chunk-7Z4COVMC.js +2 -0
- package/dist/chunk-AJ5PWKD4.js +2 -0
- package/dist/chunk-BDBRZPX3.js +7 -0
- package/dist/chunk-BE6EQIWY.js +2 -0
- package/dist/chunk-BQ3INTYT.js +8 -0
- package/dist/chunk-D7KLLMPB.js +2 -0
- package/dist/chunk-D7YBWSON.js +29 -0
- package/dist/chunk-DE5ZBHMK.js +39 -0
- package/dist/chunk-DHYIJHXZ.js +33 -0
- package/dist/chunk-EEF3YEHW.js +2 -0
- package/dist/chunk-F2LLHRRZ.js +2 -0
- package/dist/chunk-FCC3XJTI.js +2 -0
- package/dist/chunk-GNXRLK5G.js +2 -0
- package/dist/chunk-GXVB36TG.js +62 -0
- package/dist/chunk-HMKJTAZD.js +2 -0
- package/dist/chunk-IBGBI3VU.js +2 -0
- package/dist/chunk-IYFZS4PV.js +84 -0
- package/dist/chunk-JH3A7HTU.js +2 -0
- package/dist/chunk-JS2RNIC7.js +2 -0
- package/dist/chunk-K5FQFCSN.js +41 -0
- package/dist/chunk-K6GBKEQE.js +6 -0
- package/dist/chunk-KO7YJRWP.js +12 -0
- package/dist/chunk-KYT47WU2.js +4 -0
- package/dist/chunk-LORWXBOO.js +2 -0
- package/dist/chunk-LX4H4LLG.js +89 -0
- package/dist/chunk-N3Z2SJCR.js +2 -0
- package/dist/chunk-NTDA4A2D.js +25 -0
- package/dist/chunk-NXMYYHDO.js +24 -0
- package/dist/chunk-PZ6ESKRH.js +7 -0
- package/dist/chunk-QXE6EDY2.js +6 -0
- package/dist/chunk-RJ7SPBJ5.js +5 -0
- package/dist/chunk-RWE6FHG3.js +3 -0
- package/dist/chunk-SDX6MDBL.js +2 -0
- package/dist/chunk-SG35Y7J2.js +2 -0
- package/dist/chunk-STOGKRJH.js +4 -0
- package/dist/chunk-TINPMWJK.js +2 -0
- package/dist/chunk-UJB62HV3.js +2 -0
- package/dist/chunk-VEUMRDHW.js +2 -0
- package/dist/chunk-WCDXJGYT.js +65 -0
- package/dist/chunk-WTSTDJZ7.js +6 -0
- package/dist/chunk-XAZTIDST.js +2 -0
- package/dist/chunk-XVDASCN7.js +35 -0
- package/dist/chunk-Y7H6D2EV.js +2 -0
- package/dist/chunk-Y7LOQSWY.js +2 -0
- package/dist/chunk-YIPCV7M7.js +70 -0
- package/dist/chunk-ZSRXMNMK.js +5 -0
- package/dist/chunk-ZXKURFVB.js +56 -0
- package/dist/cli.js +509 -8758
- package/dist/{db-6F9R9e_t.d.ts → db-BSTtBG_H.d.ts} +146 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.js +13 -1616
- package/dist/postinstall.js +4 -100
- package/dist/queries/affected.d.ts +1 -1
- package/dist/queries/affected.js +1 -8
- package/dist/queries/bottlenecks.d.ts +1 -1
- package/dist/queries/bottlenecks.js +1 -8
- package/dist/queries/by-kind.d.ts +1 -4
- package/dist/queries/by-kind.js +1 -10
- package/dist/queries/call-graph.d.ts +1 -1
- package/dist/queries/call-graph.js +1 -8
- package/dist/queries/change-surface.d.ts +1 -1
- package/dist/queries/change-surface.js +1 -8
- package/dist/queries/code.d.ts +1 -1
- package/dist/queries/code.js +1 -8
- package/dist/queries/complexity-hotspots.d.ts +5 -10
- package/dist/queries/complexity-hotspots.js +1 -8
- package/dist/queries/complexity.d.ts +1 -1
- package/dist/queries/complexity.js +1 -8
- package/dist/queries/convergence.d.ts +1 -1
- package/dist/queries/convergence.js +1 -8
- package/dist/queries/coupling.d.ts +1 -1
- package/dist/queries/coupling.js +1 -10
- package/dist/queries/cycles.d.ts +1 -1
- package/dist/queries/cycles.js +1 -8
- package/dist/queries/dataflow.d.ts +1 -1
- package/dist/queries/dataflow.js +1 -8
- package/dist/queries/dead.d.ts +1 -1
- package/dist/queries/dead.js +1 -9
- package/dist/queries/deep-chains.d.ts +9 -1
- package/dist/queries/deep-chains.js +1 -8
- package/dist/queries/deps.d.ts +1 -1
- package/dist/queries/deps.js +1 -10
- package/dist/queries/diff-impact.d.ts +1 -1
- package/dist/queries/diff-impact.js +1 -7
- package/dist/queries/drift.d.ts +1 -1
- package/dist/queries/drift.js +1 -8
- package/dist/queries/extract-candidates.d.ts +1 -1
- package/dist/queries/extract-candidates.js +1 -8
- package/dist/queries/fan.d.ts +1 -1
- package/dist/queries/fan.js +1 -14
- package/dist/queries/files.d.ts +1 -1
- package/dist/queries/files.js +1 -6
- package/dist/queries/health.d.ts +1 -1
- package/dist/queries/health.js +1 -20
- package/dist/queries/hierarchy.d.ts +1 -1
- package/dist/queries/hierarchy.js +1 -8
- package/dist/queries/hotspots.d.ts +1 -1
- package/dist/queries/hotspots.js +1 -8
- package/dist/queries/imports.d.ts +1 -1
- package/dist/queries/imports.js +1 -12
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -197
- package/dist/queries/isolated.d.ts +1 -1
- package/dist/queries/isolated.js +1 -9
- package/dist/queries/members.d.ts +1 -1
- package/dist/queries/members.js +1 -8
- package/dist/queries/methods.d.ts +1 -1
- package/dist/queries/methods.js +1 -8
- package/dist/queries/outline.d.ts +1 -1
- package/dist/queries/outline.js +1 -8
- package/dist/queries/passthrough-candidates.d.ts +1 -1
- package/dist/queries/passthrough-candidates.js +1 -8
- package/dist/queries/redundant-reexports.d.ts +1 -1
- package/dist/queries/redundant-reexports.js +1 -9
- package/dist/queries/refs.d.ts +1 -1
- package/dist/queries/refs.js +1 -8
- package/dist/queries/similar-chains.d.ts +1 -1
- package/dist/queries/similar-chains.js +1 -8
- package/dist/queries/similar-files.d.ts +1 -1
- package/dist/queries/similar-files.js +1 -8
- package/dist/queries/similar-signatures.d.ts +1 -1
- package/dist/queries/similar-signatures.js +1 -8
- package/dist/queries/similar.d.ts +1 -1
- package/dist/queries/similar.js +1 -10
- package/dist/queries/slice.d.ts +1 -1
- package/dist/queries/slice.js +1 -8
- package/dist/queries/stale-abstractions.d.ts +15 -5
- package/dist/queries/stale-abstractions.js +1 -8
- package/dist/queries/stats.d.ts +1 -1
- package/dist/queries/stats.js +1 -6
- package/dist/queries/surface.d.ts +1 -1
- package/dist/queries/surface.js +1 -8
- package/dist/queries/symbols.d.ts +1 -1
- package/dist/queries/symbols.js +1 -9
- package/dist/queries/system.d.ts +1 -1
- package/dist/queries/system.js +1 -9
- package/dist/queries/trace.d.ts +1 -1
- package/dist/queries/trace.js +1 -9
- package/dist/queries/wrapper-candidates.d.ts +1 -1
- package/dist/queries/wrapper-candidates.js +1 -8
- package/dist/reindex-worker.js +7 -672
- package/package.json +20 -2
- package/skills/concrete-plan/SKILL.md +3 -3
- package/skills/scip-debloat/SKILL.md +3 -6
- package/skills/scip-language-playbook/SKILL.md +2 -0
- package/dist/chunk-2MQ5DPY6.js +0 -61
- package/dist/chunk-2QTYIOJ5.js +0 -165
- package/dist/chunk-3VI4YXCL.js +0 -172
- package/dist/chunk-3VV2G6U7.js +0 -34
- package/dist/chunk-44PFXVXG.js +0 -76
- package/dist/chunk-6SLFQR36.js +0 -64
- package/dist/chunk-74RFWB5T.js +0 -24
- package/dist/chunk-7DBPRGMS.js +0 -221
- package/dist/chunk-DTB724R3.js +0 -110
- package/dist/chunk-FLOYI6I4.js +0 -185
- package/dist/chunk-FO2CBB7U.js +0 -23
- package/dist/chunk-GJT3MO2T.js +0 -17
- package/dist/chunk-HAP4LJKX.js +0 -66
- package/dist/chunk-JCOJQ4I6.js +0 -93
- package/dist/chunk-JGQMOS4V.js +0 -59
- package/dist/chunk-JMD4WJ2Q.js +0 -213
- package/dist/chunk-JSQPZOPO.js +0 -64
- package/dist/chunk-JSXGC2EH.js +0 -151
- package/dist/chunk-JZN3DRCT.js +0 -59
- package/dist/chunk-KMWYB3CX.js +0 -71
- package/dist/chunk-MRM755FU.js +0 -37
- package/dist/chunk-N2XO3Z5F.js +0 -69
- package/dist/chunk-OLW5UL36.js +0 -76
- package/dist/chunk-OMCRXXDX.js +0 -2600
- package/dist/chunk-OWJOHUZE.js +0 -44
- package/dist/chunk-P3VCDYMJ.js +0 -269
- package/dist/chunk-PEDH3D4G.js +0 -53
- package/dist/chunk-POAN4SCR.js +0 -46
- package/dist/chunk-PTMGEBU3.js +0 -101
- package/dist/chunk-PU44HK7P.js +0 -87
- package/dist/chunk-QJI7EECA.js +0 -327
- package/dist/chunk-R5HICGMB.js +0 -110
- package/dist/chunk-RJ2D6YWQ.js +0 -49
- package/dist/chunk-RZ5GYPBP.js +0 -79
- package/dist/chunk-SRLQNO6O.js +0 -101
- package/dist/chunk-UGS7HJI4.js +0 -84
- package/dist/chunk-VKUUXOE7.js +0 -105
- package/dist/chunk-VPUJSJCI.js +0 -84
- package/dist/chunk-VRWVV3EP.js +0 -72
- package/dist/chunk-WJWQEU4A.js +0 -162
- package/dist/chunk-WJZHDUSB.js +0 -40
- package/dist/chunk-WWOCQ5W4.js +0 -34
- package/dist/chunk-X3Q2OVRL.js +0 -77
- package/dist/chunk-Y3P7QKKN.js +0 -27
- package/dist/chunk-Y6FAHY4N.js +0 -81
- package/dist/chunk-YMSJCSRG.js +0 -213
- package/dist/chunk-ZDL3U4W2.js +0 -124
- package/dist/chunk-ZXNX5JRE.js +0 -216
- package/dist/queries/clean-signature.d.ts +0 -17
- package/dist/queries/clean-signature.js +0 -9
package/dist/chunk-Y6FAHY4N.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
findFirstSymbolMatch,
|
|
3
|
-
resolveIndexedFile
|
|
4
|
-
} from "./chunk-OMCRXXDX.js";
|
|
5
|
-
import {
|
|
6
|
-
shortenSymbol
|
|
7
|
-
} from "./chunk-YMSJCSRG.js";
|
|
8
|
-
|
|
9
|
-
// src/queries/code.ts
|
|
10
|
-
import { readFileSync } from "fs";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
function code(db, symbolPattern, opts = {}) {
|
|
13
|
-
const { context = 0 } = opts;
|
|
14
|
-
const fileLineMatch = symbolPattern.match(/^(.+\.\w+):(\d+)-(\d+)$/);
|
|
15
|
-
if (fileLineMatch) {
|
|
16
|
-
return readFileRange(db, fileLineMatch[1], parseInt(fileLineMatch[2], 10), parseInt(fileLineMatch[3], 10), context);
|
|
17
|
-
}
|
|
18
|
-
const match = findFirstSymbolMatch(db, symbolPattern);
|
|
19
|
-
if (!match) return null;
|
|
20
|
-
const doc = db.get(
|
|
21
|
-
`SELECT language FROM documents WHERE relative_path = ?`,
|
|
22
|
-
match.relativePath
|
|
23
|
-
);
|
|
24
|
-
const filePath = join(db.config.projectRoot, match.relativePath);
|
|
25
|
-
let fileContent;
|
|
26
|
-
try {
|
|
27
|
-
fileContent = readFileSync(filePath, "utf-8");
|
|
28
|
-
} catch {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const lines = fileContent.split("\n");
|
|
32
|
-
const startLine = Math.max(0, match.startLine - context);
|
|
33
|
-
const endLine = Math.min(lines.length - 1, match.endLine + context);
|
|
34
|
-
const source = lines.slice(startLine, endLine + 1).join("\n");
|
|
35
|
-
return {
|
|
36
|
-
symbol: match.symbol,
|
|
37
|
-
shortName: shortenSymbol(match.symbol),
|
|
38
|
-
relativePath: match.relativePath,
|
|
39
|
-
// 0-indexed, like every other query result. The CLI's displayLine()
|
|
40
|
-
// converts once at render time. Returning 1-indexed here caused a
|
|
41
|
-
// double-conversion in the CLI and printed labels off by +1.
|
|
42
|
-
startLine,
|
|
43
|
-
endLine,
|
|
44
|
-
language: doc?.language ?? null,
|
|
45
|
-
source
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
function readFileRange(db, filePath, startLine, endLine, context) {
|
|
49
|
-
const resolvedPath = resolveIndexedFile(db, filePath);
|
|
50
|
-
if (!resolvedPath) return null;
|
|
51
|
-
const doc = db.get(
|
|
52
|
-
`SELECT relative_path, language FROM documents WHERE relative_path = ?`,
|
|
53
|
-
resolvedPath
|
|
54
|
-
);
|
|
55
|
-
if (!doc) return null;
|
|
56
|
-
const fullPath = join(db.config.projectRoot, doc.relative_path);
|
|
57
|
-
let fileContent;
|
|
58
|
-
try {
|
|
59
|
-
fileContent = readFileSync(fullPath, "utf-8");
|
|
60
|
-
} catch {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
const lines = fileContent.split("\n");
|
|
64
|
-
const start = Math.max(0, startLine - 1 - context);
|
|
65
|
-
const end = Math.min(lines.length - 1, endLine - 1 + context);
|
|
66
|
-
const source = lines.slice(start, end + 1).join("\n");
|
|
67
|
-
return {
|
|
68
|
-
symbol: `${doc.relative_path}:${startLine}-${endLine}`,
|
|
69
|
-
shortName: `${doc.relative_path}:${startLine}-${endLine}`,
|
|
70
|
-
relativePath: doc.relative_path,
|
|
71
|
-
startLine: start,
|
|
72
|
-
endLine: end,
|
|
73
|
-
language: doc.language,
|
|
74
|
-
source
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
code
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=chunk-Y6FAHY4N.js.map
|
package/dist/chunk-YMSJCSRG.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// src/symbol-parser.ts
|
|
2
|
-
var SUFFIX_MAP = {
|
|
3
|
-
"/": "namespace",
|
|
4
|
-
"#": "type",
|
|
5
|
-
".": "term",
|
|
6
|
-
"[": "type-param",
|
|
7
|
-
":": "meta",
|
|
8
|
-
"!": "macro"
|
|
9
|
-
};
|
|
10
|
-
function parseSymbol(raw) {
|
|
11
|
-
if (raw.startsWith("local ")) {
|
|
12
|
-
return { kind: "local", id: raw.slice(6), raw };
|
|
13
|
-
}
|
|
14
|
-
const parts = raw.split(" ");
|
|
15
|
-
if (parts.length < 4) {
|
|
16
|
-
return {
|
|
17
|
-
scheme: parts[0] ?? "",
|
|
18
|
-
manager: parts[1] ?? "",
|
|
19
|
-
packageName: parts[2] ?? "",
|
|
20
|
-
version: "",
|
|
21
|
-
descriptors: [],
|
|
22
|
-
raw
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const scheme = parts[0];
|
|
26
|
-
const manager = parts[1];
|
|
27
|
-
let restAfterManager = raw.slice(scheme.length + 1 + manager.length + 1);
|
|
28
|
-
let packageName;
|
|
29
|
-
if (restAfterManager.startsWith("`")) {
|
|
30
|
-
const closingTick = restAfterManager.indexOf("`", 1);
|
|
31
|
-
if (closingTick === -1) {
|
|
32
|
-
packageName = restAfterManager.slice(1);
|
|
33
|
-
restAfterManager = "";
|
|
34
|
-
} else {
|
|
35
|
-
packageName = restAfterManager.slice(1, closingTick);
|
|
36
|
-
restAfterManager = restAfterManager.slice(closingTick + 2);
|
|
37
|
-
}
|
|
38
|
-
} else {
|
|
39
|
-
const spaceIdx = restAfterManager.indexOf(" ");
|
|
40
|
-
if (spaceIdx === -1) {
|
|
41
|
-
packageName = restAfterManager;
|
|
42
|
-
restAfterManager = "";
|
|
43
|
-
} else {
|
|
44
|
-
packageName = restAfterManager.slice(0, spaceIdx);
|
|
45
|
-
restAfterManager = restAfterManager.slice(spaceIdx + 1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
let version;
|
|
49
|
-
const versionSpaceIdx = restAfterManager.indexOf(" ");
|
|
50
|
-
if (versionSpaceIdx === -1) {
|
|
51
|
-
version = restAfterManager;
|
|
52
|
-
restAfterManager = "";
|
|
53
|
-
} else {
|
|
54
|
-
version = restAfterManager.slice(0, versionSpaceIdx);
|
|
55
|
-
restAfterManager = restAfterManager.slice(versionSpaceIdx + 1);
|
|
56
|
-
}
|
|
57
|
-
const descriptors = parseDescriptors(restAfterManager);
|
|
58
|
-
return { scheme, manager, packageName, version, descriptors, raw };
|
|
59
|
-
}
|
|
60
|
-
function parseDescriptors(input) {
|
|
61
|
-
const descriptors = [];
|
|
62
|
-
let i = 0;
|
|
63
|
-
while (i < input.length) {
|
|
64
|
-
if (input[i] === "[") {
|
|
65
|
-
const closeBracket = input.indexOf("]", i + 1);
|
|
66
|
-
if (closeBracket === -1) {
|
|
67
|
-
descriptors.push({ name: input.slice(i + 1), suffix: "type-param" });
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
descriptors.push({ name: input.slice(i + 1, closeBracket), suffix: "type-param" });
|
|
71
|
-
i = closeBracket + 1;
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (input[i] === "(" && (descriptors.length === 0 || i === 0 || isSuffixChar(input[i - 1]))) {
|
|
75
|
-
const closeParen = input.indexOf(")", i + 1);
|
|
76
|
-
if (closeParen !== -1 && input[closeParen + 1] !== ".") {
|
|
77
|
-
descriptors.push({ name: input.slice(i + 1, closeParen), suffix: "parameter" });
|
|
78
|
-
i = closeParen + 1;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
let name;
|
|
83
|
-
if (input[i] === "`") {
|
|
84
|
-
const closingTick = input.indexOf("`", i + 1);
|
|
85
|
-
if (closingTick === -1) {
|
|
86
|
-
name = input.slice(i + 1);
|
|
87
|
-
descriptors.push({ name, suffix: "term" });
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
name = input.slice(i + 1, closingTick);
|
|
91
|
-
i = closingTick + 1;
|
|
92
|
-
} else {
|
|
93
|
-
const start = i;
|
|
94
|
-
while (i < input.length && !isSuffixChar(input[i])) {
|
|
95
|
-
i++;
|
|
96
|
-
}
|
|
97
|
-
name = input.slice(start, i);
|
|
98
|
-
}
|
|
99
|
-
if (i >= input.length) {
|
|
100
|
-
if (name) descriptors.push({ name, suffix: "term" });
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
const char = input[i];
|
|
104
|
-
if (char === "(") {
|
|
105
|
-
const closeParen = input.indexOf(")", i + 1);
|
|
106
|
-
if (closeParen !== -1 && input[closeParen + 1] === ".") {
|
|
107
|
-
descriptors.push({ name, suffix: "method" });
|
|
108
|
-
i = closeParen + 2;
|
|
109
|
-
} else if (closeParen !== -1) {
|
|
110
|
-
descriptors.push({ name, suffix: "method" });
|
|
111
|
-
i = closeParen + 1;
|
|
112
|
-
} else {
|
|
113
|
-
descriptors.push({ name, suffix: "term" });
|
|
114
|
-
i++;
|
|
115
|
-
}
|
|
116
|
-
} else {
|
|
117
|
-
const suffix = SUFFIX_MAP[char];
|
|
118
|
-
if (suffix) {
|
|
119
|
-
descriptors.push({ name, suffix });
|
|
120
|
-
i += 1;
|
|
121
|
-
} else {
|
|
122
|
-
i += 1;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return descriptors;
|
|
127
|
-
}
|
|
128
|
-
function isSuffixChar(c) {
|
|
129
|
-
return c === "/" || c === "#" || c === "." || c === "(" || c === "[" || c === ":" || c === "!";
|
|
130
|
-
}
|
|
131
|
-
function shortenSymbol(raw) {
|
|
132
|
-
const parsed = parseSymbol(raw);
|
|
133
|
-
if ("kind" in parsed && parsed.kind === "local") {
|
|
134
|
-
return `local:${parsed.id}`;
|
|
135
|
-
}
|
|
136
|
-
const sym = parsed;
|
|
137
|
-
if (sym.descriptors.length === 0) return sym.raw;
|
|
138
|
-
const parts = [];
|
|
139
|
-
for (const desc of sym.descriptors) {
|
|
140
|
-
let name = desc.name;
|
|
141
|
-
if (desc.suffix === "namespace") {
|
|
142
|
-
name = name.replace(/\.(ts|tsx|js|jsx|mjs|cjs)$/, "").replace(/\.(py|pyi)$/, "").replace(/\.(rs)$/, "").replace(/\.(java|scala|kt|kts)$/, "").replace(/\.(rb)$/, "").replace(/\.(go)$/, "").replace(/\.(cs|vb)$/, "").replace(/\.(dart)$/, "").replace(/\.(php)$/, "").replace(/\.(c|cc|cpp|cxx|h|hpp)$/, "");
|
|
143
|
-
}
|
|
144
|
-
if (!name) continue;
|
|
145
|
-
if (desc.suffix === "method") {
|
|
146
|
-
parts.push(`${name}()`);
|
|
147
|
-
} else {
|
|
148
|
-
parts.push(name);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return parts.join(":");
|
|
152
|
-
}
|
|
153
|
-
function leafName(raw) {
|
|
154
|
-
const parsed = parseSymbol(raw);
|
|
155
|
-
if ("kind" in parsed && parsed.kind === "local") {
|
|
156
|
-
return parsed.id;
|
|
157
|
-
}
|
|
158
|
-
const sym = parsed;
|
|
159
|
-
if (sym.descriptors.length === 0) return "";
|
|
160
|
-
const last = sym.descriptors[sym.descriptors.length - 1];
|
|
161
|
-
return last.name;
|
|
162
|
-
}
|
|
163
|
-
function leafSuffix(raw) {
|
|
164
|
-
const parsed = parseSymbol(raw);
|
|
165
|
-
if ("kind" in parsed && parsed.kind === "local") {
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
const sym = parsed;
|
|
169
|
-
const last = sym.descriptors[sym.descriptors.length - 1];
|
|
170
|
-
return last?.suffix ?? null;
|
|
171
|
-
}
|
|
172
|
-
function isCallableSymbol(raw) {
|
|
173
|
-
return raw.endsWith("().") || leafSuffix(raw) === "method";
|
|
174
|
-
}
|
|
175
|
-
function isFunctionLikeSymbol(raw) {
|
|
176
|
-
const suffix = leafSuffix(raw);
|
|
177
|
-
return suffix === "method" || suffix === "term";
|
|
178
|
-
}
|
|
179
|
-
function isModuleLikeSymbol(raw) {
|
|
180
|
-
return leafSuffix(raw) === "namespace";
|
|
181
|
-
}
|
|
182
|
-
function isDirectChildSymbol(parentRaw, candidateRaw) {
|
|
183
|
-
const parent = parseSymbol(parentRaw);
|
|
184
|
-
const candidate = parseSymbol(candidateRaw);
|
|
185
|
-
if ("kind" in parent || "kind" in candidate) {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
const parentDescriptors = parent.descriptors;
|
|
189
|
-
const candidateDescriptors = candidate.descriptors;
|
|
190
|
-
if (candidateDescriptors.length !== parentDescriptors.length + 1) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
for (let i = 0; i < parentDescriptors.length; i++) {
|
|
194
|
-
const parentDesc = parentDescriptors[i];
|
|
195
|
-
const candidateDesc = candidateDescriptors[i];
|
|
196
|
-
if (parentDesc.name !== candidateDesc.name || parentDesc.suffix !== candidateDesc.suffix) {
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return true;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export {
|
|
204
|
-
parseSymbol,
|
|
205
|
-
shortenSymbol,
|
|
206
|
-
leafName,
|
|
207
|
-
leafSuffix,
|
|
208
|
-
isCallableSymbol,
|
|
209
|
-
isFunctionLikeSymbol,
|
|
210
|
-
isModuleLikeSymbol,
|
|
211
|
-
isDirectChildSymbol
|
|
212
|
-
};
|
|
213
|
-
//# sourceMappingURL=chunk-YMSJCSRG.js.map
|
package/dist/chunk-ZDL3U4W2.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildFileDepGraph,
|
|
3
|
-
findFirstSymbolMatch,
|
|
4
|
-
resolveIndexedFile
|
|
5
|
-
} from "./chunk-OMCRXXDX.js";
|
|
6
|
-
import {
|
|
7
|
-
shortenSymbol
|
|
8
|
-
} from "./chunk-YMSJCSRG.js";
|
|
9
|
-
|
|
10
|
-
// src/queries/fan.ts
|
|
11
|
-
function fanIn(db, symbolPattern) {
|
|
12
|
-
const match = findFirstSymbolMatch(db, symbolPattern);
|
|
13
|
-
if (!match) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const row = db.get(
|
|
17
|
-
`SELECT COUNT(DISTINCT c.document_id) AS file_count
|
|
18
|
-
FROM mentions m
|
|
19
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
20
|
-
WHERE m.symbol_id = ?
|
|
21
|
-
AND m.role != 1`,
|
|
22
|
-
match.symbolId
|
|
23
|
-
);
|
|
24
|
-
return [{
|
|
25
|
-
name: shortenSymbol(match.symbol),
|
|
26
|
-
count: row?.file_count ?? 0
|
|
27
|
-
}];
|
|
28
|
-
}
|
|
29
|
-
function fanOut(db, filePattern) {
|
|
30
|
-
const resolvedFile = resolveIndexedFile(db, filePattern);
|
|
31
|
-
if (!resolvedFile) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
const rows = db.all(
|
|
35
|
-
`SELECT d.relative_path, COUNT(DISTINCT gs.id) AS symbol_count
|
|
36
|
-
FROM mentions m
|
|
37
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
38
|
-
JOIN documents d ON c.document_id = d.id
|
|
39
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
40
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
41
|
-
JOIN documents def_d ON der.document_id = def_d.id
|
|
42
|
-
WHERE d.relative_path = ?
|
|
43
|
-
AND m.role != 1
|
|
44
|
-
AND def_d.id != d.id
|
|
45
|
-
GROUP BY d.id
|
|
46
|
-
ORDER BY symbol_count DESC`,
|
|
47
|
-
resolvedFile
|
|
48
|
-
);
|
|
49
|
-
const indexedResults = rows.filter((r) => !db.isIgnored(r.relative_path)).map((r) => ({
|
|
50
|
-
name: r.relative_path,
|
|
51
|
-
count: r.symbol_count
|
|
52
|
-
}));
|
|
53
|
-
if (indexedResults.length > 0) {
|
|
54
|
-
return indexedResults;
|
|
55
|
-
}
|
|
56
|
-
const graph = buildFileDepGraph(db);
|
|
57
|
-
const deps = graph.get(resolvedFile);
|
|
58
|
-
if (!deps || deps.size === 0) {
|
|
59
|
-
return [];
|
|
60
|
-
}
|
|
61
|
-
return [{
|
|
62
|
-
name: resolvedFile,
|
|
63
|
-
count: deps.size
|
|
64
|
-
}];
|
|
65
|
-
}
|
|
66
|
-
function topFanIn(db, opts = {}) {
|
|
67
|
-
const { limit = 30, scope } = opts;
|
|
68
|
-
const scopeFilter = scope ? `AND def_d.relative_path LIKE '%${scope}%'` : "";
|
|
69
|
-
const rows = db.all(
|
|
70
|
-
`SELECT gs.symbol, COUNT(DISTINCT c.document_id) AS file_count
|
|
71
|
-
FROM mentions m
|
|
72
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
73
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
74
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
75
|
-
JOIN documents def_d ON der.document_id = def_d.id
|
|
76
|
-
WHERE m.role != 1
|
|
77
|
-
${db.pathExclusionsFor("def_d")}
|
|
78
|
-
${db.symbolNoiseFor("gs")}
|
|
79
|
-
${scopeFilter}
|
|
80
|
-
GROUP BY gs.id
|
|
81
|
-
HAVING file_count > 1
|
|
82
|
-
ORDER BY file_count DESC
|
|
83
|
-
LIMIT ?`,
|
|
84
|
-
limit
|
|
85
|
-
);
|
|
86
|
-
return rows.map((r) => ({
|
|
87
|
-
name: shortenSymbol(r.symbol),
|
|
88
|
-
count: r.file_count
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
function topFanOut(db, opts = {}) {
|
|
92
|
-
const { limit = 30, scope } = opts;
|
|
93
|
-
const scopeFilter = scope ? `AND d.relative_path LIKE '%${scope}%'` : "";
|
|
94
|
-
const rows = db.all(
|
|
95
|
-
`SELECT d.relative_path, COUNT(DISTINCT gs.id) AS symbol_count
|
|
96
|
-
FROM mentions m
|
|
97
|
-
JOIN chunks c ON m.chunk_id = c.id
|
|
98
|
-
JOIN documents d ON c.document_id = d.id
|
|
99
|
-
JOIN global_symbols gs ON m.symbol_id = gs.id
|
|
100
|
-
JOIN defn_enclosing_ranges der ON gs.id = der.symbol_id
|
|
101
|
-
JOIN documents def_d ON der.document_id = def_d.id
|
|
102
|
-
WHERE m.role != 1
|
|
103
|
-
AND def_d.id != d.id
|
|
104
|
-
${db.pathExclusionsFor("d")}
|
|
105
|
-
${db.symbolNoiseFor("gs")}
|
|
106
|
-
${scopeFilter}
|
|
107
|
-
GROUP BY d.id
|
|
108
|
-
ORDER BY symbol_count DESC
|
|
109
|
-
LIMIT ?`,
|
|
110
|
-
limit
|
|
111
|
-
);
|
|
112
|
-
return rows.filter((r) => !db.isIgnored(r.relative_path)).map((r) => ({
|
|
113
|
-
name: r.relative_path,
|
|
114
|
-
count: r.symbol_count
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export {
|
|
119
|
-
fanIn,
|
|
120
|
-
fanOut,
|
|
121
|
-
topFanIn,
|
|
122
|
-
topFanOut
|
|
123
|
-
};
|
|
124
|
-
//# sourceMappingURL=chunk-ZDL3U4W2.js.map
|
package/dist/chunk-ZXNX5JRE.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getAllDefinitions
|
|
3
|
-
} from "./chunk-OMCRXXDX.js";
|
|
4
|
-
import {
|
|
5
|
-
leafSuffix,
|
|
6
|
-
parseSymbol,
|
|
7
|
-
shortenSymbol
|
|
8
|
-
} from "./chunk-YMSJCSRG.js";
|
|
9
|
-
|
|
10
|
-
// src/queries/by-kind.ts
|
|
11
|
-
var KIND_NAMES = {
|
|
12
|
-
0: "UnspecifiedKind",
|
|
13
|
-
1: "AbstractMethod",
|
|
14
|
-
2: "Accessor",
|
|
15
|
-
3: "Array",
|
|
16
|
-
4: "Assertion",
|
|
17
|
-
5: "AssociatedType",
|
|
18
|
-
6: "Attribute",
|
|
19
|
-
7: "Axiom",
|
|
20
|
-
8: "Boolean",
|
|
21
|
-
9: "Class",
|
|
22
|
-
10: "Constant",
|
|
23
|
-
11: "Constructor",
|
|
24
|
-
12: "Contract",
|
|
25
|
-
13: "DataFamily",
|
|
26
|
-
14: "DefinitionMacro",
|
|
27
|
-
15: "Delegate",
|
|
28
|
-
16: "Enum",
|
|
29
|
-
17: "EnumMember",
|
|
30
|
-
18: "Error",
|
|
31
|
-
19: "Event",
|
|
32
|
-
20: "Fact",
|
|
33
|
-
21: "Field",
|
|
34
|
-
22: "File",
|
|
35
|
-
23: "Function",
|
|
36
|
-
24: "Getter",
|
|
37
|
-
25: "Grammar",
|
|
38
|
-
26: "Instance",
|
|
39
|
-
27: "Interface",
|
|
40
|
-
28: "Key",
|
|
41
|
-
29: "Lang",
|
|
42
|
-
30: "Lemma",
|
|
43
|
-
31: "Library",
|
|
44
|
-
32: "Macro",
|
|
45
|
-
33: "Method",
|
|
46
|
-
34: "MethodAlias",
|
|
47
|
-
35: "MethodReceiver",
|
|
48
|
-
36: "MethodSpecification",
|
|
49
|
-
37: "Message",
|
|
50
|
-
38: "Modifier",
|
|
51
|
-
39: "Module",
|
|
52
|
-
40: "Namespace",
|
|
53
|
-
41: "Null",
|
|
54
|
-
42: "Number",
|
|
55
|
-
43: "Object",
|
|
56
|
-
44: "Operator",
|
|
57
|
-
45: "Package",
|
|
58
|
-
46: "PackageObject",
|
|
59
|
-
47: "Parameter",
|
|
60
|
-
48: "ParameterLabel",
|
|
61
|
-
49: "Pattern",
|
|
62
|
-
50: "Predicate",
|
|
63
|
-
51: "Property",
|
|
64
|
-
52: "Protocol",
|
|
65
|
-
53: "ProtocolMethod",
|
|
66
|
-
54: "PureVirtualMethod",
|
|
67
|
-
55: "Quasiquoter",
|
|
68
|
-
56: "SelfParameter",
|
|
69
|
-
57: "Setter",
|
|
70
|
-
58: "Signature",
|
|
71
|
-
59: "SingletonClass",
|
|
72
|
-
60: "SingletonMethod",
|
|
73
|
-
61: "StaticDataMember",
|
|
74
|
-
62: "StaticEvent",
|
|
75
|
-
63: "StaticField",
|
|
76
|
-
64: "StaticMethod",
|
|
77
|
-
65: "StaticProperty",
|
|
78
|
-
66: "StaticVariable",
|
|
79
|
-
67: "String",
|
|
80
|
-
68: "Struct",
|
|
81
|
-
69: "Subscript",
|
|
82
|
-
70: "Tactic",
|
|
83
|
-
71: "Theorem",
|
|
84
|
-
72: "ThisParameter",
|
|
85
|
-
73: "Trait",
|
|
86
|
-
74: "TraitMethod",
|
|
87
|
-
75: "Type",
|
|
88
|
-
76: "TypeAlias",
|
|
89
|
-
77: "TypeClass",
|
|
90
|
-
78: "TypeClassMethod",
|
|
91
|
-
79: "TypeFamily",
|
|
92
|
-
80: "TypeParameter",
|
|
93
|
-
81: "Union",
|
|
94
|
-
82: "Value",
|
|
95
|
-
83: "Variable"
|
|
96
|
-
};
|
|
97
|
-
var KIND_BY_NAME = /* @__PURE__ */ new Map();
|
|
98
|
-
for (const [k, v] of Object.entries(KIND_NAMES)) {
|
|
99
|
-
KIND_BY_NAME.set(v.toLowerCase(), Number(k));
|
|
100
|
-
}
|
|
101
|
-
function byKind(db, kindQuery, opts = {}) {
|
|
102
|
-
const { scope, limit = 100 } = opts;
|
|
103
|
-
let kindNum = null;
|
|
104
|
-
const asNum = parseInt(kindQuery, 10);
|
|
105
|
-
if (!isNaN(asNum)) {
|
|
106
|
-
kindNum = asNum;
|
|
107
|
-
} else {
|
|
108
|
-
kindNum = KIND_BY_NAME.get(kindQuery.toLowerCase()) ?? null;
|
|
109
|
-
if (kindNum === null) {
|
|
110
|
-
for (const [name, num] of KIND_BY_NAME) {
|
|
111
|
-
if (name.includes(kindQuery.toLowerCase())) {
|
|
112
|
-
kindNum = num;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (kindNum === null) {
|
|
119
|
-
return [];
|
|
120
|
-
}
|
|
121
|
-
const rows = loadKindRows(db, scope).map((row) => ({
|
|
122
|
-
row,
|
|
123
|
-
resolvedKind: resolveKindNumber(row)
|
|
124
|
-
})).filter((entry) => entry.resolvedKind === kindNum).slice(0, limit);
|
|
125
|
-
return rows.map(({ row, resolvedKind }) => ({
|
|
126
|
-
symbol: row.symbol,
|
|
127
|
-
shortName: shortenSymbol(row.symbol),
|
|
128
|
-
kind: resolvedKind,
|
|
129
|
-
kindName: KIND_NAMES[resolvedKind] ?? "Unknown",
|
|
130
|
-
relativePath: row.relative_path,
|
|
131
|
-
startLine: row.start_line,
|
|
132
|
-
endLine: row.end_line
|
|
133
|
-
}));
|
|
134
|
-
}
|
|
135
|
-
function kindCounts(db, opts = {}) {
|
|
136
|
-
const counts = /* @__PURE__ */ new Map();
|
|
137
|
-
for (const row of loadKindRows(db, opts.scope)) {
|
|
138
|
-
const kind = resolveKindNumber(row);
|
|
139
|
-
if (kind === null || kind === 0) continue;
|
|
140
|
-
counts.set(kind, (counts.get(kind) ?? 0) + 1);
|
|
141
|
-
}
|
|
142
|
-
return [...counts.entries()].sort((a, b) => b[1] - a[1] || a[0] - b[0]).map(([kind, count]) => ({
|
|
143
|
-
kind,
|
|
144
|
-
kindName: KIND_NAMES[kind] ?? "Unknown",
|
|
145
|
-
count
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
function loadKindRows(db, scope) {
|
|
149
|
-
return getAllDefinitions(db, { scope }).map(mapDefinitionToKindRow);
|
|
150
|
-
}
|
|
151
|
-
function mapDefinitionToKindRow(definition) {
|
|
152
|
-
return {
|
|
153
|
-
symbol: definition.symbol,
|
|
154
|
-
kind: definition.kind,
|
|
155
|
-
documentation: definition.documentation,
|
|
156
|
-
enclosing_symbol: definition.enclosingSymbol,
|
|
157
|
-
relative_path: definition.relativePath,
|
|
158
|
-
start_line: definition.startLine,
|
|
159
|
-
end_line: definition.endLine
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
function resolveKindNumber(row) {
|
|
163
|
-
if (row.kind !== null && row.kind !== 0) {
|
|
164
|
-
return normalizeIndexedKind(row.kind, row.symbol, row.documentation);
|
|
165
|
-
}
|
|
166
|
-
return inferKindNumber(row.symbol, row.documentation, row.enclosing_symbol);
|
|
167
|
-
}
|
|
168
|
-
function normalizeIndexedKind(kind, symbol, documentation) {
|
|
169
|
-
const signature = (documentation ?? "").toLowerCase();
|
|
170
|
-
const suffix = leafSuffix(symbol);
|
|
171
|
-
if (suffix === "type") {
|
|
172
|
-
if (signature.includes("type ")) return 76;
|
|
173
|
-
if (signature.includes("interface ")) return 27;
|
|
174
|
-
if (signature.includes("struct ")) return 68;
|
|
175
|
-
if (signature.includes("trait ")) return 73;
|
|
176
|
-
if (signature.includes("class ")) return 9;
|
|
177
|
-
}
|
|
178
|
-
return kind;
|
|
179
|
-
}
|
|
180
|
-
function inferKindNumber(symbol, documentation, enclosingSymbol) {
|
|
181
|
-
const parsed = parseSymbol(symbol);
|
|
182
|
-
if ("kind" in parsed) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
const descriptors = parsed.descriptors;
|
|
186
|
-
const parent = descriptors[descriptors.length - 2] ?? null;
|
|
187
|
-
const suffix = leafSuffix(symbol);
|
|
188
|
-
const signature = (documentation ?? "").toLowerCase();
|
|
189
|
-
if (suffix === "type") {
|
|
190
|
-
if (signature.includes("type ")) return 76;
|
|
191
|
-
if (signature.includes("interface ")) return 27;
|
|
192
|
-
if (signature.includes("struct ")) return 68;
|
|
193
|
-
if (signature.includes("trait ")) return 73;
|
|
194
|
-
if (signature.includes("class ")) return 9;
|
|
195
|
-
return 9;
|
|
196
|
-
}
|
|
197
|
-
if (suffix === "method") {
|
|
198
|
-
return parent?.suffix === "type" ? 33 : 23;
|
|
199
|
-
}
|
|
200
|
-
if (suffix === "namespace") return 39;
|
|
201
|
-
if (suffix !== "term") return null;
|
|
202
|
-
if (signature.includes("async def ") || signature.includes("def ")) {
|
|
203
|
-
return 23;
|
|
204
|
-
}
|
|
205
|
-
const enclosingSuffix = enclosingSymbol ? leafSuffix(enclosingSymbol) : parent?.suffix ?? null;
|
|
206
|
-
if (enclosingSuffix === "type") {
|
|
207
|
-
return 21;
|
|
208
|
-
}
|
|
209
|
-
return 83;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export {
|
|
213
|
-
byKind,
|
|
214
|
-
kindCounts
|
|
215
|
-
};
|
|
216
|
-
//# sourceMappingURL=chunk-ZXNX5JRE.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Clean up the raw doc/signature string from the SCIP index.
|
|
3
|
-
*
|
|
4
|
-
* Shared across symbols, trace, and system queries.
|
|
5
|
-
* Previously duplicated as cleanSig/cleanSignature in three files.
|
|
6
|
-
*/
|
|
7
|
-
declare function cleanSignature(sig: string | null): string | null;
|
|
8
|
-
/**
|
|
9
|
-
* SCIP indexers store `documentation` as "docstring|signature" (pipe-delimited).
|
|
10
|
-
* `extractSignature` pulls the signature half; newlines are flattened to spaces
|
|
11
|
-
* so downstream one-liner rendering works. If the pipe is absent the whole
|
|
12
|
-
* `documentation` string is treated as signature — matches the SQL behaviour
|
|
13
|
-
* that `symbols.ts` and `trace.ts` used before this helper existed.
|
|
14
|
-
*/
|
|
15
|
-
declare function extractSignature(doc: string | null): string | null;
|
|
16
|
-
|
|
17
|
-
export { cleanSignature, extractSignature };
|