mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +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:
@@ -51,6 +51,9 @@ export function useWorktrees(projectPath: string | undefined, includeDetails = t
|
||||
queryFn: async (): Promise<WorktreesResult> => {
|
||||
if (!projectPath) throw new Error('No project path');
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.listAll(projectPath, includeDetails);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch worktrees');
|
||||
@@ -80,6 +83,9 @@ export function useWorktreeInfo(projectPath: string | undefined, featureId: stri
|
||||
queryFn: async () => {
|
||||
if (!projectPath || !featureId) throw new Error('Missing project path or feature ID');
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.getInfo(projectPath, featureId);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch worktree info');
|
||||
@@ -106,6 +112,9 @@ export function useWorktreeStatus(projectPath: string | undefined, featureId: st
|
||||
queryFn: async () => {
|
||||
if (!projectPath || !featureId) throw new Error('Missing project path or feature ID');
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.getStatus(projectPath, featureId);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch worktree status');
|
||||
@@ -132,6 +141,9 @@ export function useWorktreeDiffs(projectPath: string | undefined, featureId: str
|
||||
queryFn: async () => {
|
||||
if (!projectPath || !featureId) throw new Error('Missing project path or feature ID');
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.getDiffs(projectPath, featureId);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch diffs');
|
||||
@@ -180,6 +192,9 @@ export function useWorktreeBranches(worktreePath: string | undefined, includeRem
|
||||
queryFn: async (): Promise<BranchesResult> => {
|
||||
if (!worktreePath) throw new Error('No worktree path');
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.listBranches(worktreePath, includeRemote);
|
||||
|
||||
// Handle special git status codes
|
||||
@@ -239,6 +254,9 @@ export function useWorktreeInitScript(projectPath: string | undefined) {
|
||||
queryFn: async () => {
|
||||
if (!projectPath) throw new Error('No project path');
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.getInitScript(projectPath);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch init script');
|
||||
@@ -265,11 +283,14 @@ export function useAvailableEditors() {
|
||||
queryKey: queryKeys.worktrees.editors(),
|
||||
queryFn: async () => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.worktree) {
|
||||
throw new Error('Worktree API not available');
|
||||
}
|
||||
const result = await api.worktree.getAvailableEditors();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to fetch editors');
|
||||
}
|
||||
return result.editors ?? [];
|
||||
return result.result?.editors ?? [];
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
refetchOnWindowFocus: WORKTREE_REFETCH_ON_FOCUS,
|
||||
|
||||
Reference in New Issue
Block a user