spec_driven_docs/commands/
upgrade.rs1use crate::cli::upgrade::UpgradeArgs;
8use crate::context::AppContext;
9use crate::error::AppError;
10use crate::output;
11use crate::services::upgrader::{UpgradeOptions, upgrade};
12
13pub fn run(ctx: &AppContext, args: UpgradeArgs) -> Result<(), AppError> {
20 let target = if args.target.is_absolute() {
21 args.target
22 } else if args.target == "." {
23 ctx.cwd.clone()
24 } else {
25 return Err(AppError::Usage("target must be absolute or .".to_string()));
26 };
27 crate::commands::front::serves(crate::landing::classify::Intent::Upgrade, &target)?;
28 let outcome = upgrade(&UpgradeOptions {
29 target,
30 dry_run: args.dry_run,
31 })?;
32 for line in &outcome.lines {
33 output::line(line);
34 }
35 if outcome.failures > 0 {
36 return Err(AppError::Violations {
37 count: outcome.failures,
38 });
39 }
40 Ok(())
41}