feat: add --plugins-dir flag to load plugins from custom directories#640
Draft
feat: add --plugins-dir flag to load plugins from custom directories#640
Conversation
Add a --plugins-dir CLI flag similar to Claude Code's --plugin-dir flag, allowing users to load plugins (skills) from custom directories for the current session only. Features: - New --plugins-dir flag (repeatable) to specify plugin directories - Plugins are loaded additively, supplementing default plugin locations - Support for both specific plugin directories and directories containing multiple plugins - Graceful handling of nonexistent or invalid paths with warnings - Deduplication of skills with the same name Usage examples: openhands --plugins-dir ./my-plugin # Load single plugin openhands --plugins-dir ./plugins # Load all plugins in directory openhands --plugins-dir ./p1 --plugins-dir ./p2 # Load multiple The flag is passed through the full call chain: entrypoint -> textual_app -> runner_factory -> conversation_runner -> setup -> agent_store -> agent_context Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Use the SDK's openhands.sdk.plugin.Plugin class instead of loading skills directly. This properly supports the full plugin structure: - Skills from plugins/skills/ directory - MCP config from plugins/.mcp.json - Hooks from plugins/hooks/hooks.json - Agents from plugins/agents/ directory The implementation now: 1. Checks for proper plugin manifest (.plugin/plugin.json or .claude-plugin/plugin.json) before loading 2. Uses Plugin.load() for single plugin directories 3. Uses Plugin.load_all() for directories containing multiple plugins 4. Merges plugin skills and MCP config into the agent Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
The mock for AgentStore.load_or_create in the snapshot tests was missing the new plugins_dirs parameter, causing the iterative refinement tests to fail. Co-authored-by: openhands <openhands@all-hands.dev>
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.
Summary
Add a
--plugins-dirCLI flag similar to Claude Code's--plugin-dirflag, allowing users to load plugins (skills) from custom directories for the current session only.Changes
New Features
--plugins-dirflag (repeatable) to specify plugin directoriesUsage Examples
Implementation Details
The flag is passed through the full call chain:
New module
openhands_cli/plugins.pyhandles loading skills from custom directories using the SDK'sload_skills_from_dirfunction.Testing
tests/test_plugins_dir.py:Verification Commands Run
Help Output
This PR was created by an AI assistant (OpenHands) on behalf of the user.
🚀 Try this PR