@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
1,321 lines • 82.3 kB
TypeScript
/**
* @fileoverview Utility functions for working with LangChain.
*
* This module provides utility functions for creating and using LangChain
* elements like prompt templates, chains, and prompt optimization.
*/
import { PromptTemplate, FewShotPromptTemplate } from '@langchain/core/prompts';
import { StructuredOutputParser } from '@langchain/core/output_parsers';
import { ReviewType, ReviewOptions } from '../../types/review';
import { z } from 'zod';
/**
* Class for LangChain utilities
*/
export declare class LangChainUtils {
/**
* Create a basic prompt template
* @param template Template string
* @param inputVariables Input variables in the template
* @returns LangChain prompt template
*/
static createPromptTemplate(template: string, inputVariables: string[]): PromptTemplate;
/**
* Create a few-shot prompt template
* @param prefix The prefix for the prompt
* @param examples Array of example objects
* @param examplePrompt Template for formatting examples
* @param suffix The suffix for the prompt
* @param inputVariables Variables for the overall template
* @returns Few-shot prompt template
*/
static createFewShotTemplate(prefix: string, examples: Record<string, string>[], examplePrompt: PromptTemplate, suffix: string, inputVariables: string[]): FewShotPromptTemplate;
/**
* Create a structured output parser for review results
* @param reviewType Type of review
* @returns Structured output parser
*/
static createReviewOutputParser(reviewType: ReviewType): StructuredOutputParser<z.ZodObject<{
issues: z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
line: z.ZodOptional<z.ZodNumber>;
suggestion: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}>, "many">;
summary: z.ZodString;
}, "strip", z.ZodTypeAny, {
issues: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}[];
summary: string;
}, {
issues: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}[];
summary: string;
}> | z.ZodObject<{
vulnerabilities: z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
line: z.ZodOptional<z.ZodNumber>;
cwe: z.ZodOptional<z.ZodString>;
remediation: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
line?: number | undefined;
cwe?: string | undefined;
}, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
line?: number | undefined;
cwe?: string | undefined;
}>, "many">;
summary: z.ZodString;
}, "strip", z.ZodTypeAny, {
summary: string;
vulnerabilities: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
line?: number | undefined;
cwe?: string | undefined;
}[];
}, {
summary: string;
vulnerabilities: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
line?: number | undefined;
cwe?: string | undefined;
}[];
}> | z.ZodObject<{
issues: z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
impact: z.ZodEnum<["high", "medium", "low"]>;
line: z.ZodOptional<z.ZodNumber>;
suggestion: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
line?: number | undefined;
}, {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
line?: number | undefined;
}>, "many">;
summary: z.ZodString;
}, "strip", z.ZodTypeAny, {
issues: {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
line?: number | undefined;
}[];
summary: string;
}, {
issues: {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
line?: number | undefined;
}[];
summary: string;
}> | z.ZodObject<{
findings: z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
category: z.ZodEnum<["design", "structure", "patterns", "coupling", "other"]>;
suggestion: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
category: "other" | "patterns" | "design" | "structure" | "coupling";
suggestion: string;
}, {
description: string;
title: string;
category: "other" | "patterns" | "design" | "structure" | "coupling";
suggestion: string;
}>, "many">;
summary: z.ZodString;
}, "strip", z.ZodTypeAny, {
summary: string;
findings: {
description: string;
title: string;
category: "other" | "patterns" | "design" | "structure" | "coupling";
suggestion: string;
}[];
}, {
summary: string;
findings: {
description: string;
title: string;
category: "other" | "patterns" | "design" | "structure" | "coupling";
suggestion: string;
}[];
}> | z.ZodObject<{
quickFixes: z.ZodOptional<z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
line: z.ZodOptional<z.ZodNumber>;
suggestion: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}>, "many">>;
security: z.ZodOptional<z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
severity: z.ZodEnum<["critical", "high", "medium", "low"]>;
cwe: z.ZodOptional<z.ZodString>;
remediation: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
cwe?: string | undefined;
}, {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
cwe?: string | undefined;
}>, "many">>;
performance: z.ZodOptional<z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
impact: z.ZodEnum<["high", "medium", "low"]>;
suggestion: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
}, {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
}>, "many">>;
architecture: z.ZodOptional<z.ZodArray<z.ZodObject<{
title: z.ZodString;
description: z.ZodString;
category: z.ZodString;
suggestion: z.ZodString;
}, "strip", z.ZodTypeAny, {
description: string;
title: string;
category: string;
suggestion: string;
}, {
description: string;
title: string;
category: string;
suggestion: string;
}>, "many">>;
summary: z.ZodString;
}, "strip", z.ZodTypeAny, {
summary: string;
security?: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
cwe?: string | undefined;
}[] | undefined;
performance?: {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
}[] | undefined;
architecture?: {
description: string;
title: string;
category: string;
suggestion: string;
}[] | undefined;
quickFixes?: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}[] | undefined;
}, {
summary: string;
security?: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
remediation: string;
cwe?: string | undefined;
}[] | undefined;
performance?: {
description: string;
title: string;
impact: "high" | "medium" | "low";
suggestion: string;
}[] | undefined;
architecture?: {
description: string;
title: string;
category: string;
suggestion: string;
}[] | undefined;
quickFixes?: {
description: string;
title: string;
severity: "high" | "medium" | "low" | "critical";
suggestion: string;
line?: number | undefined;
}[] | undefined;
}> | z.ZodObject<{
unusedFiles: z.ZodArray<z.ZodObject<{
elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>;
name: z.ZodString;
filePath: z.ZodString;
location: z.ZodObject<{
startLine: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
startLine: number;
endLine?: number | undefined;
}, {
startLine: number;
endLine?: number | undefined;
}>;
codeSnippet: z.ZodString;
confidence: z.ZodEnum<["high", "medium", "low"]>;
confidenceReason: z.ZodString;
evidence: z.ZodObject<{
definition: z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
codeSnippet: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
codeSnippet: string;
line: number;
}, {
file: string;
codeSnippet: string;
line: number;
}>;
exports: z.ZodOptional<z.ZodArray<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
exportType: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
line: number;
exportType: string;
}, {
file: string;
line: number;
exportType: string;
}>, "many">>;
importSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noImportsFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}>;
referenceSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noReferencesFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}>;
edgeCasesConsidered: z.ZodArray<z.ZodObject<{
case: z.ZodString;
verification: z.ZodString;
}, "strip", z.ZodTypeAny, {
case: string;
verification: string;
}, {
case: string;
verification: string;
}>, "many">;
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;
}>;
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;
}>, "many">;
unusedFunctions: z.ZodArray<z.ZodObject<{
elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>;
name: z.ZodString;
filePath: z.ZodString;
location: z.ZodObject<{
startLine: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
startLine: number;
endLine?: number | undefined;
}, {
startLine: number;
endLine?: number | undefined;
}>;
codeSnippet: z.ZodString;
confidence: z.ZodEnum<["high", "medium", "low"]>;
confidenceReason: z.ZodString;
evidence: z.ZodObject<{
definition: z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
codeSnippet: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
codeSnippet: string;
line: number;
}, {
file: string;
codeSnippet: string;
line: number;
}>;
exports: z.ZodOptional<z.ZodArray<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
exportType: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
line: number;
exportType: string;
}, {
file: string;
line: number;
exportType: string;
}>, "many">>;
importSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noImportsFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}>;
referenceSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noReferencesFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}>;
edgeCasesConsidered: z.ZodArray<z.ZodObject<{
case: z.ZodString;
verification: z.ZodString;
}, "strip", z.ZodTypeAny, {
case: string;
verification: string;
}, {
case: string;
verification: string;
}>, "many">;
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;
}>;
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;
}>, "many">;
unusedClasses: z.ZodArray<z.ZodObject<{
elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>;
name: z.ZodString;
filePath: z.ZodString;
location: z.ZodObject<{
startLine: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
startLine: number;
endLine?: number | undefined;
}, {
startLine: number;
endLine?: number | undefined;
}>;
codeSnippet: z.ZodString;
confidence: z.ZodEnum<["high", "medium", "low"]>;
confidenceReason: z.ZodString;
evidence: z.ZodObject<{
definition: z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
codeSnippet: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
codeSnippet: string;
line: number;
}, {
file: string;
codeSnippet: string;
line: number;
}>;
exports: z.ZodOptional<z.ZodArray<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
exportType: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
line: number;
exportType: string;
}, {
file: string;
line: number;
exportType: string;
}>, "many">>;
importSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noImportsFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}>;
referenceSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noReferencesFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}>;
edgeCasesConsidered: z.ZodArray<z.ZodObject<{
case: z.ZodString;
verification: z.ZodString;
}, "strip", z.ZodTypeAny, {
case: string;
verification: string;
}, {
case: string;
verification: string;
}>, "many">;
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;
}>;
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;
}>, "many">;
unusedTypesAndInterfaces: z.ZodArray<z.ZodObject<{
elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>;
name: z.ZodString;
filePath: z.ZodString;
location: z.ZodObject<{
startLine: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
startLine: number;
endLine?: number | undefined;
}, {
startLine: number;
endLine?: number | undefined;
}>;
codeSnippet: z.ZodString;
confidence: z.ZodEnum<["high", "medium", "low"]>;
confidenceReason: z.ZodString;
evidence: z.ZodObject<{
definition: z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
codeSnippet: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
codeSnippet: string;
line: number;
}, {
file: string;
codeSnippet: string;
line: number;
}>;
exports: z.ZodOptional<z.ZodArray<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
exportType: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
line: number;
exportType: string;
}, {
file: string;
line: number;
exportType: string;
}>, "many">>;
importSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noImportsFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}>;
referenceSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noReferencesFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}>;
edgeCasesConsidered: z.ZodArray<z.ZodObject<{
case: z.ZodString;
verification: z.ZodString;
}, "strip", z.ZodTypeAny, {
case: string;
verification: string;
}, {
case: string;
verification: string;
}>, "many">;
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;
}>;
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;
}>, "many">;
deadCodeBranches: z.ZodArray<z.ZodObject<{
elementType: z.ZodEnum<["file", "function", "class", "interface", "type", "variable", "import", "dead-branch", "parameter", "property", "enum", "export", "hook", "component"]>;
name: z.ZodString;
filePath: z.ZodString;
location: z.ZodObject<{
startLine: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
startLine: number;
endLine?: number | undefined;
}, {
startLine: number;
endLine?: number | undefined;
}>;
codeSnippet: z.ZodString;
confidence: z.ZodEnum<["high", "medium", "low"]>;
confidenceReason: z.ZodString;
evidence: z.ZodObject<{
definition: z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
codeSnippet: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
codeSnippet: string;
line: number;
}, {
file: string;
codeSnippet: string;
line: number;
}>;
exports: z.ZodOptional<z.ZodArray<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
exportType: z.ZodString;
}, "strip", z.ZodTypeAny, {
file: string;
line: number;
exportType: string;
}, {
file: string;
line: number;
exportType: string;
}>, "many">>;
importSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noImportsFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}, {
searchedIn: string[];
noImportsFound: boolean;
searchMethod: string;
}>;
referenceSearch: z.ZodObject<{
searchedIn: z.ZodArray<z.ZodString, "many">;
noReferencesFound: z.ZodBoolean;
searchMethod: z.ZodString;
}, "strip", z.ZodTypeAny, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}, {
searchedIn: string[];
searchMethod: string;
noReferencesFound: boolean;
}>;
edgeCasesConsidered: z.ZodArray<z.ZodObject<{
case: z.ZodString;
verification: z.ZodString;
}, "strip", z.ZodTypeAny, {
case: string;
verification: string;
}, {
case: string;
verification: string;
}>, "many">;
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;
}>;
removalRisks: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
name: string;
location: {
startLine: number;
endLine?: number | undefined;
};
filePath: string;
confidence: "high" | "medium" | "low";
codeSnippet: string