chore: setup LLM-assisted IDE config#784
Conversation
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI finished reviewing your PR. |
78a60c8 to
1acb56d
Compare
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR adds IDE hook configurations and a shared setup script so new worktrees automatically sync common dependencies and rules from a root workspace using copy or symlink strategies. sequenceDiagram
participant IDE
participant SetupScript
participant RootWorkspace
participant Worktree
IDE->>SetupScript: Run setup_worktree with root path and patterns
SetupScript->>RootWorkspace: Scan files matching copy and symlink patterns
SetupScript->>SetupScript: Resolve conflicts and decide copy or symlink per item
SetupScript->>Worktree: Apply copies and symlinks in parallel
alt Matches and operations succeed
SetupScript-->>IDE: Worktree ready with shared dependencies and rules
else No matches or failed operations
SetupScript-->>IDE: Warning or error about unmatched or failed items
end
Generated by CodeAnt AI |
| elif src.is_dir(): | ||
| if dst.exists() and (not dst.is_dir() or any(dst.iterdir())): | ||
| return | ||
| if dst.exists(): | ||
| shutil.rmtree(dst) | ||
| shutil.copytree(src, dst, symlinks=True, copy_function=shutil.copy2) | ||
| else: | ||
| if dst.exists() and (not dst.is_file() or dst.stat().st_size > 0): | ||
| return | ||
| dst.parent.mkdir(parents=True, exist_ok=True) | ||
| shutil.copy2(src, dst) |
There was a problem hiding this comment.
Suggestion: Destination existence checks in the non-symlink copy paths use dst.exists() instead of _dst_exists(dst), so broken symlinks are treated as non-existent. That causes copy operations to proceed into paths that already contain dangling links and then fail with filesystem errors. Use _dst_exists(dst) (and handle symlink destinations explicitly) before attempting directory/file copy. [possible bug]
Severity Level: Major ⚠️
- ❌ Worktree setup fails when copying into broken symlink destinations.
- ⚠️ LLM-assisted IDE workspace initialization aborts on previously linked paths.Steps of Reproduction ✅
1. First run: create a symlink destination using the script. From the repo root, invoke
`scripts/setup_worktree.py` (entrypoint at `scripts/setup_worktree.py:308-309`) with a
root that has a directory `shared/` and a `-s shared` pattern; `main()` at
`scripts/setup_worktree.py:177-204` builds a `("symlink", src, dst)` work item and
`symlink_entry()` at `169-174` creates a symlink `shared` in the worktree.
2. Break the symlink target so it becomes dangling while keeping the worktree entry. For
example, move or delete the original `shared/` directory in the root workspace so that the
symlink created in step 1 now points to a non-existent target; at this point
`Path(dst).exists()` returns False but `dst.is_symlink()` remains True (as used in
`_dst_exists()` at `126-128`).
3. Second run: switch to copying the same path. Update patterns so `shared/` is matched by
a copy rule (via `.worktreeinclude` or `-c` flags processed in `main()` at `186-193`), and
rerun `scripts/setup_worktree.py`. The walker in `main()` at `215-279` collects a
`("copy", src=.../shared, dst=<worktree>/shared)` item and submits it to `copy_entry()` at
`131-167`.
4. Observe the failure when copying into the broken symlink destination. In
`copy_entry()`'s directory branch at `156-161`, the code checks `dst.exists()` (line 157)
instead of `_dst_exists(dst)` and therefore treats the dangling symlink as non-existent,
then calls `shutil.copytree(src, dst, ...)` at line 161. `copytree` attempts to create a
directory where the symlink entry already exists and raises a filesystem error (e.g.,
`FileExistsError`), which is collected in `errors` at `284-300` and reported as `error:
copy <src>: <exc>` at `302-305` before the script exits with status 1.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** scripts/setup_worktree.py
**Line:** 156:166
**Comment:**
*Possible Bug: Destination existence checks in the non-symlink copy paths use `dst.exists()` instead of `_dst_exists(dst)`, so broken symlinks are treated as non-existent. That causes copy operations to proceed into paths that already contain dangling links and then fail with filesystem errors. Use `_dst_exists(dst)` (and handle symlink destinations explicitly) before attempting directory/file copy.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
CodeAnt AI is running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Sequence DiagramThis PR adds IDE hook configurations and a setup script so new IDE worktrees automatically sync configuration files and shared dependencies from the main workspace. sequenceDiagram
participant Dev
participant IDE
participant SetupScript
participant RootWorkspace
participant Worktree
Dev->>IDE: Create new worktree
IDE->>SetupScript: Run setup_worktree with root path and patterns
SetupScript->>RootWorkspace: Load worktree include and CLI patterns
SetupScript->>RootWorkspace: Scan files and directories
SetupScript->>Worktree: Copy matched workspace files
SetupScript->>Worktree: Symlink shared dependencies and rules
SetupScript-->>IDE: Report sync completion
IDE-->>Dev: Worktree ready with shared setup
Generated by CodeAnt AI |
|
CodeAnt AI finished running the review. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
User description
Format:
feat[optional scope]: <description>Examples:
feat: add new SDK method·feat(storage): support file uploads·feat!: breaking API changeDescription
Motivation
Changes
Testing
Breaking Changes
Checklist
feat:orfeat(scope):)CodeAnt-AI Description
Set up automatic workspace syncing for supported IDEs
What Changed
node_modulescan be linked instead of duplicated, reducing setup time and disk useImpact
✅ Faster new workspace setup✅ Less manual IDE setup✅ Shared dependencies available across workspaces🔄 Retrigger CodeAnt AI Review
Details
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.