import { AnalysisResult, CrossRepoLink, MermaidDiagram, DataFlow, DocumentationReport } from '../types.js'; /** * Mermaid diagram generator */ declare class MermaidGenerator { /** * Generate all diagrams from analysis result */ generateAll(results: AnalysisResult[], crossRepoLinks: CrossRepoLink[]): MermaidDiagram[]; /** * Generate navigation flowchart - grouped by URL category */ generateNavigationDiagram(result: AnalysisResult): MermaidDiagram; /** * Generate data flow diagram */ generateDataFlowDiagram(result: AnalysisResult): MermaidDiagram; /** * Generate component hierarchy diagram */ generateComponentDiagram(result: AnalysisResult): MermaidDiagram; /** * Generate GraphQL operations diagram */ generateGraphQLDiagram(result: AnalysisResult): MermaidDiagram; /** * Generate cross-repository diagram */ generateCrossRepoDiagram(results: AnalysisResult[], crossRepoLinks: CrossRepoLink[]): MermaidDiagram; /** * Generate sequence diagram for a specific flow */ generateSequenceDiagram(flow: DataFlow): MermaidDiagram; } /** * Markdown documentation generator */ declare class MarkdownGenerator { /** * Generate complete documentation */ generateDocumentation(report: DocumentationReport): Map; private generateIndex; private generateRepoIndex; private generatePagesDoc; private generateComponentsDoc; private extractFeatureFromPage; private extractFeatureFromComponent; private formatComponentDataOps; private generateGraphQLDoc; private formatGraphQLFields; private generateDataFlowDoc; private getPageOperationGroups; private flattenGroups; private generateCrossRepoDoc; private createPageDataFlowDiagram; private generateDiagramsDoc; } /** * Environment detection utilities */ type EnvironmentType = 'nextjs' | 'react' | 'rails' | 'generic'; interface DetectedEnvironment { type: EnvironmentType; detected: boolean; version?: string; path: string; features: string[]; } interface EnvironmentDetectionResult { environments: DetectedEnvironment[]; hasNextjs: boolean; hasReact: boolean; hasRails: boolean; primary: EnvironmentType; } /** * Rails Routes Analyzer using tree-sitter */ interface RailsRoute { method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'ALL'; path: string; controller: string; action: string; name?: string; namespace?: string; authenticated?: boolean; line: number; } interface ResourceInfo { name: string; controller: string; only?: string[]; except?: string[]; nested: ResourceInfo[]; memberRoutes: RailsRoute[]; collectionRoutes: RailsRoute[]; line: number; } interface MountedEngine { engine: string; mountPath: string; line: number; } interface RailsRoutesResult { routes: RailsRoute[]; namespaces: string[]; resources: ResourceInfo[]; mountedEngines: MountedEngine[]; drawnFiles: string[]; errors: string[]; } /** * Rails Controller Analyzer using tree-sitter */ interface ControllerInfo { name: string; filePath: string; className: string; parentClass: string; namespace?: string; actions: ActionInfo[]; beforeActions: FilterInfo[]; afterActions: FilterInfo[]; aroundActions: FilterInfo[]; skipBeforeActions: FilterInfo[]; concerns: string[]; helpers: string[]; rescueFrom: RescueInfo[]; layoutInfo?: LayoutInfo; line: number; } interface InstanceVarAssignment { name: string; assignedType?: string; assignedValue?: string; line?: number; } interface ActionInfo { name: string; line: number; visibility: 'public' | 'private' | 'protected'; parameters: string[]; rendersJson?: boolean; rendersHtml?: boolean; redirectsTo?: string; respondsTo?: string[]; servicesCalled: string[]; modelsCalled: string[]; methodCalls: string[]; instanceVarAssignments?: InstanceVarAssignment[]; } interface FilterInfo { name: string; only?: string[]; except?: string[]; if?: string; unless?: string; line: number; } interface RescueInfo { exception: string; handler: string; line: number; } interface LayoutInfo { name: string; conditions?: string; } interface RailsControllersResult { controllers: ControllerInfo[]; totalActions: number; namespaces: string[]; concerns: string[]; errors: string[]; } /** * Rails Model Analyzer using tree-sitter */ interface ModelInfo { name: string; filePath: string; className: string; parentClass: string; tableName?: string; associations: AssociationInfo[]; validations: ValidationInfo[]; callbacks: CallbackInfo[]; scopes: ScopeInfo[]; concerns: string[]; enums: EnumInfo[]; attributes: AttributeInfo[]; classMethodsCount: number; instanceMethodsCount: number; line: number; } interface AssociationInfo { type: 'belongs_to' | 'has_one' | 'has_many' | 'has_and_belongs_to_many'; name: string; className?: string; foreignKey?: string; through?: string; polymorphic?: boolean; dependent?: string; optional?: boolean; line: number; } interface ValidationInfo { type: string; attributes: string[]; options?: Record; line: number; } interface CallbackInfo { type: string; method: string; conditions?: string; line: number; } interface ScopeInfo { name: string; lambda: boolean; line: number; } interface EnumInfo { name: string; values: string[]; line: number; } interface AttributeInfo { name: string; type?: string; default?: string; line: number; } interface RailsModelsResult { models: ModelInfo[]; totalAssociations: number; totalValidations: number; concerns: string[]; namespaces: string[]; errors: string[]; } /** * Rails gRPC Service Analyzer using tree-sitter */ interface GrpcServiceInfo { name: string; filePath: string; className: string; parentClass: string; namespace?: string; protoService?: string; rpcs: RpcMethodInfo[]; policies: string[]; serializers: string[]; concerns: string[]; line: number; } interface RpcMethodInfo { name: string; requestType?: string; responseType?: string; streaming?: 'none' | 'server' | 'client' | 'bidirectional'; policyMethod?: string; modelsUsed: string[]; servicesUsed: string[]; line: number; } interface RailsGrpcResult { services: GrpcServiceInfo[]; totalRpcs: number; namespaces: string[]; errors: string[]; } interface ReactComponentRef { name: string; propsVar?: string; ssr?: boolean; line?: number; } interface RailsViewInfo { name: string; path: string; controller: string; action: string; format: string; template: 'haml' | 'erb' | 'yml' | 'other'; routePath?: string; partials: string[]; helpers: string[]; instanceVars: string[]; reactComponents: ReactComponentRef[]; line?: number; } interface RailsPageInfo { route: string; method: string; controller: string; action: string; view?: RailsViewInfo; apis: RailsApiCall[]; services: string[]; grpcCalls: string[]; modelAccess: string[]; } interface RailsApiCall { type: 'grpc' | 'service' | 'http' | 'internal'; name: string; method?: string; source: string; line?: number; } interface RailsViewAnalysisResult { views: RailsViewInfo[]; pages: RailsPageInfo[]; summary: { totalViews: number; totalPages: number; byController: Record; byTemplate: Record; }; } interface ReactComponentMapping { name: string; entryFile?: string; sourceFile?: string; importPath?: string; ssr: boolean; usedIn: ReactComponentUsage[]; } interface ReactComponentUsage { viewPath: string; controller: string; action: string; propsVar?: string; line?: number; pattern: ReactMountPattern; } type ReactMountPattern = 'data-react-component' | 'render_react_component' | 'react_component' | 'redux_store' | 'stimulus-reflex' | 'turbo-frame-react'; interface ReactAnalysisResult { components: ReactComponentMapping[]; entryPoints: EntryPointInfo[]; detectedPaths: DetectedPaths; summary: { totalComponents: number; totalEntryPoints: number; ssrComponents: number; clientComponents: number; }; } interface EntryPointInfo { file: string; fullPath: string; componentName: string; imports: string[]; selector?: string; } interface DetectedPaths { entryDirs: string[]; componentDirs: string[]; integrationPattern: 'react-rails' | 'react_on_rails' | 'webpacker' | 'vite' | 'custom' | 'unknown'; } /** * Rails Analyzers - Index */ interface RailsAnalysisResult { routes: RailsRoutesResult; controllers: RailsControllersResult; models: RailsModelsResult; grpc: RailsGrpcResult; views: RailsViewAnalysisResult; react: ReactAnalysisResult; summary: RailsSummary; } interface RailsSummary { totalRoutes: number; totalControllers: number; totalActions: number; totalModels: number; totalAssociations: number; totalValidations: number; totalGrpcServices: number; totalRpcs: number; totalViews: number; totalPages: number; totalReactComponents: number; ssrReactComponents: number; namespaces: string[]; concerns: string[]; } interface PageMapOptions { envResult?: EnvironmentDetectionResult | null; railsAnalysis?: RailsAnalysisResult | null; activeTab?: 'pages' | 'rails' | 'api'; staticMode?: boolean; } /** * Interactive page map generator */ declare class PageMapGenerator { private graphqlOps; private apiCalls; private components; generatePageMapHtml(report: DocumentationReport, options?: PageMapOptions): string; private buildHierarchy; private renderPageMapHtml; private buildTreeHtml; private getPageType; } export { MarkdownGenerator, MermaidGenerator, PageMapGenerator, type PageMapOptions };