/**
 * Project Profile Analysis Tools
 *
 * Deterministic extraction of project stack, file classifications, and
 * framework-specific conventions. Produces a JSON profile conforming to
 * the zuvo project-profile schema v1.0.
 */
import type { CodeIndex, CodeSymbol } from "../types.js";
export declare const EXTRACTOR_VERSIONS: {
    readonly stack_detector: "1.0.0";
    readonly file_classifier: "1.0.0";
    readonly hono: "2.0.0";
    readonly nestjs: "1.0.0";
    readonly nextjs: "1.0.0";
    readonly express: "1.0.0";
    readonly react: "2.0.0";
    readonly typescript: "3.0.0";
    readonly javascript: "1.0.0";
    readonly python: "1.0.0";
    readonly php: "2.0.0";
    readonly astro: "1.0.0";
    readonly kotlin: "1.0.0";
    readonly monorepo: "1.0.0";
};
export interface ProjectProfile {
    version: string;
    generated_at: string;
    generated_by: {
        tool: string;
        tool_version: string;
        extractor_versions: Record<string, string>;
    };
    compatible_with: string;
    status: "complete" | "partial" | "failed";
    identity?: ProjectIdentity;
    stack?: StackInfo;
    file_classifications?: FileClassifications;
    conventions?: Conventions;
    dependency_graph?: DependencyGraph;
    test_conventions?: TestConventions;
    known_gotchas?: KnownGotchas;
    generation_metadata: GenerationMetadata;
}
export interface ProjectIdentity {
    project_name: string;
    project_type: "monorepo" | "single";
    workspace_root: string;
    git_remote: string | null;
}
export interface DependencyGraph {
    entry_points: string[];
    hub_modules: {
        path: string;
        imported_by_count: number;
    }[];
    leaf_modules: string[];
    orphan_files: string[];
}
export interface TestConventions {
    mock_style: string | null;
    setup_files: string[];
    mock_patterns: {
        name: string;
        import_from: string;
        usage: string;
    }[];
    assertion_library: string;
    file_patterns: string[];
    common_mocks: string[];
}
export interface KnownGotchas {
    auto_detected: {
        gotcha: string;
        evidence: string[];
        severity: "high" | "medium" | "low";
    }[];
}
export interface StackInfo {
    framework: string | null;
    framework_version: string | null;
    language: string;
    language_version: string | null;
    test_runner: string | null;
    package_manager: string | null;
    build_tool: string | null;
    monorepo: {
        tool: string | null;
        workspaces: string[];
        /** Rich per-workspace data populated by `resolveWorkspaces()` when
         *  available; absent when only the regex fallback ran. */
        workspace_details?: import("../types.js").Workspace[];
    } | null;
    detected_from: string[];
}
export interface FileClassifications {
    critical: ClassifiedFile[];
    important: {
        count: number;
        by_type: Record<string, number>;
        top: ClassifiedFile[];
    };
    routine: {
        count: number;
        by_type: Record<string, number>;
    };
}
export interface ClassifiedFile {
    path: string;
    code_type: string;
    reason?: string;
    dependents_count: number;
    has_tests: boolean;
}
export interface Conventions {
    middleware_chains: MiddlewareChain[];
    rate_limits: RateLimitEntry[];
    route_mounts: RouteMountEntry[];
    auth_patterns: AuthPatterns;
}
export interface MiddlewareChain {
    scope: string;
    file: string;
    chain: {
        name: string;
        line: number;
        order: number;
    }[];
}
export interface RateLimitEntry {
    file: string;
    line: number;
    max: number;
    window: number;
    applied_to_path: string | null;
    method: string | null;
}
export interface RouteMountEntry {
    file: string;
    line: number;
    mount_path: string;
    imported_from: string | null;
    exported_as: string | null;
}
export interface AuthPatterns {
    auth_middleware: string | null;
    groups: Record<string, {
        requires_auth: boolean;
        middleware: string[];
    }>;
}
export interface NestConventions {
    modules: NestModuleEntry[];
    global_guards: NestProviderEntry[];
    global_filters: NestProviderEntry[];
    global_pipes: NestProviderEntry[];
    global_interceptors: NestProviderEntry[];
    controllers: string[];
    throttler: {
        ttl: number;
        limit: number;
    } | null;
    /** G1: middleware.configure(consumer) chains */
    middleware_chains: MiddlewareChainEntry[];
}
export interface MiddlewareChainEntry {
    middleware: string;
    routes: Array<{
        path: string;
        method?: string;
    }>;
    file: string;
    line: number;
}
export interface NestModuleEntry {
    name: string;
    file: string;
    line: number;
    imported_from: string | null;
    is_global: boolean;
    /** G2: entity class names from TypeOrmModule.forFeature([...]) / MongooseModule.forFeature([...]) */
    entities?: string[];
    /** G2: top-level config keys from forRoot({ ... }) */
    dynamic_config_keys?: string[];
}
export interface NestProviderEntry {
    name: string;
    token: string;
    file: string;
    line: number;
    imported_from: string | null;
}
export interface DependencyHealth {
    total: number;
    prod: number;
    dev: number;
    key_versions: Record<string, string>;
}
export interface GitHealth {
    total_commits: number;
    recent_commits_30d: number;
    last_commit_date: string | null;
    contributors: number;
}
export interface GenerationMetadata {
    files_analyzed: number;
    files_skipped: number;
    skip_reasons: Record<string, number>;
    duration_ms: number;
}
export declare function detectStack(projectRoot: string): Promise<StackInfo>;
export declare function classifyFiles(index: CodeIndex): FileClassifications;
export declare function getHonoFallbackCount(): number;
/**
 * Extract Hono conventions from an orchestrator file.
 *
 * Uses the tree-sitter AST extractor (HonoExtractor) and adapts the result
 * to the legacy Conventions shape. Falls back to the regex-based legacy
 * implementation on failure (with counter tracking for observability).
 *
 * Kill switch: set CODESIFT_LEGACY_HONO=1 to force legacy extractor.
 */
