Skip to content

chore: setup LLM-assisted IDE config#784

Draft
jason-rl wants to merge 1 commit into
mainfrom
jason/llm_ide_infra
Draft

chore: setup LLM-assisted IDE config#784
jason-rl wants to merge 1 commit into
mainfrom
jason/llm_ide_infra

Conversation

@jason-rl
Copy link
Copy Markdown
Contributor

@jason-rl jason-rl commented Apr 27, 2026

User description

⚠️ PR Title Must Follow Conventional Commits

Format: feat[optional scope]: <description>

Examples: feat: add new SDK method · feat(storage): support file uploads · feat!: breaking API change

Description

Motivation

Changes

Testing

  • Unit tests added
  • Integration tests added
  • Smoke Tests added/updated
  • Tested locally

Breaking Changes

Checklist

  • PR title follows Conventional Commits format (feat: or feat(scope):)
  • Documentation updated (if needed)
  • Breaking changes documented (if applicable)

CodeAnt-AI Description

Set up automatic workspace syncing for supported IDEs

What Changed

  • New workspaces can now automatically copy shared project files from the main workspace during setup
  • Shared folders such as node_modules can be linked instead of duplicated, reducing setup time and disk use
  • Cursor and Windsurf now run the sync step automatically when a worktree is created

Impact

✅ 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.

@jason-rl jason-rl requested review from dines-rl and tode-rl April 27, 2026 19:24
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented Apr 27, 2026

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 ·
Reddit ·
LinkedIn

@jason-rl jason-rl changed the title Setup LLM-assisted IDE config chore: setup LLM-assisted IDE config Apr 27, 2026
@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Apr 27, 2026
Comment thread scripts/setup_worktree.py
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented Apr 27, 2026

CodeAnt AI finished reviewing your PR.

@jason-rl jason-rl force-pushed the jason/llm_ide_infra branch from 78a60c8 to 1acb56d Compare April 27, 2026 19:31
@jason-rl jason-rl marked this pull request as draft April 27, 2026 20:11
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 4, 2026

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 ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 4, 2026
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 4, 2026

Sequence Diagram

This 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
Loading

Generated by CodeAnt AI

Comment thread scripts/setup_worktree.py
Comment on lines +156 to +166
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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 4, 2026

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 ·
Reddit ·
LinkedIn

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 6, 2026

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 ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 6, 2026
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 6, 2026

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 ·
Reddit ·
LinkedIn

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 9, 2026

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 ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 9, 2026
@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 9, 2026

Sequence Diagram

This 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
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown
Contributor

codeant-ai Bot commented May 9, 2026

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 ·
Reddit ·
LinkedIn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant