jfvm Wiki ‐ Comprehensive Guide - bhanurp/jfvm GitHub Wiki

jfvm Wiki - Comprehensive Guide

Table of Contents


Overview

jfvm (JFrog CLI Version Manager) is a powerful CLI tool designed to simplify the management of multiple JFrog CLI versions. Inspired by popular version managers like nvm, sdkman, and volta, jfvm provides:

  • 🔄 Version Management: Install, switch, and remove JFrog CLI versions
  • 🏷️ Aliasing: Create meaningful names for versions (e.g., prod, dev)
  • 🔗 Local Linking: Use custom-built JFrog CLI binaries
  • 📁 Project-specific Versions: Automatic version switching via .jfrog-version files
  • Performance Analysis: Benchmark commands across versions
  • 🔍 Version Comparison: Side-by-side command output comparison
  • 📊 Usage Analytics: Track command usage and patterns
  • 🎯 Shim Integration: Transparent command redirection

Key Features Added in v0.0.2

  • Command Comparison: Compare outputs between versions with git-like diffs
  • Performance Benchmarking: Statistical analysis across multiple versions
  • Usage History: Comprehensive tracking with analytics
  • Enhanced Shim: Automatic timing and history recording
  • Rich Terminal Output: Colored output with multiple formats

Installation

Method 1: Homebrew (Recommended)

# Add the tap
brew tap bhanurp/jfvm

# Install jfvm
brew install jfvm

Method 2: One-liner Installation

brew install https://raw.githubusercontent.com/bhanureddy/homebrew-jfvm/main/jfvm.rb

Method 3: Build from Source

# Clone the repository
git clone https://github.com/bhanurp/jfvm.git
cd jfvm

# Build and install
make install

Post-installation Setup

Add jfvm's shim to your PATH by adding this to your shell profile (.zshrc, .bashrc, etc.):

export PATH="$HOME/.jfvm/shim:$PATH"

Reload your shell or run:

source ~/.zshrc  # or your shell's config file

Core Commands

Version Management

jfvm install <version>

Install a specific version of JFrog CLI from JFrog's release server.

# Install specific version
jfvm install 2.74.0

# Install latest version
jfvm install latest

jfvm use <version|alias>

Switch to a specific version or alias. Supports project-specific versions via .jfrog-version files.

# Use specific version
jfvm use 2.74.0

# Use alias
jfvm use prod

# Use version from .jfrog-version file
jfvm use

jfvm list

Display all installed versions with the currently active version highlighted.

jfvm list

**📹 Video: Installing JFrog CLI Versions, listing installed Versions and switching Between Versions **

jfvm-demo-01.mov

jfvm remove <version>

Remove a specific version from your system.

# Remove specific version
jfvm remove 2.72.1

# Remove linked version
jfvm remove local-dev

jfvm clear

Remove all installed versions (irreversible action).

jfvm clear

Aliasing and Linking

jfvm alias <name> <version>

Create meaningful aliases for versions.

# Create development alias
jfvm alias dev 2.74.0

# Create production alias  
jfvm alias prod 2.73.0

# Create staging alias
jfvm alias staging latest

📹 Video: Creating and Using Aliases

jfvm.alias.mov

jfvm link --from <path> --name <name>

Link locally built JFrog CLI binaries for development and testing.

# Link local binary
jfvm link --from /Users/dev/go/bin/jf --name local-dev

# Link relative path binary
jfvm link --from ./jf --name custom-build

# Use linked version
jfvm use local-dev

📹 Video: Linking Local Binaries [Video showing how to link and use custom-built JFrog CLI binaries]


Advanced Features

Version Comparison

jfvm compare <version1> <version2> -- <command>

Compare command outputs between two versions with sophisticated diff visualization.

# Compare version information
jfvm compare 2.74.0 2.73.0 -- --version

# Compare configuration outputs
jfvm compare prod dev -- config show

# Compare with unified diff format
jfvm compare 2.74.0 2.73.0 -- config show --unified

# Disable colors and timing for automation
jfvm compare old new -- rt search "*.jar" --no-color --timing=false

