Thank you for your interest in contributing to Bond! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Pull Request Process
- Code Style
- Testing
- Documentation
Please be respectful and constructive in all interactions. We welcome contributors of all backgrounds and experience levels.
Before reporting a bug:
- Search existing issues to avoid duplicates
- If none exists, open a new issue with:
- A clear, descriptive title
- Steps to reproduce the issue
- Expected vs actual behavior
- Python version and OS
- Relevant error messages or stack traces
Feature requests are welcome! Please:
- Check existing issues for similar requests
- Open a new issue describing:
- The use case or problem you're solving
- Your proposed solution
- Any alternatives you've considered
Look for issues labeled good first issue for beginner-friendly tasks.
- Python 3.11+ (3.11 or 3.12 recommended)
- uv package manager (installation guide)
- Git
# 1. Fork the repository on GitHub
# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/bond-agent.git
cd bond-agent
# 3. Add upstream remote
git remote add upstream https://github.com/renbytes/bond-agent.git
# 4. Install dependencies
uv sync --group dev
# 5. Install pre-commit hooks
uv run pre-commit install
# 6. Verify setup
uv run pytestCreate a branch from main with a descriptive name:
git checkout main
git pull upstream main
git checkout -b type/short-descriptionBranch types:
feat/- New featuresfix/- Bug fixesdocs/- Documentation onlyrefactor/- Code refactoringtest/- Test additions or fixes
Write clear, concise commit messages:
type: short description
Longer explanation if needed. Wrap at 72 characters.
- Bullet points are fine
- Explain what and why, not how
Types: feat, fix, docs, refactor, test, chore
Examples:
feat: add GitHub repository search toolfix: handle rate limit errors in GitHub adapterdocs: add streaming server guide
-
Update your branch with the latest upstream changes:
git fetch upstream git rebase upstream/main
-
Run all checks before pushing:
uv run pre-commit run --all-files uv run pytest
-
Push your branch and open a PR:
git push origin your-branch-name
-
Fill out the PR template with:
- Summary of changes
- Link to related issues
- Test plan
-
Address review feedback promptly
- All CI checks must pass
- Code must be formatted and linted
- New features require tests
- Documentation updates for user-facing changes
Bond uses Ruff for formatting and linting:
# Format code
uv run ruff format src tests
# Lint and auto-fix
uv run ruff check --fix src testsBond uses strict mypy type checking:
uv run mypy src/bondAll new code must be fully typed. Key rules:
- No
Anytypes without justification - All function parameters and returns typed
- Use
Protocolfor duck typing
Pre-commit runs automatically on each commit:
# Run manually
uv run pre-commit run --all-filesHooks:
ruff format- Auto-formats coderuff check --fix- Lints and auto-fixesmypy- Type checks
# Run all tests with coverage
uv run pytest
# Run specific test file
uv run pytest tests/unit/tools/github/test_adapter.py
# Run tests matching a pattern
uv run pytest -k "github"
# Run with verbose output
uv run pytest -v- Place tests in
tests/mirroring thesrc/structure - Use
pytestfixtures for setup - Use
respxfor mocking HTTP requests - Aim for high coverage on new code
Example test:
import pytest
from bond.tools.github import GitHubAdapter
@pytest.fixture
def adapter():
return GitHubAdapter(token="test-token")
async def test_get_repo_returns_info(adapter, respx_mock):
respx_mock.get("https://api.github.com/repos/owner/repo").respond(
json={"name": "repo", "description": "A test repo"}
)
result = await adapter.get_repo("owner", "repo")
assert result.name == "repo"
assert result.description == "A test repo"# Install docs dependencies
uv sync --extra docs
# Serve locally with hot reload
uv run mkdocs serve
# Build and check for errors
uv run mkdocs build --strict- Update docs for user-facing changes
- Use Google-style docstrings
- Include code examples
- Keep API reference in
docs/api/in sync
def get_repo(self, owner: str, repo: str) -> RepoInfo:
"""Get repository metadata.
Args:
owner: Repository owner (user or organization).
repo: Repository name.
Returns:
Repository information including description, stars, and topics.
Raises:
RepoNotFoundError: If the repository doesn't exist.
RateLimitedError: If API rate limit is exceeded.
"""src/bond/
├── __init__.py # Package exports
├── agent.py # BondAgent implementation
├── utils.py # StreamHandlers utilities
├── server/ # HTTP server module
├── tools/ # Bundled toolsets
│ ├── github/ # GitHub API tools
│ ├── githunter/ # Git forensics tools
│ ├── memory/ # Semantic memory tools
│ └── schema/ # Schema extraction tools
└── trace/ # Execution tracing
See Adding Tools for the complete guide.
Each toolset follows this structure:
tools/my_tool/
├── __init__.py # Public API exports
├── _protocols.py # Protocol definition
├── _types.py # Pydantic models
├── _adapter.py # Protocol implementation
└── tools.py # Tool functions
- Open a GitHub Discussion for questions
- Check the documentation for guides
Thank you for contributing!