MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / runUpgradeCommand

Function runUpgradeCommand

src/cli/commands/upgrade.ts:466–652  ·  view source on GitHub ↗
(
  options: UpgradeOptions,
  deps?: Partial<UpgradeDependencies>,
)

Source from the content-addressed store, hash-verified

464// --- Main command logic ---
465
466export async function runUpgradeCommand(
467 options: UpgradeOptions,
468 deps?: Partial<UpgradeDependencies>,
469): Promise<number> {
470 const d = resolveDependencies(deps);
471 const isTTY = d.isInteractive();
472
473 if (isTTY) {
474 clack.intro('XcodeBuildMCP Upgrade');
475 }
476
477 const installMethod = d.detectInstallMethod();
478
479 let latestRelease: LatestRelease;
480 try {
481 if (isTTY) {
482 const s = clack.spinner();
483 s.start('Checking for updates...');
484 try {
485 latestRelease = await d.fetchLatestRelease();
486 s.stop('Update check complete.');
487 } catch (error) {
488 s.stop('Update check failed.');
489 throw error;
490 }
491 } else {
492 latestRelease = await d.fetchLatestRelease();
493 }
494 } catch (error) {
495 const reason = error instanceof Error ? error.message : String(error);
496
497 if (isTTY) {
498 clack.log.error(reason);
499 clack.log.info(`Current version: ${d.currentVersion}`);
500 clack.log.info(`Install method: ${installMethod.kind}`);
501 if (isAutoUpgradeMethod(installMethod)) {
502 clack.log.info(`Manual upgrade: ${installMethod.manualCommand}`);
503 }
504 clack.outro('');
505 } else {
506 writeError(reason);
507 writeLine(`Current version: ${d.currentVersion}`);
508 writeLine(`Install method: ${installMethod.kind}`);
509 if (isAutoUpgradeMethod(installMethod)) {
510 writeLine(`Manual upgrade: ${installMethod.manualCommand}`);
511 }
512 }
513
514 return 1;
515 }
516
517 const parsedCurrent = parseVersion(d.currentVersion);
518 const parsedLatest = parseVersion(latestRelease.version);
519
520 if (!parsedCurrent || !parsedLatest) {
521 const msg = `Cannot compare versions: current=${d.currentVersion}, latest=${latestRelease.version}`;
522 if (isTTY) {
523 clack.log.error(msg);

Callers 2

upgrade.test.tsFile · 0.90
registerUpgradeCommandFunction · 0.70

Calls 11

resolveDependenciesFunction · 0.85
isAutoUpgradeMethodFunction · 0.85
writeErrorFunction · 0.85
parseVersionFunction · 0.85
compareVersionsFunction · 0.85
truncateReleaseNotesFunction · 0.85
executeUpgradeFunction · 0.85
confirmMethod · 0.80
writeLineFunction · 0.70
startMethod · 0.65
stopMethod · 0.65

Tested by

no test coverage detected