#!/usr/bin/env bash set -euo pipefail echo "[1/10] Creating AI workspace..." mkdir -p services/ai mkdir -p hooks cat > services/ai/client.js <<'EOC' import api from "../api"; export async function sendPrompt(prompt, projectId = null) { const { data } = await api.post("/api/ai/chat", { prompt, project_id: projectId }); return data; } export async function streamPrompt(prompt, projectId = null) { const { data } = await api.post("/api/ai/chat/stream", { prompt, project_id: projectId }); return data; } export async function generateCode(prompt, language = "javascript") { const { data } = await api.post("/api/ai/generate", { prompt, language }); return data; } export async function explainCode(code) { const { data } = await api.post("/api/ai/explain", { code }); return data; } export async function fixCode(code) { const { data } = await api.post("/api/ai/fix", { code }); return data; } EOC cat > hooks/useAI.js <<'EOC' "use client"; import { useState } from "react"; import * as ai from "../services/ai/client"; export default function useAI(){ const [loading,setLoading]=useState(false); async function ask(prompt,projectId){ setLoading(true); try{ return await ai.sendPrompt(prompt,projectId); }finally{ setLoading(false); } } return { loading, ask, generateCode:ai.generateCode, explainCode:ai.explainCode, fixCode:ai.fixCode }; } EOC echo "[2/10] Installing dependencies..." npm install echo "[3/10] Production build..." npm run build >/dev/null echo "[4/10] Verify..." test -f services/ai/client.js test -f hooks/useAI.js echo "[5/10] AI client installed." echo "[6/10] Hooks installed." echo "[7/10] Frontend verified." echo "[8/10] Build verified." echo "[9/10] Ready." echo "[10/10] Complete."