syncable_cli/analyzer/tool_management/installers/
rust.rs1use crate::analyzer::tool_management::ToolDetector;
2use crate::error::{AnalysisError, IaCGeneratorError, Result};
3use super::common::InstallationUtils;
4use std::collections::HashMap;
5use log::info;
6
7pub fn install_cargo_audit(
9 tool_detector: &mut ToolDetector,
10 installed_tools: &mut HashMap<String, bool>,
11) -> Result<()> {
12 if tool_detector.detect_tool("cargo-audit").available {
13 return Ok(());
14 }
15
16 info!("🔧 Installing cargo-audit for Rust vulnerability scanning...");
17
18 let success = InstallationUtils::execute_command("cargo", &["install", "cargo-audit"])?;
19
20 if success {
21 info!("✅ cargo-audit installed successfully");
22 installed_tools.insert("cargo-audit".to_string(), true);
23 tool_detector.clear_cache(); } else {
25 return Err(IaCGeneratorError::Analysis(AnalysisError::DependencyParsing {
26 file: "cargo-audit installation".to_string(),
27 reason: "Installation failed".to_string(),
28 }));
29 }
30
31 Ok(())
32}