@tienne/gestalt 0.9.0 → 0.9.2
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/CLAUDE.md +78 -1
- package/dist/package.json +3 -1
- package/dist/schemas/gestalt.schema.json +5 -0
- package/dist/skills/blast-radius/SKILL.md +134 -0
- package/dist/skills/build-graph/SKILL.md +100 -0
- package/dist/skills/diff-radius/SKILL.md +125 -0
- package/dist/skills/execute/SKILL.md +90 -8
- package/dist/skills/interview/SKILL.md +5 -4
- package/dist/skills/spec/SKILL.md +7 -1
- package/dist/src/cli/commands/init.d.ts +5 -0
- package/dist/src/cli/commands/init.d.ts.map +1 -0
- package/dist/src/cli/commands/init.js +79 -0
- package/dist/src/cli/commands/init.js.map +1 -0
- package/dist/src/cli/commands/setup.d.ts.map +1 -1
- package/dist/src/cli/commands/setup.js +1 -0
- package/dist/src/cli/commands/setup.js.map +1 -1
- package/dist/src/cli/index.d.ts.map +1 -1
- package/dist/src/cli/index.js +9 -0
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/code-graph/blast-radius.d.ts +9 -0
- package/dist/src/code-graph/blast-radius.d.ts.map +1 -0
- package/dist/src/code-graph/blast-radius.js +139 -0
- package/dist/src/code-graph/blast-radius.js.map +1 -0
- package/dist/src/code-graph/engine.d.ts +46 -0
- package/dist/src/code-graph/engine.d.ts.map +1 -0
- package/dist/src/code-graph/engine.js +301 -0
- package/dist/src/code-graph/engine.js.map +1 -0
- package/dist/src/code-graph/git-hook.d.ts +22 -0
- package/dist/src/code-graph/git-hook.d.ts.map +1 -0
- package/dist/src/code-graph/git-hook.js +100 -0
- package/dist/src/code-graph/git-hook.js.map +1 -0
- package/dist/src/code-graph/index.d.ts +7 -0
- package/dist/src/code-graph/index.d.ts.map +1 -0
- package/dist/src/code-graph/index.js +6 -0
- package/dist/src/code-graph/index.js.map +1 -0
- package/dist/src/code-graph/plugins/go.d.ts +3 -0
- package/dist/src/code-graph/plugins/go.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/go.js +126 -0
- package/dist/src/code-graph/plugins/go.js.map +1 -0
- package/dist/src/code-graph/plugins/index.d.ts +16 -0
- package/dist/src/code-graph/plugins/index.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/index.js +36 -0
- package/dist/src/code-graph/plugins/index.js.map +1 -0
- package/dist/src/code-graph/plugins/java.d.ts +3 -0
- package/dist/src/code-graph/plugins/java.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/java.js +108 -0
- package/dist/src/code-graph/plugins/java.js.map +1 -0
- package/dist/src/code-graph/plugins/kotlin.d.ts +3 -0
- package/dist/src/code-graph/plugins/kotlin.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/kotlin.js +94 -0
- package/dist/src/code-graph/plugins/kotlin.js.map +1 -0
- package/dist/src/code-graph/plugins/objc.d.ts +3 -0
- package/dist/src/code-graph/plugins/objc.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/objc.js +129 -0
- package/dist/src/code-graph/plugins/objc.js.map +1 -0
- package/dist/src/code-graph/plugins/python.d.ts +3 -0
- package/dist/src/code-graph/plugins/python.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/python.js +116 -0
- package/dist/src/code-graph/plugins/python.js.map +1 -0
- package/dist/src/code-graph/plugins/rust.d.ts +3 -0
- package/dist/src/code-graph/plugins/rust.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/rust.js +108 -0
- package/dist/src/code-graph/plugins/rust.js.map +1 -0
- package/dist/src/code-graph/plugins/swift.d.ts +3 -0
- package/dist/src/code-graph/plugins/swift.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/swift.js +106 -0
- package/dist/src/code-graph/plugins/swift.js.map +1 -0
- package/dist/src/code-graph/plugins/typescript.d.ts +3 -0
- package/dist/src/code-graph/plugins/typescript.d.ts.map +1 -0
- package/dist/src/code-graph/plugins/typescript.js +209 -0
- package/dist/src/code-graph/plugins/typescript.js.map +1 -0
- package/dist/src/code-graph/storage.d.ts +18 -0
- package/dist/src/code-graph/storage.d.ts.map +1 -0
- package/dist/src/code-graph/storage.js +175 -0
- package/dist/src/code-graph/storage.js.map +1 -0
- package/dist/src/code-graph/types.d.ts +93 -0
- package/dist/src/code-graph/types.d.ts.map +1 -0
- package/dist/src/code-graph/types.js +17 -0
- package/dist/src/code-graph/types.js.map +1 -0
- package/dist/src/core/config.d.ts +4 -0
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +6 -1
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/core/types.d.ts +1 -0
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/execute/passthrough-engine.d.ts +4 -1
- package/dist/src/execute/passthrough-engine.d.ts.map +1 -1
- package/dist/src/execute/passthrough-engine.js +54 -4
- package/dist/src/execute/passthrough-engine.js.map +1 -1
- package/dist/src/execute/prompts.d.ts +2 -2
- package/dist/src/execute/prompts.d.ts.map +1 -1
- package/dist/src/execute/prompts.js +7 -3
- package/dist/src/execute/prompts.js.map +1 -1
- package/dist/src/execute/repository.d.ts.map +1 -1
- package/dist/src/execute/repository.js +1 -0
- package/dist/src/execute/repository.js.map +1 -1
- package/dist/src/execute/session.d.ts +3 -1
- package/dist/src/execute/session.d.ts.map +1 -1
- package/dist/src/execute/session.js +3 -1
- package/dist/src/execute/session.js.map +1 -1
- package/dist/src/mcp/schemas.d.ts +46 -0
- package/dist/src/mcp/schemas.d.ts.map +1 -1
- package/dist/src/mcp/schemas.js +23 -0
- package/dist/src/mcp/schemas.js.map +1 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +21 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/code-graph-passthrough.d.ts +16 -0
- package/dist/src/mcp/tools/code-graph-passthrough.d.ts.map +1 -0
- package/dist/src/mcp/tools/code-graph-passthrough.js +65 -0
- package/dist/src/mcp/tools/code-graph-passthrough.js.map +1 -0
- package/dist/src/mcp/tools/execute-passthrough.d.ts.map +1 -1
- package/dist/src/mcp/tools/execute-passthrough.js +28 -2
- package/dist/src/mcp/tools/execute-passthrough.js.map +1 -1
- package/dist/src/mcp/tools/index.d.ts +1 -0
- package/dist/src/mcp/tools/index.d.ts.map +1 -1
- package/dist/src/mcp/tools/index.js +1 -0
- package/dist/src/mcp/tools/index.js.map +1 -1
- package/dist/src/mcp/tools/interview-passthrough.d.ts.map +1 -1
- package/dist/src/mcp/tools/interview-passthrough.js +5 -0
- package/dist/src/mcp/tools/interview-passthrough.js.map +1 -1
- package/dist/src/mcp/tools/spec-passthrough.d.ts.map +1 -1
- package/dist/src/mcp/tools/spec-passthrough.js +9 -0
- package/dist/src/mcp/tools/spec-passthrough.js.map +1 -1
- package/dist/src/utils/notifier.d.ts +10 -0
- package/dist/src/utils/notifier.d.ts.map +1 -0
- package/dist/src/utils/notifier.js +21 -0
- package/dist/src/utils/notifier.js.map +1 -0
- package/package.json +3 -1
- package/schemas/gestalt.schema.json +5 -0
- package/skills/blast-radius/SKILL.md +134 -0
- package/skills/build-graph/SKILL.md +100 -0
- package/skills/diff-radius/SKILL.md +125 -0
- package/skills/execute/SKILL.md +90 -8
- package/skills/interview/SKILL.md +5 -4
- package/skills/spec/SKILL.md +7 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { readFileSync, existsSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { join, resolve } from 'node:path';
|
|
4
|
+
import { execSync } from 'node:child_process';
|
|
5
|
+
import { CodeGraphStore } from './storage.js';
|
|
6
|
+
import { computeBlastRadius } from './blast-radius.js';
|
|
7
|
+
import { getPluginForFile } from './plugins/index.js';
|
|
8
|
+
function getFilesRecursively(repoRoot, excludePatterns, include) {
|
|
9
|
+
const excludeSegments = new Set(excludePatterns.filter(p => p.endsWith('/**')).map(p => p.slice(0, -3)));
|
|
10
|
+
const excludeSuffixes = excludePatterns
|
|
11
|
+
.filter(p => !p.includes('/') && p.startsWith('*.'))
|
|
12
|
+
.map(p => p.slice(1));
|
|
13
|
+
const includeRoots = include?.filter(p => !p.startsWith('**')).map(p => p.replace(/\*\*.*$/, '').replace(/\/$/, ''));
|
|
14
|
+
const results = [];
|
|
15
|
+
try {
|
|
16
|
+
const entries = readdirSync(repoRoot, { withFileTypes: true, recursive: true });
|
|
17
|
+
for (const entry of entries) {
|
|
18
|
+
if (!entry.isFile())
|
|
19
|
+
continue;
|
|
20
|
+
const fullPath = join(entry.parentPath, entry.name);
|
|
21
|
+
const rel = fullPath.slice(repoRoot.length + 1);
|
|
22
|
+
const segments = rel.split('/');
|
|
23
|
+
if (segments.some(s => excludeSegments.has(s)))
|
|
24
|
+
continue;
|
|
25
|
+
if (excludeSuffixes.some(s => entry.name.endsWith(s)))
|
|
26
|
+
continue;
|
|
27
|
+
if (includeRoots && includeRoots.length > 0 && !includeRoots.some(r => rel.startsWith(r)))
|
|
28
|
+
continue;
|
|
29
|
+
results.push(fullPath);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// directory doesn't exist or not readable
|
|
34
|
+
}
|
|
35
|
+
return results;
|
|
36
|
+
}
|
|
37
|
+
const DEFAULT_EXCLUDE = [
|
|
38
|
+
'node_modules/**',
|
|
39
|
+
'.git/**',
|
|
40
|
+
'.gestalt/**',
|
|
41
|
+
'dist/**',
|
|
42
|
+
'build/**',
|
|
43
|
+
'coverage/**',
|
|
44
|
+
'*.min.js',
|
|
45
|
+
];
|
|
46
|
+
export class CodeGraphEngine {
|
|
47
|
+
storeCache = new Map();
|
|
48
|
+
getDbPath(repoRoot) {
|
|
49
|
+
return join(repoRoot, '.gestalt', 'code-graph.db');
|
|
50
|
+
}
|
|
51
|
+
getStore(repoRoot) {
|
|
52
|
+
const dbPath = this.getDbPath(repoRoot);
|
|
53
|
+
if (!this.storeCache.has(dbPath)) {
|
|
54
|
+
this.storeCache.set(dbPath, new CodeGraphStore(dbPath));
|
|
55
|
+
}
|
|
56
|
+
return this.storeCache.get(dbPath);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Build or incrementally update the code graph for a repository.
|
|
60
|
+
*/
|
|
61
|
+
build(repoRoot, opts = {}) {
|
|
62
|
+
const start = Date.now();
|
|
63
|
+
const store = this.getStore(repoRoot);
|
|
64
|
+
const { include, exclude = [], mode = 'full' } = opts;
|
|
65
|
+
// Collect files
|
|
66
|
+
const excludePatterns = [...DEFAULT_EXCLUDE, ...exclude];
|
|
67
|
+
const files = getFilesRecursively(repoRoot, excludePatterns, include);
|
|
68
|
+
// Filter files that have supported plugins
|
|
69
|
+
const supportedFiles = files.filter((f) => getPluginForFile(f) !== null);
|
|
70
|
+
let nodesBuilt = 0;
|
|
71
|
+
let edgesBuilt = 0;
|
|
72
|
+
for (const filePath of supportedFiles) {
|
|
73
|
+
// Incremental: skip unchanged files (hash comparison)
|
|
74
|
+
if (mode === 'incremental') {
|
|
75
|
+
const existingHash = store.getFileHash(filePath);
|
|
76
|
+
if (existingHash) {
|
|
77
|
+
try {
|
|
78
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
79
|
+
const currentHash = createHash('sha256').update(content).digest('hex');
|
|
80
|
+
if (currentHash === existingHash)
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// If can't read, skip
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const plugin = getPluginForFile(filePath);
|
|
90
|
+
if (!plugin)
|
|
91
|
+
continue;
|
|
92
|
+
try {
|
|
93
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
94
|
+
const result = plugin.parse(filePath, content);
|
|
95
|
+
// Delete old data for this file before updating
|
|
96
|
+
store.deleteByFile(filePath);
|
|
97
|
+
for (const node of result.nodes) {
|
|
98
|
+
store.upsertNode(node);
|
|
99
|
+
nodesBuilt++;
|
|
100
|
+
}
|
|
101
|
+
for (const edge of result.edges) {
|
|
102
|
+
store.upsertEdge(edge);
|
|
103
|
+
edgesBuilt++;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Skip files that fail to parse
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
nodesBuilt,
|
|
112
|
+
edgesBuilt,
|
|
113
|
+
timeTakenMs: Date.now() - start,
|
|
114
|
+
installedHook: false, // Hook installation handled separately via GitHookManager
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Compute blast-radius for changed files.
|
|
119
|
+
* Auto-detects changed files from git diff if not provided.
|
|
120
|
+
*/
|
|
121
|
+
blastRadius(repoRoot, opts = {}) {
|
|
122
|
+
const store = this.getStore(repoRoot);
|
|
123
|
+
const { changedFiles, base = 'HEAD~1', maxDepth = 2 } = opts;
|
|
124
|
+
let files = changedFiles;
|
|
125
|
+
if (!files || files.length === 0) {
|
|
126
|
+
files = this.getGitChangedFiles(repoRoot, base);
|
|
127
|
+
}
|
|
128
|
+
// Convert to absolute paths
|
|
129
|
+
const absoluteFiles = files.map((f) => f.startsWith('/') ? f : resolve(repoRoot, f));
|
|
130
|
+
return computeBlastRadius(store, absoluteFiles, maxDepth);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Compute blast-radius for uncommitted changes (staged / unstaged / all).
|
|
134
|
+
* - staged: git diff --cached --name-only
|
|
135
|
+
* - unstaged: git diff --name-only
|
|
136
|
+
* - all (default): git diff HEAD --name-only
|
|
137
|
+
*/
|
|
138
|
+
diffRadius(repoRoot, opts = {}) {
|
|
139
|
+
const { mode = 'all', maxDepth = 2 } = opts;
|
|
140
|
+
const store = this.getStore(repoRoot);
|
|
141
|
+
const gitCmd = mode === 'staged'
|
|
142
|
+
? 'git diff --cached --name-only'
|
|
143
|
+
: mode === 'unstaged'
|
|
144
|
+
? 'git diff --name-only'
|
|
145
|
+
: 'git diff HEAD --name-only';
|
|
146
|
+
let files;
|
|
147
|
+
try {
|
|
148
|
+
const output = execSync(gitCmd, {
|
|
149
|
+
cwd: repoRoot,
|
|
150
|
+
encoding: 'utf-8',
|
|
151
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
152
|
+
});
|
|
153
|
+
files = output
|
|
154
|
+
.trim()
|
|
155
|
+
.split('\n')
|
|
156
|
+
.filter(Boolean)
|
|
157
|
+
.map((f) => resolve(repoRoot, f));
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
files = [];
|
|
161
|
+
}
|
|
162
|
+
return computeBlastRadius(store, files, maxDepth);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Query the graph with a specific pattern.
|
|
166
|
+
*/
|
|
167
|
+
query(repoRoot, pattern, target) {
|
|
168
|
+
const store = this.getStore(repoRoot);
|
|
169
|
+
const nodes = [];
|
|
170
|
+
const edges = [];
|
|
171
|
+
switch (pattern) {
|
|
172
|
+
case 'callers_of': {
|
|
173
|
+
// Find all nodes that call the target
|
|
174
|
+
const targetEdges = store.getEdgesByTarget(`function:${repoRoot}:${target}`);
|
|
175
|
+
for (const edge of targetEdges) {
|
|
176
|
+
if (edge.kind === 'CALLS') {
|
|
177
|
+
const node = store.getNodeById(edge.sourceId);
|
|
178
|
+
if (node)
|
|
179
|
+
nodes.push(node);
|
|
180
|
+
edges.push(edge);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case 'callees_of': {
|
|
186
|
+
// Find all nodes called by the target
|
|
187
|
+
const outEdges = store.getEdgesBySource(`function:${repoRoot}:${target}`);
|
|
188
|
+
for (const edge of outEdges) {
|
|
189
|
+
if (edge.kind === 'CALLS') {
|
|
190
|
+
const node = store.getNodeById(edge.targetId);
|
|
191
|
+
if (node)
|
|
192
|
+
nodes.push(node);
|
|
193
|
+
edges.push(edge);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
case 'tests_for': {
|
|
199
|
+
// Find test nodes that depend on the target file
|
|
200
|
+
const targetFileId = `file:${target.startsWith('/') ? target : resolve(repoRoot, target)}`;
|
|
201
|
+
const incomingEdges = store.getEdgesByTarget(targetFileId);
|
|
202
|
+
for (const edge of incomingEdges) {
|
|
203
|
+
const node = store.getNodeById(edge.sourceId);
|
|
204
|
+
if (node?.isTest) {
|
|
205
|
+
nodes.push(node);
|
|
206
|
+
edges.push(edge);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
case 'imports_of': {
|
|
212
|
+
// Find files that import the target
|
|
213
|
+
const targetFileId = `file:${target.startsWith('/') ? target : resolve(repoRoot, target)}`;
|
|
214
|
+
const incomingEdges = store.getEdgesByTarget(targetFileId);
|
|
215
|
+
for (const edge of incomingEdges) {
|
|
216
|
+
if (edge.kind === 'IMPORTS_FROM') {
|
|
217
|
+
const node = store.getNodeById(edge.sourceId);
|
|
218
|
+
if (node)
|
|
219
|
+
nodes.push(node);
|
|
220
|
+
edges.push(edge);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return { nodes, edges };
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Returns statistics about the code graph.
|
|
230
|
+
*/
|
|
231
|
+
stats(repoRoot) {
|
|
232
|
+
const dbPath = this.getDbPath(repoRoot);
|
|
233
|
+
const store = this.getStore(repoRoot);
|
|
234
|
+
return store.getStats(dbPath);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Checks if a code-graph.db exists for the given repo root.
|
|
238
|
+
*/
|
|
239
|
+
dbExists(repoRoot) {
|
|
240
|
+
return existsSync(this.getDbPath(repoRoot));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Search for files whose paths or node names contain any of the given keywords.
|
|
244
|
+
* Returns unique file paths sorted by match count descending.
|
|
245
|
+
*/
|
|
246
|
+
searchByKeywords(repoRoot, keywords) {
|
|
247
|
+
if (keywords.length === 0)
|
|
248
|
+
return [];
|
|
249
|
+
const store = this.getStore(repoRoot);
|
|
250
|
+
const nodes = store.getAllNodes();
|
|
251
|
+
const lower = keywords.map((k) => k.toLowerCase());
|
|
252
|
+
const scoreMap = new Map();
|
|
253
|
+
for (const node of nodes) {
|
|
254
|
+
const fileLower = node.filePath.toLowerCase();
|
|
255
|
+
const nameLower = node.name.toLowerCase();
|
|
256
|
+
let score = 0;
|
|
257
|
+
for (const kw of lower) {
|
|
258
|
+
if (fileLower.includes(kw) || nameLower.includes(kw)) {
|
|
259
|
+
score++;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (score > 0) {
|
|
263
|
+
const prev = scoreMap.get(node.filePath) ?? 0;
|
|
264
|
+
scoreMap.set(node.filePath, Math.max(prev, score));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return [...scoreMap.entries()]
|
|
268
|
+
.sort((a, b) => b[1] - a[1])
|
|
269
|
+
.map(([filePath]) => filePath);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Close all open database connections.
|
|
273
|
+
*/
|
|
274
|
+
close() {
|
|
275
|
+
for (const store of this.storeCache.values()) {
|
|
276
|
+
store.close();
|
|
277
|
+
}
|
|
278
|
+
this.storeCache.clear();
|
|
279
|
+
}
|
|
280
|
+
getGitChangedFiles(repoRoot, base) {
|
|
281
|
+
try {
|
|
282
|
+
const output = execSync(`git diff --name-only ${base}`, {
|
|
283
|
+
cwd: repoRoot,
|
|
284
|
+
encoding: 'utf-8',
|
|
285
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
286
|
+
});
|
|
287
|
+
return output
|
|
288
|
+
.trim()
|
|
289
|
+
.split('\n')
|
|
290
|
+
.filter(Boolean)
|
|
291
|
+
.map((f) => resolve(repoRoot, f));
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
// Not a git repo or no changes — return empty
|
|
295
|
+
return [];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Singleton for shared use across MCP tools
|
|
300
|
+
export const codeGraphEngine = new CodeGraphEngine();
|
|
301
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/code-graph/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAYtD,SAAS,mBAAmB,CAAC,QAAgB,EAAE,eAAyB,EAAE,OAAkB;IAC1F,MAAM,eAAe,GAAG,IAAI,GAAG,CAC7B,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CACxE,CAAC;IACF,MAAM,eAAe,GAAG,eAAe;SACpC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;SACnD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,YAAY,GAAG,OAAO,E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AAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aAC3B,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAEO,kBAAkB,CAAC,QAAgB,EAAE,IAAY;QACvD,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,QAAQ,CAAC,wBAAwB,IAAI,EAAE,EAAE;gBACtD,GAAG,EAAE,QAAQ;gBACb,QAAQ,EAAE,OAAO;gBACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;aAChC,CAAC,CAAC;YACH,OAAO,MAAM;iBACV,IAAI,EAAE;iBACN,KAAK,CAAC,IAAI,CAAC;iBACX,MAAM,CAAC,OAAO,CAAC;iBACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,8CAA8C;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class GitHookManager {
|
|
2
|
+
private getHookPath;
|
|
3
|
+
/**
|
|
4
|
+
* Install the Gestalt post-commit hook into the given repo root.
|
|
5
|
+
* - Creates the hook file with mode 0o755 if it doesn't exist.
|
|
6
|
+
* - Appends the Gestalt section to an existing file only when the marker is absent.
|
|
7
|
+
* - No-ops if the marker is already present.
|
|
8
|
+
*/
|
|
9
|
+
installHook(repoRoot: string): void;
|
|
10
|
+
/**
|
|
11
|
+
* Remove only the Gestalt-managed section from the post-commit hook.
|
|
12
|
+
* Preserves any pre-existing hook content.
|
|
13
|
+
* Deletes the file entirely if it becomes empty after removal.
|
|
14
|
+
*/
|
|
15
|
+
uninstallHook(repoRoot: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if the Gestalt hook marker is present in the post-commit hook file.
|
|
18
|
+
*/
|
|
19
|
+
isInstalled(repoRoot: string): boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare const gitHookManager: GitHookManager;
|
|
22
|
+
//# sourceMappingURL=git-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hook.d.ts","sourceRoot":"","sources":["../../../src/code-graph/git-hook.ts"],"names":[],"mappings":"AA4BA,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAqBnC;;;;OAIG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAgCrC;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAQvC;AAGD,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync, unlinkSync, chmodSync } from 'node:fs';
|
|
2
|
+
import { join, resolve, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const GESTALT_MARKER = '# GESTALT_CODE_GRAPH_HOOK';
|
|
5
|
+
// Absolute path to the fallback dist entry (resolved relative to this source file)
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const FALLBACK_PATH = resolve(dirname(__filename), '../../dist/code-graph/index.js');
|
|
8
|
+
const HOOK_SCRIPT = `#!/bin/sh
|
|
9
|
+
${GESTALT_MARKER} - managed by Gestalt, do not remove this comment
|
|
10
|
+
node --input-type=module << 'GESTALT_HOOK_EOF'
|
|
11
|
+
import { createRequire } from 'module';
|
|
12
|
+
const req = createRequire(import.meta.url);
|
|
13
|
+
try {
|
|
14
|
+
const pkgMain = req.resolve('@tienne/gestalt');
|
|
15
|
+
const { codeGraphEngine } = await import(pkgMain);
|
|
16
|
+
await codeGraphEngine.build(process.cwd(), { mode: 'incremental' });
|
|
17
|
+
} catch {
|
|
18
|
+
try {
|
|
19
|
+
const { codeGraphEngine } = await import('${FALLBACK_PATH}');
|
|
20
|
+
await codeGraphEngine.build(process.cwd(), { mode: 'incremental' });
|
|
21
|
+
} catch {}
|
|
22
|
+
}
|
|
23
|
+
GESTALT_HOOK_EOF
|
|
24
|
+
`;
|
|
25
|
+
export class GitHookManager {
|
|
26
|
+
getHookPath(repoRoot) {
|
|
27
|
+
return join(repoRoot, '.git', 'hooks', 'post-commit');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Install the Gestalt post-commit hook into the given repo root.
|
|
31
|
+
* - Creates the hook file with mode 0o755 if it doesn't exist.
|
|
32
|
+
* - Appends the Gestalt section to an existing file only when the marker is absent.
|
|
33
|
+
* - No-ops if the marker is already present.
|
|
34
|
+
*/
|
|
35
|
+
installHook(repoRoot) {
|
|
36
|
+
const hookPath = this.getHookPath(repoRoot);
|
|
37
|
+
if (existsSync(hookPath)) {
|
|
38
|
+
const existing = readFileSync(hookPath, 'utf-8');
|
|
39
|
+
if (existing.includes(GESTALT_MARKER)) {
|
|
40
|
+
// Already installed — skip
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Append to existing file preserving original content
|
|
44
|
+
const appended = existing.endsWith('\n')
|
|
45
|
+
? existing + '\n' + HOOK_SCRIPT
|
|
46
|
+
: existing + '\n\n' + HOOK_SCRIPT;
|
|
47
|
+
writeFileSync(hookPath, appended, { encoding: 'utf-8' });
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
writeFileSync(hookPath, HOOK_SCRIPT, { encoding: 'utf-8' });
|
|
51
|
+
}
|
|
52
|
+
chmodSync(hookPath, 0o755);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Remove only the Gestalt-managed section from the post-commit hook.
|
|
56
|
+
* Preserves any pre-existing hook content.
|
|
57
|
+
* Deletes the file entirely if it becomes empty after removal.
|
|
58
|
+
*/
|
|
59
|
+
uninstallHook(repoRoot) {
|
|
60
|
+
const hookPath = this.getHookPath(repoRoot);
|
|
61
|
+
if (!existsSync(hookPath)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const content = readFileSync(hookPath, 'utf-8');
|
|
65
|
+
if (!content.includes(GESTALT_MARKER)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Remove the Gestalt block: from the marker line to the end of the block.
|
|
69
|
+
// Strategy: split on the marker and keep only content before it.
|
|
70
|
+
// The marker line is always preceded by a newline (or is at the start).
|
|
71
|
+
const markerIndex = content.indexOf(GESTALT_MARKER);
|
|
72
|
+
// Walk backwards to find the beginning of the line containing the marker
|
|
73
|
+
let lineStart = markerIndex;
|
|
74
|
+
while (lineStart > 0 && content[lineStart - 1] !== '\n') {
|
|
75
|
+
lineStart--;
|
|
76
|
+
}
|
|
77
|
+
const before = content.slice(0, lineStart).trimEnd();
|
|
78
|
+
if (before.length === 0) {
|
|
79
|
+
// Nothing remains — delete the file
|
|
80
|
+
unlinkSync(hookPath);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
writeFileSync(hookPath, before + '\n', { encoding: 'utf-8' });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns true if the Gestalt hook marker is present in the post-commit hook file.
|
|
88
|
+
*/
|
|
89
|
+
isInstalled(repoRoot) {
|
|
90
|
+
const hookPath = this.getHookPath(repoRoot);
|
|
91
|
+
if (!existsSync(hookPath)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const content = readFileSync(hookPath, 'utf-8');
|
|
95
|
+
return content.includes(GESTALT_MARKER);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Singleton for shared use across MCP tools
|
|
99
|
+
export const gitHookManager = new GitHookManager();
|
|
100
|
+
//# sourceMappingURL=git-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-hook.js","sourceRoot":"","sources":["../../../src/code-graph/git-hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,cAAc,GAAG,2BAA2B,CAAC;AAEnD,mFAAmF;AACnF,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,gCAAgC,CAAC,CAAC;AAErF,MAAM,WAAW,GAAG;EAClB,cAAc;;;;;;;;;;gDAUgC,aAAa;;;;;CAK5D,CAAC;AAEF,MAAM,OAAO,cAAc;IACjB,WAAW,CAAC,QAAgB;QAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IACxD,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,QAAgB;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAE5C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACjD,IAAI,QAAQ,CAAC,QAA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AS,CAAC,CAAC,OAAO,EAAE,CAAC;QAErD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,oCAAoC;YACpC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,QAAgB;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC;CACF;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { CodeGraphEngine, codeGraphEngine } from './engine.js';
|
|
2
|
+
export { CodeGraphStore } from './storage.js';
|
|
3
|
+
export { computeBlastRadius } from './blast-radius.js';
|
|
4
|
+
export { getPluginForFile, pluginRegistry } from './plugins/index.js';
|
|
5
|
+
export type { CodeGraphNode, CodeGraphEdge, BlastRadiusResult, BlastRadiusNode, BlastRadiusOptions, BuildOptions, BuildResult, QueryPattern, QueryResult, CodeGraphStats, AnalyzerPlugin, ParseResult, } from './types.js';
|
|
6
|
+
export { NodeKind, EdgeKind } from './types.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CodeGraphEngine, codeGraphEngine } from './engine.js';
|
|
2
|
+
export { CodeGraphStore } from './storage.js';
|
|
3
|
+
export { computeBlastRadius } from './blast-radius.js';
|
|
4
|
+
export { getPluginForFile, pluginRegistry } from './plugins/index.js';
|
|
5
|
+
export { NodeKind, EdgeKind } from './types.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/code-graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAetE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../../../src/code-graph/plugins/go.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAA6C,MAAM,aAAa,CAAC;AAM7F,eAAO,MAAM,QAAQ,EAAE,cA+HtB,CAAC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { basename } from 'node:path';
|
|
3
|
+
import { NodeKind, EdgeKind } from '../types.js';
|
|
4
|
+
function isTestFile(filePath) {
|
|
5
|
+
return basename(filePath).endsWith('_test.go') || filePath.includes('/testdata/');
|
|
6
|
+
}
|
|
7
|
+
export const goPlugin = {
|
|
8
|
+
language: 'go',
|
|
9
|
+
extensions: ['.go'],
|
|
10
|
+
parse(filePath, content) {
|
|
11
|
+
const fileHash = createHash('sha256').update(content).digest('hex');
|
|
12
|
+
const now = Date.now();
|
|
13
|
+
const isTest = isTestFile(filePath);
|
|
14
|
+
const nodes = [];
|
|
15
|
+
const edges = [];
|
|
16
|
+
const edgeSet = new Set();
|
|
17
|
+
const fileNodeId = `file:${filePath}`;
|
|
18
|
+
nodes.push({
|
|
19
|
+
id: fileNodeId,
|
|
20
|
+
kind: NodeKind.File,
|
|
21
|
+
name: basename(filePath),
|
|
22
|
+
filePath,
|
|
23
|
+
isTest,
|
|
24
|
+
fileHash,
|
|
25
|
+
updatedAt: now,
|
|
26
|
+
});
|
|
27
|
+
const lines = content.split('\n');
|
|
28
|
+
// Regex for top-level func and method declarations
|
|
29
|
+
const funcRegex = /^func\s+(?:\(\s*\w+\s+\*?\w+\s*\)\s+)?(\w+)\s*\(/;
|
|
30
|
+
// type declaration
|
|
31
|
+
const typeRegex = /^type\s+(\w+)\s+(struct|interface)/;
|
|
32
|
+
// import single line
|
|
33
|
+
const importSingleRegex = /^import\s+"([^"]+)"/;
|
|
34
|
+
// inside import block
|
|
35
|
+
const importBlockEntryRegex = /^\s+"([^"]+)"/;
|
|
36
|
+
let inImportBlock = false;
|
|
37
|
+
for (let i = 0; i < lines.length; i++) {
|
|
38
|
+
const line = lines[i];
|
|
39
|
+
const lineNum = i + 1;
|
|
40
|
+
if (line.trim() === 'import (') {
|
|
41
|
+
inImportBlock = true;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (inImportBlock) {
|
|
45
|
+
if (line.trim() === ')') {
|
|
46
|
+
inImportBlock = false;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const m = importBlockEntryRegex.exec(line);
|
|
50
|
+
if (m) {
|
|
51
|
+
const mod = m[1];
|
|
52
|
+
if (mod.includes('/')) {
|
|
53
|
+
const targetId = `file:${mod}`;
|
|
54
|
+
const edgeKey = `IMPORTS_FROM:${fileNodeId}:${targetId}`;
|
|
55
|
+
if (!edgeSet.has(edgeKey)) {
|
|
56
|
+
edgeSet.add(edgeKey);
|
|
57
|
+
edges.push({ kind: EdgeKind.IMPORTS_FROM, sourceId: fileNodeId, targetId, line: lineNum, updatedAt: now });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// Single import
|
|
65
|
+
const singleImport = importSingleRegex.exec(line);
|
|
66
|
+
if (singleImport) {
|
|
67
|
+
const mod = singleImport[1];
|
|
68
|
+
if (mod.includes('/')) {
|
|
69
|
+
const targetId = `file:${mod}`;
|
|
70
|
+
const edgeKey = `IMPORTS_FROM:${fileNodeId}:${targetId}`;
|
|
71
|
+
if (!edgeSet.has(edgeKey)) {
|
|
72
|
+
edgeSet.add(edgeKey);
|
|
73
|
+
edges.push({ kind: EdgeKind.IMPORTS_FROM, sourceId: fileNodeId, targetId, line: lineNum, updatedAt: now });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
// Function / method
|
|
79
|
+
const funcMatch = funcRegex.exec(line);
|
|
80
|
+
if (funcMatch) {
|
|
81
|
+
const name = funcMatch[1];
|
|
82
|
+
if (name) {
|
|
83
|
+
const nodeId = `function:${filePath}:${name}`;
|
|
84
|
+
nodes.push({
|
|
85
|
+
id: nodeId,
|
|
86
|
+
kind: NodeKind.Function,
|
|
87
|
+
name,
|
|
88
|
+
filePath,
|
|
89
|
+
lineStart: lineNum,
|
|
90
|
+
isTest,
|
|
91
|
+
updatedAt: now,
|
|
92
|
+
});
|
|
93
|
+
const edgeKey = `CONTAINS:${fileNodeId}:${nodeId}`;
|
|
94
|
+
if (!edgeSet.has(edgeKey)) {
|
|
95
|
+
edgeSet.add(edgeKey);
|
|
96
|
+
edges.push({ kind: EdgeKind.CONTAINS, sourceId: fileNodeId, targetId: nodeId, line: lineNum, updatedAt: now });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
// Type declaration
|
|
102
|
+
const typeMatch = typeRegex.exec(line);
|
|
103
|
+
if (typeMatch) {
|
|
104
|
+
const name = typeMatch[1];
|
|
105
|
+
const kind = typeMatch[2] === 'struct' ? NodeKind.Class : NodeKind.Type;
|
|
106
|
+
const nodeId = `${kind === NodeKind.Class ? 'class' : 'type'}:${filePath}:${name}`;
|
|
107
|
+
nodes.push({
|
|
108
|
+
id: nodeId,
|
|
109
|
+
kind,
|
|
110
|
+
name,
|
|
111
|
+
filePath,
|
|
112
|
+
lineStart: lineNum,
|
|
113
|
+
isTest,
|
|
114
|
+
updatedAt: now,
|
|
115
|
+
});
|
|
116
|
+
const edgeKey = `CONTAINS:${fileNodeId}:${nodeId}`;
|
|
117
|
+
if (!edgeSet.has(edgeKey)) {
|
|
118
|
+
edgeSet.add(edgeKey);
|
|
119
|
+
edges.push({ kind: EdgeKind.CONTAINS, sourceId: fileNodeId, targetId: nodeId, line: lineNum, updatedAt: now });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { nodes, edges, fileHash };
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceR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oBAC1B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oBACrB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;gBACjH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnalyzerPlugin } from '../types.js';
|
|
2
|
+
export { typescriptPlugin } from './typescript.js';
|
|
3
|
+
export { pythonPlugin } from './python.js';
|
|
4
|
+
export { goPlugin } from './go.js';
|
|
5
|
+
export { javaPlugin } from './java.js';
|
|
6
|
+
export { kotlinPlugin } from './kotlin.js';
|
|
7
|
+
export { rustPlugin } from './rust.js';
|
|
8
|
+
export { swiftPlugin } from './swift.js';
|
|
9
|
+
export { objcPlugin } from './objc.js';
|
|
10
|
+
export declare const pluginRegistry: AnalyzerPlugin[];
|
|
11
|
+
/**
|
|
12
|
+
* Returns the appropriate plugin for a given file path based on extension.
|
|
13
|
+
* Returns null if no plugin supports the file type.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPluginForFile(filePath: string): AnalyzerPlugin | null;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/code-graph/plugins/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAWvC,eAAO,MAAM,cAAc,EAAE,cAAc,EAS1C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAGxE"}
|