Use parameter properties for constructor parameters in config.ts (#245)
This commit is contained in:
parent
b809953890
commit
b9da7290e1
|
@ -24,36 +24,19 @@ import { BaseTool, ToolResult } from '../tools/tools.js';
|
||||||
const DEFAULT_PASSTHROUGH_COMMANDS = ['ls', 'git', 'npm'];
|
const DEFAULT_PASSTHROUGH_COMMANDS = ['ls', 'git', 'npm'];
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
private apiKey: string;
|
|
||||||
private model: string;
|
|
||||||
private sandbox: boolean | string;
|
|
||||||
private targetDir: string;
|
|
||||||
private toolRegistry: ToolRegistry;
|
private toolRegistry: ToolRegistry;
|
||||||
private debugMode: boolean;
|
|
||||||
private question: string | undefined;
|
|
||||||
private passthroughCommands: string[];
|
|
||||||
private fullContext: boolean;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
apiKey: string,
|
private readonly apiKey: string,
|
||||||
model: string,
|
private readonly model: string,
|
||||||
sandbox: boolean | string,
|
private readonly sandbox: boolean | string,
|
||||||
targetDir: string,
|
private readonly targetDir: string,
|
||||||
debugMode: boolean,
|
private readonly debugMode: boolean,
|
||||||
question: string,
|
private readonly question: string | undefined, // Keep undefined possibility
|
||||||
passthroughCommands?: string[],
|
private readonly passthroughCommands: string[] = DEFAULT_PASSTHROUGH_COMMANDS, // Default value here
|
||||||
fullContext?: boolean,
|
private readonly fullContext: boolean = false, // Default value here
|
||||||
) {
|
) {
|
||||||
this.apiKey = apiKey;
|
// toolRegistry still needs initialization based on the instance
|
||||||
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;
|
|
||||||
|
|
||||||
this.toolRegistry = createToolRegistry(this);
|
this.toolRegistry = createToolRegistry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +72,6 @@ export class Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
getFullContext(): boolean {
|
getFullContext(): boolean {
|
||||||
// Added getter for fullContext
|
|
||||||
return this.fullContext;
|
return this.fullContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue