MCPcopy
hub / github.com/codeaashu/claude-code / fetchInstallCountsFromGitHub

Function fetchInstallCountsFromGitHub

src/utils/plugins/installCounts.ts:184–216  ·  view source on GitHub ↗

* Fetch install counts from GitHub stats repository

()

Source from the content-addressed store, hash-verified

182 * Fetch install counts from GitHub stats repository
183 */
184async function fetchInstallCountsFromGitHub(): Promise<
185 Array<{ plugin: string; unique_installs: number }>
186> {
187 logForDebugging(`Fetching install counts from ${INSTALL_COUNTS_URL}`)
188
189 const started = performance.now()
190 try {
191 const response = await axios.get<GitHubStatsResponse>(INSTALL_COUNTS_URL, {
192 timeout: 10000,
193 })
194
195 if (!response.data?.plugins || !Array.isArray(response.data.plugins)) {
196 throw new Error('Invalid response format from install counts API')
197 }
198
199 logPluginFetch(
200 'install_counts',
201 INSTALL_COUNTS_URL,
202 'success',
203 performance.now() - started,
204 )
205 return response.data.plugins
206 } catch (error) {
207 logPluginFetch(
208 'install_counts',
209 INSTALL_COUNTS_URL,
210 'failure',
211 performance.now() - started,
212 classifyFetchError(error),
213 )
214 throw error
215 }
216}
217
218/**
219 * Get plugin install counts as a Map.

Callers 1

getInstallCountsFunction · 0.85

Calls 3

logForDebuggingFunction · 0.85
logPluginFetchFunction · 0.85
classifyFetchErrorFunction · 0.85

Tested by

no test coverage detected