maslc 1.0.1

Maduka Authorization Specification Language (MASL) toolchain and runtime
use std::path::PathBuf;

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(
    name = "maslc",
    about = "MASL compiler — Maduka Authorization Specification Language",
    version
)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Command,
}

#[derive(Subcommand)]
pub enum Command {
    /// Compile a .mdk file or directory to .mdkc binaries
    Build {
        /// Input .mdk file or directory
        path: PathBuf,

        /// Output path for file or directory [default: <path>.mdkc or in-place for dir]
        #[arg(short, long)]
        output: Option<PathBuf>,
    },

    /// Check a .mdk file or directory without emitting output
    Check {
        /// Input .mdk file or directory
        path: PathBuf,
    },

    /// Format a .mdk file in place
    Fmt {
        /// Input .mdk file or directory
        path: PathBuf,

        /// Check mode: exit 1 if file is not formatted (for CI)
        #[arg(long)]
        check: bool,

        /// Print diff without modifying files
        #[arg(long)]
        diff: bool,
    },

    /// Run the linter on a .mdk file
    Lint {
        /// Input .mdk file or directory
        path: PathBuf,

        /// Path to masl.toml config (optional)
        #[arg(long)]
        config: Option<PathBuf>,
    },

    /// Start the MASL language server (stdio transport)
    Lsp {
        /// Use TCP transport instead of stdio
        #[arg(long)]
        port: Option<u16>,
    },

    /// Print extended documentation for an error code
    Explain {
        /// Error code to explain (e.g. E0202)
        code: String,
    },

    /// Generate Markdown documentation for a .mdk file or directory
    Doc {
        /// Input .mdk file or directory
        path: PathBuf,

        /// Output directory for generated docs (defaults to ./docs)
        #[arg(short, long)]
        output: Option<PathBuf>,
    },
}