fix: normalize Windows project file paths#1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8517eac88
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| export function resolveProjectFilePath(baseDir: string, filepath: string): string { | ||
| const normalizedPath = normalizeProjectFilePath(filepath); | ||
| return path.join(baseDir, normalizedPath); |
There was a problem hiding this comment.
Drop the preserved absolute path prefix before joining
When a snapshot contains an absolute file like C:\repo\package.json or /home/alice/repo/package.json, resolveProjectFilePath() writes it to <baseDir>/repo/package.json instead of <baseDir>/package.json. matchesProjectFilePath() still treats that same entry as the root manifest, so startPreview() and runBuild() invoke npm install from the workspace root (apps/platform-api/src/modules/preview/preview.service.ts:75-84, apps/platform-api/src/modules/sandbox/sandbox.service.ts:56-67), where no package.json exists. In the absolute-path cases this patch is meant to support, preview/build still fail.
Useful? React with 👍 / 👎.
Competitor analysis (Lovable, Bolt.new, v0, Replit, Firebase Studio) identified browser preview and deployment as the #1 gap. Discovered existing WebContainer + Vercel deploy code is implemented but dormant due to useEffect dependency bug and snapshot-only deployment constraint. Spec covers: WebContainer fix, deploy-from-current-state, error logging, fallback chain. Rev 2 after two rounds of automated spec review. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Motivation
package.jsonto behave incorrectly.Description
apps/platform-api/src/common/file-path.utils.tsprovidingnormalizeProjectFilePath,resolveProjectFilePath, andmatchesProjectFilePathutilities to normalize Windows drive prefixes, convert backslashes, and perform tolerant suffix-based matching.apps/platform-api/src/modules/preview/preview.service.ts) to detectpackage.jsonviamatchesProjectFilePathand to write files usingresolveProjectFilePath.apps/platform-api/src/modules/sandbox/sandbox.service.ts) to detectpackage.json/tsconfig*withmatchesProjectFilePathand to write files usingresolveProjectFilePathprior to install/build steps.apps/platform-api/src/modules/session/session.service.ts) to normalize incoming file paths withnormalizeProjectFilePathand to locatepackage.jsonusingmatchesProjectFilePath.Testing
pnpm --filter @ai-platform/platform-api exec ts-node --transpile-only -e "...file-path.utils"which printed normalized examples and validated that a Windows-style path matchespackage.json, and the check succeeded.pnpm --filter @ai-platform/platform-api buildto validate the service build, but the workspace build failed due to pre-existing TypeScript/Prisma typing errors unrelated to the path-normalization changes.Codex Task