import { type ClassDeclaration, type MethodDeclaration } from 'ts-morph'; /** * Represents a private helper method call detected in a method body. */ export interface PrivateHelperCall { /** Helper method name (e.g., 'decodeJwtPayload') */ helperMethodName: string; /** Full call expression (e.g., 'this.decodeJwtPayload(token)') */ callExpression: string; /** The helper method declaration */ helperMethod: MethodDeclaration; } /** * Analysis of how a private helper method is used. */ export interface HelperUsagePattern { /** Type of usage pattern */ usageType: 'single-responsibility' | 'shared-across-responsibilities' | 'unused'; /** Public methods that call this helper */ usedByMethods: string[]; /** Responsibilities of the calling methods */ usedByResponsibilities: string[]; /** Recommendation for handling this helper */ recommendation: 'move-with-caller' | 'extract-to-utility' | 'keep-in-original'; } /** * Detects private helper methods called by public methods. * * When public methods are split across focused services, private helper methods * they depend on must also be moved to avoid compilation errors. * * This detector: * 1. Scans public method bodies for `this.privateMethod()` calls * 2. Identifies which private methods are helpers (not public API) * 3. Builds dependency graph for transitive helper calls * 4. Analyzes usage patterns to determine extraction strategy */ export declare class PrivateHelperMethodDetector { /** * Detects all private helper method calls in a public method. * * @param publicMethod - The public method to analyze * @param classDecl - The class containing the method * @returns Array of detected private helper calls */ detectPrivateHelperCalls(publicMethod: MethodDeclaration, classDecl: ClassDeclaration): PrivateHelperCall[]; /** * Detects all transitive private helper dependencies. * * If a public method calls helper1(), and helper1() calls helper2(), * both helpers must be moved together. * * @param publicMethod - The public method to analyze * @param classDecl - The class containing the method * @returns Array of all helper methods (direct + transitive) */ detectTransitiveHelpers(publicMethod: MethodDeclaration, classDecl: ClassDeclaration): MethodDeclaration[]; /** * Analyzes how a private helper method is used across the class. * * Determines: * - Is it used by one method or multiple? * - Are the callers from the same responsibility or different? * - Should it be moved with caller or extracted to utility? * * @param helperMethod - The private helper method to analyze * @param classDecl - The class containing the method * @returns Usage pattern analysis */ analyzeHelperUsagePattern(helperMethod: MethodDeclaration, classDecl: ClassDeclaration): HelperUsagePattern; /** * Builds a dependency graph of method calls. * * Maps each method to the methods it calls. * * @param classDecl - The class to analyze * @returns Map of method name to called method names */ buildHelperDependencyGraph(classDecl: ClassDeclaration): Map; /** * Finds all `this.methodName()` calls in a method body. * * @param methodBody - Method body node to analyze * @returns Array of method calls * @private */ private findThisMethodCalls; /** * Checks if a method is a private helper. * * A method is a private helper if: * - It has private scope * - It's not a lifecycle hook * - It's not a static method * * @param method - Method to check * @returns True if method is a private helper * @private */ private isPrivateHelper; /** * Detects circular dependencies in the call graph. * * @param graph - Dependency graph * @throws Error if circular dependency detected * @private */ private detectCircularDependencies; } //# sourceMappingURL=private-helper-method-detector.d.ts.map