Skip to content

bug(plugin): symlink plugin directories silently skipped by discoverPlugins #206

@Astro-Han

Description

@Astro-Han

Description

discoverPlugins() in src/discovery.ts:182 uses entry.isDirectory() to filter plugin subdirectories. However, fs.Dirent.isDirectory() does not follow symbolic links -- if a plugin directory is a symlink to a real directory, isDirectory() returns false and the plugin is silently skipped.

Reproduce

# Install a plugin normally -- works
opencli plugin install github:Astro-Han/opencli-plugin-juejin

# Symlink a local plugin for development -- silently ignored
ln -s /path/to/my-plugin ~/.opencli/plugins/my-plugin
opencli my-plugin some-command
# error: unknown command 'my-plugin'

Expected

Symlinked plugin directories should be discovered the same as regular directories. This is a common pattern during plugin development.

Suggested Fix

// discovery.ts:182
// Before:
if (!entry.isDirectory()) continue;

// After:
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;

Optionally, follow the symlink with fs.stat() to confirm the target is actually a directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions