Rename the Go module, the cmd/ entrypoint dir, the binary, the default config dir (~/.config/av1dae/), the Docker image/compose service, and all docs and the dashboard wordmark. No behavioral change — import paths and identifiers only.
2.6 KiB
2.6 KiB
AGENTS.md
This file provides guidance for agents operating in the av1dae repository.
Project Overview
Go-based CLI tool for transcoding DVD/Blu-ray to SVT-AV1 with automatic metadata fetching from OMDb and TVmaze.
Build Commands
# Build binary
go build -o av1dae ./cmd/av1dae/
# Run binary
./av1dae
# With flags
./av1dae -d # Delete original after encode
./av1dae -c /path/to/config.yaml
Code Style Guidelines
General
- Use Go standard library; minimize external dependencies
- Use
gopkg.in/yaml.v3for YAML config parsing (already in go.mod) - Run
go fmtandgo vetbefore commits
Imports
- Group imports: standard library, external packages, internal packages
- Use aliases for packages:
"av1dae/pkg/types"
import (
"fmt"
"os"
"gopkg.in/yaml.v3"
"av1dae/pkg/types"
)
Naming
- Packages: lowercase, single word (e.g.,
encoder,metadata) - Types: PascalCase (e.g.,
Encoder,Job) - Functions: PascalCase exported, camelCase unexported
- Variables: camelCase
- Constants: PascalCase for exported, camelCase for unexported
- Acronyms: all caps for 2 letters (e.g.,
IMDBID), mixed for 3+ (e.g.,jpegImage)
Error Handling
- Return errors with context:
fmt.Errorf("parsing config: %w", err) - Use sentinel errors for known conditions
- Check errors explicitly, don't ignore with
_
Types
- Use specific types where appropriate (e.g.,
MediaTypestring type) - Define types in
pkg/types/types.go
Functions
- Keep functions small and focused
- Prefer multiple small functions over large ones
- Use receivers for methods:
func (e *Encoder) Transcode(...)
Concurrency
- Use channels for communication
- Handle shutdown with context or done channels
Testing
- Write tests in
*_test.gofiles alongside implementation - Use table-driven tests for multiple cases
- Test external dependencies with mocks
Commit Messages
Follow Conventional Commits:
add:new featuresfix:bug fixesrefactor:code restructuringchore:maintenance
Example: add: add command line argument support
Project Structure
cmd/av1dae/main.go # CLI entrypoint
internal/
config/ # Config loading
watcher/ # Folder polling
encoder/ # FFmpeg wrapper
metadata/ # OMDb/TVmaze client
mover/ # File operations
logger/ # Logging
pkg/types/types.go # Shared types
Key Dependencies
ffmpeg- video encodingopusenc- audio encodinggopkg.in/yaml.v3- config parsing