sprite/cli.rs
1use clap::{Subcommand, ValueEnum};
2
3#[derive(Subcommand)]
4pub enum Commands {
5 /// Initialize a new multi-agent environment
6 Init {
7 /// Force overwrite existing configuration
8 #[arg(short, long)]
9 force: bool,
10 /// Number of agents to create
11 #[arg(short, long, default_value = "3")]
12 agents: u32,
13 },
14 /// Manage configuration
15 Config {
16 #[command(subcommand)]
17 command: ConfigCommands,
18 },
19 /// Start supervision session
20 Start {
21 /// Custom session name
22 #[arg(short, long)]
23 session_name: Option<String>,
24 /// Layout type
25 #[arg(short, long, default_value = "tiled")]
26 layout: String,
27 /// Start and detach immediately
28 #[arg(short, long)]
29 detach: bool,
30 /// Kill existing session if it exists
31 #[arg(short, long)]
32 force: bool,
33 },
34 /// Manage agents
35 Agents {
36 #[command(subcommand)]
37 command: AgentsCommands,
38 },
39 /// Attach to existing session
40 Attach {
41 /// Session name to attach to
42 session_name: Option<String>,
43 /// List available sessions
44 #[arg(short, long)]
45 list: bool,
46 },
47 /// Terminate session
48 Kill {
49 /// Session name to kill
50 session_name: Option<String>,
51 /// Force kill without confirmation
52 #[arg(short, long)]
53 force: bool,
54 /// Kill all sessions
55 #[arg(long)]
56 all: bool,
57 },
58
59 /// Send command to specific agent
60 Hey {
61 /// Agent number (1, 2, 3, etc.)
62 agent: String,
63 /// Command to execute
64 command: String,
65 /// Command arguments
66 args: Vec<String>,
67 /// Command timeout in seconds
68 #[arg(short, long, default_value = "30")]
69 timeout: u64,
70 /// Working directory for command
71 #[arg(short, long)]
72 work_dir: Option<String>,
73 /// Environment variable (KEY=VALUE)
74 #[arg(short, long = "env")]
75 env_vars: Vec<String>,
76 /// Interactive mode
77 #[arg(short, long)]
78 interactive: bool,
79 },
80 /// Synchronize workspaces
81 Sync {
82 /// Sync specific agent
83 #[arg(short, long)]
84 agent: Option<String>,
85 /// Force sync even if conflicts
86 #[arg(short, long)]
87 force: bool,
88 /// Conflict resolution strategy
89 #[arg(short, long, default_value = "manual")]
90 strategy: String,
91 /// Show what would be synced
92 #[arg(long)]
93 dry_run: bool,
94 },
95 /// Remove agent workspace
96 Remove {
97 /// Agent number to remove
98 agent: String,
99 /// Force removal without confirmation
100 #[arg(short, long)]
101 force: bool,
102 /// Keep workspace files
103 #[arg(long)]
104 keep_workspace: bool,
105 /// Merge branch before removal
106 #[arg(long)]
107 merge_branch: bool,
108 },
109
110 /// Focus on agent pane
111 Zoom {
112 /// Agent number to zoom on
113 agent: Option<String>,
114 /// Return to normal layout
115 #[arg(short = 'u', long)]
116 unzoom: bool,
117 /// List available panes
118 #[arg(short, long)]
119 list: bool,
120 },
121 /// Check session status and health
122 Status {
123 /// Check specific session
124 session_name: Option<String>,
125 /// Clean up old sessions and temporary files
126 #[arg(long)]
127 cleanup: bool,
128 /// Show detailed health information
129 #[arg(long)]
130 detailed: bool,
131 },
132 /// Show extended help and documentation
133 Guide {
134 /// Command to get help for
135 command: Option<String>,
136 /// Search help content
137 #[arg(long)]
138 search: Option<String>,
139 /// Show usage patterns
140 #[arg(long)]
141 patterns: bool,
142 /// Show troubleshooting guides
143 #[arg(long)]
144 troubleshooting: bool,
145 /// Show quick reference
146 #[arg(long)]
147 quick: bool,
148 /// Show accessible help (screen reader friendly)
149 #[arg(long)]
150 accessible: bool,
151 /// Show usage patterns for specific category
152 #[arg(long, value_enum)]
153 category: Option<HelpCategory>,
154 },
155 /// Update sprite to the latest version
156 Update {
157 /// Only check for updates without installing
158 #[arg(long)]
159 check: bool,
160 /// Skip confirmation prompt
161 #[arg(short, long)]
162 yes: bool,
163 /// Update to specific version
164 #[arg(long)]
165 version: Option<String>,
166 },
167}
168
169/// Help system command categories.
170#[derive(ValueEnum, Debug, Clone)]
171pub enum HelpCategory {
172 /// Getting started guides
173 GettingStarted,
174 /// Daily workflow patterns
175 DailyWorkflow,
176 /// Troubleshooting guides
177 Troubleshooting,
178 /// Advanced usage
179 Advanced,
180 /// Collaboration workflows
181 Collaboration,
182}
183
184#[derive(Subcommand)]
185pub enum ConfigCommands {
186 /// Show current configuration
187 Show,
188 /// Validate configuration
189 Validate,
190 /// Set configuration value
191 Set {
192 /// Configuration key
193 key: String,
194 /// Configuration value
195 value: String,
196 },
197 /// Get configuration value
198 Get {
199 /// Configuration key
200 key: String,
201 },
202 /// Edit configuration file
203 Edit,
204 /// Check for configuration changes
205 Status,
206}
207
208#[derive(Subcommand)]
209pub enum AgentsCommands {
210 /// List all configured agents
211 List,
212 /// Create a new agent
213 Create {
214 /// Agent ID (e.g., "3", "4")
215 agent_id: String,
216 /// Branch name
217 #[arg(short, long)]
218 branch: Option<String>,
219 /// Workspace path
220 #[arg(short, long)]
221 workspace: Option<String>,
222 /// Model type
223 #[arg(short, long, default_value = "claude-sonnet-4")]
224 model: String,
225 /// Description
226 #[arg(short, long)]
227 description: Option<String>,
228 /// Skip workspace creation
229 #[arg(long)]
230 no_workspace: bool,
231 },
232 /// Remove an agent
233 Remove {
234 /// Agent ID to remove
235 agent_id: String,
236 /// Force removal without confirmation
237 #[arg(short, long)]
238 force: bool,
239 /// Keep workspace files
240 #[arg(long)]
241 keep_workspace: bool,
242 },
243 /// Show agent details
244 Show {
245 /// Agent ID (or leave blank for all agents)
246 agent_id: Option<String>,
247 },
248 /// Validate agent workspaces
249 Validate,
250 /// Provision workspaces for agents
251 Provision {
252 /// Specific agent ID (or leave blank for all agents)
253 agent_id: Option<String>,
254 },
255}