refactor: Restructure file search settings

This commit restructures the file search settings. The previously individual settings for file search method, regex search backend, match search backend, and ripgrep path have been grouped into a new filesSearchSettings object.
This commit is contained in:
travertexg
2025-06-10 06:54:25 +00:00
parent a00b640dad
commit f0be561cfc
10 changed files with 63 additions and 28 deletions

View File

@@ -12,9 +12,12 @@ describe('parseSmartCopilotSettings', () => {
infioApiKey: '',
openAIApiKey: '',
anthropicApiKey: '',
filesSearchMethod: 'auto',
regexSearchBackend: 'ripgrep',
matchSearchBackend: 'coreplugin',
filesSearchSettings: {
method: 'auto',
regexBackend: 'ripgrep',
matchBackend: 'coreplugin',
ripgrepPath: '',
},
fuzzyMatchThreshold: 0.85,
geminiApiKey: '',
groqApiKey: '',
@@ -100,7 +103,6 @@ describe('parseSmartCopilotSettings', () => {
defaultMention: 'none',
removeDuplicateMathBlockIndicator: true,
removeDuplicateCodeBlockIndicator: true,
ripgrepPath: '',
serperApiKey: '',
serperSearchEngine: 'google',
ignoredFilePatterns: '**/secret/**\n',
@@ -197,9 +199,12 @@ describe('settings migration', () => {
infioApiKey: '',
openAIApiKey: '',
anthropicApiKey: '',
filesSearchMethod: 'auto',
regexSearchBackend: 'ripgrep',
matchSearchBackend: 'coreplugin',
filesSearchSettings: {
method: 'auto',
regexBackend: 'ripgrep',
matchBackend: 'coreplugin',
ripgrepPath: '',
},
fuzzyMatchThreshold: 0.85,
geminiApiKey: '',
groqApiKey: '',
@@ -285,7 +290,6 @@ describe('settings migration', () => {
defaultMention: 'none',
removeDuplicateMathBlockIndicator: true,
removeDuplicateCodeBlockIndicator: true,
ripgrepPath: '',
serperApiKey: '',
serperSearchEngine: 'google',
ignoredFilePatterns: '**/secret/**\n',

View File

@@ -201,6 +201,18 @@ export const triggerSchema = z.object({
}
});
const FilesSearchSettingsSchema = z.object({
method: z.enum(['match', 'regex', 'semantic', 'auto']).catch('auto'),
regexBackend: z.enum(['coreplugin', 'ripgrep']).catch('ripgrep'),
matchBackend: z.enum(['omnisearch', 'coreplugin']).catch('coreplugin'),
ripgrepPath: z.string().catch(''),
}).catch({
method: 'auto',
regexBackend: 'ripgrep',
matchBackend: 'coreplugin',
ripgrepPath: '',
});
export const InfioSettingsSchema = z.object({
// Version
version: z.literal(SETTINGS_SCHEMA_VERSION).catch(SETTINGS_SCHEMA_VERSION),
@@ -260,10 +272,7 @@ export const InfioSettingsSchema = z.object({
jinaApiKey: z.string().catch(''),
// Files Search
filesSearchMethod: z.enum(['match', 'regex', 'semantic', 'auto']).catch('auto'),
regexSearchBackend: z.enum(['coreplugin', 'ripgrep']).catch('ripgrep'),
matchSearchBackend: z.enum(['omnisearch', 'coreplugin']).catch('coreplugin'),
ripgrepPath: z.string().catch(''),
filesSearchSettings: FilesSearchSettingsSchema,
/// [compatible]
// activeModels [compatible]
@@ -365,6 +374,7 @@ export const InfioSettingsSchema = z.object({
})
export type InfioSettings = z.infer<typeof InfioSettingsSchema>
export type FilesSearchSettings = z.infer<typeof FilesSearchSettingsSchema>
type Migration = {
fromVersion: number