How caarlos0/svu works
svu is a semantic-version utility exposed as a CLI and Go API. The main workflow selects an action, finds the relevant Git tag and (for automatic or prerelease calculations) reads commit history, then classifies changes and returns a formatted version. The CLI also loads YAML/environment configuration and can initialize a config file. The sampled sources show these calls directly; Git history and tag selection are implemented through subprocesses. The graph does not assume additional stages beyond the sampled implementation.
Main entry points: svu/svu.go Version engine · main.go Commands and flags · git.go Tag and log operations · svu/svu.go Go API
Components 11
CLI
- Commands and flags
main.go - Configuration
main.go
Versioning core
- Version engine
internal/svu/svu.go - Change classification
internal/svu/svu.go - Version formatting
internal/svu/svu.go
Git and API
- Tag and log operations
internal/git/git.go - Go API
pkg/svu/svu.go
Other components
- CLI user
- Git repository
- User config file
- Standard output
Connections 10
- CLI user → Commands and flags: runs command
main.go - Commands and flags → Version engine: calls Version
main.go - Commands and flags → Configuration: loads settings
main.go - Configuration → User config file: reads or writes
main.go - Version engine → Tag and log operations: gets tag and log
internal/svu/svu.go - Tag and log operations → Git repository: runs Git commands
internal/git/git.go - Version engine → Change classification: classifies commits
internal/svu/svu.go - Version engine → Version formatting: formats result
internal/svu/svu.go - Commands and flags → Standard output: prints version
main.go - Go API → Version engine: calls Version
pkg/svu/svu.go