diff --git a/src/services/autoFix/autoFixConfig.test.ts b/src/services/autoFix/autoFixConfig.test.ts index dd700048..465240fa 100644 --- a/src/services/autoFix/autoFixConfig.test.ts +++ b/src/services/autoFix/autoFixConfig.test.ts @@ -75,3 +75,32 @@ describe('getAutoFixConfig', () => { expect(result!.lint).toBe('eslint .') }) }) + +describe('SettingsSchema autoFix integration', () => { + test('SettingsSchema accepts autoFix field', async () => { + const { SettingsSchema } = await import('../../utils/settings/types.js') + const settings = { + autoFix: { + enabled: true, + lint: 'eslint .', + test: 'bun test', + maxRetries: 3, + timeout: 30000, + }, + } + const result = SettingsSchema().safeParse(settings) + expect(result.success).toBe(true) + }) + + test('SettingsSchema rejects invalid autoFix', async () => { + const { SettingsSchema } = await import('../../utils/settings/types.js') + const settings = { + autoFix: { + enabled: true, + // missing lint and test - should fail refine + }, + } + const result = SettingsSchema().safeParse(settings) + expect(result.success).toBe(false) + }) +}) diff --git a/src/utils/settings/types.ts b/src/utils/settings/types.ts index 65e0d906..dc2ed93e 100644 --- a/src/utils/settings/types.ts +++ b/src/utils/settings/types.ts @@ -27,6 +27,7 @@ export { // Also import for use within this file import { type HookCommand, HooksSchema } from '../../schemas/hooks.js' +import { AutoFixConfigSchema } from '../../services/autoFix/autoFixConfig.js' import { count } from '../array.js' /** @@ -435,6 +436,12 @@ export const SettingsSchema = lazySchema(() => hooks: HooksSchema() .optional() .describe('Custom commands to run before/after tool executions'), + autoFix: AutoFixConfigSchema + .optional() + .describe( + 'Auto-fix configuration: automatically run lint/test after AI file edits ' + + 'and feed errors back for self-repair.', + ), worktree: z .object({ symlinkDirectories: z