summaryrefslogtreecommitdiff
path: root/makima/src/daemon/cli/view.rs
blob: b9fa82fec3fd3fb458ad3d909450e42543e83fc0 (plain) (blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! View subcommand - interactive TUI browser for contracts and tasks.
//!
//! The `makima view` command provides an interactive Terminal User Interface (TUI)
//! for browsing and managing makima contracts and their tasks. It features
//! drill-down navigation, fuzzy search filtering, and real-time task output streaming.
//!
//! # Usage
//!
//! ```bash
//! # Browse contracts interactively
//! makima view
//!
//! # Browse with an initial search query
//! makima view "my project"
//!
//! # Change directory to selected task's worktree
//! cd $(makima view)
//! ```
//!
//! # Keyboard Shortcuts
//!
//! | Key           | Action                        |
//! |---------------|-------------------------------|
//! | `↑` / `k`     | Move selection up             |
//! | `↓` / `j`     | Move selection down           |
//! | `Enter` / `l` | Drill into item               |
//! | `Esc` / `h`   | Go back to previous view      |
//! | `e`           | Edit item (inline)            |
//! | `d`           | Delete item (with confirm)    |
//! | `/`           | Focus search input            |
//! | `Space`       | Show details in preview pane  |
//! | `q`           | Quit                          |
//! | `c`           | Navigate to worktree (cd)     |
//! | `r`           | Refresh data                  |
//!
//! # Navigation
//!
//! - **Contracts view**: Lists all contracts. Press Enter to see tasks.
//! - **Tasks view**: Shows tasks for a contract. Press Enter to view output.
//! - **Output view**: Streams real-time task output with tool call formatting.
//!
//! # Features
//!
//! - **Drill-down Navigation**: Contracts → Tasks → Task Output
//! - **Fuzzy Search**: Type to filter items in real-time
//! - **Real-time Streaming**: View live task output via WebSocket
//! - **Preview Pane**: See item details without leaving the list

use clap::Args;

/// Interactive TUI browser for contracts and tasks.
///
/// Provides a fuzzy-searchable interface for browsing contracts,
/// viewing their tasks, and streaming real-time task output.
///
/// # Examples
///
/// Browse contracts:
/// ```bash
/// makima view
/// ```
///
/// Browse with initial search:
/// ```bash
/// makima view "auth"
/// ```
#[derive(Args, Debug, Clone)]
pub struct ViewArgs {
    /// API URL for the makima server
    ///
    /// If not provided, uses MAKIMA_API_URL env var or ~/.makima/config.toml
    #[arg(long, env = "MAKIMA_API_URL")]
    pub api_url: Option<String>,

    /// API key for authentication
    ///
    /// If not provided, uses MAKIMA_API_KEY env var or ~/.makima/config.toml
    #[arg(long, env = "MAKIMA_API_KEY")]
    pub api_key: Option<String>,

    /// Initial search query
    ///
    /// Pre-populates the search field with this query when the TUI opens.
    #[arg(index = 1)]
    pub query: Option<String>,

    /// Disable the preview pane
    ///
    /// Shows only the item list without the side preview panel.
    /// Useful for smaller terminal windows.
    #[arg(long)]
    pub no_preview: bool,
}