@zipbul/gildash 0.8.2 → 0.9.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
@@ -30,6 +30,8 @@ gildash는 TypeScript 코드베이스를 로컬 SQLite 데이터베이스에 인
30
30
  - **구조적 패턴 매칭** — [@ast-grep/napi](https://ast-grep.github.io/) 기반 AST 레벨 코드 검색
31
31
  - **증분 인덱싱** — `@parcel/watcher` 기반 파일 변경 감지, 변경된 파일만 재인덱싱
32
32
  - **심볼 레벨 diff** — `IndexResult`의 `changedSymbols`로 인덱싱 사이클 당 추가/수정/삭제된 심볼 추적
33
+ - **어노테이션 추출** — JSDoc, 라인(`//`), 블록(`/* */`) 주석에서 `@tag value` 패턴을 추출하고 심볼에 자동 연결, FTS5 검색 지원
34
+ - **심볼 변경 이력** — 인덱싱 사이클 간 심볼의 추가/수정/삭제/이름변경/이동을 추적, 구조적 지문 기반 rename 감지
33
35
  - **멀티 프로세스 안전** — owner/reader 역할 분리로 단일 writer 보장
34
36
  - **스캔 전용 모드** — `watchMode: false`로 파일 워처 없이 1회성 인덱싱
35
37
  - **tsconfig.json JSONC** — `tsconfig.json`의 주석(`//`, `/* */`)과 트레일링 콤마를 지원하는 경로 별칭 파싱
@@ -416,6 +418,32 @@ Gildash (파사드)
416
418
 
417
419
  ## ⬆️ 업그레이드
418
420
 
421
+ ### 0.9.0 → 0.9.1
422
+
423
+ **버그 수정 및 성능 개선.** API 호환성 변경 없음.
424
+
425
+ - **수정:** `getParsedAst()`가 인스턴스 닫힌 상태에서 `GildashError('closed')` throw (기존: `undefined` 반환)
426
+ - **수정:** `searchSymbols({ regex })`에 잘못된 regex 전달 시 `GildashError('validation')` throw (기존: `[]` 반환)
427
+ - **수정:** reader→owner 승격 시 `ctx.role`이 `'owner'`로 정상 갱신
428
+ - **수정:** Full-index 경로에서 파일 읽기 실패 시 `IndexResult.failedFiles`에 정상 추적
429
+ - **수정:** reader→owner 승격 실패 rollback에서 heartbeat 타이머 정리 및 watcher role 해제
430
+ - **성능:** 심볼/어노테이션/체인지로그 repository 배치 INSERT (N+1 개별 insert 제거)
431
+ - **성능:** JSDoc 코멘트 탐색에 binary search 도입 (대형 파일에서 ~40x 개선)
432
+ - **성능:** regex 검색 시 progressive fetch 전략 (고정 5000행 over-fetch 제거)
433
+ - **성능:** `getQualifiedName()` O(n²) unshift → push+reverse O(n)
434
+
435
+ ### 0.8.x → 0.9.0
436
+
437
+ **신규:** 어노테이션 추출 및 심볼 체인지로그 추적.
438
+
439
+ - `searchAnnotations(query)` — JSDoc, 라인, 블록 코멘트에서 `@tag value` 검색
440
+ - `getSymbolChanges(since, opts?)` — 심볼 레벨 변경 이력 (rename/move 감지 포함)
441
+ - `pruneChangelog(before)` — 오래된 체인지로그 항목 정리
442
+ - `IndexResult`에 `totalAnnotations` 필드 추가
443
+ - 마이그레이션 `0006_annotations`, `0007_symbol_changelog` 자동 적용
444
+
445
+ **호환성 변경 없음.** 기존 데이터베이스는 자동 마이그레이션됩니다.
446
+
419
447
  ### 0.7.x → 0.8.0
420
448
 
421
449
  **Breaking:** `batchParse()`가 `Map<string, ParsedFile>` 대신 `BatchParseResult` (`parsed` + `failures` 필드)를 반환합니다.
package/README.md CHANGED
@@ -30,6 +30,8 @@ gildash indexes your TypeScript codebase into a local SQLite database, then lets
30
30
  - **Structural pattern matching** — AST-level code search via [@ast-grep/napi](https://ast-grep.github.io/)
31
31
  - **Incremental indexing** — `@parcel/watcher`-based file change detection; only re-indexes modified files
32
32
  - **Symbol-level diff** — `changedSymbols` in `IndexResult` tracks added/modified/removed symbols per index cycle
33
+ - **Annotation extraction** — Generic `@tag value` extraction from JSDoc, line, and block comments with automatic symbol linking and FTS5 search
34
+ - **Symbol changelog** — Tracks added/modified/removed/renamed/moved symbols across index runs, with structural fingerprint-based rename detection
33
35
  - **Multi-process safe** — Owner/reader role separation guarantees a single writer per database
34
36
  - **Scan-only mode** — `watchMode: false` for one-shot indexing without file watcher overhead
35
37
  - **tsconfig.json JSONC** — Path alias resolution parses comments and trailing commas in `tsconfig.json`
@@ -140,6 +142,45 @@ const limited = await ledger.getCyclePaths(undefined, { maxCycles: 100 }); //
140
142
 
141
143
  ---
142
144
 
145
+ ### Annotations
146
+
147
+ Search `@tag value` patterns extracted from JSDoc, line (`//`), and block (`/* */`) comments.
148
+
149
+ ```ts
150
+ // Find all @deprecated annotations
151
+ const deprecated = ledger.searchAnnotations({ tag: 'deprecated' });
152
+ deprecated.forEach(a => console.log(`${a.symbolName}: ${a.value}`));
153
+
154
+ // Full-text search across annotation values
155
+ const caching = ledger.searchAnnotations({ text: 'caching' });
156
+
157
+ // Filter by source type and file
158
+ const todos = ledger.searchAnnotations({ tag: 'todo', source: 'line', filePath: 'src/app.ts' });
159
+ ```
160
+
161
+ ---
162
+
163
+ ### Symbol Changelog
164
+
165
+ Track symbol-level changes across index runs. Rename and move detection uses structural fingerprinting.
166
+
167
+ ```ts
168
+ // Get all incremental changes since a given date
169
+ const changes = ledger.getSymbolChanges(new Date('2024-01-01'));
170
+
171
+ // Include full-index entries and filter by change type
172
+ const renames = ledger.getSymbolChanges(new Date(0), {
173
+ includeFullIndex: true,
174
+ changeTypes: ['renamed', 'moved'],
175
+ });
176
+ renames.forEach(c => console.log(`${c.oldName} → ${c.symbolName} (${c.changeType})`));
177
+
178
+ // Prune old entries (returns deleted count)
179
+ const pruned = ledger.pruneChangelog(new Date('2024-01-01'));
180
+ ```
181
+
182
+ ---
183
+
143
184
  ### Code Quality Analysis
144
185
 
145
186
  Inspect module interfaces and measure coupling.
@@ -272,6 +313,19 @@ Returns `Promise<Gildash>`. Throws `GildashError` on failure.
272
313
  | `getInternalRelations(filePath)` | `StoredCodeRelation[]` | Intra-file relations |
273
314
  | `diffSymbols(before, after)` | `SymbolDiff` | Snapshot diff (added / removed / modified) |
274
315
 
316
+ ### Annotations
317
+
318
+ | Method | Returns | Description |
319
+ |--------|---------|-------------|
320
+ | `searchAnnotations(query)` | `AnnotationSearchResult[]` | Search `@tag value` annotations in JSDoc, line, and block comments |
321
+
322
+ ### Symbol Changelog
323
+
324
+ | Method | Returns | Description |
325
+ |--------|---------|-------------|
326
+ | `getSymbolChanges(since, opts?)` | `SymbolChange[]` | Symbol-level change history (added/modified/removed/renamed/moved) |
327
+ | `pruneChangelog(before)` | `number` | Delete changelog entries older than the given date |
328
+
275
329
  ### Semantic (opt-in)
276
330
 
277
331
  Requires `semantic: true` at open time.
@@ -452,6 +506,7 @@ interface IndexResult {
452
506
  removedFiles: number;
453
507
  totalSymbols: number;
454
508
  totalRelations: number;
509
+ totalAnnotations: number;
455
510
  durationMs: number;
456
511
  changedFiles: string[];
457
512
  deletedFiles: string[];
@@ -473,6 +528,55 @@ interface FileRecord {
473
528
  lineCount?: number | null;
474
529
  }
475
530
 
531
+ // ── Annotations ─────────────────────────────────────────────────────────
532
+
533
+ interface AnnotationSearchQuery {
534
+ text?: string; // FTS5 full-text query
535
+ tag?: string; // exact tag name (e.g. 'deprecated', 'todo')
536
+ filePath?: string;
537
+ symbolName?: string;
538
+ source?: 'jsdoc' | 'line' | 'block';
539
+ project?: string;
540
+ limit?: number; // default: 100
541
+ }
542
+
543
+ interface AnnotationSearchResult {
544
+ tag: string;
545
+ value: string;
546
+ source: 'jsdoc' | 'line' | 'block';
547
+ filePath: string;
548
+ symbolName: string | null;
549
+ span: { start: { line: number; column: number }; end: { line: number; column: number } };
550
+ }
551
+
552
+ // ── Symbol Changelog ────────────────────────────────────────────────────
553
+
554
+ type SymbolChangeType = 'added' | 'modified' | 'removed' | 'renamed' | 'moved';
555
+
556
+ interface SymbolChange {
557
+ changeType: SymbolChangeType;
558
+ symbolName: string;
559
+ symbolKind: string;
560
+ filePath: string;
561
+ oldName: string | null; // set for 'renamed'
562
+ oldFilePath: string | null; // set for 'moved'
563
+ fingerprint: string | null;
564
+ changedAt: string;
565
+ isFullIndex: boolean;
566
+ indexRunId: string;
567
+ }
568
+
569
+ interface SymbolChangeQueryOptions {
570
+ symbolName?: string;
571
+ changeTypes?: SymbolChangeType[];
572
+ filePath?: string;
573
+ includeFullIndex?: boolean; // default: false
574
+ indexRunId?: string;
575
+ afterId?: number; // pagination cursor
576
+ limit?: number; // default: 1000
577
+ project?: string;
578
+ }
579
+
476
580
  // ── Errors ──────────────────────────────────────────────────────────────
477
581
 
478
582
  class GildashError extends Error {
@@ -527,6 +631,32 @@ When multiple processes share the same SQLite database, gildash enforces a singl
527
631
 
528
632
  ## ⬆️ Upgrading
529
633
 
634
+ ### From 0.9.0 to 0.9.1
635
+
636
+ **Bug fixes and performance improvements.** No breaking API changes.
637
+
638
+ - **Fix:** `getParsedAst()` now throws `GildashError('closed')` when the instance is closed, consistent with all other public APIs (previously returned `undefined`)
639
+ - **Fix:** `searchSymbols({ regex })` with an invalid regex now throws `GildashError('validation')` instead of silently returning `[]`
640
+ - **Fix:** `ctx.role` is now correctly updated to `'owner'` when a reader is promoted
641
+ - **Fix:** Full-index path now properly tracks failed file reads in `IndexResult.failedFiles`
642
+ - **Fix:** Reader→Owner promotion rollback now cleans up heartbeat timer and releases watcher role
643
+ - **Perf:** Batch INSERT for symbol, annotation, and changelog repositories (replaces N+1 individual inserts)
644
+ - **Perf:** Binary search for JSDoc comment association (~40x faster on large files)
645
+ - **Perf:** Progressive regex fetch strategy (replaces fixed 5000-row over-fetch)
646
+ - **Perf:** `getQualifiedName()` uses push+reverse instead of O(n²) unshift
647
+
648
+ ### From 0.8.x to 0.9.0
649
+
650
+ **New:** Annotation extraction and symbol changelog tracking.
651
+
652
+ - `searchAnnotations(query)` — Search `@tag value` from JSDoc, line, and block comments
653
+ - `getSymbolChanges(since, opts?)` — Symbol-level change history with rename/move detection
654
+ - `pruneChangelog(before)` — Prune old changelog entries
655
+ - `IndexResult` now includes `totalAnnotations`
656
+ - New migrations `0006_annotations` and `0007_symbol_changelog` are applied automatically on open
657
+
658
+ **No breaking changes.** Existing databases are migrated automatically.
659
+
530
660
  ### From 0.7.x to 0.8.0
531
661
 
532
662
  **Breaking:** `batchParse()` now returns `BatchParseResult` (with `parsed` and `failures` fields) instead of `Map<string, ParsedFile>`.