release_kit/cli/adopt.rs
1//! Arguments for `rk adopt`.
2
3use camino::Utf8PathBuf;
4use clap::Args;
5
6use super::profile_flags::ProfileFlags;
7
8/// Write the landing record for a repository that already runs the
9/// convention, landed before the record existed.
10///
11/// Strict: every rendered file must match what this binary would
12/// render, and no target file is ever changed.
13#[derive(Debug, Clone, Args)]
14#[expect(
15 clippy::struct_excessive_bools,
16 reason = "each field is one clap flag, and an opt-in capability's flag is a boolean by design; a state machine would hide the command line this struct describes"
17)]
18pub struct AdoptArgs {
19 /// The repository to adopt.
20 #[arg(long, default_value = ".")]
21 pub target: Utf8PathBuf,
22
23 /// The project profile and the Git workflow the candidate is rendered
24 /// under. The checkout mode chooses which candidate adoption verifies
25 /// against and never blesses the disk; its default is main-worktree,
26 /// the compatibility-safe reading of a pre-record target. An automatic
27 /// release requires the style from the config or the flag: the style
28 /// changes the bytes, so neither value is a safe guess.
29 #[command(flatten)]
30 pub profile: ProfileFlags,
31
32 /// The target runs the Nix capability: the candidate includes its
33 /// files, and the record carries the request. A target whose flake
34 /// pair is its own is verified without the pair, exactly as a landing
35 /// would have withheld it.
36 #[arg(long, alias = "nix")]
37 pub nix_packaging: bool,
38
39 /// The target carries the landed reporting policy.
40 #[arg(long)]
41 pub reporting_policy: bool,
42
43 /// The target runs the Scorecard capability: the candidate includes its
44 /// workflow, and the record carries the request.
45 #[arg(long)]
46 pub scorecard: bool,
47
48 /// The target runs the workflow guards: the candidate includes their
49 /// lines, glossary, and hooks, and the record carries the request.
50 #[arg(long)]
51 pub workflow_guards: bool,
52
53 /// The target runs code scanning under this provider: codeql or
54 /// semgrep. The candidate includes its workflow and the record carries
55 /// the request.
56 #[arg(long, value_name = "PROVIDER")]
57 pub code_scanning: Option<String>,
58
59 /// Land the answers a stage resolved, read from its receipt and
60 /// never its bytes; refuses a stage another binary wrote or one taken
61 /// for another target.
62 #[arg(long, value_name = "ROOT")]
63 pub stage: Option<Utf8PathBuf>,
64
65 /// Save a copy of this conflict, then replace it: an unattributed
66 /// file, or a recorded rendered file someone edited. Repeatable;
67 /// every conflict not named still refuses.
68 #[arg(long = "replace", value_name = "PATH")]
69 pub replace: Vec<String>,
70
71 /// Write the config and record; without it verification runs and nothing is
72 /// touched.
73 #[arg(long)]
74 pub apply: bool,
75
76 /// Emit one JSON object on stdout instead of the human report.
77 #[arg(long)]
78 pub json: bool,
79}