@zipbul/gildash 0.26.0 → 0.27.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 +63 -9
- package/README.md +221 -28
- package/dist/index.js +9 -9
- package/dist/src/extractor/types.d.ts +20 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/parser/ast-utils.d.ts +71 -1
- package/dist/src/parser/index.d.ts +1 -1
- package/dist/src/search/relation-search.d.ts +8 -1
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -260,7 +260,8 @@ try {
|
|
|
260
260
|
| `hasCycle(project?)` | `Promise<boolean>` | 순환 의존성 감지 |
|
|
261
261
|
| `getCyclePaths(project?, opts?)` | `Promise<string[][]>` | 모든 순환 경로 (Tarjan SCC + Johnson's). `opts.maxCycles`로 개수 제한 가능. |
|
|
262
262
|
| `getImportGraph(project?)` | `Promise<Map>` | 전체 인접 리스트 |
|
|
263
|
-
| `getTransitiveDependencies(filePath)` | `Promise<string[]>` | 전방 전이적 BFS |
|
|
263
|
+
| `getTransitiveDependencies(filePath)` | `Promise<string[]>` | 전방 전이적 BFS (이 파일이 의존하는 파일들) |
|
|
264
|
+
| `getTransitiveDependents(filePath)` | `Promise<string[]>` | 역방향 전이적 BFS (이 파일에 의존하는 파일들) |
|
|
264
265
|
|
|
265
266
|
### 분석
|
|
266
267
|
|
|
@@ -277,12 +278,40 @@ try {
|
|
|
277
278
|
|
|
278
279
|
`semantic: true`로 열어야 사용 가능.
|
|
279
280
|
|
|
281
|
+
#### 심볼 이름 기반
|
|
282
|
+
|
|
280
283
|
| 메서드 | 반환 타입 | 설명 |
|
|
281
284
|
|--------|-----------|------|
|
|
282
285
|
| `getResolvedType(name, filePath)` | `ResolvedType \| null` | tsc TypeChecker로 resolved type 조회 |
|
|
283
286
|
| `getSemanticReferences(name, filePath)` | `SemanticReference[]` | 심볼의 모든 참조 위치 |
|
|
284
287
|
| `getImplementations(name, filePath)` | `Implementation[]` | 인터페이스/추상 클래스 구현체 |
|
|
285
288
|
| `getSemanticModuleInterface(filePath)` | `SemanticModuleInterface` | 모듈 export 목록 + resolved type |
|
|
289
|
+
| `isTypeAssignableTo(opts)` | `boolean` | 두 심볼 타입 간 할당 가능성 |
|
|
290
|
+
| `isTypeAssignableToType(opts)` | `boolean` | 심볼 타입을 임의 타입 문자열에 할당 가능한지 |
|
|
291
|
+
|
|
292
|
+
#### 라인/컬럼 또는 바이트 위치 기반
|
|
293
|
+
|
|
294
|
+
| 메서드 | 반환 타입 | 설명 |
|
|
295
|
+
|--------|-----------|------|
|
|
296
|
+
| `getResolvedTypeAt(filePath, line, column)` | `ResolvedType \| null` | 라인/컬럼 위치의 resolved type |
|
|
297
|
+
| `isTypeAssignableToAt(opts)` | `boolean` | 두 라인/컬럼 위치 간 할당 가능성 |
|
|
298
|
+
| `getResolvedTypeAtPosition(filePath, position)` | `ResolvedType \| null` | 바이트 위치의 resolved type |
|
|
299
|
+
| `getResolvedTypesAtPositions(filePath, positions)` | `Map<number, ResolvedType>` | 여러 위치의 resolved type 일괄 조회 |
|
|
300
|
+
| `getSemanticReferencesAtPosition(filePath, position)` | `SemanticReference[]` | 바이트 위치 심볼의 참조 |
|
|
301
|
+
| `getImplementationsAtPosition(filePath, position)` | `Implementation[]` | 바이트 위치 심볼의 구현체 |
|
|
302
|
+
| `isTypeAssignableToAtPosition(opts)` | `boolean` | 두 바이트 위치 간 할당 가능성 |
|
|
303
|
+
| `isTypeAssignableToTypeAtPositions(opts)` | `boolean` | 위치 → 임의 타입 문자열 할당 가능성 |
|
|
304
|
+
|
|
305
|
+
#### 파일 단위 / 유틸 / 진단
|
|
306
|
+
|
|
307
|
+
| 메서드 | 반환 타입 | 설명 |
|
|
308
|
+
|--------|-----------|------|
|
|
309
|
+
| `getFileTypes(filePath)` | `Map<number, ResolvedType>` | 파일 내 모든 심볼의 resolved type |
|
|
310
|
+
| `getSymbolNode(filePath, position)` | `SymbolNode \| null` | 위치의 심볼 그래프 노드 |
|
|
311
|
+
| `getBaseTypes(filePath, position)` | `ResolvedType[] \| null` | 위치 심볼의 직접 베이스 타입들 |
|
|
312
|
+
| `lineColumnToPosition(filePath, line, column)` | `number \| null` | 라인/컬럼 → 바이트 오프셋 변환 |
|
|
313
|
+
| `findNamePosition(filePath, declarationPos, name)` | `number \| null` | 선언 내 식별자의 바이트 위치 탐색 |
|
|
314
|
+
| `getSemanticDiagnostics(filePath, opts?)` | `SemanticDiagnostic[]` | 파일의 tsc 진단 |
|
|
286
315
|
|
|
287
316
|
`getFullSymbol()`은 semantic 활성 시 자동으로 `resolvedType` 필드를 보강합니다.
|
|
288
317
|
`searchSymbols({ resolvedType })`로 resolved type 문자열 기반 필터링이 가능합니다.
|
|
@@ -331,23 +360,37 @@ interface SymbolSearchQuery {
|
|
|
331
360
|
filePath?: string; // 파일 경로 필터
|
|
332
361
|
isExported?: boolean; // export 여부
|
|
333
362
|
project?: string; // 프로젝트 이름
|
|
334
|
-
limit?: number; //
|
|
363
|
+
limit?: number; // 미지정 시 limit 미적용 (전체 결과)
|
|
335
364
|
decorator?: string; // 데코레이터 이름 필터
|
|
336
365
|
regex?: string; // 정규식 패턴 필터
|
|
366
|
+
resolvedType?: string; // 시맨틱 레이어 필터 (`semantic: true` 필요)
|
|
337
367
|
}
|
|
338
368
|
|
|
339
369
|
interface CodeRelation {
|
|
340
370
|
type: 'imports' | 'type-references' | 're-exports' | 'calls' | 'extends' | 'implements';
|
|
341
371
|
srcFilePath: string;
|
|
342
372
|
srcSymbolName: string | null;
|
|
343
|
-
|
|
373
|
+
/** 외부 패키지 / 미해상 import 의 경우 `null`. */
|
|
374
|
+
dstFilePath: string | null;
|
|
344
375
|
dstSymbolName: string | null;
|
|
345
376
|
meta?: Record<string, unknown>;
|
|
377
|
+
/**
|
|
378
|
+
* 소스에 적힌 모듈 specifier 원문(`'./foo'`, `'@zipbul/core'`, `'lodash'`).
|
|
379
|
+
* 모듈 source 가 있는 모든 관계(`'imports'`, `'re-exports'`, `'type-references'`,
|
|
380
|
+
* 동적 `import()`, `require()`)에서 `dstFilePath` 해상 여부와 무관하게 항상 보존.
|
|
381
|
+
* `'calls'` / `'extends'` / `'implements'` 관계에서만 부재.
|
|
382
|
+
*/
|
|
383
|
+
specifier?: string;
|
|
346
384
|
}
|
|
347
385
|
|
|
348
|
-
/** 목적지 프로젝트
|
|
349
|
-
interface StoredCodeRelation extends CodeRelation {
|
|
350
|
-
|
|
386
|
+
/** 목적지 프로젝트 식별자와 외부 플래그가 추가된 CodeRelation. */
|
|
387
|
+
interface StoredCodeRelation extends Omit<CodeRelation, 'specifier'> {
|
|
388
|
+
/** 목적지 프로젝트, 또는 cross-project / 미해상 시 `null`. */
|
|
389
|
+
dstProject: string | null;
|
|
390
|
+
/** 외부 패키지(bare specifier) 여부. */
|
|
391
|
+
isExternal: boolean;
|
|
392
|
+
/** 원문 specifier (`CodeRelation.specifier` 참고); `'calls'` / `'extends'` / `'implements'` 에서만 `null`. */
|
|
393
|
+
specifier: string | null;
|
|
351
394
|
}
|
|
352
395
|
|
|
353
396
|
interface IndexResult {
|
|
@@ -355,14 +398,25 @@ interface IndexResult {
|
|
|
355
398
|
removedFiles: number;
|
|
356
399
|
totalSymbols: number;
|
|
357
400
|
totalRelations: number;
|
|
401
|
+
totalAnnotations: number;
|
|
358
402
|
durationMs: number;
|
|
359
403
|
changedFiles: string[];
|
|
360
404
|
deletedFiles: string[];
|
|
361
405
|
failedFiles: string[];
|
|
406
|
+
/** 이전 인덱스 상태 대비 심볼 단위 diff. */
|
|
362
407
|
changedSymbols: {
|
|
363
|
-
added: Array<{ name: string; filePath: string; kind: string }>;
|
|
364
|
-
modified: Array<{ name: string; filePath: string; kind: string }>;
|
|
365
|
-
removed: Array<{ name: string; filePath: string; kind: string }>;
|
|
408
|
+
added: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
|
|
409
|
+
modified: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
|
|
410
|
+
removed: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
|
|
411
|
+
};
|
|
412
|
+
/** 이름이 바뀐 심볼 (구조적 fingerprint 매칭). */
|
|
413
|
+
renamedSymbols: Array<{ oldName: string; newName: string; filePath: string; kind: string; isExported: boolean }>;
|
|
414
|
+
/** 다른 파일로 이동한 심볼 (incremental 만; fingerprint 매칭). */
|
|
415
|
+
movedSymbols: Array<{ name: string; oldFilePath: string; newFilePath: string; kind: string; isExported: boolean }>;
|
|
416
|
+
/** 이전 인덱스 상태 대비 관계 단위 diff. */
|
|
417
|
+
changedRelations: {
|
|
418
|
+
added: Array<{ type: string; srcFilePath: string; dstFilePath: string | null; srcSymbolName: string | null; dstSymbolName: string | null; dstProject: string | null; metaJson: string | null }>;
|
|
419
|
+
removed: Array<{ type: string; srcFilePath: string; dstFilePath: string | null; srcSymbolName: string | null; dstSymbolName: string | null; dstProject: string | null; metaJson: string | null }>;
|
|
366
420
|
};
|
|
367
421
|
}
|
|
368
422
|
|
package/README.md
CHANGED
|
@@ -300,7 +300,8 @@ Returns `Promise<Gildash>`. Throws `GildashError` on failure.
|
|
|
300
300
|
| `hasCycle(project?)` | `Promise<boolean>` | Circular dependency check |
|
|
301
301
|
| `getCyclePaths(project?, opts?)` | `Promise<string[][]>` | All cycle paths (Tarjan SCC + Johnson's). `opts.maxCycles` limits results. |
|
|
302
302
|
| `getImportGraph(project?)` | `Promise<Map>` | Full adjacency list |
|
|
303
|
-
| `getTransitiveDependencies(filePath)` | `Promise<string[]>` | Forward transitive BFS |
|
|
303
|
+
| `getTransitiveDependencies(filePath)` | `Promise<string[]>` | Forward transitive BFS (files this depends on) |
|
|
304
|
+
| `getTransitiveDependents(filePath)` | `Promise<string[]>` | Reverse transitive BFS (files that depend on this) |
|
|
304
305
|
|
|
305
306
|
### Analysis
|
|
306
307
|
|
|
@@ -330,12 +331,40 @@ Returns `Promise<Gildash>`. Throws `GildashError` on failure.
|
|
|
330
331
|
|
|
331
332
|
Requires `semantic: true` at open time.
|
|
332
333
|
|
|
334
|
+
#### By symbol name
|
|
335
|
+
|
|
333
336
|
| Method | Returns | Description |
|
|
334
337
|
|--------|---------|-------------|
|
|
335
338
|
| `getResolvedType(name, filePath)` | `ResolvedType \| null` | Resolved type via tsc TypeChecker |
|
|
336
339
|
| `getSemanticReferences(name, filePath)` | `SemanticReference[]` | All references to a symbol |
|
|
337
340
|
| `getImplementations(name, filePath)` | `Implementation[]` | Interface / abstract class implementations |
|
|
338
341
|
| `getSemanticModuleInterface(filePath)` | `SemanticModuleInterface` | Module exports with resolved types |
|
|
342
|
+
| `isTypeAssignableTo(opts)` | `boolean` | Whether one symbol's type is assignable to another's |
|
|
343
|
+
| `isTypeAssignableToType(opts)` | `boolean` | Whether a symbol's type is assignable to an arbitrary type string |
|
|
344
|
+
|
|
345
|
+
#### By line/column or byte position
|
|
346
|
+
|
|
347
|
+
| Method | Returns | Description |
|
|
348
|
+
|--------|---------|-------------|
|
|
349
|
+
| `getResolvedTypeAt(filePath, line, column)` | `ResolvedType \| null` | Resolved type at a line/column |
|
|
350
|
+
| `isTypeAssignableToAt(opts)` | `boolean` | Assignability check between two line/column positions |
|
|
351
|
+
| `getResolvedTypeAtPosition(filePath, position)` | `ResolvedType \| null` | Resolved type at a byte position |
|
|
352
|
+
| `getResolvedTypesAtPositions(filePath, positions)` | `Map<number, ResolvedType>` | Batch type lookup across positions |
|
|
353
|
+
| `getSemanticReferencesAtPosition(filePath, position)` | `SemanticReference[]` | References to the symbol at a position |
|
|
354
|
+
| `getImplementationsAtPosition(filePath, position)` | `Implementation[]` | Implementations of the symbol at a position |
|
|
355
|
+
| `isTypeAssignableToAtPosition(opts)` | `boolean` | Assignability check between two byte positions |
|
|
356
|
+
| `isTypeAssignableToTypeAtPositions(opts)` | `boolean` | Assignability check from a position to an arbitrary type string |
|
|
357
|
+
|
|
358
|
+
#### File-level / utilities / diagnostics
|
|
359
|
+
|
|
360
|
+
| Method | Returns | Description |
|
|
361
|
+
|--------|---------|-------------|
|
|
362
|
+
| `getFileTypes(filePath)` | `Map<number, ResolvedType>` | All resolved types for symbols in a file |
|
|
363
|
+
| `getSymbolNode(filePath, position)` | `SymbolNode \| null` | Underlying symbol-graph node at a position |
|
|
364
|
+
| `getBaseTypes(filePath, position)` | `ResolvedType[] \| null` | Direct base types of the symbol at a position |
|
|
365
|
+
| `lineColumnToPosition(filePath, line, column)` | `number \| null` | Convert line/column to byte offset |
|
|
366
|
+
| `findNamePosition(filePath, declarationPos, name)` | `number \| null` | Locate an identifier's byte offset within a declaration |
|
|
367
|
+
| `getSemanticDiagnostics(filePath, opts?)` | `SemanticDiagnostic[]` | tsc diagnostics for a file |
|
|
339
368
|
|
|
340
369
|
`getFullSymbol()` automatically enriches the result with a `resolvedType` field when semantic is enabled.
|
|
341
370
|
`searchSymbols({ resolvedType })` filters symbols by their resolved type string.
|
|
@@ -361,12 +390,77 @@ Requires `semantic: true` at open time.
|
|
|
361
390
|
| `parseSource(filePath, src, opts?)` | `ParsedFile` | Parse & cache a single file. `opts`: oxc-parser `ParserOptions`. |
|
|
362
391
|
| `extractSymbols(parsed)` | `ExtractedSymbol[]` | Extract symbols from parsed AST |
|
|
363
392
|
| `extractRelations(parsed)` | `CodeRelation[]` | Extract relations from parsed AST |
|
|
393
|
+
|
|
394
|
+
|
|
364
395
|
| `getParsedAst(filePath)` | `ParsedFile \| undefined` | Cached AST lookup (read-only) |
|
|
365
396
|
| `getFileInfo(filePath)` | `FileRecord \| null` | File metadata (hash, mtime, size) |
|
|
366
397
|
| `getStats(project?)` | `SymbolStats` | Symbol / file count statistics |
|
|
367
398
|
| `projects` | `ProjectBoundary[]` | Discovered project boundaries |
|
|
368
399
|
| `close(opts?)` | `Promise<void>` | Shutdown (pass `{ cleanup: true }` to delete DB) |
|
|
369
400
|
|
|
401
|
+
### AST Primitives
|
|
402
|
+
|
|
403
|
+
gildash exposes the underlying oxc-parser AST surface and a set of helpers
|
|
404
|
+
for consumers building their own static analysis on top of the same parser.
|
|
405
|
+
These are standalone exports — no `Gildash` instance required — and follow
|
|
406
|
+
the upstream oxc-parser / oxc-walker semver.
|
|
407
|
+
|
|
408
|
+
#### Parsing & extraction
|
|
409
|
+
|
|
410
|
+
| Export | Returns | Description |
|
|
411
|
+
|--------|---------|-------------|
|
|
412
|
+
| `parseSource(file, src, opts?)` | `Result<ParsedFile, GildashError>` | Parse a single source string |
|
|
413
|
+
| `extractSymbols(parsed)` | `ExtractedSymbol[]` | Symbols from a parsed AST |
|
|
414
|
+
| `extractRelations(ast, file, ...)` | `CodeRelation[]` | Relations from a parsed AST |
|
|
415
|
+
|
|
416
|
+
#### Traversal
|
|
417
|
+
|
|
418
|
+
Re-exported from `oxc-walker` and `oxc-parser`:
|
|
419
|
+
|
|
420
|
+
| Export | Description |
|
|
421
|
+
|--------|-------------|
|
|
422
|
+
| `walk(node, { enter, leave })` | Generic preorder walker. `enter` receives `(node, parent, ctx)`; call `this.skip()` to prune the subtree. |
|
|
423
|
+
| `parseAndWalk(code, file, cb)` | Parse + walk in one call |
|
|
424
|
+
| `ScopeTracker` | Identifier-declaration tracker that integrates with `walk` |
|
|
425
|
+
| `Visitor` | Per-node-type callback object form (`new Visitor({ CallExpression(...) })`) |
|
|
426
|
+
| `visitorKeys` | `Record<string, string[]>` — child key list per node type |
|
|
427
|
+
|
|
428
|
+
#### Type predicates over `Node`
|
|
429
|
+
|
|
430
|
+
Each predicate has the signature `(node: Node) => node is Extract<Node, { type: 'X' }>`.
|
|
431
|
+
|
|
432
|
+
| Predicate | Discriminator | Notes |
|
|
433
|
+
|-----------|---------------|-------|
|
|
434
|
+
| `isArrowFunctionExpression` | `ArrowFunctionExpression` | |
|
|
435
|
+
| `isAssignmentExpression` | `AssignmentExpression` | |
|
|
436
|
+
| `isCallExpression` | `CallExpression` | |
|
|
437
|
+
| `isFunctionDeclaration` | `FunctionDeclaration` | Narrows to the `Function` interface, which structurally also accepts `TSDeclareFunction` and `TSEmptyBodyFunctionExpression` literals — those return `false` at runtime. |
|
|
438
|
+
| `isFunctionExpression` | `FunctionExpression` | Same `Function`-interface caveat as above. |
|
|
439
|
+
| `isFunctionNode` | `FunctionDeclaration` \| `FunctionExpression` \| `ArrowFunctionExpression` | Union shorthand for "any function-shape node". |
|
|
440
|
+
| `isIdentifier` | `Identifier` | 6-way collision: `IdentifierName`, `IdentifierReference`, `BindingIdentifier`, `LabelIdentifier`, `TSThisParameter`, `TSIndexSignatureName`. All expose `.name`. |
|
|
441
|
+
| `isMemberExpression` | `MemberExpression` | 3-way collision: `ComputedMemberExpression`, `StaticMemberExpression`, `PrivateFieldExpression`. All expose `.object`. |
|
|
442
|
+
| `isTSQualifiedName` | `TSQualifiedName` | 2-way collision: `TSQualifiedName`, `TSImportTypeQualifiedName`. Both expose `.left` / `.right` (different shapes). |
|
|
443
|
+
| `isVariableDeclaration` | `VariableDeclaration` | |
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
import { parseSource, walk, isCallExpression } from '@zipbul/gildash';
|
|
447
|
+
|
|
448
|
+
const parsed = parseSource('a.ts', 'foo()');
|
|
449
|
+
if (!('stack' in parsed)) {
|
|
450
|
+
walk(parsed.program, {
|
|
451
|
+
enter(node) {
|
|
452
|
+
if (isCallExpression(node)) {
|
|
453
|
+
console.log(node.callee, node.arguments);
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### AST utility types
|
|
461
|
+
|
|
462
|
+
`Program`, `Node`, `VisitorObject`, `WalkOptions`, `WalkerEnter`, `WalkerLeave`, `WalkerCallbackContext`, `ScopeTrackerNode`, `ScopeTrackerOptions`, `SourcePosition`, `SourceSpan`, `ParsedFile`, plus `buildLineOffsets` / `getLineColumn` for byte ↔ line/column conversion.
|
|
463
|
+
|
|
370
464
|
<br>
|
|
371
465
|
|
|
372
466
|
<details>
|
|
@@ -378,70 +472,131 @@ Requires `semantic: true` at open time.
|
|
|
378
472
|
interface SymbolSearchQuery {
|
|
379
473
|
text?: string; // FTS5 full-text query
|
|
380
474
|
exact?: boolean; // exact name match (not prefix)
|
|
381
|
-
kind?: SymbolKind; // 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'property'
|
|
475
|
+
kind?: SymbolKind; // 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'namespace' | 'property'
|
|
382
476
|
filePath?: string;
|
|
383
477
|
isExported?: boolean;
|
|
384
478
|
project?: string;
|
|
385
|
-
limit?: number; //
|
|
479
|
+
limit?: number; // when omitted, no limit is applied
|
|
386
480
|
decorator?: string; // e.g. 'Injectable'
|
|
387
481
|
regex?: string; // regex applied to symbol name
|
|
482
|
+
resolvedType?: string; // semantic-layer filter; requires `semantic: true`
|
|
388
483
|
}
|
|
389
484
|
|
|
390
485
|
interface SymbolSearchResult {
|
|
391
486
|
id: number;
|
|
392
487
|
filePath: string;
|
|
393
488
|
kind: SymbolKind;
|
|
394
|
-
name: string;
|
|
489
|
+
name: string; // qualified for members, e.g. "ClassName.methodName"
|
|
490
|
+
memberName: string | null; // unqualified member name, or null for top-level
|
|
395
491
|
span: { start: { line: number; column: number }; end: { line: number; column: number } };
|
|
396
492
|
isExported: boolean;
|
|
397
493
|
signature: string | null;
|
|
398
494
|
fingerprint: string | null;
|
|
399
|
-
detail:
|
|
495
|
+
detail: SymbolDetail; // typed; see below
|
|
400
496
|
}
|
|
401
497
|
|
|
498
|
+
interface SymbolDetail {
|
|
499
|
+
parameters?: Parameter[];
|
|
500
|
+
returnType?: string;
|
|
501
|
+
heritage?: Array<{ kind: 'extends' | 'implements'; name: string; typeArguments?: string[] }>;
|
|
502
|
+
decorators?: Decorator[];
|
|
503
|
+
typeParameters?: string[];
|
|
504
|
+
modifiers?: Modifier[];
|
|
505
|
+
initializer?: ExpressionValue;
|
|
506
|
+
members?: Array<{
|
|
507
|
+
name: string;
|
|
508
|
+
kind: string;
|
|
509
|
+
type?: string;
|
|
510
|
+
visibility?: string;
|
|
511
|
+
isStatic?: boolean;
|
|
512
|
+
isReadonly?: boolean;
|
|
513
|
+
initializer?: ExpressionValue;
|
|
514
|
+
decorators?: Decorator[];
|
|
515
|
+
}>;
|
|
516
|
+
jsDoc?: JsDocBlock;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
interface Parameter {
|
|
520
|
+
name: string;
|
|
521
|
+
type?: string; // type annotation as source text
|
|
522
|
+
typeImportSource?: string; // import specifier when the type is imported
|
|
523
|
+
isOptional: boolean;
|
|
524
|
+
defaultValue?: string;
|
|
525
|
+
decorators?: Decorator[];
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
interface Decorator {
|
|
529
|
+
name: string;
|
|
530
|
+
arguments?: ExpressionValue[]; // structured decorator call arguments
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
type Modifier =
|
|
534
|
+
| 'async' | 'static' | 'abstract' | 'readonly'
|
|
535
|
+
| 'private' | 'protected' | 'public'
|
|
536
|
+
| 'override' | 'declare' | 'const'
|
|
537
|
+
| 'accessor'; // TC39 auto-accessor
|
|
538
|
+
|
|
402
539
|
interface RelationSearchQuery {
|
|
403
540
|
srcFilePath?: string;
|
|
404
541
|
srcSymbolName?: string;
|
|
405
542
|
dstFilePath?: string;
|
|
406
543
|
dstSymbolName?: string;
|
|
407
|
-
dstProject?: string;
|
|
544
|
+
dstProject?: string; // filter by destination project
|
|
545
|
+
/** Glob (Bun.Glob) for source file path; mutually exclusive with srcFilePath. */
|
|
546
|
+
srcFilePathPattern?: string;
|
|
547
|
+
/** Glob (Bun.Glob) for destination file path; mutually exclusive with dstFilePath. */
|
|
548
|
+
dstFilePathPattern?: string;
|
|
408
549
|
type?: 'imports' | 'type-references' | 're-exports' | 'calls' | 'extends' | 'implements';
|
|
409
550
|
project?: string;
|
|
410
|
-
|
|
551
|
+
/** Filter by raw import specifier (e.g. `'./foo'`, `'lodash'`). */
|
|
552
|
+
specifier?: string;
|
|
553
|
+
/** Filter by external (bare specifier) flag. */
|
|
554
|
+
isExternal?: boolean;
|
|
555
|
+
limit?: number; // when omitted, no limit is applied
|
|
411
556
|
}
|
|
412
557
|
|
|
413
558
|
interface CodeRelation {
|
|
414
559
|
type: 'imports' | 'type-references' | 're-exports' | 'calls' | 'extends' | 'implements';
|
|
415
560
|
srcFilePath: string;
|
|
416
561
|
srcSymbolName: string | null;
|
|
417
|
-
|
|
562
|
+
/** `null` when the import target could not be resolved (external package, missing file). */
|
|
563
|
+
dstFilePath: string | null;
|
|
418
564
|
dstSymbolName: string | null;
|
|
419
565
|
metaJson?: string;
|
|
420
566
|
meta?: Record<string, unknown>; // auto-parsed from metaJson
|
|
567
|
+
/**
|
|
568
|
+
* Verbatim module specifier text as written in the source (`'./foo'`,
|
|
569
|
+
* `'@zipbul/core'`, `'lodash'`). Always present on module-source-bearing
|
|
570
|
+
* relations (`'imports'`, `'re-exports'`, `'type-references'`, dynamic
|
|
571
|
+
* `import()`, `require()`) regardless of `dstFilePath` resolution.
|
|
572
|
+
* Absent on `'calls'` / `'extends'` / `'implements'`.
|
|
573
|
+
*/
|
|
574
|
+
specifier?: string;
|
|
421
575
|
}
|
|
422
576
|
|
|
423
|
-
/** CodeRelation enriched with
|
|
424
|
-
interface StoredCodeRelation extends CodeRelation {
|
|
425
|
-
|
|
577
|
+
/** CodeRelation enriched with destination-project identifier and external flag. */
|
|
578
|
+
interface StoredCodeRelation extends Omit<CodeRelation, 'specifier'> {
|
|
579
|
+
/** Destination project, or `null` for cross-project / unresolved relations. */
|
|
580
|
+
dstProject: string | null;
|
|
581
|
+
/** Whether the relation targets an external (bare-specifier) package. */
|
|
582
|
+
isExternal: boolean;
|
|
583
|
+
/** Verbatim source specifier (see {@link CodeRelation.specifier}); `null` only on `'calls'` / `'extends'` / `'implements'`. */
|
|
584
|
+
specifier: string | null;
|
|
426
585
|
}
|
|
427
586
|
|
|
428
587
|
// ── Analysis ────────────────────────────────────────────────────────────
|
|
429
588
|
|
|
430
589
|
interface FullSymbol extends SymbolSearchResult {
|
|
431
|
-
members?:
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
type?: string;
|
|
435
|
-
visibility?: string;
|
|
436
|
-
isStatic?: boolean;
|
|
437
|
-
isReadonly?: boolean;
|
|
438
|
-
}>;
|
|
439
|
-
jsDoc?: string;
|
|
440
|
-
parameters?: string;
|
|
590
|
+
members?: SymbolDetail['members'];
|
|
591
|
+
jsDoc?: JsDocBlock;
|
|
592
|
+
parameters?: Parameter[];
|
|
441
593
|
returnType?: string;
|
|
442
|
-
heritage?:
|
|
443
|
-
decorators?:
|
|
444
|
-
typeParameters?: string;
|
|
594
|
+
heritage?: SymbolDetail['heritage'];
|
|
595
|
+
decorators?: Decorator[];
|
|
596
|
+
typeParameters?: string[];
|
|
597
|
+
initializer?: ExpressionValue;
|
|
598
|
+
/** Resolved type from the Semantic Layer (available when `semantic: true`). */
|
|
599
|
+
resolvedType?: ResolvedType;
|
|
445
600
|
}
|
|
446
601
|
|
|
447
602
|
interface FileStats {
|
|
@@ -511,10 +666,48 @@ interface IndexResult {
|
|
|
511
666
|
changedFiles: string[];
|
|
512
667
|
deletedFiles: string[];
|
|
513
668
|
failedFiles: string[];
|
|
669
|
+
/** Symbol-level diff against previous index state. */
|
|
514
670
|
changedSymbols: {
|
|
515
|
-
added: Array<{ name: string; filePath: string; kind: string }>;
|
|
516
|
-
modified: Array<{ name: string; filePath: string; kind: string }>;
|
|
517
|
-
removed: Array<{ name: string; filePath: string; kind: string }>;
|
|
671
|
+
added: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
|
|
672
|
+
modified: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
|
|
673
|
+
removed: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
|
|
674
|
+
};
|
|
675
|
+
/** Symbols renamed (matched via structural fingerprint). */
|
|
676
|
+
renamedSymbols: Array<{
|
|
677
|
+
oldName: string;
|
|
678
|
+
newName: string;
|
|
679
|
+
filePath: string;
|
|
680
|
+
kind: string;
|
|
681
|
+
isExported: boolean;
|
|
682
|
+
}>;
|
|
683
|
+
/** Symbols that moved to a different file (incremental only; matched via fingerprint). */
|
|
684
|
+
movedSymbols: Array<{
|
|
685
|
+
name: string;
|
|
686
|
+
oldFilePath: string;
|
|
687
|
+
newFilePath: string;
|
|
688
|
+
kind: string;
|
|
689
|
+
isExported: boolean;
|
|
690
|
+
}>;
|
|
691
|
+
/** Relation-level diff against previous index state. */
|
|
692
|
+
changedRelations: {
|
|
693
|
+
added: Array<{
|
|
694
|
+
type: string;
|
|
695
|
+
srcFilePath: string;
|
|
696
|
+
dstFilePath: string | null;
|
|
697
|
+
srcSymbolName: string | null;
|
|
698
|
+
dstSymbolName: string | null;
|
|
699
|
+
dstProject: string | null;
|
|
700
|
+
metaJson: string | null;
|
|
701
|
+
}>;
|
|
702
|
+
removed: Array<{
|
|
703
|
+
type: string;
|
|
704
|
+
srcFilePath: string;
|
|
705
|
+
dstFilePath: string | null;
|
|
706
|
+
srcSymbolName: string | null;
|
|
707
|
+
dstSymbolName: string | null;
|
|
708
|
+
dstProject: string | null;
|
|
709
|
+
metaJson: string | null;
|
|
710
|
+
}>;
|
|
518
711
|
};
|
|
519
712
|
}
|
|
520
713
|
|
|
@@ -537,7 +730,7 @@ interface AnnotationSearchQuery {
|
|
|
537
730
|
symbolName?: string;
|
|
538
731
|
source?: 'jsdoc' | 'line' | 'block';
|
|
539
732
|
project?: string;
|
|
540
|
-
limit?: number; //
|
|
733
|
+
limit?: number; // when omitted, no limit is applied
|
|
541
734
|
}
|
|
542
735
|
|
|
543
736
|
interface AnnotationSearchResult {
|