Skip to content

Latest commit

 

History

History
88 lines (67 loc) · 1.7 KB

File metadata and controls

88 lines (67 loc) · 1.7 KB

Quick Start Guide

Installation

# Clone the repository
git clone https://github.com/yourusername/openplugin
cd openplugin

# Install dependencies
pip install -r requirements.txt

# Or install in development mode
pip install -e .

Set Up OpenAI API Key

export OPENAI_API_KEY="your-api-key-here"

Run the Example

python examples/basic_usage.py

Create Your First Plugin

  1. Create a plugin directory:
mkdir -p plugins/my-plugin/.claude-plugin
mkdir -p plugins/my-plugin/commands
  1. Create the plugin manifest:
cat > plugins/my-plugin/.claude-plugin/plugin.json << EOF
{
  "name": "my-plugin",
  "version": "1.0.0",
  "description": "My first plugin",
  "author": "Your Name"
}
EOF
  1. Create a command:
cat > plugins/my-plugin/commands/greet.md << EOF
# Greet Command

A simple greeting command that responds warmly to user input.
EOF
  1. Use it in Python:
import asyncio
from openplugin import PluginManager, OpenAIProvider
import os

async def main():
    manager = PluginManager(plugins_dir="./plugins")
    manager.load_plugins()
    
    provider = OpenAIProvider(api_key=os.getenv("OPENAI_API_KEY"))
    
    result = await manager.execute_command(
        "my-plugin",
        "greet",
        provider=provider,
        user_input="Hello!"
    )
    
    print(result)
    await manager.shutdown()

asyncio.run(main())

Next Steps