@nahisaho/musubix-codegraph 2.3.0
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 +187 -0
- package/dist/codegraph.d.ts +218 -0
- package/dist/codegraph.d.ts.map +1 -0
- package/dist/codegraph.js +429 -0
- package/dist/codegraph.js.map +1 -0
- package/dist/events/event-emitter.d.ts +93 -0
- package/dist/events/event-emitter.d.ts.map +1 -0
- package/dist/events/event-emitter.js +152 -0
- package/dist/events/event-emitter.js.map +1 -0
- package/dist/events/index.d.ts +8 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +8 -0
- package/dist/events/index.js.map +1 -0
- package/dist/graph/graph-engine.d.ts +97 -0
- package/dist/graph/graph-engine.d.ts.map +1 -0
- package/dist/graph/graph-engine.js +341 -0
- package/dist/graph/graph-engine.js.map +1 -0
- package/dist/graph/index.d.ts +8 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +8 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graphrag/graphrag-search.d.ts +67 -0
- package/dist/graphrag/graphrag-search.d.ts.map +1 -0
- package/dist/graphrag/graphrag-search.js +297 -0
- package/dist/graphrag/graphrag-search.js.map +1 -0
- package/dist/graphrag/index.d.ts +8 -0
- package/dist/graphrag/index.d.ts.map +1 -0
- package/dist/graphrag/index.js +8 -0
- package/dist/graphrag/index.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer/index.d.ts +8 -0
- package/dist/indexer/index.d.ts.map +1 -0
- package/dist/indexer/index.js +8 -0
- package/dist/indexer/index.js.map +1 -0
- package/dist/indexer/indexer.d.ts +58 -0
- package/dist/indexer/indexer.d.ts.map +1 -0
- package/dist/indexer/indexer.js +206 -0
- package/dist/indexer/indexer.js.map +1 -0
- package/dist/parser/ast-parser.d.ts +79 -0
- package/dist/parser/ast-parser.d.ts.map +1 -0
- package/dist/parser/ast-parser.js +489 -0
- package/dist/parser/ast-parser.js.map +1 -0
- package/dist/parser/index.d.ts +8 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +8 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/storage/index.d.ts +9 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +10 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/memory-storage.d.ts +102 -0
- package/dist/storage/memory-storage.d.ts.map +1 -0
- package/dist/storage/memory-storage.js +263 -0
- package/dist/storage/memory-storage.js.map +1 -0
- package/dist/storage/sqlite-storage.d.ts +90 -0
- package/dist/storage/sqlite-storage.d.ts.map +1 -0
- package/dist/storage/sqlite-storage.js +344 -0
- package/dist/storage/sqlite-storage.js.map +1 -0
- package/dist/types.d.ts +539 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +99 -0
- package/dist/types.js.map +1 -0
- package/package.json +85 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nahisaho/musubix-codegraph - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module @nahisaho/musubix-codegraph
|
|
6
|
+
*
|
|
7
|
+
* @see REQ-CG-API-004
|
|
8
|
+
* @see DES-CG-010
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Supported programming languages
|
|
12
|
+
* @see REQ-CG-AST-001
|
|
13
|
+
*/
|
|
14
|
+
export type Language = 'typescript' | 'javascript' | 'python' | 'rust' | 'go' | 'java' | 'php' | 'csharp' | 'c' | 'cpp' | 'ruby' | 'hcl' | 'kotlin' | 'swift' | 'scala' | 'lua';
|
|
15
|
+
/**
|
|
16
|
+
* File extension to language mapping
|
|
17
|
+
*/
|
|
18
|
+
export declare const LANGUAGE_EXTENSIONS: Record<string, Language>;
|
|
19
|
+
/**
|
|
20
|
+
* Entity types in the code graph
|
|
21
|
+
* @see REQ-CG-AST-003
|
|
22
|
+
*/
|
|
23
|
+
export type EntityType = 'file' | 'module' | 'class' | 'interface' | 'function' | 'method' | 'property' | 'variable' | 'constant' | 'type' | 'enum' | 'enum_member' | 'parameter' | 'import' | 'export' | 'namespace' | 'trait' | 'struct' | 'impl' | 'unknown';
|
|
24
|
+
/**
|
|
25
|
+
* Code entity in the graph
|
|
26
|
+
* @see REQ-CG-AST-003
|
|
27
|
+
* @see DES-CG-010
|
|
28
|
+
*/
|
|
29
|
+
export interface Entity {
|
|
30
|
+
/** Unique identifier */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Entity type */
|
|
33
|
+
type: EntityType;
|
|
34
|
+
/** Entity name */
|
|
35
|
+
name: string;
|
|
36
|
+
/** Qualified name (namespace.name) */
|
|
37
|
+
qualifiedName?: string;
|
|
38
|
+
/** Namespace or module path */
|
|
39
|
+
namespace?: string;
|
|
40
|
+
/** Source file path */
|
|
41
|
+
filePath?: string;
|
|
42
|
+
/** Start line number (1-indexed) */
|
|
43
|
+
startLine?: number;
|
|
44
|
+
/** End line number (1-indexed) */
|
|
45
|
+
endLine?: number;
|
|
46
|
+
/** Function/method signature */
|
|
47
|
+
signature?: string;
|
|
48
|
+
/** Documentation string */
|
|
49
|
+
docstring?: string;
|
|
50
|
+
/** Source code content */
|
|
51
|
+
sourceCode?: string;
|
|
52
|
+
/** Community ID (for GraphRAG) */
|
|
53
|
+
communityId?: string;
|
|
54
|
+
/** Programming language */
|
|
55
|
+
language?: Language;
|
|
56
|
+
/** Additional metadata */
|
|
57
|
+
metadata: Record<string, unknown>;
|
|
58
|
+
/** Creation timestamp */
|
|
59
|
+
createdAt?: Date;
|
|
60
|
+
/** Last update timestamp */
|
|
61
|
+
updatedAt?: Date;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Input for creating an entity
|
|
65
|
+
*/
|
|
66
|
+
export interface EntityInput {
|
|
67
|
+
type: EntityType;
|
|
68
|
+
name: string;
|
|
69
|
+
qualifiedName?: string;
|
|
70
|
+
namespace?: string;
|
|
71
|
+
filePath?: string;
|
|
72
|
+
startLine?: number;
|
|
73
|
+
endLine?: number;
|
|
74
|
+
signature?: string;
|
|
75
|
+
docstring?: string;
|
|
76
|
+
sourceCode?: string;
|
|
77
|
+
language?: Language;
|
|
78
|
+
metadata?: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Relationship types between entities
|
|
82
|
+
* @see REQ-CG-AST-004
|
|
83
|
+
*/
|
|
84
|
+
export type RelationType = 'calls' | 'imports' | 'exports' | 'extends' | 'implements' | 'contains' | 'uses' | 'defines' | 'returns' | 'parameter_of' | 'member_of' | 'type_of' | 'inherits' | 'overrides' | 'references' | 'depends_on';
|
|
85
|
+
/**
|
|
86
|
+
* Relationship between entities
|
|
87
|
+
* @see REQ-CG-AST-004
|
|
88
|
+
*/
|
|
89
|
+
export interface Relation {
|
|
90
|
+
/** Unique identifier */
|
|
91
|
+
id: string;
|
|
92
|
+
/** Source entity ID */
|
|
93
|
+
sourceId: string;
|
|
94
|
+
/** Target entity ID */
|
|
95
|
+
targetId: string;
|
|
96
|
+
/** Relationship type */
|
|
97
|
+
type: RelationType;
|
|
98
|
+
/** Relationship weight/strength (0-1) */
|
|
99
|
+
weight: number;
|
|
100
|
+
/** Additional metadata */
|
|
101
|
+
metadata: Record<string, unknown>;
|
|
102
|
+
/** Creation timestamp */
|
|
103
|
+
createdAt?: Date;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Input for creating a relation
|
|
107
|
+
*/
|
|
108
|
+
export interface RelationInput {
|
|
109
|
+
sourceId: string;
|
|
110
|
+
targetId: string;
|
|
111
|
+
type: RelationType;
|
|
112
|
+
weight?: number;
|
|
113
|
+
metadata?: Record<string, unknown>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* CodeGraph configuration options
|
|
117
|
+
* @see REQ-CG-API-005
|
|
118
|
+
*/
|
|
119
|
+
export interface CodeGraphOptions {
|
|
120
|
+
/** Storage backend */
|
|
121
|
+
storage?: 'memory' | 'sqlite' | StorageAdapter;
|
|
122
|
+
/** SQLite database path (when storage is 'sqlite') */
|
|
123
|
+
sqlitePath?: string;
|
|
124
|
+
/** Parser options */
|
|
125
|
+
parser?: ParserOptions;
|
|
126
|
+
/** Graph engine options */
|
|
127
|
+
graph?: GraphOptions;
|
|
128
|
+
/** Indexer options */
|
|
129
|
+
indexer?: IndexerOptions;
|
|
130
|
+
/** GraphRAG options */
|
|
131
|
+
graphrag?: GraphRAGOptions;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Default CodeGraph options
|
|
135
|
+
*/
|
|
136
|
+
export declare const DEFAULT_CODEGRAPH_OPTIONS: Required<Omit<CodeGraphOptions, 'storage' | 'sqlitePath'>>;
|
|
137
|
+
/**
|
|
138
|
+
* Parser configuration
|
|
139
|
+
*/
|
|
140
|
+
export interface ParserOptions {
|
|
141
|
+
/** Languages to parse */
|
|
142
|
+
languages?: Language[];
|
|
143
|
+
/** Include comments in AST */
|
|
144
|
+
includeComments?: boolean;
|
|
145
|
+
/** Extract docstrings */
|
|
146
|
+
extractDocstrings?: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Graph engine configuration
|
|
150
|
+
*/
|
|
151
|
+
export interface GraphOptions {
|
|
152
|
+
/** Maximum traversal depth */
|
|
153
|
+
maxDepth?: number;
|
|
154
|
+
/** Enable query caching */
|
|
155
|
+
enableCaching?: boolean;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Indexer configuration
|
|
159
|
+
*/
|
|
160
|
+
export interface IndexerOptions {
|
|
161
|
+
/** Glob patterns to ignore */
|
|
162
|
+
ignorePatterns?: string[];
|
|
163
|
+
/** Maximum file size to process (bytes) */
|
|
164
|
+
maxFileSize?: number;
|
|
165
|
+
/** Number of parallel file processors */
|
|
166
|
+
parallelism?: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* GraphRAG configuration
|
|
170
|
+
*/
|
|
171
|
+
export interface GraphRAGOptions {
|
|
172
|
+
/** Community detection algorithm */
|
|
173
|
+
communityAlgorithm?: 'louvain' | 'label_propagation';
|
|
174
|
+
/** Minimum community size */
|
|
175
|
+
minCommunitySize?: number;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Graph query specification
|
|
179
|
+
* @see REQ-CG-GRF-003
|
|
180
|
+
*/
|
|
181
|
+
export interface GraphQuery {
|
|
182
|
+
/** Entity type filter */
|
|
183
|
+
entityTypes?: EntityType[];
|
|
184
|
+
/** Name pattern (glob or regex) */
|
|
185
|
+
namePattern?: string;
|
|
186
|
+
/** Namespace filter */
|
|
187
|
+
namespace?: string;
|
|
188
|
+
/** File path filter */
|
|
189
|
+
filePath?: string;
|
|
190
|
+
/** Relation type filter */
|
|
191
|
+
relationTypes?: RelationType[];
|
|
192
|
+
/** Relation direction */
|
|
193
|
+
relationDirection?: 'in' | 'out' | 'both';
|
|
194
|
+
/** Full-text search query */
|
|
195
|
+
textSearch?: string;
|
|
196
|
+
/** Include relationships in result */
|
|
197
|
+
includeRelations?: boolean;
|
|
198
|
+
/** Maximum results */
|
|
199
|
+
limit?: number;
|
|
200
|
+
/** Result offset */
|
|
201
|
+
offset?: number;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Query options for dependency analysis
|
|
205
|
+
*/
|
|
206
|
+
export interface DependencyOptions {
|
|
207
|
+
/** Maximum depth to traverse */
|
|
208
|
+
depth?: number;
|
|
209
|
+
/** Relation types to follow */
|
|
210
|
+
relationTypes?: RelationType[];
|
|
211
|
+
/** Include indirect dependencies */
|
|
212
|
+
includeIndirect?: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Local search options
|
|
216
|
+
*/
|
|
217
|
+
export interface LocalSearchOptions {
|
|
218
|
+
/** Search radius (hops) */
|
|
219
|
+
radius?: number;
|
|
220
|
+
/** Maximum results */
|
|
221
|
+
limit?: number;
|
|
222
|
+
/** Include community context */
|
|
223
|
+
includeCommunity?: boolean;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Global search options
|
|
227
|
+
*/
|
|
228
|
+
export interface GlobalSearchOptions {
|
|
229
|
+
/** Maximum results */
|
|
230
|
+
limit?: number;
|
|
231
|
+
/** Minimum relevance score */
|
|
232
|
+
minScore?: number;
|
|
233
|
+
/** Include community summaries */
|
|
234
|
+
includeSummaries?: boolean;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Query result
|
|
238
|
+
* @see REQ-CG-API-004
|
|
239
|
+
*/
|
|
240
|
+
export interface QueryResult {
|
|
241
|
+
/** Matched entities */
|
|
242
|
+
entities: Entity[];
|
|
243
|
+
/** Related relationships */
|
|
244
|
+
relations: Relation[];
|
|
245
|
+
/** Total count (before pagination) */
|
|
246
|
+
totalCount: number;
|
|
247
|
+
/** Whether more results exist */
|
|
248
|
+
hasMore: boolean;
|
|
249
|
+
/** Query execution time (ms) */
|
|
250
|
+
queryTimeMs?: number;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Index operation result
|
|
254
|
+
* @see REQ-CG-IDX-001
|
|
255
|
+
*/
|
|
256
|
+
export interface IndexResult {
|
|
257
|
+
/** Whether indexing succeeded */
|
|
258
|
+
success: boolean;
|
|
259
|
+
/** Number of entities indexed */
|
|
260
|
+
entitiesIndexed: number;
|
|
261
|
+
/** Number of relations indexed */
|
|
262
|
+
relationsIndexed: number;
|
|
263
|
+
/** Number of files processed */
|
|
264
|
+
filesProcessed: number;
|
|
265
|
+
/** Indexing duration (ms) */
|
|
266
|
+
durationMs: number;
|
|
267
|
+
/** Errors encountered */
|
|
268
|
+
errors: IndexError[];
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Index error
|
|
272
|
+
*/
|
|
273
|
+
export interface IndexError {
|
|
274
|
+
/** File path */
|
|
275
|
+
filePath: string;
|
|
276
|
+
/** Error message */
|
|
277
|
+
message: string;
|
|
278
|
+
/** Line number (if applicable) */
|
|
279
|
+
line?: number;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Parse result
|
|
283
|
+
* @see REQ-CG-AST-003
|
|
284
|
+
*/
|
|
285
|
+
export interface ParseResult {
|
|
286
|
+
/** Extracted entities */
|
|
287
|
+
entities: Entity[];
|
|
288
|
+
/** Extracted relations */
|
|
289
|
+
relations: Relation[];
|
|
290
|
+
/** Parse errors */
|
|
291
|
+
errors: ParseError[];
|
|
292
|
+
/** Statistics */
|
|
293
|
+
stats: {
|
|
294
|
+
linesOfCode: number;
|
|
295
|
+
parseTimeMs: number;
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Parse error
|
|
300
|
+
*/
|
|
301
|
+
export interface ParseError {
|
|
302
|
+
/** Error message */
|
|
303
|
+
message: string;
|
|
304
|
+
/** Line number */
|
|
305
|
+
line?: number;
|
|
306
|
+
/** Column number */
|
|
307
|
+
column?: number;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Graph statistics
|
|
311
|
+
* @see REQ-CG-API-004
|
|
312
|
+
*/
|
|
313
|
+
export interface GraphStatistics {
|
|
314
|
+
/** Total entity count */
|
|
315
|
+
entityCount: number;
|
|
316
|
+
/** Total relation count */
|
|
317
|
+
relationCount: number;
|
|
318
|
+
/** Number of files */
|
|
319
|
+
fileCount: number;
|
|
320
|
+
/** Number of communities */
|
|
321
|
+
communityCount: number;
|
|
322
|
+
/** Entities by type */
|
|
323
|
+
entitiesByType: Partial<Record<EntityType, number>>;
|
|
324
|
+
/** Relations by type */
|
|
325
|
+
relationsByType: Partial<Record<RelationType, number>>;
|
|
326
|
+
/** Languages detected */
|
|
327
|
+
languages: Language[];
|
|
328
|
+
/** Index timestamp */
|
|
329
|
+
indexedAt?: Date;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Call path in call graph
|
|
333
|
+
*/
|
|
334
|
+
export interface CallPath {
|
|
335
|
+
/** Source entity */
|
|
336
|
+
from: Entity;
|
|
337
|
+
/** Target entity */
|
|
338
|
+
to: Entity;
|
|
339
|
+
/** Path of entities */
|
|
340
|
+
path: Entity[];
|
|
341
|
+
/** Call site information */
|
|
342
|
+
callSites: CallSite[];
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Call site information
|
|
346
|
+
*/
|
|
347
|
+
export interface CallSite {
|
|
348
|
+
/** File path */
|
|
349
|
+
filePath: string;
|
|
350
|
+
/** Line number */
|
|
351
|
+
line: number;
|
|
352
|
+
/** Column number */
|
|
353
|
+
column?: number;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Module analysis result
|
|
357
|
+
*/
|
|
358
|
+
export interface ModuleAnalysis {
|
|
359
|
+
/** File path */
|
|
360
|
+
filePath: string;
|
|
361
|
+
/** Module name */
|
|
362
|
+
moduleName: string;
|
|
363
|
+
/** Entities in module */
|
|
364
|
+
entities: Entity[];
|
|
365
|
+
/** Import statements */
|
|
366
|
+
imports: Entity[];
|
|
367
|
+
/** Export statements */
|
|
368
|
+
exports: Entity[];
|
|
369
|
+
/** Dependencies */
|
|
370
|
+
dependencies: string[];
|
|
371
|
+
/** Dependents */
|
|
372
|
+
dependents: string[];
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Code snippet
|
|
376
|
+
*/
|
|
377
|
+
export interface CodeSnippet {
|
|
378
|
+
/** Entity ID */
|
|
379
|
+
entityId: string;
|
|
380
|
+
/** Source code */
|
|
381
|
+
code: string;
|
|
382
|
+
/** Language */
|
|
383
|
+
language: Language;
|
|
384
|
+
/** File path */
|
|
385
|
+
filePath: string;
|
|
386
|
+
/** Start line */
|
|
387
|
+
startLine: number;
|
|
388
|
+
/** End line */
|
|
389
|
+
endLine: number;
|
|
390
|
+
/** Context (surrounding code) */
|
|
391
|
+
context?: {
|
|
392
|
+
before: string;
|
|
393
|
+
after: string;
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* File structure
|
|
398
|
+
*/
|
|
399
|
+
export interface FileStructure {
|
|
400
|
+
/** File path */
|
|
401
|
+
filePath: string;
|
|
402
|
+
/** Language */
|
|
403
|
+
language: Language;
|
|
404
|
+
/** Entities in file */
|
|
405
|
+
entities: Entity[];
|
|
406
|
+
/** Lines of code */
|
|
407
|
+
linesOfCode: number;
|
|
408
|
+
/** Import count */
|
|
409
|
+
importCount: number;
|
|
410
|
+
/** Export count */
|
|
411
|
+
exportCount: number;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Search result (GraphRAG)
|
|
415
|
+
* @see REQ-CG-RAG-002
|
|
416
|
+
*/
|
|
417
|
+
export interface SearchResult {
|
|
418
|
+
/** Matched entity */
|
|
419
|
+
entity: Entity;
|
|
420
|
+
/** Relevance score (0-1) */
|
|
421
|
+
score: number;
|
|
422
|
+
/** Context snippet */
|
|
423
|
+
context: string;
|
|
424
|
+
/** Community information */
|
|
425
|
+
community?: Community;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Code community (GraphRAG)
|
|
429
|
+
* @see REQ-CG-RAG-001
|
|
430
|
+
*/
|
|
431
|
+
export interface Community {
|
|
432
|
+
/** Community ID */
|
|
433
|
+
id: string;
|
|
434
|
+
/** Community name/label */
|
|
435
|
+
name: string;
|
|
436
|
+
/** Member count */
|
|
437
|
+
memberCount: number;
|
|
438
|
+
/** Community summary */
|
|
439
|
+
summary?: string;
|
|
440
|
+
/** Key entities */
|
|
441
|
+
keyEntities: string[];
|
|
442
|
+
/** Parent community ID */
|
|
443
|
+
parentId?: string;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Storage adapter interface
|
|
447
|
+
* @see REQ-CG-API-005
|
|
448
|
+
* @see DES-CG-006
|
|
449
|
+
*/
|
|
450
|
+
export interface StorageAdapter {
|
|
451
|
+
saveEntity(entity: Entity): Promise<void>;
|
|
452
|
+
getEntity(id: string): Promise<Entity | null>;
|
|
453
|
+
queryEntities(query: GraphQuery): Promise<Entity[]>;
|
|
454
|
+
deleteEntity(id: string): Promise<void>;
|
|
455
|
+
saveRelation(relation: Relation): Promise<void>;
|
|
456
|
+
getRelations(entityId: string, direction?: 'in' | 'out' | 'both'): Promise<Relation[]>;
|
|
457
|
+
deleteRelation(id: string): Promise<void>;
|
|
458
|
+
bulkSave(entities: Entity[], relations: Relation[]): Promise<void>;
|
|
459
|
+
clear(): Promise<void>;
|
|
460
|
+
getStats(): Promise<StorageStats>;
|
|
461
|
+
initialize(): Promise<void>;
|
|
462
|
+
close(): Promise<void>;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Storage statistics
|
|
466
|
+
*/
|
|
467
|
+
export interface StorageStats {
|
|
468
|
+
entityCount: number;
|
|
469
|
+
relationCount: number;
|
|
470
|
+
fileCount: number;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* CodeGraph event types
|
|
474
|
+
* @see REQ-CG-API-006
|
|
475
|
+
*/
|
|
476
|
+
export interface CodeGraphEvents extends Record<string, unknown> {
|
|
477
|
+
'indexing:start': {
|
|
478
|
+
path: string;
|
|
479
|
+
timestamp: Date;
|
|
480
|
+
};
|
|
481
|
+
'indexing:progress': {
|
|
482
|
+
processed: number;
|
|
483
|
+
total: number;
|
|
484
|
+
currentFile: string;
|
|
485
|
+
};
|
|
486
|
+
'indexing:complete': IndexResult;
|
|
487
|
+
'indexing:error': {
|
|
488
|
+
error: Error;
|
|
489
|
+
file?: string;
|
|
490
|
+
};
|
|
491
|
+
'query:start': {
|
|
492
|
+
query: GraphQuery;
|
|
493
|
+
};
|
|
494
|
+
'query:complete': {
|
|
495
|
+
result: QueryResult;
|
|
496
|
+
durationMs: number;
|
|
497
|
+
};
|
|
498
|
+
'entity:added': {
|
|
499
|
+
entity: Entity;
|
|
500
|
+
};
|
|
501
|
+
'entity:updated': {
|
|
502
|
+
entity: Entity;
|
|
503
|
+
};
|
|
504
|
+
'entity:deleted': {
|
|
505
|
+
entityId: string;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Index progress information
|
|
510
|
+
*/
|
|
511
|
+
export interface IndexProgress {
|
|
512
|
+
/** Files processed so far */
|
|
513
|
+
processed: number;
|
|
514
|
+
/** Total files to process */
|
|
515
|
+
total: number;
|
|
516
|
+
/** Current file being processed */
|
|
517
|
+
currentFile: string;
|
|
518
|
+
/** Progress percentage (0-100) */
|
|
519
|
+
percentage: number;
|
|
520
|
+
/** Estimated time remaining (ms) */
|
|
521
|
+
estimatedRemainingMs?: number;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Generate entity ID
|
|
525
|
+
*/
|
|
526
|
+
export declare function generateEntityId(type: EntityType, name: string, filePath?: string): string;
|
|
527
|
+
/**
|
|
528
|
+
* Generate relation ID
|
|
529
|
+
*/
|
|
530
|
+
export declare function generateRelationId(sourceId: string, targetId: string, type: RelationType): string;
|
|
531
|
+
/**
|
|
532
|
+
* Check if language is supported
|
|
533
|
+
*/
|
|
534
|
+
export declare function isSupportedLanguage(lang: string): lang is Language;
|
|
535
|
+
/**
|
|
536
|
+
* Get language from file extension
|
|
537
|
+
*/
|
|
538
|
+
export declare function getLanguageFromExtension(filePath: string): Language | null;
|
|
539
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,MAAM,GACN,IAAI,GACJ,MAAM,GACN,KAAK,GACL,QAAQ,GACR,GAAG,GACH,KAAK,GACL,MAAM,GACN,KAAK,GACL,QAAQ,GACR,OAAO,GACP,OAAO,GACP,KAAK,CAAC;AAEV;;GAEG;AACH,eAAO,MAAM,mB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AG,MAAM,CAG1F;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAEjG;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,QAAQ,CAMlE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAG1E"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nahisaho/musubix-codegraph - Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
* @module @nahisaho/musubix-codegraph
|
|
6
|
+
*
|
|
7
|
+
* @see REQ-CG-API-004
|
|
8
|
+
* @see DES-CG-010
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* File extension to language mapping
|
|
12
|
+
*/
|
|
13
|
+
export const LANGUAGE_EXTENSIONS = {
|
|
14
|
+
'.ts': 'typescript',
|
|
15
|
+
'.tsx': 'typescript',
|
|
16
|
+
'.js': 'javascript',
|
|
17
|
+
'.jsx': 'javascript',
|
|
18
|
+
'.mjs': 'javascript',
|
|
19
|
+
'.cjs': 'javascript',
|
|
20
|
+
'.py': 'python',
|
|
21
|
+
'.pyw': 'python',
|
|
22
|
+
'.rs': 'rust',
|
|
23
|
+
'.go': 'go',
|
|
24
|
+
'.java': 'java',
|
|
25
|
+
'.php': 'php',
|
|
26
|
+
'.cs': 'csharp',
|
|
27
|
+
'.c': 'c',
|
|
28
|
+
'.h': 'c',
|
|
29
|
+
'.cpp': 'cpp',
|
|
30
|
+
'.hpp': 'cpp',
|
|
31
|
+
'.cc': 'cpp',
|
|
32
|
+
'.cxx': 'cpp',
|
|
33
|
+
'.rb': 'ruby',
|
|
34
|
+
'.tf': 'hcl',
|
|
35
|
+
'.hcl': 'hcl',
|
|
36
|
+
'.kt': 'kotlin',
|
|
37
|
+
'.kts': 'kotlin',
|
|
38
|
+
'.swift': 'swift',
|
|
39
|
+
'.scala': 'scala',
|
|
40
|
+
'.sc': 'scala',
|
|
41
|
+
'.lua': 'lua',
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Default CodeGraph options
|
|
45
|
+
*/
|
|
46
|
+
export const DEFAULT_CODEGRAPH_OPTIONS = {
|
|
47
|
+
parser: {
|
|
48
|
+
languages: ['typescript', 'javascript', 'python'],
|
|
49
|
+
includeComments: true,
|
|
50
|
+
extractDocstrings: true,
|
|
51
|
+
},
|
|
52
|
+
graph: {
|
|
53
|
+
maxDepth: 10,
|
|
54
|
+
enableCaching: true,
|
|
55
|
+
},
|
|
56
|
+
indexer: {
|
|
57
|
+
ignorePatterns: ['node_modules', '.git', 'dist', 'build', '__pycache__', '.venv'],
|
|
58
|
+
maxFileSize: 1024 * 1024, // 1MB
|
|
59
|
+
parallelism: 4,
|
|
60
|
+
},
|
|
61
|
+
graphrag: {
|
|
62
|
+
communityAlgorithm: 'louvain',
|
|
63
|
+
minCommunitySize: 3,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
// ============================================================================
|
|
67
|
+
// Utility Types
|
|
68
|
+
// ============================================================================
|
|
69
|
+
/**
|
|
70
|
+
* Generate entity ID
|
|
71
|
+
*/
|
|
72
|
+
export function generateEntityId(type, name, filePath) {
|
|
73
|
+
const base = filePath ? `${filePath}:${name}` : name;
|
|
74
|
+
return `${type}:${base}`.replace(/[^a-zA-Z0-9:._-]/g, '_');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Generate relation ID
|
|
78
|
+
*/
|
|
79
|
+
export function generateRelationId(sourceId, targetId, type) {
|
|
80
|
+
return `${sourceId}-${type}-${targetId}`;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if language is supported
|
|
84
|
+
*/
|
|
85
|
+
export function isSupportedLanguage(lang) {
|
|
86
|
+
const supported = [
|
|
87
|
+
'typescript', 'javascript', 'python', 'rust', 'go', 'java',
|
|
88
|
+
'php', 'csharp', 'c', 'cpp', 'ruby', 'hcl', 'kotlin', 'swift', 'scala', 'lua'
|
|
89
|
+
];
|
|
90
|
+
return supported.includes(lang);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get language from file extension
|
|
94
|
+
*/
|
|
95
|
+
export function getLanguageFromExtension(filePath) {
|
|
96
|
+
const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase();
|
|
97
|
+
return LANGUAGE_EXTENSIONS[ext] ?? null;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4BH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA6B;IAC3D,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,QAAQ;IACf,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,OAAO;IACjB,K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