vx_plugin/
lib.rs

1//! # vx-plugin
2//!
3//! Plugin system for vx - Universal Development Tool Manager
4//!
5//! This crate provides the core plugin architecture for vx, enabling developers to create
6//! custom tools and package managers that integrate seamlessly with the vx ecosystem.
7//!
8//! ## Features
9//!
10//! - **Tool Plugins**: Create custom tool implementations with automatic version management
11//! - **Package Manager Plugins**: Integrate custom package managers with unified interfaces
12//! - **Plugin Registry**: Discover and manage plugins dynamically
13//! - **Extensible Architecture**: Clean trait-based design for maximum flexibility
14//!
15//! ## Quick Start
16//!
17//! ### Creating a Simple Tool Plugin
18//!
19//! ```rust,no_run
20//! use vx_plugin::{VxTool, VersionInfo, Result};
21//! use async_trait::async_trait;
22//!
23//! struct MyTool;
24//!
25//! #[async_trait]
26//! impl VxTool for MyTool {
27//!     fn name(&self) -> &str {
28//!         "mytool"
29//!     }
30//!
31//!     async fn fetch_versions(&self, include_prerelease: bool) -> Result<Vec<VersionInfo>> {
32//!         // Implementation here
33//!         Ok(vec![])
34//!     }
35//! }
36//! ```
37//!
38//! ### Creating a Package Manager Plugin
39//!
40//! ```rust,no_run//! use vx_plugin::{VxPackageManager, Ecosystem, PackageSpec, Result};
41//! use async_trait::async_trait;
42//! use std::path::Path;
43//!
44//! struct MyPackageManager;
45//!
46//! #[async_trait]
47//! impl VxPackageManager for MyPackageManager {
48//!     fn name(&self) -> &str {
49//!         "mypm"
50//!     }
51//!
52//!     fn ecosystem(&self) -> Ecosystem {
53//!         Ecosystem::Node
54//!     }
55//!
56//!     async fn install_packages(&self, packages: &[PackageSpec], project_path: &Path) -> Result<()> {
57//!         // Implementation here
58//!         Ok(())
59//!     }
60//! }
61//! ```
62
63// Re-export core types and traits for convenience
64pub use package_manager::{StandardPackageManager, VxPackageManager};
65pub use plugin::{StandardPlugin, VxPlugin};
66pub use registry::{PluginRegistry, PluginRegistryBuilder, ToolRegistry};
67pub use tool::{ConfigurableTool, UrlBuilder, VersionParser, VxTool};
68pub use types::*;
69
70// Module declarations
71pub mod package_manager;
72pub mod plugin;
73pub mod registry;
74pub mod tool;
75pub mod types;
76
77// Utility modules
78pub mod utils;
79
80// Result type alias for convenience
81pub type Result<T> = anyhow::Result<T>;
82
83/// Plugin system version
84pub const VERSION: &str = env!("CARGO_PKG_VERSION");
85
86/// Plugin API version for compatibility checking
87pub const API_VERSION: &str = "0.2.0";