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
/// Returns `true` when stdin is connected to a terminal (i.e. the process is
/// running interactively), `false` otherwise (e.g. stdin is a pipe or
/// redirected file, which is the common case in CI environments).
///
/// This centralises the TTY check so that `add` and `init` both branch on the
/// same predicate rather than each duplicating the `IsTerminal` import and
/// call site. The function is a thin wrapper over
/// [`std::io::IsTerminal::is_terminal`] and carries no additional state; it
/// can be replaced with a test double by injecting a `bool` at the call site
/// when unit testing the *callers*.
///
/// # Why a dedicated module instead of an inline call?
///
/// `std::io::IsTerminal` cannot be meaningfully unit-tested without spawning a
/// real subprocess with a controlled stdin (the trait's return value is
/// determined by the OS, not by Rust code). The integration-test coverage for
/// the non-interactive path lives in
/// `crates/callisto-cli/tests/cli_tests.rs` — specifically
/// `test_add_non_interactive_via_pipe` — which pipes stdin and asserts that
/// `callisto add` selects the non-interactive code path rather than trying to
/// drive a TTY wizard.