From 2057a61ea2640eb06b64756f28d2fadfe897b79e Mon Sep 17 00:00:00 2001 From: mawkone Date: Sat, 16 May 2026 12:49:50 -0700 Subject: [PATCH] fix(ai): correct syntax for executing bash scripts inside the dev container --- .../ai/project-context/codebase-summary.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/vibn-frontend/lib/ai/project-context/codebase-summary.ts b/vibn-frontend/lib/ai/project-context/codebase-summary.ts index 252cdfe..5d3966d 100644 --- a/vibn-frontend/lib/ai/project-context/codebase-summary.ts +++ b/vibn-frontend/lib/ai/project-context/codebase-summary.ts @@ -42,7 +42,7 @@ export async function buildCodebaseSummary( echo "No package.json found" fi - echo -e "\n=== ARCHITECTURE ===" + echo -e "\\n=== ARCHITECTURE ===" if [ -d src/app ] || [ -d app ]; then echo "- Next.js App Router"; fi if [ -f prisma/schema.prisma ]; then echo "- Prisma ORM (prisma/schema.prisma)"; fi if [ -f drizzle.config.ts ]; then echo "- Drizzle ORM"; fi @@ -50,24 +50,27 @@ export async function buildCodebaseSummary( if [ -f vite.config.ts ] || [ -f vite.config.js ]; then echo "- Vite SPA"; fi if [ -f docker-compose.yml ]; then echo "- Docker Compose deployed"; fi - echo -e "\n=== DIRECTORY TREE ===" + echo -e "\\n=== DIRECTORY TREE ===" # Generate a tree up to 3 levels deep, ignoring heavy/noisy folders. # This gives the AI an instant map of the codebase without needing to run fs_tree manually. find . -maxdepth 4 -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/.next/*" -not -path "*/dist/*" -not -path "*/build/*" | sort | sed -e "s/[^-][^\\/]*\\// |/g" -e "s/|\\([^ ]\\)/|-\\1/" | head -n 300 - \`; + `; - const result = await execInDevContainer(projectId, bashScript); + const result = await execInDevContainer({ + projectId, + command: bashScript, + }); - if (result.code !== 0 || !result.stdout.trim()) { + if (result.exitCode !== 0 || !result.stdout.trim()) { return ""; } - return \`\n## CODEBASE SUMMARY (Auto-detected) -This is a real-time map of the files currently existing in \\\`/workspace/\${projectSlug}/\\\`: -\\\`\\\`\\\`text -\${result.stdout.trim().slice(0, 4000)} -\\\`\\\`\\\` -Use this directory tree to orient yourself. You do not need to run fs_list or fs_tree to find where files live. Do not guess the stack; if it says Next.js and Prisma, use Next.js and Prisma.\`; + return `\n## CODEBASE SUMMARY (Auto-detected) +This is a real-time map of the files currently existing in \`/workspace/${projectSlug}/\`: +\`\`\`text +${result.stdout.trim().slice(0, 4000)} +\`\`\` +Use this directory tree to orient yourself. You do not need to run fs_list or fs_tree to find where files live. Do not guess the stack; if it says Next.js and Prisma, use Next.js and Prisma.`; } catch (error) { console.warn("[Codebase Summary] Failed to generate summary:", error); return "";