/** * Git Stats — P4 셀프 가드 (2026-04-27) * * 최근 N커밋의 conventional commit 분포를 측정해 fix:feat 비율을 계산. * 정상 OSS 권장은 fix < 20%. 36% 초과 시 회귀 패턴 의심 — forgen 의 자기 메타 가드. * * 이번 세션 측정값: v0.4.1 시점 fix 비율 36% (정상의 약 2배). 이 코드가 다음 릴리즈 * 시 같은 비율을 자동 노출하여 사용자가 회귀 패턴을 빠르게 인지하게 한다. */ export interface FixRatioStats { windowSize: number; fixCount: number; featCount: number; /** fix / (fix + feat), 0~1. fix+feat=0 이면 0. */ ratio: number; threshold: number; exceedsThreshold: boolean; /** git 명령이 성공했는지 (저장소 외부 또는 git 미설치 시 false). */ available: boolean; } /** * git log --no-merges -N 결과에서 conventional commit 형식의 fix/feat 만 카운트. * * 분류: * - `feat: ...` / `feat(scope): ...` → feat * - `fix: ...` / `fix(scope): ...` → fix (단, scope ∈ {test, tests, docs, doc} 제외) * - 그 외 (chore, refactor, docs, style, test, hash 없는 라인) → 무시 * * fix(test):, fix(docs): 가 제외되는 이유: 사소한 노이즈 fix 가 회귀 신호를 * 흐리지 않도록. 진짜 위험은 fix(core), fix(hook), fix(api) 같은 logic fix. */ export declare function computeFixFeatRatio(cwd?: string, windowSize?: number, threshold?: number): FixRatioStats; /** 테스트용 — git log 출력 텍스트를 직접 파싱. */ export declare function parseGitLog(rawLog: string, windowSize?: number, threshold?: number): FixRatioStats; /** 사람용 한 줄 라벨. */ export declare function formatFixRatio(s: FixRatioStats): string; export interface RegressHotspot { path: string; fixHits: number; lastFixSha: string; lastFixDate: string; } export interface RegressMap { windowDays: number; fixCommits: number; hotspots: RegressHotspot[]; available: boolean; } /** * 지난 N일 동안 fix 커밋이 닿은 파일 hot-list. * * doctor 가 fix:feat 비율로 "회귀 패턴 의심" 시그널은 주지만, 진앙은 안 보여준다. * regress-map 은 fix 커밋의 changed-files 를 카운트해 top-N hotspot 을 추출 → * "이거 고치면 저거 깨진다" 의 *저거* 후보를 한 화면에 노출. * * 제외 scope (fix:feat 와 동일): fix(test|tests|docs|doc) — 노이즈. */ export declare function computeRegressMap(cwd?: string, windowDays?: number, topN?: number): RegressMap; export declare function parseRegressLog(raw: string, windowDays: number, topN: number): RegressMap;