feat: add claude_plugin_adapter - #758
Conversation
…nd syncing plugin skills, MCP servers, and agents
|
@mpfaffenberger, found this very interesting feature while browsing the issue list. Adapting the Claude Code plugin sounds like a good way to improve eco system indeed. Tested it with a couple of mock plugins and added an uninstall function. Can you please review this while you got sometime. |
|
Heads up — plugins have been moved out of this repo into a dedicated repository: https://github.com/mpfaffenberger/code_puppy_core_plugins. This PR touches code under |
|
Closing this PR since every file it touches lives under Feel free to reopen this PR (or open a fresh one) against the new plugins repo -- the change itself looks good, it just needs a new home. Thanks for the contribution! |
feat: adapter to install and wire Claude Code-style plugins
Closes #471
Overview
This PR implements a first-class plugin adapter (
claude_plugin_adapter) that allows Code Puppy to dynamically consume and wire Claude Code-style plugins. It supports the installation, uninstallation, and synchronization of Skills, MCP Servers, Agent profiles, and Hook configurations without requiring a system restart.Changes Made
adapters/skills.py): Detectsskills/directories inside Claude plugins and dynamically adds/removes them from Code Puppy's skill system usingadd_skill_directory/remove_skill_directory.adapters/mcp.py): Synchronizes a plugin's.mcp.jsoninto the user'smcp_servers.json. We enforce idempotency using a"_managed_by"tag.adapters/agents.py): Extracts metadata from markdown agent files using YAML frontmatter parsing. The adapter maps tool names via theresolve_internal_name()system and writes the synchronized agents to the user'sagents/directory (again, tracked via_managed_by).claude_code_hooks/config.py): Enhances hook configurations by recursively expanding${CLAUDE_PLUGIN_ROOT}and$CLAUDE_PLUGIN_ROOTto the local plugin directory (~/.code_puppy/claude_plugins/).installer.py,register_callbacks.py):/plugin install <path>and/plugin uninstall <name>.startupcallback to re-sync all installed plugins dynamically on boot.agent_reloadhook insideclaude_code_hooks/register_callbacks.pyto allow the Hook Engine to re-initialize gracefully during live uninstalls.Testing
tests/plugins/claude_plugin_adapter/.superpowersplugin and verified end-to-end functionality of/plugin installand/plugin uninstallacross skills, agents, MCP configurations, and hook environments.claude-memplugin. Verified that:.mcp.jsonautomatically injected themcp-searchserver configuration into Code Puppy'smcp_servers.json(tracked safely with the_managed_bytag):{ "mcp_servers": { "mcp-search": { "type": "stdio", "command": "node", "args": [ "-e", "..." ], "_managed_by": "claude_plugin_adapter:plugin" } } }skills/directory was correctly discovered and recursively bound into Code Puppy's skill context, expanding the agent's capabilities dynamically: