Thank you for your interest in contributing! This document provides guidelines and information for contributors.
- Bun runtime
- Git
- OpenCode installed and authenticated
# Clone the repository
git clone https://github.com/yourusername/opencode-chat-bridge.git
cd opencode-chat-bridge
# Install dependencies
bun install
# Test the CLI
bun src/cli.ts "Hello, world!"opencode-chat-bridge/
├── src/
│ ├── acp-client.ts # ACP protocol client (EventEmitter-based)
│ ├── cli.ts # Interactive CLI
│ └── index.ts # Library exports
├── connectors/ # Chat platform connectors
│ ├── matrix.ts
│ ├── slack.ts
│ └── whatsapp.ts
├── docs/ # Documentation
├── opencode.json # Agent and permission configuration
└── tests/ # Test scripts
We have connectors for several chat platforms, with more planned:
| Platform | Status | Priority |
|---|---|---|
| Matrix | Done | - |
| Slack | Done | - |
| Done | - | |
| IRC | Planned | Low |
| Telegram | Planned | Low |
- Improve existing docs
- Add examples
- Fix typos
mkdir -p connectors
touch connectors/matrix.ts// connectors/matrix.ts
import { ACPClient } from "../src"
class MatrixConnector {
private client: ACPClient
constructor() {
this.client = new ACPClient({ cwd: process.cwd() })
}
async start() {
await this.client.connect()
await this.client.createSession()
// Set up event handlers
this.client.on("chunk", (text) => {
// Send to chat platform
})
this.client.on("tool", ({ name, status }) => {
// Show tool usage
})
}
async handleMessage(text: string) {
await this.client.prompt(text)
}
}The ACPClient emits events for streaming responses:
client.on("chunk", (text) => {
// Buffer and send to chat
buffer += text
if (buffer.length > 500 || buffer.endsWith(".")) {
sendToChat(buffer)
buffer = ""
}
})Create docs/<PLATFORM>_SETUP.md with:
- Prerequisites
- Configuration
- Quick start
- Troubleshooting
- Use strict TypeScript
- Prefer interfaces over types for objects
- Use explicit return types for public functions
- Document public APIs with JSDoc
camelCasefor variables and functionsPascalCasefor classes and typesSCREAMING_SNAKE_CASEfor constants- Descriptive names over abbreviations
- Use typed errors
- Log errors with context
- Handle recoverable errors gracefully
- Fail fast for unrecoverable errors
# Test CLI
bun src/cli.ts "What time is it?"
# Test security
bun src/cli.ts "Read /etc/passwd" # Should be blocked- CLI works in interactive mode
- Single prompt mode works
- Security: blocked tools are denied
- Streaming responses work
- Tool notifications appear
- Test your changes manually
- Update documentation if needed
- Add to CHANGELOG if significant
- Clear title describing the change
- Description of what and why
- Reference related issues
- Include test evidence if applicable
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] New connector
- [ ] Documentation update
## Testing
How was this tested?
## Checklist
- [ ] Manual testing passed
- [ ] Documentation updated
- [ ] Code follows style guideInclude:
- OpenCode version (
opencode --version) - Steps to reproduce
- Expected vs actual behavior
- Relevant output/logs
Include:
- Use case description
- Proposed solution
- Alternatives considered
When contributing:
- Never weaken permissions - Don't add tools to the allow list without discussion
- Test security - Verify prompt injection is still blocked
- Don't commit secrets - Use environment variables
- Review carefully - Security-sensitive code gets extra scrutiny
- Open a GitHub issue
- Check existing documentation
- Review similar connectors
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn
By contributing, you agree that your contributions will be licensed under the MIT License.
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes
- Project README (for significant contributions)
Thank you for contributing to opencode-chat-bridge!