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-cli", 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 (v2 page-based endpoints)
45    #[arg(long, global = true)]
46    pub page: Option<u32>,
47
48    /// Opaque cursor from a previous response (v3 cursor-based endpoints).
49    /// Use with chat-* and doc list commands.
50    #[arg(long, global = true)]
51    pub cursor: Option<String>,
52
53    /// Boundary timestamp in Unix ms (v2 start-id-based comment endpoints).
54    /// Pair with --start-id; both required when continuing a comment listing.
55    #[arg(long, global = true)]
56    pub start: Option<i64>,
57
58    /// Boundary comment id (v2 start-id-based comment endpoints).
59    /// Pair with --start.
60    #[arg(long = "start-id", global = true)]
61    pub start_id: Option<String>,
62
63    /// Only print IDs, one per line
64    #[arg(short, long, global = true)]
65    pub quiet: bool,
66
67    /// HTTP timeout in seconds
68    #[arg(long, global = true, default_value = "30")]
69    pub timeout: u64,
70
71    #[command(subcommand)]
72    pub command: Commands,
73}
74
75#[derive(Subcommand)]
76pub enum Commands {
77    /// Configure API token and default workspace
78    Setup(commands::setup::SetupArgs),
79    /// Authentication commands
80    Auth {
81        #[command(subcommand)]
82        command: commands::auth::AuthCommands,
83    },
84    /// Workspace commands
85    Workspace {
86        #[command(subcommand)]
87        command: commands::workspace::WorkspaceCommands,
88    },
89    /// Space commands
90    Space {
91        #[command(subcommand)]
92        command: commands::space::SpaceCommands,
93    },
94    /// Folder commands
95    Folder {
96        #[command(subcommand)]
97        command: commands::folder::FolderCommands,
98    },
99    /// List commands
100    List {
101        #[command(subcommand)]
102        command: commands::list::ListCommands,
103    },
104    /// Task commands
105    Task {
106        #[command(subcommand)]
107        command: commands::task::TaskCommands,
108    },
109    /// Checklist commands
110    Checklist {
111        #[command(subcommand)]
112        command: commands::checklist::ChecklistCommands,
113    },
114    /// Comment commands
115    Comment {
116        #[command(subcommand)]
117        command: commands::comment::CommentCommands,
118    },
119    /// Tag commands
120    Tag {
121        #[command(subcommand)]
122        command: commands::tag::TagCommands,
123    },
124    /// Custom field commands
125    Field {
126        #[command(subcommand)]
127        command: commands::field::FieldCommands,
128    },
129    /// Custom task type commands
130    #[command(name = "task-type")]
131    TaskType {
132        #[command(subcommand)]
133        command: commands::task_type::TaskTypeCommands,
134    },
135    /// Attachment commands
136    Attachment {
137        #[command(subcommand)]
138        command: commands::attachment::AttachmentCommands,
139    },
140    /// Time tracking commands
141    Time {
142        #[command(subcommand)]
143        command: commands::time::TimeCommands,
144    },
145    /// Goal commands
146    Goal {
147        #[command(subcommand)]
148        command: commands::goal::GoalCommands,
149    },
150    /// View commands
151    View {
152        #[command(subcommand)]
153        command: commands::view::ViewCommands,
154    },
155    /// Member commands
156    Member {
157        #[command(subcommand)]
158        command: commands::member::MemberCommands,
159    },
160    /// User commands
161    User {
162        #[command(subcommand)]
163        command: commands::user::UserCommands,
164    },
165    /// Chat commands (v3)
166    Chat {
167        #[command(subcommand)]
168        command: commands::chat::ChatCommands,
169    },
170    /// Doc commands (v3)
171    Doc {
172        #[command(subcommand)]
173        command: commands::doc::DocCommands,
174    },
175    /// Webhook commands
176    Webhook {
177        #[command(subcommand)]
178        command: commands::webhook::WebhookCommands,
179    },
180    /// Template commands
181    Template {
182        #[command(subcommand)]
183        command: commands::template::TemplateCommands,
184    },
185    /// Guest commands (Enterprise only)
186    Guest {
187        #[command(subcommand)]
188        command: commands::guest::GuestCommands,
189    },
190    /// Group commands
191    Group {
192        #[command(subcommand)]
193        command: commands::group::GroupCommands,
194    },
195    /// Role commands (Enterprise only)
196    Role {
197        #[command(subcommand)]
198        command: commands::role::RoleCommands,
199    },
200    /// Shared hierarchy commands
201    Shared {
202        #[command(subcommand)]
203        command: commands::shared::SharedCommands,
204    },
205    /// Audit log commands (Enterprise only, v3)
206    #[command(name = "audit-log")]
207    AuditLog {
208        #[command(subcommand)]
209        command: commands::audit_log::AuditLogCommands,
210    },
211    /// ACL commands (Enterprise only, v3)
212    Acl {
213        #[command(subcommand)]
214        command: commands::acl::AclCommands,
215    },
216    /// Generate CLI reference for AI agent configs
217    #[command(name = "agent-config")]
218    AgentConfig {
219        #[command(subcommand)]
220        command: commands::agent_config::AgentConfigCommands,
221    },
222    /// Start MCP server (Model Context Protocol over stdio)
223    Mcp {
224        #[command(subcommand)]
225        command: commands::mcp_cmd::McpCommands,
226    },
227    /// Show current configuration and status
228    Status,
229    /// Generate shell completions
230    Completions {
231        /// Shell to generate completions for
232        shell: clap_complete::Shell,
233    },
234}