MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / saveSettings

Function saveSettings

cli/src/utils/settings.ts:127–146  ·  view source on GitHub ↗
(newSettings: Partial<Settings>)

Source from the content-addressed store, hash-verified

125 * Save settings to file system (merges with existing settings)
126 */
127export const saveSettings = (newSettings: Partial<Settings>): void => {
128 const settingsPath = getSettingsPath()
129
130 try {
131 ensureConfigDirExists()
132
133 // Load existing settings and merge
134 const existingSettings = loadSettings()
135 const mergedSettings = { ...existingSettings, ...newSettings }
136
137 fs.writeFileSync(settingsPath, JSON.stringify(mergedSettings, null, 2))
138 } catch (error) {
139 logger.debug(
140 {
141 error: error instanceof Error ? error.message : String(error),
142 },
143 'Error saving settings',
144 )
145 }
146}
147
148/**
149 * Load the saved agent mode preference

Callers 4

handleAdsEnableFunction · 0.90
handleAdsDisableFunction · 0.90
saveModePreferenceFunction · 0.85

Calls 3

getSettingsPathFunction · 0.85
ensureConfigDirExistsFunction · 0.85
loadSettingsFunction · 0.85

Tested by

no test coverage detected