UNPKG

@bobmatnyc/ai-code-review

Version:

A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter

1,590 lines (1,589 loc) 203 kB
/** * @fileoverview Schema for code tracing unused code review. * * This module defines a schema for code tracing unused code review that includes * detailed evidence for why each element is considered unused. */ import { z } from 'zod'; import { StructuredOutputParser } from '@langchain/core/output_parsers'; /** * Confidence level for an unused code finding */ export type ConfidenceLevel = 'high' | 'medium' | 'low'; /** * Types of unused code elements */ export type UnusedElementType = 'file' | 'function' | 'class' | 'interface' | 'type' | 'variable' | 'import' | 'dead-branch' | 'parameter' | 'property' | 'enum' | 'export' | 'hook' | 'component'; /** * Schema for the evidence of why an element is unused */ export declare const TraceEvidenceSchema: z.ZodObject<{ /** * Definition information - where the element is defined */ definition: z.ZodObject<{ /** * File where the element is defined */ file: z.ZodString; /** * Line number where the element is defined */ line: z.ZodNumber; /** * Code snippet showing the definition */ codeSnippet: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; codeSnippet: string; line: number; }, { file: string; codeSnippet: string; line: number; }>; /** * Export information - how/where the element is exported (if applicable) */ exports: z.ZodOptional<z.ZodArray<z.ZodObject<{ /** * File where the element is exported */ file: z.ZodString; /** * Line number where the element is exported */ line: z.ZodNumber; /** * Export type (default, named, re-export, etc.) */ exportType: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; line: number; exportType: string; }, { file: string; line: number; exportType: string; }>, "many">>; /** * Import search - evidence of searching for imports of this element */ importSearch: z.ZodObject<{ /** * Areas searched for imports */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no imports were found */ noImportsFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }>; /** * Reference search - evidence of searching for references to this element */ referenceSearch: z.ZodObject<{ /** * Areas searched for references */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no references were found */ noReferencesFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }>; /** * Edge cases considered */ edgeCasesConsidered: z.ZodArray<z.ZodObject<{ /** * Edge case description */ case: z.ZodString; /** * How this edge case was verified */ verification: z.ZodString; }, "strip", z.ZodTypeAny, { case: string; verification: string; }, { case: string; verification: string; }>, "many">; /** * Additional evidence */ additionalEvidence: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }>; /** * Schema for a single unused code element with trace evidence */ export declare const TracedUnusedElementSchema: z.ZodObject<{ /** * Type of the unused element */ elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>; /** * Name of the element */ name: z.ZodString; /** * File where the element is located */ filePath: z.ZodString; /** * Line numbers where the element is defined */ location: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { startLine: number; endLine?: number | undefined; }, { startLine: number; endLine?: number | undefined; }>; /** * Code snippet showing the unused element */ codeSnippet: z.ZodString; /** * Confidence level that this element is truly unused */ confidence: z.ZodEnum<["high", "medium", "low"]>; /** * Explanation for the confidence assessment */ confidenceReason: z.ZodString; /** * Evidence of why this element is unused */ evidence: z.ZodObject<{ /** * Definition information - where the element is defined */ definition: z.ZodObject<{ /** * File where the element is defined */ file: z.ZodString; /** * Line number where the element is defined */ line: z.ZodNumber; /** * Code snippet showing the definition */ codeSnippet: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; codeSnippet: string; line: number; }, { file: string; codeSnippet: string; line: number; }>; /** * Export information - how/where the element is exported (if applicable) */ exports: z.ZodOptional<z.ZodArray<z.ZodObject<{ /** * File where the element is exported */ file: z.ZodString; /** * Line number where the element is exported */ line: z.ZodNumber; /** * Export type (default, named, re-export, etc.) */ exportType: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; line: number; exportType: string; }, { file: string; line: number; exportType: string; }>, "many">>; /** * Import search - evidence of searching for imports of this element */ importSearch: z.ZodObject<{ /** * Areas searched for imports */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no imports were found */ noImportsFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }>; /** * Reference search - evidence of searching for references to this element */ referenceSearch: z.ZodObject<{ /** * Areas searched for references */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no references were found */ noReferencesFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }>; /** * Edge cases considered */ edgeCasesConsidered: z.ZodArray<z.ZodObject<{ /** * Edge case description */ case: z.ZodString; /** * How this edge case was verified */ verification: z.ZodString; }, "strip", z.ZodTypeAny, { case: string; verification: string; }, { case: string; verification: string; }>, "many">; /** * Additional evidence */ additionalEvidence: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }>; /** * Potential risks of removing this element */ removalRisks: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }>; /** * Schema for the code tracing unused code review result */ export declare const CodeTracingUnusedCodeReviewSchema: z.ZodObject<{ /** * Unused files */ unusedFiles: z.ZodArray<z.ZodEffects<z.ZodObject<{ /** * Type of the unused element */ elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>; /** * Name of the element */ name: z.ZodString; /** * File where the element is located */ filePath: z.ZodString; /** * Line numbers where the element is defined */ location: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { startLine: number; endLine?: number | undefined; }, { startLine: number; endLine?: number | undefined; }>; /** * Code snippet showing the unused element */ codeSnippet: z.ZodString; /** * Confidence level that this element is truly unused */ confidence: z.ZodEnum<["high", "medium", "low"]>; /** * Explanation for the confidence assessment */ confidenceReason: z.ZodString; /** * Evidence of why this element is unused */ evidence: z.ZodObject<{ /** * Definition information - where the element is defined */ definition: z.ZodObject<{ /** * File where the element is defined */ file: z.ZodString; /** * Line number where the element is defined */ line: z.ZodNumber; /** * Code snippet showing the definition */ codeSnippet: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; codeSnippet: string; line: number; }, { file: string; codeSnippet: string; line: number; }>; /** * Export information - how/where the element is exported (if applicable) */ exports: z.ZodOptional<z.ZodArray<z.ZodObject<{ /** * File where the element is exported */ file: z.ZodString; /** * Line number where the element is exported */ line: z.ZodNumber; /** * Export type (default, named, re-export, etc.) */ exportType: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; line: number; exportType: string; }, { file: string; line: number; exportType: string; }>, "many">>; /** * Import search - evidence of searching for imports of this element */ importSearch: z.ZodObject<{ /** * Areas searched for imports */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no imports were found */ noImportsFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }>; /** * Reference search - evidence of searching for references to this element */ referenceSearch: z.ZodObject<{ /** * Areas searched for references */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no references were found */ noReferencesFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }>; /** * Edge cases considered */ edgeCasesConsidered: z.ZodArray<z.ZodObject<{ /** * Edge case description */ case: z.ZodString; /** * How this edge case was verified */ verification: z.ZodString; }, "strip", z.ZodTypeAny, { case: string; verification: string; }, { case: string; verification: string; }>, "many">; /** * Additional evidence */ additionalEvidence: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }>; /** * Potential risks of removing this element */ removalRisks: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }>, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }>, "many">; /** * Unused functions */ unusedFunctions: z.ZodArray<z.ZodEffects<z.ZodObject<{ /** * Type of the unused element */ elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>; /** * Name of the element */ name: z.ZodString; /** * File where the element is located */ filePath: z.ZodString; /** * Line numbers where the element is defined */ location: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { startLine: number; endLine?: number | undefined; }, { startLine: number; endLine?: number | undefined; }>; /** * Code snippet showing the unused element */ codeSnippet: z.ZodString; /** * Confidence level that this element is truly unused */ confidence: z.ZodEnum<["high", "medium", "low"]>; /** * Explanation for the confidence assessment */ confidenceReason: z.ZodString; /** * Evidence of why this element is unused */ evidence: z.ZodObject<{ /** * Definition information - where the element is defined */ definition: z.ZodObject<{ /** * File where the element is defined */ file: z.ZodString; /** * Line number where the element is defined */ line: z.ZodNumber; /** * Code snippet showing the definition */ codeSnippet: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; codeSnippet: string; line: number; }, { file: string; codeSnippet: string; line: number; }>; /** * Export information - how/where the element is exported (if applicable) */ exports: z.ZodOptional<z.ZodArray<z.ZodObject<{ /** * File where the element is exported */ file: z.ZodString; /** * Line number where the element is exported */ line: z.ZodNumber; /** * Export type (default, named, re-export, etc.) */ exportType: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; line: number; exportType: string; }, { file: string; line: number; exportType: string; }>, "many">>; /** * Import search - evidence of searching for imports of this element */ importSearch: z.ZodObject<{ /** * Areas searched for imports */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no imports were found */ noImportsFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }>; /** * Reference search - evidence of searching for references to this element */ referenceSearch: z.ZodObject<{ /** * Areas searched for references */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no references were found */ noReferencesFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }>; /** * Edge cases considered */ edgeCasesConsidered: z.ZodArray<z.ZodObject<{ /** * Edge case description */ case: z.ZodString; /** * How this edge case was verified */ verification: z.ZodString; }, "strip", z.ZodTypeAny, { case: string; verification: string; }, { case: string; verification: string; }>, "many">; /** * Additional evidence */ additionalEvidence: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }>; /** * Potential risks of removing this element */ removalRisks: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }>, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }>, "many">; /** * Unused classes */ unusedClasses: z.ZodArray<z.ZodEffects<z.ZodObject<{ /** * Type of the unused element */ elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>; /** * Name of the element */ name: z.ZodString; /** * File where the element is located */ filePath: z.ZodString; /** * Line numbers where the element is defined */ location: z.ZodObject<{ startLine: z.ZodNumber; endLine: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { startLine: number; endLine?: number | undefined; }, { startLine: number; endLine?: number | undefined; }>; /** * Code snippet showing the unused element */ codeSnippet: z.ZodString; /** * Confidence level that this element is truly unused */ confidence: z.ZodEnum<["high", "medium", "low"]>; /** * Explanation for the confidence assessment */ confidenceReason: z.ZodString; /** * Evidence of why this element is unused */ evidence: z.ZodObject<{ /** * Definition information - where the element is defined */ definition: z.ZodObject<{ /** * File where the element is defined */ file: z.ZodString; /** * Line number where the element is defined */ line: z.ZodNumber; /** * Code snippet showing the definition */ codeSnippet: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; codeSnippet: string; line: number; }, { file: string; codeSnippet: string; line: number; }>; /** * Export information - how/where the element is exported (if applicable) */ exports: z.ZodOptional<z.ZodArray<z.ZodObject<{ /** * File where the element is exported */ file: z.ZodString; /** * Line number where the element is exported */ line: z.ZodNumber; /** * Export type (default, named, re-export, etc.) */ exportType: z.ZodString; }, "strip", z.ZodTypeAny, { file: string; line: number; exportType: string; }, { file: string; line: number; exportType: string; }>, "many">>; /** * Import search - evidence of searching for imports of this element */ importSearch: z.ZodObject<{ /** * Areas searched for imports */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no imports were found */ noImportsFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }, { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }>; /** * Reference search - evidence of searching for references to this element */ referenceSearch: z.ZodObject<{ /** * Areas searched for references */ searchedIn: z.ZodArray<z.ZodString, "many">; /** * Verification that no references were found */ noReferencesFound: z.ZodBoolean; /** * Search method used */ searchMethod: z.ZodString; }, "strip", z.ZodTypeAny, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }, { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }>; /** * Edge cases considered */ edgeCasesConsidered: z.ZodArray<z.ZodObject<{ /** * Edge case description */ case: z.ZodString; /** * How this edge case was verified */ verification: z.ZodString; }, "strip", z.ZodTypeAny, { case: string; verification: string; }, { case: string; verification: string; }>, "many">; /** * Additional evidence */ additionalEvidence: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }, { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }>; /** * Potential risks of removing this element */ removalRisks: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: { searchedIn: string[]; noImportsFound: boolean; searchMethod: string; }; referenceSearch: { searchedIn: string[]; searchMethod: string; noReferencesFound: boolean; }; edgeCasesConsidered: { case: string; verification: string; }[]; exports?: { file: string; line: number; exportType: string; }[] | undefined; additionalEvidence?: string | undefined; }; removalRisks?: string | undefined; }>, { name: string; location: { startLine: number; endLine?: number | undefined; }; filePath: string; confidence: "high" | "medium" | "low"; codeSnippet: string; elementType: "function" | "type" | "property" | "file" | "class" | "interface" | "variable" | "import" | "dead-branch" | "parameter" | "enum" | "export" | "hook" | "component"; confidenceReason: string; evidence: { definition: { file: string; codeSnippet: string; line: number; }; importSearch: {