Skip to main content
Contributions to Aceplay are welcome! This guide covers the contribution workflow, code style, and pull request process.

Getting Started

1

Fork the repository

Create your own fork of the repository on GitHub:
# Click "Fork" on https://github.com/crstian19/aceplay
2

Clone your fork

git clone https://github.com/YOUR_USERNAME/aceplay.git
cd aceplay
3

Create a feature branch

git checkout -b feature/amazing-feature
Branch naming conventions:
  • feature/ - New features
  • fix/ - Bug fixes
  • docs/ - Documentation updates
  • refactor/ - Code refactoring
4

Install dependencies

make deps

Development Workflow

1. Make Your Changes

Write clean, well-documented code following the code style guidelines.

2. Add Tests

All new features and bug fixes should include tests:
# Run tests as you develop
make test

# Check coverage
make test-coverage
See Testing for details.

3. Run Quality Checks

Before committing, run all checks:
make check
This runs:
  • make fmt - Format code
  • make vet - Static analysis
  • make lint - Linting
  • make test - Full test suite
Always run make check before committing. Pull requests that don’t pass these checks will not be merged.

4. Commit Your Changes

Write clear, descriptive commit messages:
git add .
git commit -m "Add support for custom player arguments"
Good commit messages:
  • “Add support for custom player arguments”
  • “Fix race condition in stream initialization”
  • “Update configuration documentation”
Bad commit messages:
  • “Fixed stuff”
  • “WIP”
  • “Updates”

5. Push to Your Fork

git push origin feature/amazing-feature

6. Open a Pull Request

On GitHub:
  1. Navigate to your fork
  2. Click “Pull Request”
  3. Select your feature branch
  4. Fill out the PR template with:
    • Description of changes
    • Related issue numbers (if any)
    • Testing performed
    • Screenshots (for UI changes)

Code Style Guidelines

General Principles

From AGENTS.md:
  • Write clean, readable Go code
  • Follow standard Go conventions
  • Keep functions focused and small (single responsibility)
  • Use meaningful variable and function names
  • Add comments for exported functions and types

Naming Conventions

// Variables: camelCase
configPath := "/path/to/config"
isFirstRun := true

// Constants: PascalCase or camelCase for unexported
const DefaultPlayer = "mpv"
const maxRetries = 3

// Functions: PascalCase for exported, camelCase for unexported
func LoadConfig(path string) (*Config, error) { }
func isValidURL(url string) bool { }

// Types/Structs: PascalCase
type Config struct { }
type EngineConfig struct { }

// Interfaces: PascalCase with "er" suffix
type Reader interface { }
type ConfigLoader interface { }

Import Organization

Organize imports in groups (standard library first, then external):
import (
    "context"
    "fmt"
    "os"
    "time"

    "charm.land/lipgloss/v2"
    "github.com/spf13/cobra"
    "github.com/spf13/viper"
    "github.com/stretchr/testify/assert"
)
Run make fmt to organize automatically.

Error Handling

Always handle errors explicitly:
// Good - wrap errors with context
if err != nil {
    return fmt.Errorf("failed to load config: %w", err)
}

// Good - early return on error
cfg, err := Load(configPath)
if err != nil {
    return fmt.Errorf("error loading configuration: %w", err)
}

// Bad - ignoring errors
_ = LoadConfig(path)

// Bad - no context
if err != nil {
    return err
}

Struct Tags

Use struct tags for configuration and serialization:
type Config struct {
    Player  string        `mapstructure:"player"`
    Engine  EngineConfig  `mapstructure:"engine"`
    Timeout time.Duration `mapstructure:"timeout"`
    HLS     bool          `mapstructure:"hls"`
}

Logging

Use the Charm log package consistently:
import "github.com/charmbracelet/log"

log.Info("starting application")
log.Debugf("config loaded from %s", configPath)
log.Errorf("failed to connect: %v", err)

CLI Commands

Use Cobra with helpful descriptions:
var playCmd = &cobra.Command{
    Use:   "play [acestream-url]",
    Short: "Play an Ace Stream URL",
    Long:  `Play Ace Stream content using your configured video player.`,
    Args:  cobra.ExactArgs(1),
    RunE:  runPlay,
}

