mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
fix(platform): detect Antigravity CLI aliases
This commit is contained in:
@@ -4,6 +4,9 @@ import { FolderOpen } from 'lucide-react';
|
|||||||
type IconProps = ComponentProps<'svg'>;
|
type IconProps = ComponentProps<'svg'>;
|
||||||
type IconComponent = ComponentType<IconProps>;
|
type IconComponent = ComponentType<IconProps>;
|
||||||
|
|
||||||
|
const ANTIGRAVITY_COMMANDS = ['antigravity', 'agy'] as const;
|
||||||
|
const [PRIMARY_ANTIGRAVITY_COMMAND, LEGACY_ANTIGRAVITY_COMMAND] = ANTIGRAVITY_COMMANDS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cursor editor logo icon - from LobeHub icons
|
* Cursor editor logo icon - from LobeHub icons
|
||||||
*/
|
*/
|
||||||
@@ -160,7 +163,8 @@ export function getEditorIcon(command: string): IconComponent {
|
|||||||
webstorm: WebStormIcon,
|
webstorm: WebStormIcon,
|
||||||
xed: XcodeIcon,
|
xed: XcodeIcon,
|
||||||
studio: AndroidStudioIcon,
|
studio: AndroidStudioIcon,
|
||||||
agy: AntigravityIcon,
|
[PRIMARY_ANTIGRAVITY_COMMAND]: AntigravityIcon,
|
||||||
|
[LEGACY_ANTIGRAVITY_COMMAND]: AntigravityIcon,
|
||||||
open: FinderIcon,
|
open: FinderIcon,
|
||||||
explorer: FolderOpen,
|
explorer: FolderOpen,
|
||||||
'xdg-open': FolderOpen,
|
'xdg-open': FolderOpen,
|
||||||
|
|||||||
@@ -1646,6 +1646,8 @@ function createMockWorktreeAPI(): WorktreeAPI {
|
|||||||
},
|
},
|
||||||
|
|
||||||
openInEditor: async (worktreePath: string, editorCommand?: string) => {
|
openInEditor: async (worktreePath: string, editorCommand?: string) => {
|
||||||
|
const ANTIGRAVITY_EDITOR_COMMAND = 'antigravity';
|
||||||
|
const ANTIGRAVITY_LEGACY_COMMAND = 'agy';
|
||||||
// Map editor commands to display names
|
// Map editor commands to display names
|
||||||
const editorNameMap: Record<string, string> = {
|
const editorNameMap: Record<string, string> = {
|
||||||
cursor: 'Cursor',
|
cursor: 'Cursor',
|
||||||
@@ -1658,7 +1660,8 @@ function createMockWorktreeAPI(): WorktreeAPI {
|
|||||||
webstorm: 'WebStorm',
|
webstorm: 'WebStorm',
|
||||||
xed: 'Xcode',
|
xed: 'Xcode',
|
||||||
studio: 'Android Studio',
|
studio: 'Android Studio',
|
||||||
agy: 'Antigravity',
|
[ANTIGRAVITY_EDITOR_COMMAND]: 'Antigravity',
|
||||||
|
[ANTIGRAVITY_LEGACY_COMMAND]: 'Antigravity',
|
||||||
open: 'Finder',
|
open: 'Finder',
|
||||||
explorer: 'Explorer',
|
explorer: 'Explorer',
|
||||||
'xdg-open': 'File Manager',
|
'xdg-open': 'File Manager',
|
||||||
|
|||||||
@@ -87,11 +87,15 @@ async function findMacApp(appName: string): Promise<string | null> {
|
|||||||
interface EditorDefinition {
|
interface EditorDefinition {
|
||||||
name: string;
|
name: string;
|
||||||
cliCommand: string;
|
cliCommand: string;
|
||||||
|
cliAliases?: readonly string[];
|
||||||
macAppName: string;
|
macAppName: string;
|
||||||
/** If true, only available on macOS */
|
/** If true, only available on macOS */
|
||||||
macOnly?: boolean;
|
macOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ANTIGRAVITY_CLI_COMMANDS = ['antigravity', 'agy'] as const;
|
||||||
|
const [PRIMARY_ANTIGRAVITY_COMMAND, ...LEGACY_ANTIGRAVITY_COMMANDS] = ANTIGRAVITY_CLI_COMMANDS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of supported editors in priority order
|
* List of supported editors in priority order
|
||||||
*/
|
*/
|
||||||
@@ -106,7 +110,12 @@ const SUPPORTED_EDITORS: EditorDefinition[] = [
|
|||||||
{ name: 'WebStorm', cliCommand: 'webstorm', macAppName: 'WebStorm' },
|
{ name: 'WebStorm', cliCommand: 'webstorm', macAppName: 'WebStorm' },
|
||||||
{ name: 'Xcode', cliCommand: 'xed', macAppName: 'Xcode', macOnly: true },
|
{ name: 'Xcode', cliCommand: 'xed', macAppName: 'Xcode', macOnly: true },
|
||||||
{ name: 'Android Studio', cliCommand: 'studio', macAppName: 'Android Studio' },
|
{ name: 'Android Studio', cliCommand: 'studio', macAppName: 'Android Studio' },
|
||||||
{ name: 'Antigravity', cliCommand: 'agy', macAppName: 'Antigravity' },
|
{
|
||||||
|
name: 'Antigravity',
|
||||||
|
cliCommand: PRIMARY_ANTIGRAVITY_COMMAND,
|
||||||
|
cliAliases: LEGACY_ANTIGRAVITY_COMMANDS,
|
||||||
|
macAppName: 'Antigravity',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,8 +129,11 @@ async function findEditor(definition: EditorDefinition): Promise<EditorInfo | nu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try CLI command first (works on all platforms)
|
// Try CLI command first (works on all platforms)
|
||||||
if (await commandExists(definition.cliCommand)) {
|
const cliCandidates = [definition.cliCommand, ...(definition.cliAliases ?? [])];
|
||||||
return { name: definition.name, command: definition.cliCommand };
|
for (const cliCommand of cliCandidates) {
|
||||||
|
if (await commandExists(cliCommand)) {
|
||||||
|
return { name: definition.name, command: cliCommand };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try macOS app bundle (checks /Applications and ~/Applications)
|
// Try macOS app bundle (checks /Applications and ~/Applications)
|
||||||
|
|||||||
Reference in New Issue
Block a user