mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-07 10:13:08 +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:
@@ -8,6 +8,7 @@ import { useQuery } from '@tanstack/react-query';
|
||||
import { getElectronAPI } from '@/lib/electron';
|
||||
import { queryKeys } from '@/lib/query-keys';
|
||||
import { STALE_TIMES } from '@/lib/query-client';
|
||||
import type { ModelDefinition } from '@automaker/types';
|
||||
|
||||
interface CodexModel {
|
||||
id: string;
|
||||
@@ -19,18 +20,6 @@ interface CodexModel {
|
||||
isDefault: boolean;
|
||||
}
|
||||
|
||||
interface OpencodeModel {
|
||||
id: string;
|
||||
name: string;
|
||||
modelString: string;
|
||||
provider: string;
|
||||
description: string;
|
||||
supportsTools: boolean;
|
||||
supportsVision: boolean;
|
||||
tier: string;
|
||||
default?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch available models
|
||||
*
|
||||
@@ -41,6 +30,9 @@ export function useAvailableModels() {
|
||||
queryKey: queryKeys.models.available(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.model) {
|
||||
throw new Error('Model API not available');
|
||||
}
|
||||
const result = await api.model.getAvailable();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch available models');
|
||||
@@ -62,6 +54,9 @@ export function useCodexModels(refresh = false) {
|
||||
queryKey: queryKeys.models.codex(),
|
||||
queryFn: async (): Promise<CodexModel[]> => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.codex) {
|
||||
throw new Error('Codex API not available');
|
||||
}
|
||||
const result = await api.codex.getModels(refresh);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch Codex models');
|
||||
@@ -81,13 +76,16 @@ export function useCodexModels(refresh = false) {
|
||||
export function useOpencodeModels(refresh = false) {
|
||||
return useQuery({
|
||||
queryKey: queryKeys.models.opencode(),
|
||||
queryFn: async (): Promise<OpencodeModel[]> => {
|
||||
queryFn: async (): Promise<ModelDefinition[]> => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getOpencodeModels) {
|
||||
throw new Error('OpenCode models API not available');
|
||||
}
|
||||
const result = await api.setup.getOpencodeModels(refresh);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch OpenCode models');
|
||||
}
|
||||
return (result.models ?? []) as OpencodeModel[];
|
||||
return (result.models ?? []) as ModelDefinition[];
|
||||
},
|
||||
staleTime: STALE_TIMES.MODELS,
|
||||
});
|
||||
@@ -103,6 +101,9 @@ export function useOpencodeProviders() {
|
||||
queryKey: queryKeys.models.opencodeProviders(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup?.getOpencodeProviders) {
|
||||
throw new Error('OpenCode providers API not available');
|
||||
}
|
||||
const result = await api.setup.getOpencodeProviders();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch OpenCode providers');
|
||||
@@ -123,6 +124,9 @@ export function useModelProviders() {
|
||||
queryKey: queryKeys.models.providers(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.model) {
|
||||
throw new Error('Model API not available');
|
||||
}
|
||||
const result = await api.model.checkProviders();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch providers');
|
||||
|
||||
Reference in New Issue
Block a user