Refactor to defer initialization. (#8925)

This commit is contained in:
Jacob Richman
2025-09-22 19:48:25 -07:00
committed by GitHub
parent 40db029887
commit 7e1705274c
5 changed files with 572 additions and 106 deletions

View File

@@ -396,6 +396,15 @@ export async function loadHierarchicalGeminiMemory(
);
}
export function isDebugMode(argv: CliArgs): boolean {
return (
argv.debug ||
[process.env['DEBUG'], process.env['DEBUG_MODE']].some(
(v) => v === 'true' || v === '1',
)
);
}
export async function loadCliConfig(
settings: Settings,
extensions: Extension[],
@@ -403,12 +412,8 @@ export async function loadCliConfig(
argv: CliArgs,
cwd: string = process.cwd(),
): Promise<Config> {
const debugMode =
argv.debug ||
[process.env['DEBUG'], process.env['DEBUG_MODE']].some(
(v) => v === 'true' || v === '1',
) ||
false;
const debugMode = isDebugMode(argv);
const memoryImportFormat = settings.context?.importFormat || 'tree';
const ideMode = settings.ide?.enabled ?? false;