@zipbul/gildash 0.8.2 → 0.9.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 +2 -0
- package/README.md +116 -0
- package/dist/index.js +8 -6
- package/dist/migrations/0006_annotations.sql +36 -0
- package/dist/migrations/0007_symbol_changelog.sql +22 -0
- package/dist/migrations/meta/_journal.json +15 -1
- package/dist/src/extractor/annotation-extractor.d.ts +3 -0
- package/dist/src/extractor/index.d.ts +2 -1
- package/dist/src/extractor/types.d.ts +8 -0
- package/dist/src/gildash/annotation-api.d.ts +3 -0
- package/dist/src/gildash/changelog-api.d.ts +4 -0
- package/dist/src/gildash/context.d.ts +10 -0
- package/dist/src/gildash/index.d.ts +5 -0
- package/dist/src/gildash/types.d.ts +23 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/indexer/annotation-indexer.d.ts +25 -0
- package/dist/src/indexer/index-coordinator.d.ts +35 -0
- package/dist/src/indexer/index.d.ts +2 -0
- package/dist/src/indexer/rename-detector.d.ts +26 -0
- package/dist/src/indexer/symbol-indexer.d.ts +3 -0
- package/dist/src/search/annotation-search.d.ts +44 -0
- package/dist/src/search/index.d.ts +2 -0
- package/dist/src/store/index.d.ts +4 -0
- package/dist/src/store/repositories/annotation.repository.d.ts +30 -0
- package/dist/src/store/repositories/changelog.repository.d.ts +32 -0
- package/dist/src/store/repositories/symbol.repository.d.ts +1 -0
- package/dist/src/store/schema.d.ts +475 -0
- package/package.json +1 -1
|
@@ -163,4 +163,12 @@ export interface CodeRelation {
|
|
|
163
163
|
/** Parsed metadata object derived from `metaJson`. */
|
|
164
164
|
meta?: Record<string, unknown>;
|
|
165
165
|
}
|
|
166
|
+
export type AnnotationSource = 'jsdoc' | 'line' | 'block';
|
|
167
|
+
export interface ExtractedAnnotation {
|
|
168
|
+
tag: string;
|
|
169
|
+
value: string;
|
|
170
|
+
source: AnnotationSource;
|
|
171
|
+
span: SourceSpan;
|
|
172
|
+
symbolName: string | null;
|
|
173
|
+
}
|
|
166
174
|
export type { SourcePosition, SourceSpan };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GildashContext } from './context';
|
|
2
|
+
import type { SymbolChange, SymbolChangeQueryOptions } from './types';
|
|
3
|
+
export declare function getSymbolChanges(ctx: GildashContext, since: Date | string, options?: SymbolChangeQueryOptions): SymbolChange[];
|
|
4
|
+
export declare function pruneChangelog(ctx: GildashContext, before: Date | string): number;
|
|
@@ -16,7 +16,9 @@ import type { TsconfigPaths } from '../common/tsconfig-resolver';
|
|
|
16
16
|
import type { SymbolSearchQuery, SymbolSearchResult, ISymbolRepo } from '../search/symbol-search';
|
|
17
17
|
import type { RelationSearchQuery, IRelationRepo } from '../search/relation-search';
|
|
18
18
|
import type { PatternMatch } from '../search/pattern-search';
|
|
19
|
+
import type { AnnotationSearchQuery, AnnotationSearchResult, IAnnotationRepo } from '../search/annotation-search';
|
|
19
20
|
import type { DependencyGraph } from '../search/dependency-graph';
|
|
21
|
+
import type { ChangelogRepository } from '../store/repositories/changelog.repository';
|
|
20
22
|
import type { SemanticLayer } from '../semantic/index';
|
|
21
23
|
import type { ParseCache } from '../parser/parse-cache';
|
|
22
24
|
import type { GildashError } from '../errors';
|
|
@@ -38,6 +40,11 @@ export type PatternSearchFn = (opts: {
|
|
|
38
40
|
pattern: string;
|
|
39
41
|
filePaths: string[];
|
|
40
42
|
}) => Promise<PatternMatch[]>;
|
|
43
|
+
export type AnnotationSearchFn = (options: {
|
|
44
|
+
annotationRepo: IAnnotationRepo;
|
|
45
|
+
project?: string;
|
|
46
|
+
query: AnnotationSearchQuery;
|
|
47
|
+
}) => AnnotationSearchResult[];
|
|
41
48
|
export type AcquireWatcherRoleFn = (db: WatcherOwnerStore, pid: number, options?: object) => WatcherRole | Promise<WatcherRole>;
|
|
42
49
|
export type ReleaseWatcherRoleFn = (db: WatcherOwnerStore, pid: number) => void;
|
|
43
50
|
export type UpdateHeartbeatFn = (db: WatcherOwnerStore, pid: number) => void;
|
|
@@ -63,6 +70,9 @@ export interface GildashContext {
|
|
|
63
70
|
readonly relationRepo: RelationRepository;
|
|
64
71
|
readonly fileRepo: FileRepoLike;
|
|
65
72
|
readonly parseCache: ParseCacheLike;
|
|
73
|
+
readonly annotationRepo: IAnnotationRepo | null;
|
|
74
|
+
readonly changelogRepo: ChangelogRepository | null;
|
|
75
|
+
readonly annotationSearchFn: AnnotationSearchFn | null;
|
|
66
76
|
readonly releaseWatcherRoleFn: ReleaseWatcherRoleFn;
|
|
67
77
|
readonly parseSourceFn: ParseSourceFn;
|
|
68
78
|
readonly extractSymbolsFn: ExtractSymbolsFn;
|
|
@@ -14,6 +14,8 @@ import type { FileChangeEvent } from '../watcher/types';
|
|
|
14
14
|
import { GildashError } from '../errors';
|
|
15
15
|
import type { GildashOptions, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol, BatchParseResult } from './types';
|
|
16
16
|
import type { GildashInternalOptions } from './lifecycle';
|
|
17
|
+
import type { AnnotationSearchQuery, AnnotationSearchResult } from '../search/annotation-search';
|
|
18
|
+
import type { SymbolChange, SymbolChangeQueryOptions } from './types';
|
|
17
19
|
export type { Logger, GildashOptions, SymbolDiff, ModuleInterface, HeritageNode, FullSymbol, FileStats, FanMetrics, ResolvedSymbol, BatchParseResult, } from './types';
|
|
18
20
|
export type { GildashInternalOptions } from './lifecycle';
|
|
19
21
|
/**
|
|
@@ -93,4 +95,7 @@ export declare class Gildash {
|
|
|
93
95
|
onFileChanged(callback: (event: FileChangeEvent) => void): () => void;
|
|
94
96
|
onError(callback: (error: GildashError) => void): () => void;
|
|
95
97
|
onRoleChanged(callback: (newRole: 'owner' | 'reader') => void): () => void;
|
|
98
|
+
searchAnnotations(query: AnnotationSearchQuery): AnnotationSearchResult[];
|
|
99
|
+
getSymbolChanges(since: Date | string, options?: SymbolChangeQueryOptions): SymbolChange[];
|
|
100
|
+
pruneChangelog(before: Date | string): number;
|
|
96
101
|
}
|
|
@@ -143,6 +143,29 @@ export interface BatchParseResult {
|
|
|
143
143
|
/**
|
|
144
144
|
* Options for creating a {@link Gildash} instance via {@link Gildash.open}.
|
|
145
145
|
*/
|
|
146
|
+
export type SymbolChangeType = 'added' | 'modified' | 'removed' | 'renamed' | 'moved';
|
|
147
|
+
export interface SymbolChange {
|
|
148
|
+
changeType: SymbolChangeType;
|
|
149
|
+
symbolName: string;
|
|
150
|
+
symbolKind: string;
|
|
151
|
+
filePath: string;
|
|
152
|
+
oldName: string | null;
|
|
153
|
+
oldFilePath: string | null;
|
|
154
|
+
fingerprint: string | null;
|
|
155
|
+
changedAt: string;
|
|
156
|
+
isFullIndex: boolean;
|
|
157
|
+
indexRunId: string;
|
|
158
|
+
}
|
|
159
|
+
export interface SymbolChangeQueryOptions {
|
|
160
|
+
symbolName?: string;
|
|
161
|
+
changeTypes?: SymbolChangeType[];
|
|
162
|
+
filePath?: string;
|
|
163
|
+
includeFullIndex?: boolean;
|
|
164
|
+
indexRunId?: string;
|
|
165
|
+
afterId?: number;
|
|
166
|
+
limit?: number;
|
|
167
|
+
project?: string;
|
|
168
|
+
}
|
|
146
169
|
export interface GildashOptions {
|
|
147
170
|
/** Absolute path to the project root directory. */
|
|
148
171
|
projectRoot: string;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -17,3 +17,6 @@ export type { WatcherRole } from "./watcher/types";
|
|
|
17
17
|
export type { ParsedFile } from "./parser/types";
|
|
18
18
|
export type { FileRecord } from "./store/repositories/file.repository";
|
|
19
19
|
export type { ResolvedType, SemanticReference, Implementation, SemanticModuleInterface } from "./semantic/types";
|
|
20
|
+
export type { AnnotationSource, ExtractedAnnotation } from "./extractor/types";
|
|
21
|
+
export type { AnnotationSearchQuery, AnnotationSearchResult } from "./search/annotation-search";
|
|
22
|
+
export type { SymbolChange, SymbolChangeType, SymbolChangeQueryOptions } from "./gildash/types";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ParsedFile } from '../parser/types';
|
|
2
|
+
interface AnnotationRepoPart {
|
|
3
|
+
deleteFileAnnotations(project: string, filePath: string): void;
|
|
4
|
+
insertBatch(project: string, filePath: string, rows: ReadonlyArray<{
|
|
5
|
+
project: string;
|
|
6
|
+
filePath: string;
|
|
7
|
+
tag: string;
|
|
8
|
+
value: string;
|
|
9
|
+
source: string;
|
|
10
|
+
symbolName: string | null;
|
|
11
|
+
startLine: number;
|
|
12
|
+
startColumn: number;
|
|
13
|
+
endLine: number;
|
|
14
|
+
endColumn: number;
|
|
15
|
+
indexedAt: string;
|
|
16
|
+
}>): void;
|
|
17
|
+
}
|
|
18
|
+
export interface IndexFileAnnotationsOptions {
|
|
19
|
+
parsed: ParsedFile;
|
|
20
|
+
project: string;
|
|
21
|
+
filePath: string;
|
|
22
|
+
annotationRepo: AnnotationRepoPart;
|
|
23
|
+
}
|
|
24
|
+
export declare function indexFileAnnotations(opts: IndexFileAnnotationsOptions): number;
|
|
25
|
+
export {};
|
|
@@ -24,6 +24,8 @@ export interface IndexResult {
|
|
|
24
24
|
totalSymbols: number;
|
|
25
25
|
/** Total relation count after indexing. */
|
|
26
26
|
totalRelations: number;
|
|
27
|
+
/** Total annotation count after indexing. */
|
|
28
|
+
totalAnnotations: number;
|
|
27
29
|
/** Wall-clock duration of the indexing run in milliseconds. */
|
|
28
30
|
durationMs: number;
|
|
29
31
|
/** Absolute paths of files that changed and were re-indexed. */
|
|
@@ -91,6 +93,38 @@ export interface IndexCoordinatorOptions {
|
|
|
91
93
|
}): void;
|
|
92
94
|
deleteFileRelations(project: string, filePath: string): void;
|
|
93
95
|
};
|
|
96
|
+
annotationRepo?: {
|
|
97
|
+
deleteFileAnnotations(project: string, filePath: string): void;
|
|
98
|
+
insertBatch(project: string, filePath: string, rows: ReadonlyArray<{
|
|
99
|
+
project: string;
|
|
100
|
+
filePath: string;
|
|
101
|
+
tag: string;
|
|
102
|
+
value: string;
|
|
103
|
+
source: string;
|
|
104
|
+
symbolName: string | null;
|
|
105
|
+
startLine: number;
|
|
106
|
+
startColumn: number;
|
|
107
|
+
endLine: number;
|
|
108
|
+
endColumn: number;
|
|
109
|
+
indexedAt: string;
|
|
110
|
+
}>): void;
|
|
111
|
+
};
|
|
112
|
+
changelogRepo?: {
|
|
113
|
+
insertBatch(rows: ReadonlyArray<{
|
|
114
|
+
project: string;
|
|
115
|
+
changeType: string;
|
|
116
|
+
symbolName: string;
|
|
117
|
+
symbolKind: string;
|
|
118
|
+
filePath: string;
|
|
119
|
+
oldName: string | null;
|
|
120
|
+
oldFilePath: string | null;
|
|
121
|
+
fingerprint: string | null;
|
|
122
|
+
changedAt: string;
|
|
123
|
+
isFullIndex: number;
|
|
124
|
+
indexRunId: string;
|
|
125
|
+
}>): void;
|
|
126
|
+
pruneOlderThan(project: string, before: string): number;
|
|
127
|
+
};
|
|
94
128
|
parseSourceFn?: typeof parseSource;
|
|
95
129
|
discoverProjectsFn?: typeof discoverProjects;
|
|
96
130
|
logger?: Logger;
|
|
@@ -107,6 +141,7 @@ export declare class IndexCoordinator {
|
|
|
107
141
|
private pendingFullIndexWaiters;
|
|
108
142
|
private tsconfigPathsRaw;
|
|
109
143
|
private boundariesRefresh;
|
|
144
|
+
private lastPruneAt;
|
|
110
145
|
constructor(opts: IndexCoordinatorOptions);
|
|
111
146
|
get tsconfigPaths(): Promise<TsconfigPaths | null>;
|
|
112
147
|
fullIndex(): Promise<IndexResult>;
|
|
@@ -4,5 +4,7 @@ export { indexFileSymbols } from './symbol-indexer';
|
|
|
4
4
|
export type { IndexFileSymbolsOptions, SymbolDbRow } from './symbol-indexer';
|
|
5
5
|
export { indexFileRelations } from './relation-indexer';
|
|
6
6
|
export type { IndexFileRelationsOptions, RelationDbRow } from './relation-indexer';
|
|
7
|
+
export { indexFileAnnotations } from './annotation-indexer';
|
|
8
|
+
export type { IndexFileAnnotationsOptions } from './annotation-indexer';
|
|
7
9
|
export { IndexCoordinator, WATCHER_DEBOUNCE_MS } from './index-coordinator';
|
|
8
10
|
export type { IndexCoordinatorOptions, IndexResult } from './index-coordinator';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface SymbolSnap {
|
|
2
|
+
name: string;
|
|
3
|
+
filePath: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
fingerprint: string | null;
|
|
6
|
+
structuralFingerprint: string | null;
|
|
7
|
+
startLine: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RenamedEntry {
|
|
10
|
+
oldName: string;
|
|
11
|
+
newName: string;
|
|
12
|
+
filePath: string;
|
|
13
|
+
kind: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SymbolInfo {
|
|
16
|
+
name: string;
|
|
17
|
+
filePath: string;
|
|
18
|
+
kind: string;
|
|
19
|
+
fingerprint: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface DetectRenamesResult {
|
|
22
|
+
renamed: RenamedEntry[];
|
|
23
|
+
added: SymbolInfo[];
|
|
24
|
+
removed: SymbolInfo[];
|
|
25
|
+
}
|
|
26
|
+
export declare function detectRenames(beforeSnapshot: Map<string, SymbolSnap>, afterSnapshot: Map<string, SymbolSnap>): DetectRenamesResult;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ParsedFile } from '../parser/types';
|
|
2
|
+
import type { ExtractedSymbol } from '../extractor/types';
|
|
2
3
|
export interface SymbolDbRow {
|
|
3
4
|
project: string;
|
|
4
5
|
filePath: string;
|
|
@@ -14,6 +15,7 @@ export interface SymbolDbRow {
|
|
|
14
15
|
detailJson: string | null;
|
|
15
16
|
contentHash: string;
|
|
16
17
|
indexedAt: string;
|
|
18
|
+
structuralFingerprint: string | null;
|
|
17
19
|
}
|
|
18
20
|
interface SymbolRepoPart {
|
|
19
21
|
replaceFileSymbols(project: string, filePath: string, contentHash: string, symbols: SymbolDbRow[]): void;
|
|
@@ -25,5 +27,6 @@ export interface IndexFileSymbolsOptions {
|
|
|
25
27
|
contentHash: string;
|
|
26
28
|
symbolRepo: SymbolRepoPart;
|
|
27
29
|
}
|
|
30
|
+
export declare function buildStructuralFingerprint(sym: ExtractedSymbol): string;
|
|
28
31
|
export declare function indexFileSymbols(opts: IndexFileSymbolsOptions): void;
|
|
29
32
|
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AnnotationSource } from '../extractor/types';
|
|
2
|
+
import type { AnnotationRecord } from '../store/repositories/annotation.repository';
|
|
3
|
+
export interface AnnotationSearchQuery {
|
|
4
|
+
text?: string;
|
|
5
|
+
tag?: string;
|
|
6
|
+
filePath?: string;
|
|
7
|
+
symbolName?: string;
|
|
8
|
+
source?: AnnotationSource;
|
|
9
|
+
project?: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface AnnotationSearchResult {
|
|
13
|
+
tag: string;
|
|
14
|
+
value: string;
|
|
15
|
+
source: AnnotationSource;
|
|
16
|
+
filePath: string;
|
|
17
|
+
symbolName: string | null;
|
|
18
|
+
span: {
|
|
19
|
+
start: {
|
|
20
|
+
line: number;
|
|
21
|
+
column: number;
|
|
22
|
+
};
|
|
23
|
+
end: {
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface IAnnotationRepo {
|
|
30
|
+
search(opts: {
|
|
31
|
+
project?: string;
|
|
32
|
+
tag?: string;
|
|
33
|
+
filePath?: string;
|
|
34
|
+
symbolName?: string;
|
|
35
|
+
source?: string;
|
|
36
|
+
ftsQuery?: string;
|
|
37
|
+
limit: number;
|
|
38
|
+
}): AnnotationRecord[];
|
|
39
|
+
}
|
|
40
|
+
export declare function annotationSearch(options: {
|
|
41
|
+
annotationRepo: IAnnotationRepo;
|
|
42
|
+
project?: string;
|
|
43
|
+
query: AnnotationSearchQuery;
|
|
44
|
+
}): AnnotationSearchResult[];
|
|
@@ -6,3 +6,5 @@ export { DependencyGraph } from './dependency-graph';
|
|
|
6
6
|
export type { IDependencyGraphRepo } from './dependency-graph';
|
|
7
7
|
export { patternSearch } from './pattern-search';
|
|
8
8
|
export type { PatternMatch, PatternSearchOptions } from './pattern-search';
|
|
9
|
+
export { annotationSearch } from './annotation-search';
|
|
10
|
+
export type { AnnotationSearchQuery, AnnotationSearchResult, IAnnotationRepo } from './annotation-search';
|
|
@@ -6,4 +6,8 @@ export { SymbolRepository } from './repositories/symbol.repository';
|
|
|
6
6
|
export type { SymbolRecord, SearchOptions, SymbolStats } from './repositories/symbol.repository';
|
|
7
7
|
export { RelationRepository } from './repositories/relation.repository';
|
|
8
8
|
export type { RelationRecord } from './repositories/relation.repository';
|
|
9
|
+
export { AnnotationRepository } from './repositories/annotation.repository';
|
|
10
|
+
export type { AnnotationRecord } from './repositories/annotation.repository';
|
|
11
|
+
export { ChangelogRepository } from './repositories/changelog.repository';
|
|
12
|
+
export type { ChangelogRecord } from './repositories/changelog.repository';
|
|
9
13
|
export * as schema from './schema';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DbConnection } from '../connection';
|
|
2
|
+
export interface AnnotationRecord {
|
|
3
|
+
id: number;
|
|
4
|
+
project: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
value: string;
|
|
8
|
+
source: string;
|
|
9
|
+
symbolName: string | null;
|
|
10
|
+
startLine: number;
|
|
11
|
+
startColumn: number;
|
|
12
|
+
endLine: number;
|
|
13
|
+
endColumn: number;
|
|
14
|
+
indexedAt: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class AnnotationRepository {
|
|
17
|
+
private readonly db;
|
|
18
|
+
constructor(db: DbConnection);
|
|
19
|
+
insertBatch(project: string, filePath: string, rows: ReadonlyArray<Omit<AnnotationRecord, 'id'>>): void;
|
|
20
|
+
deleteFileAnnotations(project: string, filePath: string): void;
|
|
21
|
+
search(opts: {
|
|
22
|
+
project?: string;
|
|
23
|
+
tag?: string;
|
|
24
|
+
filePath?: string;
|
|
25
|
+
symbolName?: string;
|
|
26
|
+
source?: string;
|
|
27
|
+
ftsQuery?: string;
|
|
28
|
+
limit: number;
|
|
29
|
+
}): AnnotationRecord[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DbConnection } from '../connection';
|
|
2
|
+
export interface ChangelogRecord {
|
|
3
|
+
id: number;
|
|
4
|
+
project: string;
|
|
5
|
+
changeType: string;
|
|
6
|
+
symbolName: string;
|
|
7
|
+
symbolKind: string;
|
|
8
|
+
filePath: string;
|
|
9
|
+
oldName: string | null;
|
|
10
|
+
oldFilePath: string | null;
|
|
11
|
+
fingerprint: string | null;
|
|
12
|
+
changedAt: string;
|
|
13
|
+
isFullIndex: number;
|
|
14
|
+
indexRunId: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class ChangelogRepository {
|
|
17
|
+
private readonly db;
|
|
18
|
+
constructor(db: DbConnection);
|
|
19
|
+
insertBatch(rows: ReadonlyArray<Omit<ChangelogRecord, 'id'>>): void;
|
|
20
|
+
getSince(opts: {
|
|
21
|
+
project: string;
|
|
22
|
+
since: string;
|
|
23
|
+
symbolName?: string;
|
|
24
|
+
changeTypes?: string[];
|
|
25
|
+
filePath?: string;
|
|
26
|
+
includeFullIndex?: boolean;
|
|
27
|
+
indexRunId?: string;
|
|
28
|
+
afterId?: number;
|
|
29
|
+
limit: number;
|
|
30
|
+
}): ChangelogRecord[];
|
|
31
|
+
pruneOlderThan(project: string, before: string): number;
|
|
32
|
+
}
|