fix(ui): added volta to auto update check (#27353)

This commit is contained in:
Dev Randalpura
2026-05-21 13:05:33 -05:00
committed by GitHub
parent df1d1119c3
commit c4d0e3ca36
2 changed files with 38 additions and 0 deletions
@@ -352,6 +352,30 @@ describe('getInstallationInfo', () => {
expect(infoDisabled.updateMessage).toContain('Please run npm install');
});
it('should detect Volta installation (Unix-style)', () => {
const voltaPath =
'/Users/test/.volta/tools/image/node/20.0.0/lib/node_modules/@google/gemini-cli/dist/index.js';
process.argv[1] = voltaPath;
mockedRealPathSync.mockReturnValue(voltaPath);
const info = getInstallationInfo(projectRoot, true);
expect(info.packageManager).toBe(PackageManager.VOLTA);
expect(info.updateCommand).toBe('volta install @google/gemini-cli@latest');
});
it('should detect Volta installation (Windows-style)', () => {
const voltaPath =
'C:\\Users\\test\\AppData\\Local\\Volta\\tools\\image\\node\\20.0.0\\node_modules\\@google/gemini-cli\\dist\\index.js';
process.argv[1] = voltaPath;
mockedRealPathSync.mockReturnValue(voltaPath);
const info = getInstallationInfo(projectRoot, true);
expect(info.packageManager).toBe(PackageManager.VOLTA);
expect(info.updateCommand).toBe('volta install @google/gemini-cli@latest');
});
it('should NOT detect Homebrew if gemini-cli is installed in brew but running from npm location', () => {
Object.defineProperty(process, 'platform', {
value: 'darwin',
@@ -22,6 +22,7 @@ export enum PackageManager {
HOMEBREW = 'homebrew',
NPX = 'npx',
BINARY = 'binary',
VOLTA = 'volta',
UNKNOWN = 'unknown',
}
@@ -116,6 +117,19 @@ export function getInstallationInfo(
}
}
// Check for Volta
if (realPath.includes('/.volta/') || realPath.includes('/Volta/')) {
const updateCommand = 'volta install @google/gemini-cli@latest';
return {
packageManager: PackageManager.VOLTA,
isGlobal: true,
updateCommand,
updateMessage: isAutoUpdateEnabled
? 'Installed with Volta. Attempting to automatically update now...'
: `Please run ${updateCommand} to update`,
};
}
// Check for pnpm
if (
realPath.includes('/.pnpm/global') ||