Skip to content

fix: installer symlinks, agent selection, and detection refinements#297

Merged
quuu merged 10 commits intovercel-labs:mainfrom
Ashutosh0x:fix/hang-and-detection-v2
Feb 20, 2026
Merged

fix: installer symlinks, agent selection, and detection refinements#297
quuu merged 10 commits intovercel-labs:mainfrom
Ashutosh0x:fix/hang-and-detection-v2

Conversation

@Ashutosh0x
Copy link
Contributor

@Ashutosh0x Ashutosh0x commented Feb 5, 2026

Pull Request: fix installer symlinks, agent selection, and removal protection

Fixes #58
Fixes #186
Fixes #293
Fixes #65
Fixes #287

Changes

1. Fix Symlink Installation Bug (#293)

Modified src/installer.ts to use realpath for path comparisons in createSymlink. This ensures that when an agent's skills directory is a symlink to the canonical .agents/skills location, the installer doesn't accidentally delete the canonical data while trying to "clean" the link path.

2. Fix Canonical Storage Protection on Removal (#287)

Updated src/remove.ts to check if any other installed agents are still using a skill before deleting its canonical storage in .agents/skills. Previously, removing a skill from one agent would delete the source files even if other agents were still using them via symlinks.

3. Fix Explicit Agent Choice (#65)

Updated src/add.ts and unified handler logic to respect the --agent flag. Universal agents are no longer forced into the installation list when a specific agent is explicitly requested.

4. Prevent hangs on invalid/private Git repos (#58)

Modified src/git.ts to set GIT_TERMINAL_PROMPT: '0'. This prevents git clone from hanging indefinitely by waiting for credential prompts.

5. Refine agent detection logic (#186)

Narrowed down the detectInstalled logic for antigravity, github-copilot, opencode, and replit to avoid false positives from common directories like .github.

Verification Results

Symlink Bug (#293)

Verified with a reproduction script that creating a symlink where the target is already reached via another symlink no longer deletes the target files.

Removal Protection (#287)

Added a new test tests/remove-canonical.test.ts that verifies:

  • Canonical storage is preserved if another agent still has the skill.
  • Canonical storage is removed if it was the last agent using the skill.

Agent Selection (#65)

Verified that skills add vercel-labs/skills --agent claude-code installs ONLY to Claude and doesn't force other agents.

All Tests

Ran pnpm test and verified all 284 tests pass.

This commit:
1. Prevents 'skills add' from hanging on invalid/private repos by disabling git terminal prompts.
2. Refines agent detection for antigravity, copilot, opencode, and replit to reduce false positives.
@Ashutosh0x
Copy link
Contributor Author

Ashutosh0x commented Feb 5, 2026

Hey @qual1337,

I've put together a few fixes for common CLI annoyances:

  1. Fixed the hang on add when there's a typo in the repo name by disabling git terminal prompts.
  2. Refined the agent detection logic to address [Bug]: Fix detected agents #186. Some of the checks were a bit too broad (e.g., checking for .github in any project was triggering Copilot detection for everyone).

Tested these locally and they seem to make the experience much smoother. Let me know if you need any adjustments!

…symlinked agent dirs

This fixes a bug where installing a skill would fail (or delete existing data) if the agent's skill directory was a symlink to the canonical .agents/skills location. By using realpath for comparison, we correctly identify when paths resolve to the same location even if their string representations differ due to symlinks.
This fixes vercel-labs#65 by removing the forced inclusion of universal agents when --agent is explicitly specified in handleRemoteSkill. It also ensures consistent behavior across all installation handlers by calling ensureUniversalAgents in all auto-selection paths.
@Ashutosh0x Ashutosh0x changed the title fix: prevent hangs on invalid git repos and refine agent detection fix: installer symlinks, agent selection, and detection refinements Feb 5, 2026
@Ashutosh0x
Copy link
Contributor Author

I've updated this PR to include two additional critical fixes:

  1. Fix for Symlinked Agent Directories ([Bug]: Skill installation fails when ~/.claude/skills is symlinked #293): Prevents accidental deletion of canonical skills when agent directories are symlinks.
  2. Respect Explicit Agent Choice ([Bug]: Agent param not respected #65): Ensures the --agent\ flag is respected and doesn't force-include universal agents.

These are now included in the same branch/PR along with the previously mentioned detection refinements. All tests are passing.

Fixes vercel-labs#287 by checking if any remaining installed agents are still using the target skill before removing its canonical storage. The first removal loop now also correctly avoids deleting the canonical storage directly.
@Ashutosh0x
Copy link
Contributor Author

Hey @qual1337, I've updated this PR with several more fixes and a new test for the removal protection logic. All 284 tests are passing! Let me know if you'd like any adjustments.

@quuu
Copy link
Collaborator

quuu commented Feb 5, 2026

@Ashutosh0x looks like only 2 fixes are in here?

  • Prevent git clone hangs
  • Refine agent detection

@Ashutosh0x
Copy link
Contributor Author

@quuu Apologies for the confusion! It looks like I pushed the previous updates to my other fork by mistake, so the PR didn't reflect the new commits. I've just force-pushed the correct branch to this PR.

It now contains all 5 fixes as described:

  1. Fix Symlink Installation Bug ([Bug]: Skill installation fails when ~/.claude/skills is symlinked #293): Modified src/installer.ts to use
    ealpath for path comparisons.
  2. Fix Canonical Storage Protection on Removal ([Bug]: npx skills remove -a <agent> unconditionally deletes source files, breaking other agents #287): Updated src/remove.ts to check if other agents use a skill before deleting its source; added ests/remove-canonical.test.ts.
  3. Fix Explicit Agent Choice ([Bug]: Agent param not respected #65): Updated src/add.ts and unified handler logic to respect the --agent\ flag.
  4. Prevent hangs on invalid Git repos ([Bug]: Add skill command hangs indefinitely on invalid input #58): Set \GIT_TERMINAL_PROMPT: '0'\ in src/git.ts.
  5. Refine agent detection logic ([Bug]: Fix detected agents #186): Reduced false positives for copilot, replit, etc. in src/agents.ts.

All 284 tests are passing. Let me know if you need any further adjustments!

@Ashutosh0x
Copy link
Contributor Author

@quuu I have pushed an additional refinement to this PR. I noticed your feedback on #284 regarding the Antigravity path—I have updated it to .agents/skills to match the unified storage standard.

This PR now addresses 6 issues: #58, #186, #284, #293, #287, and #65. It provides a comprehensive set of CLI improvements and detection refinements.

@Ashutosh0x I am tagging you here for visibility. The PR is ready for further review.

@Ashutosh0x
Copy link
Contributor Author

@quuu I have pushed one more update! I noticed your comment on #257 regarding the desire for a non-symlink installation method.

This PR now also includes a new --copy flag for the add command.

  • Using --copy will physically copy the skill files directly to the agent's specific directory, bypassing the canonical .agents/skills location and avoiding symlinks entirely.
  • This is useful for environments like Cursor where symlink discovery can sometimes be unreliable.
  • I've also updated the help message and README to document this new flag.

Total issues addressed in this PR: 7 (#58, #186, #284, #293, #287, #65, #257).

All tests are passing. Ready for your review!

@Ashutosh0x
Copy link
Contributor Author

@quuu I've pushed even more updates! I've now addressed a total of 9 issues in this PR.

New additions in this latest push:

Total issues addressed in this PR: 9 (#58, #186, #284, #293, #287, #65, #257, #294, #61).

All tests are passing. I believe this covers almost all the currently open regression bugs and high-priority CLI refinements. Ready for a final review!

@quuu
Copy link
Collaborator

quuu commented Feb 19, 2026

hey @Ashutosh0x if you can resolve the merge conflicts, this looks ready to merge!

@Ashutosh0x
Copy link
Contributor Author

@quuu Done! I've resolved the merge conflicts and fixed a small build issue that popped up during the merge. It's all set and ready for another look!

src/agents.ts Outdated
name: 'antigravity',
displayName: 'Antigravity',
skillsDir: '.agent/skills',
skillsDir: '.agents/skills',
Copy link
Collaborator

Choose a reason for hiding this comment

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

based on https://antigravity.google/docs/skills

looks like it's still .agent ?

@Ashutosh0x
Copy link
Contributor Author

Verified all tests pass (304/304). Corrected antigravity path to .agent/skills and resolved Windows environment issues (timeouts and path handling).

@quuu quuu merged commit 305ff8b into vercel-labs:main Feb 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants