Skip to content

Latest commit

 

History

History
177 lines (130 loc) · 5.85 KB

CONTRIBUTING.md

File metadata and controls

177 lines (130 loc) · 5.85 KB

Contributing to Biff

Thank you for your interest in contributing to biff. This guide covers what you need to get started.

Getting Started

Prerequisites

  • Python 3.13+
  • uv for dependency management
  • shellcheck for the hook and installer scripts
  • NATS server (optional, for NATS integration tests)

Setup

git clone https://github.com/punt-labs/biff.git
cd biff
uv sync --all-extras --all-groups

If you work on biff with Claude Code, note that this repo's .envrc deliberately differs from the org's canonical template: DISABLE_TELEMETRY, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, and the CLAUDE_CODE_ENABLE_TELEMETRY unset are commented out here, not active. Any of them disables the feature-flag evaluation Claude Code Channels depends on, which biff is actively building against (biff-5esx). See DESIGN.md DES-063 for the full rationale and evidence before "fixing" this back to match the canonical template.

Verify your setup

uv run ruff check .
uv run ruff format --check .
shellcheck plugin/hooks/*.sh install.sh scripts/*.sh
uv run mypy src/ tests/
uv run pyright
uv run pytest

All six must pass with zero errors before any commit. make check runs them together (plus markdownlint) and is the gate CI enforces.

Plugin layout

Everything the Claude Code plugin ships lives under plugin/: the manifest (plugin/.claude-plugin/plugin.json), the slash commands (plugin/commands/), and the hook dispatchers (plugin/hooks/). The marketplace installs only that directory, using Claude Code's git-subdir source, so an install never fetches src/, tests/, or docs/. ${CLAUDE_PLUGIN_ROOT} is therefore plugin/. To try a local change without releasing, start Claude Code with the plugin directory:

claude --plugin-dir "$PWD/plugin"

make help lists every Makefile target.

Development Workflow

Branch Discipline

All changes go on feature branches. Never commit directly to main.

git checkout -b feat/short-description main
Prefix Use
feat/ New features
fix/ Bug fixes
refactor/ Code improvements
docs/ Documentation only

Commit Messages

Format: type(scope): description

feat(who): add idle time display
fix(relay): handle disconnection during fetch
refactor(tools): extract shared formatting
test(integration): add multi-user messaging tests
docs: update command reference
chore: bump fastmcp dependency

One logical change per commit. Small commits are preferred over large ones.

Quality Gates

Every commit must pass:

uv run ruff check .           # Linting
uv run ruff format --check .  # Formatting
shellcheck plugin/hooks/*.sh install.sh scripts/*.sh  # Shell linting
uv run mypy src/ tests/       # Type checking (mypy)
uv run pyright                 # Type checking (pyright)
uv run pytest                  # Tests (tiers 1-2)

Running Tests

uv run pytest                          # Tiers 1-2 (unit + integration, fast)

Everything else needs an explicit -m <marker> and local infrastructure — see TESTING.md for the full tier list, markers, and what each one requires. New features should have tests at tiers 1-2 minimum.

Code Standards

Python comments and API documentation

Comments explain non-obvious reasons, invariants, and constraints rather than repeating the code. Do not leave commented-out code or narrate edits, reviews, or past implementations in comments or docstrings. Keep tracker references in commits and the issue tracker, not Python prose.

Document public modules, classes, functions, and methods under src/ in Google style with an imperative summary. Tests and private names are exempt, except that every registered MCP tool needs a fuller contract: when to use it, how to supply inputs, what the result means, and errors to expect. Keep types in signatures. Include Args: only for non-obvious parameters, Returns: or Yields: only for meaningful result semantics, and Raises: for exceptions callers can handle, including propagated exceptions. Omit empty sections.

Run the prose gates with make check-comments check-docstrings; both are part of make lint. Build and verify the Python API reference with make build-api-docs. Open .tmp/api-site/index.html to read the generated reference.

Implementation conventions

  • from __future__ import annotations in every Python file.
  • Full type annotations on every function signature. No Any.
  • Double quotes. Line length 88.
  • Immutable data models. @dataclass(frozen=True) or pydantic with immutability.
  • No duplication. If you see two copies, extract one abstraction.
  • No backwards-compatibility shims. When code changes, callers change.

Submitting Changes

  1. Push your branch and open a pull request.
  2. Ensure CI passes on all commits.
  3. Respond to review feedback. Each fix commit must also pass quality gates.
  4. Once approved and green, the PR will be merged.

What Makes a Good PR

  • Clear title and description explaining why, not just what.
  • Small, focused scope. One concern per PR.
  • Tests included for new behavior.
  • README updated if user-facing behavior changed.
  • CHANGELOG entry for notable changes.

Reporting Bugs

Open an issue at github.com/punt-labs/biff/issues with:

  • What you expected to happen.
  • What actually happened.
  • Steps to reproduce.
  • Your environment (OS, Python version, biff version).

Suggesting Features

Open an issue describing the problem you want to solve, not just the solution you have in mind. Context about your use case helps us evaluate the right approach.

License

By contributing, you agree that your contributions will be licensed under the MIT License.