arcature-cli 2026.1.0

Developer lifecycle CLI for Arcature applications.
Documentation
use std::path::PathBuf;

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub(crate) enum FrontendArg {
    React,
    Vue,
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub(crate) enum OutputFormat {
    Human,
    Json,
}

#[derive(Debug, Clone, Eq, PartialEq)]
pub(crate) struct NewOptions {
    pub(crate) destination: PathBuf,
    pub(crate) frontend: FrontendArg,
    /// When true, generate a project without the database subsystem (no
    /// `arcature-db` dependency, no `migration/` package, no `AppState`).
    pub(crate) no_db: bool,
}

/// The `arc db` subcommand family (Phase 4 spec §14).
///
/// `arc db` orchestrates lifecycle and delegates migration semantics to the
/// application-owned SeaORM migrator. Destructive commands (`fresh`/`reset`/
/// `refresh`) require `--force` — the flag IS the explicit confirmation
/// (Phase 4 spec §23: no interactive prompt, no hostname heuristic).
#[derive(Debug, Clone, Eq, PartialEq)]
pub(crate) enum DbCommand {
    /// Apply pending migrations (`migrate` → SeaORM `up`).
    Migrate,
    /// Roll back applied migrations (`rollback` → SeaORM `down`). Optional
    /// step count.
    Rollback { steps: Option<u32> },
    /// Show migration status.
    Status,
    /// Drop all tables and reapply all migrations. Destructive — requires
    /// `--force`.
    Fresh { force: bool },
    /// Roll back all migrations. Destructive — requires `--force`.
    Reset { force: bool },
    /// Roll back all, then reapply all. Destructive — requires `--force`.
    Refresh { force: bool },
    /// Generate SQLx offline metadata (`cargo sqlx prepare --workspace`).
    Prepare,
    /// Check SQLx offline metadata is current (`cargo sqlx prepare --check`).
    PrepareCheck,
}

/// The `arc make` subcommand (A13 spec). Generates source files for the
/// given kind. `--module` scopes the generator to a module directory.
#[derive(Debug, Clone, Eq, PartialEq)]
pub(crate) struct MakeOptions {
    pub(crate) kind: String,
    pub(crate) name: String,
    pub(crate) module: Option<String>,
}

#[derive(Debug, Clone, Eq, PartialEq)]
pub(crate) enum CliCommand {
    New(NewOptions),
    Dev,
    Build,
    Check(OutputFormat),
    Doctor(OutputFormat),
    Exposure(OutputFormat),
    Routes(OutputFormat),
    Modules(OutputFormat),
    Services(OutputFormat),
    Schedule(OutputFormat),
    Run {
        name: String,
        arguments: Vec<String>,
    },
    Make(MakeOptions),
    Script {
        name: String,
        arguments: Vec<String>,
    },
    Db(DbCommand),
}