Skip to main content

cli/cli/cli_args/
commands_advanced.rs

1// SPDX-License-Identifier: Apache-2.0
2//! Args for the W2 advanced verbs (A11–A15).
3
4use clap::{Args, Subcommand};
5
6#[derive(Clone, Debug, Args)]
7pub struct CheckpointArgs {
8    /// Git-facing commit summary for the current captured work.
9    #[arg(short = 'm', long)]
10    pub message: Option<String>,
11
12    /// Internal recovery: retry a failed staged-index commit checkpoint against the current
13    /// preserved Heddle state without requiring the dirty worktree to match it.
14    #[arg(long = "from-index-snapshot", hide = true)]
15    pub from_index_snapshot: bool,
16}
17
18#[derive(Clone, Debug, Subcommand)]
19pub enum TransactionCommands {
20    /// Begin a new transaction. Returns its id.
21    Begin(TransactionBeginArgs),
22    /// Commit a transaction. Buffered ops apply atomically.
23    Commit(TransactionIdArgs),
24    /// Abort a transaction. Buffered ops are discarded.
25    Abort(TransactionAbortArgs),
26    /// Show a transaction's current state.
27    Status(TransactionIdArgs),
28}
29
30#[derive(Clone, Debug, Args)]
31pub struct TransactionBeginArgs {
32    /// Thread the transaction targets. Defaults to HEAD-attached thread.
33    #[arg(long)]
34    pub thread: Option<String>,
35    /// Optional message describing the transaction's purpose.
36    #[arg(long)]
37    pub message: Option<String>,
38}
39
40#[derive(Clone, Debug, Args)]
41pub struct TransactionIdArgs {
42    pub transaction_id: String,
43}
44
45#[derive(Clone, Debug, Args)]
46pub struct TransactionAbortArgs {
47    pub transaction_id: String,
48    /// Reason for aborting (recorded with the abort op).
49    #[arg(long, default_value = "user-requested abort")]
50    pub reason: String,
51}