fix(ai): correct syntax for executing bash scripts inside the dev container

This commit is contained in:
2026-05-16 12:49:50 -07:00
parent 70ea8f849b
commit 2057a61ea2

View File

@@ -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 "";