use std::sync::Arc; use compliance_core::models::Finding; use crate::error::AgentError; use crate::llm::LlmClient; const FIX_SYSTEM_PROMPT: &str = r#"You are a security engineer. Given a security finding with code context, suggest a concrete code fix. Return ONLY the fixed code snippet that can directly replace the vulnerable code. Include brief inline comments explaining the fix."#; pub async fn suggest_fix(llm: &Arc, finding: &Finding) -> Result { let user_prompt = format!( "Suggest a fix for this vulnerability:\n\ Language context from file: {}\n\ Rule: {}\n\ Description: {}\n\ Vulnerable code:\n```\n{}\n```", finding.file_path.as_deref().unwrap_or("unknown"), finding.rule_id.as_deref().unwrap_or("N/A"), finding.description, finding.code_snippet.as_deref().unwrap_or("N/A"), ); llm.chat(FIX_SYSTEM_PROMPT, &user_prompt, Some(0.2)).await }