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    },
27    /// Kill all sessions
28    AllKill,
29    /// Reattach to existing session
30    Resume,
31    /// Interactive session navigator (launched by start)
32    Sidebar,
33    /// Handle Claude Code hook events (called by hooks, not directly)
34    Hook {
35        #[command(subcommand)]
36        event: HookEvent,
37    },
38    /// Install Claude Code hooks for session status detection
39    Init,
40}
41
42#[derive(Debug, Subcommand)]
43pub enum HookEvent {
44    /// Claude received a user prompt (UserPromptSubmit hook)
45    UserPrompt,
46    /// Claude finished responding (Stop hook)
47    Stop,
48    /// Claude is about to show an AskUserQuestion (PreToolUse hook) [legacy]
49    Ask,
50    /// User answered an AskUserQuestion (PostToolUse hook) [legacy]
51    AskDone,
52    /// Claude is about to use a tool (PreToolUse hook, wildcard matcher)
53    PreTool,
54    /// Claude finished using a tool (PostToolUse hook, wildcard matcher)
55    PostTool,
56    /// Claude session ended (SessionEnd hook)
57    SessionEnd,
58}