vx-paths
Cross-platform path management for vx tool installations.
Overview
vx-paths provides a unified interface for managing tool installation paths across different platforms, ensuring consistent directory structures and proper handling of executable file extensions.
Features
- Standardized Path Structure: Enforces
~/.vx/tools/<tool>/<version>/<tool>.exestructure - Cross-Platform Support: Handles executable extensions (.exe on Windows, none on Unix)
- Configuration Integration: Supports custom paths via environment variables and configuration
- Tool Discovery: Find installed tools and their versions
- Path Resolution: Resolve tool paths with version preferences
Standard Directory Structure
~/.vx/
├── tools/ # Tool installations
│ ├── node/
│ │ ├── 18.17.0/
│ │ │ └── node.exe # Windows
│ │ │ └── node # Unix
│ │ └── 20.0.0/
│ │ └── node.exe
│ └── uv/
│ └── 0.1.0/
│ └── uv.exe
├── cache/ # Download cache
├── config/ # Configuration files
└── tmp/ # Temporary files
Usage
Basic Path Management
use PathManager;
// Create path manager with default locations
let manager = new?;
// Get tool executable path
let node_path = manager.tool_executable_path;
// Returns: ~/.vx/tools/node/18.17.0/node.exe (Windows)
// ~/.vx/tools/node/18.17.0/node (Unix)
// Check if tool is installed
let is_installed = manager.is_tool_version_installed;
// List all versions of a tool
let versions = manager.list_tool_versions?;
// Get latest version
let latest = manager.get_latest_tool_version?;
Tool Discovery
use ;
let manager = new?;
let resolver = new;
// Find all executables for a tool
let executables = resolver.find_tool_executables?;
// Find latest executable
let latest_exe = resolver.find_latest_executable?;
// Resolve with version preference
let exe_path = resolver.resolve_tool_path?;
Custom Configuration
use ;
// Create with custom base directory
let config = with_base_dir;
let manager = config.create_path_manager?;
// Load from environment variables
let config = from_env;
let manager = config.create_path_manager?;
Environment Variables
VX_BASE_DIR: Custom base directoryVX_TOOLS_DIR: Custom tools directoryVX_CACHE_DIR: Custom cache directoryVX_CONFIG_DIR: Custom config directoryVX_TMP_DIR: Custom temporary directory
Integration with vx-core
use PathManager;
use VxConfig;
// Integrate with vx configuration
let path_manager = new?;
let config = VxConfig ;
Testing
License
This project is licensed under the MIT License - see the LICENSE file for details.