import { useEffect, useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import { apiFetch } from '@core/lib/api' import { Card, CardContent, CardHeader, CardTitle } from '@core/components/ui/card' import { Button } from '@core/components/ui/button' import { Plus } from 'lucide-react' export default function CILProjectsPage() { const navigate = useNavigate() const [projects, setProjects] = useState([]) const [loading, setLoading] = useState(false) const [creating, setCreating] = useState(false) const [error, setError] = useState(null) const load = async () => { setLoading(true) setError(null) try { const r = await apiFetch('/api/admin-data?entity=items&type_slug=cil_project&status=active&limit=200') const json = await r.json() if (json.error) throw new Error(json.error) setProjects(Array.isArray(json.data) ? json.data : []) } catch (err: any) { setError(err.message || 'Failed to load projects') } finally { setLoading(false) } } useEffect(() => { load() }, []) const handleNew = async () => { setCreating(true) try { const r = await apiFetch('/api/admin-data?entity=items', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ type_slug: 'cil_project', title: 'New CIL Project', status: 'active', data: {}, }) }) const json = await r.json() if (json.error) throw new Error(json.error) navigate(`/workbench/cil/projects/${json.data?.id || json.data?.data?.id}`) } catch (err: any) { setError(err.message || 'Failed to create project') } finally { setCreating(false) } } return (

CIL Projects

Configured code-intelligence projects for the Workbench.

{loading &&

Loading projects...

} {error &&

{error}

} {projects.length === 0 && !loading && !error && ( No projects yet

Click New Project to create the first CIL project.

)}
{projects.map((p: any) => ( {p.title || p.id}

{p.description || 'No description'}

))}
) }