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:
Shirone
2026-01-25 18:36:47 +01:00
parent 0fb471ca15
commit 5c335641fa
48 changed files with 1071 additions and 336 deletions

View File

@@ -36,6 +36,7 @@ export function useStartFeature(projectPath: string) {
worktreePath?: string;
}) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.runFeature(
projectPath,
featureId,
@@ -77,6 +78,7 @@ export function useResumeFeature(projectPath: string) {
useWorktrees?: boolean;
}) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.resumeFeature(projectPath, featureId, useWorktrees);
if (!result.success) {
throw new Error(result.error || 'Failed to resume feature');
@@ -116,6 +118,7 @@ export function useStopFeature() {
mutationFn: async (input: string | { featureId: string; projectPath?: string }) => {
const featureId = typeof input === 'string' ? input : input.featureId;
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.stopFeature(featureId);
if (!result.success) {
throw new Error(result.error || 'Failed to stop feature');
@@ -151,6 +154,7 @@ export function useVerifyFeature(projectPath: string) {
return useMutation({
mutationFn: async (featureId: string) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.verifyFeature(projectPath, featureId);
if (!result.success) {
throw new Error(result.error || 'Failed to verify feature');
@@ -196,6 +200,7 @@ export function useApprovePlan(projectPath: string) {
feedback?: string;
}) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.approvePlan(
projectPath,
featureId,
@@ -246,6 +251,7 @@ export function useFollowUpFeature(projectPath: string) {
useWorktrees?: boolean;
}) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.followUpFeature(
projectPath,
featureId,
@@ -282,6 +288,7 @@ export function useCommitFeature(projectPath: string) {
return useMutation({
mutationFn: async (featureId: string) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.commitFeature(projectPath, featureId);
if (!result.success) {
throw new Error(result.error || 'Failed to commit changes');
@@ -310,6 +317,7 @@ export function useAnalyzeProject() {
return useMutation({
mutationFn: async (projectPath: string) => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.analyzeProject(projectPath);
if (!result.success) {
throw new Error(result.error || 'Failed to analyze project');
@@ -339,7 +347,8 @@ export function useStartAutoMode(projectPath: string) {
return useMutation({
mutationFn: async (maxConcurrency?: number) => {
const api = getElectronAPI();
const result = await api.autoMode.start(projectPath, maxConcurrency);
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.start(projectPath, String(maxConcurrency ?? ''));
if (!result.success) {
throw new Error(result.error || 'Failed to start auto mode');
}
@@ -369,6 +378,7 @@ export function useStopAutoMode(projectPath: string) {
return useMutation({
mutationFn: async () => {
const api = getElectronAPI();
if (!api.autoMode) throw new Error('AutoMode API not available');
const result = await api.autoMode.stop(projectPath);
if (!result.success) {
throw new Error(result.error || 'Failed to stop auto mode');

View File

@@ -8,7 +8,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
import { getElectronAPI, GitHubIssue, GitHubComment } from '@/lib/electron';
import { queryKeys } from '@/lib/query-keys';
import { toast } from 'sonner';
import type { LinkedPRInfo, ModelId } from '@automaker/types';
import type { LinkedPRInfo, ModelId, ThinkingLevel, ReasoningEffort } from '@automaker/types';
import { resolveModelString } from '@automaker/model-resolver';
/**
@@ -17,8 +17,8 @@ import { resolveModelString } from '@automaker/model-resolver';
interface ValidateIssueInput {
issue: GitHubIssue;
model?: ModelId;
thinkingLevel?: number;
reasoningEffort?: string;
thinkingLevel?: ThinkingLevel;
reasoningEffort?: ReasoningEffort;
comments?: GitHubComment[];
linkedPRs?: LinkedPRInfo[];
}

View File

@@ -22,6 +22,7 @@ export function useCreateWorktree(projectPath: string) {
return useMutation({
mutationFn: async ({ branchName, baseBranch }: { branchName: string; baseBranch?: string }) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.create(projectPath, branchName, baseBranch);
if (!result.success) {
throw new Error(result.error || 'Failed to create worktree');
@@ -58,6 +59,7 @@ export function useDeleteWorktree(projectPath: string) {
deleteBranch?: boolean;
}) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.delete(projectPath, worktreePath, deleteBranch);
if (!result.success) {
throw new Error(result.error || 'Failed to delete worktree');
@@ -87,6 +89,7 @@ export function useCommitWorktree() {
return useMutation({
mutationFn: async ({ worktreePath, message }: { worktreePath: string; message: string }) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.commit(worktreePath, message);
if (!result.success) {
throw new Error(result.error || 'Failed to commit changes');
@@ -117,6 +120,7 @@ export function usePushWorktree() {
return useMutation({
mutationFn: async ({ worktreePath, force }: { worktreePath: string; force?: boolean }) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.push(worktreePath, force);
if (!result.success) {
throw new Error(result.error || 'Failed to push changes');
@@ -146,6 +150,7 @@ export function usePullWorktree() {
return useMutation({
mutationFn: async (worktreePath: string) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.pull(worktreePath);
if (!result.success) {
throw new Error(result.error || 'Failed to pull changes');
@@ -188,6 +193,7 @@ export function useCreatePullRequest() {
};
}) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.createPR(worktreePath, options);
if (!result.success) {
throw new Error(result.error || 'Failed to create pull request');
@@ -243,10 +249,12 @@ export function useMergeWorktree(projectPath: string) {
};
}) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.mergeFeature(
projectPath,
branchName,
worktreePath,
undefined, // targetBranch - use default (main)
options
);
if (!result.success) {
@@ -284,6 +292,7 @@ export function useSwitchBranch() {
branchName: string;
}) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.switchBranch(worktreePath, branchName);
if (!result.success) {
throw new Error(result.error || 'Failed to switch branch');
@@ -319,6 +328,7 @@ export function useCheckoutBranch() {
branchName: string;
}) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.checkoutBranch(worktreePath, branchName);
if (!result.success) {
throw new Error(result.error || 'Failed to checkout branch');
@@ -346,6 +356,7 @@ export function useGenerateCommitMessage() {
return useMutation({
mutationFn: async (worktreePath: string) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.generateCommitMessage(worktreePath);
if (!result.success) {
throw new Error(result.error || 'Failed to generate commit message');
@@ -375,6 +386,7 @@ export function useOpenInEditor() {
editorCommand?: string;
}) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.openInEditor(worktreePath, editorCommand);
if (!result.success) {
throw new Error(result.error || 'Failed to open in editor');
@@ -400,6 +412,7 @@ export function useInitGit() {
return useMutation({
mutationFn: async (projectPath: string) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.initGit(projectPath);
if (!result.success) {
throw new Error(result.error || 'Failed to initialize git');
@@ -431,6 +444,7 @@ export function useSetInitScript(projectPath: string) {
return useMutation({
mutationFn: async (content: string) => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.setInitScript(projectPath, content);
if (!result.success) {
throw new Error(result.error || 'Failed to save init script');
@@ -461,6 +475,7 @@ export function useDeleteInitScript(projectPath: string) {
return useMutation({
mutationFn: async () => {
const api = getElectronAPI();
if (!api.worktree) throw new Error('Worktree API not available');
const result = await api.worktree.deleteInitScript(projectPath);
if (!result.success) {
throw new Error(result.error || 'Failed to delete init script');