MCPcopy Create free account
hub / github.com/google-gemini/gemini-cli / findReleaseAsset

Function findReleaseAsset

packages/cli/src/config/extensions/github.ts:476–511  ·  view source on GitHub ↗
(assets: Asset[])

Source from the content-addressed store, hash-verified

474}
475
476export function findReleaseAsset(assets: Asset[]): Asset | undefined {
477 const platform = os.platform();
478 const arch = os.arch();
479
480 const platformArchPrefix = `${platform}.${arch}.`;
481 const platformPrefix = `${platform}.`;
482
483 // Check for platform + architecture specific asset
484 const platformArchAsset = assets.find((asset) =>
485 asset.name.toLowerCase().startsWith(platformArchPrefix),
486 );
487 if (platformArchAsset) {
488 return platformArchAsset;
489 }
490
491 // Check for platform specific asset
492 const platformAsset = assets.find((asset) =>
493 asset.name.toLowerCase().startsWith(platformPrefix),
494 );
495 if (platformAsset) {
496 return platformAsset;
497 }
498
499 // Check for generic asset if only one is available
500 const genericAsset = assets.find(
501 (asset) =>
502 !asset.name.toLowerCase().includes('darwin') &&
503 !asset.name.toLowerCase().includes('linux') &&
504 !asset.name.toLowerCase().includes('win32'),
505 );
506 if (assets.length === 1) {
507 return genericAsset;
508 }
509
510 return undefined;
511}
512
513export interface DownloadOptions {
514 headers?: Record<string, string>;

Callers 2

github.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected