From d7388420696d8850504f2318cfb7f242a4f06394 Mon Sep 17 00:00:00 2001 From: mawkone Date: Sun, 14 Jun 2026 13:20:49 -0700 Subject: [PATCH] fix(codebase): remove legacy single-codebase hint description from api endpoints --- .../project/[projectId]/(home)/code/page.tsx | 194 +++++++++++------- .../api/projects/[projectId]/anatomy/route.ts | 2 +- .../projects/[projectId]/codebases/route.ts | 26 ++- 3 files changed, 135 insertions(+), 87 deletions(-) diff --git a/vibn-frontend/app/[workspace]/project/[projectId]/(home)/code/page.tsx b/vibn-frontend/app/[workspace]/project/[projectId]/(home)/code/page.tsx index 43eedafc..8c364d00 100644 --- a/vibn-frontend/app/[workspace]/project/[projectId]/(home)/code/page.tsx +++ b/vibn-frontend/app/[workspace]/project/[projectId]/(home)/code/page.tsx @@ -48,95 +48,124 @@ export default function CodeTab() { const showLoading = loading && !anatomy; return ( -
+
- -
- {/* ── Left rail ── */} -
- {showLoading && ( + +
+ {/* ── Left rail ── */} +
+ {showLoading && ( -
+
Loading…
)} - {error && !showLoading && ( + {error && !showLoading && ( -
+
{error}
)} - {anatomy && ( - <> - {/* Code Files */} - - {codebases && codebases.length === 0 && ( - - {reason === "no_repo" ? ( - <> - No codebase yet.{" "} - - Try: "Start building my app" - - - ) : ( - <> - Repo is empty — push a first commit.{" "} - - Try: "Scaffold a Next.js app" - - - )} - - )} - {codebases?.map((cb) => { - return ( -
-
- - - - -
-
{cb.label}
- {cb.hint &&
{cb.hint}
} + {anatomy && ( + <> + {/* Code Files */} + + {codebases && codebases.length === 0 && ( + + {reason === "no_repo" ? ( + <> + No codebase yet.{" "} + + Try: "Start building my app" + + + ) : ( + <> + Repo is empty — push a first commit.{" "} + + Try: "Scaffold a Next.js app" + + + )} + + )} + {codebases?.map((cb) => { + return ( +
+
+ + + + +
+
{cb.label}
+ {cb.hint &&
{cb.hint}
} +
-
-
- - setSelection({ - type: "file", - codebaseId: cb.id, - path: p, - }) - } - /> -
-
- ); - })} -
- - )} -
+
+ + setSelection({ + type: "file", + codebaseId: cb.id, + path: p, + }) + } + /> +
+ + ); + })} + + + )} +
- {/* ── Right pane ── */} -
+
); diff --git a/vibn-frontend/app/api/projects/[projectId]/anatomy/route.ts b/vibn-frontend/app/api/projects/[projectId]/anatomy/route.ts index 57e32c49..a1117a52 100644 --- a/vibn-frontend/app/api/projects/[projectId]/anatomy/route.ts +++ b/vibn-frontend/app/api/projects/[projectId]/anatomy/route.ts @@ -254,7 +254,7 @@ async function discoverCodebases(giteaRepo: string): Promise<{ id: "root", label: repoName, path: "", - hint: "Single-codebase project — repository root.", + hint: "", }, ]; } diff --git a/vibn-frontend/app/api/projects/[projectId]/codebases/route.ts b/vibn-frontend/app/api/projects/[projectId]/codebases/route.ts index 8c6b3aeb..0ffc8ac2 100644 --- a/vibn-frontend/app/api/projects/[projectId]/codebases/route.ts +++ b/vibn-frontend/app/api/projects/[projectId]/codebases/route.ts @@ -35,14 +35,17 @@ interface GiteaItem { type: "file" | "dir" | "symlink"; } -async function giteaList(repo: string, path: string): Promise { +async function giteaList( + repo: string, + path: string, +): Promise { const encoded = path ? encodeURIComponent(path).replace(/%2F/g, "/") : ""; const res = await fetch( `${GITEA_API_URL}/api/v1/repos/${repo}/contents/${encoded}`, { headers: { Authorization: `token ${GITEA_API_TOKEN}` }, next: { revalidate: 30 }, - } + }, ); if (res.status === 404) return null; if (!res.ok) throw new Error(`Gitea ${res.status} listing ${repo}/${path}`); @@ -52,7 +55,7 @@ async function giteaList(repo: string, path: string): Promise } + { params }: { params: Promise<{ projectId: string }> }, ) { try { const { projectId } = await params; @@ -65,7 +68,7 @@ export async function GET( `SELECT p.data FROM fs_projects p JOIN fs_users u ON u.id = p.user_id WHERE p.id = $1 AND u.data->>'email' = $2 LIMIT 1`, - [projectId, session.user.email] + [projectId, session.user.email], ); if (rows.length === 0) { return NextResponse.json({ error: "Project not found" }, { status: 404 }); @@ -89,15 +92,17 @@ export async function GET( }); } - const appsDir = root.find(item => item.type === "dir" && item.name === "apps"); + const appsDir = root.find( + (item) => item.type === "dir" && item.name === "apps", + ); let codebases: Codebase[] = []; if (appsDir) { const appsChildren = await giteaList(giteaRepo, "apps"); if (appsChildren) { codebases = appsChildren - .filter(item => item.type === "dir") - .map(item => ({ + .filter((item) => item.type === "dir") + .map((item) => ({ id: item.name, label: item.name, path: `apps/${item.name}`, @@ -114,7 +119,7 @@ export async function GET( id: "root", label: repoName, path: "", - hint: "Single-codebase project — repository root.", + hint: "", }, ]; } @@ -122,6 +127,9 @@ export async function GET( return NextResponse.json({ codebases }); } catch (err) { console.error("[codebases API]", err); - return NextResponse.json({ error: "Failed to list codebases" }, { status: 500 }); + return NextResponse.json( + { error: "Failed to list codebases" }, + { status: 500 }, + ); } }