spec_driven_docs/cli/init.rs
1//! `init` subcommand: parse-shape.
2//!
3//! Holds the clap derive struct only. No I/O, no business logic.
4
5use camino::Utf8PathBuf;
6
7use crate::domain::profile::ProfileId;
8
9/// Install the payload into a target repository.
10#[derive(Debug, clap::Args)]
11pub struct InitArgs {
12 /// The target repository; must be an absolute path. With `--stage`, it
13 /// defaults to the working directory and must be the stage's target.
14 #[arg(long, required_unless_present = "stage")]
15 pub target: Option<Utf8PathBuf>,
16
17 /// The profile to install.
18 #[arg(long, value_enum, required_unless_present = "stage")]
19 pub profile: Option<ProfileId>,
20
21 /// Land the choices a stage recorded: its profile, docs scratch,
22 /// writing style, reserved paths, and acquisition decision. The landing
23 /// still renders every byte from this binary; only the stage's receipt
24 /// is read, and a receipt another release wrote refuses.
25 #[arg(
26 long,
27 value_name = "ROOT",
28 conflicts_with_all = ["profile", "reserve", "docs_scratch", "writing_style"]
29 )]
30 pub stage: Option<Utf8PathBuf>,
31
32 /// Land beside a corpus that stays, on a target classified `migration`,
33 /// with no archive, and record each budget finding of the corpus as
34 /// debt. The operator names this scope: `sdd migrate` is the default
35 /// for such a target.
36 #[arg(long)]
37 pub incremental: bool,
38
39 /// Write into a non-empty target that has no instance yet.
40 #[arg(long, conflicts_with = "dry_run")]
41 pub apply: bool,
42
43 /// Preview only; write nothing.
44 #[arg(long)]
45 pub dry_run: bool,
46
47 /// A path no delivered gate judges, recorded under `reserved:` in the
48 /// instance's declaration. Repeatable.
49 ///
50 /// Use it for a region another tool owns. Omitted, a recorded value
51 /// stays.
52 #[arg(long, value_name = "PATH")]
53 pub reserve: Vec<String>,
54
55 /// Where material that is not a statement yet is kept, as a path that may
56 /// leave the repository, or `none` to clear a recorded value. Omitted,
57 /// the recorded value stays.
58 #[arg(long, value_name = "PATH")]
59 pub docs_scratch: Option<String>,
60
61 /// Where the writing style comes from: `builtin` routes authors to
62 /// `sdd method writing-style`, `project:<PATH>` routes them to the
63 /// project's own document, and `none` installs no route and imposes no
64 /// conversion obligation. Recorded in the instance's declaration,
65 /// unless the declaration already holds that selection; a missing key
66 /// holds `builtin`. Omitted, the recorded value stays.
67 #[arg(long, value_name = "SELECTION")]
68 pub writing_style: Option<String>,
69}