Thank you for your interest in contributing to slack-cli! This document provides guidelines and information for contributors.
Be respectful, inclusive, and professional in all interactions.
- Fork the repository
- Clone your fork:
git clone https://github.com/yourusername/slack-cli.git - Create a feature branch:
git checkout -b feature/my-new-feature - Make your changes
- Test thoroughly
- Commit and push
- Open a Pull Request
- Go 1.21 or higher
- A Slack workspace for testing
go build -o slack-cli .# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run specific package
go test ./internal/slack/...- Follow standard Go conventions
- Use
gofmtto format code - Run
go vetto check for issues - Keep functions focused and well-documented
- Write tests for new features
Use conventional commit format:
feat: add new featurefix: resolve bugdocs: update documentationtest: add testsrefactor: improve code structurechore: update dependencies
- Update documentation - If you add features, update README.md and DESIGN.md
- Add tests - New features should include tests
- Check formatting - Run
gofmt -s -w . - Verify builds - Ensure
go build ./...succeeds - Run tests - Ensure
go test ./...passes - Update CHANGELOG - Add entry for your changes (if applicable)
- Describe changes - Provide clear PR description
<type>: <short description>
Examples:
feat: add message threading support
fix: resolve cache corruption issue
docs: improve installation instructions
Include:
- Go version (
go version) - OS and architecture
- Steps to reproduce
- Expected vs actual behavior
- Relevant logs or error messages
Include:
- Use case description
- Proposed solution
- Alternative solutions considered
- Impact on existing features
slack-cli/
├── cmd/ # CLI commands (Cobra)
│ ├── root.go # Root command
│ ├── config.go # Config commands
│ ├── messages.go # Message commands
│ └── ...
├── internal/ # Internal packages
│ ├── slack/ # Slack API client
│ ├── config/ # Configuration management
│ ├── cache/ # Caching layer
│ ├── output/ # Output formatting
│ └── ...
├── docs/ # Documentation
├── main.go # Entry point
└── README.md # Project documentation
- Test individual functions and methods
- Mock external dependencies (Slack API)
- Use table-driven tests for multiple scenarios
- Aim for >80% coverage on new code
Example:
func TestChannelResolver(t *testing.T) {
tests := []struct {
name string
input string
want string
wantErr bool
}{
{
name: "valid channel name",
input: "#general",
want: "C123ABC",
wantErr: false,
},
// more cases...
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// test implementation
})
}
}- Test with real Slack API (when possible)
- Use environment variables for credentials
- Skip if credentials not available
func TestSlackIntegration(t *testing.T) {
if os.Getenv("SLACK_USER_TOKEN") == "" {
t.Skip("SLACK_USER_TOKEN not set")
}
// test implementation
}- Keep README.md up to date
- Document all public functions and types
- Provide examples for complex features
- Update DESIGN.md for architectural changes
- Open an issue for questions
- Check existing issues first
- Be specific and provide context
By contributing, you agree that your contributions will be licensed under the MIT License.