🎨 Full UI: White + Light Blue theme across ALL pages (CODE-NARRATIVE style)

#7
frontend/src/App.tsx CHANGED
@@ -30,29 +30,29 @@ function useHashRouter(): [Page, (p: Page) => void] {
30
  function Navbar({ page, onNavigate }: { page: Page; onNavigate: (p: Page) => void }) {
31
  if (page === 'landing') return null;
32
 
33
- const links: { id: Page; label: string; icon: string }[] = [
34
- { id: 'generate', label: 'Generate', icon: '⚡' },
35
- { id: 'analyze', label: 'Analyze', icon: '🔬' },
36
- { id: 'history', label: 'History', icon: '📋' },
37
- { id: 'settings', label: 'Settings', icon: '⚙️' },
38
  ];
39
 
40
  return (
41
- <nav className="sticky top-0 z-50 bg-[#0a0a0f]/80 backdrop-blur-xl border-b border-white/[0.04]">
42
- <div className="max-w-[1400px] mx-auto px-6 py-3 flex items-center justify-between">
43
- <button onClick={() => onNavigate('landing')} className="flex items-center gap-2.5 hover:opacity-80 transition">
44
- <div className="w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-500 to-cyan-500 flex items-center justify-center text-xs font-black shadow-md shadow-emerald-500/20">T</div>
45
- <span className="font-bold text-sm tracking-tight">TestGenius<span className="text-emerald-400">.ai</span></span>
46
  </button>
47
  <div className="flex gap-1">
48
  {links.map(l => (
49
  <button key={l.id} onClick={() => onNavigate(l.id)}
50
- className={`px-3.5 py-2 rounded-lg text-xs font-medium transition-all ${
51
  page === l.id
52
- ? 'bg-emerald-500/10 text-emerald-300 border border-emerald-500/20 shadow-sm shadow-emerald-500/5'
53
- : 'text-gray-500 hover:text-gray-300 border border-transparent hover:border-white/[0.06]'
54
  }`}>
55
- <span className="mr-1.5">{l.icon}</span>{l.label}
56
  </button>
57
  ))}
58
  </div>
@@ -61,36 +61,11 @@ function Navbar({ page, onNavigate }: { page: Page; onNavigate: (p: Page) => voi
61
  );
62
  }
63
 
64
- function ErrorFallback({ error, onReset }: { error: string; onReset: () => void }) {
65
- return (
66
- <div className="min-h-screen bg-[#0a0a0f] flex items-center justify-center p-8">
67
- <div className="bg-red-500/5 border border-red-500/20 rounded-2xl p-10 max-w-md text-center">
68
- <div className="text-4xl mb-5">⚠️</div>
69
- <h2 className="text-lg font-bold text-white mb-2">Something went wrong</h2>
70
- <p className="text-sm text-red-300/80 mb-6">{error}</p>
71
- <button onClick={onReset}
72
- className="px-6 py-2.5 bg-white/[0.05] hover:bg-white/[0.08] border border-white/[0.08] rounded-xl text-sm font-medium transition">
73
- Try Again
74
- </button>
75
- </div>
76
- </div>
77
- );
78
- }
79
-
80
  export default function App() {
81
  const [page, navigate] = useHashRouter();
82
- const [error, setError] = useState<string | null>(null);
83
-
84
- useEffect(() => {
85
- const handler = (e: ErrorEvent) => { setError(e.message); e.preventDefault(); };
86
- window.addEventListener('error', handler);
87
- return () => window.removeEventListener('error', handler);
88
- }, []);
89
-
90
- if (error) return <ErrorFallback error={error} onReset={() => { setError(null); navigate('landing'); }} />;
91
 
92
  return (
93
- <div className="min-h-screen bg-[#0a0a0f] text-white">
94
  <Navbar page={page} onNavigate={navigate} />
95
  <main className="animate-fade-in">
96
  {page === 'landing' && <LandingPage onNavigate={navigate} />}
 
30
  function Navbar({ page, onNavigate }: { page: Page; onNavigate: (p: Page) => void }) {
31
  if (page === 'landing') return null;
32
 
33
+ const links: { id: Page; label: string }[] = [
34
+ { id: 'generate', label: 'Generate' },
35
+ { id: 'analyze', label: 'Analyze' },
36
+ { id: 'history', label: 'History' },
37
+ { id: 'settings', label: 'Settings' },
38
  ];
39
 
40
  return (
41
+ <nav className="sticky top-0 z-50 glass-nav">
42
+ <div className="max-w-7xl mx-auto px-6 py-3 flex items-center justify-between">
43
+ <button onClick={() => onNavigate('landing')} className="flex items-center gap-2 hover:opacity-80 transition">
44
+ <div className="w-8 h-8 rounded-lg bg-blue-50 flex items-center justify-center text-blue-600 text-lg">🧪</div>
45
+ <span className="font-bold text-slate-900 text-sm tracking-tight">TestGenius AI</span>
46
  </button>
47
  <div className="flex gap-1">
48
  {links.map(l => (
49
  <button key={l.id} onClick={() => onNavigate(l.id)}
50
+ className={`px-4 py-2 rounded-lg text-sm font-medium transition-all ${
51
  page === l.id
52
+ ? 'bg-blue-50 text-blue-700 border border-blue-100'
53
+ : 'text-slate-500 hover:text-slate-900 hover:bg-slate-50 border border-transparent'
54
  }`}>
55
+ {l.label}
56
  </button>
57
  ))}
58
  </div>
 
61
  );
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  export default function App() {
65
  const [page, navigate] = useHashRouter();
 
 
 
 
 
 
 
 
 
66
 
67
  return (
68
+ <div className="min-h-screen" style={{ backgroundColor: 'var(--cn-bg)', color: 'var(--cn-text)' }}>
69
  <Navbar page={page} onNavigate={navigate} />
70
  <main className="animate-fade-in">
71
  {page === 'landing' && <LandingPage onNavigate={navigate} />}
frontend/src/index.css CHANGED
@@ -1,37 +1,221 @@
 
 
 
 
1
  @tailwind base;
2
  @tailwind components;
3
  @tailwind utilities;
4
 
5
- * { margin: 0; padding: 0; box-sizing: border-box; }
6
- html { scroll-behavior: smooth; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
 
 
 
8
  body {
9
- font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
 
 
10
  -webkit-font-smoothing: antialiased;
11
  -moz-osx-font-smoothing: grayscale;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  }
13
 
14
- ::selection { background: rgba(16, 185, 129, 0.15); }
 
 
 
 
 
 
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  ::-webkit-scrollbar { width: 6px; height: 6px; }
17
  ::-webkit-scrollbar-track { background: transparent; }
18
- ::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
19
- ::-webkit-scrollbar-thumb:hover { background: #475569; }
20
-
21
- pre { tab-size: 2; }
22
 
 
 
 
23
  @keyframes fadeIn {
24
- from { opacity: 0; transform: translateY(8px); }
25
  to { opacity: 1; transform: translateY(0); }
26
  }
27
- .animate-fade-in { animation: fadeIn 0.4s ease-out; }
28
 
29
  @keyframes shimmer {
30
  0% { background-position: -200% 0; }
31
  100% { background-position: 200% 0; }
32
  }
33
- .animate-shimmer {
34
- background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
35
  background-size: 200% 100%;
36
- animation: shimmer 2s infinite;
 
37
  }
 
1
+ /* ── Fonts ── */
2
+ @import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');
3
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');
4
+
5
  @tailwind base;
6
  @tailwind components;
7
  @tailwind utilities;
8
 
9
+ /* ══════════════════════════════════════════════
10
+ LIGHT MODE (default white + light blue)
11
+ ══════════════════════════════════════════════ */
12
+ :root {
13
+ --cn-bg: #f8fafc;
14
+ --cn-surface: #ffffff;
15
+ --cn-surface-elevated: #f1f5f9;
16
+ --cn-surface-glass: rgba(255,255,255,0.85);
17
+ --cn-border: #e2e8f0;
18
+ --cn-border-strong: #cbd5e1;
19
+ --cn-text: #0f172a;
20
+ --cn-muted: #64748b;
21
+ --cn-accent: #2563eb;
22
+ --cn-accent-hover: #1d4ed8;
23
+ --cn-success: #16a34a;
24
+ --cn-success-bg: rgba(22,163,74,0.08);
25
+ --cn-info: #0891b2;
26
+ --cn-info-bg: rgba(8,145,178,0.08);
27
+ --cn-danger: #dc2626;
28
+ --cn-danger-bg: rgba(220,38,38,0.08);
29
+ --cn-warn: #d97706;
30
+ --cn-warn-bg: rgba(217,119,6,0.08);
31
+ --cn-purple: #7c3aed;
32
+ --cn-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
33
+ --cn-shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
34
+ --cn-shadow-lg: 0 10px 30px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
35
+ }
36
+
37
+ /* ══════════════════════════════════════════════
38
+ DARK MODE
39
+ ══════════════════════════════════════════════ */
40
+ .dark {
41
+ --cn-bg: #0a0f1e;
42
+ --cn-surface: #111827;
43
+ --cn-surface-elevated: #1e2a3d;
44
+ --cn-surface-glass: rgba(17,24,39,0.9);
45
+ --cn-border: #1f3050;
46
+ --cn-border-strong: #2d4470;
47
+ --cn-text: #e2e8f0;
48
+ --cn-muted: #8b9dc3;
49
+ --cn-accent: #3b82f6;
50
+ --cn-accent-hover: #60a5fa;
51
+ --cn-success: #22c55e;
52
+ --cn-success-bg: rgba(34,197,94,0.1);
53
+ --cn-info: #22d3ee;
54
+ --cn-info-bg: rgba(34,211,238,0.1);
55
+ --cn-danger: #f87171;
56
+ --cn-danger-bg: rgba(248,113,113,0.1);
57
+ --cn-warn: #fbbf24;
58
+ --cn-warn-bg: rgba(251,191,36,0.1);
59
+ --cn-purple: #a78bfa;
60
+ --cn-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
61
+ --cn-shadow-md: 0 4px 12px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.2);
62
+ --cn-shadow-lg: 0 10px 30px rgba(0,0,0,0.4), 0 4px 10px rgba(0,0,0,0.25);
63
+ }
64
 
65
+ /* ══════════════════════════════════════════════
66
+ BASE
67
+ ══════════════════════════════════════════════ */
68
  body {
69
+ background-color: var(--cn-bg);
70
+ color: var(--cn-text);
71
+ font-family: 'Inter', sans-serif;
72
  -webkit-font-smoothing: antialiased;
73
  -moz-osx-font-smoothing: grayscale;
74
+ overflow-x: hidden;
75
+ }
76
+
77
+ ::selection { background: rgba(37,99,235,0.15); color: inherit; }
78
+
79
+ /* ══════════════════════════════════════════════
80
+ COMPONENTS
81
+ ══════════════════════════════════════════════ */
82
+ .card {
83
+ background: var(--cn-surface);
84
+ border: 1px solid var(--cn-border);
85
+ border-radius: 0.875rem;
86
+ box-shadow: var(--cn-shadow);
87
+ }
88
+
89
+ .card-glass {
90
+ background: var(--cn-surface-glass);
91
+ backdrop-filter: blur(16px);
92
+ border: 1px solid var(--cn-border);
93
+ border-radius: 0.875rem;
94
+ box-shadow: var(--cn-shadow);
95
+ }
96
+
97
+ .input-base {
98
+ width: 100%;
99
+ border-radius: 0.5rem;
100
+ border: 1px solid var(--cn-border);
101
+ background: var(--cn-surface);
102
+ padding: 0.625rem 0.875rem;
103
+ font-size: 0.875rem;
104
+ color: var(--cn-text);
105
+ outline: none;
106
+ transition: border-color 0.15s, box-shadow 0.15s;
107
+ }
108
+ .input-base::placeholder { color: var(--cn-muted); }
109
+ .input-base:focus {
110
+ border-color: var(--cn-accent);
111
+ box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
112
+ }
113
+
114
+ .btn-primary {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ border-radius: 9999px;
119
+ padding: 0.625rem 1.5rem;
120
+ font-size: 0.875rem;
121
+ font-weight: 600;
122
+ background: var(--cn-accent);
123
+ color: white;
124
+ border: none;
125
+ cursor: pointer;
126
+ transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
127
+ box-shadow: 0 2px 8px rgba(37,99,235,0.25);
128
+ }
129
+ .btn-primary:hover {
130
+ background: var(--cn-accent-hover);
131
+ transform: translateY(-1px);
132
+ box-shadow: 0 4px 16px rgba(37,99,235,0.3);
133
+ }
134
+
135
+ .btn-secondary {
136
+ display: inline-flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ border-radius: 9999px;
140
+ padding: 0.625rem 1.5rem;
141
+ font-size: 0.875rem;
142
+ font-weight: 600;
143
+ background: var(--cn-surface);
144
+ color: var(--cn-text);
145
+ border: 1px solid var(--cn-border);
146
+ cursor: pointer;
147
+ transition: border-color 0.15s, background 0.15s;
148
+ }
149
+ .btn-secondary:hover {
150
+ border-color: var(--cn-border-strong);
151
+ background: var(--cn-surface-elevated);
152
+ }
153
+
154
+ /* ══════════════════════════════════════════════
155
+ LANDING PAGE HELPERS
156
+ ══════════════════════════════════════════════ */
157
+ .glass-nav {
158
+ background: rgba(255,255,255,0.92);
159
+ backdrop-filter: blur(16px);
160
+ border-bottom: 1px solid rgba(0,0,0,0.05);
161
+ }
162
+
163
+ .stripe-hero-bg {
164
+ position: absolute; inset: 0;
165
+ background:
166
+ radial-gradient(circle at 100% 0%, #eef2ff 0%, transparent 40%),
167
+ radial-gradient(circle at 0% 100%, #f0fdf4 0%, transparent 30%);
168
+ }
169
+
170
+ .linear-grid {
171
+ background-size: 40px 40px;
172
+ background-image:
173
+ linear-gradient(to right, rgba(0,0,0,0.03) 1px, transparent 1px),
174
+ linear-gradient(to bottom, rgba(0,0,0,0.03) 1px, transparent 1px);
175
  }
176
 
177
+ .code-window {
178
+ background: #1e1e1e;
179
+ border-radius: 12px;
180
+ box-shadow: 0 20px 50px rgba(0,0,0,0.25);
181
+ border: 1px solid #333;
182
+ font-family: 'JetBrains Mono', monospace;
183
+ overflow: hidden;
184
+ }
185
 
186
+ .code-header {
187
+ background: #2d2d2d;
188
+ padding: 10px 14px;
189
+ display: flex;
190
+ align-items: center;
191
+ gap: 6px;
192
+ border-bottom: 1px solid #3a3a3a;
193
+ }
194
+
195
+ /* ══════════════════════════════════════════════
196
+ SCROLLBAR
197
+ ══════════════════════════════════════════════ */
198
  ::-webkit-scrollbar { width: 6px; height: 6px; }
199
  ::-webkit-scrollbar-track { background: transparent; }
200
+ ::-webkit-scrollbar-thumb { background: var(--cn-border-strong); border-radius: 9999px; }
201
+ ::-webkit-scrollbar-thumb:hover { background: var(--cn-muted); }
 
 
202
 
203
+ /* ══════════════════════════════════════════════
204
+ ANIMATIONS
205
+ ══════════════════════════════════════════════ */
206
  @keyframes fadeIn {
207
+ from { opacity: 0; transform: translateY(6px); }
208
  to { opacity: 1; transform: translateY(0); }
209
  }
210
+ .animate-fade-in { animation: fadeIn 0.3s ease-out; }
211
 
212
  @keyframes shimmer {
213
  0% { background-position: -200% 0; }
214
  100% { background-position: 200% 0; }
215
  }
216
+ .skeleton {
217
+ background: linear-gradient(90deg, var(--cn-surface-elevated) 25%, var(--cn-border) 50%, var(--cn-surface-elevated) 75%);
218
  background-size: 200% 100%;
219
+ animation: shimmer 1.6s infinite;
220
+ border-radius: 0.5rem;
221
  }
frontend/src/pages/AnalyzePage.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
2
 
3
  const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
4
 
@@ -6,7 +6,7 @@ export function AnalyzePage() {
6
  const [code, setCode] = useState('');
7
  const [result, setResult] = useState<any>(null);
8
  const [loading, setLoading] = useState(false);
9
- const [activeView, setActiveView] = useState<'complexity' | 'behaviors' | 'gaps' | 'mutations' | 'security'>('complexity');
10
 
11
  const analyze = async () => {
12
  if (!code.trim()) return;
@@ -14,7 +14,7 @@ export function AnalyzePage() {
14
  try {
15
  const res = await fetch(`${API}/api/v1/generate/multi-agent`, {
16
  method: 'POST', headers: { 'Content-Type': 'application/json' },
17
- body: JSON.stringify({ source_code: code, framework: 'pytest', language: 'python', test_types: ['unit'], max_iterations: 0 }),
18
  });
19
  if (res.ok) setResult(await res.json());
20
  } catch {} finally { setLoading(false); }
@@ -22,122 +22,113 @@ export function AnalyzePage() {
22
 
23
  const complexity = result?.analysis?.complexity;
24
  const gaps = result?.analysis?.gaps;
25
- const mutations = result?.analysis?.mutations;
26
  const behaviors = result?.behavior_coverage;
27
 
28
  return (
29
- <div className="max-w-[1400px] mx-auto px-6 py-6">
30
  <div className="mb-6">
31
- <h1 className="text-xl font-bold">Code Analysis Studio</h1>
32
- <p className="text-xs text-gray-500 mt-0.5">Deep-dive into complexity, behaviors, gaps, and mutations before generating tests</p>
33
  </div>
34
 
35
- <div className="grid lg:grid-cols-[1fr_1.5fr] gap-4">
36
  {/* Input */}
37
- <div className="flex flex-col gap-3">
38
- <textarea value={code} onChange={e => setCode(e.target.value)} placeholder="Paste source code here for deep analysis..."
39
- className="h-[400px] bg-white/[0.015] border border-white/[0.05] rounded-xl p-4 text-[13px] text-gray-200 placeholder-gray-600 resize-none focus:outline-none focus:border-emerald-500/30 font-mono" />
 
40
  <button onClick={analyze} disabled={loading || !code.trim()}
41
- className="py-2.5 rounded-xl bg-gradient-to-r from-blue-600 to-indigo-600 text-white font-semibold text-sm hover:shadow-lg hover:shadow-blue-500/20 transition disabled:opacity-50">
42
  {loading ? '🔬 Analyzing...' : '🔬 Run Deep Analysis'}
43
  </button>
44
  </div>
45
 
46
  {/* Results */}
47
- <div className="bg-white/[0.01] border border-white/[0.04] rounded-xl overflow-hidden">
48
  {result ? (
49
  <>
50
- {/* View Tabs */}
51
- <div className="flex border-b border-white/[0.04] px-3 py-2 gap-1 overflow-x-auto">
52
  {[
53
  { id: 'complexity', label: '🧠 Complexity', count: complexity?.functions?.length },
54
  { id: 'behaviors', label: '📊 Behaviors', count: behaviors?.total_behaviors },
55
  { id: 'gaps', label: '🔍 Gaps', count: gaps?.total_gaps },
56
- { id: 'mutations', label: '🧬 Mutations', count: mutations?.total_mutations },
57
  ].map(v => (
58
  <button key={v.id} onClick={() => setActiveView(v.id as any)}
59
- className={`px-3 py-1.5 rounded-lg text-[11px] font-medium transition whitespace-nowrap ${
60
- activeView === v.id ? 'bg-blue-500/10 text-blue-300 border border-blue-500/20' : 'text-gray-500 hover:text-gray-300'}`}>
61
- {v.label} {v.count !== undefined && <span className="ml-1 text-gray-600">({v.count})</span>}
62
  </button>
63
  ))}
64
  </div>
65
 
66
- <div className="p-4 overflow-auto max-h-[500px]">
67
- {/* Complexity View */}
68
  {activeView === 'complexity' && complexity && (
69
  <div className="space-y-3">
70
- <div className="flex items-center gap-3 mb-4">
71
  <div className={`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold ${
72
- complexity.grade === 'A' ? 'bg-emerald-500/20 text-emerald-300' : complexity.grade === 'B' ? 'bg-blue-500/20 text-blue-300' : 'bg-amber-500/20 text-amber-300'}`}>
73
- {complexity.grade}
74
- </div>
75
  <div>
76
- <div className="text-sm font-semibold text-white">Complexity Grade: {complexity.grade}</div>
77
- <div className="text-xs text-gray-500">Average: {complexity.average} | Suggested tests: {complexity.suggested_total_tests}</div>
78
  </div>
79
  </div>
80
  {complexity.functions?.map((f: any, i: number) => (
81
- <div key={i} className="flex items-center justify-between p-2.5 rounded-lg bg-white/[0.02] border border-white/[0.04]">
82
- <div>
83
- <span className="text-xs font-mono text-white">{f.name}()</span>
84
- <span className="text-[10px] text-gray-500 ml-2">complexity: {f.complexity}</span>
85
- </div>
86
  <div className="flex items-center gap-2">
87
- <span className={`text-[10px] px-2 py-0.5 rounded-full font-medium ${
88
- f.priority === 'HIGH' ? 'bg-red-500/10 text-red-400' : f.priority === 'MEDIUM' ? 'bg-amber-500/10 text-amber-400' : 'bg-green-500/10 text-green-400'}`}>
89
- {f.priority}
90
- </span>
91
- <span className="text-[10px] text-gray-500">{f.suggested_tests} tests</span>
92
  </div>
93
  </div>
94
  ))}
95
  </div>
96
  )}
97
 
98
- {/* Behaviors View */}
99
  {activeView === 'behaviors' && behaviors && (
100
- <div className="space-y-2">
101
  <div className="flex items-center gap-3 mb-4">
102
- <div className="flex-1 h-2 rounded-full bg-white/[0.05] overflow-hidden">
103
- <div className="h-full bg-gradient-to-r from-emerald-500 to-cyan-500" style={{ width: `${behaviors.coverage_pct}%` }} />
104
- </div>
105
- <span className="text-sm font-medium text-white">{behaviors.coverage_pct}%</span>
106
  </div>
107
- <div className="text-xs text-gray-400 mb-3">{behaviors.covered}/{behaviors.total_behaviors} behaviors covered</div>
108
  {behaviors.uncovered_behaviors?.map((b: any, i: number) => (
109
- <div key={i} className="flex items-center gap-2 p-2 rounded-lg bg-red-500/5 border border-red-500/10">
110
- <span className="text-red-400 text-xs">⚠️</span>
111
- <span className="text-xs text-gray-300 flex-1">{b.description}</span>
112
- <span className={`text-[10px] px-1.5 py-0.5 rounded-full ${b.priority === 'critical' ? 'bg-red-500/10 text-red-400' : 'bg-amber-500/10 text-amber-400'}`}>{b.priority}</span>
113
  </div>
114
  ))}
115
  </div>
116
  )}
117
 
118
- {/* Gaps View */}
119
  {activeView === 'gaps' && gaps && (
120
  <div className="space-y-2">
121
- <div className="text-xs text-gray-400 mb-3">Coverage estimate: {gaps.coverage_estimate}% | {gaps.high_priority} high-priority gaps</div>
122
  {gaps.gaps?.map((g: any, i: number) => (
123
- <div key={i} className="flex items-center gap-2 p-2.5 rounded-lg bg-white/[0.02] border border-white/[0.04]">
124
- <span className={`w-1.5 h-1.5 rounded-full ${g.priority === 'HIGH' ? 'bg-red-500' : 'bg-amber-500'}`} />
125
- <span className="text-xs text-gray-300 flex-1 font-mono">{g.desc}</span>
126
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-white/[0.05] text-gray-500">{g.type}</span>
127
  </div>
128
  ))}
129
  </div>
130
  )}
131
 
132
- {/* Mutations View */}
133
  {activeView === 'mutations' && mutations && (
134
- <div className="space-y-2">
135
- <div className="text-xs text-gray-400 mb-3">{mutations.kill_target}</div>
136
- {mutations.mutations?.slice(0, 15).map((m: any, i: number) => (
137
- <div key={i} className="flex items-center gap-2 p-2 rounded-lg bg-white/[0.02] border border-white/[0.04]">
138
- <span className="text-[10px] text-gray-600 font-mono w-8">L{m.line}</span>
139
- <span className="text-xs text-gray-400 flex-1">{m.mutant}</span>
140
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-300">{m.type}</span>
 
 
 
 
141
  </div>
142
  ))}
143
  </div>
@@ -145,10 +136,10 @@ export function AnalyzePage() {
145
  </div>
146
  </>
147
  ) : (
148
- <div className="flex items-center justify-center h-[500px] text-center px-8">
149
- <div>
150
- <div className="text-4xl mb-4 opacity-40">🔬</div>
151
- <p className="text-sm text-gray-500">Paste code and click "Run Deep Analysis" to see complexity, behaviors, gaps, and mutation points.</p>
152
  </div>
153
  </div>
154
  )}
 
1
+ import { useState } from 'react';
2
 
3
  const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
4
 
 
6
  const [code, setCode] = useState('');
7
  const [result, setResult] = useState<any>(null);
8
  const [loading, setLoading] = useState(false);
9
+ const [activeView, setActiveView] = useState<'complexity' | 'behaviors' | 'gaps' | 'mutations'>('complexity');
10
 
11
  const analyze = async () => {
12
  if (!code.trim()) return;
 
14
  try {
15
  const res = await fetch(`${API}/api/v1/generate/multi-agent`, {
16
  method: 'POST', headers: { 'Content-Type': 'application/json' },
17
+ body: JSON.stringify({ source_code: code, framework: 'pytest', language: 'python', test_types: ['unit'], max_iterations: 1 }),
18
  });
19
  if (res.ok) setResult(await res.json());
20
  } catch {} finally { setLoading(false); }
 
22
 
23
  const complexity = result?.analysis?.complexity;
24
  const gaps = result?.analysis?.gaps;
25
+ const mutations = result?.mutation_testing;
26
  const behaviors = result?.behavior_coverage;
27
 
28
  return (
29
+ <div className="max-w-7xl mx-auto px-6 py-8">
30
  <div className="mb-6">
31
+ <h1 className="text-2xl font-bold text-slate-900">Code Analysis Studio</h1>
32
+ <p className="text-slate-500 text-sm mt-1">Deep-dive into complexity, behaviors, gaps, and mutations</p>
33
  </div>
34
 
35
+ <div className="grid lg:grid-cols-[1fr_1.5fr] gap-6">
36
  {/* Input */}
37
+ <div className="flex flex-col gap-4">
38
+ <textarea value={code} onChange={e => setCode(e.target.value)}
39
+ placeholder="Paste source code here for deep analysis..."
40
+ className="input-base min-h-[400px] resize-none font-mono text-sm" />
41
  <button onClick={analyze} disabled={loading || !code.trim()}
42
+ className={`btn-primary h-11 text-sm w-full ${loading ? 'opacity-60' : ''}`}>
43
  {loading ? '🔬 Analyzing...' : '🔬 Run Deep Analysis'}
44
  </button>
45
  </div>
46
 
47
  {/* Results */}
48
+ <div className="card overflow-hidden min-h-[460px] flex flex-col">
49
  {result ? (
50
  <>
51
+ {/* Tabs */}
52
+ <div className="flex border-b border-slate-100 px-4 py-2 gap-1">
53
  {[
54
  { id: 'complexity', label: '🧠 Complexity', count: complexity?.functions?.length },
55
  { id: 'behaviors', label: '📊 Behaviors', count: behaviors?.total_behaviors },
56
  { id: 'gaps', label: '🔍 Gaps', count: gaps?.total_gaps },
57
+ { id: 'mutations', label: '🧬 Mutations', count: mutations?.total_mutants },
58
  ].map(v => (
59
  <button key={v.id} onClick={() => setActiveView(v.id as any)}
60
+ className={`px-3 py-1.5 rounded-lg text-xs font-medium transition ${
61
+ activeView === v.id ? 'bg-blue-50 text-blue-700 border border-blue-100' : 'text-slate-500 hover:text-slate-700'}`}>
62
+ {v.label} {v.count !== undefined && <span className="ml-1 text-slate-400">({v.count})</span>}
63
  </button>
64
  ))}
65
  </div>
66
 
67
+ <div className="p-5 overflow-auto flex-1">
 
68
  {activeView === 'complexity' && complexity && (
69
  <div className="space-y-3">
70
+ <div className="flex items-center gap-3 mb-5">
71
  <div className={`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold ${
72
+ complexity.grade === 'A' ? 'bg-green-50 text-green-700' : complexity.grade === 'B' ? 'bg-blue-50 text-blue-700' : 'bg-amber-50 text-amber-700'}`}>{complexity.grade}</div>
 
 
73
  <div>
74
+ <div className="text-sm font-semibold text-slate-900">Complexity Grade: {complexity.grade}</div>
75
+ <div className="text-xs text-slate-500">Average: {complexity.average} | Suggested: {complexity.suggested_total_tests} tests</div>
76
  </div>
77
  </div>
78
  {complexity.functions?.map((f: any, i: number) => (
79
+ <div key={i} className="flex items-center justify-between p-3 rounded-lg border border-slate-100 bg-slate-50/50">
80
+ <div><span className="text-sm font-mono text-slate-800">{f.name}()</span><span className="text-xs text-slate-400 ml-2">complexity: {f.complexity}</span></div>
 
 
 
81
  <div className="flex items-center gap-2">
82
+ <span className={`text-[10px] px-2 py-0.5 rounded-full font-semibold ${f.priority === 'HIGH' ? 'bg-red-50 text-red-700' : f.priority === 'MEDIUM' ? 'bg-amber-50 text-amber-700' : 'bg-green-50 text-green-700'}`}>{f.priority}</span>
83
+ <span className="text-xs text-slate-400">{f.suggested_tests} tests</span>
 
 
 
84
  </div>
85
  </div>
86
  ))}
87
  </div>
88
  )}
89
 
 
90
  {activeView === 'behaviors' && behaviors && (
91
+ <div className="space-y-3">
92
  <div className="flex items-center gap-3 mb-4">
93
+ <div className="flex-1 h-2 rounded-full bg-slate-100 overflow-hidden"><div className="h-full bg-blue-600 rounded-full" style={{ width: `${behaviors.coverage_pct}%` }} /></div>
94
+ <span className="text-sm font-semibold text-slate-900">{behaviors.coverage_pct}%</span>
 
 
95
  </div>
96
+ <p className="text-xs text-slate-500 mb-3">{behaviors.covered}/{behaviors.total_behaviors} behaviors covered</p>
97
  {behaviors.uncovered_behaviors?.map((b: any, i: number) => (
98
+ <div key={i} className="flex items-center gap-2 p-3 rounded-lg border border-red-100 bg-red-50/50">
99
+ <span className="text-red-600 text-xs">⚠️</span>
100
+ <span className="text-sm text-slate-700 flex-1">{b.description}</span>
101
+ <span className={`text-[10px] px-2 py-0.5 rounded-full font-semibold ${b.priority === 'critical' ? 'bg-red-100 text-red-700' : 'bg-amber-100 text-amber-700'}`}>{b.priority}</span>
102
  </div>
103
  ))}
104
  </div>
105
  )}
106
 
 
107
  {activeView === 'gaps' && gaps && (
108
  <div className="space-y-2">
109
+ <p className="text-xs text-slate-500 mb-3">Coverage estimate: {gaps.coverage_estimate}% | {gaps.high_priority} high-priority gaps</p>
110
  {gaps.gaps?.map((g: any, i: number) => (
111
+ <div key={i} className="flex items-center gap-3 p-3 rounded-lg border border-slate-100">
112
+ <span className={`w-2 h-2 rounded-full ${g.priority === 'HIGH' ? 'bg-red-500' : 'bg-amber-500'}`} />
113
+ <span className="text-sm text-slate-700 flex-1 font-mono">{g.desc}</span>
114
+ <span className="text-[10px] px-2 py-0.5 rounded bg-slate-100 text-slate-500">{g.type}</span>
115
  </div>
116
  ))}
117
  </div>
118
  )}
119
 
 
120
  {activeView === 'mutations' && mutations && (
121
+ <div className="space-y-3">
122
+ <div className="grid grid-cols-3 gap-3 mb-4">
123
+ <div className="p-3 rounded-lg bg-green-50 border border-green-100 text-center"><div className="text-xl font-bold text-green-700">{mutations.killed}</div><div className="text-[10px] text-green-600">Killed</div></div>
124
+ <div className="p-3 rounded-lg bg-red-50 border border-red-100 text-center"><div className="text-xl font-bold text-red-700">{mutations.survived}</div><div className="text-[10px] text-red-600">Survived</div></div>
125
+ <div className="p-3 rounded-lg bg-blue-50 border border-blue-100 text-center"><div className="text-xl font-bold text-blue-700">{mutations.mutation_score}%</div><div className="text-[10px] text-blue-600">Score</div></div>
126
+ </div>
127
+ {mutations.surviving_mutants?.map((m: any, i: number) => (
128
+ <div key={i} className="flex items-center gap-3 p-3 rounded-lg border border-slate-100">
129
+ <span className="text-xs text-slate-400 font-mono w-8">L{m.line}</span>
130
+ <span className="text-sm text-slate-700 flex-1">{m.description}</span>
131
+ <span className="text-[10px] px-2 py-0.5 rounded bg-purple-50 text-purple-700">{m.type}</span>
132
  </div>
133
  ))}
134
  </div>
 
136
  </div>
137
  </>
138
  ) : (
139
+ <div className="flex-1 flex items-center justify-center">
140
+ <div className="text-center px-8">
141
+ <div className="text-4xl mb-4 opacity-30">🔬</div>
142
+ <p className="text-sm text-slate-500">Paste code and run analysis to see complexity, behaviors, gaps, and mutations.</p>
143
  </div>
144
  </div>
145
  )}
frontend/src/pages/GeneratePage.tsx CHANGED
@@ -1,23 +1,22 @@
1
- import React, { useState } from 'react';
2
 
3
  const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
4
 
5
  const TABS = [
6
- { id: 'requirements', label: 'Requirements', icon: '📝', placeholder: 'Paste product requirements, user stories, acceptance criteria...\n\nExample:\n• User can register with email + password\n• Password: 8+ chars, uppercase, lowercase, number\n• Email must be unique in system\n• Send verification email on signup\n• Rate limit: max 5 signup attempts per IP per hour\n• Account locked after 5 failed login attempts' },
7
- { id: 'api', label: 'API Spec', icon: '🔌', placeholder: 'Paste OpenAPI/Swagger JSON specification...\n\n{\n "openapi": "3.0.0",\n "info": { "title": "User API" },\n "paths": {\n "/users": { "post": { "summary": "Create user" } }\n }\n}' },
8
- { id: 'code', label: 'Source Code', icon: '💻', placeholder: 'Paste Python/JS/TS/Go source code...\n\ndef calculate_discount(price, user_type, coupon=None):\n if price <= 0:\n raise ValueError("Price must be positive")\n discount = 0\n if user_type == "premium":\n discount = 0.2\n elif user_type == "member":\n discount = 0.1\n if coupon and coupon.is_valid():\n discount += coupon.value\n return min(discount, 0.5) * price' },
9
- { id: 'flow', label: 'User Flow', icon: '🖥️', placeholder: 'Describe the frontend user flow...\n\nCheckout Flow:\n1. User reviews cart items (quantity editable)\n2. Enters shipping address (with autocomplete)\n3. Selects shipping method (standard/express)\n4. Enters payment (card number, expiry, CVV)\n5. Reviews order summary\n6. Clicks "Place Order"\n7. Shows confirmation with order number\n8. Sends confirmation email' },
10
  ];
11
 
12
  const FRAMEWORKS: Record<string, string[]> = {
13
  python: ['pytest', 'unittest'],
14
  javascript: ['jest', 'mocha', 'cypress', 'playwright'],
15
  typescript: ['jest', 'vitest', 'playwright'],
16
- go: ['go_testing'],
17
  };
18
 
19
  export function GeneratePage() {
20
- const [tab, setTab] = useState('requirements');
21
  const [input, setInput] = useState('');
22
  const [lang, setLang] = useState('python');
23
  const [framework, setFramework] = useState('pytest');
@@ -27,191 +26,137 @@ export function GeneratePage() {
27
  const [loading, setLoading] = useState(false);
28
  const [error, setError] = useState('');
29
  const [activeFile, setActiveFile] = useState(0);
30
- const [stage, setStage] = useState('');
31
 
32
  const generate = async () => {
33
  if (!input.trim()) return;
34
- setLoading(true); setError(''); setResult(null); setStage('Analyzing input...');
35
-
36
  try {
37
- const endpoint = useMultiAgent ? '/api/v1/generate/multi-agent' : `/api/v1/generate/from-${tab === 'api' ? 'api-spec' : tab === 'flow' ? 'flow' : tab}`;
38
-
39
  let body: any = { framework, language: lang, test_types: testTypes };
40
  if (useMultiAgent) {
41
- body = { ...body, max_iterations: 2 };
42
  if (tab === 'requirements') body.requirements = input;
43
  else if (tab === 'api') body.openapi_spec = JSON.parse(input);
44
  else if (tab === 'code') body.source_code = input;
45
- else body.requirements = input; // flow as requirements for multi-agent
46
  } else {
47
  if (tab === 'requirements') body.requirements = input;
48
  else if (tab === 'api') body.openapi_spec = JSON.parse(input);
49
- else if (tab === 'code') { body.source_code = input; body.filename = `source.${lang === 'python' ? 'py' : 'ts'}`; }
50
  else body.flow_description = input;
51
  }
52
-
53
- setStage(useMultiAgent ? 'Running 5-agent pipeline...' : 'Generating tests...');
54
  const res = await fetch(`${API}${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
55
-
56
  if (!res.ok) throw new Error((await res.json()).detail || `Error ${res.status}`);
57
- const data = await res.json();
58
- setResult(data); setActiveFile(0);
59
-
60
- // Save history
61
- const h = JSON.parse(localStorage.getItem('tg_history') || '[]');
62
- h.unshift({ ...data, _input: input.slice(0, 150), _tab: tab, _time: Date.now() });
63
- localStorage.setItem('tg_history', JSON.stringify(h.slice(0, 30)));
64
- } catch (e: any) { setError(e.message); } finally { setLoading(false); setStage(''); }
65
  };
66
 
67
- const currentTab = TABS.find(t => t.id === tab)!;
68
  const testFiles = result?.test_files || [];
69
  const quality = result?.quality;
70
  const coverage = result?.behavior_coverage;
71
 
72
  return (
73
- <div className="max-w-[1400px] mx-auto px-6 py-6">
74
- {/* Top Controls */}
75
- <div className="flex items-center justify-between mb-5">
76
- <div>
77
- <h1 className="text-xl font-bold">Test Generation Studio</h1>
78
- <p className="text-xs text-gray-500 mt-0.5">Multi-agent AI pipeline • Iterative refinement • Behavior coverage</p>
79
- </div>
80
- <div className="flex items-center gap-3">
81
- {/* Multi-agent toggle */}
82
- <label className="flex items-center gap-2 cursor-pointer">
83
- <input type="checkbox" checked={useMultiAgent} onChange={e => setUseMultiAgent(e.target.checked)}
84
- className="w-4 h-4 rounded bg-white/5 border-white/10 text-emerald-500 focus:ring-emerald-500/20" />
85
- <span className="text-xs text-gray-400">🧠 Multi-Agent Mode</span>
86
- </label>
87
- {/* Language */}
88
- <select value={lang} onChange={e => { setLang(e.target.value); setFramework(FRAMEWORKS[e.target.value][0]); }}
89
- className="bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-1.5 text-xs text-white focus:border-emerald-500/40 focus:outline-none">
90
- {Object.keys(FRAMEWORKS).map(l => <option key={l} value={l}>{l}</option>)}
91
- </select>
92
- {/* Framework */}
93
- <select value={framework} onChange={e => setFramework(e.target.value)}
94
- className="bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-1.5 text-xs text-white focus:border-emerald-500/40 focus:outline-none">
95
- {(FRAMEWORKS[lang] || []).map(f => <option key={f} value={f}>{f}</option>)}
96
- </select>
97
- </div>
98
  </div>
99
 
100
- {/* Main Split */}
101
- <div className="grid lg:grid-cols-[1fr_1.2fr] gap-4 h-[calc(100vh-160px)]">
102
  {/* LEFT: Input */}
103
- <div className="flex flex-col min-h-0">
104
- {/* Input Tabs */}
105
- <div className="flex gap-1 mb-3">
106
  {TABS.map(t => (
107
  <button key={t.id} onClick={() => { setTab(t.id); setInput(''); }}
108
- className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[12px] font-medium transition-all ${
109
- tab === t.id ? 'bg-emerald-500/10 text-emerald-300 border border-emerald-500/20 shadow-sm shadow-emerald-500/5' : 'text-gray-500 hover:text-gray-300 border border-transparent'}`}>
110
- <span>{t.icon}</span>{t.label}
111
- </button>
112
  ))}
113
  </div>
114
 
115
- {/* Test Type Pills */}
116
- <div className="flex flex-wrap gap-1.5 mb-3">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  {['unit', 'integration', 'edge_case', 'security', 'e2e'].map(t => (
118
  <button key={t} onClick={() => setTestTypes(testTypes.includes(t) ? testTypes.filter(x => x !== t) : [...testTypes, t])}
119
- className={`px-2.5 py-1 rounded-full text-[11px] font-medium transition-all ${
120
- testTypes.includes(t) ? 'bg-emerald-500/15 text-emerald-300 border border-emerald-500/20' : 'bg-white/[0.02] text-gray-600 border border-white/[0.04] hover:border-white/[0.08]'}`}>
121
- {t.replace('_', ' ')}
122
- </button>
123
  ))}
124
  </div>
125
 
126
  {/* Textarea */}
127
- <textarea value={input} onChange={e => setInput(e.target.value)} placeholder={currentTab.placeholder}
128
- className="flex-1 bg-white/[0.015] border border-white/[0.05] rounded-xl p-4 text-[13px] text-gray-200 placeholder-gray-600 resize-none focus:outline-none focus:border-emerald-500/30 font-mono leading-relaxed transition" />
 
129
 
130
- {/* Generate Button */}
131
  <button onClick={generate} disabled={loading || !input.trim()}
132
- className={`mt-3 py-3 rounded-xl font-semibold text-[14px] transition-all ${
133
- loading ? 'bg-white/[0.03] text-gray-500 border border-white/[0.05]' :
134
- 'bg-gradient-to-r from-emerald-600 to-cyan-600 text-white shadow-lg shadow-emerald-500/20 hover:shadow-emerald-500/30 hover:scale-[1.01]'}`}>
135
- {loading ? `⏳ ${stage}` : useMultiAgent ? '🧠 Run Multi-Agent Pipeline' : '⚡ Generate Tests'}
136
  </button>
137
- {error && <p className="mt-2 text-red-400 text-xs bg-red-500/5 px-3 py-2 rounded-lg border border-red-500/10">{error}</p>}
138
  </div>
139
 
140
  {/* RIGHT: Output */}
141
- <div className="flex flex-col min-h-0 bg-white/[0.01] border border-white/[0.04] rounded-xl overflow-hidden">
142
  {result ? (
143
  <>
144
- {/* Quality + Coverage Bar */}
145
- <div className="flex items-center justify-between px-4 py-2.5 border-b border-white/[0.04] bg-white/[0.02]">
146
  <div className="flex items-center gap-4">
147
  {quality && (
148
  <div className="flex items-center gap-2">
149
- <div className={`w-7 h-7 rounded-lg flex items-center justify-center text-xs font-bold ${
150
- quality.grade === 'A' ? 'bg-emerald-500/20 text-emerald-300' :
151
- quality.grade === 'B' ? 'bg-blue-500/20 text-blue-300' :
152
- quality.grade === 'C' ? 'bg-amber-500/20 text-amber-300' : 'bg-red-500/20 text-red-300'}`}>
153
- {quality.grade}
154
- </div>
155
- <span className="text-[11px] text-gray-500">Quality {quality.overall}%</span>
156
  </div>
157
  )}
158
- {coverage && (
159
- <div className="flex items-center gap-2">
160
- <div className="w-16 h-1.5 rounded-full bg-white/[0.05] overflow-hidden">
161
- <div className="h-full bg-gradient-to-r from-emerald-500 to-cyan-500 rounded-full" style={{ width: `${coverage.coverage_pct}%` }} />
162
- </div>
163
- <span className="text-[11px] text-gray-500">{coverage.coverage_pct}% behaviors</span>
164
- </div>
165
- )}
166
- <span className="text-[11px] text-gray-600">{result.processing_time_ms?.toFixed(0)}ms</span>
167
  </div>
168
  <button onClick={() => navigator.clipboard.writeText(testFiles[activeFile]?.code || '')}
169
- className="px-3 py-1 rounded-lg bg-emerald-500/10 text-emerald-400 text-[11px] font-medium hover:bg-emerald-500/20 transition">
170
- Copy Code
171
- </button>
172
  </div>
173
 
174
- {/* Iteration badge */}
175
- {result.iterations_performed > 0 && (
176
- <div className="px-4 py-1.5 border-b border-white/[0.03] flex items-center gap-2">
177
- <span className="text-[10px] px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-300 border border-purple-500/20">
178
- 🔄 {result.iterations_performed} refinement iterations
179
- </span>
180
- {coverage?.uncovered_behaviors?.length > 0 && (
181
- <span className="text-[10px] px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-300 border border-amber-500/20">
182
- ⚠️ {coverage.uncovered} untested behaviors
183
- </span>
184
- )}
185
- </div>
186
- )}
187
-
188
- {/* File Tabs */}
189
  {testFiles.length > 1 && (
190
- <div className="flex px-3 py-1.5 border-b border-white/[0.03] gap-1 overflow-x-auto">
191
  {testFiles.map((f: any, i: number) => (
192
  <button key={i} onClick={() => setActiveFile(i)}
193
- className={`px-2.5 py-1 rounded-md text-[11px] whitespace-nowrap transition ${
194
- i === activeFile ? 'bg-emerald-500/10 text-emerald-300' : 'text-gray-600 hover:text-gray-400'}`}>
195
- {f.filename} <span className="text-gray-600 ml-1">({f.num_tests})</span>
196
  </button>
197
  ))}
198
  </div>
199
  )}
200
 
201
  {/* Code */}
202
- <pre className="flex-1 overflow-auto p-4 text-[12px] text-gray-300 font-mono leading-[1.7] selection:bg-emerald-500/20">
203
  {testFiles[activeFile]?.code || result.test_code || 'No code generated'}
204
  </pre>
205
  </>
206
  ) : (
207
  <div className="flex-1 flex items-center justify-center">
208
  <div className="text-center px-8">
209
- <div className="text-5xl mb-5 opacity-50">🧪</div>
210
- <h3 className="text-base font-medium text-white/80 mb-2">Ready to Generate</h3>
211
- <p className="text-[13px] text-gray-500 max-w-sm leading-relaxed">
212
- Paste your input, select test types, and click generate.
213
- {useMultiAgent && <span className="block mt-1 text-emerald-400/60">Multi-agent mode: tests will be iteratively refined for higher quality.</span>}
214
- </p>
215
  </div>
216
  </div>
217
  )}
 
1
+ import { useState } from 'react';
2
 
3
  const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
4
 
5
  const TABS = [
6
+ { id: 'requirements', label: 'Requirements', icon: '📝' },
7
+ { id: 'api', label: 'API Spec', icon: '🔌' },
8
+ { id: 'code', label: 'Source Code', icon: '💻' },
9
+ { id: 'flow', label: 'User Flow', icon: '🖥️' },
10
  ];
11
 
12
  const FRAMEWORKS: Record<string, string[]> = {
13
  python: ['pytest', 'unittest'],
14
  javascript: ['jest', 'mocha', 'cypress', 'playwright'],
15
  typescript: ['jest', 'vitest', 'playwright'],
 
16
  };
17
 
18
  export function GeneratePage() {
19
+ const [tab, setTab] = useState('code');
20
  const [input, setInput] = useState('');
21
  const [lang, setLang] = useState('python');
22
  const [framework, setFramework] = useState('pytest');
 
26
  const [loading, setLoading] = useState(false);
27
  const [error, setError] = useState('');
28
  const [activeFile, setActiveFile] = useState(0);
 
29
 
30
  const generate = async () => {
31
  if (!input.trim()) return;
32
+ setLoading(true); setError(''); setResult(null);
 
33
  try {
34
+ const endpoint = useMultiAgent ? '/api/v1/generate/multi-agent' : `/api/v1/generate/from-${tab === 'api' ? 'api-spec' : tab === 'flow' ? 'flow' : tab === 'requirements' ? 'requirements' : 'code'}`;
 
35
  let body: any = { framework, language: lang, test_types: testTypes };
36
  if (useMultiAgent) {
37
+ body.max_iterations = 3;
38
  if (tab === 'requirements') body.requirements = input;
39
  else if (tab === 'api') body.openapi_spec = JSON.parse(input);
40
  else if (tab === 'code') body.source_code = input;
41
+ else body.requirements = input;
42
  } else {
43
  if (tab === 'requirements') body.requirements = input;
44
  else if (tab === 'api') body.openapi_spec = JSON.parse(input);
45
+ else if (tab === 'code') { body.source_code = input; body.filename = 'source.py'; }
46
  else body.flow_description = input;
47
  }
 
 
48
  const res = await fetch(`${API}${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
 
49
  if (!res.ok) throw new Error((await res.json()).detail || `Error ${res.status}`);
50
+ setResult(await res.json()); setActiveFile(0);
51
+ } catch (e: any) { setError(e.message); } finally { setLoading(false); }
 
 
 
 
 
 
52
  };
53
 
 
54
  const testFiles = result?.test_files || [];
55
  const quality = result?.quality;
56
  const coverage = result?.behavior_coverage;
57
 
58
  return (
59
+ <div className="max-w-7xl mx-auto px-6 py-8">
60
+ {/* Header */}
61
+ <div className="mb-6">
62
+ <h1 className="text-2xl font-bold text-slate-900">Test Generation Studio</h1>
63
+ <p className="text-slate-500 text-sm mt-1">Multi-agent AI pipeline • Iterative refinement • Behavior coverage</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  </div>
65
 
66
+ <div className="grid lg:grid-cols-[1fr_1.2fr] gap-6">
 
67
  {/* LEFT: Input */}
68
+ <div className="flex flex-col gap-4">
69
+ {/* Tabs */}
70
+ <div className="flex gap-2">
71
  {TABS.map(t => (
72
  <button key={t.id} onClick={() => { setTab(t.id); setInput(''); }}
73
+ className={`px-3 py-2 rounded-lg text-sm font-medium transition-all ${
74
+ tab === t.id ? 'bg-blue-50 text-blue-700 border border-blue-100' : 'text-slate-500 hover:text-slate-900 hover:bg-slate-50 border border-transparent'
75
+ }`}>{t.icon} {t.label}</button>
 
76
  ))}
77
  </div>
78
 
79
+ {/* Config row */}
80
+ <div className="flex items-center gap-3 flex-wrap">
81
+ <select value={lang} onChange={e => { setLang(e.target.value); setFramework(FRAMEWORKS[e.target.value]?.[0] || 'pytest'); }}
82
+ className="input-base w-auto">
83
+ {Object.keys(FRAMEWORKS).map(l => <option key={l} value={l}>{l}</option>)}
84
+ </select>
85
+ <select value={framework} onChange={e => setFramework(e.target.value)} className="input-base w-auto">
86
+ {(FRAMEWORKS[lang] || []).map(f => <option key={f} value={f}>{f}</option>)}
87
+ </select>
88
+ <label className="flex items-center gap-2 text-sm text-slate-600 cursor-pointer ml-auto">
89
+ <input type="checkbox" checked={useMultiAgent} onChange={e => setUseMultiAgent(e.target.checked)} className="w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500" />
90
+ 🧠 Multi-Agent
91
+ </label>
92
+ </div>
93
+
94
+ {/* Test type pills */}
95
+ <div className="flex flex-wrap gap-2">
96
  {['unit', 'integration', 'edge_case', 'security', 'e2e'].map(t => (
97
  <button key={t} onClick={() => setTestTypes(testTypes.includes(t) ? testTypes.filter(x => x !== t) : [...testTypes, t])}
98
+ className={`px-3 py-1 rounded-full text-xs font-medium border transition-all ${
99
+ testTypes.includes(t) ? 'bg-blue-50 text-blue-700 border-blue-200' : 'bg-white text-slate-500 border-slate-200 hover:border-slate-300'
100
+ }`}>{t.replace('_', ' ')}</button>
 
101
  ))}
102
  </div>
103
 
104
  {/* Textarea */}
105
+ <textarea value={input} onChange={e => setInput(e.target.value)}
106
+ placeholder={tab === 'code' ? 'Paste source code here...' : tab === 'api' ? 'Paste OpenAPI JSON spec...' : tab === 'flow' ? 'Describe user flow...' : 'Paste requirements...'}
107
+ className="input-base flex-1 min-h-[300px] resize-none font-mono text-sm leading-relaxed" />
108
 
109
+ {/* Generate button */}
110
  <button onClick={generate} disabled={loading || !input.trim()}
111
+ className={`btn-primary h-12 text-base w-full ${loading ? 'opacity-60 cursor-wait' : ''}`}>
112
+ {loading ? '⏳ Generating...' : useMultiAgent ? '🧠 Run Multi-Agent Pipeline' : '⚡ Generate Tests'}
 
 
113
  </button>
114
+ {error && <p className="text-red-600 text-sm bg-red-50 px-4 py-2 rounded-lg border border-red-100">{error}</p>}
115
  </div>
116
 
117
  {/* RIGHT: Output */}
118
+ <div className="card min-h-[500px] flex flex-col overflow-hidden">
119
  {result ? (
120
  <>
121
+ {/* Top bar */}
122
+ <div className="flex items-center justify-between px-5 py-3 border-b border-slate-100 bg-slate-50/50">
123
  <div className="flex items-center gap-4">
124
  {quality && (
125
  <div className="flex items-center gap-2">
126
+ <div className={`w-8 h-8 rounded-lg flex items-center justify-center text-sm font-bold ${
127
+ quality.grade === 'A' ? 'bg-green-50 text-green-700' : quality.grade === 'B' ? 'bg-blue-50 text-blue-700' : 'bg-amber-50 text-amber-700'}`}>{quality.grade}</div>
128
+ <span className="text-xs text-slate-500">{quality.overall}%</span>
 
 
 
 
129
  </div>
130
  )}
131
+ {coverage && <span className="text-xs text-slate-500">{coverage.coverage_pct}% behaviors covered</span>}
 
 
 
 
 
 
 
 
132
  </div>
133
  <button onClick={() => navigator.clipboard.writeText(testFiles[activeFile]?.code || '')}
134
+ className="px-3 py-1.5 rounded-lg bg-blue-50 text-blue-700 text-xs font-medium hover:bg-blue-100 transition">Copy</button>
 
 
135
  </div>
136
 
137
+ {/* File tabs */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  {testFiles.length > 1 && (
139
+ <div className="flex px-4 py-2 border-b border-slate-100 gap-1 overflow-x-auto">
140
  {testFiles.map((f: any, i: number) => (
141
  <button key={i} onClick={() => setActiveFile(i)}
142
+ className={`px-3 py-1 rounded text-xs font-medium transition ${i === activeFile ? 'bg-blue-50 text-blue-700' : 'text-slate-500 hover:text-slate-700'}`}>
143
+ {f.filename} ({f.num_tests})
 
144
  </button>
145
  ))}
146
  </div>
147
  )}
148
 
149
  {/* Code */}
150
+ <pre className="flex-1 overflow-auto p-5 text-sm text-slate-800 font-mono leading-[1.7] bg-white">
151
  {testFiles[activeFile]?.code || result.test_code || 'No code generated'}
152
  </pre>
153
  </>
154
  ) : (
155
  <div className="flex-1 flex items-center justify-center">
156
  <div className="text-center px-8">
157
+ <div className="text-5xl mb-5 opacity-30">🧪</div>
158
+ <h3 className="text-lg font-semibold text-slate-700 mb-2">Ready to Generate</h3>
159
+ <p className="text-sm text-slate-500 max-w-sm">Paste your input and click generate. {useMultiAgent && <span className="text-blue-600">Multi-agent mode will iteratively refine for higher quality.</span>}</p>
 
 
 
160
  </div>
161
  </div>
162
  )}
frontend/src/pages/HistoryPage.tsx CHANGED
@@ -1,66 +1,63 @@
1
- import React, { useState, useEffect } from 'react';
2
 
3
  export function HistoryPage() {
4
  const [history, setHistory] = useState<any[]>([]);
5
  const [selected, setSelected] = useState<any>(null);
6
 
7
- useEffect(() => { setHistory(JSON.parse(localStorage.getItem('tg_history') || '[]')); }, []);
8
-
9
- const timeAgo = (ts: number) => {
10
- const d = Date.now() - ts;
11
- if (d < 60000) return 'just now';
12
- if (d < 3600000) return `${Math.floor(d/60000)}m ago`;
13
- if (d < 86400000) return `${Math.floor(d/3600000)}h ago`;
14
- return `${Math.floor(d/86400000)}d ago`;
15
- };
16
 
17
  return (
18
- <div className="max-w-[1400px] mx-auto px-6 py-6">
19
- <div className="flex items-center justify-between mb-6">
20
- <div><h1 className="text-xl font-bold">Generation History</h1><p className="text-xs text-gray-500 mt-0.5">{history.length} runs saved locally</p></div>
21
- {history.length > 0 && <button onClick={() => { localStorage.removeItem('tg_history'); setHistory([]); setSelected(null); }} className="px-3 py-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg hover:bg-red-500/5 transition">Clear All</button>}
22
  </div>
23
 
24
  {history.length === 0 ? (
25
- <div className="text-center py-24"><div className="text-4xl mb-4 opacity-30">📋</div><p className="text-gray-500 text-sm">No history yet. Generate some tests first.</p></div>
 
 
 
26
  ) : (
27
- <div className="grid lg:grid-cols-[280px_1fr] gap-4 h-[calc(100vh-180px)]">
28
- <div className="space-y-1.5 overflow-y-auto pr-2">
 
29
  {history.map((item, i) => (
30
  <button key={i} onClick={() => setSelected(item)}
31
- className={`w-full text-left p-3 rounded-xl border transition-all ${selected === item ? 'bg-emerald-500/5 border-emerald-500/20' : 'bg-white/[0.01] border-white/[0.04] hover:border-white/[0.08]'}`}>
32
- <div className="flex items-center justify-between mb-1">
33
- <span className="text-[10px] font-mono text-emerald-400/70">{item.run_id || item.test_suite_id || '—'}</span>
34
- <span className="text-[10px] text-gray-600">{timeAgo(item._time)}</span>
35
- </div>
36
- <div className="text-[11px] text-gray-400 truncate">{item._input || '(no preview)'}</div>
37
- <div className="flex items-center gap-2 mt-1.5">
38
- <span className="text-[10px] px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400">{item._tab}</span>
39
- {item.quality && <span className="text-[10px] px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-400">Grade {item.quality.grade}</span>}
40
- {item.behavior_coverage && <span className="text-[10px] text-gray-500">{item.behavior_coverage.coverage_pct}%</span>}
41
  </div>
42
  </button>
43
  ))}
44
  </div>
45
 
46
- <div className="bg-white/[0.01] border border-white/[0.04] rounded-xl overflow-hidden flex flex-col">
 
47
  {selected ? (
48
  <>
49
- <div className="flex items-center justify-between px-4 py-2.5 border-b border-white/[0.04]">
50
- <div className="flex items-center gap-3">
51
- {selected.quality && <span className={`text-xs font-bold px-2 py-0.5 rounded ${selected.quality.grade === 'A' ? 'bg-emerald-500/10 text-emerald-300' : 'bg-blue-500/10 text-blue-300'}`}>Grade {selected.quality.grade}</span>}
52
- <span className="text-[11px] text-gray-500">{selected.processing_time_ms?.toFixed(0)}ms</span>
53
- {selected.iterations_performed > 0 && <span className="text-[11px] text-purple-400">🔄 {selected.iterations_performed} iterations</span>}
54
- </div>
55
  <button onClick={() => navigator.clipboard.writeText(selected.test_files?.[0]?.code || selected.test_code || '')}
56
- className="px-3 py-1 text-[11px] bg-emerald-500/10 text-emerald-400 rounded-lg hover:bg-emerald-500/20 transition">Copy</button>
57
  </div>
58
- <pre className="flex-1 overflow-auto p-4 text-[12px] text-gray-300 font-mono leading-[1.7]">
59
- {selected.test_files?.[0]?.code || selected.test_code || 'No code available'}
60
  </pre>
61
  </>
62
  ) : (
63
- <div className="flex-1 flex items-center justify-center text-gray-500 text-sm">Select a run to view</div>
64
  )}
65
  </div>
66
  </div>
 
1
+ import { useState, useEffect } from 'react';
2
 
3
  export function HistoryPage() {
4
  const [history, setHistory] = useState<any[]>([]);
5
  const [selected, setSelected] = useState<any>(null);
6
 
7
+ useEffect(() => {
8
+ const h = JSON.parse(localStorage.getItem('tg_history') || '[]');
9
+ setHistory(h);
10
+ if (h.length) setSelected(h[0]);
11
+ }, []);
 
 
 
 
12
 
13
  return (
14
+ <div className="max-w-7xl mx-auto px-6 py-8">
15
+ <div className="mb-6">
16
+ <h1 className="text-2xl font-bold text-slate-900">Generation History</h1>
17
+ <p className="text-slate-500 text-sm mt-1">Previous test generation runs (stored locally)</p>
18
  </div>
19
 
20
  {history.length === 0 ? (
21
+ <div className="card p-12 text-center">
22
+ <div className="text-4xl mb-4 opacity-30">📋</div>
23
+ <p className="text-slate-500">No history yet. Generate some tests first!</p>
24
+ </div>
25
  ) : (
26
+ <div className="grid lg:grid-cols-[280px_1fr] gap-6">
27
+ {/* List */}
28
+ <div className="space-y-2 max-h-[600px] overflow-y-auto">
29
  {history.map((item, i) => (
30
  <button key={i} onClick={() => setSelected(item)}
31
+ className={`w-full text-left p-3 rounded-lg border transition-all ${
32
+ selected === item ? 'bg-blue-50 border-blue-200' : 'bg-white border-slate-200 hover:border-slate-300'
33
+ }`}>
34
+ <div className="text-sm font-medium text-slate-900 truncate">{item.run_id || `Run ${i + 1}`}</div>
35
+ <div className="text-xs text-slate-500 mt-1">{item._input?.slice(0, 60) || 'No description'}</div>
36
+ <div className="flex items-center gap-2 mt-2">
37
+ {item.quality && <span className={`text-[10px] px-2 py-0.5 rounded-full font-semibold ${
38
+ item.quality.grade === 'A' ? 'bg-green-50 text-green-700' : 'bg-blue-50 text-blue-700'
39
+ }`}>Grade {item.quality.grade}</span>}
40
+ <span className="text-[10px] text-slate-400">{item.processing_time_ms?.toFixed(0)}ms</span>
41
  </div>
42
  </button>
43
  ))}
44
  </div>
45
 
46
+ {/* Detail */}
47
+ <div className="card overflow-hidden flex flex-col">
48
  {selected ? (
49
  <>
50
+ <div className="px-5 py-3 border-b border-slate-100 bg-slate-50/50 flex items-center justify-between">
51
+ <span className="text-sm font-medium text-slate-900">{selected.run_id}</span>
 
 
 
 
52
  <button onClick={() => navigator.clipboard.writeText(selected.test_files?.[0]?.code || selected.test_code || '')}
53
+ className="px-3 py-1 rounded-lg bg-blue-50 text-blue-700 text-xs font-medium hover:bg-blue-100">Copy Code</button>
54
  </div>
55
+ <pre className="flex-1 overflow-auto p-5 text-sm text-slate-800 font-mono leading-[1.7]">
56
+ {selected.test_files?.[0]?.code || selected.test_code || 'No code'}
57
  </pre>
58
  </>
59
  ) : (
60
+ <div className="flex-1 flex items-center justify-center text-slate-500 text-sm">Select a run to view</div>
61
  )}
62
  </div>
63
  </div>
frontend/src/pages/LandingPage.tsx CHANGED
@@ -2,58 +2,34 @@ import { useState } from "react";
2
 
3
  interface Props { onNavigate: (page: any) => void; }
4
 
5
- function GithubIcon() {
6
- return (
7
- <svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
8
- <path fillRule="evenodd" clipRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" />
9
- </svg>
10
- );
11
- }
12
-
13
- function TwitterIcon() {
14
- return (
15
- <svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
16
- <path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
17
- </svg>
18
- );
19
- }
20
-
21
  const FEATURES = [
22
- { icon: "🔬", title: "Code Analysis", desc: "Paste any source code. Get AST-based complexity scoring, behavior extraction, and coverage gap detection in seconds." },
23
- { icon: "🧬", title: "Mutation Testing", desc: "Real mutation execution — mutates your code, runs tests, identifies which bugs would escape to production." },
24
- { icon: "📊", title: "Behavior Coverage", desc: "Semantic AST-based mapping of which behaviors ARE tested vs untested. Not keyword matching — real analysis." },
25
- { icon: "🔄", title: "Iterative Refinement", desc: "MuTAP-inspired loop: generate → validate → identify weaknesses → re-generate stronger tests until Grade A." },
26
- { icon: "🔐", title: "Security Scanner", desc: "OWASP Top 10 analysis: IDOR, injection, mass assignment, missing auth, path traversal — with test suggestions." },
27
- { icon: "⚡", title: "Multi-Agent Pipeline", desc: "5 specialized AI agents collaborate: Analyzer, Generator, Validator, Refiner, Coverage Mapper." },
28
  ];
29
 
30
  export function LandingPage({ onNavigate }: Props) {
31
- const [isDark, setIsDark] = useState(true);
32
- const toggle = () => setIsDark(!isDark);
33
-
34
  return (
35
- <div className={`relative flex min-h-screen w-full flex-col antialiased overflow-x-hidden transition-colors duration-300 ${isDark ? 'bg-slate-950 text-slate-100' : 'bg-white text-slate-900'}`}>
36
 
37
  {/* Nav */}
38
- <header className={`sticky top-0 z-50 w-full backdrop-blur-xl transition-all duration-300 border-b ${isDark ? 'bg-slate-900/90 border-slate-800' : 'bg-white/80 border-slate-200'}`}>
39
  <div className="max-w-7xl mx-auto px-6 py-4 flex items-center justify-between">
40
  <div className="flex items-center gap-2">
41
- <div className={`w-8 h-8 flex items-center justify-center rounded-lg text-lg font-black ${isDark ? 'bg-emerald-950 text-emerald-400' : 'bg-emerald-50 text-emerald-600'}`}>🧪</div>
42
- <h2 className={`text-lg font-bold tracking-tight ${isDark ? 'text-white' : 'text-slate-900'}`}>TestGenius AI</h2>
43
  </div>
44
  <nav className="hidden md:flex items-center gap-8">
45
- {["Features", "Pipeline", "Research", "Docs"].map((item) => (
46
- <a key={item} href={`#${item.toLowerCase()}`} className={`text-sm font-medium transition-colors ${isDark ? 'text-slate-400 hover:text-emerald-400' : 'text-slate-500 hover:text-emerald-600'}`}>{item}</a>
47
  ))}
48
  </nav>
49
- <div className="flex items-center gap-3">
50
- <button onClick={toggle} className={`flex h-9 w-9 items-center justify-center rounded-full border transition-all ${isDark ? 'border-slate-700 bg-slate-800 text-slate-300 hover:border-slate-600' : 'border-slate-200 bg-white text-slate-600 hover:border-slate-300'}`}>
51
- {isDark ? '☀️' : '🌙'}
52
- </button>
53
- <button onClick={() => onNavigate('generate')} className={`flex items-center justify-center rounded-full h-9 px-5 text-sm font-medium transition-all hover:shadow-lg ${isDark ? 'bg-white hover:bg-slate-100 text-slate-900' : 'bg-slate-900 hover:bg-slate-800 text-white'}`}>
54
- Start Building →
55
- </button>
56
- </div>
57
  </div>
58
  </header>
59
 
@@ -61,64 +37,71 @@ export function LandingPage({ onNavigate }: Props) {
61
 
62
  {/* Hero */}
63
  <section className="relative pt-20 pb-32 lg:pt-32 lg:pb-40 overflow-hidden">
64
- <div className={`absolute inset-0 z-0 ${isDark ? 'bg-slate-950' : 'bg-white'}`}>
65
- <div className={`absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:20px_20px] ${isDark ? 'opacity-[0.03]' : 'opacity-[0.4]'}`} />
 
66
  </div>
 
67
  <div className="max-w-7xl mx-auto px-6 grid lg:grid-cols-2 gap-16 items-center relative z-10">
 
68
  <div className="flex flex-col gap-8 max-w-2xl">
69
- <div className={`inline-flex items-center gap-2 px-3 py-1.5 rounded-full w-fit shadow-sm border ${isDark ? 'bg-emerald-950 border-emerald-900' : 'bg-emerald-50 border-emerald-100'}`}>
70
- <span className="flex h-2 w-2 rounded-full bg-emerald-500 relative"><span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-500 opacity-75" /></span>
71
- <span className={`text-xs font-semibold uppercase tracking-wide ${isDark ? 'text-emerald-400' : 'text-emerald-600'}`}>v2.0 — Multi-Agent Pipeline</span>
72
  </div>
73
- <h1 className={`text-5xl lg:text-[4rem] font-extrabold leading-[1.1] tracking-tight ${isDark ? 'text-white' : 'text-slate-900'}`}>
74
- AI-Powered Test<br /><span className={isDark ? 'text-emerald-400' : 'text-emerald-600'}>Generation Agent</span>
 
75
  </h1>
76
- <p className={`text-lg leading-relaxed max-w-lg ${isDark ? 'text-slate-400' : 'text-slate-600'}`}>
77
- 5 AI agents analyze your code, generate comprehensive tests, validate quality, and iteratively refine using mutation testing feedback — achieving Grade A quality automatically.
 
78
  </p>
 
79
  <div className="flex flex-wrap gap-4 pt-2">
80
- <button onClick={() => onNavigate('generate')} className="flex items-center justify-center rounded-full h-12 px-8 bg-emerald-600 hover:bg-emerald-700 text-white text-base font-semibold shadow-lg shadow-emerald-600/30 transition-all hover:-translate-y-0.5">
81
  Start Generating Tests →
82
  </button>
83
- <button onClick={() => onNavigate('analyze')} className={`flex items-center justify-center rounded-full h-12 px-8 border text-base font-semibold transition-all ${isDark ? 'bg-slate-800 border-slate-700 hover:border-slate-600 text-slate-200' : 'bg-white border-slate-200 hover:border-slate-300 text-slate-700'}`}>
84
  Analyze Code First
85
  </button>
86
  </div>
87
- <div className={`flex items-center gap-6 pt-4 text-sm font-mono ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>
88
- <div className="flex items-center gap-2"><span className="text-green-500">✓</span><span>Real Mutation Execution</span></div>
89
- <div className="flex items-center gap-2"><span className="text-green-500">✓</span><span>Any LLM Provider</span></div>
 
90
  </div>
91
  </div>
92
 
93
- {/* Mock UI card */}
94
  <div className="relative w-full group hidden lg:block">
95
- <div className="absolute -inset-4 bg-gradient-to-r from-emerald-500 to-cyan-600 rounded-xl blur-2xl opacity-15 group-hover:opacity-25 transition duration-1000" />
96
- <div className={`relative rounded-xl shadow-2xl border overflow-hidden ${isDark ? 'bg-slate-900 border-slate-700/60' : 'bg-white border-slate-200/60'}`}>
97
- <div className={`h-10 border-b flex items-center px-4 justify-between ${isDark ? 'border-slate-800 bg-slate-800/50' : 'border-slate-100 bg-slate-50/50'}`}>
98
- <div className="flex gap-1.5"><div className="w-3 h-3 rounded-full bg-red-400" /><div className="w-3 h-3 rounded-full bg-yellow-400" /><div className="w-3 h-3 rounded-full bg-green-400" /></div>
99
- <div className={`text-[10px] font-mono px-2 py-0.5 rounded border ${isDark ? 'text-slate-500 bg-slate-800 border-slate-700' : 'text-slate-400 bg-white border-slate-100'}`}>multi-agent-pipeline / output</div>
100
  </div>
101
- <div className={`p-6 min-h-[340px] relative ${isDark ? 'bg-slate-900' : 'bg-white'}`}>
102
  <div className="flex gap-6">
103
  <div className="flex-1 space-y-3">
104
- <div className={`h-3 rounded w-3/4 ${isDark ? 'bg-slate-800' : 'bg-slate-100'}`} />
105
- <div className={`h-3 rounded w-1/2 ${isDark ? 'bg-slate-800' : 'bg-slate-100'}`} />
106
- <div className={`h-3 rounded w-5/6 ${isDark ? 'bg-slate-800' : 'bg-slate-100'}`} />
107
- <div className={`h-3 rounded w-full mt-4 ${isDark ? 'bg-emerald-900/40' : 'bg-emerald-100'}`} />
108
- <div className={`h-3 rounded w-11/12 ${isDark ? 'bg-emerald-900/20' : 'bg-emerald-50'}`} />
109
  </div>
110
  <div className="w-48 bg-slate-900 rounded-lg p-4 shadow-xl text-white transform translate-y-4 border border-slate-700 shrink-0">
111
- <div className="flex items-center gap-2 mb-2"><span className="w-2 h-2 rounded-full bg-emerald-400 animate-pulse" /><span className="text-[10px] font-mono text-slate-400 uppercase">Quality Score</span></div>
112
  <div className="text-3xl font-black mb-1">A</div>
113
  <div className="text-xs text-slate-400">85/100 • 18 tests</div>
114
- <div className="mt-3 h-1.5 w-full bg-slate-800 rounded-full overflow-hidden"><div className="h-full bg-gradient-to-r from-emerald-500 to-cyan-500 w-[85%]" /></div>
115
  </div>
116
  </div>
117
- <div className={`absolute bottom-6 left-6 right-6 p-3 rounded border flex items-start gap-3 ${isDark ? 'bg-emerald-950 border-emerald-900' : 'bg-emerald-50 border-emerald-100'}`}>
118
- <span className={`text-sm mt-0.5 ${isDark ? 'text-emerald-400' : 'text-emerald-600'}`}>🧬</span>
119
  <div>
120
- <div className={`text-xs font-semibold ${isDark ? 'text-white' : 'text-slate-900'}`}>Mutation Result</div>
121
- <div className={`text-[10px] mt-1 ${isDark ? 'text-slate-400' : 'text-slate-600'}`}>3 mutants survived — adding edge case tests to kill them.</div>
122
  </div>
123
  </div>
124
  </div>
@@ -127,20 +110,20 @@ export function LandingPage({ onNavigate }: Props) {
127
  </div>
128
  </section>
129
 
130
- {/* Features Grid */}
131
- <section id="features" className={`py-24 relative overflow-hidden transition-colors duration-300 ${isDark ? 'bg-slate-900' : 'bg-white'}`}>
132
- <div className={`absolute inset-0 bg-[radial-gradient(#334155_1px,transparent_1px)] [background-size:16px_16px] [mask-image:radial-gradient(ellipse_50%_50%_at_50%_50%,#000_70%,transparent_100%)] ${isDark ? 'opacity-20' : 'opacity-10'}`} />
133
  <div className="max-w-7xl mx-auto px-6 relative z-10">
134
  <div className="text-center max-w-3xl mx-auto mb-20">
135
- <h2 className={`text-3xl font-bold mb-4 tracking-tight ${isDark ? 'text-white' : 'text-slate-900'}`}>Designed for QA velocity</h2>
136
- <p className={`text-lg ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>Research-backed tools that generate tests smarter than manual effort.</p>
137
  </div>
138
- <div className={`grid md:grid-cols-3 gap-0 border-t border-l ${isDark ? 'border-slate-700' : 'border-slate-200'}`}>
139
  {FEATURES.map(({ icon, title, desc }) => (
140
- <div key={title} className={`p-10 border-r border-b transition-colors group ${isDark ? 'border-slate-700 bg-slate-900 hover:bg-slate-800' : 'border-slate-200 bg-white hover:bg-slate-50'}`}>
141
- <div className={`w-10 h-10 mb-6 flex items-center justify-center rounded-lg text-lg transition-colors ${isDark ? 'bg-slate-800 group-hover:bg-emerald-600 group-hover:text-white' : 'bg-slate-100 group-hover:bg-slate-900 group-hover:text-white'}`}>{icon}</div>
142
- <h3 className={`text-lg font-semibold mb-3 ${isDark ? 'text-white' : 'text-slate-900'}`}>{title}</h3>
143
- <p className={`text-sm leading-relaxed ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>{desc}</p>
144
  </div>
145
  ))}
146
  </div>
@@ -148,31 +131,33 @@ export function LandingPage({ onNavigate }: Props) {
148
  </section>
149
 
150
  {/* Code Demo */}
151
- <section id="pipeline" className={`py-24 border-y transition-colors duration-300 ${isDark ? 'bg-slate-950 border-slate-800' : 'bg-slate-50 border-slate-200'}`}>
152
  <div className="max-w-6xl mx-auto px-6">
153
- <div className="mb-12 md:text-center">
154
- <h2 className={`text-3xl font-bold ${isDark ? 'text-white' : 'text-slate-900'}`}>See the 5-agent pipeline in action</h2>
155
- <p className={`mt-2 text-lg ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>From raw code to production-ready tests in one API call.</p>
156
  </div>
157
- <div className="max-w-4xl mx-auto rounded-xl overflow-hidden shadow-2xl border border-slate-700">
158
- <div className="h-10 bg-[#1e1e1e] border-b border-[#333] flex items-center px-4 gap-2">
159
- <div className="w-3 h-3 rounded-full bg-[#ff5f56]" /><div className="w-3 h-3 rounded-full bg-[#ffbd2e]" /><div className="w-3 h-3 rounded-full bg-[#27c93f]" />
160
- <span className="ml-4 text-xs text-slate-400 font-mono">🧪 testgenius / demo</span>
 
 
161
  </div>
162
  <div className="grid md:grid-cols-2">
163
  <div className="bg-[#1e1e1e] p-6 border-r border-[#333]">
164
- <div className="text-[10px] font-mono text-slate-500 uppercase mb-3">Input: Source Code</div>
165
- <pre className="text-sm leading-6 font-mono">
166
- <span className="text-[#569cd6]">def </span><span className="text-[#dcdcaa]">calculate_discount</span>(price, type):{"\n"}{" "}<span className="text-[#c586c0]">if</span> price {"<="} <span className="text-[#b5cea8]">0</span>:{"\n"}{" "}<span className="text-[#c586c0]">raise</span> <span className="text-[#4ec9b0]">ValueError</span>(<span className="text-[#ce9178]">"positive"</span>){"\n"}{" "}<span className="text-[#c586c0]">if</span> type == <span className="text-[#ce9178]">"premium"</span>:{"\n"}{" "}<span className="text-[#c586c0]">return</span> price * <span className="text-[#b5cea8]">0.2</span>{"\n"}{" "}<span className="text-[#c586c0]">return</span> <span className="text-[#b5cea8]">0</span>
167
  </pre>
168
  </div>
169
  <div className="bg-[#252526] p-6 relative">
170
- <div className="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-emerald-500 to-cyan-500" />
171
- <div className="flex items-center gap-2 mb-4"><span className="text-emerald-400 text-sm">🤖</span><span className="text-xs font-bold uppercase tracking-wider text-[#ccc]">Generated (Grade A)</span></div>
172
  <div className="space-y-3">
173
- <div className="bg-[#333] p-3 rounded border-l-2 border-emerald-500"><p className="text-xs text-[#999] mb-1">✅ 18 tests generated</p><p className="text-sm text-[#ddd]">Happy path, edge cases, boundary, errors</p></div>
174
- <div className="bg-[#333] p-3 rounded border-l-2 border-purple-500"><p className="text-xs text-[#999] mb-1">🧬 Mutation Score: 87%</p><p className="text-sm text-[#ddd]">13/15 mutants killed</p></div>
175
- <div className="bg-[#333] p-3 rounded border-l-2 border-cyan-500"><p className="text-xs text-[#999] mb-1">📊 Coverage: 92%</p><p className="text-sm text-[#ddd]">22/24 behaviors tested</p></div>
176
  </div>
177
  </div>
178
  </div>
@@ -181,13 +166,13 @@ export function LandingPage({ onNavigate }: Props) {
181
  </section>
182
 
183
  {/* Stats */}
184
- <section className={`py-20 transition-colors duration-300 ${isDark ? 'bg-slate-900' : 'bg-white'}`}>
185
  <div className="max-w-7xl mx-auto px-6">
186
  <div className="grid md:grid-cols-4 gap-12 text-center">
187
- {[{ stat: "85%+", label: "Quality Score" }, { stat: "5", label: "AI Agents" }, { stat: "<4s", label: "Generation Time" }, { stat: "87%", label: "Mutation Kill Rate" }].map(({ stat, label }, i) => (
188
- <div key={label} className={`flex flex-col gap-1 items-center ${i < 3 ? `md:border-r ${isDark ? 'border-slate-800' : 'border-slate-100'}` : ''}`}>
189
- <p className={`text-5xl font-extrabold tracking-tight text-transparent bg-clip-text bg-gradient-to-b ${isDark ? 'from-white to-slate-400' : 'from-slate-900 to-slate-600'}`}>{stat}</p>
190
- <p className={`font-medium mt-2 ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>{label}</p>
191
  </div>
192
  ))}
193
  </div>
@@ -196,40 +181,36 @@ export function LandingPage({ onNavigate }: Props) {
196
 
197
  {/* CTA */}
198
  <section className="bg-slate-900 py-24 relative overflow-hidden">
199
- <div className="absolute top-0 right-0 w-[500px] h-[500px] bg-emerald-500/20 rounded-full blur-[100px] pointer-events-none" />
200
- <div className="absolute bottom-0 left-0 w-[400px] h-[400px] bg-cyan-600/15 rounded-full blur-[80px] pointer-events-none" />
201
  <div className="max-w-3xl mx-auto px-6 text-center relative z-10">
202
  <h2 className="text-3xl md:text-4xl font-bold text-white mb-6 tracking-tight">Ready to generate better tests?</h2>
203
- <p className="text-slate-400 mb-10 text-lg">Join QA teams who transformed their testing with AI-powered iterative generation.</p>
204
  <div className="flex flex-col sm:flex-row items-center justify-center gap-4">
205
- <button onClick={() => onNavigate('generate')} className="w-full sm:w-auto flex items-center justify-center rounded-full h-12 px-8 bg-white hover:bg-slate-100 text-slate-900 text-base font-bold shadow-lg transition-all">Get Started Free</button>
206
- <button onClick={() => onNavigate('settings')} className="w-full sm:w-auto flex items-center justify-center rounded-full h-12 px-8 bg-slate-800 border border-slate-700 hover:border-slate-600 text-white text-base font-bold transition-all">Configure LLM</button>
207
  </div>
208
  </div>
209
  </section>
210
  </main>
211
 
212
  {/* Footer */}
213
- <footer className={`pt-16 pb-12 border-t transition-colors duration-300 ${isDark ? 'bg-slate-900 border-slate-800' : 'bg-white border-slate-100'}`}>
214
  <div className="max-w-7xl mx-auto px-6">
215
  <div className="grid grid-cols-2 md:grid-cols-5 gap-8 mb-16">
216
  <div className="col-span-2">
217
- <div className={`flex items-center gap-2 mb-6 ${isDark ? 'text-white' : 'text-slate-900'}`}><span className="text-xl">🧪</span><span className="font-bold text-base tracking-tight">TestGenius AI</span></div>
218
- <p className={`text-sm max-w-xs ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>AI-powered test case generation for QA teams. Multi-agent iterative refinement inspired by MuTAP research.</p>
219
  </div>
220
- {[{ heading: "Product", links: ["Multi-Agent Pipeline", "Code Analysis", "Mutation Testing", "Security Scanner"] }, { heading: "Resources", links: ["API Docs", "Research Papers", "LLM Providers", "Changelog"] }, { heading: "Company", links: ["About", "GitHub", "MIT License", "Contact"] }].map(({ heading, links }) => (
221
- <div key={heading} className="flex flex-col gap-4">
222
- <h4 className={`font-semibold text-sm ${isDark ? 'text-white' : 'text-slate-900'}`}>{heading}</h4>
223
- {links.map((l) => (<a key={l} href="#" className={`text-sm transition-colors ${isDark ? 'text-slate-400 hover:text-white' : 'text-slate-500 hover:text-slate-900'}`}>{l}</a>))}
224
  </div>
225
  ))}
226
  </div>
227
- <div className={`flex flex-col md:flex-row justify-between items-center gap-6 pt-8 border-t ${isDark ? 'border-slate-800' : 'border-slate-100'}`}>
228
- <div className={`text-sm ${isDark ? 'text-slate-400' : 'text-slate-500'}`}>© {new Date().getFullYear()} TestGenius AI</div>
229
- <div className="flex gap-6">
230
- <a href="https://github.com/MUTHUKUMARAN-K-1" target="_blank" rel="noopener noreferrer" className={`transition-colors ${isDark ? 'text-slate-500 hover:text-white' : 'text-slate-400 hover:text-slate-900'}`}><GithubIcon /></a>
231
- <a href="#" className={`transition-colors ${isDark ? 'text-slate-500 hover:text-white' : 'text-slate-400 hover:text-slate-900'}`}><TwitterIcon /></a>
232
- </div>
233
  </div>
234
  </div>
235
  </footer>
 
2
 
3
  interface Props { onNavigate: (page: any) => void; }
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  const FEATURES = [
6
+ { icon: "🔬", title: "Code Analysis", desc: "AST-based complexity scoring, behavior extraction, and coverage gap detection." },
7
+ { icon: "🧬", title: "Mutation Testing", desc: "Real mutation execution — mutates code, runs tests, identifies survivors." },
8
+ { icon: "📊", title: "Behavior Coverage", desc: "Semantic AST-based mapping of tested vs untested behaviors." },
9
+ { icon: "🔄", title: "Iterative Refinement", desc: "MuTAP loop: generate → validate → improve until Grade A." },
10
+ { icon: "🔐", title: "Security Scanner", desc: "OWASP: IDOR, injection, mass assignment, missing auth detection." },
11
+ { icon: "⚡", title: "Multi-Agent Pipeline", desc: "5 AI agents: Analyzer, Generator, Validator, Refiner, Mapper." },
12
  ];
13
 
14
  export function LandingPage({ onNavigate }: Props) {
 
 
 
15
  return (
16
+ <div className="relative flex min-h-screen w-full flex-col bg-white text-slate-900 antialiased overflow-x-hidden">
17
 
18
  {/* Nav */}
19
+ <header className="sticky top-0 z-50 glass-nav w-full">
20
  <div className="max-w-7xl mx-auto px-6 py-4 flex items-center justify-between">
21
  <div className="flex items-center gap-2">
22
+ <div className="w-8 h-8 flex items-center justify-center rounded-lg bg-blue-50 text-blue-600 text-lg">🧪</div>
23
+ <h2 className="text-slate-900 text-lg font-bold tracking-tight">TestGenius AI</h2>
24
  </div>
25
  <nav className="hidden md:flex items-center gap-8">
26
+ {["Features", "Pipeline", "Research"].map((item) => (
27
+ <a key={item} href={`#${item.toLowerCase()}`} className="text-slate-500 hover:text-blue-600 text-sm font-medium transition-colors">{item}</a>
28
  ))}
29
  </nav>
30
+ <button onClick={() => onNavigate('generate')} className="flex items-center justify-center rounded-full h-9 px-5 bg-slate-900 hover:bg-slate-800 text-white text-sm font-medium transition-all hover:shadow-lg">
31
+ Start Building
32
+ </button>
 
 
 
 
 
33
  </div>
34
  </header>
35
 
 
37
 
38
  {/* Hero */}
39
  <section className="relative pt-20 pb-32 lg:pt-32 lg:pb-40 overflow-hidden">
40
+ <div className="absolute inset-0 z-0">
41
+ <div className="stripe-hero-bg opacity-60" />
42
+ <div className="linear-grid absolute inset-0 opacity-40" />
43
  </div>
44
+
45
  <div className="max-w-7xl mx-auto px-6 grid lg:grid-cols-2 gap-16 items-center relative z-10">
46
+ {/* Left */}
47
  <div className="flex flex-col gap-8 max-w-2xl">
48
+ <div className="inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-blue-50 border border-blue-100 w-fit shadow-sm">
49
+ <span className="flex h-2 w-2 rounded-full bg-blue-600 relative"><span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-600 opacity-75" /></span>
50
+ <span className="text-blue-700 text-xs font-semibold uppercase tracking-wide">v2.0 — Multi-Agent Pipeline</span>
51
  </div>
52
+
53
+ <h1 className="text-slate-900 text-5xl lg:text-[4rem] font-extrabold leading-[1.1] tracking-tight">
54
+ AI-Powered Test<br /><span className="text-blue-600">Generation Agent</span>
55
  </h1>
56
+
57
+ <p className="text-slate-600 text-lg leading-relaxed max-w-lg">
58
+ 5 AI agents analyze your code, generate comprehensive tests, validate quality, and iteratively refine using mutation testing feedback — achieving Grade A automatically.
59
  </p>
60
+
61
  <div className="flex flex-wrap gap-4 pt-2">
62
+ <button onClick={() => onNavigate('generate')} className="btn-primary h-12 px-8 text-base shadow-lg shadow-blue-600/30 hover:-translate-y-0.5">
63
  Start Generating Tests →
64
  </button>
65
+ <button onClick={() => onNavigate('analyze')} className="btn-secondary h-12 px-8 text-base">
66
  Analyze Code First
67
  </button>
68
  </div>
69
+
70
+ <div className="flex items-center gap-6 pt-4 text-sm text-slate-500 font-mono">
71
+ <div className="flex items-center gap-2"><span className="text-green-600">✓</span> Real Mutation Execution</div>
72
+ <div className="flex items-center gap-2"><span className="text-green-600">✓</span> Any LLM Provider</div>
73
  </div>
74
  </div>
75
 
76
+ {/* Right: Mock Card */}
77
  <div className="relative w-full group hidden lg:block">
78
+ <div className="absolute -inset-4 bg-gradient-to-r from-blue-400 to-purple-500 rounded-xl blur-2xl opacity-15 group-hover:opacity-25 transition duration-1000" />
79
+ <div className="relative bg-white rounded-xl shadow-cn-lg border border-slate-200/60 overflow-hidden">
80
+ <div className="h-10 border-b border-slate-100 bg-slate-50/50 flex items-center px-4 justify-between">
81
+ <div className="flex gap-1.5"><div className="w-3 h-3 rounded-full bg-slate-200" /><div className="w-3 h-3 rounded-full bg-slate-200" /><div className="w-3 h-3 rounded-full bg-slate-200" /></div>
82
+ <div className="text-[10px] font-mono text-slate-400 bg-white px-2 py-0.5 rounded border border-slate-100">multi-agent / output</div>
83
  </div>
84
+ <div className="p-6 min-h-[320px] relative">
85
  <div className="flex gap-6">
86
  <div className="flex-1 space-y-3">
87
+ <div className="h-3 bg-slate-100 rounded w-3/4" />
88
+ <div className="h-3 bg-slate-100 rounded w-1/2" />
89
+ <div className="h-3 bg-slate-100 rounded w-5/6" />
90
+ <div className="h-3 bg-blue-50 rounded w-full mt-4" />
91
+ <div className="h-3 bg-blue-50 rounded w-11/12" />
92
  </div>
93
  <div className="w-48 bg-slate-900 rounded-lg p-4 shadow-xl text-white transform translate-y-4 border border-slate-700 shrink-0">
94
+ <div className="flex items-center gap-2 mb-2"><span className="w-2 h-2 rounded-full bg-green-400 animate-pulse" /><span className="text-[10px] font-mono text-slate-400 uppercase">Quality</span></div>
95
  <div className="text-3xl font-black mb-1">A</div>
96
  <div className="text-xs text-slate-400">85/100 • 18 tests</div>
97
+ <div className="mt-3 h-1.5 w-full bg-slate-800 rounded-full overflow-hidden"><div className="h-full bg-gradient-to-r from-blue-500 to-purple-500 w-[85%]" /></div>
98
  </div>
99
  </div>
100
+ <div className="absolute bottom-6 left-6 right-6 p-3 bg-blue-50 rounded border border-blue-100 flex items-start gap-3">
101
+ <span className="text-blue-600 text-sm mt-0.5">🧬</span>
102
  <div>
103
+ <div className="text-xs font-semibold text-slate-900">Mutation Result</div>
104
+ <div className="text-[10px] text-slate-600 mt-1">3 mutants survived — adding tests to kill them.</div>
105
  </div>
106
  </div>
107
  </div>
 
110
  </div>
111
  </section>
112
 
113
+ {/* Features */}
114
+ <section id="features" className="bg-white py-24 relative overflow-hidden">
115
+ <div className="absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:16px_16px] [mask-image:radial-gradient(ellipse_50%_50%_at_50%_50%,#000_70%,transparent_100%)] opacity-30" />
116
  <div className="max-w-7xl mx-auto px-6 relative z-10">
117
  <div className="text-center max-w-3xl mx-auto mb-20">
118
+ <h2 className="text-slate-900 text-3xl font-bold mb-4 tracking-tight">Designed for QA velocity</h2>
119
+ <p className="text-slate-500 text-lg">Research-backed tools built with the precision of a compiler.</p>
120
  </div>
121
+ <div className="grid md:grid-cols-3 gap-0 border-t border-l border-slate-200">
122
  {FEATURES.map(({ icon, title, desc }) => (
123
+ <div key={title} className="p-10 border-r border-b border-slate-200 bg-white hover:bg-slate-50 transition-colors group">
124
+ <div className="w-10 h-10 mb-6 flex items-center justify-center rounded-lg bg-slate-100 text-lg group-hover:bg-slate-900 group-hover:text-white transition-colors">{icon}</div>
125
+ <h3 className="text-slate-900 text-lg font-semibold mb-3">{title}</h3>
126
+ <p className="text-slate-500 text-sm leading-relaxed">{desc}</p>
127
  </div>
128
  ))}
129
  </div>
 
131
  </section>
132
 
133
  {/* Code Demo */}
134
+ <section id="pipeline" className="py-24 bg-slate-50 border-y border-slate-200">
135
  <div className="max-w-6xl mx-auto px-6">
136
+ <div className="mb-12 text-center">
137
+ <h2 className="text-3xl font-bold text-slate-900">See the pipeline in action</h2>
138
+ <p className="text-slate-500 mt-2 text-lg">From raw code to Grade A tests in one API call.</p>
139
  </div>
140
+ <div className="code-window max-w-4xl mx-auto">
141
+ <div className="code-header">
142
+ <div className="w-2.5 h-2.5 rounded-full bg-[#ff5f56]" />
143
+ <div className="w-2.5 h-2.5 rounded-full bg-[#ffbd2e]" />
144
+ <div className="w-2.5 h-2.5 rounded-full bg-[#27c93f]" />
145
+ <span className="ml-4 text-xs text-slate-400 font-mono">🧪 testgenius-pipeline / demo</span>
146
  </div>
147
  <div className="grid md:grid-cols-2">
148
  <div className="bg-[#1e1e1e] p-6 border-r border-[#333]">
149
+ <div className="text-[10px] font-mono text-slate-500 uppercase mb-3">Input</div>
150
+ <pre className="text-sm leading-6">
151
+ <span className="text-[#569cd6]">def </span><span className="text-[#dcdcaa]">calculate_discount</span>(price, type):{"\n"}{" "}<span className="text-[#c586c0]">if</span> price {"<="} <span className="text-[#b5cea8]">0</span>:{"\n"}{" "}<span className="text-[#c586c0]">raise</span> <span className="text-[#4ec9b0]">ValueError</span>(){"\n"}{" "}<span className="text-[#c586c0]">if</span> type == <span className="text-[#ce9178]">"premium"</span>:{"\n"}{" "}<span className="text-[#c586c0]">return</span> price * <span className="text-[#b5cea8]">0.2</span>{"\n"}{" "}<span className="text-[#c586c0]">return</span> <span className="text-[#b5cea8]">0</span>
152
  </pre>
153
  </div>
154
  <div className="bg-[#252526] p-6 relative">
155
+ <div className="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-blue-500 to-purple-500" />
156
+ <div className="flex items-center gap-2 mb-4"><span className="text-purple-400 text-sm">🤖</span><span className="text-xs font-bold uppercase tracking-wider text-[#ccc]">Generated (Grade A)</span></div>
157
  <div className="space-y-3">
158
+ <div className="bg-[#333] p-3 rounded border-l-2 border-blue-500"><p className="text-xs text-[#999]">✅ 18 tests happy path + edge + error</p></div>
159
+ <div className="bg-[#333] p-3 rounded border-l-2 border-purple-500"><p className="text-xs text-[#999]">🧬 Mutation: 87% killed (13/15)</p></div>
160
+ <div className="bg-[#333] p-3 rounded border-l-2 border-cyan-500"><p className="text-xs text-[#999]">📊 Coverage: 92% behaviors tested</p></div>
161
  </div>
162
  </div>
163
  </div>
 
166
  </section>
167
 
168
  {/* Stats */}
169
+ <section className="bg-white py-20">
170
  <div className="max-w-7xl mx-auto px-6">
171
  <div className="grid md:grid-cols-4 gap-12 text-center">
172
+ {[{ stat: "85%+", label: "Quality Score" }, { stat: "5", label: "AI Agents" }, { stat: "<4s", label: "Per Run" }, { stat: "87%", label: "Mutation Kill" }].map(({ stat, label }, i) => (
173
+ <div key={label} className={`flex flex-col gap-1 items-center ${i < 3 ? 'md:border-r border-slate-100' : ''}`}>
174
+ <p className="text-5xl font-extrabold tracking-tight text-transparent bg-clip-text bg-gradient-to-b from-slate-900 to-slate-600">{stat}</p>
175
+ <p className="text-slate-500 font-medium mt-2">{label}</p>
176
  </div>
177
  ))}
178
  </div>
 
181
 
182
  {/* CTA */}
183
  <section className="bg-slate-900 py-24 relative overflow-hidden">
184
+ <div className="absolute top-0 right-0 w-[500px] h-[500px] bg-blue-500/20 rounded-full blur-[100px] pointer-events-none" />
185
+ <div className="absolute bottom-0 left-0 w-[400px] h-[400px] bg-purple-600/15 rounded-full blur-[80px] pointer-events-none" />
186
  <div className="max-w-3xl mx-auto px-6 text-center relative z-10">
187
  <h2 className="text-3xl md:text-4xl font-bold text-white mb-6 tracking-tight">Ready to generate better tests?</h2>
188
+ <p className="text-slate-400 mb-10 text-lg">Join QA teams who transformed testing with AI-powered iterative generation.</p>
189
  <div className="flex flex-col sm:flex-row items-center justify-center gap-4">
190
+ <button onClick={() => onNavigate('generate')} className="w-full sm:w-auto rounded-full h-12 px-8 bg-white hover:bg-slate-100 text-slate-900 text-base font-bold shadow-lg transition-all">Get Started Free</button>
191
+ <button onClick={() => onNavigate('settings')} className="w-full sm:w-auto rounded-full h-12 px-8 bg-slate-800 border border-slate-700 hover:border-slate-600 text-white text-base font-bold transition-all">Configure LLM</button>
192
  </div>
193
  </div>
194
  </section>
195
  </main>
196
 
197
  {/* Footer */}
198
+ <footer className="bg-white border-t border-slate-100 pt-16 pb-12">
199
  <div className="max-w-7xl mx-auto px-6">
200
  <div className="grid grid-cols-2 md:grid-cols-5 gap-8 mb-16">
201
  <div className="col-span-2">
202
+ <div className="flex items-center gap-2 text-slate-900 mb-6"><span className="text-xl">🧪</span><span className="font-bold text-base">TestGenius AI</span></div>
203
+ <p className="text-slate-500 text-sm max-w-xs">AI-powered test generation for QA teams. Multi-agent iterative refinement inspired by MuTAP research (ISSTA 2023).</p>
204
  </div>
205
+ {[{ h: "Product", l: ["Pipeline", "Analysis", "Mutations", "Security"] }, { h: "Resources", l: ["API Docs", "Papers", "Providers", "Changelog"] }, { h: "Company", l: ["About", "GitHub", "License", "Contact"] }].map(({ h, l }) => (
206
+ <div key={h} className="flex flex-col gap-3">
207
+ <h4 className="text-slate-900 font-semibold text-sm">{h}</h4>
208
+ {l.map(x => <a key={x} href="#" className="text-slate-500 hover:text-slate-900 text-sm transition-colors">{x}</a>)}
209
  </div>
210
  ))}
211
  </div>
212
+ <div className="flex justify-between items-center pt-8 border-t border-slate-100">
213
+ <p className="text-slate-400 text-sm">© {new Date().getFullYear()} TestGenius AI</p>
 
 
 
 
214
  </div>
215
  </div>
216
  </footer>
frontend/src/pages/SettingsPage.tsx CHANGED
@@ -1,38 +1,94 @@
1
- import React from 'react';
 
 
2
 
3
  export function SettingsPage() {
 
 
 
 
 
 
4
  return (
5
  <div className="max-w-3xl mx-auto px-6 py-8">
6
- <h1 className="text-xl font-bold mb-6">Settings</h1>
7
- <div className="space-y-4">
8
- <div className="p-5 rounded-xl bg-white/[0.015] border border-white/[0.05]">
9
- <h3 className="text-sm font-semibold text-white mb-3">🤖 LLM Provider Configuration</h3>
10
- <p className="text-xs text-gray-500 mb-4">Configure in backend <code className="bg-white/5 px-1.5 py-0.5 rounded">.env</code> file. Supports ANY OpenAI-compatible API.</p>
11
- <div className="space-y-3">
12
- <div><label className="text-[11px] text-gray-400 block mb-1">LLM_BASE_URL</label><input disabled value="https://api.groq.com/openai/v1" className="w-full bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-2 text-xs text-gray-400" /></div>
13
- <div><label className="text-[11px] text-gray-400 block mb-1">LLM_MODEL</label><input disabled value="llama-3.3-70b-versatile" className="w-full bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-2 text-xs text-gray-400" /></div>
14
- <div><label className="text-[11px] text-gray-400 block mb-1">LLM_API_KEY</label><input disabled value="••••••••" type="password" className="w-full bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-2 text-xs text-gray-400" /></div>
15
- </div>
16
- <p className="text-[10px] text-gray-600 mt-3">Supported: Groq, Featherless, OpenAI, Together, DeepSeek, OpenRouter, Mistral, Ollama, LM Studio</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  </div>
18
 
19
- <div className="p-5 rounded-xl bg-white/[0.015] border border-white/[0.05]">
20
- <h3 className="text-sm font-semibold text-white mb-3">⚡ Pipeline Settings</h3>
21
- <div className="grid grid-cols-2 gap-4 text-xs">
22
- <div className="flex justify-between"><span className="text-gray-400">Multi-Agent Mode</span><span className="text-emerald-400">Enabled</span></div>
23
- <div className="flex justify-between"><span className="text-gray-400">Max Iterations</span><span className="text-white">2</span></div>
24
- <div className="flex justify-between"><span className="text-gray-400">Quality Threshold</span><span className="text-white">Grade B (70%)</span></div>
25
- <div className="flex justify-between"><span className="text-gray-400">Mutation Feedback</span><span className="text-emerald-400">Active</span></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  </div>
27
  </div>
28
 
29
- <div className="p-5 rounded-xl bg-white/[0.015] border border-white/[0.05]">
30
- <h3 className="text-sm font-semibold text-white mb-3">📊 System Info</h3>
31
- <div className="grid grid-cols-2 gap-4 text-xs">
32
- <div className="flex justify-between"><span className="text-gray-400">Version</span><span className="text-white">2.0.0</span></div>
33
- <div className="flex justify-between"><span className="text-gray-400">Agents</span><span className="text-white">5 active</span></div>
34
- <div className="flex justify-between"><span className="text-gray-400">Novelties</span><span className="text-white">8 features</span></div>
35
- <div className="flex justify-between"><span className="text-gray-400">Research</span><span className="text-white">MuTAP + HITS</span></div>
 
 
 
 
 
 
 
 
 
36
  </div>
37
  </div>
38
  </div>
 
1
+ import { useState, useEffect } from 'react';
2
+
3
+ const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
4
 
5
  export function SettingsPage() {
6
+ const [provider, setProvider] = useState<any>(null);
7
+
8
+ useEffect(() => {
9
+ fetch(`${API}/api/v1/provider`).then(r => r.json()).then(setProvider).catch(() => {});
10
+ }, []);
11
+
12
  return (
13
  <div className="max-w-3xl mx-auto px-6 py-8">
14
+ <div className="mb-6">
15
+ <h1 className="text-2xl font-bold text-slate-900">Settings</h1>
16
+ <p className="text-slate-500 text-sm mt-1">LLM provider configuration and system info</p>
17
+ </div>
18
+
19
+ <div className="space-y-5">
20
+ {/* LLM Provider */}
21
+ <div className="card p-6">
22
+ <h3 className="text-base font-semibold text-slate-900 mb-4">🤖 LLM Provider</h3>
23
+ {provider ? (
24
+ <div className="space-y-3">
25
+ <div className="flex justify-between py-2 border-b border-slate-100">
26
+ <span className="text-sm text-slate-500">Provider</span>
27
+ <span className="text-sm font-medium text-slate-900">{provider.provider}</span>
28
+ </div>
29
+ <div className="flex justify-between py-2 border-b border-slate-100">
30
+ <span className="text-sm text-slate-500">Model</span>
31
+ <span className="text-sm font-mono text-slate-900">{provider.model}</span>
32
+ </div>
33
+ <div className="flex justify-between py-2 border-b border-slate-100">
34
+ <span className="text-sm text-slate-500">Base URL</span>
35
+ <span className="text-sm font-mono text-slate-600 truncate max-w-[250px]">{provider.base_url}</span>
36
+ </div>
37
+ <div className="flex justify-between py-2 border-b border-slate-100">
38
+ <span className="text-sm text-slate-500">Max Tokens</span>
39
+ <span className="text-sm text-slate-900">{provider.max_tokens}</span>
40
+ </div>
41
+ <div className="flex justify-between py-2">
42
+ <span className="text-sm text-slate-500">Status</span>
43
+ <span className={`text-sm font-medium ${provider.configured ? 'text-green-600' : 'text-red-600'}`}>
44
+ {provider.configured ? '✓ Connected' : '✗ Not configured'}
45
+ </span>
46
+ </div>
47
+ </div>
48
+ ) : (
49
+ <div className="skeleton h-32" />
50
+ )}
51
  </div>
52
 
53
+ {/* Pipeline */}
54
+ <div className="card p-6">
55
+ <h3 className="text-base font-semibold text-slate-900 mb-4">⚙️ Pipeline Settings</h3>
56
+ <div className="space-y-3">
57
+ <div className="flex justify-between py-2 border-b border-slate-100">
58
+ <span className="text-sm text-slate-500">Max Iterations</span>
59
+ <span className="text-sm text-slate-900">5</span>
60
+ </div>
61
+ <div className="flex justify-between py-2 border-b border-slate-100">
62
+ <span className="text-sm text-slate-500">Quality Threshold</span>
63
+ <span className="text-sm text-slate-900">Grade A (85%+)</span>
64
+ </div>
65
+ <div className="flex justify-between py-2 border-b border-slate-100">
66
+ <span className="text-sm text-slate-500">Mutation Testing</span>
67
+ <span className="text-sm text-green-600 font-medium">Enabled (real execution)</span>
68
+ </div>
69
+ <div className="flex justify-between py-2">
70
+ <span className="text-sm text-slate-500">Syntax Validation</span>
71
+ <span className="text-sm text-green-600 font-medium">Enabled (AST parse)</span>
72
+ </div>
73
  </div>
74
  </div>
75
 
76
+ {/* Info */}
77
+ <div className="card p-6">
78
+ <h3 className="text-base font-semibold text-slate-900 mb-4">ℹ️ System</h3>
79
+ <div className="space-y-3">
80
+ <div className="flex justify-between py-2 border-b border-slate-100">
81
+ <span className="text-sm text-slate-500">Version</span>
82
+ <span className="text-sm text-slate-900">v2.0.0</span>
83
+ </div>
84
+ <div className="flex justify-between py-2 border-b border-slate-100">
85
+ <span className="text-sm text-slate-500">Research Basis</span>
86
+ <span className="text-sm text-slate-900">MuTAP (ISSTA'23) + HITS (ASE'24)</span>
87
+ </div>
88
+ <div className="flex justify-between py-2">
89
+ <span className="text-sm text-slate-500">API Docs</span>
90
+ <a href={`${API}/docs`} target="_blank" className="text-sm text-blue-600 hover:underline">{API}/docs</a>
91
+ </div>
92
  </div>
93
  </div>
94
  </div>
frontend/tailwind.config.js CHANGED
@@ -5,15 +5,33 @@ export default {
5
  theme: {
6
  extend: {
7
  colors: {
8
- primary: { DEFAULT: '#10b981', dark: '#059669' },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  },
10
  fontFamily: {
11
- sans: ['-apple-system', 'BlinkMacSystemFont', 'Inter', 'Segoe UI', 'Roboto', 'sans-serif'],
12
- mono: ['JetBrains Mono', 'Fira Code', 'Menlo', 'Monaco', 'monospace'],
13
  },
14
- animation: {
15
- 'fade-in': 'fadeIn 0.4s ease-out',
16
- 'shimmer': 'shimmer 2s infinite',
 
 
17
  },
18
  },
19
  },
 
5
  theme: {
6
  extend: {
7
  colors: {
8
+ cn: {
9
+ bg: 'var(--cn-bg)',
10
+ surface: 'var(--cn-surface)',
11
+ 'surface-elevated': 'var(--cn-surface-elevated)',
12
+ border: 'var(--cn-border)',
13
+ 'border-strong': 'var(--cn-border-strong)',
14
+ text: 'var(--cn-text)',
15
+ muted: 'var(--cn-muted)',
16
+ accent: 'var(--cn-accent)',
17
+ 'accent-hover': 'var(--cn-accent-hover)',
18
+ success: 'var(--cn-success)',
19
+ danger: 'var(--cn-danger)',
20
+ warn: 'var(--cn-warn)',
21
+ info: 'var(--cn-info)',
22
+ purple: 'var(--cn-purple)',
23
+ },
24
+ primary: { DEFAULT: '#2563eb', dark: '#1d4ed8' },
25
  },
26
  fontFamily: {
27
+ sans: ['Inter', '-apple-system', 'BlinkMacSystemFont', 'sans-serif'],
28
+ mono: ['JetBrains Mono', 'Fira Code', 'monospace'],
29
  },
30
+ borderRadius: { cn: '0.875rem' },
31
+ boxShadow: {
32
+ cn: 'var(--cn-shadow)',
33
+ 'cn-md': 'var(--cn-shadow-md)',
34
+ 'cn-lg': 'var(--cn-shadow-lg)',
35
  },
36
  },
37
  },