Compare commits

..

1 Commits

Author SHA1 Message Date
Sehoon Shon 953fb70be1 Emitfeedback when users don't have access to the write path of the settings 2026-02-02 14:25:31 -05:00
2 changed files with 24 additions and 9 deletions
+24 -8
View File
@@ -339,8 +339,13 @@ export class LoadedSettings {
setValue(scope: LoadableSettingScope, key: string, value: unknown): void {
coreEvents.emitFeedback(
'info',
'saving: ' + key + ', ' + value + ', scope: ' + scope,
'warning',
'scope: ' +
scope +
', key: ' +
key +
', value: ' +
JSON.stringify(value, null, 2),
);
const settingsFile = this.forScope(scope);
setNestedProperty(settingsFile.settings, key, value);
@@ -679,7 +684,23 @@ export function migrateDeprecatedSettings(
): boolean {
let anyModified = false;
const processScope = (scope: LoadableSettingScope) => {
const settings = loadedSettings.forScope(scope).settings;
const settingsFile = loadedSettings.forScope(scope);
// If we don't have write access to the specific settings file, show the reason
// instead of showing every failure.
try {
if (fs.existsSync(settingsFile.path)) {
fs.accessSync(settingsFile.path, fs.constants.W_OK);
}
} catch (_e) {
coreEvents.emitFeedback(
'warning',
'You do not have permission to update: ' + settingsFile.path,
);
// return;
}
const settings = settingsFile.settings;
// Migrate inverted boolean settings (disableX -> enableX)
// These settings were renamed and their boolean logic inverted
@@ -731,10 +752,6 @@ export function migrateDeprecatedSettings(
}
if (modified) {
coreEvents.emitFeedback(
'info',
'setting new general for scope:' + scope,
);
loadedSettings.setValue(scope, 'general', newGeneral);
anyModified = true;
}
@@ -855,7 +872,6 @@ export function saveSettings(settingsFile: SettingsFile): void {
settingsToSave as Record<string, unknown>,
);
} catch (error) {
coreEvents.emitFeedback('error', 'here' + error, error);
coreEvents.emitFeedback(
'error',
'There was an error saving your latest settings changes.',
-1
View File
@@ -371,7 +371,6 @@ export async function main() {
process.env['CLOUD_SHELL'] === 'true' ||
process.env['GEMINI_CLI_USE_COMPUTE_ADC'] === 'true'
) {
coreEvents.emitFeedback('info', 'saving compute_adc');
settings.setValue(
SettingScope.User,
'security.auth.selectedType',