import type { BetterSqlite3Database, NativeDatabase } from '../types.js';
/** Escape LIKE wildcards in a literal string segment. */
export declare function escapeLike(s: string): string;
/**
 * Normalize a file filter value (string, string[], or falsy) into a flat array.
 * Returns an empty array when the input is falsy.
 */
export declare function normalizeFileFilter(file: string | string[] | undefined | null): string[];
/**
 * Build a SQL condition + params for a multi-value file LIKE filter.
 * Returns `{ sql: '', params: [] }` when the filter is empty.
 */
export declare function buildFileConditionSQL(file: string | string[], column?: string): {
    sql: string;
    params: string[];
};
/**
 * Commander option accumulator for repeatable `--file` flag.
 * Use as: `['-f, --file <path>', 'Scope to file (partial match, repeatable)', collectFile]`
 */
export declare function collectFile(val: string, acc?: string[]): string[];
/**
 * Return a SQL AND clause that excludes test/spec/stories files.
 * Returns empty string when disabled.
 */
export declare function testFilterSQL(column?: string, enabled?: boolean): string;
/** Build IN (?, ?, ?) placeholders and params array for a kind filter. */
export declare function kindInClause(kinds: string[]): {
    placeholders: string;
    params: string[];
};
/**
 * Return a LEFT JOIN subquery for fan-in (incoming edge count).
 */
export declare function fanInJoinSQL(edgeKind?: string, alias?: string): string;
/**
 * Return a LEFT JOIN subquery for fan-out (outgoing edge count).
 */
export declare function fanOutJoinSQL(edgeKind?: string, alias?: string): string;
/**
 * Fluent builder for the common `SELECT ... FROM nodes n WHERE ...` pattern.
 * Not an ORM — complex queries (BFS, correlated subqueries) stay as raw SQL.
 */
export declare class NodeQuery {
    #private;
    /** Set SELECT columns (default: `n.*`). */
    select(cols: string): this;
    /** WHERE n.kind IN (?, ?, ...) */
    kinds(kindArray: string[] | undefined | null): this;
    /** Add 5 NOT LIKE conditions to exclude test files. No-op when enabled is falsy. */
    excludeTests(enabled: boolean | undefined): this;
    /** WHERE n.file LIKE ? (no-op if falsy). Accepts a single string or string[]. */
    fileFilter(file: string | string[] | undefined | null): this;
    /** WHERE n.kind = ? (no-op if falsy). */
    kindFilter(kind: string | undefined | null): this;
    /** WHERE n.role = ? (no-op if falsy). 'dead' matches all dead-* sub-roles. */
    roleFilter(role: string | undefined | null): this;
    /** WHERE n.name LIKE ? (no-op if falsy). Escapes LIKE wildcards in the value. */
    nameLike(pattern: string | undefined | null): this;
    /** Raw WHERE condition escape hatch. */
    where(sql: string, ...params: (string | number)[]): this;
    /** Add fan-in LEFT JOIN subquery. */
    withFanIn(edgeKind?: string): this;
    /** Add fan-out LEFT JOIN subquery. */
    withFanOut(edgeKind?: string): this;
    /** LEFT JOIN function_complexity. */
    withComplexity(): this;
    /** LEFT JOIN file_commit_counts. */
    withChurn(): this;
    /** @internal Raw JOIN — internal use only; external callers should use withFanIn/withFanOut/withComplexity/withChurn. */
    _join(sql: string): this;
    /** ORDER BY clause. */
    orderBy(clause: string): this;
    /** LIMIT ?. */
    limit(n: number | undefined | null): this;
    /** Build the SQL and params without executing. */
    build(): {
        sql: string;
        params: (string | number)[];
    };
    /** Execute and return all rows. When `nativeDb` is provided, dispatches through rusqlite. */
    all<TRow = Record<string, unknown>>(db: BetterSqlite3Database, nativeDb?: NativeDatabase): TRow[];
    /** Execute and return first row. When `nativeDb` is provided, dispatches through rusqlite. */
    get<TRow = Record<string, unknown>>(db: BetterSqlite3Database, nativeDb?: NativeDatabase): TRow | undefined;
    /** Execute and return an iterator. */
    iterate<TRow = Record<string, unknown>>(db: BetterSqlite3Database): IterableIterator<TRow>;
}
//# sourceMappingURL=query-builder.d.ts.map