Skip to content

fix: discover symlinked adapter directories in ~/.opencli/clis/#1020

Open
lanyasheng wants to merge 3 commits intojackwener:mainfrom
lanyasheng:fix/symlink-discovery
Open

fix: discover symlinked adapter directories in ~/.opencli/clis/#1020
lanyasheng wants to merge 3 commits intojackwener:mainfrom
lanyasheng:fix/symlink-discovery

Conversation

@lanyasheng
Copy link
Copy Markdown

Problem

discoverClisFromFs() in discovery.ts uses entry.isDirectory() to filter site directories, but Dirent.isDirectory() returns false for symbolic links even when the link target is a directory. This causes user adapters installed as symlinks to be silently skipped.

Reproduction: Create a symlinked adapter directory:

ln -s /path/to/project/adapters/mysite ~/.opencli/clis/mysite

The adapter is not discovered — opencli mysite --help shows the top-level help instead of the site's commands.

Fix

Also check entry.isSymbolicLink() and verify the target is a directory via fs.promises.stat() before scanning the site directory.

Testing

  • Verified with 5 symlinked adapter directories (dingtalk-doc, ata, crash-detail, crash-stack, motu-crash)
  • All adapters correctly discovered after the fix
  • Non-directory symlinks are safely skipped via stat check

lanyasheng and others added 3 commits April 14, 2026 23:05
`readdir({ withFileTypes: true })` returns `Dirent` objects where
`isDirectory()` returns false for symlinks, even when the target
is a directory. This causes user adapters installed as symlinks
(e.g. `~/.opencli/clis/mysite -> /path/to/project/adapters/mysite`)
to be silently skipped during filesystem discovery.

Fix: also check `isSymbolicLink()` and verify the target is a
directory via `fs.promises.stat()` before scanning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- adapter status/reset --all now discover symlinked site directories
  (same isDirectory()||isSymbolicLink()+stat pattern as discovery)
- discovery.ts symlink error handling aligned with isDiscoverablePluginDir:
  log warning for unexpected errors (not ENOENT/ENOTDIR)
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.

2 participants