MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / fetchBootstrapData

Function fetchBootstrapData

source code/services/api/bootstrap.ts:116–143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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