Skip to main content

agent_policy/
cli.rs

1//! Command-line interface definition.
2
3use clap::{Parser, Subcommand};
4
5/// Schema-first generator for coding-agent repo policies.
6#[derive(Parser)]
7#[command(
8    name = "agent-policy",
9    version,
10    about = "Schema-first generator for coding-agent repo policies.",
11    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."
12)]
13pub struct Cli {
14    #[command(subcommand)]
15    pub command: Command,
16}
17
18/// Agent-policy subcommands.
19#[derive(Subcommand)]
20pub enum Command {
21    /// Write a starter agent-policy.yaml to the current directory.
22    Init {
23        /// Overwrite existing agent-policy.yaml if present.
24        #[arg(long)]
25        force: bool,
26    },
27
28    /// Generate all enabled output files from agent-policy.yaml.
29    Generate {
30        /// Path to agent-policy.yaml.
31        #[arg(long, short, default_value = "agent-policy.yaml")]
32        config: camino::Utf8PathBuf,
33    },
34
35    /// Check that committed generated files match the current policy.
36    ///
37    /// Exits non-zero if any generated file is stale or missing.
38    Check {
39        /// Path to agent-policy.yaml.
40        #[arg(long, short, default_value = "agent-policy.yaml")]
41        config: camino::Utf8PathBuf,
42    },
43}