-
由 Will Chen 提交于
## Summary - Fixes Windows-specific bug where `path.relative()` generates backslash paths (e.g., `src\components\Button.tsx`) that break TSC workers and git operations - Normalizes paths to use forward slashes in both component tagger plugins (nextjs-webpack and react-vite) - Adds defensive normalization in `visual_editing_handlers.ts` and `PreviewIframe.tsx` Fixes #2271 ## Test plan - [ ] Test on Windows: use Annotator / Edit with Select to refactor or move files - [ ] Verify no TSC worker errors occur after using the visual editing tools - [ ] Verify git operations don't fail due to invalid paths
🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Bug fix: Windows path normalization** > > - Update `safeJoin` to normalize backslashes via `normalizePath`, then validate/block absolute, home, and UNC paths before joining; join uses normalized segments > - Normalize `gitAdd` filepaths for both native Git and isomorphic-git; adjust error messages accordingly > - Visual editing handler now stages modified files with `gitAdd` (replacing direct isomorphic-git add) while continuing to use `safeJoin` > - Tests updated to assert forward-slash normalization for Windows-style inputs > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 5e1cf28e5632a37c564c71b52cc702b7c57e49fc. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Normalize Windows backslash paths to forward slashes across component taggers, visual editing, and git staging so TSC workers and git operations don’t break on Windows. Centralizes normalization in gitAdd and safeJoin for consistent component IDs and file paths. - **Bug Fixes** - Next.js webpack and Vite taggers: replace backslashes from path.relative() with forward slashes. - Git utils: gitAdd normalizes filepath before staging (native Git and isomorphic-git). - Path utils: safeJoin normalizes segments before joining and blocks unsafe absolute paths. - Visual editing and preview: normalize component IDs and paths; use gitAdd and safeJoin for file staging. <sup>Written for commit 674f783cdd844fb98cd746cd8d7dc9234d419d80. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by:Claude Opus 4.5 <noreply@anthropic.com>