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    /// Land the Git workflow and nothing of a release: a preset that sets
51    /// `profile.release.mode = "none"`, `git.integration = "local"`,
52    /// `git.checkout_mode = "linked-worktree"`, and
53    /// `capabilities.workflow_guards = true`, and records those four
54    /// answers alone. A flag that contradicts one of them refuses before
55    /// any write; a flag the preset does not set, such as `--merge-form`,
56    /// combines with it.
57    #[arg(long)]
58    pub workflow_only: bool,
59
60    /// Opt the landing into code scanning, naming the provider: codeql,
61    /// GitHub's own analyzer, whose terms cover an open-source codebase so
62    /// the landing reads the driver's declared licence and refuses the pair
63    /// where it states no such codebase; or semgrep, which carries no licence
64    /// condition and runs on either forge. Recorded as a capability
65    /// request; off by default, because a scanning surface is a decision.
66    #[arg(long, value_name = "PROVIDER")]
67    pub code_scanning: Option<String>,
68
69    /// Land the answers a stage resolved, read from its receipt and
70    /// never its bytes; refuses a stage another binary wrote or one taken
71    /// for another target.
72    #[arg(long, value_name = "ROOT")]
73    pub stage: Option<Utf8PathBuf>,
74
75    /// Save a copy of this conflict, then replace it: an unattributed
76    /// file, or a recorded rendered file someone edited. Repeatable;
77    /// every conflict not named still refuses.
78    #[arg(long = "replace", value_name = "PATH")]
79    pub replace: Vec<String>,
80
81    /// Write the files; without it the destinations are listed and nothing
82    /// is touched.
83    #[arg(long)]
84    pub apply: bool,
85
86    /// Emit one JSON object on stdout instead of the human report.
87    #[arg(long)]
88    pub json: bool,
89}