Skip to main content

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 and push the candidate's version; without it the intent
80        /// is reported and nothing is touched.
81        #[arg(long)]
82        apply: bool,
83
84        /// Emit one JSON object on stdout instead of the human report.
85        #[arg(long)]
86        json: bool,
87    },
88
89    /// Report a line's newest candidate tag and the next number a finding
90    /// would mint; read-only, because a tag is never hand-authored.
91    Rc {
92        /// The line's `<major>.<minor>`.
93        line: String,
94
95        /// The repository to read; any of its worktrees names it.
96        #[arg(long, default_value = ".")]
97        target: Utf8PathBuf,
98
99        /// Emit one JSON object on stdout instead of the human report.
100        #[arg(long)]
101        json: bool,
102    },
103
104    /// Retire a line that left production: the seat before the branch,
105    /// only behind its tags, and only under --apply; the remote deletion
106    /// stays the operator's.
107    Retire {
108        /// The line's `<major>.<minor>`.
109        line: String,
110
111        /// The repository to act on; any of its worktrees names it.
112        #[arg(long, default_value = ".")]
113        target: Utf8PathBuf,
114
115        /// Remove the seat and delete the local branch; without it the
116        /// intent is reported and nothing is touched.
117        #[arg(long)]
118        apply: bool,
119
120        /// Emit one JSON object on stdout instead of the human report.
121        #[arg(long)]
122        json: bool,
123    },
124}