{error}
Generating Intelligence Report
Scanning codebase, extracting semantics, and building your knowledge base. This may take up to a minute for large repositories.
import React, { useState, useEffect } from 'react'; import { Cpu, ArrowLeft, AlertCircle, CheckCircle } from 'lucide-react'; import InputForm from './components/InputForm'; import RepoTree from './components/RepoTree'; import Dashboard from './components/Dashboard'; import { apiUrl } from './api'; const LOADING_STEPS = [ { title: 'Access Verification', desc: 'Checking GitHub repository accessibility...' }, { title: 'Workspace Isolation', desc: 'Cloning repository into isolated sandbox...' }, { title: 'Static Profiling', desc: 'Scanning files, parsing package manifests...' }, { title: 'Gemini Reasoning', desc: 'Analyzing codebase with Gemini 2.5 Flash...' }, { title: 'Knowledge Indexing', desc: 'Building semantic vector index (ChromaDB)...' }, ]; export default function App() { const [appState, setAppState] = useState('idle'); // idle | loading | success | error const [analysisResult, setAnalysisResult] = useState(null); const [error, setError] = useState(null); const [currentStep, setCurrentStep] = useState(0); useEffect(() => { let interval; if (appState === 'loading') { setCurrentStep(0); interval = setInterval(() => { setCurrentStep(prev => (prev < LOADING_STEPS.length - 2 ? prev + 1 : prev)); }, 3800); } return () => clearInterval(interval); }, [appState]); const handleStartAnalysis = async (formData) => { setAppState('loading'); setError(null); setAnalysisResult(null); // API key is now server-side from .env — only send if user explicitly provided one const headers = {}; if (formData.apiKey) headers['x-gemini-key'] = formData.apiKey; try { let response; if (formData.type === 'url') { setCurrentStep(0); response = await fetch(apiUrl('/api/analyze-url'), { method: 'POST', headers: { 'Content-Type': 'application/json', ...headers }, body: JSON.stringify({ url: formData.url, token: formData.token || null }), }); } else { setCurrentStep(1); const fd = new FormData(); fd.append('file', formData.file); response = await fetch(apiUrl('/api/analyze-zip'), { method: 'POST', headers, body: fd }); } const resData = await response.json(); if (!response.ok) throw new Error(resData.detail || 'Analysis failed.'); setCurrentStep(4); setTimeout(() => { setAnalysisResult({ ...resData, apiKey: formData.apiKey || null }); setAppState('success'); }, 700); } catch (e) { setError(e.message); setAppState('error'); } }; const handleReset = () => { setAppState('idle'); setAnalysisResult(null); setError(null); }; return (
{error}
Scanning codebase, extracting semantics, and building your knowledge base. This may take up to a minute for large repositories.