Thank you for your interest in contributing to Flashduty Runner! This document provides guidelines and instructions for contributing.
Please read and follow our Code of Conduct. We aim to maintain a welcoming environment for all contributors.
- Go 1.24 or later
- Make
- golangci-lint (for linting)
- gofumpt (for formatting)
- gci (for import sorting)
# Clone the repository
git clone https://github.com/flashcatcloud/flashduty-runner.git
cd flashduty-runner
# Install development tools
make tools
# Install dependencies
go mod tidy
# Verify setup
make testgit checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixFollow these coding standards:
- Formatting: Run
make fmtbefore committing - Linting: Ensure
make lintpasses - Testing: Add tests for new functionality
- Documentation: Update README if adding features
Use gci to organize imports in this order:
- Standard library
- Third-party packages
- Local packages (github.com/flashcatcloud/...)
import (
"context"
"fmt"
"github.com/gorilla/websocket"
"github.com/flashcatcloud/flashduty-runner/config"
)- Always wrap errors with context
- Use
fmt.Errorf("context: %w", err)for wrapping - Never ignore errors silently
if err != nil {
return fmt.Errorf("failed to connect: %w", err)
}- Use structured logging with
log/slog - Include relevant context in log messages
- Use appropriate log levels (debug, info, warn, error)
slog.Info("connected to server",
"url", config.APIURL,
"runner_id", runnerID,
)# Run all tests
make test
# Run specific package tests
go test -v ./workspace/...
# Run with coverage
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.outFollow conventional commits:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoringtest: Adding testschore: Maintenance tasks
Examples:
feat(workspace): add glob pattern support for file search
fix(ws): handle reconnection on network timeout
docs(readme): add troubleshooting section
- Push your branch
- Create a Pull Request with:
- Clear description of changes
- Link to related issues
- Screenshots for UI changes (if any)
- Wait for CI to pass
- Address review comments
flashduty-runner/
├── cmd/
│ └── main.go # CLI entry point (cobra)
├── config/
│ ├── config.go # Configuration loading (viper)
│ └── config_test.go # Config tests
├── permission/
│ ├── permission.go # Command permission checker
│ └── permission_test.go # Permission tests
├── protocol/
│ └── messages.go # WebSocket message types
├── workspace/
│ ├── workspace.go # Workspace operations
│ ├── workspace_test.go # Workspace tests
│ ├── webfetch.go # Web page fetching
│ └── large_output.go # Large output handling
├── ws/
│ ├── client.go # WebSocket client
│ └── handler.go # Message handler
├── mcp/
│ ├── client.go # MCP client manager
│ └── transport.go # MCP transport layer
├── .github/
│ ├── workflows/ # CI/CD pipelines
│ │ ├── go.yml # Go tests
│ │ ├── lint.yml # Linting
│ │ ├── goreleaser.yml # Release automation
│ │ └── docker-publish.yml # Docker builds
│ ├── ISSUE_TEMPLATE/ # Issue templates
│ └── pull_request_template.md
├── Dockerfile # Multi-stage Docker build
├── Makefile # Build automation
├── .goreleaser.yaml # Release configuration
├── .golangci.yml # Linter configuration
└── README.md
- Add method to
workspace/workspace.go - Add message type to
protocol/messages.go - Add handler case in
ws/handler.go - Add tests in
workspace/workspace_test.go - Update README if user-facing
- Add command function in
cmd/main.go - Register with
rootCmd.AddCommand() - Add tests
- Update README
- Add field to
config.Configstruct inconfig/config.go - Update
DefaultConfig()if needed - Add validation in
Validate()if needed - Document in README
- Add tests in
config/config_test.go
Every PR triggers:
- go.yml: Runs
go testwith race detection - lint.yml: Runs golangci-lint
- code-scanning.yml: Security scanning with CodeQL
Releases are automated via GoReleaser when a tag is pushed:
git tag v1.0.0
git push origin v1.0.0This triggers:
- Cross-platform binary builds (Linux, macOS, Windows × amd64, arm64)
- Docker image builds and push to GHCR
- GitHub release creation with changelog
- Open an issue for bugs or feature requests
- Check existing issues before creating new ones
- Join our community discussions
Thank you for contributing!