Skip to main content

Module interactive

Module interactive 

Source
Expand description

Interactive terminal prompts for the remote sources setup wizard.

This module provides rich interactive components using dialoguer, including:

  • Multi-select host picker with multi-line item display
  • Confirmation prompts for destructive operations

§Design Decision: dialoguer vs inquire

We chose dialoguer because:

  1. It integrates well with indicatif (already used for progress bars)
  2. It’s actively maintained and widely used
  3. It supports ANSI styling in items via the console crate

§Multi-line Item Display

Standard dialoguer MultiSelect shows single-line items. We achieve multi-line display by embedding ANSI escape sequences and newlines directly in item strings:

[x] css
    209.145.54.164 • ubuntu
    ✓ cass v0.1.50 installed • 1,234 sessions
    Claude ✓  Codex ✓  Cursor ✓

§Example

use coding_agent_search::sources::interactive::{
    HostSelector, HostDisplayInfo, HostState, CassStatusDisplay
};

let hosts = vec![
    HostDisplayInfo {
        name: "css".into(),
        hostname: "209.145.54.164".into(),
        username: "ubuntu".into(),
        cass_status: CassStatusDisplay::Installed { version: "0.1.50".into(), sessions: 1234 },
        detected_agents: vec!["claude".into(), "codex".into()],
        reachable: true,
        error: None,
        state: HostState::ReadyToSync,
        system_info: Some("ubuntu 22.04 • 45GB free".into()),
    },
    // ... more hosts
];

let selector = HostSelector::new(hosts);
let selected = selector.prompt()?;

Structs§

HostDisplayInfo
Display information for a remote host in the selection UI.
HostSelectionResult
Result of host selection.
HostSelector
Interactive multi-select host picker with rich display.

Enums§

CassStatusDisplay
cass installation status for display purposes.
HostState
State of a host for selection purposes.
InteractiveError
Errors from interactive prompts.

Functions§

confirm_action
Ask for confirmation before a destructive operation.
confirm_with_details
Ask for confirmation with a detailed explanation.
probe_to_display_info
Convert a probe result to display info for the selection UI.
run_host_selection
Run the interactive host selection flow.