summaryrefslogtreecommitdiff
path: root/makima/src/daemon/cli/directive.rs
blob: 8eded77932229edf2c8d388b87b9903ad1e579b8 (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
//! 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 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>,
}

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

    /// Memory key
    pub key: String,

    /// Memory value
    pub value: String,
}

/// Arguments for memory-get command.
#[derive(Args, Debug)]
pub struct MemoryGetArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Memory key
    pub key: String,
}

/// Arguments for memory-list command (uses DirectiveArgs directly).

/// Arguments for memory-delete command.
#[derive(Args, Debug)]
pub struct MemoryDeleteArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Memory key to delete
    pub key: String,
}

/// Arguments for memory-clear command (uses DirectiveArgs directly).

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

    /// JSON object of key-value pairs: {"key1":"value1","key2":"value2"}
    #[arg(long)]
    pub json: String,
}