release_kit/cli/lines.rs
1//! Arguments for `rk lines`.
2
3use camino::Utf8PathBuf;
4use clap::{Args, Subcommand};
5
6/// Open, inventory, mint candidates on, and retire the release lines.
7#[derive(Debug, Args)]
8pub struct LinesArgs {
9 /// What to do with the lines.
10 #[command(subcommand)]
11 pub action: LinesAction,
12}
13
14/// The line verbs. A line is `release/<major>.<minor>`: cut from an
15/// explicit base, validated through the candidates it mints, released by
16/// hand, and retired only behind its tags.
17#[derive(Debug, Subcommand)]
18pub enum LinesAction {
19 /// Report every release line — its tags, its tag coverage, and its
20 /// seat — offline.
21 List {
22 /// The repository to read; any of its worktrees names it.
23 #[arg(long, default_value = ".")]
24 target: Utf8PathBuf,
25
26 /// Emit one JSON object on stdout instead of the human report.
27 #[arg(long)]
28 json: bool,
29 },
30
31 /// Open `release/<line>` at an explicit base, seated per the recorded
32 /// workflow mode; preview by default.
33 Open {
34 /// The line's `<major>.<minor>`.
35 line: String,
36
37 /// The commit-ish the line is cut from — the tag it patches. A
38 /// line is a snapshot of a chosen commit, so there is no default.
39 #[arg(long)]
40 base: Option<String>,
41
42 /// The repository to act on; any of its worktrees names it.
43 #[arg(long, default_value = ".")]
44 target: Utf8PathBuf,
45
46 /// Create the line; without it the intent is reported and nothing
47 /// is touched.
48 #[arg(long)]
49 apply: bool,
50
51 /// Emit one JSON object on stdout instead of the human report.
52 #[arg(long)]
53 json: bool,
54 },
55
56 /// Mint the line's next release candidate: write its version into the
57 /// manifest, commit, and push the line; the release half tags it.
58 /// Preview by default.
59 Mint {
60 /// The line's `<major>.<minor>`.
61 line: String,
62
63 /// The line's tip the caller saw; the mint refuses when the remote
64 /// tip, the checkout's HEAD, or the working tree moved from it.
65 /// Required with --apply.
66 #[arg(long)]
67 expect: Option<String>,
68
69 /// Promote the newest candidate instead: write its stable version,
70 /// so the line's release request proposes it. Refuses while the
71 /// line holds a commit that candidate did not test.
72 #[arg(long)]
73 promote: bool,
74
75 /// The repository to act on; any of its worktrees names it.
76 #[arg(long, default_value = ".")]
77 target: Utf8PathBuf,
78
79 /// Commit as the account the forge names for the job's bot
80 /// credential, read before any file is written; a bash or python
81 /// line only. Without it the commit takes the caller's identity.
82 #[arg(long)]
83 as_bot: bool,
84
85 /// Commit and push the candidate's version; without it the intent
86 /// is reported and nothing is touched.
87 #[arg(long)]
88 apply: bool,
89
90 /// Emit one JSON object on stdout instead of the human report.
91 #[arg(long)]
92 json: bool,
93 },
94
95 /// Report a line's newest candidate tag and the next number a finding
96 /// would mint; read-only, because a tag is never hand-authored.
97 Rc {
98 /// The line's `<major>.<minor>`.
99 line: String,
100
101 /// The repository to read; any of its worktrees names it.
102 #[arg(long, default_value = ".")]
103 target: Utf8PathBuf,
104
105 /// Emit one JSON object on stdout instead of the human report.
106 #[arg(long)]
107 json: bool,
108 },
109
110 /// Retire a line that left production: the seat before the branch,
111 /// only behind its tags, and only under --apply; the remote deletion
112 /// stays the operator's.
113 Retire {
114 /// The line's `<major>.<minor>`.
115 line: String,
116
117 /// The repository to act on; any of its worktrees names it.
118 #[arg(long, default_value = ".")]
119 target: Utf8PathBuf,
120
121 /// Remove the seat and delete the local branch; without it the
122 /// intent is reported and nothing is touched.
123 #[arg(long)]
124 apply: bool,
125
126 /// Emit one JSON object on stdout instead of the human report.
127 #[arg(long)]
128 json: bool,
129 },
130}