🧩 Plugins
Code Puppy features a plugin system that allows extending functionality through callbacks. Plugins can intercept and modify behavior at various points in the execution flow.
Built-in Plugins
Authentication plugin for Claude API using OAuth flow. Enables secure authentication without storing API keys locally.
Location: plugins/claude_code_oauth/
Authentication plugin for ChatGPT/OpenAI using OAuth. Similar to Claude OAuth but for OpenAI services.
Location: plugins/chatgpt_oauth/
Safety plugin that evaluates shell commands for risk before execution. Blocks dangerous commands and requires confirmation for risky ones.
Location: plugins/shell_safety/
Manages file permissions and access control. Ensures safe file operations with proper confirmations.
Location: plugins/file_permission_handler/
Enables user-defined custom commands via markdown files. Create your own slash commands!
Location: plugins/customizable_commands/
Shell Safety Plugin
The shell safety plugin evaluates commands before execution:
- LOW - Safe commands (ls, cat, echo)
- MEDIUM - Moderate risk (git, npm, pip)
- HIGH - Potentially dangerous (rm, sudo)
- CRITICAL - Very dangerous (rm -rf, format)
Configure safety level:
/set safety_permission_level medium
# Options: low, medium, high, critical
Custom Commands Plugin
Create custom slash commands by adding markdown files to .claude/commands/:
# .claude/commands/deploy.md
## Deploy to Production
1. Run all tests
2. Build the production bundle
3. Deploy to the production server
4. Verify the deployment
Use the following commands:
```bash
npm test
npm run build
npm run deploy:prod
```
Then use with: /deploy
Creating Custom Plugins
Plugins use a callback system to hook into Code Puppy's execution flow:
# my_plugin/__init__.py
from code_puppy.callbacks import register_callback
@register_callback("before_shell_command")
async def my_command_hook(command: str, context: dict):
"""Called before every shell command."""
# Modify or validate the command
return {"allow": True, "command": command}
@register_callback("after_file_edit")
async def my_file_hook(file_path: str, content: str):
"""Called after every file edit."""
# Log or post-process file changes
print(f"File modified: {file_path}")
Available Callbacks
| Callback | Description |
|---|---|
before_shell_command |
Before executing shell commands |
after_shell_command |
After shell command execution |
before_file_edit |
Before modifying files |
after_file_edit |
After file modifications |
before_message |
Before sending to AI |
after_response |
After receiving AI response |
on_startup |
When Code Puppy starts |
on_shutdown |
When Code Puppy exits |
Plugin Structure
my_plugin/
├── __init__.py # Plugin entry point with callbacks
├── config.py # Plugin configuration
├── handlers.py # Callback handlers
└── utils.py # Utility functions