Skip to content

Commit c4d0e3c

Browse files
authored
fix(ui): added volta to auto update check (#27353)
1 parent df1d111 commit c4d0e3c

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

packages/cli/src/utils/installationInfo.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,30 @@ describe('getInstallationInfo', () => {
352352
expect(infoDisabled.updateMessage).toContain('Please run npm install');
353353
});
354354

355+
it('should detect Volta installation (Unix-style)', () => {
356+
const voltaPath =
357+
'/Users/test/.volta/tools/image/node/20.0.0/lib/node_modules/@google/gemini-cli/dist/index.js';
358+
process.argv[1] = voltaPath;
359+
mockedRealPathSync.mockReturnValue(voltaPath);
360+
361+
const info = getInstallationInfo(projectRoot, true);
362+
363+
expect(info.packageManager).toBe(PackageManager.VOLTA);
364+
expect(info.updateCommand).toBe('volta install @google/gemini-cli@latest');
365+
});
366+
367+
it('should detect Volta installation (Windows-style)', () => {
368+
const voltaPath =
369+
'C:\\Users\\test\\AppData\\Local\\Volta\\tools\\image\\node\\20.0.0\\node_modules\\@google/gemini-cli\\dist\\index.js';
370+
process.argv[1] = voltaPath;
371+
mockedRealPathSync.mockReturnValue(voltaPath);
372+
373+
const info = getInstallationInfo(projectRoot, true);
374+
375+
expect(info.packageManager).toBe(PackageManager.VOLTA);
376+
expect(info.updateCommand).toBe('volta install @google/gemini-cli@latest');
377+
});
378+
355379
it('should NOT detect Homebrew if gemini-cli is installed in brew but running from npm location', () => {
356380
Object.defineProperty(process, 'platform', {
357381
value: 'darwin',

packages/cli/src/utils/installationInfo.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export enum PackageManager {
2222
HOMEBREW = 'homebrew',
2323
NPX = 'npx',
2424
BINARY = 'binary',
25+
VOLTA = 'volta',
2526
UNKNOWN = 'unknown',
2627
}
2728

@@ -116,6 +117,19 @@ export function getInstallationInfo(
116117
}
117118
}
118119

120+
// Check for Volta
121+
if (realPath.includes('/.volta/') || realPath.includes('/Volta/')) {
122+
const updateCommand = 'volta install @google/gemini-cli@latest';
123+
return {
124+
packageManager: PackageManager.VOLTA,
125+
isGlobal: true,
126+
updateCommand,
127+
updateMessage: isAutoUpdateEnabled
128+
? 'Installed with Volta. Attempting to automatically update now...'
129+
: `Please run ${updateCommand} to update`,
130+
};
131+
}
132+
119133
// Check for pnpm
120134
if (
121135
realPath.includes('/.pnpm/global') ||

0 commit comments

Comments
 (0)