โ๏ธ vx-config
Advanced Configuration Management for the vx Universal Tool Manager
Intelligent, layered configuration system with automatic project detection
๐ฏ Overview
vx-config provides the comprehensive configuration management system for vx, enabling intelligent tool version management, automatic project detection, and layered configuration from multiple sources. It's designed to work seamlessly with zero configuration while offering powerful customization when needed.
โจ Features
๐๏ธ Layered Configuration System
- Built-in Defaults: Sensible defaults that work out of the box
- User Configuration: Global user preferences and tool versions
- Project Configuration: Project-specific tool requirements
- Environment Variables: Runtime configuration overrides
- Priority Resolution: Intelligent merging with proper precedence
๐ Intelligent Project Detection
- Automatic Detection: Recognizes Python, Rust, Node.js, and Go projects
- Multi-Language Support: Handles polyglot projects with multiple ecosystems
- Configuration Inference: Automatically suggests tool versions based on project files
- Lock File Analysis: Reads package-lock.json, Cargo.lock, poetry.lock, etc.
๐ Multiple Format Support
- TOML: Primary configuration format (
.vx.toml) - JSON: Alternative format support
- Environment Variables:
VX_*prefixed variables - Legacy Support: Reads existing tool configuration files
๐ฏ Smart Tool Management
- Version Constraints: Semantic version ranges and constraints
- Tool Dependencies: Automatic dependency resolution
- Conflict Detection: Identifies and resolves version conflicts
- Inheritance: Project configs inherit from user configs
๐ Quick Start
Basic Usage
use ConfigManager;
async
Configuration Files
Global Configuration (~/.config/vx/config.toml)
[]
= true
= true
= "24h"
[]
= "20.11.0"
= "0.5.26"
= "1.21.6"
[]
= "7d"
= 4
= false
[]
= true
= true
= "default"
Project Configuration (.vx.toml)
[]
= "18.17.0" # Specific version
= "latest" # Latest version
= "^1.21.0" # Version constraint
[]
= true
= "7d"
[]
= "npm run dev"
= "npm run build"
= "npm test"
= "uvx ruff check ."
[]
= "my-awesome-project"
= ["node", "python"]
๐ก Advanced Usage
Project Detection
use ;
let config_manager = new.await?;
// Detect project types in current directory
let project_types = config_manager.detect_project_types.await?;
for project_type in project_types
// Get recommended tool versions for detected projects
let recommendations = config_manager.get_tool_recommendations.await?;
println!;
Custom Configuration Sources
use ;
let config_manager = builder
.add_source
.add_source
.build
.await?;
Version Constraint Resolution
use ;
// Parse version constraints
let constraint = parse?;
let resolver = new;
// Find best matching version
let available_versions = vec!;
let best_match = resolver.resolve?;
println!;
๐๏ธ Architecture
Configuration Hierarchy
Environment Variables (highest priority)
โ
Project Configuration (.vx.toml)
โ
User Configuration (~/.config/vx/config.toml)
โ
Built-in Defaults (lowest priority)
Core Components
- ConfigManager: Main interface for configuration operations
- ProjectDetector: Automatic project type detection
- VersionResolver: Semantic version constraint resolution
- ConfigParser: Multi-format configuration parsing
- SourceMerger: Intelligent configuration merging
Project Detection Logic
1. Check for language-specific files:
- package.json (Node.js)
- pyproject.toml, requirements.txt (Python)
- Cargo.toml (Rust)
- go.mod (Go)
2. Analyze lock files for version hints:
- package-lock.json, yarn.lock
- poetry.lock, Pipfile.lock
- Cargo.lock
- go.sum
3. Read existing tool configurations:
- .nvmrc, .node-version
- .python-version, .tool-versions
- rust-toolchain.toml
๐ง Configuration Reference
Tool Configuration
[]
# Exact version
= "18.17.0"
# Version constraint
= "^1.21.0" # >= 1.21.0, < 1.22.0
= "~0.5.26" # >= 0.5.26, < 0.6.0
# Special values
= "latest" # Latest stable version
= "system" # Use system installation
Settings Configuration
[]
= true # Auto-install missing tools
= true # Check for tool updates
= "24h" # Update check frequency
= "7d" # Cache duration
= 4 # Concurrent downloads
= false # Use system PATH
UI Configuration
[]
= true # Show progress bars
= true # Use colored output
= "default" # Progress bar style
= "info" # Logging level
๐งช Testing
# Run all tests
# Run with specific features
# Run integration tests
# Test configuration parsing
๐ Related Crates
vx-installer- Universal installation enginevx-core- Core functionality and utilitiesvx-cli- Command-line interfacevx-plugin- Plugin system and trait definitions
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
Intelligent configuration for the modern developer