summaryrefslogtreecommitdiff
path: root/makima/src/daemon/cli/directive.rs
blob: a2bb34b6d4c2150f921e2808663d266e0f193f3d (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
//! Directive CLI commands for autonomous goal-driven orchestration.
//!
//! Directives are top-level goals that the system works toward. Each directive
//! generates a chain of steps that are executed autonomously with configurable
//! guardrails.

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

/// Common arguments for directive commands requiring API access.
#[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,
}

/// Arguments for the `create` command.
#[derive(Args, Debug)]
pub struct CreateArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// The goal for the directive
    #[arg(short, long)]
    pub goal: String,

    /// Repository URL (optional)
    #[arg(short, long)]
    pub repository: Option<String>,

    /// Autonomy level: full_auto, guardrails, or manual
    #[arg(short, long, default_value = "guardrails")]
    pub autonomy: String,
}

/// Arguments for the `status` command.
#[derive(Args, Debug)]
pub struct StatusArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `list` command.
#[derive(Args, Debug)]
pub struct ListArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Filter by status (draft, planning, active, paused, completed, archived, failed)
    #[arg(long)]
    pub status: Option<String>,

    /// Limit number of results
    #[arg(long, default_value = "50")]
    pub limit: i32,
}

/// Arguments for the `steps` command.
#[derive(Args, Debug)]
pub struct StepsArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `events` command.
#[derive(Args, Debug)]
pub struct EventsArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,

    /// Limit number of events
    #[arg(long, default_value = "50")]
    pub limit: i32,
}

/// Arguments for the `approve` command.
#[derive(Args, Debug)]
pub struct ApproveArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,

    /// Approval ID
    pub approval_id: Uuid,

    /// Response message (optional)
    #[arg(short, long)]
    pub response: Option<String>,
}

/// Arguments for the `deny` command.
#[derive(Args, Debug)]
pub struct DenyArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,

    /// Approval ID
    pub approval_id: Uuid,

    /// Reason for denial (optional)
    #[arg(short, long)]
    pub reason: Option<String>,
}

/// Arguments for the `start` command.
#[derive(Args, Debug)]
pub struct StartArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `pause` command.
#[derive(Args, Debug)]
pub struct PauseArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `resume` command.
#[derive(Args, Debug)]
pub struct ResumeArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `stop` command.
#[derive(Args, Debug)]
pub struct StopArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `archive` command.
#[derive(Args, Debug)]
pub struct ArchiveArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,
}

/// Arguments for the `graph` command (ASCII DAG visualization).
#[derive(Args, Debug)]
pub struct GraphArgs {
    #[command(flatten)]
    pub common: DirectiveArgs,

    /// Directive ID
    pub directive_id: Uuid,

    /// Show step status in nodes
    #[arg(long)]
    pub with_status: bool,
}