/**
 * Interaction-mode detection. The CLI's rich surfaces (spinners, live step
 * lists, prompts) only render when we are attached to an interactive terminal
 * and not running under CI; otherwise everything degrades to plain line logs so
 * pipes, captures, and tests stay deterministic.
 */
/** True under a recognized CI environment. */
export function isCI() {
    const env = process.env;
    return Boolean(env.CI === "true" ||
        env.CI === "1" ||
        env.CONTINUOUS_INTEGRATION ||
        env.GITHUB_ACTIONS ||
        env.GITLAB_CI ||
        env.BUILDKITE ||
        env.CIRCLECI);
}
/** The stream all UI is written to (stderr; stdout is reserved for tool output). */
export function uiStream() {
    return process.stderr;
}
/** True when we should render rich, animated UI to `stream`. */
export function isInteractive(stream = uiStream()) {
    if (process.env.CURSORKIT_NO_TUI === "1")
        return false;
    if (isCI())
        return false;
    return Boolean(stream.isTTY);
}
/** True when we can read interactive keypresses (raw mode) from stdin. */
export function canPromptInteractively() {
    return (Boolean(process.stdin.isTTY) &&
        !isCI() &&
        process.env.CURSORKIT_NO_TUI !== "1");
}
