Skip to main content

spec_driven_docs/cli/
policy.rs

1//! `policy` subcommand: parse-shape.
2//!
3//! Holds the clap derive structs only. No I/O, no business logic.
4
5use camino::Utf8PathBuf;
6
7/// Bring an adopted specification into agreement with what the project
8/// declared, on request and never on upgrade.
9#[derive(Debug, clap::Args)]
10pub struct PolicyArgs {
11    /// The verb.
12    #[command(subcommand)]
13    pub verb: PolicyVerb,
14}
15
16/// The one verb, previewing by default.
17#[derive(Debug, clap::Subcommand)]
18pub enum PolicyVerb {
19    /// Add the rule that authorizes an active declaration to the adopted
20    /// specification that owns it, where the local specifications lack it.
21    Reconcile(ReconcileArgs),
22}
23
24/// What the verb takes.
25#[derive(Debug, clap::Args)]
26pub struct ReconcileArgs {
27    /// The instance to act on; absolute, or the working directory.
28    #[arg(long, default_value = ".")]
29    pub target: Utf8PathBuf,
30
31    /// Write the change. Without it the verb prints every file, the rule
32    /// it would add, and the exact text, and changes nothing.
33    #[arg(long)]
34    pub apply: bool,
35}