Skip to main content

clickup_cli/
lib.rs

1pub mod client;
2pub mod commands;
3pub mod config;
4pub mod error;
5pub mod mcp;
6pub mod models;
7pub mod output;
8
9use clap::{Parser, Subcommand};
10
11#[derive(Parser)]
12#[command(name = "clickup", version, about = "CLI for the ClickUp API")]
13pub struct Cli {
14    /// API token (overrides config file)
15    #[arg(long, global = true)]
16    pub token: Option<String>,
17
18    /// Workspace ID (overrides config default)
19    #[arg(long, global = true)]
20    pub workspace: Option<String>,
21
22    /// Output format: table, json, json-compact, csv
23    #[arg(long, global = true, default_value = "table")]
24    pub output: String,
25
26    /// Comma-separated list of fields to display
27    #[arg(long, global = true)]
28    pub fields: Option<String>,
29
30    /// Omit table header row
31    #[arg(long, global = true)]
32    pub no_header: bool,
33
34    /// Fetch all pages
35    #[arg(long, global = true)]
36    pub all: bool,
37
38    /// Cap total results
39    #[arg(long, global = true)]
40    pub limit: Option<usize>,
41
42    /// Manual page selection
43    #[arg(long, global = true)]
44    pub page: Option<u32>,
45
46    /// Only print IDs, one per line
47    #[arg(short, long, global = true)]
48    pub quiet: bool,
49
50    /// HTTP timeout in seconds
51    #[arg(long, global = true, default_value = "30")]
52    pub timeout: u64,
53
54    #[command(subcommand)]
55    pub command: Commands,
56}
57
58#[derive(Subcommand)]
59pub enum Commands {
60    /// Configure API token and default workspace
61    Setup(commands::setup::SetupArgs),
62    /// Authentication commands
63    Auth {
64        #[command(subcommand)]
65        command: commands::auth::AuthCommands,
66    },
67    /// Workspace commands
68    Workspace {
69        #[command(subcommand)]
70        command: commands::workspace::WorkspaceCommands,
71    },
72    /// Space commands
73    Space {
74        #[command(subcommand)]
75        command: commands::space::SpaceCommands,
76    },
77    /// Folder commands
78    Folder {
79        #[command(subcommand)]
80        command: commands::folder::FolderCommands,
81    },
82    /// List commands
83    List {
84        #[command(subcommand)]
85        command: commands::list::ListCommands,
86    },
87    /// Task commands
88    Task {
89        #[command(subcommand)]
90        command: commands::task::TaskCommands,
91    },
92    /// Checklist commands
93    Checklist {
94        #[command(subcommand)]
95        command: commands::checklist::ChecklistCommands,
96    },
97    /// Comment commands
98    Comment {
99        #[command(subcommand)]
100        command: commands::comment::CommentCommands,
101    },
102    /// Tag commands
103    Tag {
104        #[command(subcommand)]
105        command: commands::tag::TagCommands,
106    },
107    /// Custom field commands
108    Field {
109        #[command(subcommand)]
110        command: commands::field::FieldCommands,
111    },
112    /// Custom task type commands
113    #[command(name = "task-type")]
114    TaskType {
115        #[command(subcommand)]
116        command: commands::task_type::TaskTypeCommands,
117    },
118    /// Attachment commands
119    Attachment {
120        #[command(subcommand)]
121        command: commands::attachment::AttachmentCommands,
122    },
123    /// Time tracking commands
124    Time {
125        #[command(subcommand)]
126        command: commands::time::TimeCommands,
127    },
128    /// Goal commands
129    Goal {
130        #[command(subcommand)]
131        command: commands::goal::GoalCommands,
132    },
133    /// View commands
134    View {
135        #[command(subcommand)]
136        command: commands::view::ViewCommands,
137    },
138    /// Member commands
139    Member {
140        #[command(subcommand)]
141        command: commands::member::MemberCommands,
142    },
143    /// User commands
144    User {
145        #[command(subcommand)]
146        command: commands::user::UserCommands,
147    },
148    /// Chat commands (v3)
149    Chat {
150        #[command(subcommand)]
151        command: commands::chat::ChatCommands,
152    },
153    /// Doc commands (v3)
154    Doc {
155        #[command(subcommand)]
156        command: commands::doc::DocCommands,
157    },
158    /// Webhook commands
159    Webhook {
160        #[command(subcommand)]
161        command: commands::webhook::WebhookCommands,
162    },
163    /// Template commands
164    Template {
165        #[command(subcommand)]
166        command: commands::template::TemplateCommands,
167    },
168    /// Guest commands (Enterprise only)
169    Guest {
170        #[command(subcommand)]
171        command: commands::guest::GuestCommands,
172    },
173    /// Group commands
174    Group {
175        #[command(subcommand)]
176        command: commands::group::GroupCommands,
177    },
178    /// Role commands (Enterprise only)
179    Role {
180        #[command(subcommand)]
181        command: commands::role::RoleCommands,
182    },
183    /// Shared hierarchy commands
184    Shared {
185        #[command(subcommand)]
186        command: commands::shared::SharedCommands,
187    },
188    /// Audit log commands (Enterprise only, v3)
189    #[command(name = "audit-log")]
190    AuditLog {
191        #[command(subcommand)]
192        command: commands::audit_log::AuditLogCommands,
193    },
194    /// ACL commands (Enterprise only, v3)
195    Acl {
196        #[command(subcommand)]
197        command: commands::acl::AclCommands,
198    },
199    /// Generate CLI reference for AI agent configs
200    #[command(name = "agent-config")]
201    AgentConfig {
202        #[command(subcommand)]
203        command: commands::agent_config::AgentConfigCommands,
204    },
205    /// Start MCP server (Model Context Protocol over stdio)
206    Mcp {
207        #[command(subcommand)]
208        command: commands::mcp_cmd::McpCommands,
209    },
210    /// Show current configuration and status
211    Status,
212    /// Generate shell completions
213    Completions {
214        /// Shell to generate completions for
215        shell: clap_complete::Shell,
216    },
217}