Skip to content

Latest commit

 

History

History
 
 

README.md

OpenCode Python

A Python port of the OpenCode AI coding agent, built for the terminal.

Features

  • πŸ€– AI-powered coding assistance
  • πŸ”§ Multiple tool integrations (bash, edit, read, grep, etc.)
  • 🌐 Language Server Protocol (LSP) support
  • πŸ“ Session management and chat history
  • πŸ”Œ Multiple AI provider support (OpenAI, Anthropic, etc.)
  • 🎨 Rich terminal UI
  • πŸ”„ Real-time file watching and diagnostics

Installation

pip install opencode-python

Or for development:

git clone <repository>
cd opencode_python
pip install -e ".[dev]"

Usage

# Start interactive session
opencode

# Run with a message
opencode run "Help me fix this bug"

# Continue last session
opencode run --continue

# Use specific model
opencode run --model anthropic/claude-3-sonnet "Refactor this code"

# Start server mode
opencode serve --port 8080

Configuration

Configuration files are stored in platform-specific directories:

  • Linux: ~/.config/opencode/
  • macOS: ~/Library/Application Support/opencode/
  • Windows: %APPDATA%/opencode/

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black .
ruff check --fix .

# Type checking
mypy .

Architecture

The Python port maintains the same architecture as the original TypeScript version:

  • CLI: Command-line interface with multiple commands
  • Tools: Individual tools for different operations (bash, edit, read, etc.)
  • Session: Chat session management and message handling
  • LSP: Language Server Protocol integration
  • Provider: AI model provider abstraction
  • Server: HTTP API server for remote access

License

MIT License - see LICENSE file for details.