Skip to main content

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 code scanning under this provider: codeql or
49    /// semgrep. The candidate includes its workflow and the record carries
50    /// the request.
51    #[arg(long, value_name = "PROVIDER")]
52    pub code_scanning: Option<String>,
53
54    /// Write the config and record; without it verification runs and nothing is
55    /// touched.
56    #[arg(long)]
57    pub apply: bool,
58
59    /// Emit one JSON object on stdout instead of the human report.
60    #[arg(long)]
61    pub json: bool,
62}