Contributing
Thank you for your interest in contributing to Bazelle! This guide will help you get started.
Getting Started
-
Fork the repository
Fork albertocavalcante/bazelle on GitHub.
-
Clone your fork
Terminal window git clone https://github.com/YOUR_USERNAME/bazelle.gitcd bazelle -
Install dependencies
Bazelle uses Bazel for building. Install Bazelisk for automatic Bazel version management:
Terminal window # macOSbrew install bazelisk# Linuxgo install github.com/bazelbuild/bazelisk@latest -
Build and test
Terminal window bazel build //...bazel test //...
Development Workflow
Building
# Build all targetsbazel build //...
# Build just the CLIbazel build //cmd/bazelle
# Run the CLI./bazel-bin/cmd/bazelle/bazelle_/bazelle --helpTesting
# Run all testsbazel test //...
# Run tests for a specific packagebazel test //cmd/bazelle/internal/cli:cli_test
# Run with verbose outputbazel test --test_output=all //...Updating BUILD Files
Use Bazelle itself to manage BUILD files:
bazel run //:gazelleProject Structure
bazelle/├── cmd/bazelle/ # CLI binary│ └── internal/│ ├── cli/ # Command implementations│ ├── detect/ # Language detection│ ├── incremental/ # Incremental update tracking│ └── watch/ # File watching├── gazelle-kotlin/ # Kotlin Gazelle extension├── gazelle-python/ # Python Gazelle extension├── gazelle-groovy/ # Groovy Gazelle extension├── pkg/ # Shared packages│ ├── config/ # Configuration loading│ ├── jvm/ # JVM language utilities│ ├── registry/ # Language registry│ └── treesitter/ # Tree-sitter parsing├── internal/ # Internal utilities│ └── log/ # Logging package└── docs/ # Documentation (Starlight)Making Changes
Code Style
- Follow standard Go conventions (
gofmt,go vet) - Use meaningful variable and function names
- Add comments for exported functions and types
- Keep functions focused and small
Commit Messages
Use clear, descriptive commit messages:
feat: add incremental update support for Python
Add tracking of Python source files in the incrementalupdate system. This enables faster updates for largePython codebases.
Closes #123Prefixes:
feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Test additions or changeschore:- Build, CI, or tooling changes
Pull Requests
-
Create a feature branch from
main:Terminal window git checkout -b feat/my-feature -
Make your changes and commit
-
Ensure tests pass:
Terminal window bazel test //... -
Push and create a PR:
Terminal window git push origin feat/my-feature -
Fill out the PR template with:
- Description of changes
- Related issues
- Test plan
Adding a New Language Extension
If you want to add support for a new language:
-
Create the extension directory
gazelle-newlang/├── BUILD.bazel├── language.go # Implements language.Language├── config.go # Configuration and directives├── parser.go # Source file parsing├── resolver.go # Dependency resolution└── generate.go # BUILD rule generation -
Implement the Gazelle interfaces
language.Languageconfig.Configurerresolve.Resolverrule.KindInfo
-
Register in the CLI Update
cmd/bazelle/internal/langs/langs.go -
Add tests Create
testdata/directories with example projects -
Update documentation Add a page under
docs/src/content/docs/languages/
Documentation
Documentation is built with Starlight. To work on docs:
cd docsbun installbun run devThen open http://localhost:4321/bazelle/
Adding Pages
- Create a new
.mdxfile indocs/src/content/docs/ - Add frontmatter with
titleanddescription - Add to sidebar in
docs/astro.config.mjs
Reporting Issues
When reporting bugs:
- Check existing issues first
- Include Bazelle version (
bazelle version) - Include Bazel version (
bazel version) - Provide minimal reproduction steps
- Include relevant error messages
Getting Help
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - Questions and ideas
License
Bazelle is licensed under Apache-2.0. By contributing, you agree that your contributions will be licensed under the same license.