Contributing¶
Guidelines for contributing to vac.
Getting Started¶
Prerequisites¶
- Go 1.21+
- FFmpeg
- Marp CLI
- ElevenLabs API key (for testing TTS)
Clone and Build¶
git clone https://github.com/grokify/videoascode.git
cd vac
go mod download
go build -o vac ./cmd/vac
Run Tests¶
Run Linter¶
Code Style¶
Formatting¶
Use gofmt:
Linting¶
All code must pass golangci-lint:
Error Handling¶
Follow this priority order:
- Panic: For programming errors / invariant violations
- Return: If the function can return an error
- Log: If error cannot be returned, use slog via context:
import "github.com/grokify/mogo/log/slogutil"
logger := slogutil.LoggerFromContext(ctx, nil)
logger.Error("operation failed", "error", err)
- Report: If none of the above, report to the user
Never silently discard errors.
Logging¶
Use structured logging via slog:
logger := slogutil.LoggerFromContext(ctx, nil)
// Good
logger.Info("processing slide", "index", i, "duration", duration)
// Avoid
log.Printf("processing slide %d", i)
Commit Messages¶
Follow Conventional Commits:
Types:
| Type | Description |
|---|---|
feat | New feature |
fix | Bug fix |
docs | Documentation |
style | Formatting (no code change) |
refactor | Code restructuring |
perf | Performance improvement |
test | Adding tests |
build | Build system changes |
ci | CI configuration |
chore | Maintenance |
Examples:
feat(tts): add Deepgram provider support
fix: handle empty slide notes gracefully
docs: add transcript schema reference
test: add parser edge case tests
Pull Request Process¶
- Fork the repository
- Create branch:
git checkout -b feat/my-feature - Make changes with tests
- Run checks:
- Commit with conventional commit message
- Push:
git push origin feat/my-feature - Open PR against
main
PR Checklist¶
- [ ] Tests pass locally
- [ ] Linter passes
- [ ] Commit messages follow conventions
- [ ] Documentation updated (if applicable)
- [ ] No breaking changes (or documented in PR)
Adding Features¶
New TTS Provider¶
- Create
pkg/tts/<provider>.go - Implement the TTS interface:
- Add CLI flag for provider selection
- Update documentation
New Output Format¶
- Update
pkg/video/combiner.go - Add format-specific FFmpeg options
- Add CLI flag
- Update documentation
New Transcript Feature¶
- Update
pkg/transcript/transcript.go - Update
pkg/transcript/transcript.schema.json - Update orchestrator to use new feature
- Add example in
examples/ - Update documentation
Testing¶
Unit Tests¶
Place tests alongside code:
Example:
func TestParseMarpContent(t *testing.T) {
input := `---
marp: true
---
# Slide 1
<!-- Voiceover text -->
`
slides, err := parser.ParseMarpContent(input)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if len(slides) != 1 {
t.Errorf("expected 1 slide, got %d", len(slides))
}
}
Integration Tests¶
For tests requiring external services:
func TestElevenLabsSynthesize(t *testing.T) {
if os.Getenv("ELEVENLABS_API_KEY") == "" {
t.Skip("ELEVENLABS_API_KEY not set")
}
// ...
}
Documentation¶
Code Comments¶
- Document exported functions and types
- Keep comments concise and useful
- Don't state the obvious
MkDocs¶
Documentation lives in docs/:
Release Process¶
- Update version in code
- Update CHANGELOG.md
- Create PR with version bump
- After merge, tag release:
Questions?¶
- Open an issue for bugs or feature requests
- Discussions for general questions