@zipbul/gildash 0.0.1
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/LICENSE +21 -0
- package/README.ko.md +386 -0
- package/README.md +445 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2736 -0
- package/dist/index.js.map +42 -0
- package/dist/migrations/0000_soft_revanche.sql +56 -0
- package/dist/migrations/meta/0000_snapshot.json +408 -0
- package/dist/migrations/meta/_journal.json +13 -0
- package/dist/migrations/migrations/0000_soft_revanche.sql +56 -0
- package/dist/migrations/migrations/meta/0000_snapshot.json +408 -0
- package/dist/migrations/migrations/meta/_journal.json +13 -0
- package/dist/src/codeledger.d.ts +103 -0
- package/dist/src/common/hasher.d.ts +2 -0
- package/dist/src/common/index.d.ts +5 -0
- package/dist/src/common/lru-cache.d.ts +10 -0
- package/dist/src/common/path-utils.d.ts +2 -0
- package/dist/src/common/project-discovery.d.ts +6 -0
- package/dist/src/common/tsconfig-resolver.d.ts +6 -0
- package/dist/src/errors.d.ts +42 -0
- package/dist/src/extractor/calls-extractor.d.ts +3 -0
- package/dist/src/extractor/extractor-utils.d.ts +5 -0
- package/dist/src/extractor/heritage-extractor.d.ts +3 -0
- package/dist/src/extractor/imports-extractor.d.ts +4 -0
- package/dist/src/extractor/index.d.ts +7 -0
- package/dist/src/extractor/relation-extractor.d.ts +4 -0
- package/dist/src/extractor/symbol-extractor.d.ts +3 -0
- package/dist/src/extractor/types.d.ts +162 -0
- package/dist/src/gildash.d.ts +284 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/indexer/file-indexer.d.ts +27 -0
- package/dist/src/indexer/index-coordinator.d.ts +80 -0
- package/dist/src/indexer/index.d.ts +8 -0
- package/dist/src/indexer/relation-indexer.d.ts +24 -0
- package/dist/src/indexer/symbol-indexer.d.ts +29 -0
- package/dist/src/parser/ast-utils.d.ts +10 -0
- package/dist/src/parser/index.d.ts +6 -0
- package/dist/src/parser/jsdoc-parser.d.ts +2 -0
- package/dist/src/parser/parse-cache.d.ts +10 -0
- package/dist/src/parser/parse-source.d.ts +3 -0
- package/dist/src/parser/source-position.d.ts +3 -0
- package/dist/src/parser/types.d.ts +16 -0
- package/dist/src/search/dependency-graph.d.ts +71 -0
- package/dist/src/search/index.d.ts +6 -0
- package/dist/src/search/relation-search.d.ts +45 -0
- package/dist/src/search/symbol-search.d.ts +76 -0
- package/dist/src/store/connection.d.ts +30 -0
- package/dist/src/store/index.d.ts +10 -0
- package/dist/src/store/repositories/file.repository.d.ts +18 -0
- package/dist/src/store/repositories/fts-utils.d.ts +1 -0
- package/dist/src/store/repositories/relation.repository.d.ts +29 -0
- package/dist/src/store/repositories/symbol.repository.d.ts +46 -0
- package/dist/src/store/schema.d.ts +634 -0
- package/dist/src/watcher/index.d.ts +3 -0
- package/dist/src/watcher/ownership.d.ts +22 -0
- package/dist/src/watcher/project-watcher.d.ts +13 -0
- package/dist/src/watcher/types.d.ts +11 -0
- package/package.json +58 -0
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "dde10964-60b8-4981-af9f-7d4664d0d20a",
|
|
5
|
+
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
|
+
"tables": {
|
|
7
|
+
"files": {
|
|
8
|
+
"name": "files",
|
|
9
|
+
"columns": {
|
|
10
|
+
"project": {
|
|
11
|
+
"name": "project",
|
|
12
|
+
"type": "text",
|
|
13
|
+
"primaryKey": false,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": false
|
|
16
|
+
},
|
|
17
|
+
"file_path": {
|
|
18
|
+
"name": "file_path",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"mtime_ms": {
|
|
25
|
+
"name": "mtime_ms",
|
|
26
|
+
"type": "real",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true,
|
|
29
|
+
"autoincrement": false
|
|
30
|
+
},
|
|
31
|
+
"size": {
|
|
32
|
+
"name": "size",
|
|
33
|
+
"type": "integer",
|
|
34
|
+
"primaryKey": false,
|
|
35
|
+
"notNull": true,
|
|
36
|
+
"autoincrement": false
|
|
37
|
+
},
|
|
38
|
+
"content_hash": {
|
|
39
|
+
"name": "content_hash",
|
|
40
|
+
"type": "text",
|
|
41
|
+
"primaryKey": false,
|
|
42
|
+
"notNull": true,
|
|
43
|
+
"autoincrement": false
|
|
44
|
+
},
|
|
45
|
+
"updated_at": {
|
|
46
|
+
"name": "updated_at",
|
|
47
|
+
"type": "text",
|
|
48
|
+
"primaryKey": false,
|
|
49
|
+
"notNull": true,
|
|
50
|
+
"autoincrement": false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"indexes": {},
|
|
54
|
+
"foreignKeys": {},
|
|
55
|
+
"compositePrimaryKeys": {
|
|
56
|
+
"files_project_file_path_pk": {
|
|
57
|
+
"columns": [
|
|
58
|
+
"project",
|
|
59
|
+
"file_path"
|
|
60
|
+
],
|
|
61
|
+
"name": "files_project_file_path_pk"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"uniqueConstraints": {},
|
|
65
|
+
"checkConstraints": {}
|
|
66
|
+
},
|
|
67
|
+
"relations": {
|
|
68
|
+
"name": "relations",
|
|
69
|
+
"columns": {
|
|
70
|
+
"id": {
|
|
71
|
+
"name": "id",
|
|
72
|
+
"type": "integer",
|
|
73
|
+
"primaryKey": true,
|
|
74
|
+
"notNull": true,
|
|
75
|
+
"autoincrement": true
|
|
76
|
+
},
|
|
77
|
+
"project": {
|
|
78
|
+
"name": "project",
|
|
79
|
+
"type": "text",
|
|
80
|
+
"primaryKey": false,
|
|
81
|
+
"notNull": true,
|
|
82
|
+
"autoincrement": false
|
|
83
|
+
},
|
|
84
|
+
"type": {
|
|
85
|
+
"name": "type",
|
|
86
|
+
"type": "text",
|
|
87
|
+
"primaryKey": false,
|
|
88
|
+
"notNull": true,
|
|
89
|
+
"autoincrement": false
|
|
90
|
+
},
|
|
91
|
+
"src_file_path": {
|
|
92
|
+
"name": "src_file_path",
|
|
93
|
+
"type": "text",
|
|
94
|
+
"primaryKey": false,
|
|
95
|
+
"notNull": true,
|
|
96
|
+
"autoincrement": false
|
|
97
|
+
},
|
|
98
|
+
"src_symbol_name": {
|
|
99
|
+
"name": "src_symbol_name",
|
|
100
|
+
"type": "text",
|
|
101
|
+
"primaryKey": false,
|
|
102
|
+
"notNull": false,
|
|
103
|
+
"autoincrement": false
|
|
104
|
+
},
|
|
105
|
+
"dst_file_path": {
|
|
106
|
+
"name": "dst_file_path",
|
|
107
|
+
"type": "text",
|
|
108
|
+
"primaryKey": false,
|
|
109
|
+
"notNull": true,
|
|
110
|
+
"autoincrement": false
|
|
111
|
+
},
|
|
112
|
+
"dst_symbol_name": {
|
|
113
|
+
"name": "dst_symbol_name",
|
|
114
|
+
"type": "text",
|
|
115
|
+
"primaryKey": false,
|
|
116
|
+
"notNull": false,
|
|
117
|
+
"autoincrement": false
|
|
118
|
+
},
|
|
119
|
+
"meta_json": {
|
|
120
|
+
"name": "meta_json",
|
|
121
|
+
"type": "text",
|
|
122
|
+
"primaryKey": false,
|
|
123
|
+
"notNull": false,
|
|
124
|
+
"autoincrement": false
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"indexes": {
|
|
128
|
+
"idx_relations_src": {
|
|
129
|
+
"name": "idx_relations_src",
|
|
130
|
+
"columns": [
|
|
131
|
+
"project",
|
|
132
|
+
"src_file_path"
|
|
133
|
+
],
|
|
134
|
+
"isUnique": false
|
|
135
|
+
},
|
|
136
|
+
"idx_relations_dst": {
|
|
137
|
+
"name": "idx_relations_dst",
|
|
138
|
+
"columns": [
|
|
139
|
+
"project",
|
|
140
|
+
"dst_file_path"
|
|
141
|
+
],
|
|
142
|
+
"isUnique": false
|
|
143
|
+
},
|
|
144
|
+
"idx_relations_type": {
|
|
145
|
+
"name": "idx_relations_type",
|
|
146
|
+
"columns": [
|
|
147
|
+
"project",
|
|
148
|
+
"type"
|
|
149
|
+
],
|
|
150
|
+
"isUnique": false
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"foreignKeys": {
|
|
154
|
+
"relations_project_src_file_path_files_project_file_path_fk": {
|
|
155
|
+
"name": "relations_project_src_file_path_files_project_file_path_fk",
|
|
156
|
+
"tableFrom": "relations",
|
|
157
|
+
"tableTo": "files",
|
|
158
|
+
"columnsFrom": [
|
|
159
|
+
"project",
|
|
160
|
+
"src_file_path"
|
|
161
|
+
],
|
|
162
|
+
"columnsTo": [
|
|
163
|
+
"project",
|
|
164
|
+
"file_path"
|
|
165
|
+
],
|
|
166
|
+
"onDelete": "cascade",
|
|
167
|
+
"onUpdate": "no action"
|
|
168
|
+
},
|
|
169
|
+
"relations_project_dst_file_path_files_project_file_path_fk": {
|
|
170
|
+
"name": "relations_project_dst_file_path_files_project_file_path_fk",
|
|
171
|
+
"tableFrom": "relations",
|
|
172
|
+
"tableTo": "files",
|
|
173
|
+
"columnsFrom": [
|
|
174
|
+
"project",
|
|
175
|
+
"dst_file_path"
|
|
176
|
+
],
|
|
177
|
+
"columnsTo": [
|
|
178
|
+
"project",
|
|
179
|
+
"file_path"
|
|
180
|
+
],
|
|
181
|
+
"onDelete": "cascade",
|
|
182
|
+
"onUpdate": "no action"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"compositePrimaryKeys": {},
|
|
186
|
+
"uniqueConstraints": {},
|
|
187
|
+
"checkConstraints": {}
|
|
188
|
+
},
|
|
189
|
+
"symbols": {
|
|
190
|
+
"name": "symbols",
|
|
191
|
+
"columns": {
|
|
192
|
+
"id": {
|
|
193
|
+
"name": "id",
|
|
194
|
+
"type": "integer",
|
|
195
|
+
"primaryKey": true,
|
|
196
|
+
"notNull": true,
|
|
197
|
+
"autoincrement": true
|
|
198
|
+
},
|
|
199
|
+
"project": {
|
|
200
|
+
"name": "project",
|
|
201
|
+
"type": "text",
|
|
202
|
+
"primaryKey": false,
|
|
203
|
+
"notNull": true,
|
|
204
|
+
"autoincrement": false
|
|
205
|
+
},
|
|
206
|
+
"file_path": {
|
|
207
|
+
"name": "file_path",
|
|
208
|
+
"type": "text",
|
|
209
|
+
"primaryKey": false,
|
|
210
|
+
"notNull": true,
|
|
211
|
+
"autoincrement": false
|
|
212
|
+
},
|
|
213
|
+
"kind": {
|
|
214
|
+
"name": "kind",
|
|
215
|
+
"type": "text",
|
|
216
|
+
"primaryKey": false,
|
|
217
|
+
"notNull": true,
|
|
218
|
+
"autoincrement": false
|
|
219
|
+
},
|
|
220
|
+
"name": {
|
|
221
|
+
"name": "name",
|
|
222
|
+
"type": "text",
|
|
223
|
+
"primaryKey": false,
|
|
224
|
+
"notNull": true,
|
|
225
|
+
"autoincrement": false
|
|
226
|
+
},
|
|
227
|
+
"start_line": {
|
|
228
|
+
"name": "start_line",
|
|
229
|
+
"type": "integer",
|
|
230
|
+
"primaryKey": false,
|
|
231
|
+
"notNull": true,
|
|
232
|
+
"autoincrement": false
|
|
233
|
+
},
|
|
234
|
+
"start_column": {
|
|
235
|
+
"name": "start_column",
|
|
236
|
+
"type": "integer",
|
|
237
|
+
"primaryKey": false,
|
|
238
|
+
"notNull": true,
|
|
239
|
+
"autoincrement": false
|
|
240
|
+
},
|
|
241
|
+
"end_line": {
|
|
242
|
+
"name": "end_line",
|
|
243
|
+
"type": "integer",
|
|
244
|
+
"primaryKey": false,
|
|
245
|
+
"notNull": true,
|
|
246
|
+
"autoincrement": false
|
|
247
|
+
},
|
|
248
|
+
"end_column": {
|
|
249
|
+
"name": "end_column",
|
|
250
|
+
"type": "integer",
|
|
251
|
+
"primaryKey": false,
|
|
252
|
+
"notNull": true,
|
|
253
|
+
"autoincrement": false
|
|
254
|
+
},
|
|
255
|
+
"is_exported": {
|
|
256
|
+
"name": "is_exported",
|
|
257
|
+
"type": "integer",
|
|
258
|
+
"primaryKey": false,
|
|
259
|
+
"notNull": true,
|
|
260
|
+
"autoincrement": false,
|
|
261
|
+
"default": 0
|
|
262
|
+
},
|
|
263
|
+
"signature": {
|
|
264
|
+
"name": "signature",
|
|
265
|
+
"type": "text",
|
|
266
|
+
"primaryKey": false,
|
|
267
|
+
"notNull": false,
|
|
268
|
+
"autoincrement": false
|
|
269
|
+
},
|
|
270
|
+
"fingerprint": {
|
|
271
|
+
"name": "fingerprint",
|
|
272
|
+
"type": "text",
|
|
273
|
+
"primaryKey": false,
|
|
274
|
+
"notNull": false,
|
|
275
|
+
"autoincrement": false
|
|
276
|
+
},
|
|
277
|
+
"detail_json": {
|
|
278
|
+
"name": "detail_json",
|
|
279
|
+
"type": "text",
|
|
280
|
+
"primaryKey": false,
|
|
281
|
+
"notNull": false,
|
|
282
|
+
"autoincrement": false
|
|
283
|
+
},
|
|
284
|
+
"content_hash": {
|
|
285
|
+
"name": "content_hash",
|
|
286
|
+
"type": "text",
|
|
287
|
+
"primaryKey": false,
|
|
288
|
+
"notNull": true,
|
|
289
|
+
"autoincrement": false
|
|
290
|
+
},
|
|
291
|
+
"indexed_at": {
|
|
292
|
+
"name": "indexed_at",
|
|
293
|
+
"type": "text",
|
|
294
|
+
"primaryKey": false,
|
|
295
|
+
"notNull": true,
|
|
296
|
+
"autoincrement": false
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"indexes": {
|
|
300
|
+
"idx_symbols_project_file": {
|
|
301
|
+
"name": "idx_symbols_project_file",
|
|
302
|
+
"columns": [
|
|
303
|
+
"project",
|
|
304
|
+
"file_path"
|
|
305
|
+
],
|
|
306
|
+
"isUnique": false
|
|
307
|
+
},
|
|
308
|
+
"idx_symbols_project_kind": {
|
|
309
|
+
"name": "idx_symbols_project_kind",
|
|
310
|
+
"columns": [
|
|
311
|
+
"project",
|
|
312
|
+
"kind"
|
|
313
|
+
],
|
|
314
|
+
"isUnique": false
|
|
315
|
+
},
|
|
316
|
+
"idx_symbols_project_name": {
|
|
317
|
+
"name": "idx_symbols_project_name",
|
|
318
|
+
"columns": [
|
|
319
|
+
"project",
|
|
320
|
+
"name"
|
|
321
|
+
],
|
|
322
|
+
"isUnique": false
|
|
323
|
+
},
|
|
324
|
+
"idx_symbols_fingerprint": {
|
|
325
|
+
"name": "idx_symbols_fingerprint",
|
|
326
|
+
"columns": [
|
|
327
|
+
"project",
|
|
328
|
+
"fingerprint"
|
|
329
|
+
],
|
|
330
|
+
"isUnique": false
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"foreignKeys": {
|
|
334
|
+
"symbols_project_file_path_files_project_file_path_fk": {
|
|
335
|
+
"name": "symbols_project_file_path_files_project_file_path_fk",
|
|
336
|
+
"tableFrom": "symbols",
|
|
337
|
+
"tableTo": "files",
|
|
338
|
+
"columnsFrom": [
|
|
339
|
+
"project",
|
|
340
|
+
"file_path"
|
|
341
|
+
],
|
|
342
|
+
"columnsTo": [
|
|
343
|
+
"project",
|
|
344
|
+
"file_path"
|
|
345
|
+
],
|
|
346
|
+
"onDelete": "cascade",
|
|
347
|
+
"onUpdate": "no action"
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
"compositePrimaryKeys": {},
|
|
351
|
+
"uniqueConstraints": {},
|
|
352
|
+
"checkConstraints": {}
|
|
353
|
+
},
|
|
354
|
+
"watcher_owner": {
|
|
355
|
+
"name": "watcher_owner",
|
|
356
|
+
"columns": {
|
|
357
|
+
"id": {
|
|
358
|
+
"name": "id",
|
|
359
|
+
"type": "integer",
|
|
360
|
+
"primaryKey": true,
|
|
361
|
+
"notNull": true,
|
|
362
|
+
"autoincrement": false
|
|
363
|
+
},
|
|
364
|
+
"pid": {
|
|
365
|
+
"name": "pid",
|
|
366
|
+
"type": "integer",
|
|
367
|
+
"primaryKey": false,
|
|
368
|
+
"notNull": true,
|
|
369
|
+
"autoincrement": false
|
|
370
|
+
},
|
|
371
|
+
"started_at": {
|
|
372
|
+
"name": "started_at",
|
|
373
|
+
"type": "text",
|
|
374
|
+
"primaryKey": false,
|
|
375
|
+
"notNull": true,
|
|
376
|
+
"autoincrement": false
|
|
377
|
+
},
|
|
378
|
+
"heartbeat_at": {
|
|
379
|
+
"name": "heartbeat_at",
|
|
380
|
+
"type": "text",
|
|
381
|
+
"primaryKey": false,
|
|
382
|
+
"notNull": true,
|
|
383
|
+
"autoincrement": false
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"indexes": {},
|
|
387
|
+
"foreignKeys": {},
|
|
388
|
+
"compositePrimaryKeys": {},
|
|
389
|
+
"uniqueConstraints": {},
|
|
390
|
+
"checkConstraints": {
|
|
391
|
+
"watcher_owner_singleton": {
|
|
392
|
+
"name": "watcher_owner_singleton",
|
|
393
|
+
"value": "\"watcher_owner\".\"id\" = 1"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
"views": {},
|
|
399
|
+
"enums": {},
|
|
400
|
+
"_meta": {
|
|
401
|
+
"schemas": {},
|
|
402
|
+
"tables": {},
|
|
403
|
+
"columns": {}
|
|
404
|
+
},
|
|
405
|
+
"internal": {
|
|
406
|
+
"indexes": {}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { ParsedFile } from './parser/types';
|
|
2
|
+
import { parseSource as defaultParseSource } from './parser/parse-source';
|
|
3
|
+
import { ParseCache } from './parser/parse-cache';
|
|
4
|
+
import type { ExtractedSymbol } from './extractor/types';
|
|
5
|
+
import { extractSymbols as defaultExtractSymbols } from './extractor/symbol-extractor';
|
|
6
|
+
import { extractRelations as defaultExtractRelations } from './extractor/relation-extractor';
|
|
7
|
+
import type { CodeRelation } from './extractor/types';
|
|
8
|
+
import { DbConnection } from './store/connection';
|
|
9
|
+
import { FileRepository } from './store/repositories/file.repository';
|
|
10
|
+
import { SymbolRepository } from './store/repositories/symbol.repository';
|
|
11
|
+
import { RelationRepository } from './store/repositories/relation.repository';
|
|
12
|
+
import { ProjectWatcher } from './watcher/project-watcher';
|
|
13
|
+
import { IndexCoordinator } from './indexer/index-coordinator';
|
|
14
|
+
import type { IndexResult } from './indexer/index-coordinator';
|
|
15
|
+
import type { FileChangeEvent } from './watcher/types';
|
|
16
|
+
import { acquireWatcherRole, releaseWatcherRole, updateHeartbeat } from './watcher/ownership';
|
|
17
|
+
import type { WatcherOwnerStore } from './watcher/ownership';
|
|
18
|
+
import { discoverProjects } from './common/project-discovery';
|
|
19
|
+
import type { ProjectBoundary } from './common/project-discovery';
|
|
20
|
+
import { loadTsconfigPaths } from './common/tsconfig-resolver';
|
|
21
|
+
import type { TsconfigPaths } from './common/tsconfig-resolver';
|
|
22
|
+
import { symbolSearch as defaultSymbolSearch } from './search/symbol-search';
|
|
23
|
+
import type { SymbolSearchQuery, SymbolSearchResult } from './search/symbol-search';
|
|
24
|
+
import { relationSearch as defaultRelationSearch } from './search/relation-search';
|
|
25
|
+
import type { RelationSearchQuery } from './search/relation-search';
|
|
26
|
+
import type { SymbolStats } from './store/repositories/symbol.repository';
|
|
27
|
+
export interface Logger {
|
|
28
|
+
error(...args: unknown[]): void;
|
|
29
|
+
}
|
|
30
|
+
export interface CodeledgerOptions {
|
|
31
|
+
projectRoot: string;
|
|
32
|
+
extensions?: string[];
|
|
33
|
+
ignorePatterns?: string[];
|
|
34
|
+
parseCacheCapacity?: number;
|
|
35
|
+
logger?: Logger;
|
|
36
|
+
}
|
|
37
|
+
/** @internal */
|
|
38
|
+
interface CodeledgerInternalOptions {
|
|
39
|
+
existsSyncFn?: (p: string) => boolean;
|
|
40
|
+
dbConnectionFactory?: () => Pick<DbConnection, 'open' | 'close' | 'transaction'> & WatcherOwnerStore;
|
|
41
|
+
watcherFactory?: () => Pick<ProjectWatcher, 'start' | 'close'>;
|
|
42
|
+
coordinatorFactory?: () => Pick<IndexCoordinator, 'fullIndex' | 'shutdown' | 'onIndexed'> & {
|
|
43
|
+
tsconfigPaths?: Promise<TsconfigPaths | null>;
|
|
44
|
+
handleWatcherEvent?(event: FileChangeEvent): void;
|
|
45
|
+
};
|
|
46
|
+
repositoryFactory?: () => {
|
|
47
|
+
fileRepo: Pick<FileRepository, 'upsertFile' | 'getAllFiles' | 'getFilesMap' | 'deleteFile'>;
|
|
48
|
+
symbolRepo: SymbolRepository;
|
|
49
|
+
relationRepo: RelationRepository;
|
|
50
|
+
parseCache: Pick<ParseCache, 'set' | 'get' | 'invalidate'>;
|
|
51
|
+
};
|
|
52
|
+
acquireWatcherRoleFn?: typeof acquireWatcherRole;
|
|
53
|
+
releaseWatcherRoleFn?: typeof releaseWatcherRole;
|
|
54
|
+
updateHeartbeatFn?: typeof updateHeartbeat;
|
|
55
|
+
discoverProjectsFn?: typeof discoverProjects;
|
|
56
|
+
parseSourceFn?: typeof defaultParseSource;
|
|
57
|
+
extractSymbolsFn?: typeof defaultExtractSymbols;
|
|
58
|
+
extractRelationsFn?: typeof defaultExtractRelations;
|
|
59
|
+
symbolSearchFn?: typeof defaultSymbolSearch;
|
|
60
|
+
relationSearchFn?: typeof defaultRelationSearch;
|
|
61
|
+
loadTsconfigPathsFn?: typeof loadTsconfigPaths;
|
|
62
|
+
}
|
|
63
|
+
export declare class Codeledger {
|
|
64
|
+
readonly projectRoot: string;
|
|
65
|
+
private readonly db;
|
|
66
|
+
private readonly symbolRepo;
|
|
67
|
+
private readonly relationRepo;
|
|
68
|
+
private readonly parseCache;
|
|
69
|
+
private coordinator;
|
|
70
|
+
private watcher;
|
|
71
|
+
private readonly releaseWatcherRoleFn;
|
|
72
|
+
private readonly parseSourceFn;
|
|
73
|
+
private readonly extractSymbolsFn;
|
|
74
|
+
private readonly extractRelationsFn;
|
|
75
|
+
private readonly symbolSearchFn;
|
|
76
|
+
private readonly relationSearchFn;
|
|
77
|
+
private readonly logger;
|
|
78
|
+
private readonly defaultProject;
|
|
79
|
+
private readonly role;
|
|
80
|
+
private timer;
|
|
81
|
+
private signalHandlers;
|
|
82
|
+
private closed;
|
|
83
|
+
private tsconfigPaths;
|
|
84
|
+
private boundaries;
|
|
85
|
+
private readonly onIndexedCallbacks;
|
|
86
|
+
private constructor();
|
|
87
|
+
static open(options: CodeledgerOptions & CodeledgerInternalOptions): Promise<Codeledger>;
|
|
88
|
+
close(): Promise<void>;
|
|
89
|
+
onIndexed(callback: (result: IndexResult) => void): () => void;
|
|
90
|
+
parseSource(filePath: string, sourceText: string): ParsedFile;
|
|
91
|
+
extractSymbols(parsed: ParsedFile): ExtractedSymbol[];
|
|
92
|
+
extractRelations(parsed: ParsedFile): CodeRelation[];
|
|
93
|
+
reindex(): Promise<IndexResult>;
|
|
94
|
+
get projects(): ProjectBoundary[];
|
|
95
|
+
getStats(project?: string): SymbolStats;
|
|
96
|
+
searchSymbols(query: SymbolSearchQuery): SymbolSearchResult[];
|
|
97
|
+
searchRelations(query: RelationSearchQuery): CodeRelation[];
|
|
98
|
+
getDependencies(filePath: string, project?: string, limit?: number): string[];
|
|
99
|
+
getDependents(filePath: string, project?: string, limit?: number): string[];
|
|
100
|
+
getAffected(changedFiles: string[], project?: string): Promise<string[]>;
|
|
101
|
+
hasCycle(project?: string): Promise<boolean>;
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ProjectBoundary {
|
|
2
|
+
dir: string;
|
|
3
|
+
project: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function discoverProjects(projectRoot: string): Promise<ProjectBoundary[]>;
|
|
6
|
+
export declare function resolveFileProject(filePath: string, boundaries: ProjectBoundary[], rootProject?: string): string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all Gildash errors.
|
|
3
|
+
* Every error thrown by this library is an instance of `GildashError`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* try {
|
|
8
|
+
* await Gildash.open({ projectRoot: '/path' });
|
|
9
|
+
* } catch (err) {
|
|
10
|
+
* if (err instanceof GildashError) {
|
|
11
|
+
* console.error('Gildash error:', err.message);
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare class GildashError extends Error {
|
|
17
|
+
constructor(message: string, options?: ErrorOptions);
|
|
18
|
+
}
|
|
19
|
+
/** Thrown when the file watcher fails to start or stop. */
|
|
20
|
+
export declare class WatcherError extends GildashError {
|
|
21
|
+
constructor(message: string, options?: ErrorOptions);
|
|
22
|
+
}
|
|
23
|
+
/** Thrown when AST parsing of a TypeScript file fails. */
|
|
24
|
+
export declare class ParseError extends GildashError {
|
|
25
|
+
constructor(message: string, options?: ErrorOptions);
|
|
26
|
+
}
|
|
27
|
+
/** Thrown when symbol or relation extraction from a parsed AST fails. */
|
|
28
|
+
export declare class ExtractError extends GildashError {
|
|
29
|
+
constructor(message: string, options?: ErrorOptions);
|
|
30
|
+
}
|
|
31
|
+
/** Thrown when the indexing pipeline encounters an unrecoverable error. */
|
|
32
|
+
export declare class IndexError extends GildashError {
|
|
33
|
+
constructor(message: string, options?: ErrorOptions);
|
|
34
|
+
}
|
|
35
|
+
/** Thrown when a database (SQLite) operation fails. */
|
|
36
|
+
export declare class StoreError extends GildashError {
|
|
37
|
+
constructor(message: string, options?: ErrorOptions);
|
|
38
|
+
}
|
|
39
|
+
/** Thrown when a search query (symbol search, relation search) fails. */
|
|
40
|
+
export declare class SearchError extends GildashError {
|
|
41
|
+
constructor(message: string, options?: ErrorOptions);
|
|
42
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Program } from 'oxc-parser';
|
|
2
|
+
import type { TsconfigPaths } from '../common/tsconfig-resolver';
|
|
3
|
+
import type { ImportReference } from './types';
|
|
4
|
+
export declare function resolveImport(currentFilePath: string, importPath: string, tsconfigPaths?: TsconfigPaths): string[];
|
|
5
|
+
export declare function buildImportMap(ast: Program, currentFilePath: string, tsconfigPaths?: TsconfigPaths, resolveImportFn?: (currentFilePath: string, importPath: string, tsconfigPaths?: TsconfigPaths) => string[]): Map<string, ImportReference>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from 'oxc-parser';
|
|
2
|
+
import type { TsconfigPaths } from '../common/tsconfig-resolver';
|
|
3
|
+
import type { CodeRelation } from './types';
|
|
4
|
+
export declare function extractImports(ast: Program, filePath: string, tsconfigPaths?: TsconfigPaths, resolveImportFn?: (currentFilePath: string, importPath: string, tsconfigPaths?: TsconfigPaths) => string[]): CodeRelation[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { extractSymbols } from './symbol-extractor';
|
|
2
|
+
export { extractRelations } from './relation-extractor';
|
|
3
|
+
export { extractImports } from './imports-extractor';
|
|
4
|
+
export { extractCalls } from './calls-extractor';
|
|
5
|
+
export { extractHeritage } from './heritage-extractor';
|
|
6
|
+
export { resolveImport, buildImportMap } from './extractor-utils';
|
|
7
|
+
export type { ExtractedSymbol, SymbolKind, CodeRelation, Parameter, Modifier, Heritage, Decorator, JsDocBlock, JsDocTag, ImportReference, QualifiedName, } from './types';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Program } from 'oxc-parser';
|
|
2
|
+
import type { TsconfigPaths } from '../common/tsconfig-resolver';
|
|
3
|
+
import type { CodeRelation } from './types';
|
|
4
|
+
export declare function extractRelations(ast: Program, filePath: string, tsconfigPaths?: TsconfigPaths): CodeRelation[];
|