Contributing to SLV
Thank you for your interest in contributing to SLV! This guide will help you get started with contributing to the project.
How to Contributeโ
There are many ways to contribute to SLV:
- ๐ Report bugs - Open an issue describing the problem
- ๐ก Suggest features - Share your ideas for improvements
- ๐ Improve documentation - Help make the docs better
- ๐ป Write code - Fix bugs or add new features
- ๐งช Write tests - Improve test coverage
- ๐ Review pull requests - Help review and test changes
Getting Startedโ
Prerequisitesโ
Before you begin, ensure you have the following installed:
Development Setupโ
-
Fork the repository
# Fork the repository on GitHub, then clone your fork
git clone https://github.com/YOUR_USERNAME/slv.git
cd slv -
Add the upstream remote
git remote add upstream https://github.com/amagioss/slv.git -
Install dependencies
# Go dependencies will be downloaded automatically
go mod download
# For documentation development
cd website
npm install -
Build the project
# Build the main CLI
go build -o slv ./internal/app/main.go
# Or install it
go install ./internal/app/main.go
Development Workflowโ
1. Create a Branchโ
Always create a new branch for your changes:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix
Branch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or improvements
2. Make Your Changesโ
- Write clean, readable code
- Follow Go conventions and best practices
- Add comments for complex logic
- Update tests if needed
- Update documentation if your changes affect user-facing features
3. Test Your Changesโ
# Run all tests
go test ./...
# Run tests for a specific package
go test ./internal/core/vaults
# Run with verbose output
go test ./... -v
4. Commit Your Changesโ
Write clear, descriptive commit messages:
git add .
git commit -m "Add feature: description of what you added"
Commit message guidelines:
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters
- Reference issues and pull requests when applicable
Example:
Add support for Azure Key Vault integration
- Implement Azure KMS provider
- Add authentication flow
- Update documentation
Fixes #123
5. Push and Create a Pull Requestโ
git push origin feature/your-feature-name
Then open a Pull Request on GitHub with:
- A clear title and description
- Reference to related issues
- Screenshots (if applicable)
- Testing instructions
Code Contributionsโ
Project Structureโ
slv/
โโโ internal/
โ โโโ app/main.go # Entry Point
โ โโโ cli/ # CLI commands
โ โโโ core/ # Core functionality
โ โโโ tui/ # Terminal UI
โ โโโ k8s/ # Kubernetes operator
โโโ action/ # GitHub Actions
โโโ website/ # Documentation site
โโโ slv.go # Library Functions
Code Styleโ
- Follow Effective Go guidelines
- Use
gofmtto format your code - Run
go vetto check for common mistakes - Use meaningful variable and function names
- Keep functions small and focused
Documentation Contributionsโ
The documentation is built with Docusaurus.
Setupโ
cd website
npm install
Developmentโ
# Start the development server
npm start
# Build the site
npm run build
# Clear cache
npm run clear
Documentation Structureโ
- Markdown files in
website/docs/- Main documentation content - Components in
website/src/components/- React components - Styling in
website/src/css/- Custom CSS
Writing Documentationโ
- Use clear, concise language
- Include code examples where helpful
- Add cross-references to related pages
- Keep examples up-to-date with the codebase
- Test all code examples
Documentation Style Guideโ
- Use active voice
- Write for both beginners and advanced users
- Include "See Also" sections for related topics
- Add prerequisites when needed
- Use consistent formatting
Testingโ
Writing Testsโ
- Write tests for new features
- Update tests when fixing bugs
- Aim for good test coverage
- Use table-driven tests when appropriate
Test Structureโ
func TestFunctionName(t *testing.T) {
tests := []struct {
name string
input string
expected string
wantErr bool
}{
{
name: "valid input",
input: "test",
expected: "result",
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Test implementation
})
}
}
Running Testsโ
# Run all tests
go test ./...
# Run tests with coverage
go test ./... -coverprofile=coverage.out
go tool cover -html=coverage.out
# Run tests for a specific package
go test ./internal/core/vaults
Pull Request Processโ
-
Update your branch
git fetch upstream
git rebase upstream/main -
Ensure tests pass
go test ./... -
Update documentation if your changes affect user-facing features
-
Create the PR with:
- Clear title and description
- Reference to related issues
- Testing instructions
- Screenshots (if applicable)
-
Respond to feedback and make requested changes
-
Keep your PR focused - One feature or fix per PR
Code Review Guidelinesโ
For Contributorsโ
- Be open to feedback
- Respond to comments promptly
- Make requested changes clearly
- Ask questions if something is unclear
For Reviewersโ
- Be constructive and respectful
- Explain the reasoning behind suggestions
- Approve when changes look good
- Test the changes when possible
Reporting Bugsโ
When reporting bugs, please include:
- Description - What happened?
- Steps to reproduce - How can we reproduce it?
- Expected behavior - What should have happened?
- Actual behavior - What actually happened?
- Environment - OS, Go version, SLV version
- Logs - Relevant error messages or logs
Suggesting Featuresโ
When suggesting features, please include:
- Use case - What problem does this solve?
- Proposed solution - How should it work?
- Alternatives - Other solutions you've considered
- Additional context - Any other relevant information
Questions?โ
- GitHub Discussions - For questions and discussions
- GitHub Issues - For bug reports and feature requests
- Documentation - Check the docs at slv.sh
Licenseโ
By contributing to SLV, you agree that your contributions will be licensed under the MIT License.
See Alsoโ
- Quick Start Guide - Get started with SLV
- Command Reference - Learn about SLV commands
- Overview - Learn about SLV