Skip to content

Comments

fix(symlinks): Clean git index when migrating directory to symlink#33

Merged
gricha merged 1 commit intomainfrom
fix-symlink-issue
Feb 23, 2026
Merged

fix(symlinks): Clean git index when migrating directory to symlink#33
gricha merged 1 commit intomainfrom
fix-symlink-issue

Conversation

@gricha
Copy link
Member

@gricha gricha commented Feb 23, 2026

When a user has a pre-existing skill committed as a real file (e.g.,
.claude/skills/writing-assistant/SKILL.md) and then runs dotagents install,
the tool migrates the files to .agents/skills/ and replaces .claude/skills/
with a symlink. However, git's index still references the old paths, causing:

error: '.claude/skills/writing-assistant/SKILL.md' is beyond a symbolic link
fatal: Unable to process path .claude/skills/writing-assistant/SKILL.md

This adds a best-effort git rm -r --cached --ignore-unmatch call during the
directory-to-symlink migration to clear stale index entries. The call is wrapped
in a try/catch so it silently does nothing when not in a git repo or when git
isn't available.

Agent transcript: https://claudescope.sentry.dev/share/vQlVJtcuM0_Rd7Nt57nIDj-P25tfFxeMXzKe9exg_M8

When a real skills directory (e.g. .claude/skills/) contains files
previously tracked by git, replacing it with a symlink causes git
to error with "beyond a symbolic link". Run `git rm --cached` on
the directory during migration to clear stale index entries.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/uvNWVFn7VxnO_y4YuhSoZGROZ_CkZSN2imoRF7EvY6s
@vercel
Copy link

vercel bot commented Feb 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dotagents Ready Ready Preview, Comment Feb 23, 2026 10:09pm

Request Review

@gricha gricha marked this pull request as ready for review February 23, 2026 22:16
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

// Verify the skill was moved to .agents/skills/
const agentsEntries = await readdir(join(agentsDir, "skills"));
expect(agentsEntries).toContain("my-skill");
});
Copy link

Choose a reason for hiding this comment

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

Symlink tests now require git installed

Medium Severity

The new test invokes exec("git", ...) directly, so the suite fails in environments where git isn’t available on PATH (or is blocked by sandboxing). This introduces a new external dependency for running vitest that can break CI or downstream consumers running tests in minimal containers.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

False positive — the test suite already requires git. Four other test files (install.test.ts, update.test.ts, remove.test.ts, resolver.integration.test.ts) call exec("git", ...) directly.

@gricha gricha merged commit ed3392d into main Feb 23, 2026
16 checks passed
@gricha gricha deleted the fix-symlink-issue branch February 23, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant