1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! Arguments for `rk stage`.
use camino::Utf8PathBuf;
use clap::{Args, Subcommand};
use super::profile_flags::ProfileFlags;
/// Write the candidate this binary would land in a target into a
/// disposable stage, beside the knowledge that explains it.
///
/// Reads the target and writes nothing inside it. The stage holds every
/// proposed destination under `artifacts/`, the changelog, guidance,
/// method, bindings, runbooks, forge notes, and setup skill under
/// `reference/`, and one explanatory `stage.json`. Production landing
/// never reads a stage; `rk stage clean <path>` removes one.
#[derive(Debug, Args)]
#[expect(
clippy::struct_excessive_bools,
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"
)]
pub struct StageArgs {
/// The one companion: remove a stage.
#[command(subcommand)]
pub action: Option<StageAction>,
/// The project profile and the Git workflow the candidate renders
/// under.
#[command(flatten)]
pub profile: ProfileFlags,
/// The repository the candidate is computed for; read, never written.
#[arg(long, default_value = ".")]
pub target: Utf8PathBuf,
/// Stage the Nix capability too.
#[arg(long, alias = "nix")]
pub nix_packaging: bool,
/// Stage the reporting policy too.
#[arg(long)]
pub reporting_policy: bool,
/// Stage the Scorecard capability too.
#[arg(long)]
pub scorecard: bool,
/// Stage the workflow guards too.
#[arg(long)]
pub workflow_guards: bool,
/// Stage the code scanning capability under this provider: codeql or
/// semgrep.
#[arg(long, value_name = "PROVIDER")]
pub code_scanning: Option<String>,
/// The exact directory to stage into; it must be absent or empty.
/// Without it, a target and version directory below `RK_STAGE_ROOT`,
/// else below the private state root.
#[arg(long)]
pub output: Option<Utf8PathBuf>,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
pub json: bool,
}
/// The stage subcommands.
#[derive(Debug, Subcommand)]
pub enum StageAction {
/// Remove exactly one stage directory, which must name itself in its
/// own stage.json.
Clean {
/// The stage directory, as `rk stage` printed it. No glob, no
/// parent, no link.
path: Utf8PathBuf,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// Compare a stage with the target: one row per destination, its
/// state, its kind, its provenance, and the word the landing prints.
Compare {
/// The stage directory, as `rk stage` printed it.
root: Utf8PathBuf,
/// The repository the stage was taken for.
#[arg(long, default_value = ".")]
target: Utf8PathBuf,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
}