Thank you for your interest in contributing to Starmap! We welcome contributions of all kinds, from bug reports and feature requests to code contributions and documentation improvements.
- Getting Started
- Development Setup
- Development Workflow
- Project Structure
- Adding New Providers
- Testing
- Submitting Changes
- Development Guidelines
- Contributing to models.dev
Before contributing, please:
- Check existing issues to avoid duplicates
- Read our Code of Conduct (if available)
- Review the ARCHITECTURE.md to understand the system design
- Join our Discord (if available) to discuss major changes
- Go 1.25 or later - Install Go
- Make - For build automation
- Git - For models.dev integration and version control
# Clone repository
git clone https://github.com/agentstation/starmap.git
cd starmap
# Install dependencies
go mod download
# Run tests to verify setup
make test
# Build binary
make build# Run the built binary
./starmap version
# Run with embedded catalog
./starmap models list# Format and lint code
make fix
make lint
# Run tests with coverage
make test-coverage
# Update provider testdata
make testdata-update
# Generate Go documentation
make generate
# Full build cycle
make all # clean, fix, lint, test, buildThe starmap embed command lets you inspect the embedded filesystem during development:
# List embedded files
starmap embed ls catalog
starmap embed ls catalog/providers
# View file contents
starmap embed cat catalog/providers.yaml
starmap embed cat sources/models.dev/api.json
# Display directory tree
starmap embed tree catalog
# Show file details
starmap embed stat catalog/providers.yamlThis is useful for:
- Verifying catalog structure after updates
- Debugging embedded data issues
- Understanding the catalog layout
- Checking file contents without rebuilding
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Run
make fixto format code - Run
make lintto check for issues - Run
make testto ensure tests pass - Commit with descriptive message
- Push and create pull request
Understanding the codebase organization:
starmap/
├── cmd/
│ ├── starmap/ # CLI application
│ │ ├── app/ # Application implementation
│ │ └── commands/ # Cobra CLI commands
│ └── application/ # Application interface (DI pattern)
│
├── pkg/ # Public API packages
│ ├── catalogs/ # Catalog abstraction and storage
│ ├── reconcile/ # Multi-source reconciliation
│ ├── sources/ # Data source abstractions
│ ├── authority/ # Field-level authority system
│ ├── errors/ # Custom error types
│ ├── constants/ # Application constants
│ ├── logging/ # Structured logging
│ └── convert/ # Format conversion utilities
│
├── internal/ # Internal implementation packages
│ ├── embedded/ # Embedded catalog data
│ ├── transport/ # HTTP client utilities
│ └── sources/ # Source implementations
│ ├── providers/ # Provider API clients
│ ├── modelsdev/ # models.dev integration
│ ├── local/ # Local file source
│ └── clients/ # Client registry
│
├── docs/ # Technical documentation
│ ├── API.md # Go package API reference
│ ├── ARCHITECTURE.md # System design documentation
│ └── REST_API.md # HTTP server API reference
│
├── CLAUDE.md # LLM coding assistance guide
├── README.md # User-facing documentation
└── scripts/ # Build and automation scripts
- User interfaces import only the root
starmappackage - Root package imports only
pkg/packages - Internal packages implement
pkg/interfaces - No circular dependencies (enforced by Go)
See ARCHITECTURE.md § Package Organization for detailed dependency rules.
For comprehensive instructions, see the provider implementation section in ARCHITECTURE.md.
-
Add Provider Configuration
Edit
internal/embedded/catalog/providers.yaml:- id: newprovider name: New Provider description: Description of the provider api_key: name: NEWPROVIDER_API_KEY env_var: NEWPROVIDER_API_KEY api: base_url: https://api.newprovider.com/v1 models_endpoint: /models
-
Implement Client
Create
internal/sources/providers/newprovider/client.go:package newprovider import ( "context" "github.com/agentstation/starmap/pkg/catalogs" ) type Client struct { provider *catalogs.Provider } func NewClient(provider *catalogs.Provider) (*Client, error) { return &Client{provider: provider}, nil } func (c *Client) ListModels(ctx context.Context) ([]catalogs.Model, error) { // Implement API call and model parsing return nil, nil }
-
Register in Provider Registry
Edit
internal/sources/providers/providers.go:case "newprovider": return newprovider.NewClient(provider)
-
Add Tests and Testdata
# Create test file touch internal/sources/providers/newprovider/client_test.go # Generate testdata (requires API key) export NEWPROVIDER_API_KEY=your-key go test ./internal/sources/providers/newprovider -update # Run tests go test ./internal/sources/providers/newprovider -v
-
Update Documentation
- Add provider to README.md if it's a major provider
- Update docs/ARCHITECTURE.md § Data Sources if needed
- Add yourself to CONTRIBUTORS.md
# Run all tests
go test ./...
# Run specific package tests
go test ./pkg/catalogs/...
# Run with race detector
go test -race ./...
# Run with coverage
make test-coverage
# View coverage in browser
go tool cover -html=coverage.outProvider tests use the -update flag to generate testdata:
# Update testdata for a specific provider
go test ./internal/sources/providers/openai -update
# Update all provider testdata
make testdata-update
# Update testdata for specific provider via make
make testdata PROVIDER=openaiNote: Updating testdata requires valid API keys set in environment variables.
# Run integration tests
make test-integration
# Run integration tests with specific providers
PROVIDER=openai make test-integrationAll contributions must:
- Include unit tests for new functionality
- Maintain or improve code coverage
- Pass all existing tests
- Pass race detector checks (
go test -race) - Pass linting (
make lint)
-
Fork the repository and create your branch from
master -
Make your changes following our coding guidelines
-
Test thoroughly:
make all # Runs: clean, fix, lint, test, build -
Commit your changes:
- Use clear, descriptive commit messages
- Reference issues:
Fixes #123orRelates to #456 - Follow Conventional Commits if possible
-
Push to your fork:
git push origin feature/your-feature
-
Open a Pull Request:
- Provide clear description of changes
- Reference related issues
- Include screenshots/examples for UI changes
- Update documentation if needed
- Code follows Go best practices
- Tests added/updated and passing
- Documentation updated
- Commits are focused and atomic
- No merge conflicts with
master - Passes CI checks (linting, tests, build)
- Maintainers review PR within 2-3 business days
- Address feedback and requested changes
- Once approved, maintainer merges PR
- PR author will be added to CONTRIBUTORS.md
- Follow Go conventions: Use
gofmt,goimports - Run linters:
make lintuses golangci-lint - Write idiomatic Go: See Effective Go
- Use value semantics: Prefer values over pointers for thread safety
- Document exported symbols: All exported types, functions, constants
- Define interfaces where used: Don't create interfaces "just in case"
- Dependency injection: Use functional options pattern
- Thread safety: Always return deep copies, never expose internals
- Error handling: Use typed errors from
pkg/errors - Constants: Use
pkg/constants, never hardcode values
See ARCHITECTURE.md for detailed design patterns.
- Update package READMEs for new features
- Use
//go:generatecomments for auto-generated docs - Include code examples in GoDoc comments
- Link to docs/ARCHITECTURE.md for design decisions
- Update CHANGELOG.md for user-facing changes
- Keep commits focused and atomic
- Write clear, descriptive commit messages
- Reference issues in commits:
Fixes #123 - Don't commit generated files (unless necessary)
- Add yourself to CONTRIBUTORS.md
Starmap uses models.dev for community-verified pricing and metadata.
- Visit https://models.dev
- Find the model/provider you want to update
- Submit corrections via GitHub pull request
- Wait for review and merge
- Sync automatically happens in next starmap update
- Pricing updates (input/output token costs)
- Context window limits
- Model capabilities (vision, function calling, etc.)
- Knowledge cutoff dates
- Provider logos (SVG preferred)
- Accurate model IDs
Data from models.dev syncs automatically to starmap's embedded catalog.
- Documentation: See README.md and ARCHITECTURE.md
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Discord: Join our community (if available)
Thank you for contributing to Starmap! 🌟