Contributing to Codebook

May 19, 2026 ยท View on GitHub

Thanks for your interest in improving Codebook! This document covers the most common contribution paths: adding dictionaries, adding programming language support, running the test suite, and cutting a release.

Running Tests

Run tests with make test after cloning. Integration tests are also available with make integration_test, but requires BunJS to run.

Adding a New Dictionary

Dictionaries in Codebook are currently hardcoded in the dictionary repository file at crates/codebook/src/dictionaries/repo.rs.

To add a new Hunspell-compatible dictionary:

  1. Open crates/codebook/src/dictionaries/repo.rs

  2. Locate the HUNSPELL_DICTIONARIES static vector (for Hunspell dictionaries) or TEXT_DICTIONARIES (for plain text word lists)

  3. Add a new entry using the appropriate constructor. For Hunspell dictionaries:

    HunspellRepo::new(
        "nl_nl",  // Dictionary name in snake_case
        "https://raw.githubusercontent.com/wooorm/dictionaries/refs/heads/main/dictionaries/nl/index.aff",
        "https://raw.githubusercontent.com/wooorm/dictionaries/refs/heads/main/dictionaries/nl/index.dic",
    ),
    
  4. Follow the naming convention:

    • Use snake_case format (e.g., en_us, nl_nl, pt_br)
    • Language codes should be lowercase
    • Names must be unique across all dictionaries
  5. Find dictionary sources:

  6. (Optional) Run the tests to verify your addition:

    cargo test test_dictionary_names_unique_and_snake_case
    

    This test ensures dictionary names are unique and follow the snake_case convention.

For plain text dictionaries, use TextRepo::new() instead and add to TEXT_DICTIONARIES.

Adding New Programming Language Support

See the query development guide for instructions on adding Tree-sitter queries for new languages, the tag naming convention, and tips for writing effective queries.

Release

To publish a new version:

  1. Update and commit changelog with new version number
  2. Run make release-lsp
  3. Follow instructions
  4. Wait for Actions to finish
  5. Go to GitHub Releases
  6. Un-mark "prerelease" and publish
  7. Run make publish_crates to upload to crates.io