mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
refactor: improve error handling and CLI integration
- Updated CodexProvider to read prompts from stdin to prevent shell escaping issues. - Enhanced AgentService to handle streamed error messages from providers, ensuring a consistent user experience. - Modified UI components to display error messages clearly, including visual indicators for errors in chat bubbles. - Updated CLI status handling to support both Claude and Codex APIs, improving compatibility and user feedback. These changes enhance the robustness of the application and improve the user experience during error scenarios.
This commit is contained in:
@@ -40,8 +40,13 @@ export function useCliStatus({
|
||||
logger.info(`Raw status result for ${cliType}:`, result);
|
||||
|
||||
if (result.success) {
|
||||
// Handle both response formats:
|
||||
// - Claude API returns {status: 'installed' | 'not_installed'}
|
||||
// - Codex API returns {installed: boolean}
|
||||
const isInstalled =
|
||||
typeof result.installed === 'boolean' ? result.installed : result.status === 'installed';
|
||||
const cliStatus = {
|
||||
installed: result.status === 'installed',
|
||||
installed: isInstalled,
|
||||
path: result.path || null,
|
||||
version: result.version || null,
|
||||
method: result.method || 'none',
|
||||
|
||||
@@ -15,7 +15,6 @@ import { getElectronAPI } from '@/lib/electron';
|
||||
import {
|
||||
CheckCircle2,
|
||||
Loader2,
|
||||
Terminal,
|
||||
Key,
|
||||
ArrowRight,
|
||||
ArrowLeft,
|
||||
@@ -31,6 +30,7 @@ import {
|
||||
import { toast } from 'sonner';
|
||||
import { StatusBadge, TerminalOutput } from '../components';
|
||||
import { useCliStatus, useCliInstallation, useTokenSave } from '../hooks';
|
||||
import { AnthropicIcon } from '@/components/ui/provider-icon';
|
||||
|
||||
interface ClaudeSetupStepProps {
|
||||
onNext: () => void;
|
||||
@@ -310,7 +310,7 @@ export function ClaudeSetupStep({ onNext, onBack, onSkip }: ClaudeSetupStepProps
|
||||
<div className="space-y-6">
|
||||
<div className="text-center mb-8">
|
||||
<div className="w-16 h-16 rounded-xl bg-brand-500/10 flex items-center justify-center mx-auto mb-4">
|
||||
<Terminal className="w-8 h-8 text-brand-500" />
|
||||
<AnthropicIcon className="w-8 h-8 text-brand-500" />
|
||||
</div>
|
||||
<h2 className="text-2xl font-bold text-foreground mb-2">Claude Code Setup</h2>
|
||||
<p className="text-muted-foreground">Configure for code generation</p>
|
||||
@@ -339,7 +339,7 @@ export function ClaudeSetupStep({ onNext, onBack, onSkip }: ClaudeSetupStepProps
|
||||
<AccordionTrigger className="hover:no-underline">
|
||||
<div className="flex items-center justify-between w-full pr-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<Terminal
|
||||
<AnthropicIcon
|
||||
className={`w-5 h-5 ${
|
||||
cliVerificationStatus === 'verified'
|
||||
? 'text-green-500'
|
||||
|
||||
@@ -14,11 +14,11 @@ import {
|
||||
Copy,
|
||||
RefreshCw,
|
||||
AlertTriangle,
|
||||
Terminal,
|
||||
XCircle,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { StatusBadge } from '../components';
|
||||
import { CursorIcon } from '@/components/ui/provider-icon';
|
||||
|
||||
const logger = createLogger('CursorSetupStep');
|
||||
|
||||
@@ -168,7 +168,7 @@ export function CursorSetupStep({ onNext, onBack, onSkip }: CursorSetupStepProps
|
||||
<div className="space-y-6">
|
||||
<div className="text-center mb-8">
|
||||
<div className="w-16 h-16 rounded-xl bg-cyan-500/10 flex items-center justify-center mx-auto mb-4">
|
||||
<Terminal className="w-8 h-8 text-cyan-500" />
|
||||
<CursorIcon className="w-8 h-8 text-cyan-500" />
|
||||
</div>
|
||||
<h2 className="text-2xl font-bold text-foreground mb-2">Cursor CLI Setup</h2>
|
||||
<p className="text-muted-foreground">Optional - Use Cursor as an AI provider</p>
|
||||
@@ -195,7 +195,7 @@ export function CursorSetupStep({ onNext, onBack, onSkip }: CursorSetupStepProps
|
||||
<CardHeader>
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="text-lg flex items-center gap-2">
|
||||
<Terminal className="w-5 h-5" />
|
||||
<CursorIcon className="w-5 h-5" />
|
||||
Cursor CLI Status
|
||||
<Badge variant="outline" className="ml-2">
|
||||
Optional
|
||||
|
||||
Reference in New Issue
Block a user