diff options
| author | Jacob MacDonald <[email protected]> | 2025-08-07 14:19:06 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-07 21:19:06 +0000 |
| commit | 19491b7b940912c2fb3fe24b2f189d3fd5668669 (patch) | |
| tree | 6112b96d342a87bea824caa405e5786715a0ab2f /packages/core/src/config/config.ts | |
| parent | 53f8617b249c9f0443f5082a293a30504a118030 (diff) | |
avoid loading and initializing CLI config twice in non-interactive mode (#5793)
Diffstat (limited to 'packages/core/src/config/config.ts')
| -rw-r--r-- | packages/core/src/config/config.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index db226c76..473ab5a6 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -197,6 +197,7 @@ export interface ConfigParameters { ideMode?: boolean; loadMemoryFromIncludeDirectories?: boolean; chatCompression?: ChatCompressionSettings; + interactive?: boolean; } export class Config { @@ -260,6 +261,8 @@ export class Config { private readonly experimentalAcp: boolean = false; private readonly loadMemoryFromIncludeDirectories: boolean = false; private readonly chatCompression: ChatCompressionSettings | undefined; + private readonly interactive: boolean; + private initialized: boolean = false; constructor(params: ConfigParameters) { this.sessionId = params.sessionId; @@ -326,6 +329,7 @@ export class Config { this.loadMemoryFromIncludeDirectories = params.loadMemoryFromIncludeDirectories ?? false; this.chatCompression = params.chatCompression; + this.interactive = params.interactive ?? false; if (params.contextFileName) { setGeminiMdFilename(params.contextFileName); @@ -344,7 +348,14 @@ export class Config { } } + /** + * Must only be called once, throws if called again. + */ async initialize(): Promise<void> { + if (this.initialized) { + throw Error('Config was already initialized'); + } + this.initialized = true; // Initialize centralized FileDiscoveryService this.getFileService(); if (this.getCheckpointingEnabled()) { @@ -685,6 +696,10 @@ export class Config { return this.chatCompression; } + isInteractive(): boolean { + return this.interactive; + } + async getGitService(): Promise<GitService> { if (!this.gitService) { this.gitService = new GitService(this.targetDir); |
