interface CodeFile {
    path: string;
    repo: string;
    language: string;
    gitBlobHash: string | null;
    lastScanned: string | null;
    sizeBytes: number;
    lines: number;
    metadata?: Record<string, any>;
}
interface ExtractedSymbol {
    name: string;
    kind: SymbolKind;
    scope: string | null;
    signature: string;
    startLine: number;
    endLine: number;
    metadata: Record<string, unknown>;
}
type SymbolKind = 'class' | 'method' | 'function' | 'interface' | 'trait' | 'constant' | 'enum' | 'property' | 'namespace' | 'struct' | 'module' | 'field';
interface ExtractedReference {
    sourceSymbol: string | null;
    targetName: string;
    referenceType: ReferenceType;
    startLine: number;
    verifiability?: 'verified' | 'inferred';
    metadata?: Record<string, any>;
}
type ReferenceType = 'import' | 'require' | 'extends' | 'implements' | 'call' | 'instantiation' | 'return_type' | 'param_type' | 'relation' | 'route' | 'middleware' | 'binding' | 'dispatch' | 'notify' | 'hook' | 'graphql_resolver' | 'message_handler' | 'websocket_handler' | 'render';
interface ParseResult {
    symbols: ExtractedSymbol[];
    references: ExtractedReference[];
    errors: ParseError[];
    fileMetadata?: Record<string, any>;
}
interface ParseError {
    message: string;
    line?: number;
}
interface GraphEdge {
    id?: number;
    sourceFile: string;
    targetFile: string;
    sourceSymbol: string | null;
    targetSymbol: string | null;
    edgeType: ReferenceType;
    repo: string;
    weight: number;
    verifiability?: 'verified' | 'inferred';
    metadata?: Record<string, any>;
    targetRepo?: string | null;
}
type ScanPhase = 'discover' | 'index' | 'parse' | 'resolve' | 'detect' | 'cluster';
interface ScanProgress {
    phase: ScanPhase;
    current: number;
    total: number;
    file?: string;
}
type ProgressCallback = (progress: ScanProgress) => void;
interface ScanResult {
    filesScanned: number;
    symbolsFound: number;
    edgesFound: number;
    durationMs: number;
    languageBreakdown: Record<string, number>;
    interrupted?: boolean;
    totalFiles?: number;
}
interface Snapshot {
    commitSha: string;
    parentSha: string | null;
    timestamp: string;
    filesAdded: string[];
    filesModified: string[];
    filesRemoved: string[];
    symbolsDelta: {
        added: number;
        removed: number;
        changed: number;
    };
}
interface ExportOptions {
    format: 'llm' | 'json' | 'dot' | 'svg' | 'toon';
    tokenBudget: number;
    repo?: string;
    files?: string[];
    delimiter?: 'comma' | 'tab' | 'pipe';
    keyFolding?: boolean;
}
interface RepoConfig {
    name: string;
    path: string;
    framework?: string;
    languages?: Record<string, UserLanguageDefinition>;
}
interface UserLanguageDefinition {
    extensions: string[];
    grammarWasm: string;
    queries: {
        symbols?: string;
        references?: string;
    };
    nodeMappings: Partial<Record<SymbolKind, string>>;
}
interface MapxConfig {
    version: string;
    repos: RepoConfig[];
    languages: Record<string, UserLanguageDefinition>;
    settings: {
        maxTokenBudget: number;
        excludePatterns: string[];
        includePatterns: string[];
        php?: {
            facadeMap?: Record<string, string>;
        };
        [key: string]: any;
    };
}
interface SubmoduleInfo {
    name: string;
    path: string;
    url: string;
    isInitialized: boolean;
}
interface MonorepoPackageInfo {
    /** Friendly name derived from the package manifest (e.g. package.json `name`). */
    name: string;
    /** Path relative to the workspace root (e.g. `apps/web`, `packages/shared`). */
    path: string;
    /** Package manager / build tool that declared this package (e.g. `npm`, `pnpm`, `cargo`). */
    packageManager: string;
}
type UniversalRole = 'entry' | 'config' | 'types' | 'shared' | 'test' | 'docs' | 'other';
type BackendRole = 'api' | 'middleware' | 'service' | 'data' | 'integration' | 'auth';
type FrontendRole = 'pages' | 'components' | 'state' | 'hooks' | 'styles' | 'assets';
type ToolRole = 'cli' | 'core' | 'parsers' | 'plugins';
type FileRole = UniversalRole | BackendRole | FrontendRole | ToolRole | 'utils' | 'ui' | 'exporters' | 'agents' | 'frameworks' | 'scripts';
/**
 * Architectural layer a file belongs to, automatically inferred from its path,
 * name, and role in the system. Used to add vertical depth to cluster views.
 * Aliased to FileRole for backward compatibility.
 */