Testing Requirements

Test Coverage

All new code should include tests:
  • New features: Add tests covering main functionality and edge cases
  • Bug fixes: Add regression tests to prevent recurrence
  • Refactoring: Ensure existing tests still pass
Target coverage:
  • Critical paths: 80%+
  • Utilities: 70%+
  • UI components: Best effort

Test Structure

Use table-driven tests:
func TestParseURL(t *testing.T) {
    tests := []struct {
        name    string
        input   string
        wantID  string
        wantErr bool
    }{
        {"valid URL", "acestream://abc123", "abc123", false},
        {"invalid protocol", "http://example.com", "", true},
    }

    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            id, err := ParseURL(tt.input)
            if tt.wantErr {
                assert.Error(t, err)
            } else {
                assert.NoError(t, err)
                assert.Equal(t, tt.wantID, id)
            }
        })
    }
}
See Testing for detailed guidelines.

Documentation

Update documentation when:
  • Adding new features
  • Changing configuration options
  • Modifying CLI commands
  • Changing behavior
Documentation locations:
  • README.md - Project overview and quick start
  • AGENTS.md - Development guidelines
  • CHANGELOG.md - Version history
  • Code comments - Exported functions and types

Pull Request Guidelines

PR Checklist

Before submitting:
  • Code follows style guidelines
  • make check passes without errors
  • Tests added for new features/fixes
  • Documentation updated
  • Commit messages are clear and descriptive
  • PR description explains changes and motivation

PR Review Process

  1. Automated checks: CI runs tests and linting
  2. Code review: Maintainers review your changes
  3. Feedback: Address review comments
  4. Approval: PR is approved and merged

Responding to Feedback

When reviewers request changes:
  1. Make the requested changes
  2. Run make check again
  3. Commit and push updates
  4. Respond to review comments
# After making changes
git add .
git commit -m "Address review feedback: improve error handling"
git push origin feature/amazing-feature

Common Contribution Tasks

Adding a New Command

1

Create command file

Add command in appropriate package
2

Register with Cobra

Register in cmd/aceplay/main.go
3

Add tests

Create *_test.go file with test cases
4

Update documentation

Document in README.md and relevant docs

Adding a Configuration Option

1

Update Config struct

Add field to Config struct in internal/config/config.go
2

Set default value

Add default in NewConfig() function
3

Document in README

Add to configuration section with example
4

Add tests

Test loading and validation

Fixing a Bug

1

Write failing test

Create test that reproduces the bug
2

Fix the bug

Implement the fix
3

Verify test passes

Ensure the new test now passes
4

Run all tests

Make sure no regressions: make test

Dependencies

Adding Dependencies

When adding new dependencies:
# Add dependency
go get github.com/example/package@latest

# Clean up
make tidy

# Verify
go mod verify
Guidelines:
  • Keep dependencies minimal
  • Prefer well-maintained packages
  • Check license compatibility (MIT preferred)
  • Document why the dependency is needed

Updating Dependencies

# Update specific package
go get -u github.com/spf13/cobra@latest

# Update all dependencies
go get -u ./...

# Clean up
make tidy

Getting Help

If you need help:
  1. Check existing issues: Search GitHub issues for similar problems
  2. Read documentation: Review README.md and AGENTS.md
  3. Ask questions: Open a GitHub issue with the “question” label
  4. Join discussions: Participate in GitHub Discussions

Code of Conduct

Be respectful and constructive:
  • Use welcoming and inclusive language
  • Respect differing viewpoints and experiences
  • Accept constructive criticism gracefully
  • Focus on what is best for the community

Recognition

Contributors are recognized in:
  • GitHub contributors page
  • CHANGELOG.md for significant contributions
  • Project README for major features
Thank you for contributing to Aceplay!

Resources

Architecture

Understand the project structure

Building

Learn how to build from source

Testing

Testing guidelines and commands

Go Documentation

Official Go documentation

Build docs developers (and LLMs) love