release_kit/cli/stage.rs
1//! Arguments for `rk stage`.
2
3use camino::Utf8PathBuf;
4use clap::{Args, Subcommand};
5
6/// Write the candidate this binary would land in a target into a
7/// disposable stage, beside the knowledge that explains it.
8///
9/// Reads the target and writes nothing inside it. The stage holds every
10/// proposed destination under `artifacts/`, the changelog, guidance,
11/// method, bindings, runbooks, forge notes, and setup skill under
12/// `reference/`, and one explanatory `stage.json`. Production landing
13/// never reads a stage; `rk stage clean <path>` removes one.
14#[derive(Debug, Args)]
15pub struct StageArgs {
16 /// The one companion: remove a stage.
17 #[command(subcommand)]
18 pub action: Option<StageAction>,
19
20 /// The technology whose candidate is staged; one of the bindings.
21 #[arg(long)]
22 pub tech: Option<String>,
23
24 /// The repository the candidate is computed for; read, never written.
25 #[arg(long, default_value = ".")]
26 pub target: Utf8PathBuf,
27
28 /// The forge whose files are staged: github or gitlab. Defaults to
29 /// detection from the target's git remote.
30 #[arg(long)]
31 pub forge: Option<String>,
32
33 /// The project path on the forge, substituted into the rendered files.
34 /// Defaults to detection from the target's git remote.
35 #[arg(long)]
36 pub repo: Option<String>,
37
38 /// The working-copy mode the candidate renders under: worktree or
39 /// branches.
40 #[arg(long)]
41 pub workflow: Option<String>,
42
43 /// The release style the candidate renders under: trunk or lines.
44 #[arg(long)]
45 pub style: Option<String>,
46
47 /// Stage the Nix capability too.
48 #[arg(long)]
49 pub nix: bool,
50
51 /// Stage the Scorecard capability too.
52 #[arg(long)]
53 pub scorecard: bool,
54
55 /// Stage the code scanning capability under this provider: codeql or
56 /// semgrep.
57 #[arg(long, value_name = "PROVIDER")]
58 pub code_scanning: Option<String>,
59
60 /// The exact directory to stage into; it must be absent or empty.
61 /// Without it, a target and version directory below `RK_STAGE_ROOT`,
62 /// else below the private state root.
63 #[arg(long)]
64 pub output: Option<Utf8PathBuf>,
65
66 /// Emit one JSON object on stdout instead of the human report.
67 #[arg(long)]
68 pub json: bool,
69}
70
71/// The stage subcommands.
72#[derive(Debug, Subcommand)]
73pub enum StageAction {
74 /// Remove exactly one stage directory, which must name itself in its
75 /// own stage.json.
76 Clean {
77 /// The stage directory, as `rk stage` printed it. No glob, no
78 /// parent, no link.
79 path: Utf8PathBuf,
80 /// Emit one JSON object on stdout instead of the human report.
81 #[arg(long)]
82 json: bool,
83 },
84}