Skip to main content

release_kit/cli/
reconcile.rs

1//! Arguments for `rk reconcile`.
2
3use camino::Utf8PathBuf;
4use clap::{Args, Subcommand, ValueEnum};
5
6/// Compute the plan that converges a target toward one release.
7#[derive(Debug, Args)]
8pub struct ReconcileArgs {
9    /// What to do with a plan.
10    #[command(subcommand)]
11    pub action: ReconcileAction,
12}
13
14/// The reconcile operations.
15#[derive(Debug, Subcommand)]
16pub enum ReconcileAction {
17    /// Observe the target, resolve the release, compute the plan, and print it; nothing is written.
18    Plan(PlanArgs),
19}
20
21/// What a plan may read beyond the target and the bundle.
22#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
23pub enum Observe {
24    /// Read the trunk's tip at the origin remote, and stamp it.
25    Forge,
26}
27
28/// Arguments for `rk reconcile plan`.
29#[derive(Debug, Args)]
30pub struct PlanArgs {
31    /// The repository to plan for.
32    #[arg(long, default_value = ".")]
33    pub target: Utf8PathBuf,
34
35    /// The release to converge toward: `embedded` for this binary's own
36    /// bundle, offline; `latest` or an exact version through the crates
37    /// venue, which reaches the network and says so.
38    #[arg(long, default_value = "embedded", value_name = "SELECTOR")]
39    pub to: String,
40
41    /// Read the recorded release's bundle through the crates venue where
42    /// the cache does not hold it, so the baseline is bytes; without it a
43    /// missing baseline is reported as not observed.
44    #[arg(long)]
45    pub fetch: bool,
46
47    /// Opt into a read beyond the target: `forge` reads the trunk's tip
48    /// at the origin remote.
49    #[arg(long, value_enum, value_name = "WHAT")]
50    pub observe: Vec<Observe>,
51
52    /// Select an answer to a decision the plan names, as `<id>=<answer>`;
53    /// repeatable. A selected decision is a fingerprint input.
54    #[arg(long, value_name = "ID=ANSWER")]
55    pub decide: Vec<String>,
56
57    /// Override the configured payload binding.
58    #[arg(long)]
59    pub tech: Option<String>,
60
61    /// Override the configured forge.
62    #[arg(long)]
63    pub forge: Option<String>,
64
65    /// Override the configured project path.
66    #[arg(long)]
67    pub repo: Option<String>,
68
69    /// Answer the working-copy mode: worktree or branches.
70    #[arg(long)]
71    pub workflow: Option<String>,
72
73    /// Answer the release style: trunk or lines.
74    #[arg(long)]
75    pub style: Option<String>,
76
77    /// Answer the Nix opt-in: `on` or `off`.
78    #[arg(long)]
79    pub nix: Option<String>,
80
81    /// Emit the plan as one JSON object on stdout instead of the human report.
82    #[arg(long)]
83    pub json: bool,
84}