use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use std::path::PathBuf;
use crate::errors::diagnostic::Diagnostic;
mod builder;
mod policy_helpers;
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
#[serde(rename_all = "lowercase")]
pub enum RiskLevel {
Low,
Medium,
High,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedAction {
pub id: String,
pub title: String,
pub risk: RiskLevel,
pub command: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SuggestedPatch {
pub id: String,
pub title: String,
pub risk: RiskLevel,
pub file: String, pub ops: Vec<JsonPatchOp>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "op", rename_all = "lowercase")]
pub enum JsonPatchOp {
Add { path: String, value: JsonValue },
Remove { path: String },
Replace { path: String, value: JsonValue },
Move { from: String, path: String },
}
pub struct AgenticCtx {
pub policy_path: Option<PathBuf>,
pub config_path: Option<PathBuf>,
}
pub fn build_suggestions(
diags: &[Diagnostic],
ctx: &AgenticCtx,
) -> (Vec<SuggestedAction>, Vec<SuggestedPatch>) {
builder::build_suggestions_impl(diags, ctx)
}
#[cfg(test)]
mod tests;