Spaces:
Build error
Build error
David Prince
fix: add all missing local module stubs (remote_mcp_registry, mcp_auth, mcp_transport, etc)
cce8120 | set -euo pipefail | |
| echo "[1/10] Creating GitHub Workspace..." | |
| mkdir -p services/github | |
| mkdir -p hooks | |
| cat > services/github/client.js <<'EOC' | |
| import api from "../api"; | |
| export async function repositories(){ | |
| const {data}=await api.get("/api/github/repositories"); | |
| return data; | |
| } | |
| export async function repository(name){ | |
| const {data}=await api.get(`/api/github/repositories/${name}`); | |
| return data; | |
| } | |
| export async function cloneRepository(url){ | |
| const {data}=await api.post("/api/github/clone",{url}); | |
| return data; | |
| } | |
| export async function createRepository(payload){ | |
| const {data}=await api.post("/api/github/repositories",payload); | |
| return data; | |
| } | |
| export async function commit(projectId,message){ | |
| const {data}=await api.post(`/api/github/${projectId}/commit`,{ | |
| message | |
| }); | |
| return data; | |
| } | |
| export async function push(projectId){ | |
| const {data}=await api.post(`/api/github/${projectId}/push`); | |
| return data; | |
| } | |
| export async function pull(projectId){ | |
| const {data}=await api.post(`/api/github/${projectId}/pull`); | |
| return data; | |
| } | |
| export async function branches(projectId){ | |
| const {data}=await api.get(`/api/github/${projectId}/branches`); | |
| return data; | |
| } | |
| export async function checkout(projectId,branch){ | |
| const {data}=await api.post(`/api/github/${projectId}/checkout`,{ | |
| branch | |
| }); | |
| return data; | |
| } | |
| export async function pullRequests(projectId){ | |
| const {data}=await api.get(`/api/github/${projectId}/pull-requests`); | |
| return data; | |
| } | |
| EOC | |
| cat > hooks/useGitHub.js <<'EOC' | |
| "use client"; | |
| import {useState} from "react"; | |
| import * as github from "../services/github/client"; | |
| export default function useGitHub(){ | |
| const [loading,setLoading]=useState(false); | |
| async function execute(fn,...args){ | |
| setLoading(true); | |
| try{ | |
| return await fn(...args); | |
| }finally{ | |
| setLoading(false); | |
| } | |
| } | |
| return{ | |
| loading, | |
| repositories:(...a)=>execute(github.repositories,...a), | |
| repository:(...a)=>execute(github.repository,...a), | |
| cloneRepository:(...a)=>execute(github.cloneRepository,...a), | |
| createRepository:(...a)=>execute(github.createRepository,...a), | |
| commit:(...a)=>execute(github.commit,...a), | |
| push:(...a)=>execute(github.push,...a), | |
| pull:(...a)=>execute(github.pull,...a), | |
| branches:(...a)=>execute(github.branches,...a), | |
| checkout:(...a)=>execute(github.checkout,...a), | |
| pullRequests:(...a)=>execute(github.pullRequests,...a) | |
| }; | |
| } | |
| EOC | |
| echo "[2/10] Installing..." | |
| npm install | |
| echo "[3/10] Building..." | |
| npm run build >/dev/null | |
| echo "[4/10] Verify..." | |
| test -f services/github/client.js | |
| test -f hooks/useGitHub.js | |
| echo "[5/10] GitHub API installed." | |
| echo "[6/10] GitHub hooks installed." | |
| echo "[7/10] Production build verified." | |
| echo "[8/10] Frontend verified." | |
| echo "[9/10] Ready." | |
| echo "[10/10] Complete." | |