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

Function fetchBootstrapData

src/services/api/bootstrap.ts:114–141  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112 * Fetch bootstrap data from the API and persist to disk cache.
113 */
114export async function fetchBootstrapData(): Promise<void> {
115 try {
116 const response = await fetchBootstrapAPI()
117 if (!response) return
118
119 const clientData = response.client_data ?? null
120 const additionalModelOptions = response.additional_model_options ?? []
121
122 // Only persist if data actually changed — avoids a config write on every startup.
123 const config = getGlobalConfig()
124 if (
125 isEqual(config.clientDataCache, clientData) &&
126 isEqual(config.additionalModelOptionsCache, additionalModelOptions)
127 ) {
128 logForDebugging('[Bootstrap] Cache unchanged, skipping write')
129 return
130 }
131
132 logForDebugging('[Bootstrap] Cache updated, persisting to disk')
133 saveGlobalConfig(current => ({
134 ...current,
135 clientDataCache: clientData,
136 additionalModelOptionsCache: additionalModelOptions,
137 }))
138 } catch (error) {
139 logError(error)
140 }
141}
142

Callers 1

runFunction · 0.85

Calls 5

fetchBootstrapAPIFunction · 0.85
getGlobalConfigFunction · 0.85
logForDebuggingFunction · 0.85
saveGlobalConfigFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected