This file provides instructions for AI coding agents working in this repository.
atvloadly is a Go-based web service for sideloading apps onto Apple TV devices. It uses:
- Backend: Go 1.18+ with Fiber web framework
- Frontend: Vue.js 3 + Vite + TailwindCSS
- Database: SQLite with GORM
- External Tools: PlumeImpactor (
plumesignCLI) for IPA signing
# Build the Go binary
go build -o atvloadly main.go
# Build for specific platform
GOOS=linux GOARCH=amd64 go build -o build/atvloadly-linux-amd64 main.go
# Run locally with debug mode
go run main.go server --config ./doc/config.yaml.example --debug
# Run with hot reload (requires air)
air
# Build frontend (required before Go build)
cd ./web/static && npm install && npm run build# Run all tests
go test ./...
# Run tests with coverage
go test -coverprofile=coverage.txt -covermode=atomic ./...
# Run a single test
go test -run TestCommand_CombinedOutput ./internal/exec/
# Run tests for specific package
go test ./internal/service/# Run golangci-lint (used in CI)
golangci-lint run --timeout=5m
# Format Go code
gofmt -w .
# Tidy modules
go mod tidy- Standard library imports
- Third-party imports (alphabetical)
- Local imports (
github.com/bitxeno/atvloadly/...)
- Use
pkg/errorsorgo-errors/errorsfor stack traces - Wrap errors with context:
errors.Wrap(err, "context") - Check error handling in tests with
t.Errorf()
- Exported: PascalCase (e.g.,
InstallManager,GetDevices()) - Unexported: camelCase (e.g.,
quietMode,outputStdout) - Constants: CamelCase or PascalCase (e.g.,
AppName,ErrCommandTimeout) - Interfaces: Noun with -er suffix (e.g.,
Writer,Handler)
All HTTP responses use consistent JSON wrappers:
// Success
c.Status(http.StatusOK).JSON(apiSuccess(data))
// Error
c.Status(http.StatusOK).JSON(apiError("error message"))- MANDATORY: All code comments must be written in English
- Use Go-style comments:
// Comment text - Document exported functions, types, and packages
- Use
rs/zerologviainternal/log/package - Log levels:
info(default),debug,trace - Enable debug with
--debugflag
- Models in
internal/model/ - Auto-migration in
internal/app/bootstrap.go - Use struct tags for JSON and DB:
json:"field" gorm:"column:field"
- YAML config via
koanf:internal/app/config.go - Runtime settings in JSON:
internal/app/settings.go - Default data directory:
~/.configor/datain Docker
/ws/install- Installation progress/ws/pair- Device pairing/ws/login- Login workflow/ws/tty- Terminal access (dev only!)
- Router:
web/router.go - API result helpers:
web/api_result.go - Device manager:
internal/manager/device_manager.go - Install manager:
internal/manager/install_manager.go - Models:
internal/model/
- NEVER enable TTY WebSocket (
/ws/tty) in production - Filter sensitive data (passwords) from logs
- Container requires
--privilegedfor USB access
MANDATORY: Use Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
feat: New featurefix: Bug fixdocs: Documentation only changesstyle: Code style changes (formatting, semicolons, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or correcting testschore: Build process or auxiliary tool changes
feat(device): add wireless device scanning support
fix(install): resolve timeout issue during IPA installation
docs(readme): update installation instructions
- Linux/OpenWrt ONLY - macOS/Windows not supported
- Requires
avahi-daemonfor device discovery - Requires
usbmuxd2for iOS device communication