Thank you for your interest in contributing to blob-cli! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Workflow
- Code Style
- Commit Guidelines
- Testing
- Pull Request Process
- Getting Help
We are committed to providing a welcoming and inclusive environment. Please be respectful and constructive in all interactions. Harassment, discrimination, or abusive behavior will not be tolerated.
- Go 1.25+ - Installation guide
- just - Command runner (installation)
- golangci-lint - Go linter (installation)
-
Fork the repository on GitHub
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/blob-cli.git cd blob-cli -
Add the upstream remote:
git remote add upstream https://github.com/meigma/blob-cli.git
-
Install development tools:
just tools
-
Verify your setup:
just ci
Create a feature branch from master:
git checkout master
git pull upstream master
git checkout -b feat/your-feature-nameUse descriptive branch names with prefixes like feat/, fix/, docs/, or refactor/.
Use just to run common development tasks:
| Command | Description |
|---|---|
just |
Run default checks (fmt, vet, lint, test) |
just ci |
Run full CI pipeline (includes build) |
just build |
Build the binary |
just test |
Run unit tests with race detection |
just lint |
Run golangci-lint |
just fmt |
Check formatting |
just fmt-write |
Format code (modifies files) |
just tools |
Install development tools |
just clean |
Remove build artifacts |
Start a local OCI registry for manual testing:
docker run -d -p 5000:5000 --name registry registry:2Then test commands against it:
./blob push localhost:5000/test:v1 ./testdata
./blob pull localhost:5000/test:v1 ./outputCode must be formatted with gofmt:
just fmt # Check formatting
just fmt-write # Fix formattingImports must be organized in groups:
- Standard library
- External packages
- Local packages (
github.com/meigma/blob-cli)
All code must pass golangci-lint with no errors:
just lintThe linter enforces:
- Error handling - All errors must be explicitly handled
- Security - No common security vulnerabilities (gosec)
- Code quality - Various best practices via revive, gocritic, etc.
- Keep functions focused and concise
- Use meaningful variable and function names
- Add godoc comments for exported functions and types
- Handle errors explicitly; avoid ignoring them
- Use
context.Contextfor cancellation and timeouts
This project uses Conventional Commits for automated versioning and changelog generation.
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
| Type | Version Bump | Example |
|---|---|---|
fix: |
Patch (0.0.x) | fix: handle nil pointer in registry client |
feat: |
Minor (0.x.0) | feat: add zstd compression support |
feat!: |
Major (x.0.0) | feat!: redesign command flags |
BREAKING CHANGE: |
Major (x.0.0) | Footer indicating breaking change |
Other types (no version bump, but tracked in changelog):
docs:- Documentation changeschore:- Maintenance taskstest:- Test additions or fixesci:- CI/CD changesrefactor:- Code refactoringstyle:- Code style changesperf:- Performance improvements
# Bug fix
git commit -m "fix: prevent panic when manifest is nil"
# New feature
git commit -m "feat: add --recursive flag to cp command"
# Breaking change
git commit -m "feat!: change pull command to require explicit output path"
# With scope
git commit -m "fix(cache): handle concurrent cache writes"
# With body
git commit -m "feat: add content-addressed caching
Implements local filesystem caching with automatic
deduplication across archives based on content hash."Run unit tests:
just testTests run with race detection and coverage enabled by default.
- Use testify for assertions
- Place test files alongside source files (
foo_test.go) - Use table-driven tests for multiple test cases
- Tag integration tests with
//go:build integration
Example:
func TestPushCmd_Validation(t *testing.T) {
tests := []struct {
name string
args []string
wantErr bool
}{
// test cases...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// test implementation
})
}
}-
Sync with upstream:
git fetch upstream git rebase upstream/master
-
Run all checks:
just ci
-
Push your branch to your fork:
git push origin feat/your-feature-name
-
Open a Pull Request against
meigma/blob-cli:master -
Fill out the PR template with:
- Summary of changes
- Related issues (use
Fixes #123to auto-close) - Testing performed
- All CI checks must pass
- Code must be formatted and lint-free
- Tests must pass (including any new tests for new functionality)
- Commits must follow Conventional Commits format
- Changes should be focused and atomic
- A maintainer will review your PR
- Address feedback by pushing additional commits
- Once approved, a maintainer will merge the PR
- Questions: Open a GitHub Discussion
- Bugs: Open a GitHub Issue
By contributing, you agree that your contributions will be licensed under the Apache License 2.0 or MIT License, at the user's option.