1pub mod dependency;
39pub mod graph;
40pub mod resolver;
41pub mod types;
42pub mod version;
43
44pub use graph::{
46 DependencyGraph, DependencyNode, GraphStats, NodeState, ResolutionResult, VersionConflict,
47};
48pub use resolver::{DependencyResolver, ResolutionOptions};
49pub use types::{DependencySpec, DependencyType, ToolSpec, VersionConstraint};
50pub use version::{Version, VersionMatcher, VersionRange};
51
52pub type Result<T> = std::result::Result<T, Error>;
54
55#[derive(thiserror::Error, Debug)]
57pub enum Error {
58 #[error("Tool '{tool}' not found")]
59 ToolNotFound { tool: String },
60
61 #[error("Circular dependency detected: {cycle:?}")]
62 CircularDependency { cycle: Vec<String> },
63
64 #[error("Version conflict for tool '{tool}': required {required}, found {found}")]
65 VersionConflict {
66 tool: String,
67 required: String,
68 found: String,
69 },
70
71 #[error("Dependency resolution failed: {message}")]
72 ResolutionFailed { message: String },
73
74 #[error("Invalid version constraint: {constraint}")]
75 InvalidVersionConstraint { constraint: String },
76
77 #[error("Tool '{tool}' has unresolvable dependencies: {dependencies:?}")]
78 UnresolvableDependencies {
79 tool: String,
80 dependencies: Vec<String>,
81 },
82
83 #[error("IO error: {0}")]
84 Io(#[from] std::io::Error),
85
86 #[error("Serialization error: {0}")]
87 Serialization(#[from] serde_json::Error),
88
89 #[error("Other error: {0}")]
90 Other(#[from] anyhow::Error),
91}
92
93pub const VERSION: &str = env!("CARGO_PKG_VERSION");
95
96#[cfg(test)]
97mod tests {
98 use super::*;
99
100 #[test]
101 fn test_version_info() {
102 assert!(!VERSION.is_empty());
103 }
104}