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
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(name = "vika-cli")]
#[command(version = "0.1.0")]
#[command(about = "Generate TypeScript clients from Swagger/OpenAPI specs")]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Initialize a new vika-cli project
Init,
/// Add a new spec to existing project
Add,
/// Generate TypeScript code from Swagger spec
Generate {
/// Path or URL to Swagger/OpenAPI spec (for single-spec mode)
#[arg(short, long)]
spec: Option<String>,
/// Generate all specs (for multi-spec mode)
#[arg(long)]
all_specs: bool,
/// Generate specific spec by name (for multi-spec mode)
#[arg(long)]
spec_name: Option<String>,
/// Enable verbose output
#[arg(long)]
verbose: bool,
/// Use cached spec if available (overrides config)
#[arg(long, action = clap::ArgAction::SetTrue)]
cache: bool,
/// Create backup before writing files (overrides config)
#[arg(long, action = clap::ArgAction::SetTrue)]
backup: bool,
/// Force overwrite user-modified files (overrides config)
#[arg(long, action = clap::ArgAction::SetTrue)]
force: bool,
/// Generate React Query hooks
#[arg(long, action = clap::ArgAction::SetTrue)]
react_query: bool,
/// Generate SWR hooks
#[arg(long, action = clap::ArgAction::SetTrue)]
swr: bool,
},
/// Update existing generated code
Update,
/// Inspect OpenAPI spec without generating code
Inspect {
/// Path or URL to Swagger/OpenAPI spec (for single-spec mode)
#[arg(short, long)]
spec: Option<String>,
/// Inspect all specs (for multi-spec mode)
#[arg(long)]
all_specs: bool,
/// Inspect specific spec by name (for multi-spec mode)
#[arg(long)]
spec_name: Option<String>,
/// Show details for specific module
#[arg(short, long)]
module: Option<String>,
/// Show schema details
#[arg(long)]
schemas: bool,
/// Show dependency graph
#[arg(long)]
graph: bool,
/// Output as JSON
#[arg(long)]
json: bool,
},
/// Manage templates
Templates {
#[command(subcommand)]
command: TemplateCommands,
},
}
#[derive(Subcommand)]
pub enum TemplateCommands {
/// List all available templates
List,
/// Initialize templates directory with built-in templates
Init,
}