This document explains how version information is managed across the MagicTunnel codebase to ensure consistency and reduce maintenance overhead.
Previously, the project name "MagicTunnel" and version numbers were hardcoded in many places:
- Documentation files (README.md, CLAUDE.md, etc.)
- Configuration files (config.yaml.template, magictunnel-config.yaml)
- Source code comments and CLI descriptions
- Build files and scripts
This created maintenance overhead and potential inconsistencies when updating versions.
We now use Cargo.toml as the single source of truth for project name and version information, with automated tools to keep everything in sync.
Automatically updates key files during compilation:
test-resources/info.jsonconfig.yaml.templatemagictunnel-config.yaml
# Update all files with current Cargo.toml version
cargo run --bin version-manager -- update
# Check for version inconsistencies
cargo run --bin version-manager -- check
# Set a new version across all files
cargo run --bin version-manager -- set 0.3.0# Update to current Cargo.toml version
./scripts/update-version.sh
# Update to specific version
./scripts/update-version.sh 0.3.0# Update version across all files
make update-version
# Check version consistency
make check-version
# Set new version
make set-version VERSION=0.3.0// Good - uses Cargo.toml values
#[command(name = env!("CARGO_PKG_NAME"))]
#[command(about = env!("CARGO_PKG_DESCRIPTION"))]
#[command(version)] // Automatically uses CARGO_PKG_VERSION
info!("Starting {} v{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));// Bad - hardcoded values
#[command(name = "magictunnel")]
#[command(about = "MagicTunnel - Intelligent bridge...")]
info!("Starting MagicTunnel v0.2.48");Configuration templates use placeholders that get replaced by the build script:
# config.yaml.template
mcp_client:
protocol_version: "2025-03-26"
client_name: "magictunnel" # Updated by build script
client_version: "0.2.48" # Updated by build scriptWhen releasing a new version:
-
Update Cargo.toml version:
# Edit Cargo.toml manually or use: make set-version VERSION=0.3.0 -
Verify all files are updated:
make check-version
-
Update CHANGELOG.md manually (this is not automated)
-
Commit and tag:
git add . git commit -m "Release v0.3.0" git tag v0.3.0
- ✅
test-resources/info.json - ✅
config.yaml.template - ✅
magictunnel-config.yaml - ✅
README.md - ✅
CLAUDE.md - ✅
test-resources/documentation.md - ✅ Source code CLI descriptions (via env! macros)
- ❌
CHANGELOG.md- Requires manual content updates - ❌ Git tags - Must be created manually
- ❌ Release notes - Must be written manually
# Check what's inconsistent
make check-version
# Fix inconsistencies
make update-versionThe build script runs automatically during cargo build. If changes aren't applied:
# Force rebuild
cargo clean
cargo buildIf you need to manually update a specific file:
# Use the version manager for specific operations
cargo run --bin version-manager -- updateThis centralized approach ensures version consistency across the entire codebase while minimizing manual maintenance overhead.