Skip to main content

clickup_cli/
lib.rs

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