Skip to main content

cuenv_core/tools/
mod.rs

1//! Tool provider system for fetching development tools.
2//!
3//! This module provides a pluggable system for fetching development tools from
4//! various sources (GitHub, OCI, Nix). Each source is implemented
5//! as a `ToolProvider` that can resolve and fetch tools.
6//!
7//! # Architecture
8//!
9//! The tool system consists of:
10//!
11//! - [`ToolProvider`] - Trait implemented by each source (GitHub, Nix, etc.)
12//! - [`ToolRegistry`] - Collection of registered providers
13//! - [`Platform`], [`Os`], [`Arch`] - Platform identification types
14//! - [`ToolSource`] - Source-specific resolution data
15//! - [`ResolvedTool`] - A fully resolved tool ready to fetch
16//! - [`FetchedTool`] - Result of fetching a tool
17//!
18//! # Example
19//!
20//! ```ignore
21//! use cuenv_core::tools::{ToolRegistry, Platform, ToolOptions};
22//!
23//! // Create registry with providers
24//! let mut registry = ToolRegistry::new();
25//! registry.register(GitHubToolProvider::new());
26//! registry.register(NixToolProvider::new());
27//!
28//! // Resolve and fetch a tool
29//! let provider = registry.get("github").unwrap();
30//! let resolved = provider.resolve(&ToolResolveRequest {
31//!     tool_name: "jq",
32//!     version: "1.7.1",
33//!     platform: &Platform::current(),
34//!     config: &config,
35//!     token: None,
36//! }).await?;
37//! let fetched = provider.fetch(&resolved, &ToolOptions::default()).await?;
38//! ```
39
40mod provider;
41mod registry;
42
43pub use provider::{
44    Arch, FetchedTool, Os, Platform, ResolvedTool, ToolOptions, ToolProvider, ToolResolveRequest,
45    ToolSource, default_cache_dir,
46};
47pub use registry::ToolRegistry;