@zipbul/gildash 0.25.0 → 0.26.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/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; // 최대 결과 (기본값: 100)
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
- dstFilePath: string;
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
- /** 목적지 프로젝트 식별자가 추가된 CodeRelation */
349
- interface StoredCodeRelation extends CodeRelation {
350
- dstProject: string;
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.
@@ -378,70 +407,131 @@ Requires `semantic: true` at open time.
378
407
  interface SymbolSearchQuery {
379
408
  text?: string; // FTS5 full-text query
380
409
  exact?: boolean; // exact name match (not prefix)
381
- kind?: SymbolKind; // 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'property'
410
+ kind?: SymbolKind; // 'function' | 'method' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'namespace' | 'property'
382
411
  filePath?: string;
383
412
  isExported?: boolean;
384
413
  project?: string;
385
- limit?: number; // default: 100
414
+ limit?: number; // when omitted, no limit is applied
386
415
  decorator?: string; // e.g. 'Injectable'
387
416
  regex?: string; // regex applied to symbol name
417
+ resolvedType?: string; // semantic-layer filter; requires `semantic: true`
388
418
  }
389
419
 
390
420
  interface SymbolSearchResult {
391
421
  id: number;
392
422
  filePath: string;
393
423
  kind: SymbolKind;
394
- name: string;
424
+ name: string; // qualified for members, e.g. "ClassName.methodName"
425
+ memberName: string | null; // unqualified member name, or null for top-level
395
426
  span: { start: { line: number; column: number }; end: { line: number; column: number } };
396
427
  isExported: boolean;
397
428
  signature: string | null;
398
429
  fingerprint: string | null;
399
- detail: Record<string, unknown>;
430
+ detail: SymbolDetail; // typed; see below
431
+ }
432
+
433
+ interface SymbolDetail {
434
+ parameters?: Parameter[];
435
+ returnType?: string;
436
+ heritage?: Array<{ kind: 'extends' | 'implements'; name: string; typeArguments?: string[] }>;
437
+ decorators?: Decorator[];
438
+ typeParameters?: string[];
439
+ modifiers?: Modifier[];
440
+ initializer?: ExpressionValue;
441
+ members?: Array<{
442
+ name: string;
443
+ kind: string;
444
+ type?: string;
445
+ visibility?: string;
446
+ isStatic?: boolean;
447
+ isReadonly?: boolean;
448
+ initializer?: ExpressionValue;
449
+ decorators?: Decorator[];
450
+ }>;
451
+ jsDoc?: JsDocBlock;
400
452
  }
401
453
 
454
+ interface Parameter {
455
+ name: string;
456
+ type?: string; // type annotation as source text
457
+ typeImportSource?: string; // import specifier when the type is imported
458
+ isOptional: boolean;
459
+ defaultValue?: string;
460
+ decorators?: Decorator[];
461
+ }
462
+
463
+ interface Decorator {
464
+ name: string;
465
+ arguments?: ExpressionValue[]; // structured decorator call arguments
466
+ }
467
+
468
+ type Modifier =
469
+ | 'async' | 'static' | 'abstract' | 'readonly'
470
+ | 'private' | 'protected' | 'public'
471
+ | 'override' | 'declare' | 'const'
472
+ | 'accessor'; // TC39 auto-accessor
473
+
402
474
  interface RelationSearchQuery {
403
475
  srcFilePath?: string;
404
476
  srcSymbolName?: string;
405
477
  dstFilePath?: string;
406
478
  dstSymbolName?: string;
407
- dstProject?: string; // filter by destination project
479
+ dstProject?: string; // filter by destination project
480
+ /** Glob (Bun.Glob) for source file path; mutually exclusive with srcFilePath. */
481
+ srcFilePathPattern?: string;
482
+ /** Glob (Bun.Glob) for destination file path; mutually exclusive with dstFilePath. */
483
+ dstFilePathPattern?: string;
408
484
  type?: 'imports' | 'type-references' | 're-exports' | 'calls' | 'extends' | 'implements';
409
485
  project?: string;
410
- limit?: number; // default: 500
486
+ /** Filter by raw import specifier (e.g. `'./foo'`, `'lodash'`). */
487
+ specifier?: string;
488
+ /** Filter by external (bare specifier) flag. */
489
+ isExternal?: boolean;
490
+ limit?: number; // when omitted, no limit is applied
411
491
  }
412
492
 
413
493
  interface CodeRelation {
414
494
  type: 'imports' | 'type-references' | 're-exports' | 'calls' | 'extends' | 'implements';
415
495
  srcFilePath: string;
416
496
  srcSymbolName: string | null;
417
- dstFilePath: string;
497
+ /** `null` when the import target could not be resolved (external package, missing file). */
498
+ dstFilePath: string | null;
418
499
  dstSymbolName: string | null;
419
500
  metaJson?: string;
420
501
  meta?: Record<string, unknown>; // auto-parsed from metaJson
502
+ /**
503
+ * Verbatim module specifier text as written in the source (`'./foo'`,
504
+ * `'@zipbul/core'`, `'lodash'`). Always present on module-source-bearing
505
+ * relations (`'imports'`, `'re-exports'`, `'type-references'`, dynamic
506
+ * `import()`, `require()`) regardless of `dstFilePath` resolution.
507
+ * Absent on `'calls'` / `'extends'` / `'implements'`.
508
+ */
509
+ specifier?: string;
421
510
  }
422
511
 
423
- /** CodeRelation enriched with the destination project identifier. */
424
- interface StoredCodeRelation extends CodeRelation {
425
- dstProject: string;
512
+ /** CodeRelation enriched with destination-project identifier and external flag. */
513
+ interface StoredCodeRelation extends Omit<CodeRelation, 'specifier'> {
514
+ /** Destination project, or `null` for cross-project / unresolved relations. */
515
+ dstProject: string | null;
516
+ /** Whether the relation targets an external (bare-specifier) package. */
517
+ isExternal: boolean;
518
+ /** Verbatim source specifier (see {@link CodeRelation.specifier}); `null` only on `'calls'` / `'extends'` / `'implements'`. */
519
+ specifier: string | null;
426
520
  }
427
521
 
428
522
  // ── Analysis ────────────────────────────────────────────────────────────
429
523
 
430
524
  interface FullSymbol extends SymbolSearchResult {
431
- members?: Array<{
432
- name: string;
433
- kind: string;
434
- type?: string;
435
- visibility?: string;
436
- isStatic?: boolean;
437
- isReadonly?: boolean;
438
- }>;
439
- jsDoc?: string;
440
- parameters?: string;
525
+ members?: SymbolDetail['members'];
526
+ jsDoc?: JsDocBlock;
527
+ parameters?: Parameter[];
441
528
  returnType?: string;
442
- heritage?: string[];
443
- decorators?: Array<{ name: string; arguments?: string }>;
444
- typeParameters?: string;
529
+ heritage?: SymbolDetail['heritage'];
530
+ decorators?: Decorator[];
531
+ typeParameters?: string[];
532
+ initializer?: ExpressionValue;
533
+ /** Resolved type from the Semantic Layer (available when `semantic: true`). */
534
+ resolvedType?: ResolvedType;
445
535
  }
446
536
 
447
537
  interface FileStats {
@@ -511,10 +601,48 @@ interface IndexResult {
511
601
  changedFiles: string[];
512
602
  deletedFiles: string[];
513
603
  failedFiles: string[];
604
+ /** Symbol-level diff against previous index state. */
514
605
  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 }>;
606
+ added: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
607
+ modified: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
608
+ removed: Array<{ name: string; filePath: string; kind: string; isExported: boolean }>;
609
+ };
610
+ /** Symbols renamed (matched via structural fingerprint). */
611
+ renamedSymbols: Array<{
612
+ oldName: string;
613
+ newName: string;
614
+ filePath: string;
615
+ kind: string;
616
+ isExported: boolean;
617
+ }>;
618
+ /** Symbols that moved to a different file (incremental only; matched via fingerprint). */
619
+ movedSymbols: Array<{
620
+ name: string;
621
+ oldFilePath: string;
622
+ newFilePath: string;
623
+ kind: string;
624
+ isExported: boolean;
625
+ }>;
626
+ /** Relation-level diff against previous index state. */
627
+ changedRelations: {
628
+ added: Array<{
629
+ type: string;
630
+ srcFilePath: string;
631
+ dstFilePath: string | null;
632
+ srcSymbolName: string | null;
633
+ dstSymbolName: string | null;
634
+ dstProject: string | null;
635
+ metaJson: string | null;
636
+ }>;
637
+ removed: Array<{
638
+ type: string;
639
+ srcFilePath: string;
640
+ dstFilePath: string | null;
641
+ srcSymbolName: string | null;
642
+ dstSymbolName: string | null;
643
+ dstProject: string | null;
644
+ metaJson: string | null;
645
+ }>;
518
646
  };
519
647
  }
520
648
 
@@ -537,7 +665,7 @@ interface AnnotationSearchQuery {
537
665
  symbolName?: string;
538
666
  source?: 'jsdoc' | 'line' | 'block';
539
667
  project?: string;
540
- limit?: number; // default: 100
668
+ limit?: number; // when omitted, no limit is applied
541
669
  }
542
670
 
543
671
  interface AnnotationSearchResult {