"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"; import { Download, Search, CheckCircle2, FileText } from "lucide-react"; import { toast } from "sonner"; interface ProjectConfigGeneratorProps { projectId: string; projectName: string; } export function ProjectConfigGenerator({ projectId, projectName }: ProjectConfigGeneratorProps) { const [showDialog, setShowDialog] = useState(false); const [searching, setSearching] = useState(false); const [fileFound, setFileFound] = useState(null); const vibnConfig = { projectId, projectName, version: "1.0", }; const configContent = JSON.stringify(vibnConfig, null, 2); const handleSearchFile = async () => { setSearching(true); setFileFound(null); try { // Prompt user to select the .vibn file const input = document.createElement('input'); input.type = 'file'; input.accept = '.vibn,.json'; input.onchange = async (e: any) => { const file = e.target?.files?.[0]; if (!file) { setSearching(false); return; } try { const text = await file.text(); const config = JSON.parse(text); if (config.projectId === projectId) { setFileFound(true); toast.success("File verified!", { description: "Your .vibn file is correctly configured for this project", }); } else { setFileFound(false); toast.error("Project ID mismatch", { description: "This .vibn file is for a different project", }); } } catch (error) { setFileFound(false); toast.error("Invalid file", { description: "Could not read or parse the .vibn file", }); } setSearching(false); }; input.click(); } catch (error) { toast.error("Failed to search for file"); setSearching(false); } }; const handleDownload = () => { const blob = new Blob([configContent], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = ".vibn"; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); toast.success("Configuration downloaded!", { description: "Save it to your project root and restart Cursor", }); }; return ( <> Link Your Workspace Add a .vibn file to your project root so the Cursor extension automatically tracks sessions.
{/* Primary Action */} {/* Instructions */}

Setup Steps:

  1. Download the file above
  2. Save it to your project root as .vibn
  3. Commit and push to GitHub
  4. Extension will auto-link sessions to this project
{/* Verification */}
{fileFound === false && (

File not found or incorrect projectId

)} {fileFound === true && (

Ready! Push to GitHub and you're all set.

)}
); }