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
94
95
96
97
//! Arguments for `rk setup`.
use camino::Utf8PathBuf;
use clap::{Args, Subcommand};
/// Execute the repository-side setup against the detected forge.
///
/// Without a subcommand: preview every step, or run them in order under
/// `--apply`; `--list` prints the ordered steps and what each proves.
#[derive(Debug, Args)]
pub struct SetupArgs {
/// The read-only companions: check, one step, one script.
#[command(subcommand)]
pub action: Option<SetupAction>,
/// The repository to set up.
#[arg(long)]
pub target: Option<Utf8PathBuf>,
/// Override the detected project path (owner/name).
#[arg(long)]
pub repo: Option<String>,
/// Override the detected forge: github or gitlab.
#[arg(long)]
pub forge: Option<String>,
/// The check the gate must pass; required on github, refused on gitlab.
#[arg(long)]
pub required_check: Option<String>,
/// Run the steps; without it every step is previewed and nothing runs.
#[arg(long)]
pub apply: bool,
/// List the ordered steps and what each proves, and run nothing.
#[arg(long)]
pub list: bool,
/// Emit NDJSON events on stdout instead of the human report.
#[arg(long)]
pub json: bool,
}
/// The setup subcommands.
#[derive(Debug, Subcommand)]
pub enum SetupAction {
/// Prove the desired state against the forge, mutating nothing.
Check {
/// The repository to check.
#[arg(long)]
target: Utf8PathBuf,
/// Override the detected project path (owner/name).
#[arg(long)]
repo: Option<String>,
/// Override the detected forge: github or gitlab.
#[arg(long)]
forge: Option<String>,
/// The check the gate must pass, verified where given.
#[arg(long)]
required_check: Option<String>,
/// Emit NDJSON events on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// Run one step by name, for recovery and rerun.
Step {
/// The step, from `rk setup --list`.
name: String,
/// The repository to set up.
#[arg(long)]
target: Utf8PathBuf,
/// Override the detected project path (owner/name).
#[arg(long)]
repo: Option<String>,
/// Override the detected forge: github or gitlab.
#[arg(long)]
forge: Option<String>,
/// The check the gate must pass; required on github, refused on gitlab.
#[arg(long)]
required_check: Option<String>,
/// Run the step; without it the step is previewed and nothing runs.
#[arg(long)]
apply: bool,
/// Emit NDJSON events on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// Print one embedded setup script, for audit.
Script {
/// The step whose script to print.
name: String,
/// Which forge's tree to read; defaults to github.
#[arg(long)]
forge: Option<String>,
},
}