Skip to main content

cove_cli/
cli.rs

1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(name = "cove", about = "Claude Code session manager", version)]
5#[command(args_conflicts_with_subcommands = true)]
6pub struct Cli {
7    /// Session name (default behavior: start or resume a session)
8    pub name: Option<String>,
9
10    /// Working directory
11    pub dir: Option<String>,
12
13    #[command(subcommand)]
14    pub command: Option<Command>,
15}
16
17#[derive(Debug, Subcommand)]
18pub enum Command {
19    /// List active sessions
20    #[command(alias = "ls")]
21    List,
22    /// Kill a single session tab
23    Kill {
24        /// Session name to kill
25        name: String,
26        /// Skip graceful shutdown (instant kill, no /exit)
27        #[arg(long, short)]
28        force: bool,
29    },
30    /// Kill all sessions
31    AllKill {
32        /// Skip graceful shutdown (instant kill, no /exit)
33        #[arg(long, short)]
34        force: bool,
35    },
36    /// Reattach to existing session
37    Resume,
38    /// Interactive session navigator (launched by start)
39    Sidebar,
40    /// Handle Claude Code hook events (called by hooks, not directly)
41    Hook {
42        #[command(subcommand)]
43        event: HookEvent,
44    },
45    /// Install Claude Code hooks for session status detection
46    Init,
47}
48
49#[derive(Debug, Subcommand)]
50pub enum HookEvent {
51    /// Claude received a user prompt (UserPromptSubmit hook)
52    UserPrompt,
53    /// Claude finished responding (Stop hook)
54    Stop,
55    /// Claude is about to show an AskUserQuestion (PreToolUse hook) [legacy]
56    Ask,
57    /// User answered an AskUserQuestion (PostToolUse hook) [legacy]
58    AskDone,
59    /// Claude is about to use a tool (PreToolUse hook, wildcard matcher)
60    PreTool,
61    /// Claude finished using a tool (PostToolUse hook, wildcard matcher)
62    PostTool,
63    /// Claude session ended (SessionEnd hook)
64    SessionEnd,
65}