diff --git a/apps/api/src/onboarding-scan.ts b/apps/api/src/onboarding-scan.ts index 765336b..bad1aa8 100644 --- a/apps/api/src/onboarding-scan.ts +++ b/apps/api/src/onboarding-scan.ts @@ -1,13 +1,14 @@ // Onboarding scan — real filesystem scan, Git analysis, and profile compilation. // Runs synchronously on the host machine (no sandbox needed). import { spawn } from "node:child_process"; -import { access, readdir, realpath, stat } from "node:fs/promises"; +import { access, readdir, stat } from "node:fs/promises"; import { basename, dirname, join } from "node:path"; import type { Actor } from "@rakazo/contracts"; import type { PrismaClient } from "@rakazo/db"; import { createSpaceForMember, InvalidSpaceNameError, + resolveProjectWorkspaceDirectory, SpaceLimitError, wireProjectWorkspace, } from "@rakazo/db"; @@ -656,7 +657,8 @@ async function createProjects( for (const repo of repos) { // Compare and link the real folder, so the next scan recognizes the projects of this one. - const folder = await realpath(repo.path).catch(() => null); + // Checking it before the project exists means a folder that cannot be linked leaves none. + const folder = await resolveProjectWorkspaceDirectory(repo.path).catch(() => null); if (!folder || linkedFolders.has(folder)) continue; let space: { id: string; name: string }; try {