Skip to main content

thndrs_lib/cli/commands/
session.rs

1//! Local session command definitions.
2
3use clap::Subcommand;
4
5/// Local session history commands.
6#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
7pub enum SessionCommand {
8    /// List local sessions newest-first.
9    List,
10    /// Print the newest local session.
11    Latest,
12    /// List local session titles newest-first.
13    Titles,
14    /// Print replayable transcript entries for one local session id.
15    Show {
16        /// Exact id or unique id prefix, without the `.jsonl` suffix.
17        session_id: String,
18    },
19    /// Safely open an existing session for append-only continuation.
20    Resume {
21        /// Exact id or unique id prefix, without the `.jsonl` suffix.
22        session_id: String,
23    },
24    /// Print a stable, renderer-independent session projection.
25    Inspect {
26        /// Exact id or unique id prefix, without the `.jsonl` suffix.
27        session_id: String,
28        /// Output format.
29        #[arg(long, value_enum, default_value_t = SessionDataFormat::Json)]
30        format: SessionDataFormat,
31    },
32    /// Export redacted session records in append-only sequence order.
33    Export {
34        /// Exact id or unique id prefix, without the `.jsonl` suffix.
35        session_id: String,
36        /// Output format.
37        #[arg(long, value_enum, default_value_t = SessionDataFormat::Jsonl)]
38        format: SessionDataFormat,
39    },
40}
41
42/// Machine-readable session command output format.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, clap::ValueEnum)]
44pub enum SessionDataFormat {
45    /// A single JSON document.
46    Json,
47    /// One JSON value per line.
48    Jsonl,
49}