agent-policy 0.6.0

Schema-first generator for coding-agent repo policies and compatibility files.
Documentation
//! Command-line interface definition.

use clap::{Parser, Subcommand};

/// Schema-first generator for coding-agent repo policies.
#[derive(Parser)]
#[command(
    name = "agent-policy",
    version,
    about = "Schema-first generator for coding-agent repo policies.",
    long_about = "Generates AGENTS.md, CLAUDE.md, and .cursor/rules from a canonical agent-policy.yaml.\n\nSee https://github.com/CameronBrooks11/agent-policy for documentation."
)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Command,
}

/// Agent-policy subcommands.
#[derive(Subcommand)]
pub enum Command {
    /// Write a starter agent-policy.yaml to the current directory.
    Init {
        /// Overwrite existing agent-policy.yaml if present.
        #[arg(long)]
        force: bool,
    },

    /// Generate all enabled output files from agent-policy.yaml.
    Generate {
        /// Path to agent-policy.yaml.
        #[arg(long, short, default_value = "agent-policy.yaml")]
        config: camino::Utf8PathBuf,

        /// Specific targets to generate (overrides targets from the config file).
        #[arg(long, short, value_delimiter = ',')]
        targets: Option<Vec<String>>,
    },

    /// Check that committed generated files match the current policy.
    ///
    /// Exits non-zero if any generated file is stale or missing.
    Check {
        /// Path to agent-policy.yaml.
        #[arg(long, short, default_value = "agent-policy.yaml")]
        config: camino::Utf8PathBuf,

        /// Specific targets to check (overrides targets from the config file).
        #[arg(long, short, value_delimiter = ',')]
        targets: Option<Vec<String>>,
    },

    /// Analyze agent-policy.yaml for semantic errors and warnings.
    ///
    /// Exits non-zero if validation errors (e.g., path conflicts) are found.
    Lint {
        /// Path to agent-policy.yaml.
        #[arg(long, short, default_value = "agent-policy.yaml")]
        config: camino::Utf8PathBuf,
    },

    /// List all supported output targets and their output paths.
    #[command(name = "list-targets")]
    ListTargets,

    /// Install a git hook to automatically check agent-policy during commits.
    #[command(name = "install-hooks")]
    InstallHooks {
        /// Install as a pre-push hook instead of pre-commit
        #[arg(long)]
        pre_push: bool,
    },

    /// Import existing AGENTS.md or CLAUDE.md to scaffold a new agent-policy.yaml.
    Import,
}