export declare function extractHonoConventions(source: string, filePath: string): Promise<Conventions>;
export declare function extractNestConventions(source: string, filePath: string): NestConventions;
/**
 * G1: Parse `configure(consumer: MiddlewareConsumer) { ... }` blocks.
 * Extracts consumer.apply(Middleware).forRoutes(...) chains.
 */
export declare function parseMiddlewareChains(source: string, filePath: string): MiddlewareChainEntry[];
export interface NextConventions {
    pages: {
        path: string;
        type: "page" | "layout" | "loading" | "error" | "not-found" | "global-error" | "default" | "template";
    }[];
    middleware: {
        file: string;
        matchers: string[];
    } | null;
    api_routes: {
        path: string;
        methods: string[];
        file: string;
    }[];
    services_count: number;
    inngest_functions: string[];
    webhooks: string[];
    client_component_count: number;
    server_action_count: number;
    config: {
        app_router: boolean;
        src_dir: boolean;
        i18n: boolean;
    };
}
export declare function extractNextConventions(_projectRoot: string, files: {
    path: string;
}[]): NextConventions;
export interface ExpressConventions {
    middleware: {
        name: string;
        file: string;
        line: number;
    }[];
    routers: {
        mount_path: string;
        file: string;
        line: number;
        imported_from: string | null;
    }[];
    error_handlers: {
        file: string;
        line: number;
    }[];
}
export declare function extractExpressConventions(source: string, filePath: string): ExpressConventions;
export interface ReactConventions {
    state_management: string | null;
    routing: string | null;
    ui_library: string | null;
    form_library: string | null;
    /** File-path-based counts (coarse, matches /pages/, /components/, /hooks/ dirs) */
    component_count: {
        pages: number;
        components: number;
        hooks: number;
    };
    /** Actual count from symbol kinds (requires Wave 1 extractor) */
    actual_component_count: number;
    /** Actual count from symbol kinds */
    actual_hook_count: number;
    /** Top hooks called across all components, sorted by usage */
    hook_usage: {
        name: string;
        count: number;
    }[];
    /** Count of components wrapped in React.memo/forwardRef/lazy */
    component_patterns: {
        memo: number;
        forwardRef: number;
        lazy: number;
    };
}
export declare function extractReactConventions(files: {
    path: string;
}[], deps: Record<string, string>, symbols?: CodeSymbol[]): ReactConventions;
export interface PythonConventions {
    framework_type: "fastapi" | "django" | "flask" | null;
    routers: {
        path: string;
        file: string;
    }[];
    middleware: string[];
    models_dir: string | null;
    test_framework: string | null;
}
export declare function extractPythonConventions(files: {
    path: string;
}[]): PythonConventions;
export interface PhpConventions {
    controllers: {
        name: string;
        path: string;
    }[];
    middleware: {
        name: string;
        path: string;
    }[];
    models: {
        name: string;
        path: string;
    }[];
    routes_files: string[];
    migrations_count: number;
}
export declare function extractPhpConventions(files: {
    path: string;
}[]): PhpConventions;
export interface Yii2Conventions extends PhpConventions {
    framework_type: "yii2";
    modules: {
        name: string;
        path: string;
    }[];
    widgets: {
        name: string;
        path: string;
    }[];
    behaviors: {
        name: string;
        path: string;
    }[];
    components: {
        name: string;
        path: string;
    }[];
    assets: {
        name: string;
        path: string;
    }[];
    config_files: string[];
}
export declare function extractYii2Conventions(files: {
    path: string;
}[]): Yii2Conventions;
/** Test-only — clear the analyzeProject cache. */
export declare function resetAnalyzeProjectCacheForTesting(): void;
export declare function analyzeProject(repoName: string, options?: {
    force?: boolean | undefined;
}): Promise<ProfileSummary>;
export interface ProfileSummary {
    status: ProjectProfile["status"];
    profile_path: string;
    stack: {
        framework: string | null;
        language: string;
        test_runner: string | null;
        package_manager: string | null;
        monorepo: boolean;
    };
    file_counts: {
        critical: number;
        important: number;
        routine: number;
        total_analyzed: number;
    };
    conventions_summary: Record<string, unknown> | null;
    dependency_health: {
        total: number;
        prod: number;
        dev: number;
        key_count: number;
    } | null;
    git_health: GitHealth | null;
    duration_ms: number;
}
export declare function buildConventionsSummary(profile: ProjectProfile): ProfileSummary["conventions_summary"];
/**
 * Languages with a tree-sitter parser extractor — these get symbol-level
 * indexing (search_symbols, get_file_outline, get_symbol, find_references, etc.).
 */
