Skip to main content

release_kit/cli/
upgrade.rs

1//! Arguments for `rk upgrade`.
2
3use camino::Utf8PathBuf;
4use clap::Args;
5
6use super::profile_flags::ProfileFlags;
7
8/// Take a landed target to this binary's projection.
9///
10/// Flags resolve over configuration, and recorded answers stand where
11/// both are silent. Preview by default; `--apply` replaces every recorded
12/// generated file, preserves every seeded and state file, and rewrites
13/// the receipt last.
14#[derive(Debug, Args)]
15pub struct UpgradeArgs {
16    /// The landed repository to upgrade.
17    #[arg(long, default_value = ".")]
18    pub target: Utf8PathBuf,
19
20    /// The project profile and the Git workflow, each flag overriding the
21    /// configured answer; the apply writes the answer back into the
22    /// config. Omitted, the config answers first and the record is the
23    /// fallback.
24    #[command(flatten)]
25    pub profile: ProfileFlags,
26
27    /// Change the recorded Nix request: `on` adds the capability's files
28    /// and records it; `off` drops them from the record while the files
29    /// stay on disk as the target's own, like any file this binary stops
30    /// shipping. Omitted, configuration precedes the recorded choice.
31    #[arg(long, alias = "nix", value_name = "on|off")]
32    pub nix_packaging: Option<String>,
33
34    /// Change the recorded reporting policy request: `on` lands
35    /// `SECURITY.md` and records it; `off` drops it from the record while
36    /// the file stays on disk as the target's own.
37    #[arg(long, value_name = "on|off")]
38    pub reporting_policy: Option<String>,
39
40    /// Change the recorded Scorecard request: `on` adds the workflow and
41    /// records it; `off` drops it from the record while the file stays on
42    /// disk as the target's own, like any file this binary stops shipping.
43    /// Omitted, configuration precedes the recorded choice.
44    #[arg(long, value_name = "on|off")]
45    pub scorecard: Option<String>,
46
47    /// Change the recorded code scanning provider: `codeql` or `semgrep`
48    /// lands that provider's workflow and records it; `off` drops it from
49    /// the record while the file stays on disk as the target's own. Omitted,
50    /// configuration precedes the recorded choice.
51    #[arg(long, value_name = "PROVIDER")]
52    pub code_scanning: Option<String>,
53
54    /// Write the upgrade; without it every file's action is listed and
55    /// nothing is touched. `rk stage` is the full-byte comparison surface.
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}