import type { GitRunner } from '../git/runner.js'; export interface ComplexitySnapshot { date: Date; totalFiles: number; totalSize: number; churnRate: number; /** * Commit hash that the snapshot reflects. Optional so analyzer outputs * remain compatible with synthetic test fixtures that build snapshots * directly. When present, enables real churn computation between * consecutive snapshots. */ commitHash?: string; } export interface ComplexityTrendData { snapshots: ComplexitySnapshot[]; interval: 'weekly' | 'monthly'; } export interface ComplexityConfig { from: Date; to: Date; branch: string; scope?: string; } /** * Determine whether to use monthly or weekly intervals. * Monthly if the date range spans >= 3 months, weekly otherwise. */ export declare function determineInterval(from: Date, to: Date): 'weekly' | 'monthly'; /** * Downsample a sorted array of dates to at most `max` entries by picking * evenly-spaced indices. Always preserves the first and last entries so the * trend chart shows the true endpoints. No-op when `dates.length <= max`. */ export declare function downsampleDates(dates: Date[], max: number): Date[]; /** * Generate snapshot sample dates between `from` and `to`. * Monthly: first day of each month within the range. * Weekly: every 7 days starting from `from`. */ export declare function generateSnapshotDates(from: Date, to: Date, interval: 'weekly' | 'monthly'): Date[]; /** * Parse ls-tree output string into TreeEntry objects. * Used when we have the full output as a string from exec(). */ export declare function parseLsTreeOutput(output: string, scope?: string): { totalFiles: number; totalSize: number; }; /** * Analyze complexity trends by sampling repository snapshots. * * @param config - Date range, branch, and optional scope * @param gitRunner - Git command runner * @returns ComplexityTrendData with snapshots and interval */ export declare function analyzeComplexityTrend(config: ComplexityConfig, gitRunner: GitRunner): Promise; /** * Compute churn rates between consecutive snapshots using `git diff-tree`. * * For each snapshot pair (prev, curr) with both commit hashes available: * churnRate = filesChanged / max(curr.totalFiles, 1) * * filesChanged is the number of distinct paths returned by * `git diff-tree -r --name-only ` — that is, every blob added, * deleted, modified, or renamed between the two commits. * * Snapshots without a commit hash (synthetic fixtures, or rev-list misses) * keep churnRate = 0. The first snapshot has no predecessor, so it also * stays at 0. Failures are non-fatal: if a diff-tree call fails, that * snapshot's churnRate is left at 0 and the rest continue. */ export declare function computeChurnRates(snapshots: ComplexitySnapshot[], gitRunner?: GitRunner): Promise; //# sourceMappingURL=complexity.d.ts.map