type ArchLayer = FileRole;
type CodebaseArchetype = 'cli-tool' | 'web-api' | 'web-app' | 'full-stack' | 'library' | 'monorepo' | 'mobile-app' | 'mixed';
type ArchPattern = 'layered' | 'mvc' | 'mvvm' | 'hexagonal' | 'clean' | 'microkernel' | 'modular' | 'flat';
interface CodebaseProfile {
    archetype: CodebaseArchetype;
    archetypeConfidence: number;
    detectedFrameworks: string[];
    detectedPatterns: ArchPattern[];
    dominantLanguages: string[];
    hasBackend: boolean;
    hasFrontend: boolean;
    isMonorepo: boolean;
    componentBoundaries: string[];
}
type SignalSource = 'path' | 'naming' | 'topology' | 'framework' | 'imports';
interface ClassificationSignal {
    source: SignalSource;
    role: FileRole;
    confidence: number;
    reason: string;
}
interface ClassificationResult {
    filePath: string;
    role: FileRole;
    confidence: number;
    signals: ClassificationSignal[];
    alternateRoles: FileRole[];
}
interface WorkspaceInfo {
    path: string;
    repos: RepoConfig[];
}
interface RepoSummary {
    name: string;
    path: string;
    type: 'primary' | 'submodule' | 'peer';
    fileCount: number;
    symbolCount: number;
    edgeCount: number;
    crossRepoEdgeCount: number;
    lastScanned: string | null;
    headSha: string | null;
}
interface ScanContext {
    workspaceRoot: string;
    repoName: string;
    resolveSymbolToFile: (symbolName: string, sourcePath?: string) => string | null;
}
interface RouteBinding {
    framework: string;
    method: string;
    path: string;
    handlerFile: string;
    handlerSymbol?: string;
    middlewares?: string[];
    metadata?: Record<string, any>;
}
interface HookBinding {
    framework: string;
    hookName: string;
    hookType: string;
    handlerFile: string;
    handlerSymbol?: string;
    metadata?: Record<string, any>;
}
interface FrameworkDetector {
    readonly name: string;
    readonly language: string;
    readonly filePattern: RegExp;
    detect(projectRoot: string, files: string[]): Promise<boolean>;
    extractRoutes(filePath: string, content: string, ctx: ScanContext): Promise<RouteBinding[]>;
    extractHooks?(filePath: string, content: string, ctx: ScanContext): Promise<HookBinding[]>;
}

export type { ArchLayer, ArchPattern, BackendRole, ClassificationResult, ClassificationSignal, CodeFile, CodebaseArchetype, CodebaseProfile, ExportOptions, ExtractedReference, ExtractedSymbol, FileRole, FrameworkDetector, FrontendRole, GraphEdge, HookBinding, MapxConfig, MonorepoPackageInfo, ParseError, ParseResult, ProgressCallback, ReferenceType, RepoConfig, RepoSummary, RouteBinding, ScanContext, ScanPhase, ScanProgress, ScanResult, SignalSource, Snapshot, SubmoduleInfo, SymbolKind, ToolRole, UniversalRole, UserLanguageDefinition, WorkspaceInfo };
