@bobmatnyc/ai-code-review
Version:
A TypeScript-based tool for automated code reviews using AI models from Google Gemini, Anthropic Claude, and OpenRouter
84 lines (83 loc) • 2.56 kB
TypeScript
/**
* @fileoverview Configuration file manager for JSON config files.
*
* This module provides functions for loading, parsing, and generating
* JSON configuration files for the AI code review tool.
*/
import { ReviewOptions } from '../types/review';
/**
* Interface for the JSON configuration file structure
*/
export interface JsonConfig {
output?: {
format?: string;
dir?: string;
};
review?: {
type?: string;
interactive?: boolean;
include_tests?: boolean;
include_project_docs?: boolean;
include_dependency_analysis?: boolean;
consolidated?: boolean;
trace_code?: boolean;
use_ts_prune?: boolean;
use_eslint?: boolean;
auto_fix?: boolean;
prompt_all?: boolean;
confirm?: boolean;
};
api?: {
model?: string;
writer_model?: string;
keys?: {
google?: string;
openrouter?: string;
anthropic?: string;
openai?: string;
};
test_api?: boolean;
};
prompts?: {
prompt_file?: string;
prompt_fragment?: string;
prompt_fragment_position?: 'start' | 'middle' | 'end';
prompt_strategy?: string;
use_cache?: boolean;
};
system?: {
debug?: boolean;
log_level?: string;
};
}
/**
* Load a JSON configuration file
* @param configFilePath Path to the configuration file
* @returns The parsed configuration or null if the file doesn't exist
*/
export declare function loadConfigFile(configFilePath?: string): JsonConfig | null;
/**
* Apply JSON configuration to review options
* @param config The JSON configuration
* @param options The review options to modify
* @returns The modified review options
*/
export declare function applyConfigToOptions(config: JsonConfig, options: ReviewOptions): ReviewOptions;
/**
* Generate a sample configuration file
* @returns A JSON string containing the sample configuration
*/
export declare function generateSampleConfig(): string;
/**
* Save a sample configuration file
* @param outputPath Path to save the configuration file
* @returns True if the file was saved successfully, false otherwise
*/
export declare function saveSampleConfig(outputPath: string): boolean;
declare const _default: {
loadConfigFile: typeof loadConfigFile;
applyConfigToOptions: typeof applyConfigToOptions;
generateSampleConfig: typeof generateSampleConfig;
saveSampleConfig: typeof saveSampleConfig;
};
export default _default;