@zipbul/gildash 0.6.0 → 0.8.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 +90 -55
- package/README.md +91 -55
- package/dist/index.js +7 -7
- package/dist/index.js.map +18 -18
- package/dist/migrations/0005_instance_id_covering_index.sql +2 -0
- package/dist/migrations/meta/0005_snapshot.json +445 -0
- package/dist/migrations/meta/_journal.json +7 -0
- package/dist/src/errors.d.ts +8 -6
- package/dist/src/gildash/context.d.ts +5 -0
- package/dist/src/gildash/extract-api.d.ts +2 -4
- package/dist/src/gildash/graph-api.d.ts +11 -10
- package/dist/src/gildash/index.d.ts +45 -41
- package/dist/src/gildash/lifecycle.d.ts +5 -7
- package/dist/src/gildash/misc-api.d.ts +12 -6
- package/dist/src/gildash/parse-api.d.ts +4 -5
- package/dist/src/gildash/query-api.d.ts +12 -14
- package/dist/src/gildash/semantic-api.d.ts +4 -6
- package/dist/src/gildash/types.d.ts +16 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/indexer/index-coordinator.d.ts +1 -0
- package/dist/src/search/dependency-graph.d.ts +13 -0
- package/dist/src/store/connection.d.ts +3 -2
- package/dist/src/store/schema.d.ts +19 -0
- package/dist/src/watcher/ownership.d.ts +4 -2
- package/package.json +11 -3
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
1
|
import type { ParsedFile } from '../parser/types';
|
|
3
2
|
import type { ParserOptions } from 'oxc-parser';
|
|
4
3
|
import type { ExtractedSymbol, CodeRelation } from '../extractor/types';
|
|
@@ -9,12 +8,13 @@ import type { RelationSearchQuery } from '../search/relation-search';
|
|
|
9
8
|
import type { SymbolStats } from '../store/repositories/symbol.repository';
|
|
10
9
|
import type { FileRecord } from '../store/repositories/file.repository';
|
|
11
10
|
import type { PatternMatch } from '../search/pattern-search';
|
|
12
|
-
import type { GildashError } from '../errors';
|
|
13
11
|
import type { ResolvedType, SemanticReference, Implementation, SemanticModuleInterface } from '../semantic/types';
|
|
14
12
|
import type { GildashContext } from './context';
|
|
15
|
-
import type {
|
|
13
|
+
import type { FileChangeEvent } from '../watcher/types';
|
|
14
|
+
import { GildashError } from '../errors';
|
|
15
|
+
import type { GildashOptions, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol, BatchParseResult } from './types';
|
|
16
16
|
import type { GildashInternalOptions } from './lifecycle';
|
|
17
|
-
export type { Logger, GildashOptions, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol, } from './types';
|
|
17
|
+
export type { Logger, GildashOptions, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol, BatchParseResult, } from './types';
|
|
18
18
|
export type { GildashInternalOptions } from './lifecycle';
|
|
19
19
|
/**
|
|
20
20
|
* Main entry point for gildash.
|
|
@@ -22,9 +22,9 @@ export type { GildashInternalOptions } from './lifecycle';
|
|
|
22
22
|
* `Gildash` indexes TypeScript source code into a local SQLite database,
|
|
23
23
|
* watches for file changes, and provides search / dependency-graph queries.
|
|
24
24
|
*
|
|
25
|
-
* Every public method returns a
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* Every public method either returns a value directly or throws a
|
|
26
|
+
* `GildashError` on failure. Use `try/catch` with `instanceof GildashError`
|
|
27
|
+
* to handle errors.
|
|
28
28
|
*
|
|
29
29
|
* Create an instance with the static {@link Gildash.open} factory.
|
|
30
30
|
* Always call {@link Gildash.close} when done to release resources.
|
|
@@ -41,52 +41,56 @@ export declare class Gildash {
|
|
|
41
41
|
private constructor();
|
|
42
42
|
/**
|
|
43
43
|
* Create and initialise a new `Gildash` instance.
|
|
44
|
+
* @throws {GildashError} if initialization fails.
|
|
44
45
|
*/
|
|
45
|
-
static open(options: GildashOptions & GildashInternalOptions): Promise<
|
|
46
|
+
static open(options: GildashOptions & GildashInternalOptions): Promise<Gildash>;
|
|
46
47
|
/** Shut down the instance and release all resources. */
|
|
47
48
|
close(opts?: {
|
|
48
49
|
cleanup?: boolean;
|
|
49
|
-
}): Promise<
|
|
50
|
-
parseSource(filePath: string, sourceText: string, options?: ParserOptions):
|
|
51
|
-
batchParse(filePaths: string[], options?: ParserOptions): Promise<
|
|
50
|
+
}): Promise<void>;
|
|
51
|
+
parseSource(filePath: string, sourceText: string, options?: ParserOptions): ParsedFile;
|
|
52
|
+
batchParse(filePaths: string[], options?: ParserOptions): Promise<BatchParseResult>;
|
|
52
53
|
getParsedAst(filePath: string): ParsedFile | undefined;
|
|
53
|
-
extractSymbols(parsed: ParsedFile):
|
|
54
|
-
extractRelations(parsed: ParsedFile):
|
|
55
|
-
getStats(project?: string):
|
|
56
|
-
searchSymbols(query: SymbolSearchQuery):
|
|
57
|
-
searchRelations(query: RelationSearchQuery):
|
|
54
|
+
extractSymbols(parsed: ParsedFile): ExtractedSymbol[];
|
|
55
|
+
extractRelations(parsed: ParsedFile): CodeRelation[];
|
|
56
|
+
getStats(project?: string): SymbolStats;
|
|
57
|
+
searchSymbols(query: SymbolSearchQuery): SymbolSearchResult[];
|
|
58
|
+
searchRelations(query: RelationSearchQuery): CodeRelation[];
|
|
58
59
|
searchAllSymbols(query: Omit<SymbolSearchQuery, 'project'> & {
|
|
59
60
|
project?: string;
|
|
60
|
-
}):
|
|
61
|
-
searchAllRelations(query: RelationSearchQuery):
|
|
62
|
-
listIndexedFiles(project?: string):
|
|
63
|
-
getInternalRelations(filePath: string, project?: string):
|
|
64
|
-
getFullSymbol(symbolName: string, filePath: string, project?: string):
|
|
65
|
-
getFileStats(filePath: string, project?: string):
|
|
66
|
-
getFileInfo(filePath: string, project?: string):
|
|
67
|
-
getSymbolsByFile(filePath: string, project?: string):
|
|
68
|
-
getModuleInterface(filePath: string, project?: string):
|
|
69
|
-
getDependencies(filePath: string, project?: string, limit?: number):
|
|
70
|
-
getDependents(filePath: string, project?: string, limit?: number):
|
|
71
|
-
getAffected(changedFiles: string[], project?: string): Promise<
|
|
72
|
-
hasCycle(project?: string): Promise<
|
|
73
|
-
getImportGraph(project?: string): Promise<
|
|
74
|
-
getTransitiveDependencies(filePath: string, project?: string): Promise<
|
|
61
|
+
}): SymbolSearchResult[];
|
|
62
|
+
searchAllRelations(query: RelationSearchQuery): CodeRelation[];
|
|
63
|
+
listIndexedFiles(project?: string): FileRecord[];
|
|
64
|
+
getInternalRelations(filePath: string, project?: string): CodeRelation[];
|
|
65
|
+
getFullSymbol(symbolName: string, filePath: string, project?: string): FullSymbol | null;
|
|
66
|
+
getFileStats(filePath: string, project?: string): FileStats;
|
|
67
|
+
getFileInfo(filePath: string, project?: string): FileRecord | null;
|
|
68
|
+
getSymbolsByFile(filePath: string, project?: string): SymbolSearchResult[];
|
|
69
|
+
getModuleInterface(filePath: string, project?: string): ModuleInterface;
|
|
70
|
+
getDependencies(filePath: string, project?: string, limit?: number): string[];
|
|
71
|
+
getDependents(filePath: string, project?: string, limit?: number): string[];
|
|
72
|
+
getAffected(changedFiles: string[], project?: string): Promise<string[]>;
|
|
73
|
+
hasCycle(project?: string): Promise<boolean>;
|
|
74
|
+
getImportGraph(project?: string): Promise<Map<string, string[]>>;
|
|
75
|
+
getTransitiveDependencies(filePath: string, project?: string): Promise<string[]>;
|
|
75
76
|
getCyclePaths(project?: string, options?: {
|
|
76
77
|
maxCycles?: number;
|
|
77
|
-
}): Promise<
|
|
78
|
-
getFanMetrics(filePath: string, project?: string): Promise<
|
|
79
|
-
getResolvedType(symbolName: string, filePath: string, project?: string):
|
|
80
|
-
getSemanticReferences(symbolName: string, filePath: string, project?: string):
|
|
81
|
-
getImplementations(symbolName: string, filePath: string, project?: string):
|
|
82
|
-
getSemanticModuleInterface(filePath: string):
|
|
78
|
+
}): Promise<string[][]>;
|
|
79
|
+
getFanMetrics(filePath: string, project?: string): Promise<FanMetrics>;
|
|
80
|
+
getResolvedType(symbolName: string, filePath: string, project?: string): ResolvedType | null;
|
|
81
|
+
getSemanticReferences(symbolName: string, filePath: string, project?: string): SemanticReference[];
|
|
82
|
+
getImplementations(symbolName: string, filePath: string, project?: string): Implementation[];
|
|
83
|
+
getSemanticModuleInterface(filePath: string): SemanticModuleInterface;
|
|
83
84
|
diffSymbols(before: SymbolSearchResult[], after: SymbolSearchResult[]): SymbolDiff;
|
|
84
85
|
onIndexed(callback: (result: IndexResult) => void): () => void;
|
|
85
|
-
reindex(): Promise<
|
|
86
|
-
resolveSymbol(symbolName: string, filePath: string, project?: string):
|
|
86
|
+
reindex(): Promise<IndexResult>;
|
|
87
|
+
resolveSymbol(symbolName: string, filePath: string, project?: string): ResolvedSymbol;
|
|
87
88
|
findPattern(pattern: string, opts?: {
|
|
88
89
|
filePaths?: string[];
|
|
89
90
|
project?: string;
|
|
90
|
-
}): Promise<
|
|
91
|
-
getHeritageChain(symbolName: string, filePath: string, project?: string): Promise<
|
|
91
|
+
}): Promise<PatternMatch[]>;
|
|
92
|
+
getHeritageChain(symbolName: string, filePath: string, project?: string): Promise<HeritageNode>;
|
|
93
|
+
onFileChanged(callback: (event: FileChangeEvent) => void): () => void;
|
|
94
|
+
onError(callback: (error: GildashError) => void): () => void;
|
|
95
|
+
onRoleChanged(callback: (newRole: 'owner' | 'reader') => void): () => void;
|
|
92
96
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
1
|
import { FileRepository } from '../store/repositories/file.repository';
|
|
3
2
|
import { SymbolRepository } from '../store/repositories/symbol.repository';
|
|
4
3
|
import { RelationRepository } from '../store/repositories/relation.repository';
|
|
@@ -13,11 +12,10 @@ import { symbolSearch as defaultSymbolSearch } from '../search/symbol-search';
|
|
|
13
12
|
import { relationSearch as defaultRelationSearch } from '../search/relation-search';
|
|
14
13
|
import type { PatternMatch } from '../search/pattern-search';
|
|
15
14
|
import { SemanticLayer } from '../semantic/index';
|
|
16
|
-
import type { GildashError } from '../errors';
|
|
17
15
|
import type { GildashContext, CoordinatorLike, WatcherLike, DbStore } from './context';
|
|
18
16
|
import type { GildashOptions } from './types';
|
|
19
17
|
export declare const HEARTBEAT_INTERVAL_MS = 30000;
|
|
20
|
-
export declare const HEALTHCHECK_INTERVAL_MS =
|
|
18
|
+
export declare const HEALTHCHECK_INTERVAL_MS = 15000;
|
|
21
19
|
export declare const MAX_HEALTHCHECK_RETRIES = 10;
|
|
22
20
|
export interface GildashInternalOptions {
|
|
23
21
|
existsSyncFn?: (p: string) => boolean;
|
|
@@ -46,17 +44,17 @@ export interface GildashInternalOptions {
|
|
|
46
44
|
loadTsconfigPathsFn?: typeof loadTsconfigPaths;
|
|
47
45
|
readFileFn?: (filePath: string) => Promise<string>;
|
|
48
46
|
unlinkFn?: (filePath: string) => Promise<void>;
|
|
49
|
-
semanticLayerFactory?: (tsconfigPath: string) =>
|
|
47
|
+
semanticLayerFactory?: (tsconfigPath: string) => SemanticLayer;
|
|
50
48
|
}
|
|
51
49
|
/** Create coordinator + watcher, start watcher, heartbeat timer, run fullIndex. */
|
|
52
50
|
export declare function setupOwnerInfrastructure(ctx: GildashContext, opts: {
|
|
53
51
|
isWatchMode: boolean;
|
|
54
52
|
}): Promise<void>;
|
|
55
53
|
/** Register SIGTERM / SIGINT / beforeExit handlers. */
|
|
56
|
-
export declare function registerSignalHandlers(ctx: GildashContext, closeFn: () => Promise<
|
|
54
|
+
export declare function registerSignalHandlers(ctx: GildashContext, closeFn: () => Promise<void>): void;
|
|
57
55
|
/** Initialize a GildashContext (replaces the old `Gildash.open()` body). */
|
|
58
|
-
export declare function initializeContext(options: GildashOptions & GildashInternalOptions): Promise<
|
|
56
|
+
export declare function initializeContext(options: GildashOptions & GildashInternalOptions): Promise<GildashContext>;
|
|
59
57
|
/** Shut down the context and release all resources. */
|
|
60
58
|
export declare function closeContext(ctx: GildashContext, opts?: {
|
|
61
59
|
cleanup?: boolean;
|
|
62
|
-
}): Promise<
|
|
60
|
+
}): Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
1
|
import type { SymbolSearchResult } from '../search/symbol-search';
|
|
3
2
|
import type { IndexResult } from '../indexer/index-coordinator';
|
|
3
|
+
import type { FileChangeEvent } from '../watcher/types';
|
|
4
4
|
import type { PatternMatch } from '../search/pattern-search';
|
|
5
|
-
import
|
|
5
|
+
import { GildashError } from '../errors';
|
|
6
6
|
import type { GildashContext } from './context';
|
|
7
7
|
import type { SymbolDiff, ResolvedSymbol, HeritageNode } from './types';
|
|
8
8
|
/** Compare two snapshots of symbol search results and return a structured diff. */
|
|
@@ -10,13 +10,19 @@ export declare function diffSymbols(before: SymbolSearchResult[], after: SymbolS
|
|
|
10
10
|
/** Register a callback that fires after each indexing run completes. */
|
|
11
11
|
export declare function onIndexed(ctx: GildashContext, callback: (result: IndexResult) => void): () => void;
|
|
12
12
|
/** Trigger a full re-index of all tracked files. */
|
|
13
|
-
export declare function reindex(ctx: GildashContext): Promise<
|
|
13
|
+
export declare function reindex(ctx: GildashContext): Promise<IndexResult>;
|
|
14
14
|
/** Resolve the original definition location of a symbol by following its re-export chain. */
|
|
15
|
-
export declare function resolveSymbol(ctx: GildashContext, symbolName: string, filePath: string, project?: string):
|
|
15
|
+
export declare function resolveSymbol(ctx: GildashContext, symbolName: string, filePath: string, project?: string): ResolvedSymbol;
|
|
16
|
+
/** Register a callback that fires whenever a watched file changes. */
|
|
17
|
+
export declare function onFileChanged(ctx: GildashContext, callback: (event: FileChangeEvent) => void): () => void;
|
|
18
|
+
/** Register a callback that fires on internal errors (e.g. healthcheck failures). */
|
|
19
|
+
export declare function onError(ctx: GildashContext, callback: (error: GildashError) => void): () => void;
|
|
20
|
+
/** Register a callback that fires when the watcher role changes (reader → owner). */
|
|
21
|
+
export declare function onRoleChanged(ctx: GildashContext, callback: (newRole: 'owner' | 'reader') => void): () => void;
|
|
16
22
|
/** Search for an AST structural pattern across indexed TypeScript files. */
|
|
17
23
|
export declare function findPattern(ctx: GildashContext, pattern: string, opts?: {
|
|
18
24
|
filePaths?: string[];
|
|
19
25
|
project?: string;
|
|
20
|
-
}): Promise<
|
|
26
|
+
}): Promise<PatternMatch[]>;
|
|
21
27
|
/** Recursively traverse extends/implements relations to build a heritage tree. */
|
|
22
|
-
export declare function getHeritageChain(ctx: GildashContext, symbolName: string, filePath: string, project?: string): Promise<
|
|
28
|
+
export declare function getHeritageChain(ctx: GildashContext, symbolName: string, filePath: string, project?: string): Promise<HeritageNode>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
1
|
import type { ParsedFile } from '../parser/types';
|
|
3
2
|
import type { ParserOptions } from 'oxc-parser';
|
|
4
|
-
import type { GildashError } from '../errors';
|
|
5
3
|
import type { GildashContext } from './context';
|
|
4
|
+
import type { BatchParseResult } from './types';
|
|
6
5
|
/** Parse a TypeScript source string into an AST and cache the result. */
|
|
7
|
-
export declare function parseSource(ctx: GildashContext, filePath: string, sourceText: string, options?: ParserOptions):
|
|
8
|
-
/** Parse multiple files concurrently and return
|
|
9
|
-
export declare function batchParse(ctx: GildashContext, filePaths: string[], options?: ParserOptions): Promise<
|
|
6
|
+
export declare function parseSource(ctx: GildashContext, filePath: string, sourceText: string, options?: ParserOptions): ParsedFile;
|
|
7
|
+
/** Parse multiple files concurrently and return results with failure details. */
|
|
8
|
+
export declare function batchParse(ctx: GildashContext, filePaths: string[], options?: ParserOptions): Promise<BatchParseResult>;
|
|
10
9
|
/** Retrieve a previously-parsed AST from the internal LRU cache. */
|
|
11
10
|
export declare function getParsedAst(ctx: GildashContext, filePath: string): ParsedFile | undefined;
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
1
|
import type { SymbolSearchQuery, SymbolSearchResult } from '../search/symbol-search';
|
|
3
2
|
import type { RelationSearchQuery } from '../search/relation-search';
|
|
4
3
|
import type { CodeRelation } from '../extractor/types';
|
|
5
4
|
import type { FileRecord } from '../store/repositories/file.repository';
|
|
6
5
|
import type { SymbolStats } from '../store/repositories/symbol.repository';
|
|
7
|
-
import type { GildashError } from '../errors';
|
|
8
6
|
import type { GildashContext } from './context';
|
|
9
7
|
import type { FullSymbol, FileStats, ModuleInterface } from './types';
|
|
10
8
|
/** Return aggregate symbol statistics for the given project. */
|
|
11
|
-
export declare function getStats(ctx: GildashContext, project?: string):
|
|
9
|
+
export declare function getStats(ctx: GildashContext, project?: string): SymbolStats;
|
|
12
10
|
/** Search indexed symbols by name, kind, file path, or export status. */
|
|
13
|
-
export declare function searchSymbols(ctx: GildashContext, query: SymbolSearchQuery):
|
|
11
|
+
export declare function searchSymbols(ctx: GildashContext, query: SymbolSearchQuery): SymbolSearchResult[];
|
|
14
12
|
/** Search indexed code relationships (imports, calls, extends, implements). */
|
|
15
|
-
export declare function searchRelations(ctx: GildashContext, query: RelationSearchQuery):
|
|
13
|
+
export declare function searchRelations(ctx: GildashContext, query: RelationSearchQuery): CodeRelation[];
|
|
16
14
|
/** Search symbols across all projects (no project filter). */
|
|
17
15
|
export declare function searchAllSymbols(ctx: GildashContext, query: Omit<SymbolSearchQuery, 'project'> & {
|
|
18
16
|
project?: string;
|
|
19
|
-
}):
|
|
17
|
+
}): SymbolSearchResult[];
|
|
20
18
|
/** Search relations across all projects (no project filter). */
|
|
21
|
-
export declare function searchAllRelations(ctx: GildashContext, query: RelationSearchQuery):
|
|
19
|
+
export declare function searchAllRelations(ctx: GildashContext, query: RelationSearchQuery): CodeRelation[];
|
|
22
20
|
/** List all files indexed for a given project. */
|
|
23
|
-
export declare function listIndexedFiles(ctx: GildashContext, project?: string):
|
|
21
|
+
export declare function listIndexedFiles(ctx: GildashContext, project?: string): FileRecord[];
|
|
24
22
|
/** Get all intra-file relations for a given file. */
|
|
25
|
-
export declare function getInternalRelations(ctx: GildashContext, filePath: string, project?: string):
|
|
23
|
+
export declare function getInternalRelations(ctx: GildashContext, filePath: string, project?: string): CodeRelation[];
|
|
26
24
|
/** Retrieve full details for a named symbol in a specific file. */
|
|
27
|
-
export declare function getFullSymbol(ctx: GildashContext, symbolName: string, filePath: string, project?: string):
|
|
25
|
+
export declare function getFullSymbol(ctx: GildashContext, symbolName: string, filePath: string, project?: string): FullSymbol | null;
|
|
28
26
|
/** Retrieve statistics for an indexed file. */
|
|
29
|
-
export declare function getFileStats(ctx: GildashContext, filePath: string, project?: string):
|
|
27
|
+
export declare function getFileStats(ctx: GildashContext, filePath: string, project?: string): FileStats;
|
|
30
28
|
/** Retrieve metadata for an indexed file. */
|
|
31
|
-
export declare function getFileInfo(ctx: GildashContext, filePath: string, project?: string):
|
|
29
|
+
export declare function getFileInfo(ctx: GildashContext, filePath: string, project?: string): FileRecord | null;
|
|
32
30
|
/** List all symbols declared in a specific file. */
|
|
33
|
-
export declare function getSymbolsByFile(ctx: GildashContext, filePath: string, project?: string):
|
|
31
|
+
export declare function getSymbolsByFile(ctx: GildashContext, filePath: string, project?: string): SymbolSearchResult[];
|
|
34
32
|
/** Return the public interface of a module. */
|
|
35
|
-
export declare function getModuleInterface(ctx: GildashContext, filePath: string, project?: string):
|
|
33
|
+
export declare function getModuleInterface(ctx: GildashContext, filePath: string, project?: string): ModuleInterface;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type Result } from '@zipbul/result';
|
|
2
1
|
import type { SymbolSearchResult } from '../search/symbol-search';
|
|
3
|
-
import type { GildashError } from '../errors';
|
|
4
2
|
import type { ResolvedType, SemanticReference, Implementation, SemanticModuleInterface } from '../semantic/types';
|
|
5
3
|
import type { GildashContext } from './context';
|
|
6
4
|
/**
|
|
@@ -13,10 +11,10 @@ export declare function resolveSymbolPosition(ctx: GildashContext, symbolName: s
|
|
|
13
11
|
absPath: string;
|
|
14
12
|
} | null;
|
|
15
13
|
/** Retrieve the resolved type of a symbol using the Semantic Layer. */
|
|
16
|
-
export declare function getResolvedType(ctx: GildashContext, symbolName: string, filePath: string, project?: string):
|
|
14
|
+
export declare function getResolvedType(ctx: GildashContext, symbolName: string, filePath: string, project?: string): ResolvedType | null;
|
|
17
15
|
/** Find all semantic references to a symbol. */
|
|
18
|
-
export declare function getSemanticReferences(ctx: GildashContext, symbolName: string, filePath: string, project?: string):
|
|
16
|
+
export declare function getSemanticReferences(ctx: GildashContext, symbolName: string, filePath: string, project?: string): SemanticReference[];
|
|
19
17
|
/** Find implementations of an interface/abstract class. */
|
|
20
|
-
export declare function getImplementations(ctx: GildashContext, symbolName: string, filePath: string, project?: string):
|
|
18
|
+
export declare function getImplementations(ctx: GildashContext, symbolName: string, filePath: string, project?: string): Implementation[];
|
|
21
19
|
/** Retrieve the semantic module interface — exported symbols with resolved types. */
|
|
22
|
-
export declare function getSemanticModuleInterface(ctx: GildashContext, filePath: string):
|
|
20
|
+
export declare function getSemanticModuleInterface(ctx: GildashContext, filePath: string): SemanticModuleInterface;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ParsedFile } from '../parser/types';
|
|
1
2
|
import type { SymbolSearchResult } from '../search/symbol-search';
|
|
2
3
|
import type { SymbolKind } from '../extractor/types';
|
|
3
4
|
import type { ResolvedType } from '../semantic/types';
|
|
@@ -123,6 +124,21 @@ export interface ResolvedSymbol {
|
|
|
123
124
|
filePath: string;
|
|
124
125
|
exportedAs: string;
|
|
125
126
|
}>;
|
|
127
|
+
/** Whether a circular re-export chain was detected. */
|
|
128
|
+
circular: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Result of a batch parse operation.
|
|
132
|
+
* Contains both successful parses and failure details.
|
|
133
|
+
*/
|
|
134
|
+
export interface BatchParseResult {
|
|
135
|
+
/** Successfully parsed files. */
|
|
136
|
+
parsed: Map<string, ParsedFile>;
|
|
137
|
+
/** Files that failed to parse, with error details. */
|
|
138
|
+
failures: Array<{
|
|
139
|
+
filePath: string;
|
|
140
|
+
error: Error;
|
|
141
|
+
}>;
|
|
126
142
|
}
|
|
127
143
|
/**
|
|
128
144
|
* Options for creating a {@link Gildash} instance via {@link Gildash.open}.
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Gildash } from "./gildash";
|
|
2
2
|
export type { GildashOptions, Logger, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol } from "./gildash";
|
|
3
|
-
export { gildashError } from "./errors";
|
|
4
|
-
export type {
|
|
3
|
+
export { GildashError, gildashError } from "./errors";
|
|
4
|
+
export type { GildashErrorType } from "./errors";
|
|
5
5
|
export { symbolSearch } from "./search/symbol-search";
|
|
6
6
|
export type { SymbolSearchQuery, SymbolSearchResult } from "./search/symbol-search";
|
|
7
7
|
export { relationSearch } from "./search/relation-search";
|
|
@@ -9,6 +9,7 @@ import type { SymbolRecord } from '../store/repositories/symbol.repository';
|
|
|
9
9
|
import type { RelationRecord } from '../store/repositories/relation.repository';
|
|
10
10
|
import type { Logger } from '../gildash';
|
|
11
11
|
export declare const WATCHER_DEBOUNCE_MS = 100;
|
|
12
|
+
export declare const FILE_READ_BATCH_SIZE = 50;
|
|
12
13
|
/**
|
|
13
14
|
* Summary returned after an indexing run completes.
|
|
14
15
|
*
|
|
@@ -32,6 +32,19 @@ export declare class DependencyGraph {
|
|
|
32
32
|
* Must be called before any query method.
|
|
33
33
|
*/
|
|
34
34
|
build(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Incrementally patch the graph after a set of files changed or were deleted.
|
|
37
|
+
*
|
|
38
|
+
* For small change-sets this is much cheaper than a full {@link build}.
|
|
39
|
+
*
|
|
40
|
+
* @param changedFiles - Files whose edges may have changed.
|
|
41
|
+
* @param deletedFiles - Files that were removed from the project.
|
|
42
|
+
* @param getRelationsForFile - Callback to query current relations for a file.
|
|
43
|
+
*/
|
|
44
|
+
patchFiles(changedFiles: string[], deletedFiles: string[], getRelationsForFile: (filePath: string) => Array<{
|
|
45
|
+
srcFilePath: string;
|
|
46
|
+
dstFilePath: string;
|
|
47
|
+
}>): void;
|
|
35
48
|
/**
|
|
36
49
|
* Return the files that `filePath` directly imports.
|
|
37
50
|
*
|
|
@@ -21,9 +21,10 @@ export declare class DbConnection {
|
|
|
21
21
|
selectOwner(): {
|
|
22
22
|
pid: number;
|
|
23
23
|
heartbeat_at: string;
|
|
24
|
+
instance_id: string | null;
|
|
24
25
|
} | undefined;
|
|
25
|
-
insertOwner(pid: number): void;
|
|
26
|
-
replaceOwner(pid: number): void;
|
|
26
|
+
insertOwner(pid: number, instanceId?: string): void;
|
|
27
|
+
replaceOwner(pid: number, instanceId?: string): void;
|
|
27
28
|
touchOwner(pid: number): void;
|
|
28
29
|
deleteOwner(pid: number): void;
|
|
29
30
|
private requireClient;
|
|
@@ -683,6 +683,25 @@ export declare const watcherOwner: import("drizzle-orm/sqlite-core").SQLiteTable
|
|
|
683
683
|
}, {}, {
|
|
684
684
|
length: number | undefined;
|
|
685
685
|
}>;
|
|
686
|
+
instanceId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
687
|
+
name: "instance_id";
|
|
688
|
+
tableName: "watcher_owner";
|
|
689
|
+
dataType: "string";
|
|
690
|
+
columnType: "SQLiteText";
|
|
691
|
+
data: string;
|
|
692
|
+
driverParam: string;
|
|
693
|
+
notNull: false;
|
|
694
|
+
hasDefault: false;
|
|
695
|
+
isPrimaryKey: false;
|
|
696
|
+
isAutoincrement: false;
|
|
697
|
+
hasRuntimeDefault: false;
|
|
698
|
+
enumValues: [string, ...string[]];
|
|
699
|
+
baseColumn: never;
|
|
700
|
+
identity: undefined;
|
|
701
|
+
generated: undefined;
|
|
702
|
+
}, {}, {
|
|
703
|
+
length: number | undefined;
|
|
704
|
+
}>;
|
|
686
705
|
};
|
|
687
706
|
dialect: "sqlite";
|
|
688
707
|
}>;
|
|
@@ -2,12 +2,13 @@ import type { WatcherRole } from "./types";
|
|
|
2
2
|
interface WatcherOwnerRow {
|
|
3
3
|
pid: number;
|
|
4
4
|
heartbeat_at: string;
|
|
5
|
+
instance_id: string | null;
|
|
5
6
|
}
|
|
6
7
|
export interface WatcherOwnerStore {
|
|
7
8
|
immediateTransaction<T>(fn: () => T): T;
|
|
8
9
|
selectOwner(): WatcherOwnerRow | undefined;
|
|
9
|
-
insertOwner(pid: number): void;
|
|
10
|
-
replaceOwner(pid: number): void;
|
|
10
|
+
insertOwner(pid: number, instanceId?: string): void;
|
|
11
|
+
replaceOwner(pid: number, instanceId?: string): void;
|
|
11
12
|
touchOwner(pid: number): void;
|
|
12
13
|
deleteOwner(pid: number): void;
|
|
13
14
|
}
|
|
@@ -15,6 +16,7 @@ interface AcquireOptions {
|
|
|
15
16
|
now?: () => number;
|
|
16
17
|
isAlive?: (pid: number) => boolean;
|
|
17
18
|
staleAfterSeconds?: number;
|
|
19
|
+
instanceId?: string;
|
|
18
20
|
}
|
|
19
21
|
export declare function acquireWatcherRole(db: WatcherOwnerStore, pid: number, options?: AcquireOptions): WatcherRole;
|
|
20
22
|
export declare function releaseWatcherRole(db: WatcherOwnerStore, pid: number): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipbul/gildash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "TypeScript code indexing and dependency graph engine for Bun",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,11 +39,14 @@
|
|
|
39
39
|
"changeset": "changeset",
|
|
40
40
|
"version-packages": "changeset version",
|
|
41
41
|
"release": "changeset publish",
|
|
42
|
+
"bench": "bun run bench/index-benchmark.ts && bun run bench/search-benchmark.ts && bun run bench/graph-benchmark.ts",
|
|
43
|
+
"bench:oss": "bun run bench/oss-benchmark.ts",
|
|
42
44
|
"prepare": "husky"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
47
|
"@ast-grep/napi": "^0.41.0",
|
|
46
48
|
"@parcel/watcher": "^2.5.6",
|
|
49
|
+
"@zipbul/result": "^0.1.4",
|
|
47
50
|
"comment-parser": "1.4.5",
|
|
48
51
|
"drizzle-orm": "^0.45.1",
|
|
49
52
|
"oxc-parser": "0.115.0"
|
|
@@ -55,11 +58,16 @@
|
|
|
55
58
|
"@commitlint/config-conventional": "^20.4.2",
|
|
56
59
|
"@types/bun": "latest",
|
|
57
60
|
"drizzle-kit": "^0.31.9",
|
|
61
|
+
"fast-check": "^4.5.3",
|
|
58
62
|
"husky": "^9.1.7",
|
|
59
63
|
"typescript": "^5.8.0"
|
|
60
64
|
},
|
|
61
65
|
"peerDependencies": {
|
|
62
|
-
"
|
|
63
|
-
|
|
66
|
+
"typescript": ">=5.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"typescript": {
|
|
70
|
+
"optional": true
|
|
71
|
+
}
|
|
64
72
|
}
|
|
65
73
|
}
|