use crate::ci::CiGenerator;
use super::CiArgs;
use anyhow::{Context, Result};
use colored::*;
pub fn run(args: &CiArgs) -> Result<()> {
let generator = CiGenerator::new(&args.platform);
eprintln!("{}", "🔧 Forge Guard — CI/CD Generator".bold());
eprintln!(" Platform: {}", args.platform.bold());
let config = generator.generate(args.include_deploy)?;
let output_path = args.output.join(generator.filename());
std::fs::create_dir_all(&args.output)?;
if output_path.exists() && !args.overwrite {
anyhow::bail!(
"{} already exists. Use --overwrite to replace.",
output_path.display()
);
}
std::fs::write(&output_path, &config).context("Failed to write CI config")?;
eprintln!(
"{} CI config written to {}",
"✅".green(),
output_path.display()
);
println!("{}", config);
Ok(())
}