refactor(setting): Improve settings migration and tool loading (#7445)

Co-authored-by: psinha40898 <pyushsinha20@gmail.com>
This commit is contained in:
Gal Zahavi
2025-09-03 19:23:25 -07:00
committed by GitHub
parent e7a4142b2a
commit 3885f7b6ae
7 changed files with 552 additions and 311 deletions
+17
View File
@@ -13,6 +13,17 @@ import type {
} from '@google/gemini-cli-core';
import type { CustomTheme } from '../ui/themes/theme.js';
export enum MergeStrategy {
// Replace the old value with the new value. This is the default.
REPLACE = 'replace',
// Concatenate arrays.
CONCAT = 'concat',
// Merge arrays, ensuring unique values.
UNION = 'union',
// Shallow merge objects.
SHALLOW_MERGE = 'shallow_merge',
}
export interface SettingDefinition {
type: 'boolean' | 'string' | 'number' | 'array' | 'object';
label: string;
@@ -25,6 +36,7 @@ export interface SettingDefinition {
key?: string;
properties?: SettingsSchema;
showInDialog?: boolean;
mergeStrategy?: MergeStrategy;
}
export interface SettingsSchema {
@@ -49,6 +61,7 @@ export const SETTINGS_SCHEMA = {
default: {} as Record<string, MCPServerConfig>,
description: 'Configuration for MCP servers.',
showInDialog: false,
mergeStrategy: MergeStrategy.SHALLOW_MERGE,
},
general: {
@@ -485,6 +498,7 @@ export const SETTINGS_SCHEMA = {
description:
'Additional directories to include in the workspace context. Missing directories will be skipped with a warning.',
showInDialog: false,
mergeStrategy: MergeStrategy.CONCAT,
},
loadMemoryFromIncludeDirectories: {
type: 'boolean',
@@ -796,6 +810,7 @@ export const SETTINGS_SCHEMA = {
default: ['DEBUG', 'DEBUG_MODE'] as string[],
description: 'Environment variables to exclude from project context.',
showInDialog: false,
mergeStrategy: MergeStrategy.UNION,
},
bugCommand: {
type: 'object',
@@ -847,6 +862,7 @@ export const SETTINGS_SCHEMA = {
default: [] as string[],
description: 'List of disabled extensions.',
showInDialog: false,
mergeStrategy: MergeStrategy.UNION,
},
workspacesWithMigrationNudge: {
type: 'array',
@@ -857,6 +873,7 @@ export const SETTINGS_SCHEMA = {
description:
'List of workspaces for which the migration nudge has been shown.',
showInDialog: false,
mergeStrategy: MergeStrategy.UNION,
},
},
},