export type WatcherEventType = 'create' | 'modify' | 'delete';
export interface WatcherEvent {
    /** Type of file system event */
    type: WatcherEventType;
    /** Normalized path relative to project root */
    path: string;
    /** Unix timestamp in milliseconds */
    timestamp: number;
}
export type FileHookType = 'on-save' | 'on-create' | 'on-delete' | 'on-test-pass' | 'on-commit';
export interface FileHookTypeConfig {
    /** Whether this hook type is enabled */
    enabled: boolean;
    /** Glob patterns to include */
    include?: string[];
    /** Glob patterns to exclude */
    exclude?: string[];
}
export interface FileHookConfig {
    /** Master switch for all file hooks */
    enabled: boolean;
    /** Debounce window in milliseconds */
    debounceMs: number;
    /** Rate limit per file in milliseconds */
    rateLimitPerFileMs: number;
    /** Per-hook-type configuration */
    hooks: Record<string, FileHookTypeConfig>;
}
export interface DebouncerOptions {
    /** Debounce window in milliseconds (default: 300) */
    debounceMs?: number;
    /** Rate limit per file in milliseconds (default: 5000) */
    rateLimitPerFileMs?: number;
    /** Rate limit per spec for auto-reconcile in milliseconds (default: 300000) */
    rateLimitPerSpecMs?: number;
}
export interface DebouncerConfig {
    /** Debounce window in ms (default: 300) */
    debounceMs: number;
    /** Rate limit per file in ms (default: 5000) */
    rateLimitPerFileMs: number;
    /** Rate limit per spec in ms for auto-reconcile (default: 300000 = 5 min) */
    rateLimitPerSpecMs: number;
}
export interface TokenBucket {
    tokens: number;
    lastRefill: number;
    capacity: number;
    refillIntervalMs: number;
}
export interface FileWatcherOptions {
    /** Root directory to watch */
    rootDir: string;
    /** Glob patterns to include (default: all) */
    include?: string[];
    /** Glob patterns to exclude (always includes data/ and node_modules/) */
    exclude?: string[];
}
export interface OnSaveContext {
    /** Absolute path to project root */
    projectRoot: string;
    /** Set of known spec IDs (e.g. from spec store) */
    knownSpecs: Set<string>;
}
export interface SpecFilePlan {
    /** Spec ID (e.g. "SPEC-042") */
    specId: string;
    /** Glob patterns of files planned in this spec */
    plannedFiles: string[];
}
export interface OnCreateContext {
    /** Active specs with their file plans */
    specFilePlans: SpecFilePlan[];
}
export interface SpecAnnotationIndex {
    /** Spec ID */
    specId: string;
    /** Files that reference this spec via @spec annotations */
    annotatedFiles: string[];
}
export interface OnDeleteContext {
    /** Index of specs and their annotated files */
    specAnnotations: SpecAnnotationIndex[];
}
export interface OnSaveHookResult {
    hook: 'on-save';
    specId: string | null;
    driftDelta: number;
    hashChanged: boolean;
    annotationsValid: boolean;
}
export interface OnCreateHookResult {
    hook: 'on-create';
    path: string;
    matchedSpecs: string[];
    suggestedAnnotations: string[];
}
export interface OnDeleteHookResult {
    hook: 'on-delete';
    path: string;
    affectedSpecs: string[];
    brokenAnnotations: string[];
}
export type FileHookResult = OnSaveHookResult | OnCreateHookResult | OnDeleteHookResult;
export type ConfigChangeCallback = (config: FileHookConfig) => void;
export type DebouncedCallback = (event: WatcherEvent) => void;
/** Result from on-test-pass handler */
export interface OnTestPassHookResult {
    hook: 'on-test-pass';
    coverageDelta: Record<string, number>;
    specsUpdated: string[];
}
/** Context for on-test-pass handler */
export interface OnTestPassContext {
    /** Path to coverage-summary.json */
    coveragePath: string;
    /** Mapping of file patterns to spec IDs via annotations */
    specAnnotationIndex: SpecAnnotationIndex[];
    /** Previous coverage data for delta computation */
    previousCoverage?: Record<string, number>;
}
/** Result from on-commit handler */
export interface OnCommitHookResult {
    hook: 'on-commit';
    commitHash: string;
    reconciledSpecs: string[];
    integrityResult: {
        valid: boolean;
        errors: string[];
    };
}
/** Context for on-commit handler */
export interface OnCommitContext {
    /** Absolute path to project root */
    projectRoot: string;
    /** Set of known spec IDs */
    knownSpecs: Set<string>;
}
/** Plugin handler for custom hooks */
export interface HookPluginHandler {
    /** Unique name for the handler */
    name: string;
    /** Hook type this handler processes */
    hookType: FileHookType;
    /** Priority (lower = higher priority, default 100) */
    priority?: number;
    /** The handler function */
    execute: (event: WatcherEvent) => Promise<FileHookResult | OnTestPassHookResult | OnCommitHookResult>;
}
/** Telemetry data per hook type */
export interface HookTelemetry {
    /** Total executions */
    executionCount: number;
    /** Average latency in ms */
    avgLatencyMs: number;
    /** Number of errors */
    errorCount: number;
    /** Error rate (0-1) */
    errorRate: number;
    /** Total latency accumulated (internal) */
    totalLatencyMs: number;
}
/** Status returned by HookEngine.status() */
export interface HookEngineStatus {
    /** Whether the engine is running */
    running: boolean;
    /** Active hooks by type */
    activeHooks: {
        name: string;
        hookType: FileHookType;
        priority: number;
    }[];
    /** Number of pending events */
    pendingEvents: number;
    /** Telemetry per hook name */
    telemetry: Record<string, HookTelemetry>;
}
/** Typed event for the EventBus */
export interface EventBusEvent {
    /** Unique event ID */
    id: string;
    /** Event type discriminator */
    type: 'file:change' | 'hook:start' | 'hook:complete' | 'hook:error';
    /** Timestamp in ms */
    timestamp: number;
    /** Event-specific data */
    data: Record<string, unknown>;
}
/** Extended hook result union including SPEC-130 types */
export interface CoverageMetric {
    total: number;
    covered: number;
    skipped: number;
    pct: number;
}
export interface FileCoverage {
    lines: CoverageMetric;
    statements: CoverageMetric;
    functions: CoverageMetric;
    branches: CoverageMetric;
}
export type CoverageSummary = Record<string, FileCoverage>;
export type ExtendedHookResult = FileHookResult | OnTestPassHookResult | OnCommitHookResult;
export interface StartHooksInput {
    /** Absolute path to the project root directory to watch */
    projectPath: string;
    /** Hook types to enable */
    hooks?: string[];
}
export interface StopHooksInput {
    /** Optional reason for stopping the hook engine */
    reason?: string;
}
export interface ConfigureHooksInput {
    /** Absolute path to the project root directory */
    projectPath: string;
    /** Master switch for all hooks */
    enabled?: boolean;
    /** Debounce window in milliseconds */
    debounceMs?: number;
    /** Rate limit per file in milliseconds */
    rateLimitPerFileMs?: number;
    /** Per-hook-type configuration overrides */
    hooks?: Record<string, {
        enabled?: boolean;
        include?: string[];
        exclude?: string[];
    }>;
}
//# sourceMappingURL=file-hooks.d.ts.map