Features:

  • ⚡ Parallel execution for speed
  • 🎨 Colored diff output (side-by-side and unified)
  • ⏱️ Execution timing comparison
  • 🚦 Exit code and error output comparison
  • 📊 Statistical summary

📹 Video: Comparing Version Outputs [Video demonstrating various comparison modes, diff formats, and real-world scenarios]

jfvm-compare

Performance Benchmarking

jfvm benchmark <versions> -- <command>

Comprehensive performance analysis across multiple versions with statistical insights.

# Basic benchmark across versions
jfvm benchmark 2.74.0,2.73.0,2.72.0 -- --version

# Custom iterations with detailed output
jfvm benchmark prod,dev,latest -- rt ping --iterations 10 --detailed

# Export results in different formats
jfvm benchmark 2.74.0,2.73.0 -- config show --format json
jfvm benchmark 2.74.0,2.73.0 -- rt search "*.jar" --format csv

Advanced Options:

  • --iterations N: Number of runs per version (default: 3)
  • --detailed: Show detailed execution logs
  • --format json|csv|table: Output format
  • --timeout 30s: Custom timeout per execution

Metrics Provided:

  • 📈 Min/Max/Average execution times
  • 📊 Success rate percentage
  • 🏆 Performance ranking
  • 📉 Speed comparison ratios
  • 📋 Statistical summary

📹 Video: Performance Benchmarking [Video showing benchmark setup, execution, and analysis of results]

Usage Analytics

jfvm history

Track and analyze JFrog CLI usage patterns with comprehensive statistics.

# Show recent usage history
jfvm history

# Show detailed statistics
jfvm history --stats

# Filter by specific version
jfvm history --version 2.74.0

# Limit number of entries
jfvm history --limit 20

# Export as JSON
jfvm history --format json

# Show command outputs (added in unreleased version)
jfvm history --show-output

# Clear history (cannot be undone)
jfvm history --clear

Analytics Features:

  • 📊 Command execution frequency
  • ⏱️ Execution timing analysis
  • 📈 Version usage trends
  • 🎯 Most used commands
  • 📋 Success/failure rates
  • 💾 Command output capture (upcoming)

📹 Video: Usage Analytics and History [Video demonstrating history tracking, statistics, and usage insights]


Video Tutorials

Getting Started Series

📹 Part 1: Installation and Basic Setup [10-minute video covering installation, PATH setup, and first version installation]

📹 Part 2: Core Version Management [15-minute video demonstrating install, use, list, remove commands with real examples]

📹 Part 3: Project Workflows with Aliases [12-minute video showing project-specific versions, alias creation, and team workflows]

Advanced Features Series

📹 Part 4: Version Comparison Deep Dive [20-minute video exploring all comparison features, diff formats, and automation scenarios]

📹 Part 5: Performance Benchmarking Guide [18-minute video covering benchmark setup, analysis, and CI/CD integration]

📹 Part 6: Usage Analytics and History [15-minute video showing analytics features, insights, and optimization techniques]

Real-world Scenarios

📹 Scenario 1: CI/CD Pipeline Integration [25-minute video showing jfvm in automated testing and deployment pipelines]

📹 Scenario 2: Team Development Workflows [20-minute video demonstrating multi-developer scenarios and best practices]

📹 Scenario 3: Performance Regression Testing [30-minute video covering systematic performance testing across JFrog CLI versions]


Configuration

Environment Variables

JFVM_DEBUG

Enable detailed debug output for troubleshooting.

export JFVM_DEBUG=1
jf --version  # Will show detailed execution info

JFVM_HOME

Override the default jfvm installation directory (default: ~/.jfvm).

export JFVM_HOME=/custom/path

Configuration Files

.jfrog-version

Project-specific version specification.

# Create project version file
echo "2.74.0" > .jfrog-version

# jfvm will automatically use this version in this directory
jfvm use

History Configuration

History is automatically stored in ~/.jfvm/history.json with:

  • Maximum 1000 entries (auto-rotation)
  • Command timing and metadata
  • Output capture (upcoming feature)

Use Cases

Development Teams

Version Testing Workflow

