Use parameter properties for constructor parameters in config.ts (#245)

This commit is contained in:
Jacob Richman 2025-05-02 11:28:30 -07:00 committed by GitHub
parent b809953890
commit b9da7290e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 27 deletions

View File

@ -24,36 +24,19 @@ import { BaseTool, ToolResult } from '../tools/tools.js';
const DEFAULT_PASSTHROUGH_COMMANDS = ['ls', 'git', 'npm'];
export class Config {
private apiKey: string;
private model: string;
private sandbox: boolean | string;
private targetDir: string;
private toolRegistry: ToolRegistry;
private debugMode: boolean;
private question: string | undefined;
private passthroughCommands: string[];
private fullContext: boolean;
constructor(
apiKey: string,
model: string,
sandbox: boolean | string,
targetDir: string,
debugMode: boolean,
question: string,
passthroughCommands?: string[],
fullContext?: boolean,
private readonly apiKey: string,
private readonly model: string,
private readonly sandbox: boolean | string,
private readonly targetDir: string,
private readonly debugMode: boolean,
private readonly question: string | undefined, // Keep undefined possibility
private readonly passthroughCommands: string[] = DEFAULT_PASSTHROUGH_COMMANDS, // Default value here
private readonly fullContext: boolean = false, // Default value here
) {
this.apiKey = apiKey;
this.model = model;
this.sandbox = sandbox;
this.targetDir = targetDir;
this.debugMode = debugMode;
this.question = question;
this.passthroughCommands =
passthroughCommands || DEFAULT_PASSTHROUGH_COMMANDS;
this.fullContext = fullContext || false;
// toolRegistry still needs initialization based on the instance
this.toolRegistry = createToolRegistry(this);
}
@ -89,7 +72,6 @@ export class Config {
}
getFullContext(): boolean {
// Added getter for fullContext
return this.fullContext;
}
}