From 191e2b7429ff4547b5fdd0fbfcff943ce96c2d68 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 12 Aug 2026 00:03:21 +0000 Subject: Add explicit image builder CLI commands --- src/cli.rs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/cli.rs (limited to 'src/cli.rs') diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..de9404a --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,58 @@ +use std::path::PathBuf; + +use anyhow::{bail, Result}; +use clap::{Parser, Subcommand}; + +use crate::{BuildPlan, ImageSpec}; + +#[derive(Debug, Parser)] +#[command(name = "alt-controller-image", about = "Native ALT image builder")] +pub struct Cli { + #[command(subcommand)] + pub command: Command, +} + +#[derive(Debug, Subcommand)] +pub enum Command { + /// Validate an image specification and render its build intent. + Plan { + #[arg(long)] + spec: PathBuf, + }, + /// Build an image from a specification. + Build { + #[arg(long)] + spec: PathBuf, + #[arg(long)] + workspace: PathBuf, + #[arg(long)] + output: PathBuf, + }, + /// Inspect a built artifact. + Inspect { + #[arg(long)] + artifact: PathBuf, + }, + /// Compare two built artifacts semantically. + Compare { + #[arg(long)] + left: PathBuf, + #[arg(long)] + right: PathBuf, + }, +} + +pub fn run(cli: Cli) -> Result<()> { + match cli.command { + Command::Plan { spec } => { + let plan = BuildPlan::compile(ImageSpec::load(&spec)?)?; + println!("target: {}", plan.spec().target.name); + println!("architecture: {}", plan.spec().target.architecture.as_str()); + println!("format: tar"); + Ok(()) + } + Command::Build { .. } => bail!("build execution is not available yet"), + Command::Inspect { .. } => bail!("artifact inspection is not available yet"), + Command::Compare { .. } => bail!("artifact comparison is not available yet"), + } +} -- cgit v1.2.3