refactor: streamline auto-load CLAUDE.md setting retrieval

- Removed the private method for getting the autoLoadClaudeMd setting from AgentService and AutoModeService.
- Updated both services to utilize the new settings helper for retrieving the autoLoadClaudeMd setting, improving code reusability and clarity.
- Adjusted error handling in the settings helper to throw errors instead of returning false when the settings service is unavailable.
This commit is contained in:
Kacper
2025-12-24 22:48:02 +01:00
parent 3154121840
commit 99a19cb2a2
4 changed files with 19 additions and 79 deletions

View File

@@ -173,18 +173,6 @@ function buildClaudeMdOptions(config: CreateSdkOptionsConfig): {
result.systemPrompt.append = config.systemPrompt;
}
console.log(
'[SDK Options] CLAUDE.md auto-loading enabled:',
JSON.stringify(
{
systemPrompt: result.systemPrompt,
settingSources: result.settingSources,
},
null,
2
)
);
return result;
}

View File

@@ -15,7 +15,7 @@ import type { SettingsService } from '../services/settings-service.js';
*/
export async function getAutoLoadClaudeMdSetting(
projectPath: string,
settingsService?: SettingsService,
settingsService?: SettingsService | null,
logPrefix = '[SettingsHelper]'
): Promise<boolean> {
if (!settingsService) {
@@ -40,6 +40,6 @@ export async function getAutoLoadClaudeMdSetting(
return result;
} catch (error) {
console.error(`${logPrefix} Failed to load autoLoadClaudeMd setting:`, error);
return false;
throw error;
}
}