Skip to main content

release_kit/cli/
init.rs

1//! Arguments for `rk init`.
2
3use camino::Utf8PathBuf;
4use clap::Args;
5
6/// Land a technology's deterministic files into a target repository.
7#[derive(Debug, Clone, Args)]
8#[expect(
9    clippy::struct_excessive_bools,
10    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"
11)]
12pub struct InitArgs {
13    /// The technology whose files land; one of the bindings.
14    #[arg(long)]
15    pub tech: Option<String>,
16
17    /// The repository the files land into.
18    #[arg(long)]
19    pub target: Utf8PathBuf,
20
21    /// The forge whose files land: github or gitlab. Defaults to detection
22    /// from the target's git remote; an unrecognized host refuses.
23    #[arg(long)]
24    pub forge: Option<String>,
25
26    /// The project path on the forge, substituted into the rendered files
27    /// and recorded as the landing parameter. Defaults to detection from
28    /// the target's git remote; an apply with neither refuses.
29    #[arg(long)]
30    pub repo: Option<String>,
31
32    /// The working-copy mode this project chooses: worktree (every
33    /// code-changing branch in a linked worktree, the main checkout
34    /// commits nothing) or branches (branches worked in the main
35    /// checkout, worktrees optional beside them). Recorded as a landing
36    /// parameter and rendered into the landed blocks.
37    #[arg(long)]
38    pub workflow: Option<String>,
39
40    /// The release style this project chooses: trunk (the bot's release
41    /// request carries auto-merge from creation, so a green trunk ships
42    /// itself) or lines (every request waits for a human's merge).
43    /// Recorded as a landing parameter and rendered into the landed
44    /// release workflow.
45    #[arg(long)]
46    pub style: Option<String>,
47
48    /// Opt the landing into the Nix capability: a seeded package
49    /// expression, a seed flake pair where the target has none, and the
50    /// workflow that proves the build. Recorded as a landing parameter;
51    /// off by default, because a packaging surface is a decision, not a
52    /// default.
53    #[arg(long)]
54    pub nix: bool,
55
56    /// Opt the landing into the Scorecard capability: a workflow that
57    /// computes an `OpenSSF` Scorecard result and publishes it to the public
58    /// Scorecard API. GitHub only. Recorded as a landing parameter; off by
59    /// default, because publishing a score is a decision, not a default.
60    #[arg(long)]
61    pub scorecard: bool,
62
63    /// Opt the landing into code scanning, naming the provider: codeql,
64    /// GitHub's own analyzer, whose terms cover an open-source codebase so
65    /// the landing reads the binding's declared licence and refuses the pair
66    /// where it is not OSI-approved; or semgrep, which carries no licence
67    /// condition and runs on either forge. Recorded as a landing parameter;
68    /// off by default, because a scanning surface is a decision.
69    #[arg(long, value_name = "PROVIDER")]
70    pub code_scanning: Option<String>,
71
72    /// Write the files; without it the destinations are listed and nothing
73    /// is touched.
74    #[arg(long)]
75    pub apply: bool,
76
77    /// Emit one JSON object on stdout instead of the human report.
78    #[arg(long)]
79    pub json: bool,
80}