euv_cli/args/enum.rs
1use super::*;
2
3/// CLI target selector covering all 36 supported euv platforms plus `native` and `all`.
4#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
5pub enum TargetArg {
6 /// Browser WebAssembly target (`wasm32-unknown-unknown`).
7 Web,
8 /// Android native NDK target (`aarch64-linux-android`).
9 Android,
10 /// iOS native UIKit/Metal target (`aarch64-apple-ios`).
11 Ios,
12 /// iPadOS native UIKit/Metal target (`aarch64-apple-ios`).
13 Ipad,
14 /// macOS native AppKit/Metal target (`aarch64-apple-darwin` / `x86_64-apple-darwin`).
15 Macos,
16 /// Windows native Win32/D3D12 target (`x86_64-pc-windows-msvc` / `aarch64-pc-windows-msvc`).
17 Windows,
18 /// Linux native Wayland/X11/Vulkan target (`x86_64-unknown-linux-gnu` / `aarch64-unknown-linux-gnu`).
19 Linux,
20 /// Interactive PTY Terminal UI target.
21 Tui,
22 /// Non-interactive static/pipe CLI terminal target.
23 Cli,
24 /// Google/Samsung Wear OS smartwatch target.
25 Wearos,
26 /// Apple watchOS smartwatch target.
27 Watchos,
28 /// Huawei HarmonyOS Watch wearable target.
29 #[value(name = "harmony-wearable")]
30 HarmonyWearable,
31 /// Xiaomi HyperOS / Vela Watch wearable target.
32 Vela,
33 /// vivo BlueOS Watch smartwatch target (`blueos` / `vivo`).
34 #[value(name = "vivo-watch", alias = "blueos", alias = "vivo")]
35 VivoWatch,
36 /// OPPO ColorOS Watch / Wear OS dual-engine smartwatch target.
37 #[value(name = "oppo-watch", alias = "oppo")]
38 OppoWatch,
39 /// Garmin Connect IQ smartwatch target.
40 #[value(name = "garmin")]
41 Garmin,
42 /// Amazfit Zepp OS smartwatch target.
43 #[value(name = "zeppos", alias = "amazfit")]
44 Zeppos,
45 /// Generic smart wearable target building all supported smartwatch ecosystems.
46 Wearable,
47 /// HarmonyOS / OpenHarmony multi-form-factor native target (phone/tablet/pc/foldable/tv/car).
48 Harmony,
49 /// HarmonyOS PC / 2-in-1 desktop native target (`harmony-pc` / `harmony-2in1`).
50 #[value(name = "harmony-pc", alias = "harmony-2in1")]
51 HarmonyPc,
52 /// WeChat Mini-Program target (`wx`).
53 Wechat,
54 /// Alipay Mini-Program target (`my`).
55 Alipay,
56 /// Douyin / ByteDance Mini-Program target (`tt`).
57 Douyin,
58 /// Baidu Smart Mini-Program target (`swan`).
59 Baidu,
60 /// QQ Mini-Program target (`qq`).
61 Qq,
62 /// Kuaishou Mini-Program target (`ks`).
63 Kuaishou,
64 /// JD Mini-Program target (`jd`).
65 #[value(name = "jd", alias = "jingdong")]
66 Jd,
67 /// Xiaohongshu Mini-Program target (`xhs`).
68 #[value(name = "xhs", alias = "xiaohongshu")]
69 Xhs,
70 /// DingTalk Mini-Program target (`dd`).
71 #[value(name = "dingtalk", alias = "dd")]
72 Dingtalk,
73 /// Feishu / Lark Mini-Program target (`tt`).
74 #[value(name = "feishu", alias = "lark")]
75 Feishu,
76 /// Taobao Mini-Program target (`my`).
77 #[value(name = "taobao", alias = "tb")]
78 Taobao,
79 /// Meituan Mini-Program target (`mt`).
80 #[value(name = "meituan", alias = "mt")]
81 Meituan,
82 /// HarmonyOS Atomic Service target (`atomic`).
83 #[value(name = "harmony-atomic")]
84 HarmonyAtomic,
85 /// QuickApp Alliance / Huawei QuickApp unified target.
86 Quickapp,
87 /// QuickApp Alliance (`@system.*` OEM distribution) target.
88 #[value(name = "quickapp-alliance")]
89 QuickappAlliance,
90 /// Huawei QuickApp (`@system.*` + `@service.*`) target.
91 #[value(name = "quickapp-huawei")]
92 QuickappHuawei,
93 /// Current host native target.
94 Native,
95 /// Every supported euv platform.
96 All,
97}
98
99/// Optional HarmonyOS / OpenHarmony device form factor selector for `euv build --target harmony`.
100#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
101pub enum HarmonyFormFactorArg {
102 /// HarmonyOS phone device profile.
103 #[default]
104 Phone,
105 /// HarmonyOS tablet device profile.
106 Tablet,
107 /// HarmonyOS PC / 2-in-1 desktop device profile.
108 Pc,
109 /// HarmonyOS foldable display device profile.
110 Foldable,
111 /// HarmonyOS smart TV / Vision device profile.
112 Tv,
113 /// HarmonyOS automotive / cockpit device profile.
114 Car,
115 /// HarmonyOS smartwatch wearable device profile.
116 Wearable,
117}
118
119/// CLI render pipeline mode selector.
120#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
121pub enum RenderArg {
122 /// Automatically prefer hardware GPU with software fallback.
123 Auto,
124 /// Deterministic software CPU rasterizer.
125 Software,
126 /// Native GPU instanced pipeline.
127 Hardware,
128 /// Hybrid CPU vector + GPU texture compositor.
129 Hybrid,
130}
131
132/// Target mode for the `euv dev` hot-reload and OTA development server.
133#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
134pub enum DevTargetArg {
135 /// Build and live-reload all project Markdown documentation pages.
136 Docs,
137 /// Build and live-reload WebAssembly zero-JS bundles plus Dynamic WASM OTA feed.
138 Web,
139 /// Watch Rust sources, rebuild, hot-restart the native app, and serve Dynamic WASM OTA updates.
140 Native,
141 /// Watch Rust sources and relaunch interactive PTY Terminal UI builds.
142 Tui,
143 /// Watch Rust sources and rerun static/pipe CLI terminal builds.
144 Cli,
145 /// Watch Rust sources and rebuild HarmonyOS HAP bundles.
146 Harmony,
147 /// Watch Rust sources and rebuild wearable smartwatch bundles.
148 Wearable,
149 /// Watch Rust sources and rebuild Mini-Program bundles.
150 Miniapp,
151 /// Watch Rust sources and rebuild QuickApp bundles.
152 Quickapp,
153}
154
155/// Subcommands under `euv docs` for building or live-serving project Markdown documentation.
156#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
157pub enum DocsAction {
158 /// Builds all Markdown files under a project or docs directory into a static site.
159 Build {
160 /// Shared source, output, title, and base URL flags.
161 #[command(flatten)]
162 build: DocsBuildArgs,
163 },
164 /// Builds and serves Markdown documentation with live file-watching and SSE hot reload.
165 Dev {
166 /// Shared source, output, title, and base URL flags.
167 #[command(flatten)]
168 build: DocsBuildArgs,
169 /// Shared dev server bind, poll interval, and smoke-run flags.
170 #[command(flatten)]
171 server: ServerBindArgs,
172 },
173}
174
175/// Subcommands under `euv update` for operating the Hyperlane HTTP + SSE dynamic update server and local store.
176#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
177pub enum UpdateAction {
178 /// Starts the read-only Hyperlane HTTP + SSE dynamic update server backed by the local store directory.
179 Serve {
180 /// Local update store root directory (`staging/`, `blobs/`, `releases/`, `channels/`, `state/`).
181 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
182 store: PathBuf,
183 /// Host bind address.
184 #[arg(long, default_value = DEFAULT_UPDATE_SERVER_HOST)]
185 host: String,
186 /// TCP listen port (`0` selects an ephemeral port).
187 #[arg(long, default_value_t = DEFAULT_UPDATE_SERVER_PORT)]
188 port: u16,
189 /// Optional external reverse-proxy base URL (e.g. `https://ota.example.com/euv`).
190 #[arg(long)]
191 proxy_base: Option<String>,
192 /// SSE keep-alive heartbeat interval in milliseconds.
193 #[arg(long, default_value_t = DEFAULT_UPDATE_HEARTBEAT_MS)]
194 heartbeat_ms: u64,
195 /// Background channel pointer watcher polling interval in milliseconds.
196 #[arg(long, default_value_t = DEFAULT_UPDATE_WATCH_POLL_MS)]
197 poll_ms: u64,
198 /// Validate store layout and server bind readiness then exit immediately.
199 #[arg(long, default_value_t = false)]
200 once: bool,
201 /// Print the structured server configuration without binding sockets.
202 #[arg(long, default_value_t = false)]
203 plan: bool,
204 },
205 /// Stages and SHA-256-verifies a release manifest and its blobs into `staging/<stage_id>/`.
206 Stage {
207 /// Local update store root directory.
208 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
209 store: PathBuf,
210 /// Logical project identifier.
211 #[arg(long)]
212 project: String,
213 /// Release channel name (e.g. `prod`).
214 #[arg(long)]
215 channel: String,
216 /// Unique stage identifier name.
217 #[arg(long)]
218 stage_id: String,
219 /// Path to the draft JSON `ReleaseManifest` file.
220 #[arg(long)]
221 manifest: PathBuf,
222 /// Directory containing built artifact blobs referenced by `manifest`.
223 #[arg(long)]
224 blobs_dir: PathBuf,
225 },
226 /// Atomically signs and publishes a staged release with a strictly monotonic sequence number.
227 Publish {
228 /// Local update store root directory.
229 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
230 store: PathBuf,
231 /// Logical project identifier.
232 #[arg(long)]
233 project: String,
234 /// Release channel name.
235 #[arg(long)]
236 channel: String,
237 /// Previously staged directory name under `staging/`.
238 #[arg(long)]
239 stage_id: String,
240 /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
241 #[arg(long)]
242 signing_key: Option<String>,
243 /// Environment variable name holding the offline signing secret.
244 #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
245 signing_key_env: String,
246 },
247 /// Signs a NEW monotonic release pointing back to a historical release's verified blobs (never replaying old manifests).
248 Rollback {
249 /// Local update store root directory.
250 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
251 store: PathBuf,
252 /// Logical project identifier.
253 #[arg(long)]
254 project: String,
255 /// Release channel name.
256 #[arg(long)]
257 channel: String,
258 /// Historical release sequence whose verified artifacts should be restored.
259 #[arg(long)]
260 to_release: u64,
261 /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
262 #[arg(long)]
263 signing_key: Option<String>,
264 /// Environment variable name holding the offline signing secret.
265 #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
266 signing_key_env: String,
267 },
268 /// Inspects active channel pointers, release counts, and content-addressed blob inventory in a local update store.
269 Status {
270 /// Local update store root directory.
271 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
272 store: PathBuf,
273 /// Optional project filter.
274 #[arg(long)]
275 project: Option<String>,
276 /// Optional channel filter.
277 #[arg(long)]
278 channel: Option<String>,
279 },
280}
281
282/// Top-level `euv` CLI subcommands.
283#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
284pub enum Commands {
285 /// Runs an euv application for a target platform and render mode, with optional `--watch` hot reload.
286 Run {
287 /// Target platform to launch.
288 #[arg(long, value_enum, default_value_t = TargetArg::Native)]
289 target: TargetArg,
290 /// Optional HarmonyOS form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
291 #[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
292 form_factor: HarmonyFormFactorArg,
293 /// Rendering pipeline mode.
294 #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
295 render: RenderArg,
296 /// Build and run in release mode.
297 #[arg(long, default_value_t = false)]
298 release: bool,
299 /// Optional Cargo package name to run.
300 #[arg(long)]
301 package: Option<String>,
302 /// Enable file-watching hot reload and live OTA update serving.
303 #[arg(short = 'w', long, default_value_t = false)]
304 watch: bool,
305 /// HTTP hot-reload/OTA port when `--watch` is enabled.
306 #[arg(long, default_value_t = 8080)]
307 port: u16,
308 /// Print the execution plan without spawning Cargo.
309 #[arg(long, default_value_t = false)]
310 plan: bool,
311 },
312 /// Starts the hot-reload and Dynamic WASM OTA development server for Web, Native, Docs, Terminal, Harmony, Wearable, MiniApp, or QuickApp.
313 Dev {
314 /// Development pipeline target (`web`, `native`, `docs`, `tui`, `cli`, `harmony`, `wearable`, `miniapp`, `quickapp`).
315 #[arg(long, value_enum, default_value_t = DevTargetArg::Web)]
316 target: DevTargetArg,
317 /// Rendering pipeline mode default.
318 #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
319 render: RenderArg,
320 /// Build and serve in release mode when rebuilding Web or Native targets.
321 #[arg(long, default_value_t = false)]
322 release: bool,
323 /// Optional project root directory to watch (defaults to current directory).
324 #[arg(long)]
325 path: Option<PathBuf>,
326 /// Optional output directory for built bundles.
327 #[arg(long)]
328 out: Option<PathBuf>,
329 /// Optional Cargo package name to rebuild on changes.
330 #[arg(long)]
331 package: Option<String>,
332 /// Shared dev server bind, poll interval, and smoke-run flags.
333 #[command(flatten)]
334 server: ServerBindArgs,
335 /// Enable live Dynamic WASM OTA manifest + `.wasm` hot-update endpoint (`--ota=false` disables).
336 #[arg(long, default_value_t = true, num_args = 0..=1, default_missing_value = "true")]
337 ota: bool,
338 /// Print the structured dev server plan without spawning processes.
339 #[arg(long, default_value_t = false)]
340 plan: bool,
341 },
342 /// Manages the Hyperlane HTTP + SSE dynamic update server and atomic local release store (`serve`, `stage`, `publish`, `rollback`, `status`).
343 Update {
344 /// Dynamic update server or store management subcommand.
345 #[command(subcommand)]
346 action: UpdateAction,
347 },
348 /// Builds or live-serves a static documentation site from all `.md` files in a project.
349 Docs {
350 /// Optional `build` or `dev` subcommand (defaults to building all project `.md` files).
351 #[command(subcommand)]
352 action: Option<DocsAction>,
353 /// Shared source, output, title, and base URL flags.
354 #[command(flatten)]
355 build: DocsBuildArgs,
356 /// Enable live watch and SSE hot-reload dev server directly from `euv docs --watch`.
357 #[arg(short = 'w', long, default_value_t = false)]
358 watch: bool,
359 /// Shared dev server bind, poll interval, and smoke-run flags when `--watch` is active.
360 #[command(flatten)]
361 server: ServerBindArgs,
362 },
363 /// Builds native, terminal, wearable, HarmonyOS, Mini-Program, QuickApp, or Web bundles for one or all targets.
364 Build {
365 /// Target platform (or `all`).
366 #[arg(long, value_enum, default_value_t = TargetArg::Native)]
367 target: TargetArg,
368 /// Optional HarmonyOS device form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
369 #[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
370 form_factor: HarmonyFormFactorArg,
371 /// Rendering pipeline mode default.
372 #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
373 render: RenderArg,
374 /// Enable release optimization profile.
375 #[arg(long, default_value_t = false)]
376 release: bool,
377 /// Print structured JSON build plans without executing.
378 #[arg(long, default_value_t = false)]
379 plan: bool,
380 },
381 /// Checks Rust compilation across one or all cross-platform targets.
382 Check {
383 /// Check all supported platform targets in sequence.
384 #[arg(long, default_value_t = false)]
385 all_targets: bool,
386 /// Single target to check when `--all-targets` is omitted.
387 #[arg(long, value_enum, default_value_t = TargetArg::Native)]
388 target: TargetArg,
389 /// Optional Cargo package name to check.
390 #[arg(long)]
391 package: Option<String>,
392 /// Print the planned commands without running Cargo.
393 #[arg(long, default_value_t = false)]
394 plan: bool,
395 },
396 /// Runs unified `crate-cli` text/Rust formatting first, then normalizes indentation inside all `euv` macro blocks (`view!`, `style!`, etc.).
397 Fmt {
398 /// Verify formatting without modifying files.
399 #[arg(long, default_value_t = false)]
400 check: bool,
401 /// Optional root directory or file path (defaults to current directory).
402 #[arg(long)]
403 path: Option<PathBuf>,
404 /// Format only `euv` procedural macro bodies without invoking `crate-cli` or `cargo fmt`.
405 #[arg(long, default_value_t = false)]
406 macros_only: bool,
407 },
408 /// Inspects installed Rust targets, SDKs, and cross-platform tooling readiness.
409 Doctor {
410 /// Emit machine-readable JSON output.
411 #[arg(long, default_value_t = false)]
412 json: bool,
413 },
414 /// Scaffolds a new cross-platform euv native project.
415 New {
416 /// Name of the new project directory and crate.
417 name: String,
418 /// Optional parent directory (defaults to current working directory).
419 #[arg(long)]
420 path: Option<PathBuf>,
421 },
422}