mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-08 22:43:07 +00:00
chore: Fix all 246 TypeScript errors in UI
- Extended SetupAPI interface with 20+ missing methods for Cursor, Codex, OpenCode, Gemini, and Copilot CLI integrations - Fixed WorktreeInfo type to include isCurrent and hasWorktree fields - Added null checks for optional API properties across all hooks - Fixed Feature type conflicts between @automaker/types and local definitions - Added missing CLI status hooks for all providers - Fixed type mismatches in mutation callbacks and event handlers - Removed dead code referencing non-existent GlobalSettings properties - Updated mock implementations in electron.ts for all new API methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* CLI Status Query Hooks
|
||||
*
|
||||
* React Query hooks for fetching CLI tool status (Claude, Cursor, Codex, etc.)
|
||||
* React Query hooks for fetching CLI tool status (Claude, GitHub CLI, etc.)
|
||||
*/
|
||||
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
@@ -19,6 +19,9 @@ export function useClaudeCliStatus() {
|
||||
queryKey: queryKeys.cli.claude(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup) {
|
||||
throw new Error('Setup API not available');
|
||||
}
|
||||
const result = await api.setup.getClaudeStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Claude status');
|
||||
@@ -29,106 +32,6 @@ export function useClaudeCliStatus() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Cursor CLI status
|
||||
*
|
||||
* @returns Query result with Cursor CLI status
|
||||
*/
|
||||
export function useCursorCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.cursor(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
const result = await api.setup.getCursorStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Cursor status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Codex CLI status
|
||||
*
|
||||
* @returns Query result with Codex CLI status
|
||||
*/
|
||||
export function useCodexCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.codex(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
const result = await api.setup.getCodexStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Codex status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch OpenCode CLI status
|
||||
*
|
||||
* @returns Query result with OpenCode CLI status
|
||||
*/
|
||||
export function useOpencodeCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.opencode(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
const result = await api.setup.getOpencodeStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch OpenCode status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Gemini CLI status
|
||||
*
|
||||
* @returns Query result with Gemini CLI status
|
||||
*/
|
||||
export function useGeminiCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.gemini(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
const result = await api.setup.getGeminiStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Gemini status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Copilot SDK status
|
||||
*
|
||||
* @returns Query result with Copilot SDK status
|
||||
*/
|
||||
export function useCopilotCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.copilot(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
const result = await api.setup.getCopilotStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Copilot status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch GitHub CLI status
|
||||
*
|
||||
@@ -139,6 +42,9 @@ export function useGitHubCliStatus() {
|
||||
queryKey: queryKeys.cli.github(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getGhStatus) {
|
||||
throw new Error('GitHub CLI status API not available');
|
||||
}
|
||||
const result = await api.setup.getGhStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch GitHub CLI status');
|
||||
@@ -159,6 +65,9 @@ export function useApiKeysStatus() {
|
||||
queryKey: queryKeys.cli.apiKeys(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup) {
|
||||
throw new Error('Setup API not available');
|
||||
}
|
||||
const result = await api.setup.getApiKeys();
|
||||
return result;
|
||||
},
|
||||
@@ -176,6 +85,9 @@ export function usePlatformInfo() {
|
||||
queryKey: queryKeys.cli.platform(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup) {
|
||||
throw new Error('Setup API not available');
|
||||
}
|
||||
const result = await api.setup.getPlatform();
|
||||
if (!result.success) {
|
||||
throw new Error('Failed to fetch platform info');
|
||||
@@ -185,3 +97,95 @@ export function usePlatformInfo() {
|
||||
staleTime: Infinity, // Platform info never changes
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Cursor CLI status
|
||||
*
|
||||
* @returns Query result with Cursor CLI status
|
||||
*/
|
||||
export function useCursorCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.cursor(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getCursorStatus) {
|
||||
throw new Error('Cursor CLI status API not available');
|
||||
}
|
||||
const result = await api.setup.getCursorStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Cursor CLI status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Copilot CLI status
|
||||
*
|
||||
* @returns Query result with Copilot CLI status
|
||||
*/
|
||||
export function useCopilotCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.copilot(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getCopilotStatus) {
|
||||
throw new Error('Copilot CLI status API not available');
|
||||
}
|
||||
const result = await api.setup.getCopilotStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Copilot CLI status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Gemini CLI status
|
||||
*
|
||||
* @returns Query result with Gemini CLI status
|
||||
*/
|
||||
export function useGeminiCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.gemini(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getGeminiStatus) {
|
||||
throw new Error('Gemini CLI status API not available');
|
||||
}
|
||||
const result = await api.setup.getGeminiStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Gemini CLI status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch OpenCode CLI status
|
||||
*
|
||||
* @returns Query result with OpenCode CLI status
|
||||
*/
|
||||
export function useOpencodeCliStatus() {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.cli.opencode(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getOpencodeStatus) {
|
||||
throw new Error('OpenCode CLI status API not available');
|
||||
}
|
||||
const result = await api.setup.getOpencodeStatus();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch OpenCode CLI status');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user