Skip to main content

release_kit/cli/
init.rs

1//! Arguments for `rk init`.
2
3use camino::Utf8PathBuf;
4use clap::Args;
5
6use super::profile_flags::ProfileFlags;
7
8/// Land the files the target configuration selects into a repository.
9#[derive(Debug, Clone, Args)]
10#[expect(
11    clippy::struct_excessive_bools,
12    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"
13)]
14pub struct InitArgs {
15    /// The project profile and the Git workflow.
16    #[command(flatten)]
17    pub profile: ProfileFlags,
18
19    /// The repository the files land into.
20    #[arg(long)]
21    pub target: Utf8PathBuf,
22
23    /// Opt the landing into the Nix capability: a seeded package
24    /// expression and a seed flake pair where the target has none.
25    /// Recorded as a capability request; off by default, because a
26    /// packaging surface is a decision, not a default.
27    #[arg(long, alias = "nix")]
28    pub nix_packaging: bool,
29
30    /// Request the landed vulnerability reporting policy, `SECURITY.md`.
31    /// An automatic release requests it by default; a release-less
32    /// profile asks for it with this flag.
33    #[arg(long)]
34    pub reporting_policy: bool,
35
36    /// Opt the landing into the Scorecard capability: a workflow that
37    /// computes an `OpenSSF` Scorecard result and publishes it to the public
38    /// Scorecard API. GitHub only. Recorded as a capability request; off by
39    /// default, because publishing a score is a decision, not a default.
40    #[arg(long)]
41    pub scorecard: bool,
42
43    /// Opt the landing into the workflow guards: the agent and commit
44    /// policy lines, the glossary, the workflow hooks, and the two workflow
45    /// setup steps. Off by default, because they shape how a project works
46    /// rather than what its release needs.
47    #[arg(long)]
48    pub workflow_guards: bool,
49
50    /// Opt the landing into code scanning, naming the provider: codeql,
51    /// GitHub's own analyzer, whose terms cover an open-source codebase so
52    /// the landing reads the driver's declared licence and refuses the pair
53    /// where it states no such codebase; or semgrep, which carries no licence
54    /// condition and runs on either forge. Recorded as a capability
55    /// request; off by default, because a scanning surface is a decision.
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 files; without it the destinations are listed and nothing
72    /// is 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}