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 /// Builds, verifies, signs, and atomically publishes a live hot-update release from a `.json` UI spec, `.wasm` binary, or inline `--title` in one command.
281 Push {
282 /// Local update store root directory.
283 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
284 store: PathBuf,
285 /// Logical project identifier.
286 #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
287 project: String,
288 /// Release channel name.
289 #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
290 channel: String,
291 /// Optional target route path to update (defaults to `"/dynamic-panel"` when neither `--route` nor `--slot` is specified).
292 #[arg(long)]
293 route: Option<String>,
294 /// Optional component slot identifier to update (defaults to `"promo_banner"` when neither `--route` nor `--slot` is specified).
295 #[arg(long)]
296 slot: Option<String>,
297 /// Path to a JSON `DynamicNodeSpec` or compiled `.wasm` artifact file.
298 #[arg(long)]
299 file: Option<PathBuf>,
300 /// Optional inline card title generating a ready-to-push declarative or WASM update.
301 #[arg(long)]
302 title: Option<String>,
303 /// Optional body copy paired with `--title` for quick live OTA updates.
304 #[arg(long)]
305 body: Option<String>,
306 /// Generate a genuine `.wasm` module binary when using `--title` instead of declarative JSON.
307 #[arg(long, default_value_t = false)]
308 wasm_widget: bool,
309 /// Optional RGB hex accent color (e.g. `0x16A34A` or `16A34A`) when using `--title`.
310 #[arg(long)]
311 accent_hex: Option<String>,
312 /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
313 #[arg(long)]
314 signing_key: Option<String>,
315 /// Environment variable name holding the offline signing secret.
316 #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
317 signing_key_env: String,
318 },
319 /// Watches a `.json` UI spec or `.wasm` artifact file and automatically pushes signed live hot-update releases whenever it changes.
320 Watch {
321 /// Local update store root directory.
322 #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
323 store: PathBuf,
324 /// Logical project identifier.
325 #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
326 project: String,
327 /// Release channel name.
328 #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
329 channel: String,
330 /// Optional target route path to update.
331 #[arg(long)]
332 route: Option<String>,
333 /// Optional component slot identifier to update.
334 #[arg(long)]
335 slot: Option<String>,
336 /// Watched `.json` UI spec or `.wasm` binary file path.
337 #[arg(long)]
338 file: PathBuf,
339 /// File polling interval in milliseconds.
340 #[arg(long, default_value_t = DEFAULT_UPDATE_WATCH_POLL_MS)]
341 poll_ms: u64,
342 /// Perform a single verified push then exit immediately.
343 #[arg(long, default_value_t = false)]
344 once: bool,
345 /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
346 #[arg(long)]
347 signing_key: Option<String>,
348 /// Environment variable name holding the offline signing secret.
349 #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
350 signing_key_env: String,
351 },
352}
353
354/// Top-level `euv` CLI subcommands.
355#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
356pub enum Commands {
357 /// Runs an euv application for a target platform and render mode, with optional `--watch` hot reload.
358 Run {
359 /// Target platform to launch.
360 #[arg(long, value_enum, default_value_t = TargetArg::Native)]
361 target: TargetArg,
362 /// Optional HarmonyOS form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
363 #[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
364 form_factor: HarmonyFormFactorArg,
365 /// Rendering pipeline mode.
366 #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
367 render: RenderArg,
368 /// Build and run in release mode.
369 #[arg(long, default_value_t = false)]
370 release: bool,
371 /// Optional Cargo package name to run.
372 #[arg(long)]
373 package: Option<String>,
374 /// Enable file-watching hot reload and live OTA update serving.
375 #[arg(short = 'w', long, default_value_t = false)]
376 watch: bool,
377 /// HTTP hot-reload/OTA port when `--watch` is enabled.
378 #[arg(long, default_value_t = 8080)]
379 port: u16,
380 /// Print the execution plan without spawning Cargo.
381 #[arg(long, default_value_t = false)]
382 plan: bool,
383 },
384 /// Starts the hot-reload and Dynamic WASM OTA development server for Web, Native, Docs, Terminal, Harmony, Wearable, MiniApp, or QuickApp.
385 Dev {
386 /// Development pipeline target (`web`, `native`, `docs`, `tui`, `cli`, `harmony`, `wearable`, `miniapp`, `quickapp`).
387 #[arg(long, value_enum, default_value_t = DevTargetArg::Web)]
388 target: DevTargetArg,
389 /// Rendering pipeline mode default.
390 #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
391 render: RenderArg,
392 /// Build and serve in release mode when rebuilding Web or Native targets.
393 #[arg(long, default_value_t = false)]
394 release: bool,
395 /// Optional project root directory to watch (defaults to current directory).
396 #[arg(long)]
397 path: Option<PathBuf>,
398 /// Optional output directory for built bundles.
399 #[arg(long)]
400 out: Option<PathBuf>,
401 /// Optional Cargo package name to rebuild on changes.
402 #[arg(long)]
403 package: Option<String>,
404 /// Shared dev server bind, poll interval, and smoke-run flags.
405 #[command(flatten)]
406 server: ServerBindArgs,
407 /// Enable live Dynamic WASM OTA manifest + `.wasm` hot-update endpoint (`--ota=false` disables).
408 #[arg(long, default_value_t = true, num_args = 0..=1, default_missing_value = "true")]
409 ota: bool,
410 /// Print the structured dev server plan without spawning processes.
411 #[arg(long, default_value_t = false)]
412 plan: bool,
413 },
414 /// Manages the Hyperlane HTTP + SSE dynamic update server and atomic local release store (`serve`, `stage`, `publish`, `rollback`, `status`).
415 Update {
416 /// Dynamic update server or store management subcommand.
417 #[command(subcommand)]
418 action: UpdateAction,
419 },
420 /// Builds or live-serves a static documentation site from all `.md` files in a project.
421 Docs {
422 /// Optional `build` or `dev` subcommand (defaults to building all project `.md` files).
423 #[command(subcommand)]
424 action: Option<DocsAction>,
425 /// Shared source, output, title, and base URL flags.
426 #[command(flatten)]
427 build: DocsBuildArgs,
428 /// Enable live watch and SSE hot-reload dev server directly from `euv docs --watch`.
429 #[arg(short = 'w', long, default_value_t = false)]
430 watch: bool,
431 /// Shared dev server bind, poll interval, and smoke-run flags when `--watch` is active.
432 #[command(flatten)]
433 server: ServerBindArgs,
434 },
435 /// Builds native, terminal, wearable, HarmonyOS, Mini-Program, QuickApp, or Web bundles for one or all targets.
436 Build {
437 /// Target platform (or `all`).
438 #[arg(long, value_enum, default_value_t = TargetArg::Native)]
439 target: TargetArg,
440 /// Optional HarmonyOS device form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
441 #[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
442 form_factor: HarmonyFormFactorArg,
443 /// Rendering pipeline mode default.
444 #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
445 render: RenderArg,
446 /// Enable release optimization profile.
447 #[arg(long, default_value_t = false)]
448 release: bool,
449 /// Print structured JSON build plans without executing.
450 #[arg(long, default_value_t = false)]
451 plan: bool,
452 },
453 /// Checks Rust compilation across one or all cross-platform targets.
454 Check {
455 /// Check all supported platform targets in sequence.
456 #[arg(long, default_value_t = false)]
457 all_targets: bool,
458 /// Single target to check when `--all-targets` is omitted.
459 #[arg(long, value_enum, default_value_t = TargetArg::Native)]
460 target: TargetArg,
461 /// Optional Cargo package name to check.
462 #[arg(long)]
463 package: Option<String>,
464 /// Print the planned commands without running Cargo.
465 #[arg(long, default_value_t = false)]
466 plan: bool,
467 },
468 /// Runs unified `crate-cli` text/Rust formatting first, then normalizes indentation inside all `euv` macro blocks (`view!`, `style!`, etc.).
469 Fmt {
470 /// Verify formatting without modifying files.
471 #[arg(long, default_value_t = false)]
472 check: bool,
473 /// Optional root directory or file path (defaults to current directory).
474 #[arg(long)]
475 path: Option<PathBuf>,
476 /// Format only `euv` procedural macro bodies without invoking `crate-cli` or `cargo fmt`.
477 #[arg(long, default_value_t = false)]
478 macros_only: bool,
479 },
480 /// Inspects installed Rust targets, SDKs, and cross-platform tooling readiness.
481 Doctor {
482 /// Emit machine-readable JSON output.
483 #[arg(long, default_value_t = false)]
484 json: bool,
485 },
486 /// Scaffolds a new cross-platform euv native project.
487 New {
488 /// Name of the new project directory and crate.
489 name: String,
490 /// Optional parent directory (defaults to current working directory).
491 #[arg(long)]
492 path: Option<PathBuf>,
493 },
494}