fix(core/ide): add Antigravity CLI fallbacks (#22030)

This commit is contained in:
Adarsh Pandey
2026-03-13 00:58:36 +05:30
committed by GitHub
parent c68303c553
commit 829c532703
2 changed files with 122 additions and 14 deletions
+25 -8
View File
@@ -252,19 +252,36 @@ class AntigravityInstaller implements IdeInstaller {
) {}
async install(): Promise<InstallResult> {
const command = process.env['ANTIGRAVITY_CLI_ALIAS'];
if (!command) {
return {
success: false,
message: 'ANTIGRAVITY_CLI_ALIAS environment variable not set.',
};
const envCommand = process.env['ANTIGRAVITY_CLI_ALIAS'];
const safeCommandPattern = /^[a-zA-Z0-9.\-_/\\]+$/;
const sanitizedEnvCommand =
envCommand && safeCommandPattern.test(envCommand)
? envCommand
: undefined;
const fallbackCommands =
this.platform === 'win32'
? ['agy.cmd', 'antigravity.cmd']
: ['agy', 'antigravity'];
const commands = [
...(sanitizedEnvCommand ? [sanitizedEnvCommand] : []),
...fallbackCommands,
].filter(
(command, index, allCommands) => allCommands.indexOf(command) === index,
);
let commandPath: string | null = null;
for (const command of commands) {
commandPath = await findCommand(command, this.platform);
if (commandPath) {
break;
}
}
const commandPath = await findCommand(command, this.platform);
if (!commandPath) {
const supportedCommands = fallbackCommands.join(', ');
return {
success: false,
message: `${command} not found. Please ensure it is in your system's PATH.`,
message: `Antigravity CLI not found. Please ensure one of these commands is in your system's PATH: ${supportedCommands}.`,
};
}