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