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
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "aiclient-api", about = "Unified AI gateway service")]
pub struct Cli {
#[command(subcommand)]
pub command: Command,
}
#[derive(Subcommand)]
pub enum Command {
/// Start the daemon
Start {
/// API port
#[arg(long, default_value = "9090")]
port: u16,
/// Bind address
#[arg(long, default_value = "127.0.0.1")]
host: String,
/// Run in foreground (don't daemonize)
#[arg(long)]
foreground: bool,
/// Protect API with bearer token
#[arg(long)]
api_key: Option<String>,
/// Log file path
#[arg(long)]
log_file: Option<String>,
},
/// Stop the daemon
Stop,
/// Restart the daemon
Restart,
/// Authentication management
Auth {
#[command(subcommand)]
action: AuthAction,
},
/// Show daemon status
Status,
/// Configuration management
Config {
#[command(subcommand)]
action: ConfigAction,
},
/// List available models
Models,
/// Provider management
Provider {
#[command(subcommand)]
action: ProviderAction,
},
/// Tail daemon logs
Logs {
/// Show last N lines
#[arg(long, default_value = "50")]
lines: usize,
/// Filter level
#[arg(long, default_value = "info")]
level: String,
},
/// Self-update from GitHub Releases
Update,
/// Stop daemon + remove config + remove binary
Uninstall,
}
#[derive(Subcommand)]
pub enum AuthAction {
/// Authenticate with GitHub Copilot
Copilot {
#[arg(long, default_value = "individual")]
account_type: String,
},
/// Authenticate with Kiro
Kiro {
/// IAM Identity Center start URL (for organization identity)
#[arg(long)]
start_url: Option<String>,
/// AWS region for OIDC endpoint
#[arg(long)]
region: Option<String>,
},
/// List authenticated providers
List,
/// Revoke a provider's tokens
Revoke { provider: String },
}
#[derive(Subcommand)]
pub enum ConfigAction {
/// Interactive configuration wizard
Init,
/// Show current config
Show,
/// Set a config value
Set { key: String, value: String },
/// Reload config from disk
Reload,
}
#[derive(Subcommand)]
pub enum ProviderAction {
/// Enable a provider
Enable { name: String },
/// Disable a provider
Disable { name: String },
}