summaryrefslogtreecommitdiff
path: root/makima/src/daemon/cli/directive.rs
blob: cc7b224d59ca9b045ab838fc65e40a0b6dc93ee9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
//! Directive subcommand - directive management commands for orchestrator tasks.

use clap::Args;
use uuid::Uuid;

/// Common arguments for directive commands.
#[derive(Args, Debug, Clone)]
pub struct DirectiveArgs {
    /// API URL
    #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp", global = true)]
    pub api_url: String,

    /// API key for authentication
    #[arg(long, env = "MAKIMA_API_KEY", global = true)]
    pub api_key: String,

    /// Directive ID
    #[arg(long, env = "MAKIMA_DIRECTIVE_ID", global = true)]
    pub directive_id: Uuid,
}

/// Arguments for listing directives (no directive_id required).
#[derive(Args, Debug, Clone)]
pub struct DirectiveListArgs {
    /// API URL
    #[arg(long, env = "MAKIMA_API_URL", default_value = "https://api.makima.jp", global = true)]
    pub api_url: String,

    /// API key for authentication
    #[arg(long, env = "MAKIMA_API_KEY", global = true)]
    pub api_key: String,
}

/// Arguments for add-step command.
#[derive(Args, Debug)]
pub struct AddStepArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Step name
    pub name: String,

    /// Step description
    #[arg(long)]
    pub description: Option<String>,

    /// Task plan for the step
    #[arg(long)]
    pub task_plan: Option<String>,

    /// Comma-separated UUIDs of dependency steps
    #[arg(long)]
    pub depends_on: Option<String>,

    /// Order index
    #[arg(long, default_value = "0")]
    pub order_index: i32,
}

/// Arguments for remove-step command.
#[derive(Args, Debug)]
pub struct RemoveStepArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Step ID to remove
    pub step_id: Uuid,
}

/// Arguments for set-deps command.
#[derive(Args, Debug)]
pub struct SetDepsArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Step ID to update
    pub step_id: Uuid,

    /// Comma-separated UUIDs of dependency steps
    pub depends_on: String,
}

/// Arguments for complete-step/fail-step/skip-step commands.
#[derive(Args, Debug)]
pub struct StepActionArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Step ID
    pub step_id: Uuid,
}

/// Arguments for update-goal command.
#[derive(Args, Debug)]
pub struct UpdateGoalArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// New goal text
    pub goal: String,
}

/// Arguments for batch-add-steps command.
#[derive(Args, Debug)]
pub struct BatchAddStepsArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// JSON array of steps: [{"name":"...","description":"...","taskPlan":"...","dependsOn":[],"orderIndex":0}]
    #[arg(long)]
    pub json: String,
}

/// Arguments for ask command (ask user a question from directive context).
#[derive(Args, Debug)]
pub struct AskArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// The question to ask
    #[arg(index = 1)]
    pub question: String,

    /// Optional choices (comma-separated)
    #[arg(long)]
    pub choices: Option<String>,

    /// Context about what this relates to
    #[arg(long)]
    pub context: Option<String>,

    /// Timeout in seconds (default: 3600 = 1 hour)
    #[arg(long, default_value = "3600")]
    pub timeout: i32,

    /// Block indefinitely until user responds (no timeout)
    #[arg(long, default_value = "false")]
    pub phaseguard: bool,

    /// Allow selecting multiple choices (response will be comma-separated)
    #[arg(long, default_value = "false")]
    pub multi_select: bool,

    /// Non-blocking mode - returns immediately without waiting for response
    #[arg(long, default_value = "false")]
    pub non_blocking: bool,

    /// Question type (general, phase_confirmation, contract_complete)
    #[arg(long, default_value = "general")]
    pub question_type: String,
}

/// Arguments for create-order command.
#[derive(Args, Debug)]
pub struct CreateOrderArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Order title
    #[arg(long)]
    pub title: String,

    /// Order description
    #[arg(long)]
    pub description: Option<String>,

    /// Priority: critical, high, medium, low, none
    #[arg(long, default_value = "medium")]
    pub priority: String,

    /// Order type: spike or chore only
    #[arg(long, default_value = "spike")]
    pub order_type: String,

    /// Comma-separated labels
    #[arg(long)]
    pub labels: Option<String>,
}

/// Arguments for update command.
#[derive(Args, Debug)]
pub struct UpdateArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// PR URL to store on the directive
    #[arg(long)]
    pub pr_url: Option<String>,

    /// PR branch name to store on the directive
    #[arg(long)]
    pub pr_branch: Option<String>,

    /// Status to set on the directive (e.g., completed, paused)
    #[arg(long)]
    pub status: Option<String>,
}