1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! Typed CLI input consumed by the library entry point.
use std::path::PathBuf;
use crate::session_id::SessionId;
/// Parsed command the binary should execute.
#[derive(Clone, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum Command {
/// Start a new session and attach.
Run {
/// Command argv after `--`.
command: Vec<String>,
},
/// Attach to an existing live session.
Resume {
/// Explicit session id; `None` uses auto-detect.
id: Option<SessionId>,
},
/// Print live sessions.
List,
/// Abruptly terminate the recorded supervisor for this id.
Kill {
/// Session id to kill. Required by the CLI.
id: SessionId,
},
/// Supervisor process spawned by `run`. Not a user-facing subcommand.
#[doc(hidden)]
Supervisor {
/// One-shot startup pipe name created by the client.
startup_pipe: String,
/// Canonical launch directory.
launch_directory: PathBuf,
/// Command argv to execute.
command: Vec<String>,
},
}
/// Fully parsed invocation.
///
/// Built by [`crate::Cli::into_input`] and consumed by [`crate::run`].
#[derive(Clone, Debug, Eq, PartialEq)]
#[expect(
clippy::exhaustive_structs,
reason = "handoff struct read directly by the in-crate binary"
)]
pub struct RunInput {
/// Whether auto-detect should explain its decisions on stderr.
pub verbose: bool,
/// Store-root override. Hidden; tests use it so they never touch `LocalAppData`.
#[doc(hidden)]
pub store_root: Option<PathBuf>,
/// Subcommand to execute.
pub command: Command,
}
/// Result of a successful `dure` invocation.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[expect(
clippy::exhaustive_enums,
reason = "handoff enum matched directly by the in-crate binary"
)]
pub enum Outcome {
/// Command finished without an app exit status to forward.
Success,
/// The attached app exited; the process should exit with this status.
AppExit(i32),
}