summaryrefslogtreecommitdiff
path: root/packages/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/config/config.ts19
1 files changed, 18 insertions, 1 deletions
diff --git a/packages/server/src/config/config.ts b/packages/server/src/config/config.ts
index bd698cf6..fad219b5 100644
--- a/packages/server/src/config/config.ts
+++ b/packages/server/src/config/config.ts
@@ -9,22 +9,28 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import process from 'node:process';
+const DEFAULT_PASSTHROUGH_COMMANDS = ['ls', 'git', 'npm'];
+
export class Config {
private apiKey: string;
private model: string;
private targetDir: string;
private debugMode: boolean;
+ private passthroughCommands: string[];
constructor(
apiKey: string,
model: string,
targetDir: string,
debugMode: boolean,
+ passthroughCommands?: string[],
) {
this.apiKey = apiKey;
this.model = model;
this.targetDir = targetDir;
this.debugMode = debugMode;
+ this.passthroughCommands =
+ passthroughCommands || DEFAULT_PASSTHROUGH_COMMANDS;
}
getApiKey(): string {
@@ -42,6 +48,10 @@ export class Config {
getDebugMode(): boolean {
return this.debugMode;
}
+
+ getPassthroughCommands(): string[] {
+ return this.passthroughCommands;
+ }
}
function findEnvFile(startDir: string): string | null {
@@ -72,6 +82,13 @@ export function createServerConfig(
model: string,
targetDir: string,
debugMode: boolean,
+ passthroughCommands?: string[],
): Config {
- return new Config(apiKey, model, path.resolve(targetDir), debugMode);
+ return new Config(
+ apiKey,
+ model,
+ path.resolve(targetDir),
+ debugMode,
+ passthroughCommands,
+ );
}