vx_core/
lib.rs

1//! Core traits and interfaces for vx tool manager
2//!
3//! This crate provides a highly abstracted plugin system that makes it easy for developers
4//! to implement new tools and package managers with minimal boilerplate code.
5//!
6//! # Quick Start for Plugin Developers
7//!
8//! To create a new tool plugin, implement the `VxTool` trait:
9//!
10//! ```rust
11//! use vx_core::{VxTool, ToolContext, VersionInfo, Result};
12//!
13//! #[derive(Default)]
14//! struct MyTool;
15//!
16//! #[async_trait::async_trait]
17//! impl VxTool for MyTool {
18//!     fn name(&self) -> &str { "mytool" }
19//!
20//!     async fn fetch_versions(&self, _include_prerelease: bool) -> Result<Vec<VersionInfo>> {
21//!         // Fetch versions from your tool's API
22//!         Ok(vec![])
23//!     }
24//!
25//!     async fn install_version(&self, version: &str, force: bool) -> Result<()> {
26//!         // Download and install the tool
27//!         Ok(())
28//!     }
29//! }
30//! ```
31
32pub mod config;
33pub mod config_figment;
34pub mod error;
35pub mod install_configs;
36pub mod installer;
37pub mod package_manager;
38pub mod plugin; // Re-enabled for current system
39pub mod registry;
40pub mod tool;
41pub mod version; // Re-enabled for current system
42
43// Utility modules
44pub mod downloader;
45pub mod environment;
46pub mod http;
47pub mod platform;
48pub mod url_builder;
49pub mod venv;
50pub mod version_manager;
51pub mod version_parser;
52
53// Re-export main traits for convenience
54// Current plugin system (VxPlugin-based)
55pub use plugin::{
56    ConfigurableTool, StandardPlugin, ToolMetadata, UrlBuilder, VersionParser, VxPackageManager,
57    VxPlugin, VxTool,
58};
59// New plugin system (Plugin-based) - for future migration
60pub use config::{GlobalConfig, ToolConfig};
61pub use config_figment::{
62    ConfigStatus, DefaultConfig, FigmentConfigManager, ProjectInfo, ProjectType, VxConfig,
63};
64pub use error::{Result, VxError};
65pub use install_configs::{
66    get_install_config, get_manual_install_instructions, supports_auto_install,
67};
68pub use installer::{InstallConfig, InstallProgress, InstallStage};
69pub use package_manager::{Ecosystem, PackageInfo, PackageSpec};
70pub use registry::{PluginRegistry, ToolRegistry};
71pub use tool::{
72    AsyncTool, Configuration, Environment, Plugin, Tool, ToolContext, ToolExecutionResult,
73    ToolInfo, ToolStatus,
74};
75pub use version::VersionInfo; // Re-enabled for current system
76
77// Re-export utility modules
78pub use downloader::ToolDownloader;
79pub use environment::{EnvironmentConfig, ToolInstallation, VxEnvironment};
80pub use http::{get_http_client, HttpUtils};
81pub use platform::{Architecture, OperatingSystem, Platform};
82pub use url_builder::{
83    GenericUrlBuilder, GoUrlBuilder, NodeUrlBuilder, PythonUrlBuilder, RustUrlBuilder, UvUrlBuilder,
84};
85pub use venv::{VenvConfig, VenvManager};
86pub use version_manager::{Version, VersionManager};
87pub use version_parser::{
88    GitHubVersionParser, GoVersionParser, NodeVersionParser, VersionParserUtils,
89};