MCPcopy
hub / github.com/colbymchenry/codegraph / upgradeUnixBundle

Function upgradeUnixBundle

src/upgrade/index.ts:405–435  ·  view source on GitHub ↗
(
  method: Extract<InstallMethod, { kind: 'bundle' }>,
  pinned: string | undefined,
  deps: UpgradeDeps
)

Source from the content-addressed store, hash-verified

403}
404
405function upgradeUnixBundle(
406 method: Extract<InstallMethod, { kind: 'bundle' }>,
407 pinned: string | undefined,
408 deps: UpgradeDeps
409): number {
410 const downloader = deps.hasCommand('curl')
411 ? `curl -fsSL ${INSTALL_SH_URL}`
412 : deps.hasCommand('wget')
413 ? `wget -qO- ${INSTALL_SH_URL}`
414 : null;
415 if (!downloader) {
416 deps.error('Neither curl nor wget is available to download the installer.');
417 deps.log(c.dim(`Install curl, or run manually: ${INSTALL_SH_URL} | sh`));
418 return 1;
419 }
420
421 const env: NodeJS.ProcessEnv = { ...process.env };
422 if (method.installDir) env.CODEGRAPH_INSTALL_DIR = method.installDir;
423 if (pinned) env.CODEGRAPH_VERSION = pinned;
424
425 deps.log(c.dim(`Running the installer (${downloader} | sh)…`));
426 const code = deps.run('sh', ['-c', `${downloader} | sh`], env);
427 if (code !== 0) {
428 deps.error(`Installer exited with code ${code}.`);
429 return 1;
430 }
431 deps.log('');
432 deps.log(c.green('✓ Upgrade complete.') + c.dim(' Open a new terminal if the version looks unchanged (PATH cache).'));
433 deps.log(reindexAdvisory());
434 return 0;
435}
436
437/** Build the in-place Windows upgrade script (exported for unit-testing). */
438export function buildWindowsUpgradeScript(bundleRoot: string, version: string, arch: string): string {

Callers 1

runUpgradeFunction · 0.85

Calls 3

reindexAdvisoryFunction · 0.85
errorMethod · 0.80
runMethod · 0.65

Tested by

no test coverage detected