Thank you for your interest in contributing to grepai! This document provides guidelines and instructions for contributing.
- Go 1.22 or later
- Ollama (for local testing with embeddings)
- Git
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/grepai.git cd grepai - Add the upstream remote:
git remote add upstream https://github.com/yoanbernabeu/grepai.git
- Install dependencies:
go mod download
make build
# or
go build ./cmd/grepaimake test
# or
go test -v -race ./...We use golangci-lint for code quality:
# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Run linter
make lintAlways run the pre-commit checks before pushing your changes:
make pre-commitThis single command will:
- Format all Go files with
gofmt - Vet - detect common errors with
go vet - Lint - run comprehensive checks with
golangci-lint - Test - run all tests with race detection
If all checks pass, you're ready to commit!
- Follow standard Go conventions and idioms
- Use
gofmtorgoimportsto format your code - Write meaningful commit messages
- Add tests for new functionality
- Update documentation as needed
feat/description- New featuresfix/description- Bug fixesdocs/description- Documentation changesrefactor/description- Code refactoringtest/description- Test additions or modifications
We follow conventional commits:
type(scope): description
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore
Examples:
feat(search): add fuzzy matching optionfix(watcher): handle file rename events correctlydocs(readme): update installation instructions
- Create a feature branch from
main - Make your changes
- Ensure all tests pass
- Run the linter and fix any issues
- Update CHANGELOG.md if applicable
- Submit a pull request
- Tests added/updated
- Documentation updated
- CHANGELOG.md updated (for user-facing changes)
- Code follows project style guidelines
- All CI checks pass
grepai/
├── cmd/grepai/ # CLI entry point
├── cli/ # Cobra commands
├── config/ # Configuration management
├── embedder/ # Embedding providers (Ollama, OpenAI)
├── store/ # Vector storage backends (GOB, Postgres)
├── indexer/ # File scanning and chunking
├── watcher/ # File system watcher
└── search/ # Search functionality
- Create a new file in
embedder/(e.g.,embedder/newprovider.go) - Implement the
Embedderinterface - Add configuration options in
config/config.go - Update CLI initialization in
cli/watch.goandcli/search.go - Add tests in
embedder/newprovider_test.go - Update documentation
- Create a new file in
store/(e.g.,store/newbackend.go) - Implement the
VectorStoreinterface - Add configuration options in
config/config.go - Update CLI initialization
- Add tests
- Update documentation
- Open an issue for bugs or feature requests
- Start a discussion for questions
- Check existing issues and discussions first
By contributing, you agree that your contributions will be licensed under the MIT License.