Thank you for your interest in contributing to GoCode! We welcome contributions from developers of all skill levels. Whether you are fixing a bug, adding a new provider, introducing a tool, or polishing documentation, your help makes GoCode better for everyone.
- Code of Conduct
- How Can I Contribute?
- Development Setup
- Project Architecture
- Extending GoCode
- Coding Guidelines
- Testing
- Security Policy
GoCode is an open, welcoming, and inclusive community. Please be respectful and constructive in all issues, pull requests, and discussions.
Before creating a bug report, please check existing issues to avoid duplicates. When filing a bug report, include:
- GoCode Version: Output of
gocode --versionor git commit hash. - OS & Environment: (e.g., Windows 11, macOS Sequoia, Ubuntu 24.04).
- LLM Provider & Model: (e.g., Ollama
codellama). - Reproduction Steps: Clear, step-by-step instructions.
- Expected vs. Actual Behavior: Include console logs or error stack traces if applicable.
Feature requests are tracked as GitHub Issues. Please include:
- A clear, descriptive title.
- The use case or problem you are trying to solve.
- Proposed solution or API design.
GoCode is designed around modular Go interfaces (provider.Provider and tools.Tool). Adding a new LLM backend or tool integration is a great first contribution! See Extending GoCode below.
- Fork the repository on GitHub.
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/gocode.git cd gocode - Create a topic branch:
git checkout -b feat/my-new-feature
- Make your changes following the Coding Guidelines.
- Verify your changes:
go test ./... go vet ./... - Commit your changes with a clear, concise commit message:
git commit -m "feat(tools): add web search tool" - Push to your fork and open a Pull Request against
main.
- Go: 1.22 or higher installed (golang.org).
- Git: Installed and configured.
- Ollama: (Optional but recommended for local testing) Running locally on port
11434(ollama.com).
# Clone the repository
git clone https://github.com/mevarx/GoCode.git
cd gocode
# Build binary
go build -o gocode ./cmd/gocode/
# Run interactive binary
./gocode
# Or run directly with flags
go run ./cmd/gocode/ --provider ollama --model codellamaGoCode follows standard Go layout patterns:
gocode/
├── .github/ # GitHub Actions workflows & PR/issue templates
├── cmd/
│ └── gocode/ # Main entry point (Cobra CLI & doctor subcommand)
├── internal/
│ ├── agent/ # Core agent loop, conversation history, context management
│ ├── config/ # Configuration management (TOML, XDG paths)
│ ├── provider/ # LLM Provider interfaces and implementations (Ollama, etc.)
│ ├── tools/ # Tool interfaces, approval gate, and tool implementations
│ └── tui/ # Interactive TUI (Bubble Tea model, styles & approval modal)
├── .goreleaser.yaml # GoReleaser release configuration
├── CONTRIBUTING.md # Contribution guide
├── LICENSE # MIT License
├── Makefile # Build, test, and release targets
├── README.md # Project overview & quickstart
├── go.mod # Module dependencies
└── go.sum # Module checksums
All tools must implement the tools.Tool interface defined in internal/tools/tool.go:
type Tool interface {
Spec() ToolSpec
Execute(ctx context.Context, args json.RawMessage) (Result, error)
RequiresApproval() bool
}- Create a new file in
internal/tools/your_tool.go. - Implement
Spec()(returns name, description, JSON schema parameters),Execute(), andRequiresApproval(). - Register your tool in
cmd/gocode/main.go:toolRegistry.Register(&tools.YourTool{})
- Add tests for your tool in
internal/tools/your_tool_test.go.
Providers must implement the provider.Provider interface in internal/provider/provider.go:
type Provider interface {
Name() string
Models(ctx context.Context) ([]string, error)
Stream(ctx context.Context, model string, history []Message, tools []ToolSpec) (<-chan StreamChunk, error)
}- Create a new file in
internal/provider/your_provider.go. - Implement
Name(),Models(), andStream()with streaming communication to your backend API. - Register the provider in
cmd/gocode/main.go.
- Format: Run
gofmt -s -w .before committing. - Linting: Ensure
go vet ./...reports zero issues. - Error Handling: Always handle returned errors. Wrap errors with contextual information using
fmt.Errorf("failed to ...: %w", err). - Security: Any tool performing file modifications or executing system commands MUST set
RequiresApproval() bool { return true }. - Dependencies: Keep external dependencies minimal. Prefer the Go standard library where possible.
Run unit tests across all packages:
go test -v ./...For package coverage:
go test -cover ./...If you discover a security vulnerability, please do not open a public issue. Instead, report it privately to the maintainers via email or security advisory.
Thank you for helping build a better, open-source terminal coding experience!