feat: add auto-load CLAUDE.md functionality

- Introduced a new setting to enable automatic loading of CLAUDE.md files from project-specific directories.
- Updated relevant services and components to support the new setting, including the AgentService and AutoModeService.
- Added UI controls for managing the auto-load setting in the settings view.
- Enhanced SDK options to incorporate settingSources for CLAUDE.md loading.
- Updated global and project settings interfaces to include autoLoadClaudeMd property.
This commit is contained in:
Kacper
2025-12-24 22:05:50 +01:00
parent 8a0226512d
commit 07bcb6b767
12 changed files with 306 additions and 15 deletions

View File

@@ -478,6 +478,9 @@ export interface AppState {
// Validation Model Settings
validationModel: AgentModel; // Model used for GitHub issue validation (default: opus)
// Claude Agent SDK Settings
autoLoadClaudeMd: boolean; // Auto-load CLAUDE.md files using SDK's settingSources option
// Project Analysis
projectAnalysis: ProjectAnalysis | null;
isAnalyzing: boolean;
@@ -751,6 +754,9 @@ export interface AppActions {
// Validation Model actions
setValidationModel: (model: AgentModel) => void;
// Claude Agent SDK Settings actions
setAutoLoadClaudeMd: (enabled: boolean) => Promise<void>;
// AI Profile actions
addAIProfile: (profile: Omit<AIProfile, 'id'>) => void;
updateAIProfile: (id: string, updates: Partial<AIProfile>) => void;
@@ -922,6 +928,7 @@ const initialState: AppState = {
muteDoneSound: false, // Default to sound enabled (not muted)
enhancementModel: 'sonnet', // Default to sonnet for feature enhancement
validationModel: 'opus', // Default to opus for GitHub issue validation
autoLoadClaudeMd: false, // Default to disabled (user must opt-in)
aiProfiles: DEFAULT_AI_PROFILES,
projectAnalysis: null,
isAnalyzing: false,
@@ -1547,6 +1554,14 @@ export const useAppStore = create<AppState & AppActions>()(
// Validation Model actions
setValidationModel: (model) => set({ validationModel: model }),
// Claude Agent SDK Settings actions
setAutoLoadClaudeMd: async (enabled) => {
set({ autoLoadClaudeMd: enabled });
// Sync to server settings file
const { syncSettingsToServer } = await import('@/hooks/use-settings-migration');
await syncSettingsToServer();
},
// AI Profile actions
addAIProfile: (profile) => {
const id = `profile-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
@@ -2690,6 +2705,7 @@ export const useAppStore = create<AppState & AppActions>()(
muteDoneSound: state.muteDoneSound,
enhancementModel: state.enhancementModel,
validationModel: state.validationModel,
autoLoadClaudeMd: state.autoLoadClaudeMd,
// Profiles and sessions
aiProfiles: state.aiProfiles,
chatSessions: state.chatSessions,