fix: discover symlinked adapter directories in ~/.opencli/clis/#1020
Open
lanyasheng wants to merge 3 commits intojackwener:mainfrom
Open
fix: discover symlinked adapter directories in ~/.opencli/clis/#1020lanyasheng wants to merge 3 commits intojackwener:mainfrom
lanyasheng wants to merge 3 commits intojackwener:mainfrom
Conversation
`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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
discoverClisFromFs()indiscovery.tsusesentry.isDirectory()to filter site directories, butDirent.isDirectory()returnsfalsefor 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/mysiteThe adapter is not discovered —
opencli mysite --helpshows the top-level help instead of the site's commands.Fix
Also check
entry.isSymbolicLink()and verify the target is a directory viafs.promises.stat()before scanning the site directory.Testing