import { redirect } from 'next/navigation' import { getCurrentUser } from '@/lib/session' import { execAgent } from '@/lib/agent-client' import { parseGitStatus, type RepoStatus } from '@/lib/parse-git' import GitReposList from './_components/git-repos-list' export const dynamic = 'force-dynamic' function repoName(repoPath: string): string { return repoPath.split('/').filter(Boolean).pop() ?? repoPath } export default async function GitPage() { const user = await getCurrentUser() if (!user) redirect('/login') const repoPaths = (process.env.REPO_PATHS ?? '') .split(',') .map((p) => p.trim()) .filter(Boolean) const initialRepos = await Promise.all( repoPaths.map(async (path) => { let status: RepoStatus | null = null let error: string | null = null try { const output = await execAgent('git_status', [path]) status = parseGitStatus(output) } catch (err) { error = err instanceof Error ? err.message : 'failed' } return { path, name: repoName(path), status, error } }), ) return (

Git Repositories

Auto-refreshes every 30 seconds

{repoPaths.length === 0 ? (
No repos configured. Set REPO_PATHS in your environment (comma-separated absolute paths).
) : ( )}
) }