# Install test versions
jfvm install 2.74.0
jfvm install 2.73.0

# Create aliases for clarity
jfvm alias current 2.74.0
jfvm alias previous 2.73.0

# Compare behavior
jfvm compare current previous -- config show

# Performance testing
jfvm benchmark current,previous -- rt ping --iterations 5

Project Standardization

# Set project version
echo "2.74.0" > .jfrog-version

# Team members automatically use correct version
jfvm use  # Reads from .jfrog-version

DevOps Engineers

CI/CD Integration

# Performance regression testing in CI
jfvm benchmark $BASELINE_VERSION,$NEW_VERSION -- rt ping --format json > results.json

# Automated compatibility testing
jfvm compare stable canary -- rt search "*.jar" --no-color --unified > diff.txt

Migration Planning

# Analyze current usage
jfvm history --stats

# Test migration compatibility
jfvm compare current target -- config show
jfvm benchmark current,target -- rt upload test.txt repo/

Enterprise Environments

Compliance and Monitoring

# Track version usage across teams
jfvm history --format json | jq '.[] | select(.version == "2.74.0")'

# Performance baseline establishment
jfvm benchmark approved-versions -- rt ping --iterations 10 --format csv

Troubleshooting

Common Issues

Installation Problems

Issue: jfvm command not found after installation

# Solution: Check PATH configuration
echo $PATH | grep -q ".jfvm" && echo "jfvm in PATH" || echo "Add jfvm to PATH"

# Add to shell profile
echo 'export PATH="$HOME/.jfvm/shim:$PATH"' >> ~/.zshrc
source ~/.zshrc

Issue: Permission denied when installing versions

# Solution: Check directory permissions
ls -la ~/.jfvm/
chmod 755 ~/.jfvm/

Version Management Issues

Issue: Version not switching properly

# Enable debug mode to diagnose
export JFVM_DEBUG=1
jfvm use 2.74.0
jf --version

Issue: .jfrog-version file not being respected

# Check file contents and current directory
cat .jfrog-version
pwd
jfvm use  # Should read from .jfrog-version

Performance Issues

Issue: Slow benchmark execution

# Reduce iterations for faster results
jfvm benchmark 2.74.0,2.73.0 -- --version --iterations 1

# Use timeout for hanging commands
jfvm benchmark versions -- command --timeout 10s

Debug Mode

Enable comprehensive debugging:

export JFVM_DEBUG=1

This will show:

  • Version resolution process
  • Command execution details
  • File system operations
  • Timing information

Log Files

Check jfvm logs for issues:

# History and usage logs
cat ~/.jfvm/history.json

# Installation logs (if any issues)
ls -la ~/.jfvm/versions/

Contributing

Development Setup

# Clone the repository
git clone https://github.com/bhanurp/jfvm.git
cd jfvm

# Install dependencies
go mod download

# Build for development
make build

# Run tests
make test

# Install locally
make install

Code Structure

jfvm/
├── cmd/                    # Command implementations
│   ├── install.go         # Version installation
│   ├── use.go            # Version switching
│   ├── compare.go        # Version comparison
│   ├── benchmark.go      # Performance testing
│   ├── history.go        # Usage analytics
│   └── descriptions/     # Help text and examples
├── internal/             # Internal packages
│   └── downloader.go    # Download utilities
├── shim/                # JFrog CLI shim
│   └── main.go         # Shim implementation
└── main.go             # Entry point

Adding New Features

  1. Command Implementation: Add new command in cmd/
  2. Help Text: Update cmd/descriptions/descriptions.go
  3. Main Registration: Register command in main.go
  4. Testing: Add comprehensive tests
  5. Documentation: Update README and wiki

Testing Guidelines

# Unit tests
go test ./...

# Integration tests
make test-integration

# Manual testing with different versions
jfvm install 2.74.0
jfvm install 2.73.0
# Test all commands

Submitting Changes

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Update documentation
  5. Submit a pull request

Resources

Release Information


This wiki is maintained by the jfvm community. For questions or improvements, please open an issue or submit a pull request.

⚠️ **GitHub.com Fallback** ⚠️