tagver-cli-0.1.1 is not a library.
TagVer
A Rust implementation of the MinVer CLI - minimalistic versioning using Git tags.
This project ports the excellent MinVer CLI .NET tool to Rust and incorporates the gitoxide crate, providing a fast, dependency-free CLI tool and library for calculating version numbers from Git repository tags.
Features
- Tag-driven versioning: Uses Git tags as the single source of truth for versions
- Height calculation: Automatically calculates distance from tagged commits
- Cross-platform: Single binary that runs anywhere Rust compiles
- Zero dependencies: Statically linked binary with no runtime dependencies
- Environment variable support: Full compatibility with existing MinVer CLI workflows
- First-parent traversal: Correctly handles merge commits like the original
- Semantic versioning: Strict adherence to SemVer 2.0.0 specification
Requirements
- Rust 1.75 or newer (MSRV)
Installation
From crates.io (recommended)
Pre-built binaries
Download platform-specific archives from GitHub Releases:
tagver-linux-x86_64.tar.gz(Linux x86_64)tagver-macos-arm64.tar.gz(macOS Apple Silicon)tagver-windows-x86_64.zip(Windows x86_64)
From source
Usage
Basic usage
# Calculate version for current repository
# With custom tag prefix
# Ignore height (use exact tag version)
# Print all command-line options
Example
Environment variables
All options can also be set via environment variables:
TAGVER_TAGPREFIXTAGVER_AUTOINCREMENTTAGVER_DEFAULTPRERELEASEIDENTIFIERSTAGVER_MINIMUMMAJORMINORTAGVER_IGNOREHEIGHTTAGVER_BUILDMETADATATAGVER_VERBOSITY
How it works
TagVer follows the same algorithm as the original MinVer:
- Tag discovery: Find all Git tags that match the configured prefix
- Version parsing: Parse tags as semantic versions (SemVer 2.0.0)
- Commit traversal: Walk the commit graph from HEAD to find the nearest tagged ancestor
- Height calculation: Count commits between current position and the base tag
- Version synthesis:
- If at exact tag: use version as-is
- If not at tag: apply auto-increment, add pre-release identifiers, append height
- Apply minimum major.minor constraint if configured
- Append build metadata if provided
Version calculation examples
| Git state | Result |
|---|---|
On tag 1.0.0 |
1.0.0 |
5 commits after 1.0.0 |
1.0.1-alpha.0.5 |
On tag 1.0.0-beta.1 |
1.0.0-beta.1 |
3 commits after 1.0.0-beta.1 |
1.0.0-beta.1.3 |
| No tags | 0.0.0-alpha.0 |
| 2 commits from root | 0.0.0-alpha.0.2 |
Comparison with original MinVer
| Feature | MinVer (.NET) | TagVer (Rust) |
|---|---|---|
| Language | C# | Rust |
| Distribution | NuGet package | Static binary |
| Startup time | ~200ms | <10ms |
| Dependencies | .NET SDK | None |
| Cross-platform | .NET supported | All Rust targets |
| Environment variables | ✅ | ✅ |
| CLI interface | ✅ | ✅ |
| Library usage | ✅ | ✅ |
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Acknowledgments
- Adam Ralph for creating the original MinVer
- Gitoxide for the excellent pure-Rust Git implementation
- The Rust community for the amazing ecosystem of libraries