cargo-setupx 0.1.0

Rust-based CLI and library that automates the initial setup of new Rust projects with modular configuration packs
Documentation
//! # cargo-setupx
//!
//! A Rust-based CLI and library that automates the initial setup of new Rust projects.
//! Provides modular configuration packs that can be selectively applied to standardize
//! development environments.
//!
//! ## Features
//!
//! - **Quality Pack**: Generates code quality configuration files
//! - **Hooks Pack**: Sets up Git hooks for automated quality checks
//! - **Architecture Pack**: Scaffolds project structure based on patterns
//!
//! ## Usage as a Library
//!
//! ```no_run
//! use cargo_setupx::{Config, apply_packs};
//! use std::path::Path;
//!
//! let config = Config {
//!     quality: true,
//!     hooks: true,
//!     arch: Some("clean".to_string()),
//!     force: false,
//!     yes: false,
//! };
//!
//! apply_packs(&config, Path::new(".")).expect("Failed to apply packs");
//! ```

pub mod error;
pub mod packs;
pub mod templates;
pub mod utils;

use error::Result;
use std::path::Path;

/// Configuration for cargo-setupx
#[derive(Debug, Clone)]
pub struct Config {
    /// Enable quality pack (rustfmt.toml, clippy.toml, _typos.toml, Makefile)
    pub quality: bool,
    /// Enable hooks pack (.githooks)
    pub hooks: bool,
    /// Architecture pack name (e.g., "clean")
    pub arch: Option<String>,
    /// Force overwrite existing files
    pub force: bool,
    /// Skip confirmation prompts
    pub yes: bool,
}

/// Apply selected packs to the project
pub fn apply_packs(config: &Config, project_path: &Path) -> Result<()> {
    println!("🚀 Setting up project at: {}", project_path.display());
    println!();

    if config.quality {
        packs::quality::apply(project_path, config.force)?;
    }

    if config.hooks {
        packs::hooks::apply(project_path, config.force)?;
    }

    if let Some(arch_type) = &config.arch {
        packs::architecture::apply(project_path, arch_type, config.force)?;
    }

    println!();
    println!("✅ Setup complete!");
    Ok(())
}