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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
use clap::{Args, Parser, Subcommand};
use clap_complete::aot::Shell;
use std::path::PathBuf;
#[derive(Debug, Parser)]
#[command(name = "devrig", version, about = "Local development orchestrator")]
pub struct Cli {
#[command(flatten)]
pub global: GlobalOpts,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Debug, Args)]
pub struct GlobalOpts {
/// Use a specific config file
#[arg(short = 'f', long = "file", global = true)]
pub config_file: Option<PathBuf>,
}
#[derive(Debug, Subcommand)]
pub enum Commands {
/// Start all services
Start {
/// Specific services to start (start all if empty)
services: Vec<String>,
/// Start Vite dev server for dashboard hot-reload
#[cfg(debug_assertions)]
#[arg(long, hide = true)]
dev: bool,
},
/// Stop the whole project (all services run under one supervisor)
Stop {
/// Not supported: services cannot be stopped individually
#[arg(hide = true)]
services: Vec<String>,
/// Stop all running devrig instances
#[arg(long)]
all: bool,
},
/// Stop and remove all resources
Delete {
/// Delete all running devrig instances
#[arg(long)]
all: bool,
},
/// Show service status
Ps {
/// Show all running devrig instances
#[arg(long)]
all: bool,
},
/// Generate a starter devrig.toml
Init,
/// Check that dependencies are installed
Doctor,
/// Show resolved environment variables for a service
Env {
/// Service name to show env for
service: String,
},
/// Execute a command in a docker container
Exec {
/// Docker service name
docker: String,
/// Command to execute
#[arg(last = true)]
command: Vec<String>,
},
/// Reset init-completed flag for a docker service
Reset {
/// Docker service name
docker: String,
},
/// Validate the configuration file
Validate,
/// Show and filter service logs
Logs {
/// Services to show logs for (all if empty)
services: Vec<String>,
/// Follow log output (live tail)
#[arg(short = 'F', long)]
follow: bool,
/// Show last N lines
#[arg(long)]
tail: Option<usize>,
/// Show logs since duration (e.g. "5m", "1h")
#[arg(long)]
since: Option<String>,
/// Include only lines matching regex
#[arg(short = 'g', long)]
grep: Option<String>,
/// Exclude lines matching regex
#[arg(short = 'v', long)]
exclude: Option<String>,
/// Minimum log level (trace, debug, info, warn, error)
#[arg(short = 'l', long)]
level: Option<String>,
/// Output format: text or json
#[arg(long, default_value = "text")]
format: String,
/// Write output to file
#[arg(short = 'o', long)]
output: Option<PathBuf>,
/// Show timestamps
#[arg(short = 't', long)]
timestamps: bool,
},
/// Generate shell completions
Completions {
/// Shell to generate completions for
#[arg(value_enum)]
shell: Shell,
},
/// Manage the k3d cluster
Cluster {
#[command(subcommand)]
command: ClusterCommands,
},
/// Proxy to kubectl with devrig's isolated kubeconfig
#[command(name = "kubectl", alias = "k")]
Kubectl {
/// Arguments passed to kubectl
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Query telemetry data from the OTel collector
Query {
#[command(subcommand)]
command: QueryCommands,
},
/// Update devrig to the latest version
Update,
/// Manage the devrig Claude Code skill
Skill {
#[command(subcommand)]
command: SkillCommands,
},
}
#[derive(Debug, Subcommand)]
pub enum QueryCommands {
/// List traces
Traces {
/// Filter by service name
#[arg(short, long)]
service: Option<String>,
/// Filter by status (ok, error)
#[arg(long)]
status: Option<String>,
/// Minimum duration in milliseconds
#[arg(long)]
min_duration: Option<u64>,
/// Show traces from the last duration (e.g. "5m", "1h")
#[arg(long)]
last: Option<String>,
/// Max results to return
#[arg(short = 'n', long, default_value = "20")]
limit: usize,
/// Output format: table, json, jsonl
#[arg(long, alias = "output")]
format: Option<String>,
},
/// Get details for a specific trace
Trace {
/// Trace ID (full or prefix)
trace_id: String,
/// Output format: table, json, jsonl
#[arg(long, alias = "output")]
format: Option<String>,
},
/// Query logs from the OTel collector
Logs {
/// Filter by service name
#[arg(short, long)]
service: Option<String>,
/// Minimum severity (trace, debug, info, warn, error, fatal)
#[arg(short = 'l', long, alias = "severity")]
level: Option<String>,
/// Search text in log body
#[arg(short = 'g', long)]
search: Option<String>,
/// Filter by trace ID
#[arg(long)]
trace_id: Option<String>,
/// Show logs from the last duration (e.g. "5m", "1h")
#[arg(long)]
last: Option<String>,
/// Max results to return
#[arg(short = 'n', long, default_value = "50")]
limit: usize,
/// Output format: table, json, jsonl
#[arg(long, alias = "output")]
format: Option<String>,
},
/// Query metrics from the OTel collector
Metrics {
/// Filter by metric name
#[arg(short = 'm', long)]
name: Option<String>,
/// Filter by service name
#[arg(short, long)]
service: Option<String>,
/// Show metrics from the last duration (e.g. "5m", "1h")
#[arg(long)]
last: Option<String>,
/// Max results to return
#[arg(short = 'n', long, default_value = "50")]
limit: usize,
/// Output format: table, json, jsonl
#[arg(long, alias = "output")]
format: Option<String>,
},
/// Show OTel collector status
Status {
/// Output format: table, json
#[arg(long, alias = "output")]
format: Option<String>,
},
/// Get related telemetry for a trace (logs and metrics from the same services)
Related {
/// Trace ID to find related telemetry for
trace_id: String,
/// Output format: table, json, jsonl
#[arg(long, alias = "output")]
format: Option<String>,
},
}
#[derive(Debug, Subcommand)]
pub enum SkillCommands {
/// Install the devrig skill for Claude Code
Install {
/// Install globally to ~/.claude/skills/ instead of project-local
#[arg(long)]
global: bool,
},
/// Print the full configuration reference
Reference,
}
#[derive(Debug, Subcommand)]
pub enum ClusterCommands {
/// Create the k3d cluster
Create,
/// Delete the k3d cluster
Delete,
/// Print path to devrig's isolated kubeconfig
Kubeconfig,
/// Rebuild and re-push all cluster images with --no-cache for a completely fresh build
Rebuild {
/// Names of images/deploys to rebuild (omit to rebuild all)
#[arg(value_name = "IMAGE")]
images: Vec<String>,
/// Skip re-applying Kubernetes manifests and rollout restart for deploy entries
#[arg(long)]
no_apply: bool,
},
}