@zipbul/gildash 0.5.1 → 0.6.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.ko.md +28 -6
- package/README.md +29 -5
- package/dist/index.js +7 -5
- package/dist/index.js.map +42 -28
- package/dist/migrations/0003_majestic_mongu.sql +1 -0
- package/dist/migrations/0004_cool_firestar.sql +23 -0
- package/dist/migrations/meta/0003_snapshot.json +422 -0
- package/dist/migrations/meta/0004_snapshot.json +429 -0
- package/dist/migrations/meta/_journal.json +14 -0
- package/dist/src/errors.d.ts +1 -1
- package/dist/src/extractor/relation-extractor.d.ts +2 -1
- package/dist/src/gildash/context.d.ts +91 -0
- package/dist/src/gildash/extract-api.d.ts +9 -0
- package/dist/src/gildash/graph-api.d.ts +30 -0
- package/dist/src/gildash/index.d.ts +92 -0
- package/dist/src/gildash/lifecycle.d.ts +62 -0
- package/dist/src/gildash/misc-api.d.ts +22 -0
- package/dist/src/gildash/parse-api.d.ts +11 -0
- package/dist/src/gildash/query-api.d.ts +35 -0
- package/dist/src/gildash/semantic-api.d.ts +22 -0
- package/dist/src/gildash/types.d.ts +160 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/indexer/index-coordinator.d.ts +8 -2
- package/dist/src/indexer/relation-indexer.d.ts +6 -0
- package/dist/src/search/dependency-graph.d.ts +1 -0
- package/dist/src/search/relation-search.d.ts +11 -1
- package/dist/src/search/symbol-search.d.ts +6 -0
- package/dist/src/semantic/ast-node-utils.d.ts +9 -0
- package/dist/src/semantic/implementation-finder.d.ts +22 -0
- package/dist/src/semantic/index.d.ts +68 -0
- package/dist/src/semantic/reference-resolver.d.ts +19 -0
- package/dist/src/semantic/symbol-graph.d.ts +36 -0
- package/dist/src/semantic/tsc-program.d.ts +67 -0
- package/dist/src/semantic/type-collector.d.ts +27 -0
- package/dist/src/semantic/types.d.ts +103 -0
- package/dist/src/store/repositories/relation.repository.d.ts +14 -2
- package/dist/src/store/repositories/symbol.repository.d.ts +2 -0
- package/dist/src/store/schema.d.ts +38 -0
- package/package.json +3 -2
- package/dist/src/gildash.d.ts +0 -821
package/dist/src/gildash.d.ts
DELETED
|
@@ -1,821 +0,0 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
|
-
import type { ParsedFile } from './parser/types';
|
|
3
|
-
import { parseSource as defaultParseSource } from './parser/parse-source';
|
|
4
|
-
import { ParseCache } from './parser/parse-cache';
|
|
5
|
-
import type { ExtractedSymbol, SymbolKind, CodeRelation } from './extractor/types';
|
|
6
|
-
import { extractSymbols as defaultExtractSymbols } from './extractor/symbol-extractor';
|
|
7
|
-
import { extractRelations as defaultExtractRelations } from './extractor/relation-extractor';
|
|
8
|
-
import { DbConnection } from './store/connection';
|
|
9
|
-
import { FileRepository } from './store/repositories/file.repository';
|
|
10
|
-
import type { FileRecord } from './store/repositories/file.repository';
|
|
11
|
-
import { SymbolRepository } from './store/repositories/symbol.repository';
|
|
12
|
-
import { RelationRepository } from './store/repositories/relation.repository';
|
|
13
|
-
import { ProjectWatcher } from './watcher/project-watcher';
|
|
14
|
-
import { IndexCoordinator } from './indexer/index-coordinator';
|
|
15
|
-
import type { IndexResult } from './indexer/index-coordinator';
|
|
16
|
-
import type { FileChangeEvent } from './watcher/types';
|
|
17
|
-
import { acquireWatcherRole, releaseWatcherRole, updateHeartbeat } from './watcher/ownership';
|
|
18
|
-
import type { WatcherOwnerStore } from './watcher/ownership';
|
|
19
|
-
import { discoverProjects } from './common/project-discovery';
|
|
20
|
-
import type { ProjectBoundary } from './common/project-discovery';
|
|
21
|
-
import { loadTsconfigPaths } from './common/tsconfig-resolver';
|
|
22
|
-
import type { TsconfigPaths } from './common/tsconfig-resolver';
|
|
23
|
-
import type { ParserOptions } from 'oxc-parser';
|
|
24
|
-
import { symbolSearch as defaultSymbolSearch } from './search/symbol-search';
|
|
25
|
-
import type { SymbolSearchQuery, SymbolSearchResult } from './search/symbol-search';
|
|
26
|
-
import { relationSearch as defaultRelationSearch } from './search/relation-search';
|
|
27
|
-
import type { RelationSearchQuery } from './search/relation-search';
|
|
28
|
-
import type { SymbolStats } from './store/repositories/symbol.repository';
|
|
29
|
-
import type { PatternMatch } from './search/pattern-search';
|
|
30
|
-
import { type GildashError } from './errors';
|
|
31
|
-
/**
|
|
32
|
-
* Minimal logger interface accepted by {@link Gildash}.
|
|
33
|
-
*
|
|
34
|
-
* Any object with an `error` method (including `console`) satisfies this interface.
|
|
35
|
-
*/
|
|
36
|
-
export interface Logger {
|
|
37
|
-
/** Log one or more error-level messages. */
|
|
38
|
-
error(...args: unknown[]): void;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Result of a {@link Gildash.diffSymbols} call.
|
|
42
|
-
*/
|
|
43
|
-
export interface SymbolDiff {
|
|
44
|
-
/** Symbols present in `after` but not in `before`. */
|
|
45
|
-
added: SymbolSearchResult[];
|
|
46
|
-
/** Symbols present in `before` but not in `after`. */
|
|
47
|
-
removed: SymbolSearchResult[];
|
|
48
|
-
/** Symbols present in both but with a different `fingerprint`. */
|
|
49
|
-
modified: Array<{
|
|
50
|
-
before: SymbolSearchResult;
|
|
51
|
-
after: SymbolSearchResult;
|
|
52
|
-
}>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Public interface of a module — its exported symbols with key metadata.
|
|
56
|
-
* Returned by {@link Gildash.getModuleInterface}.
|
|
57
|
-
*/
|
|
58
|
-
export interface ModuleInterface {
|
|
59
|
-
filePath: string;
|
|
60
|
-
exports: Array<{
|
|
61
|
-
name: string;
|
|
62
|
-
kind: SymbolKind;
|
|
63
|
-
parameters?: string;
|
|
64
|
-
returnType?: string;
|
|
65
|
-
jsDoc?: string;
|
|
66
|
-
}>;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* A node in the heritage chain tree returned by {@link Gildash.getHeritageChain}.
|
|
70
|
-
*/
|
|
71
|
-
export interface HeritageNode {
|
|
72
|
-
symbolName: string;
|
|
73
|
-
filePath: string;
|
|
74
|
-
/** Relationship kind (`extends` or `implements`). Undefined for the root query node. */
|
|
75
|
-
kind?: 'extends' | 'implements';
|
|
76
|
-
children: HeritageNode[];
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Full symbol detail including members, documentation, and type information.
|
|
80
|
-
* Returned by {@link Gildash.getFullSymbol}.
|
|
81
|
-
*/
|
|
82
|
-
export interface FullSymbol extends SymbolSearchResult {
|
|
83
|
-
members?: Array<{
|
|
84
|
-
name: string;
|
|
85
|
-
kind: string;
|
|
86
|
-
type?: string;
|
|
87
|
-
visibility?: string;
|
|
88
|
-
isStatic?: boolean;
|
|
89
|
-
isReadonly?: boolean;
|
|
90
|
-
}>;
|
|
91
|
-
/** JSDoc comment attached to the symbol. */
|
|
92
|
-
jsDoc?: string;
|
|
93
|
-
/** Stringified parameter list (functions/methods). */
|
|
94
|
-
parameters?: string;
|
|
95
|
-
/** Stringified return type (functions/methods). */
|
|
96
|
-
returnType?: string;
|
|
97
|
-
/** Superclass/interface names (classes/interfaces with heritage). */
|
|
98
|
-
heritage?: string[];
|
|
99
|
-
/** Decorators applied to the symbol. */
|
|
100
|
-
decorators?: Array<{
|
|
101
|
-
name: string;
|
|
102
|
-
arguments?: string;
|
|
103
|
-
}>;
|
|
104
|
-
/** Stringified type parameters (generic symbols). */
|
|
105
|
-
typeParameters?: string;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* File-level statistics for an indexed file.
|
|
109
|
-
* Returned by {@link Gildash.getFileStats}.
|
|
110
|
-
*/
|
|
111
|
-
export interface FileStats {
|
|
112
|
-
/** Absolute file path. */
|
|
113
|
-
filePath: string;
|
|
114
|
-
/** Number of lines in the file at the time of last indexing. */
|
|
115
|
-
lineCount: number;
|
|
116
|
-
/** Number of symbols indexed in the file. */
|
|
117
|
-
symbolCount: number;
|
|
118
|
-
/** Number of outgoing relations (imports, calls, etc.) from the file. */
|
|
119
|
-
relationCount: number;
|
|
120
|
-
/** File size in bytes at the time of last indexing. */
|
|
121
|
-
size: number;
|
|
122
|
-
/** Number of exported symbols in the file. */
|
|
123
|
-
exportedSymbolCount: number;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Import-graph fan metrics for a single file.
|
|
127
|
-
* Returned by {@link Gildash.getFanMetrics}.
|
|
128
|
-
*/
|
|
129
|
-
export interface FanMetrics {
|
|
130
|
-
/** Absolute file path queried. */
|
|
131
|
-
filePath: string;
|
|
132
|
-
/** Number of files that import this file (fan-in). */
|
|
133
|
-
fanIn: number;
|
|
134
|
-
/** Number of files this file imports (fan-out). */
|
|
135
|
-
fanOut: number;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Result of following a re-export chain to the original symbol definition.
|
|
139
|
-
*/
|
|
140
|
-
export interface ResolvedSymbol {
|
|
141
|
-
/** The name of the symbol at the end of the re-export chain (may differ from the queried name due to aliasing). */
|
|
142
|
-
originalName: string;
|
|
143
|
-
/** Absolute path of the file that originally defines the symbol. */
|
|
144
|
-
originalFilePath: string;
|
|
145
|
-
/** Ordered list of re-export hops between the queried file and the original definition. */
|
|
146
|
-
reExportChain: Array<{
|
|
147
|
-
filePath: string;
|
|
148
|
-
exportedAs: string;
|
|
149
|
-
}>;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Options for creating a {@link Gildash} instance via {@link Gildash.open}.
|
|
153
|
-
*
|
|
154
|
-
* @example
|
|
155
|
-
* ```ts
|
|
156
|
-
* import { isErr } from '@zipbul/result';
|
|
157
|
-
*
|
|
158
|
-
* const result = await Gildash.open({
|
|
159
|
-
* projectRoot: '/absolute/path/to/project',
|
|
160
|
-
* extensions: ['.ts', '.tsx'],
|
|
161
|
-
* ignorePatterns: ['vendor'],
|
|
162
|
-
* });
|
|
163
|
-
* if (isErr(result)) {
|
|
164
|
-
* console.error(result.data.message);
|
|
165
|
-
* process.exit(1);
|
|
166
|
-
* }
|
|
167
|
-
* const ledger = result;
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
export interface GildashOptions {
|
|
171
|
-
/** Absolute path to the project root directory. */
|
|
172
|
-
projectRoot: string;
|
|
173
|
-
/** File extensions to index. Defaults to `['.ts', '.mts', '.cts']`. */
|
|
174
|
-
extensions?: string[];
|
|
175
|
-
/** Glob patterns to ignore during indexing. */
|
|
176
|
-
ignorePatterns?: string[];
|
|
177
|
-
/** Maximum number of parsed ASTs to keep in the LRU cache. Defaults to `500`. */
|
|
178
|
-
parseCacheCapacity?: number;
|
|
179
|
-
/** Logger for error output. Defaults to `console`. */
|
|
180
|
-
logger?: Logger;
|
|
181
|
-
/**
|
|
182
|
-
* When `false`, disables the file watcher and runs in scan-only mode:
|
|
183
|
-
* ownership contention is skipped, heartbeat and signal handlers are not
|
|
184
|
-
* registered, and only the initial `fullIndex()` is performed.
|
|
185
|
-
*
|
|
186
|
-
* Set `cleanup: true` in {@link Gildash.close} to remove the database files
|
|
187
|
-
* after a one-shot scan.
|
|
188
|
-
*
|
|
189
|
-
* @default true
|
|
190
|
-
*/
|
|
191
|
-
watchMode?: boolean;
|
|
192
|
-
}
|
|
193
|
-
interface GildashInternalOptions {
|
|
194
|
-
existsSyncFn?: (p: string) => boolean;
|
|
195
|
-
dbConnectionFactory?: () => Pick<DbConnection, 'open' | 'close' | 'transaction'> & WatcherOwnerStore;
|
|
196
|
-
watcherFactory?: () => Pick<ProjectWatcher, 'start' | 'close'>;
|
|
197
|
-
coordinatorFactory?: () => Pick<IndexCoordinator, 'fullIndex' | 'shutdown' | 'onIndexed'> & {
|
|
198
|
-
tsconfigPaths?: Promise<TsconfigPaths | null>;
|
|
199
|
-
handleWatcherEvent?(event: FileChangeEvent): void;
|
|
200
|
-
};
|
|
201
|
-
repositoryFactory?: () => {
|
|
202
|
-
fileRepo: Pick<FileRepository, 'upsertFile' | 'getAllFiles' | 'getFilesMap' | 'deleteFile' | 'getFile'>;
|
|
203
|
-
symbolRepo: SymbolRepository;
|
|
204
|
-
relationRepo: RelationRepository;
|
|
205
|
-
parseCache: Pick<ParseCache, 'set' | 'get' | 'invalidate'>;
|
|
206
|
-
};
|
|
207
|
-
acquireWatcherRoleFn?: typeof acquireWatcherRole;
|
|
208
|
-
releaseWatcherRoleFn?: typeof releaseWatcherRole;
|
|
209
|
-
updateHeartbeatFn?: typeof updateHeartbeat;
|
|
210
|
-
discoverProjectsFn?: typeof discoverProjects;
|
|
211
|
-
parseSourceFn?: typeof defaultParseSource;
|
|
212
|
-
extractSymbolsFn?: typeof defaultExtractSymbols;
|
|
213
|
-
extractRelationsFn?: typeof defaultExtractRelations;
|
|
214
|
-
symbolSearchFn?: typeof defaultSymbolSearch;
|
|
215
|
-
relationSearchFn?: typeof defaultRelationSearch;
|
|
216
|
-
patternSearchFn?: (opts: {
|
|
217
|
-
pattern: string;
|
|
218
|
-
filePaths: string[];
|
|
219
|
-
}) => Promise<PatternMatch[]>;
|
|
220
|
-
loadTsconfigPathsFn?: typeof loadTsconfigPaths;
|
|
221
|
-
readFileFn?: (filePath: string) => Promise<string>;
|
|
222
|
-
unlinkFn?: (filePath: string) => Promise<void>;
|
|
223
|
-
makeExternalCoordinatorFn?: (packageDir: string, project: string) => {
|
|
224
|
-
fullIndex(): Promise<IndexResult>;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Main entry point for gildash.
|
|
229
|
-
*
|
|
230
|
-
* `Gildash` indexes TypeScript source code into a local SQLite database,
|
|
231
|
-
* watches for file changes, and provides search / dependency-graph queries.
|
|
232
|
-
*
|
|
233
|
-
* Every public method returns a `Result<T, GildashError>` — either the
|
|
234
|
-
* success value `T` directly, or an `Err<GildashError>` that can be checked
|
|
235
|
-
* with `isErr()` from `@zipbul/result`.
|
|
236
|
-
*
|
|
237
|
-
* Create an instance with the static {@link Gildash.open} factory.
|
|
238
|
-
* Always call {@link Gildash.close} when done to release resources.
|
|
239
|
-
*
|
|
240
|
-
* @example
|
|
241
|
-
* ```ts
|
|
242
|
-
* import { Gildash } from '@zipbul/gildash';
|
|
243
|
-
* import { isErr } from '@zipbul/result';
|
|
244
|
-
*
|
|
245
|
-
* const result = await Gildash.open({ projectRoot: '/my/project' });
|
|
246
|
-
* if (isErr(result)) {
|
|
247
|
-
* console.error(result.data.message);
|
|
248
|
-
* process.exit(1);
|
|
249
|
-
* }
|
|
250
|
-
* const ledger = result;
|
|
251
|
-
*
|
|
252
|
-
* const symbols = ledger.searchSymbols({ text: 'handle', kind: 'function' });
|
|
253
|
-
* if (!isErr(symbols)) {
|
|
254
|
-
* symbols.forEach(s => console.log(s.name));
|
|
255
|
-
* }
|
|
256
|
-
*
|
|
257
|
-
* await ledger.close();
|
|
258
|
-
* ```
|
|
259
|
-
*/
|
|
260
|
-
export declare class Gildash {
|
|
261
|
-
/** Absolute path to the indexed project root. */
|
|
262
|
-
readonly projectRoot: string;
|
|
263
|
-
private readonly db;
|
|
264
|
-
private readonly symbolRepo;
|
|
265
|
-
private readonly relationRepo;
|
|
266
|
-
private readonly fileRepo;
|
|
267
|
-
private readonly parseCache;
|
|
268
|
-
private coordinator;
|
|
269
|
-
private watcher;
|
|
270
|
-
private readonly releaseWatcherRoleFn;
|
|
271
|
-
private readonly parseSourceFn;
|
|
272
|
-
private readonly extractSymbolsFn;
|
|
273
|
-
private readonly extractRelationsFn;
|
|
274
|
-
private readonly symbolSearchFn;
|
|
275
|
-
private readonly relationSearchFn;
|
|
276
|
-
private readonly patternSearchFn;
|
|
277
|
-
private readonly readFileFn;
|
|
278
|
-
private readonly unlinkFn;
|
|
279
|
-
private readonly existsSyncFn;
|
|
280
|
-
private readonly makeExternalCoordinatorFn?;
|
|
281
|
-
private readonly logger;
|
|
282
|
-
private readonly defaultProject;
|
|
283
|
-
/** Current watcher role: `'owner'` (can reindex) or `'reader'` (read-only). */
|
|
284
|
-
readonly role: 'owner' | 'reader';
|
|
285
|
-
private timer;
|
|
286
|
-
private signalHandlers;
|
|
287
|
-
private closed;
|
|
288
|
-
private tsconfigPaths;
|
|
289
|
-
private boundaries;
|
|
290
|
-
private readonly onIndexedCallbacks;
|
|
291
|
-
/** Cached DependencyGraph — invalidated on each index run. */
|
|
292
|
-
private graphCache;
|
|
293
|
-
/** Project key of the cached graph (`project ?? '__cross__'`). */
|
|
294
|
-
private graphCacheKey;
|
|
295
|
-
private constructor();
|
|
296
|
-
/**
|
|
297
|
-
* Create and initialise a new `Gildash` instance.
|
|
298
|
-
*
|
|
299
|
-
* Opens (or creates) a SQLite database alongside the project root,
|
|
300
|
-
* discovers sub-projects, acquires a watcher role, performs initial indexing,
|
|
301
|
-
* and begins watching for file changes.
|
|
302
|
-
*
|
|
303
|
-
* @param options - Configuration for the instance.
|
|
304
|
-
* @returns A fully-initialised `Gildash` ready for queries, or an `Err<GildashError>` on failure.
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* ```ts
|
|
308
|
-
* const result = await Gildash.open({
|
|
309
|
-
* projectRoot: '/home/user/my-app',
|
|
310
|
-
* extensions: ['.ts', '.tsx'],
|
|
311
|
-
* });
|
|
312
|
-
* if (isErr(result)) { console.error(result.data.message); process.exit(1); }
|
|
313
|
-
* const ledger = result;
|
|
314
|
-
* ```
|
|
315
|
-
*/
|
|
316
|
-
static open(options: GildashOptions & GildashInternalOptions): Promise<Result<Gildash, GildashError>>;
|
|
317
|
-
/**
|
|
318
|
-
* Shut down the instance and release all resources.
|
|
319
|
-
*
|
|
320
|
-
* Stops the file watcher, shuts down the index coordinator,
|
|
321
|
-
* releases the watcher ownership role, and closes the database.
|
|
322
|
-
* Calling `close()` more than once is safe (subsequent calls are no-ops).
|
|
323
|
-
*
|
|
324
|
-
* @returns `void` on success, or `Err<GildashError>` with `type='close'` if one or more
|
|
325
|
-
* sub-systems failed during shutdown. The `cause` field contains an array of
|
|
326
|
-
* individual errors from each failed sub-system.
|
|
327
|
-
*
|
|
328
|
-
* @example
|
|
329
|
-
* ```ts
|
|
330
|
-
* const closeResult = await ledger.close();
|
|
331
|
-
* if (isErr(closeResult)) {
|
|
332
|
-
* console.error('Close failed:', closeResult.data.message);
|
|
333
|
-
* // closeResult.data.cause is unknown[] of per-subsystem errors
|
|
334
|
-
* }
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
close(opts?: {
|
|
338
|
-
cleanup?: boolean;
|
|
339
|
-
}): Promise<Result<void, GildashError>>;
|
|
340
|
-
/**
|
|
341
|
-
* Register a callback that fires after each indexing run completes.
|
|
342
|
-
*
|
|
343
|
-
* @param callback - Receives the {@link IndexResult} for the completed run.
|
|
344
|
-
* @returns An unsubscribe function. Call it to remove the listener.
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ```ts
|
|
348
|
-
* const off = ledger.onIndexed(result => {
|
|
349
|
-
* console.log(`Indexed ${result.filesProcessed} files`);
|
|
350
|
-
* });
|
|
351
|
-
* // later…
|
|
352
|
-
* off();
|
|
353
|
-
* ```
|
|
354
|
-
*/
|
|
355
|
-
onIndexed(callback: (result: IndexResult) => void): () => void;
|
|
356
|
-
/**
|
|
357
|
-
* Parse a TypeScript source string into an AST and cache the result.
|
|
358
|
-
*
|
|
359
|
-
* On success the result is automatically stored in the internal LRU parse cache
|
|
360
|
-
* so that subsequent calls to extraction methods can reuse it.
|
|
361
|
-
*
|
|
362
|
-
* @param filePath - File path used as the cache key and for diagnostics.
|
|
363
|
-
* @param sourceText - Raw TypeScript source code.
|
|
364
|
-
* @param options - Optional oxc-parser {@link ParserOptions} (e.g. `sourceType`, `lang`).
|
|
365
|
-
* @returns A {@link ParsedFile}, or `Err<GildashError>` with `type='closed'` if the instance
|
|
366
|
-
* is closed, or `type='parse'` if the parser fails.
|
|
367
|
-
*
|
|
368
|
-
* @example
|
|
369
|
-
* ```ts
|
|
370
|
-
* const parsed = ledger.parseSource('/project/src/app.ts', sourceCode);
|
|
371
|
-
* if (isErr(parsed)) {
|
|
372
|
-
* console.error(parsed.data.message); // e.g. "Failed to parse file: ..."
|
|
373
|
-
* return;
|
|
374
|
-
* }
|
|
375
|
-
* // parsed is now a ParsedFile
|
|
376
|
-
* const symbols = ledger.extractSymbols(parsed);
|
|
377
|
-
* ```
|
|
378
|
-
*/
|
|
379
|
-
parseSource(filePath: string, sourceText: string, options?: ParserOptions): Result<ParsedFile, GildashError>;
|
|
380
|
-
/**
|
|
381
|
-
* Extract all symbol declarations from a previously parsed file.
|
|
382
|
-
*
|
|
383
|
-
* Returns function, class, variable, type-alias, interface, and enum declarations
|
|
384
|
-
* found in the AST.
|
|
385
|
-
*
|
|
386
|
-
* @param parsed - A {@link ParsedFile} obtained from {@link parseSource}.
|
|
387
|
-
* @returns An array of {@link ExtractedSymbol} entries, or `Err<GildashError>` with
|
|
388
|
-
* `type='closed'` if the instance is closed.
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* ```ts
|
|
392
|
-
* const symbols = ledger.extractSymbols(parsed);
|
|
393
|
-
* if (isErr(symbols)) return;
|
|
394
|
-
* for (const sym of symbols) {
|
|
395
|
-
* console.log(`${sym.kind}: ${sym.name}`);
|
|
396
|
-
* }
|
|
397
|
-
* ```
|
|
398
|
-
*/
|
|
399
|
-
extractSymbols(parsed: ParsedFile): Result<ExtractedSymbol[], GildashError>;
|
|
400
|
-
/**
|
|
401
|
-
* Extract inter-file relationships (imports, calls, extends, implements)
|
|
402
|
-
* from a previously parsed file.
|
|
403
|
-
*
|
|
404
|
-
* If tsconfig path aliases were discovered during {@link Gildash.open},
|
|
405
|
-
* they are automatically applied when resolving import targets.
|
|
406
|
-
*
|
|
407
|
-
* @param parsed - A {@link ParsedFile} obtained from {@link parseSource}.
|
|
408
|
-
* @returns An array of {@link CodeRelation} entries, or `Err<GildashError>` with
|
|
409
|
-
* `type='closed'` if the instance is closed.
|
|
410
|
-
*
|
|
411
|
-
* @example
|
|
412
|
-
* ```ts
|
|
413
|
-
* const relations = ledger.extractRelations(parsed);
|
|
414
|
-
* if (isErr(relations)) return;
|
|
415
|
-
* const imports = relations.filter(r => r.type === 'imports');
|
|
416
|
-
* ```
|
|
417
|
-
*/
|
|
418
|
-
extractRelations(parsed: ParsedFile): Result<CodeRelation[], GildashError>;
|
|
419
|
-
/** Invalidate the cached DependencyGraph (called after every index run). */
|
|
420
|
-
private invalidateGraphCache;
|
|
421
|
-
/**
|
|
422
|
-
* Return a cached or freshly-built {@link DependencyGraph} for the given project.
|
|
423
|
-
*
|
|
424
|
-
* Builds once per `project ?? '__cross__'` key; subsequent calls with the same key
|
|
425
|
-
* return the cached instance. Cache is invalidated by {@link invalidateGraphCache}.
|
|
426
|
-
*/
|
|
427
|
-
private getOrBuildGraph;
|
|
428
|
-
/**
|
|
429
|
-
* Trigger a full re-index of all tracked files.
|
|
430
|
-
*
|
|
431
|
-
* Only available to the instance that holds the *owner* role.
|
|
432
|
-
* Reader instances receive `Err<GildashError>` with `type='closed'`.
|
|
433
|
-
*
|
|
434
|
-
* @returns An {@link IndexResult} summary on success, or `Err<GildashError>` with
|
|
435
|
-
* `type='closed'` if the instance is closed / reader,
|
|
436
|
-
* `type='index'` if the indexing pipeline fails.
|
|
437
|
-
*
|
|
438
|
-
* @example
|
|
439
|
-
* ```ts
|
|
440
|
-
* const result = await ledger.reindex();
|
|
441
|
-
* if (isErr(result)) {
|
|
442
|
-
* console.error(result.data.message);
|
|
443
|
-
* return;
|
|
444
|
-
* }
|
|
445
|
-
* console.log(`Indexed ${result.indexedFiles} files in ${result.durationMs}ms`);
|
|
446
|
-
* ```
|
|
447
|
-
*/
|
|
448
|
-
reindex(): Promise<Result<IndexResult, GildashError>>;
|
|
449
|
-
/**
|
|
450
|
-
* Discovered project boundaries within the project root.
|
|
451
|
-
*
|
|
452
|
-
* Each entry contains a project name and its root directory.
|
|
453
|
-
*/
|
|
454
|
-
get projects(): ProjectBoundary[];
|
|
455
|
-
/**
|
|
456
|
-
* Return aggregate symbol statistics for the given project.
|
|
457
|
-
*
|
|
458
|
-
* @param project - Project name. Defaults to the auto-discovered primary project.
|
|
459
|
-
* @returns A {@link SymbolStats} object with counts grouped by symbol kind,
|
|
460
|
-
* or `Err<GildashError>` with `type='closed'` if the instance is closed,
|
|
461
|
-
* `type='store'` if the database query fails.
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* ```ts
|
|
465
|
-
* const stats = ledger.getStats();
|
|
466
|
-
* if (isErr(stats)) return;
|
|
467
|
-
* console.log(`Files: ${stats.fileCount}, Symbols: ${stats.symbolCount}`);
|
|
468
|
-
* ```
|
|
469
|
-
*/
|
|
470
|
-
getStats(project?: string): Result<SymbolStats, GildashError>;
|
|
471
|
-
/**
|
|
472
|
-
* Search indexed symbols by name, kind, file path, or export status.
|
|
473
|
-
*
|
|
474
|
-
* @param query - Search filters (see {@link SymbolSearchQuery}). All fields are optional;
|
|
475
|
-
* omitted fields match everything.
|
|
476
|
-
* @returns An array of {@link SymbolSearchResult} entries, or `Err<GildashError>` with
|
|
477
|
-
* `type='closed'` if the instance is closed,
|
|
478
|
-
* `type='search'` if the query fails.
|
|
479
|
-
*
|
|
480
|
-
* @example
|
|
481
|
-
* ```ts
|
|
482
|
-
* const fns = ledger.searchSymbols({ kind: 'function', isExported: true });
|
|
483
|
-
* if (isErr(fns)) return;
|
|
484
|
-
* fns.forEach(fn => console.log(fn.name, fn.filePath));
|
|
485
|
-
* ```
|
|
486
|
-
*/
|
|
487
|
-
searchSymbols(query: SymbolSearchQuery): Result<SymbolSearchResult[], GildashError>;
|
|
488
|
-
/**
|
|
489
|
-
* Search indexed code relationships (imports, calls, extends, implements).
|
|
490
|
-
*
|
|
491
|
-
* @param query - Search filters (see {@link RelationSearchQuery}). All fields are optional.
|
|
492
|
-
* @returns An array of {@link CodeRelation} entries, or `Err<GildashError>` with
|
|
493
|
-
* `type='closed'` if the instance is closed,
|
|
494
|
-
* `type='search'` if the query fails.
|
|
495
|
-
*
|
|
496
|
-
* @example
|
|
497
|
-
* ```ts
|
|
498
|
-
* const rels = ledger.searchRelations({ srcFilePath: 'src/app.ts', type: 'imports' });
|
|
499
|
-
* if (isErr(rels)) return;
|
|
500
|
-
* rels.forEach(r => console.log(`${r.srcFilePath} -> ${r.dstFilePath}`));
|
|
501
|
-
* ```
|
|
502
|
-
*/
|
|
503
|
-
searchRelations(query: RelationSearchQuery): Result<CodeRelation[], GildashError>;
|
|
504
|
-
/**
|
|
505
|
-
* Search symbols across all projects (no project filter).
|
|
506
|
-
*
|
|
507
|
-
* @param query - Search filters (see {@link SymbolSearchQuery}). The `project` field is ignored.
|
|
508
|
-
* @returns An array of {@link SymbolSearchResult} entries, or `Err<GildashError>` with
|
|
509
|
-
* `type='closed'` if the instance is closed,
|
|
510
|
-
* `type='search'` if the query fails.
|
|
511
|
-
*/
|
|
512
|
-
searchAllSymbols(query: Omit<SymbolSearchQuery, 'project'> & {
|
|
513
|
-
project?: string;
|
|
514
|
-
}): Result<SymbolSearchResult[], GildashError>;
|
|
515
|
-
/**
|
|
516
|
-
* Search relations across all projects (no project filter).
|
|
517
|
-
*
|
|
518
|
-
* @param query - Search filters (see {@link RelationSearchQuery}). The `project` field is ignored.
|
|
519
|
-
* @returns An array of {@link CodeRelation} entries, or `Err<GildashError>` with
|
|
520
|
-
* `type='closed'` if the instance is closed,
|
|
521
|
-
* `type='search'` if the query fails.
|
|
522
|
-
*/
|
|
523
|
-
searchAllRelations(query: RelationSearchQuery): Result<CodeRelation[], GildashError>;
|
|
524
|
-
/**
|
|
525
|
-
* List all files indexed for a given project.
|
|
526
|
-
*
|
|
527
|
-
* @param project - Project name. Defaults to the primary project.
|
|
528
|
-
* @returns An array of {@link FileRecord} entries, or `Err<GildashError>` with
|
|
529
|
-
* `type='closed'` if the instance is closed,
|
|
530
|
-
* `type='store'` if the repository query fails.
|
|
531
|
-
*/
|
|
532
|
-
listIndexedFiles(project?: string): Result<FileRecord[], GildashError>;
|
|
533
|
-
/**
|
|
534
|
-
* Get all intra-file relations for a given file (relations where both source and destination
|
|
535
|
-
* are within the same file).
|
|
536
|
-
*
|
|
537
|
-
* @param filePath - Path of the file to query.
|
|
538
|
-
* @param project - Project name. Defaults to the primary project.
|
|
539
|
-
* @returns An array of {@link CodeRelation} entries, or `Err<GildashError>` with
|
|
540
|
-
* `type='closed'` if the instance is closed,
|
|
541
|
-
* `type='search'` if the query fails.
|
|
542
|
-
*/
|
|
543
|
-
getInternalRelations(filePath: string, project?: string): Result<CodeRelation[], GildashError>;
|
|
544
|
-
/**
|
|
545
|
-
* Compare two snapshots of symbol search results and return a structured diff.
|
|
546
|
-
*
|
|
547
|
-
* Symbols are keyed by `name::filePath`. A symbol is:
|
|
548
|
-
* - **added** if it appears only in `after`
|
|
549
|
-
* - **removed** if it appears only in `before`
|
|
550
|
-
* - **modified** if it appears in both but with a different `fingerprint`
|
|
551
|
-
* - **unchanged** otherwise
|
|
552
|
-
*
|
|
553
|
-
* @param before - Snapshot of symbols before the change.
|
|
554
|
-
* @param after - Snapshot of symbols after the change.
|
|
555
|
-
* @returns A {@link SymbolDiff} object.
|
|
556
|
-
*/
|
|
557
|
-
diffSymbols(before: SymbolSearchResult[], after: SymbolSearchResult[]): SymbolDiff;
|
|
558
|
-
/**
|
|
559
|
-
* List the files that a given file directly imports.
|
|
560
|
-
*
|
|
561
|
-
* @param filePath - Absolute path of the source file.
|
|
562
|
-
* @param project - Project name. Defaults to the primary project.
|
|
563
|
-
* @param limit - Maximum results. Defaults to `10_000`.
|
|
564
|
-
* @returns An array of absolute paths that `filePath` imports,
|
|
565
|
-
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
566
|
-
*
|
|
567
|
-
* @example
|
|
568
|
-
* ```ts
|
|
569
|
-
* const deps = ledger.getDependencies('/project/src/app.ts');
|
|
570
|
-
* if (isErr(deps)) return;
|
|
571
|
-
* console.log('Imports:', deps.join(', '));
|
|
572
|
-
* ```
|
|
573
|
-
*/
|
|
574
|
-
getDependencies(filePath: string, project?: string, limit?: number): Result<string[], GildashError>;
|
|
575
|
-
/**
|
|
576
|
-
* List the files that directly import a given file.
|
|
577
|
-
*
|
|
578
|
-
* @param filePath - Absolute path of the target file.
|
|
579
|
-
* @param project - Project name. Defaults to the primary project.
|
|
580
|
-
* @param limit - Maximum results. Defaults to `10_000`.
|
|
581
|
-
* @returns An array of absolute paths of files that import `filePath`,
|
|
582
|
-
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
583
|
-
*
|
|
584
|
-
* @example
|
|
585
|
-
* ```ts
|
|
586
|
-
* const dependents = ledger.getDependents('/project/src/utils.ts');
|
|
587
|
-
* if (isErr(dependents)) return;
|
|
588
|
-
* console.log('Imported by:', dependents.join(', '));
|
|
589
|
-
* ```
|
|
590
|
-
*/
|
|
591
|
-
getDependents(filePath: string, project?: string, limit?: number): Result<string[], GildashError>;
|
|
592
|
-
/**
|
|
593
|
-
* Compute the full set of files transitively affected by changes.
|
|
594
|
-
*
|
|
595
|
-
* Internally builds a full {@link DependencyGraph} and walks all reverse
|
|
596
|
-
* edges from each changed file to find every transitive dependent.
|
|
597
|
-
*
|
|
598
|
-
* @param changedFiles - Absolute paths of files that changed.
|
|
599
|
-
* @param project - Project name. Defaults to the primary project.
|
|
600
|
-
* @returns De-duplicated absolute paths of all transitively-dependent files
|
|
601
|
-
* (excluding the changed files themselves), or `Err<GildashError>` with
|
|
602
|
-
* `type='closed'` / `type='search'`.
|
|
603
|
-
*
|
|
604
|
-
* @example
|
|
605
|
-
* ```ts
|
|
606
|
-
* const affected = await ledger.getAffected(['/project/src/utils.ts']);
|
|
607
|
-
* if (isErr(affected)) return;
|
|
608
|
-
* console.log('Affected files:', affected.length);
|
|
609
|
-
* ```
|
|
610
|
-
*/
|
|
611
|
-
getAffected(changedFiles: string[], project?: string): Promise<Result<string[], GildashError>>;
|
|
612
|
-
/**
|
|
613
|
-
* Check whether the import graph contains a circular dependency.
|
|
614
|
-
*
|
|
615
|
-
* Internally builds a full {@link DependencyGraph} and runs iterative DFS
|
|
616
|
-
* cycle detection.
|
|
617
|
-
*
|
|
618
|
-
* @param project - Project name. Defaults to the primary project.
|
|
619
|
-
* @returns `true` if at least one cycle exists, `false` otherwise,
|
|
620
|
-
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
621
|
-
*
|
|
622
|
-
* @example
|
|
623
|
-
* ```ts
|
|
624
|
-
* const cycleResult = await ledger.hasCycle();
|
|
625
|
-
* if (isErr(cycleResult)) return;
|
|
626
|
-
* if (cycleResult) {
|
|
627
|
-
* console.warn('Circular dependency detected!');
|
|
628
|
-
* }
|
|
629
|
-
* ```
|
|
630
|
-
*/
|
|
631
|
-
hasCycle(project?: string): Promise<Result<boolean, GildashError>>;
|
|
632
|
-
/**
|
|
633
|
-
* Return the full import graph for a project as an adjacency list.
|
|
634
|
-
*
|
|
635
|
-
* Builds a {@link DependencyGraph} and exposes its internal adjacency list.
|
|
636
|
-
* Each file appears as a key; its value lists the files it directly imports.
|
|
637
|
-
* Files that are imported but do not themselves import appear as keys with empty arrays.
|
|
638
|
-
*
|
|
639
|
-
* @param project - Project name. Defaults to the primary project.
|
|
640
|
-
* @returns A `Map<filePath, importedFilePaths[]>`, or `Err<GildashError>` with
|
|
641
|
-
* `type='closed'` / `type='search'`.
|
|
642
|
-
*/
|
|
643
|
-
getImportGraph(project?: string): Promise<Result<Map<string, string[]>, GildashError>>;
|
|
644
|
-
/**
|
|
645
|
-
* Return all files that `filePath` transitively imports (forward BFS).
|
|
646
|
-
*
|
|
647
|
-
* @param filePath - Absolute path of the starting file.
|
|
648
|
-
* @param project - Project name. Defaults to the primary project.
|
|
649
|
-
* @returns An array of file paths that `filePath` directly or indirectly imports,
|
|
650
|
-
* or `Err<GildashError>` with `type='closed'` / `type='search'`.
|
|
651
|
-
*/
|
|
652
|
-
getTransitiveDependencies(filePath: string, project?: string): Promise<Result<string[], GildashError>>;
|
|
653
|
-
/**
|
|
654
|
-
* Return all cycle paths in the import graph.
|
|
655
|
-
*
|
|
656
|
-
* Tarjan SCC + Johnson's circuits — 모든 elementary circuit 보장.
|
|
657
|
-
* 단순한 사이클 유무(`hasCycle`)와 달리 중복 없는 정규화된 경로 전체를 반환합니다.
|
|
658
|
-
* `maxCycles` 옵션으로 반환 개수를 제한할 수 있습니다.
|
|
659
|
-
*
|
|
660
|
-
* @param project - Project name. Defaults to the primary project.
|
|
661
|
-
* @param options.maxCycles - Maximum number of cycles to return. Defaults to no limit.
|
|
662
|
-
* @returns An array of cycle paths (`string[][]`), each path starting at the
|
|
663
|
-
* lexicographically smallest node (canonical rotation). Returns `[]` if no cycles exist.
|
|
664
|
-
* Returns `Err<GildashError>` with `type='closed'` (instance closed) or `type='search'` (graph error).
|
|
665
|
-
*/
|
|
666
|
-
getCyclePaths(project?: string, options?: {
|
|
667
|
-
maxCycles?: number;
|
|
668
|
-
}): Promise<Result<string[][], GildashError>>;
|
|
669
|
-
/**
|
|
670
|
-
* Retrieve full details for a named symbol in a specific file,
|
|
671
|
-
* including members, documentation, and type information.
|
|
672
|
-
*
|
|
673
|
-
* @param symbolName - Exact symbol name to look up.
|
|
674
|
-
* @param filePath - Absolute path of the file containing the symbol.
|
|
675
|
-
* @param project - Project scope override (defaults to `defaultProject`).
|
|
676
|
-
* @returns A {@link FullSymbol} on success, or `Err<GildashError>` with
|
|
677
|
-
* `type='closed'` if the instance is closed,
|
|
678
|
-
* `type='search'` if the symbol is not found or the query fails.
|
|
679
|
-
*/
|
|
680
|
-
getFullSymbol(symbolName: string, filePath: string, project?: string): Result<FullSymbol, GildashError>;
|
|
681
|
-
/**
|
|
682
|
-
* Retrieve statistics for an indexed file (line count, symbol count, etc.).
|
|
683
|
-
*
|
|
684
|
-
* @param filePath - Absolute path of the file to query.
|
|
685
|
-
* @param project - Project scope override (defaults to `defaultProject`).
|
|
686
|
-
* @returns A {@link FileStats} on success, or `Err<GildashError>` with
|
|
687
|
-
* `type='closed'` if the instance is closed,
|
|
688
|
-
* `type='search'` if the file is not in the index,
|
|
689
|
-
* `type='store'` if the query throws.
|
|
690
|
-
*/
|
|
691
|
-
getFileStats(filePath: string, project?: string): Result<FileStats, GildashError>;
|
|
692
|
-
/**
|
|
693
|
-
* Compute import-graph fan metrics (fan-in / fan-out) for a single file.
|
|
694
|
-
*
|
|
695
|
-
* Builds a full {@link DependencyGraph} each call (O(relations)).
|
|
696
|
-
* For repeated calls, consider caching the graph externally.
|
|
697
|
-
*
|
|
698
|
-
* @param filePath - Absolute path of the file to query.
|
|
699
|
-
* @param project - Project scope override (defaults to `defaultProject`).
|
|
700
|
-
* @returns A {@link FanMetrics} on success, or `Err<GildashError>` with
|
|
701
|
-
* `type='closed'` if the instance is closed,
|
|
702
|
-
* `type='search'` if the graph build fails.
|
|
703
|
-
*/
|
|
704
|
-
getFanMetrics(filePath: string, project?: string): Promise<Result<FanMetrics, GildashError>>;
|
|
705
|
-
/**
|
|
706
|
-
* Resolve the original definition location of a symbol by following its re-export chain.
|
|
707
|
-
*
|
|
708
|
-
* Traverses `re-exports` relations iteratively until no further hop is found or a
|
|
709
|
-
* circular chain is detected.
|
|
710
|
-
*
|
|
711
|
-
* @param symbolName - The exported name to resolve.
|
|
712
|
-
* @param filePath - The file from which the symbol is exported.
|
|
713
|
-
* @param project - Project scope override (defaults to `defaultProject`).
|
|
714
|
-
* @returns A {@link ResolvedSymbol} on success, or `Err<GildashError>` with
|
|
715
|
-
* `type='closed'` if the instance is closed,
|
|
716
|
-
* `type='search'` if a circular re-export chain is detected.
|
|
717
|
-
*/
|
|
718
|
-
resolveSymbol(symbolName: string, filePath: string, project?: string): Result<ResolvedSymbol, GildashError>;
|
|
719
|
-
/**
|
|
720
|
-
* Search for an AST structural pattern across indexed TypeScript files.
|
|
721
|
-
*
|
|
722
|
-
* Uses ast-grep's `findInFiles` under the hood. Provide `opts.filePaths` to
|
|
723
|
-
* limit search scope; otherwise all files tracked by the project index are searched.
|
|
724
|
-
*
|
|
725
|
-
* @param pattern - ast-grep structural pattern (e.g. `'console.log($$$)'`).
|
|
726
|
-
* @param opts - Optional scope: file paths and/or project override.
|
|
727
|
-
* @returns An array of {@link PatternMatch} on success, or `Err<GildashError>` with
|
|
728
|
-
* `type='closed'` if the instance is closed,
|
|
729
|
-
* `type='search'` if the underlying search fails.
|
|
730
|
-
*/
|
|
731
|
-
findPattern(pattern: string, opts?: {
|
|
732
|
-
filePaths?: string[];
|
|
733
|
-
project?: string;
|
|
734
|
-
}): Promise<Result<PatternMatch[], GildashError>>;
|
|
735
|
-
/**
|
|
736
|
-
* Index the TypeScript type declarations (`.d.ts` files) of one or more
|
|
737
|
-
* `node_modules` packages.
|
|
738
|
-
*
|
|
739
|
-
* Each package is indexed under a dedicated `@external/<packageName>` project
|
|
740
|
-
* so it does not pollute the main project index. Subsequent calls re-index
|
|
741
|
-
* (incremental diff) the same package.
|
|
742
|
-
*
|
|
743
|
-
* @param packages - Package names as they appear in `node_modules/`
|
|
744
|
-
* (e.g. `['react', 'typescript']`).
|
|
745
|
-
* @param opts - Optional overrides (unused currently, reserved for future use).
|
|
746
|
-
* @returns An array of {@link IndexResult} — one per package — on success,
|
|
747
|
-
* or `Err<GildashError>` with:
|
|
748
|
-
* - `type='closed'` if the instance is closed or in reader mode,
|
|
749
|
-
* - `type='validation'` if a requested package is not found in `node_modules/`,
|
|
750
|
-
* - `type='store'` if indexing fails at runtime.
|
|
751
|
-
*/
|
|
752
|
-
indexExternalPackages(packages: string[], opts?: {
|
|
753
|
-
project?: string;
|
|
754
|
-
}): Promise<Result<IndexResult[], GildashError>>;
|
|
755
|
-
/**
|
|
756
|
-
* Parse multiple files concurrently and return a map of results.
|
|
757
|
-
*
|
|
758
|
-
* Files that fail to read or parse are silently excluded from the result map.
|
|
759
|
-
* The operation does not fail even if every file fails — it returns an empty `Map`.
|
|
760
|
-
*
|
|
761
|
-
* @param filePaths - Absolute paths of files to parse.
|
|
762
|
-
* @param options - Optional oxc-parser {@link ParserOptions} (e.g. `sourceType`, `lang`).
|
|
763
|
-
* @returns A `Map<filePath, ParsedFile>` for every successfully-parsed file,
|
|
764
|
-
* or `Err<GildashError>` with `type='closed'` if the instance is closed.
|
|
765
|
-
*/
|
|
766
|
-
batchParse(filePaths: string[], options?: ParserOptions): Promise<Result<Map<string, ParsedFile>, GildashError>>;
|
|
767
|
-
/**
|
|
768
|
-
* Return the public interface of a module: all exported symbols with key metadata.
|
|
769
|
-
*
|
|
770
|
-
* @param filePath - Absolute path of the file.
|
|
771
|
-
* @param project - Project name. Defaults to the primary project.
|
|
772
|
-
* @returns A {@link ModuleInterface} object, or `Err<GildashError>` with
|
|
773
|
-
* `type='closed'` / `type='search'`.
|
|
774
|
-
*/
|
|
775
|
-
getModuleInterface(filePath: string, project?: string): Result<ModuleInterface, GildashError>;
|
|
776
|
-
/**
|
|
777
|
-
* Recursively traverse `extends`/`implements` relations to build a heritage tree.
|
|
778
|
-
*
|
|
779
|
-
* The root node represents `symbolName`/`filePath`. Its `children` are the symbols
|
|
780
|
-
* it extends or implements, and so on transitively. A visited set prevents cycles.
|
|
781
|
-
*
|
|
782
|
-
* @param symbolName - Name of the starting symbol.
|
|
783
|
-
* @param filePath - Absolute path of the file containing the symbol.
|
|
784
|
-
* @param project - Project name. Defaults to the primary project.
|
|
785
|
-
* @returns A {@link HeritageNode} tree, or `Err<GildashError>` with
|
|
786
|
-
* `type='closed'` / `type='search'`.
|
|
787
|
-
*/
|
|
788
|
-
getHeritageChain(symbolName: string, filePath: string, project?: string): Promise<Result<HeritageNode, GildashError>>;
|
|
789
|
-
/**
|
|
790
|
-
* Retrieve a previously-parsed AST from the internal LRU cache.
|
|
791
|
-
*
|
|
792
|
-
* Returns `undefined` if the file has not been parsed or was evicted from the cache.
|
|
793
|
-
* The returned object is shared with the internal cache — treat it as **read-only**.
|
|
794
|
-
*
|
|
795
|
-
* @param filePath - Absolute path of the file.
|
|
796
|
-
* @returns The cached {@link ParsedFile}, or `undefined` if not available.
|
|
797
|
-
*/
|
|
798
|
-
getParsedAst(filePath: string): ParsedFile | undefined;
|
|
799
|
-
/**
|
|
800
|
-
* Retrieve metadata for an indexed file.
|
|
801
|
-
*
|
|
802
|
-
* Returns the stored {@link FileRecord} including content hash, mtime, and size.
|
|
803
|
-
* Returns `null` if the file has not been indexed yet.
|
|
804
|
-
*
|
|
805
|
-
* @param filePath - Relative path from project root (as stored in the index).
|
|
806
|
-
* @param project - Project name. Defaults to the primary project.
|
|
807
|
-
* @returns The {@link FileRecord}, or `null` if not found.
|
|
808
|
-
*/
|
|
809
|
-
getFileInfo(filePath: string, project?: string): Result<FileRecord | null, GildashError>;
|
|
810
|
-
/**
|
|
811
|
-
* List all symbols declared in a specific file.
|
|
812
|
-
*
|
|
813
|
-
* Convenience wrapper around {@link searchSymbols} with a `filePath` filter.
|
|
814
|
-
*
|
|
815
|
-
* @param filePath - File path to query.
|
|
816
|
-
* @param project - Project name. Defaults to the primary project.
|
|
817
|
-
* @returns An array of {@link SymbolSearchResult} entries, or `Err<GildashError>`.
|
|
818
|
-
*/
|
|
819
|
-
getSymbolsByFile(filePath: string, project?: string): Result<SymbolSearchResult[], GildashError>;
|
|
820
|
-
}
|
|
821
|
-
export {};
|