Skip to main content

release_kit/cli/
adopt.rs

1//! Arguments for `rk adopt`.
2
3use camino::Utf8PathBuf;
4use clap::Args;
5
6/// Write the landing record for a repository that already runs the
7/// convention, landed before the record existed.
8///
9/// Strict: every rendered file must match what this binary would
10/// render, and no target file is ever changed.
11#[derive(Debug, Clone, Args)]
12#[expect(
13    clippy::struct_excessive_bools,
14    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"
15)]
16pub struct AdoptArgs {
17    /// The repository to adopt.
18    #[arg(long, default_value = ".")]
19    pub target: Utf8PathBuf,
20
21    /// The technology whose files the target runs. Defaults to
22    /// detection from the version file.
23    #[arg(long)]
24    pub tech: Option<String>,
25
26    /// The forge whose files the target runs: github or gitlab.
27    /// Defaults to detection from the target's git remote.
28    #[arg(long)]
29    pub forge: Option<String>,
30
31    /// The project path on the forge, the parameter the candidate is
32    /// rendered under. Defaults to detection from the target's git
33    /// remote.
34    #[arg(long)]
35    pub repo: Option<String>,
36
37    /// The working-copy mode the candidate is rendered under: worktree or
38    /// branches. It chooses which candidate adoption verifies against and
39    /// never blesses the disk; the default is branches, the
40    /// compatibility-safe reading of a pre-record target.
41    #[arg(long)]
42    pub workflow: Option<String>,
43
44    /// The release style the candidate is rendered under: trunk or lines.
45    /// Required from the config or this flag: the style changes the bytes. An
46    /// adoption verifies bytes against exactly one rendered candidate, so
47    /// neither value is a safe guess.
48    #[arg(long)]
49    pub style: Option<String>,
50
51    /// The target runs the Nix capability: the candidate includes its
52    /// files, and the record carries the parameter. A target whose flake
53    /// pair is its own is verified without the pair and the workflow,
54    /// exactly as a landing would have withheld them.
55    #[arg(long)]
56    pub nix: bool,
57
58    /// The target runs the Scorecard capability: the candidate includes its
59    /// workflow, and the record carries the parameter.
60    #[arg(long)]
61    pub scorecard: bool,
62
63    /// The target runs code scanning under this provider: codeql or
64    /// semgrep. The candidate includes its workflow and the record carries
65    /// the parameter.
66    #[arg(long, value_name = "PROVIDER")]
67    pub code_scanning: Option<String>,
68
69    /// Write the config and record; without it verification runs and nothing is
70    /// touched.
71    #[arg(long)]
72    pub apply: bool,
73
74    /// Emit one JSON object on stdout instead of the human report.
75    #[arg(long)]
76    pub json: bool,
77}