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
use std::path::PathBuf;
use clap::{Args, Parser, Subcommand};
#[derive(Parser)]
#[command(name = "greentic-flow-builder")]
#[command(version)]
#[command(about = "AI-powered Adaptive Card flow builder with visual graph editor", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Render data into an Adaptive Card using a template/preset.
Render(RenderArgs),
/// List available presets grouped by category.
List(ListArgs),
/// Print the JSON Schema for a preset's expected data.
Schema(SchemaArgs),
/// Validate data against a preset's schema without rendering.
Validate(ValidateArgs),
/// Launch the web UI with LLM-powered card generation.
Ui(UiArgs),
}
#[derive(Args, Debug)]
pub struct RenderArgs {
/// Preset name (e.g., "menu-card").
#[arg(short, long)]
pub preset: Option<String>,
/// Legacy alias for --preset.
#[arg(long, hide = true)]
pub template: Option<String>,
/// Theme name (default: "default").
#[arg(long)]
pub theme: Option<String>,
/// JSON data file path, or "-" for stdin.
#[arg(short, long)]
pub data: Option<PathBuf>,
/// Inline JSON data string.
#[arg(long)]
pub data_json: Option<String>,
/// Output file path (default: stdout).
#[arg(short, long)]
pub output: Option<PathBuf>,
/// External template pack (path or URL). Can be specified multiple times.
#[arg(long = "template-pack")]
pub template_pack: Vec<PathBuf>,
/// Fail on missing data fields instead of using empty defaults.
#[arg(long)]
pub strict: bool,
/// Output compact JSON instead of pretty-printed.
#[arg(long)]
pub compact: bool,
}
#[derive(Args, Debug)]
pub struct ListArgs {
/// Filter by category.
#[arg(short, long)]
pub category: Option<String>,
/// Output as JSON array.
#[arg(long)]
pub json: bool,
/// External template pack (path or URL).
#[arg(long = "template-pack")]
pub template_pack: Vec<PathBuf>,
}
#[derive(Args, Debug)]
pub struct SchemaArgs {
/// Preset name.
#[arg(short, long)]
pub template: String,
/// External template pack (path or URL).
#[arg(long = "template-pack")]
pub template_pack: Vec<PathBuf>,
}
#[derive(Args, Debug)]
pub struct ValidateArgs {
/// Preset name.
#[arg(short, long)]
pub template: String,
/// JSON data file path, or "-" for stdin.
#[arg(short, long)]
pub data: Option<PathBuf>,
/// Inline JSON data string.
#[arg(long)]
pub data_json: Option<String>,
/// External template pack (path or URL).
#[arg(long = "template-pack")]
pub template_pack: Vec<PathBuf>,
}
#[derive(Args, Debug)]
pub struct UiArgs {
/// OpenAI API key for LLM-powered card generation.
#[arg(long, env = "OPENAI_API_KEY")]
pub openai_api_key: String,
/// Port to listen on (default: random available port).
#[arg(long)]
pub port: Option<u16>,
/// OpenAI model to use.
#[arg(long, default_value = "gpt-4o-mini")]
pub model: String,
/// External template pack (path or URL). Can be specified multiple times.
#[arg(long = "template-pack")]
pub template_pack: Vec<PathBuf>,
}