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
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
/// Path to the pupoxide configuration directory (default: /etc/pupoxide)
#[arg(short, long, default_value = "/etc/pupoxide")]
pub config: PathBuf,
}
#[derive(Subcommand)]
pub enum Commands {
/// Apply a single manifest file locally
Run {
#[arg(short, long)]
file: PathBuf,
/// Path to the modules directory (optional)
#[arg(short, long)]
module_path: Option<PathBuf>,
/// Run in dry-run mode without making changes
#[arg(long, default_value = "false")]
dry_run: bool,
/// Show unchanged resources in the output
#[arg(long, default_value = "false")]
show_unchanged: bool,
},
/// Apply configuration from an environment locally
Apply {
#[arg(short, long)]
environment: String,
/// Run in dry-run mode without making changes
#[arg(long, default_value = "false")]
dry_run: bool,
/// Show unchanged resources in the output
#[arg(long, default_value = "false")]
show_unchanged: bool,
},
/// Manage the Pupoxide Master server
Master {
#[command(subcommand)]
action: MasterAction,
/// Path to the configuration directory
#[arg(short, long)]
config: Option<PathBuf>,
},
/// Start the Pupoxide Agent
Agent {
#[arg(short, long)]
server: String,
#[arg(short, long)]
node: String,
#[arg(short, long)]
environment: String,
/// Bootstrap agent with the master (submit CSR request)
#[arg(long, default_value = "false")]
bootstrap: bool,
/// Check bootstrap approval status (polls until approved)
#[arg(long, default_value = "false")]
check: bool,
/// Timeout for --check in seconds
#[arg(long, default_value = "600")]
check_timeout: u64,
/// Run in dry-run mode without making changes
#[arg(long, default_value = "false")]
dry_run: bool,
/// Show unchanged resources in the output
#[arg(long, default_value = "false")]
show_unchanged: bool,
/// Optional certificate directory
#[arg(short, long)]
cert_dir: Option<PathBuf>,
},
/// Visualize resource dependency graph for debugging
Graph {
/// Path to the manifest file
#[arg(short, long)]
file: PathBuf,
/// Path to modules directory
#[arg(short, long)]
module_path: Option<PathBuf>,
/// Show only specific resource types (file, directory, exec, meta)
#[arg(long, value_delimiter = ',')]
filter: Option<Vec<String>>,
/// Maximum depth to display
#[arg(long, default_value = "10")]
max_depth: usize,
/// Output style (ascii, mermaid)
#[arg(short, long, default_value = "ascii")]
style: String,
},
}
#[derive(Subcommand)]
pub enum MasterAction {
/// Start the Master server
Start {
#[arg(short, long, default_value = "8080")]
port: u16,
},
/// Sign certificate for a pending bootstrap request
Sign {
/// Node ID to approve
#[arg(short, long)]
node: String,
},
/// Reject a pending bootstrap request
Reject {
/// Node ID to reject
#[arg(short, long)]
node: String,
},
/// List pending bootstrap requests
List,
}