[go: up one dir, main page]

tagver-cli 0.1.1

Command-line tool for minimalistic versioning using Git tags
tagver-cli-0.1.1 is not a library.

TagVer

CI MSRV 1.75+

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)

cargo install tagver-cli

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

git clone https://github.com/scratchingmonkey/tagver
cd tagver
cargo install --path crates/cli

Usage

Basic usage

# Calculate version for current repository
tagver

# With custom tag prefix
tagver --tag-prefix v

# Ignore height (use exact tag version)
tagver --ignore-height

# Print all command-line options
tagver --help

Example

$ git tag 1.2.3

$ tagver
1.2.3

Environment variables

All options can also be set via environment variables:

  • TAGVER_TAGPREFIX
  • TAGVER_AUTOINCREMENT
  • TAGVER_DEFAULTPRERELEASEIDENTIFIERS
  • TAGVER_MINIMUMMAJORMINOR
  • TAGVER_IGNOREHEIGHT
  • TAGVER_BUILDMETADATA
  • TAGVER_VERBOSITY

How it works

TagVer follows the same algorithm as the original MinVer:

  1. Tag discovery: Find all Git tags that match the configured prefix
  2. Version parsing: Parse tags as semantic versions (SemVer 2.0.0)
  3. Commit traversal: Walk the commit graph from HEAD to find the nearest tagged ancestor
  4. Height calculation: Count commits between current position and the base tag
  5. 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