export declare const PARSER_LANGUAGES: readonly ["typescript", "javascript", "python", "go", "rust", "php", "kotlin", "prisma", "markdown", "astro", "sql", "sql-jinja"];
/**
 * Languages indexed as FileEntry (so get_file_tree and search_text with
 * file_pattern work) but WITHOUT symbol extraction. Ripgrep-backed search_text
 * and scan_secrets work on these via filesystem. Upgrade path: add a
 * tree-sitter grammar .wasm and extractor to move a language to PARSER_LANGUAGES.
 */
export declare const TEXT_STUB_LANGUAGES: readonly ["swift", "dart", "scala", "clojure", "elixir", "lua", "zig", "nim", "gradle", "sbt"];
export interface ExtractorVersionsResponse {
    /** Tree-sitter language parsers — affect symbol-based tools only */
    parser_languages: readonly string[];
    /** Indexed (file listing + text search) but no symbol extraction yet */
    text_stub_languages: readonly string[];
    /** Framework detectors used by analyze_project (project profile) */
    profile_frameworks: Record<string, string>;
    /**
     * Important note for agents: text-based tools work on ALL files regardless
     * of parser_languages. Missing a language here does NOT mean CodeSift is
     * useless for that project — it just means no symbol indexing.
     */
    note: string;
    /** Backward compat: flat version dict matching legacy shape */
    versions: Record<string, string>;
}
export declare function getExtractorVersions(): ExtractorVersionsResponse;
//# sourceMappingURL=project-tools.d.ts.map