MCPcopy Index your code
hub / github.com/codeaashu/claude-code / doDownloadUserSettings

Function doDownloadUserSettings

src/services/settingsSync/index.ts:157–202  ·  view source on GitHub ↗
(
  maxRetries = DEFAULT_MAX_RETRIES,
)

Source from the content-addressed store, hash-verified

155}
156
157async function doDownloadUserSettings(
158 maxRetries = DEFAULT_MAX_RETRIES,
159): Promise<boolean> {
160 if (feature('DOWNLOAD_USER_SETTINGS')) {
161 try {
162 if (
163 !getFeatureValue_CACHED_MAY_BE_STALE('tengu_strap_foyer', false) ||
164 !isUsingOAuth()
165 ) {
166 logForDiagnosticsNoPII('info', 'settings_sync_download_skipped')
167 logEvent('tengu_settings_sync_download_skipped', {})
168 return false
169 }
170
171 logForDiagnosticsNoPII('info', 'settings_sync_download_starting')
172 const result = await fetchUserSettings(maxRetries)
173 if (!result.success) {
174 logForDiagnosticsNoPII('warn', 'settings_sync_download_fetch_failed')
175 logEvent('tengu_settings_sync_download_fetch_failed', {})
176 return false
177 }
178
179 if (result.isEmpty) {
180 logForDiagnosticsNoPII('info', 'settings_sync_download_empty')
181 logEvent('tengu_settings_sync_download_empty', {})
182 return false
183 }
184
185 const entries = result.data!.content.entries
186 const projectId = await getRepoRemoteHash()
187 const entryCount = Object.keys(entries).length
188 logForDiagnosticsNoPII('info', 'settings_sync_download_applying', {
189 entryCount,
190 })
191 await applyRemoteEntriesToLocal(entries, projectId)
192 logEvent('tengu_settings_sync_download_success', { entryCount })
193 return true
194 } catch {
195 // Fail-open: log error but don't block CCR startup
196 logForDiagnosticsNoPII('error', 'settings_sync_download_error')
197 logEvent('tengu_settings_sync_download_error', {})
198 return false
199 }
200 }
201 return false
202}
203
204/**
205 * Check if user is authenticated with first-party OAuth.

Callers 2

downloadUserSettingsFunction · 0.85
redownloadUserSettingsFunction · 0.85

Calls 9

featureFunction · 0.85
logForDiagnosticsNoPIIFunction · 0.85
logEventFunction · 0.85
fetchUserSettingsFunction · 0.85
getRepoRemoteHashFunction · 0.85
keysMethod · 0.80
isUsingOAuthFunction · 0.70

Tested by

no test coverage detected