intent_engine/cli.rs
1use clap::{Parser, Subcommand};
2
3#[derive(Parser)]
4#[command(name = "intent-engine")]
5#[command(about = "A command-line database service for tracking strategic intent", long_about = None)]
6pub struct Cli {
7 #[command(subcommand)]
8 pub command: Commands,
9}
10
11#[derive(Subcommand)]
12pub enum Commands {
13 /// Task management commands
14 #[command(subcommand)]
15 Task(TaskCommands),
16
17 /// Workspace state management
18 Current {
19 /// Set the current task ID
20 #[arg(long)]
21 set: Option<i64>,
22 },
23
24 /// Generate analysis and reports
25 Report {
26 /// Time duration (e.g., "7d", "2h", "30m")
27 #[arg(long)]
28 since: Option<String>,
29
30 /// Filter by status
31 #[arg(long)]
32 status: Option<String>,
33
34 /// Filter by name pattern (FTS5)
35 #[arg(long)]
36 filter_name: Option<String>,
37
38 /// Filter by spec pattern (FTS5)
39 #[arg(long)]
40 filter_spec: Option<String>,
41
42 /// Output format
43 #[arg(long, default_value = "json")]
44 format: String,
45
46 /// Return summary only
47 #[arg(long)]
48 summary_only: bool,
49 },
50
51 /// Event logging commands
52 #[command(subcommand)]
53 Event(EventCommands),
54
55 /// Check system health and dependencies
56 Doctor,
57}
58
59#[derive(Subcommand)]
60pub enum TaskCommands {
61 /// Add a new task
62 Add {
63 /// Task name
64 #[arg(long)]
65 name: String,
66
67 /// Parent task ID
68 #[arg(long)]
69 parent: Option<i64>,
70
71 /// Read spec from stdin
72 #[arg(long)]
73 spec_stdin: bool,
74 },
75
76 /// Get a task by ID
77 Get {
78 /// Task ID
79 id: i64,
80
81 /// Include events summary
82 #[arg(long)]
83 with_events: bool,
84 },
85
86 /// Update a task
87 Update {
88 /// Task ID
89 id: i64,
90
91 /// New task name
92 #[arg(long)]
93 name: Option<String>,
94
95 /// New parent task ID
96 #[arg(long)]
97 parent: Option<i64>,
98
99 /// New status
100 #[arg(long)]
101 status: Option<String>,
102
103 /// Task complexity (1-10)
104 #[arg(long)]
105 complexity: Option<i32>,
106
107 /// Task priority
108 #[arg(long)]
109 priority: Option<i32>,
110
111 /// Read spec from stdin
112 #[arg(long)]
113 spec_stdin: bool,
114 },
115
116 /// Delete a task
117 Del {
118 /// Task ID
119 id: i64,
120 },
121
122 /// Find tasks with filters
123 Find {
124 /// Filter by status
125 #[arg(long)]
126 status: Option<String>,
127
128 /// Filter by parent ID (use "null" for no parent)
129 #[arg(long)]
130 parent: Option<String>,
131 },
132
133 /// Start a task (atomic: update status + set current)
134 Start {
135 /// Task ID
136 id: i64,
137
138 /// Include events summary
139 #[arg(long)]
140 with_events: bool,
141 },
142
143 /// Complete a task (atomic: check children + update status)
144 Done {
145 /// Task ID
146 id: i64,
147 },
148
149 /// Intelligently pick tasks from todo and move to doing
150 PickNext {
151 /// Maximum number of tasks to pick
152 #[arg(long, default_value = "5")]
153 max_count: usize,
154
155 /// Maximum total tasks allowed in doing status
156 #[arg(long, default_value = "5")]
157 capacity: usize,
158 },
159
160 /// Create a subtask under current task and switch to it
161 SpawnSubtask {
162 /// Subtask name
163 #[arg(long)]
164 name: String,
165
166 /// Read spec from stdin
167 #[arg(long)]
168 spec_stdin: bool,
169 },
170
171 /// Switch to a specific task (atomic: update to doing + set current)
172 Switch {
173 /// Task ID
174 id: i64,
175 },
176}
177
178#[derive(Subcommand)]
179pub enum EventCommands {
180 /// Add a new event
181 Add {
182 /// Task ID
183 #[arg(long)]
184 task_id: i64,
185
186 /// Log type
187 #[arg(long = "type")]
188 log_type: String,
189
190 /// Read discussion data from stdin
191 #[arg(long)]
192 data_stdin: bool,
193 },
194
195 /// List events for a task
196 List {
197 /// Task ID
198 #[arg(long)]
199 task_id: i64,
200
201 /// Maximum number of events to return
202 #[arg(long)]
203 limit: Option<i64>,
204 },
205}