Skip to content

Latest commit

 

History

History
61 lines (48 loc) · 2.95 KB

File metadata and controls

61 lines (48 loc) · 2.95 KB

Repository Guidelines

Project Structure & Module Organization

Core code lives under src/:

  • src/bub/__main__.py: Typer CLI entrypoint.
  • src/bub/framework.py: turn orchestration and outbound routing.
  • src/bub/hookspecs.py / src/bub/hook_runtime.py: hook contracts and execution helpers.
  • src/bub/builtin/: builtin runtime, CLI wiring, settings, tools, and tape services.
  • src/bub/channels/: channel abstractions plus CLI and Telegram adapters.
  • src/bub/skills.py / src/bub/tools.py: skill discovery and tool registry.
  • src/bub_skills/: bundled skills shipped with Bub.

Tests live in tests/. Documentation lives in docs/.

Build, Test, and Development Commands

  • uv sync: install or update dependencies.
  • just install: sync dependencies and install prek hooks.
  • uv run bub chat: run the interactive CLI.
  • uv run bub gateway: start channel listener mode.
  • uv run bub run "hello": run one inbound message through the full framework pipeline.
  • uv run bub hooks: inspect discovered hook bindings.
  • uv run ruff check .: lint checks.
  • uv run mypy src: static type checks.
  • uv run pytest -q: run the main test suite.
  • just test: run pytest with doctests enabled.
  • just check: lock validation, lint, and typing.
  • just docs / just docs-test: serve or build docs.

Coding Style & Naming Conventions

  • Python 3.12+, 4-space indentation, and type hints for new or modified logic.
  • Use snake_case for modules/functions/variables, PascalCase for classes, and UPPER_CASE for constants.
  • Keep functions focused and composable; avoid hidden side effects.
  • Format and lint with Ruff. Keep line length within 120 unless an existing file clearly follows a different local convention.

Testing Guidelines

  • Framework: pytest.
  • Name test files tests/test_<feature>.py.
  • Prefer behavior-oriented test names such as test_gateway_uses_enabled_channels_only.
  • Cover hook precedence, turn lifecycle, CLI/channel behavior, and tape persistence when changing runtime behavior.
  • Update or add tests in the same change when behavior moves.

Commit & Pull Request Guidelines

  • Follow the Conventional Commit style used in history, for example feat:, fix:, docs:, chore:.
  • Keep commits focused; avoid mixing unrelated refactors with behavior changes.
  • For PRs, include:
    • what changed and why
    • impacted modules or commands
    • verification performed (ruff, mypy, pytest, docs build if relevant)
    • docs updates when CLI behavior, commands, or architecture changed

Security & Configuration Tips

  • Use .env for local secrets; never commit credentials.
  • Bub runtime settings are driven by BUB_* variables such as BUB_MODEL, BUB_API_KEY, and BUB_API_BASE.
  • Provider-specific keys such as OPENROUTER_API_KEY may still be consumed by downstream SDKs.
  • Telegram deployments usually require BUB_TELEGRAM_TOKEN, and allowlists are controlled with BUB_TELEGRAM_ALLOW_USERS and BUB_TELEGRAM_ALLOW_CHATS.