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
use clap::{Args, Subcommand};
/// `harn guard` — manage downloadable on-device injection-detection models.
#[derive(Debug, Args)]
pub(crate) struct GuardArgs {
#[command(subcommand)]
pub command: GuardCommand,
}
#[derive(Debug, Subcommand)]
pub(crate) enum GuardCommand {
/// List installed models, and (with --catalog) the models available to install.
List(GuardListArgs),
/// Download and install a model from the catalog into `~/.harn/guard/`.
Install(GuardInstallArgs),
/// Show install status for a model (or all models).
Status(GuardStatusArgs),
/// Remove an installed model from `~/.harn/guard/`.
Remove(GuardRemoveArgs),
}
#[derive(Debug, Args)]
pub(crate) struct GuardListArgs {
/// Also list the models available to install from the built-in catalog.
#[arg(long)]
pub catalog: bool,
}
#[derive(Debug, Args)]
pub(crate) struct GuardInstallArgs {
/// Catalog model name to install. Defaults to the recommended model.
pub model: Option<String>,
/// Accept the model's upstream license. Required — nothing is downloaded
/// without it (the license text is printed for review first).
#[arg(long)]
pub accept_license: bool,
/// Re-download and overwrite an already-installed model.
#[arg(long)]
pub force: bool,
}
#[derive(Debug, Args)]
pub(crate) struct GuardStatusArgs {
/// Catalog model name. Omit to show every installed model.
pub model: Option<String>,
}
#[derive(Debug, Args)]
pub(crate) struct GuardRemoveArgs {
/// Catalog model name to remove.
pub model: String,
}