/** * Forgen — MCP Solution Reader * * MCP 도구 핸들러를 위한 비즈니스 로직 파사드. * 기존 solution-index, solution-matcher, solution-format 모듈을 조합하여 * 검색/목록/읽기/통계 기능을 제공합니다. * * 설계 결정: * - MCP 도구 핸들러가 직접 fs/path를 다루지 않도록 격리 * - Hook injection(push)과 독립: 세션 캐시/버짓 적용 안 함 * - compound-read는 전문 반환 (축약 없음), compound-search는 요약만 * - prompt injection 필터는 동일하게 적용 (보안 일관성) * - 인덱스 캐시는 isIndexStale()에 의존 (resetIndexCache 미사용) * → 디렉토리 mtime이 변하지 않으면 캐시 재사용 (성능) */ import type { SolutionStatus, SolutionType } from '../engine/solution-format.js'; import type { SolutionDirConfig } from '../engine/solution-index.js'; export interface SearchOptions { dirs?: SolutionDirConfig[]; type?: SolutionType; status?: SolutionStatus; limit?: number; } export interface ListOptions { dirs?: SolutionDirConfig[]; status?: SolutionStatus; type?: SolutionType; scope?: 'me' | 'team' | 'project' | 'universal'; sort?: 'confidence' | 'updated' | 'name'; } export interface SolutionSummary { name: string; status: SolutionStatus; confidence: number; type: SolutionType; scope: 'me' | 'team' | 'project' | 'universal'; tags: string[]; } export interface SearchResult extends SolutionSummary { relevance: number; matchedTags: string[]; } export interface SolutionDetail { name: string; status: SolutionStatus; confidence: number; type: SolutionType; scope: 'me' | 'team' | 'project' | 'universal'; tags: string[]; identifiers: string[]; context: string; content: string; } export interface SolutionStats { total: number; retiredCount: number; extractionPrecision: number | null; byStatus: Record; byType: Record; byScope: Record<'me' | 'team' | 'project' | 'universal', number>; } /** * 기본 솔루션 디렉토리 목록 생성. * MCP 서버에서 cwd를 전달받으면 project 스코프도 포함. */ export declare function defaultSolutionDirs(cwd?: string): SolutionDirConfig[]; /** * 쿼리 텍스트로 솔루션을 검색합니다. * 태그 기반 Jaccard 매칭 + confidence 가중치. * Hook injection과 달리 세션 캐시/버짓 없이 순수 검색. * * 인덱스 캐시: getOrBuildIndex() 내부의 isIndexStale()이 * 디렉토리 mtime을 비교하여 변경 시에만 재구축합니다. */ export declare function searchSolutions(query: string, options?: SearchOptions): SearchResult[]; /** 솔루션 요약 목록을 반환합니다 (필터/정렬 지원). */ export declare function listSolutions(options?: ListOptions): SolutionSummary[]; /** * 이름으로 솔루션 전문을 읽습니다. * * MCP는 온디맨드이므로 truncation 없이 전문을 반환합니다. * 이것이 hook injection(1500자 캡)과의 핵심 차이입니다. * Prompt injection 필터만 적용합니다. */ export declare function readSolution(name: string, options?: { dirs?: SolutionDirConfig[]; skipEvidence?: boolean; }): SolutionDetail | null; /** 솔루션 통계 (status별, type별, scope별 카운트). */ export declare function getSolutionStats(options?: { dirs?: SolutionDirConfig[]; }): SolutionStats;