Skip to main content

euv_cli/args/
enum.rs

1use super::*;
2
3/// CLI target selector covering all 38 concrete euv targets plus target groups (`desktop`, `mobile`, `apple`, `terminal`, `harmony-all`, `wearables`, `miniapps`, `quickapps`, `native`, `all`).
4#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, 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 device target (`aarch64-apple-ios`).
11    Ios,
12    /// iOS Simulator UIKit/Metal target (`aarch64-apple-ios-sim`).
13    #[value(name = "ios-sim")]
14    IosSim,
15    /// iPadOS native UIKit/Metal device target (`aarch64-apple-ios`).
16    Ipad,
17    /// iPadOS Simulator UIKit/Metal target (`aarch64-apple-ios-sim`).
18    #[value(name = "ipad-sim")]
19    IpadSim,
20    /// macOS native AppKit/Metal target (`aarch64-apple-darwin` / `x86_64-apple-darwin`).
21    Macos,
22    /// Windows native Win32/D3D12 target (`x86_64-pc-windows-msvc` / `aarch64-pc-windows-msvc`).
23    Windows,
24    /// Linux native Wayland/X11/Vulkan target (`x86_64-unknown-linux-gnu` / `aarch64-unknown-linux-gnu`).
25    Linux,
26    /// Interactive PTY Terminal UI target.
27    Tui,
28    /// Non-interactive static/pipe CLI terminal target.
29    Cli,
30    /// Google/Samsung Wear OS smartwatch target.
31    Wearos,
32    /// Apple watchOS smartwatch target.
33    Watchos,
34    /// Huawei HarmonyOS Watch wearable target.
35    #[value(name = "harmony-wearable")]
36    HarmonyWearable,
37    /// Xiaomi HyperOS / Vela Watch wearable target.
38    Vela,
39    /// vivo BlueOS Watch smartwatch target (`blueos` / `vivo`).
40    #[value(name = "vivo-watch", alias = "blueos", alias = "vivo")]
41    VivoWatch,
42    /// OPPO ColorOS Watch / Wear OS dual-engine smartwatch target.
43    #[value(name = "oppo-watch", alias = "oppo")]
44    OppoWatch,
45    /// Garmin Connect IQ smartwatch target.
46    #[value(name = "garmin")]
47    Garmin,
48    /// Amazfit Zepp OS smartwatch target.
49    #[value(name = "zeppos", alias = "amazfit")]
50    Zeppos,
51    /// Generic smart wearable target building all supported smartwatch ecosystems.
52    Wearable,
53    /// HarmonyOS / OpenHarmony multi-form-factor native target (phone/tablet/pc/foldable/tv/car).
54    Harmony,
55    /// HarmonyOS PC / 2-in-1 desktop native target (`harmony-pc` / `harmony-2in1`).
56    #[value(name = "harmony-pc", alias = "harmony-2in1")]
57    HarmonyPc,
58    /// WeChat Mini-Program target (`wx`).
59    Wechat,
60    /// Alipay Mini-Program target (`my`).
61    Alipay,
62    /// Douyin / ByteDance Mini-Program target (`tt`).
63    Douyin,
64    /// Baidu Smart Mini-Program target (`swan`).
65    Baidu,
66    /// QQ Mini-Program target (`qq`).
67    Qq,
68    /// Kuaishou Mini-Program target (`ks`).
69    Kuaishou,
70    /// JD Mini-Program target (`jd`).
71    #[value(name = "jd", alias = "jingdong")]
72    Jd,
73    /// Xiaohongshu Mini-Program target (`xhs`).
74    #[value(name = "xhs", alias = "xiaohongshu")]
75    Xhs,
76    /// DingTalk Mini-Program target (`dd`).
77    #[value(name = "dingtalk", alias = "dd")]
78    Dingtalk,
79    /// Feishu / Lark Mini-Program target (`tt`).
80    #[value(name = "feishu", alias = "lark")]
81    Feishu,
82    /// Taobao Mini-Program target (`my`).
83    #[value(name = "taobao", alias = "tb")]
84    Taobao,
85    /// Meituan Mini-Program target (`mt`).
86    #[value(name = "meituan", alias = "mt")]
87    Meituan,
88    /// HarmonyOS Atomic Service target (`atomic`).
89    #[value(name = "harmony-atomic")]
90    HarmonyAtomic,
91    /// QuickApp Alliance / Huawei QuickApp unified target.
92    Quickapp,
93    /// QuickApp Alliance (`@system.*` OEM distribution) target.
94    #[value(name = "quickapp-alliance")]
95    QuickappAlliance,
96    /// Huawei QuickApp (`@system.*` + `@service.*`) target.
97    #[value(name = "quickapp-huawei")]
98    QuickappHuawei,
99    /// Target group expanding to `macos`, `windows`, and `linux`.
100    Desktop,
101    /// Target group expanding to `android`, `ios`, `ipad`, `ios-sim`, `ipad-sim`, and `harmony`.
102    Mobile,
103    /// Target group expanding to `macos`, `ios`, `ipad`, `ios-sim`, `ipad-sim`, and `watchos`.
104    Apple,
105    /// Target group expanding to `tui` and `cli`.
106    Terminal,
107    /// Target group expanding to `harmony`, `harmony-pc`, `harmony-wearable`, and `harmony-atomic`.
108    #[value(name = "harmony-all")]
109    HarmonyAll,
110    /// Target group expanding to all 9 wearable targets.
111    Wearables,
112    /// Target group expanding to all 13 Mini-Program targets.
113    Miniapps,
114    /// Target group expanding to all 3 QuickApp targets.
115    Quickapps,
116    /// Current host native target.
117    Native,
118    /// Every supported production euv platform (36 targets).
119    All,
120}
121
122/// Optional HarmonyOS / OpenHarmony device form factor selector for `euv build --target harmony`.
123#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
124pub enum HarmonyFormFactorArg {
125    /// HarmonyOS phone device profile.
126    #[default]
127    Phone,
128    /// HarmonyOS tablet device profile.
129    Tablet,
130    /// HarmonyOS PC / 2-in-1 desktop device profile.
131    Pc,
132    /// HarmonyOS foldable display device profile.
133    Foldable,
134    /// HarmonyOS smart TV / Vision device profile.
135    Tv,
136    /// HarmonyOS automotive / cockpit device profile.
137    Car,
138    /// HarmonyOS smartwatch wearable device profile.
139    Wearable,
140}
141
142/// CLI render pipeline mode selector.
143#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
144pub enum RenderArg {
145    /// Automatically prefer hardware GPU with software fallback.
146    Auto,
147    /// Deterministic software CPU rasterizer.
148    Software,
149    /// Native GPU instanced pipeline.
150    Hardware,
151    /// Hybrid CPU vector + GPU texture compositor.
152    Hybrid,
153}
154
155/// Target mode for the `euv dev` hot-reload and OTA development server.
156#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
157pub enum DevTargetArg {
158    /// Build and live-reload all project Markdown documentation pages.
159    Docs,
160    /// Build and live-reload WebAssembly zero-JS bundles plus Dynamic WASM OTA feed.
161    Web,
162    /// Watch Rust sources, rebuild, hot-restart the native app, and serve Dynamic WASM OTA updates.
163    Native,
164    /// Watch Rust sources and relaunch interactive PTY Terminal UI builds.
165    Tui,
166    /// Watch Rust sources and rerun static/pipe CLI terminal builds.
167    Cli,
168    /// Watch Rust sources and rebuild HarmonyOS HAP bundles.
169    Harmony,
170    /// Watch Rust sources and rebuild wearable smartwatch bundles.
171    Wearable,
172    /// Watch Rust sources and rebuild Mini-Program bundles.
173    Miniapp,
174    /// Watch Rust sources and rebuild QuickApp bundles.
175    Quickapp,
176}
177
178/// Project scaffolding template selector for `euv new --template`.
179#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
180pub enum ProjectTemplateArg {
181    /// Cross-platform native + Web Rust UI application (`src/main.rs` + `src/lib.rs` + `euv.toml`).
182    #[default]
183    App,
184    /// WebAssembly zero-JS browser application (`cdylib` + `wasm-bindgen` entry + `euv.toml`).
185    Web,
186    /// Hot-updatable Dynamic WASM widget crate exporting `euv_abi_version` and `euv_render`.
187    #[value(name = "dynamic-widget")]
188    DynamicWidget,
189    /// Multi-locale VuePress-style Markdown documentation site configured for `euv docs`.
190    Docs,
191}
192
193/// Shell type selector for `euv completions <shell>`.
194#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
195pub enum ShellKindArg {
196    /// Bourne Again SHell completion script.
197    Bash,
198    /// Z shell completion function (`_euv`).
199    Zsh,
200    /// Friendly Interactive Shell completion rules.
201    Fish,
202    /// PowerShell `Register-ArgumentCompleter` script.
203    #[value(name = "powershell", alias = "pwsh")]
204    Powershell,
205}
206
207/// Subcommands under `euv docs` for building or live-serving project Markdown documentation.
208#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
209pub enum DocsAction {
210    /// Builds all Markdown files under a project or docs directory into a static or WASM site.
211    Build {
212        /// Shared source, output, title, base URL, and WASM build flags.
213        #[command(flatten)]
214        build: DocsBuildArgs,
215    },
216    /// Builds and serves Markdown documentation with live file-watching and SSE hot reload.
217    Dev {
218        /// Shared source, output, title, base URL, and WASM build flags.
219        #[command(flatten)]
220        build: DocsBuildArgs,
221        /// Shared dev server bind, poll interval, and smoke-run flags.
222        #[command(flatten)]
223        server: ServerBindArgs,
224    },
225}
226
227/// Subcommands under `euv update` for operating the Hyperlane HTTP + SSE dynamic update server and local store.
228#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
229pub enum UpdateAction {
230    /// Starts the read-only Hyperlane HTTP + SSE dynamic update server backed by the local store directory.
231    Serve {
232        /// Local update store root directory (`staging/`, `blobs/`, `releases/`, `channels/`, `state/`).
233        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
234        store: PathBuf,
235        /// Host bind address.
236        #[arg(long, default_value = DEFAULT_UPDATE_SERVER_HOST)]
237        host: String,
238        /// TCP listen port (`0` selects an ephemeral port).
239        #[arg(long, default_value_t = DEFAULT_UPDATE_SERVER_PORT)]
240        port: u16,
241        /// Optional external reverse-proxy base URL (e.g. `https://ota.example.com/euv`).
242        #[arg(long)]
243        proxy_base: Option<String>,
244        /// SSE keep-alive heartbeat interval in milliseconds.
245        #[arg(long, default_value_t = DEFAULT_UPDATE_HEARTBEAT_MS)]
246        heartbeat_ms: u64,
247        /// Background channel pointer watcher polling interval in milliseconds.
248        #[arg(long, default_value_t = DEFAULT_UPDATE_WATCH_POLL_MS)]
249        poll_ms: u64,
250        /// Validate store layout and server bind readiness then exit immediately.
251        #[arg(long, default_value_t = false)]
252        once: bool,
253        /// Print the structured server configuration without binding sockets.
254        #[arg(long, default_value_t = false)]
255        plan: bool,
256    },
257    /// Stages and SHA-256-verifies a release manifest and its blobs into `staging/<stage_id>/`.
258    Stage {
259        /// Local update store root directory.
260        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
261        store: PathBuf,
262        /// Logical project identifier.
263        #[arg(long)]
264        project: String,
265        /// Release channel name (e.g. `prod`).
266        #[arg(long)]
267        channel: String,
268        /// Unique stage identifier name.
269        #[arg(long)]
270        stage_id: String,
271        /// Path to the draft JSON `ReleaseManifest` file.
272        #[arg(long)]
273        manifest: PathBuf,
274        /// Directory containing built artifact blobs referenced by `manifest`.
275        #[arg(long)]
276        blobs_dir: PathBuf,
277    },
278    /// Atomically signs and publishes a staged release with a strictly monotonic sequence number.
279    Publish {
280        /// Local update store root directory.
281        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
282        store: PathBuf,
283        /// Logical project identifier.
284        #[arg(long)]
285        project: String,
286        /// Release channel name.
287        #[arg(long)]
288        channel: String,
289        /// Previously staged directory name under `staging/`.
290        #[arg(long)]
291        stage_id: String,
292        /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
293        #[arg(long)]
294        signing_key: Option<String>,
295        /// Environment variable name holding the offline signing secret.
296        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
297        signing_key_env: String,
298    },
299    /// Signs a NEW monotonic release pointing back to a historical release's verified blobs (never replaying old manifests).
300    Rollback {
301        /// Local update store root directory.
302        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
303        store: PathBuf,
304        /// Logical project identifier.
305        #[arg(long)]
306        project: String,
307        /// Release channel name.
308        #[arg(long)]
309        channel: String,
310        /// Historical release sequence whose verified artifacts should be restored.
311        #[arg(long)]
312        to_release: u64,
313        /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
314        #[arg(long)]
315        signing_key: Option<String>,
316        /// Environment variable name holding the offline signing secret.
317        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
318        signing_key_env: String,
319    },
320    /// Inspects active channel pointers, release counts, and content-addressed blob inventory in a local update store.
321    Status {
322        /// Local update store root directory.
323        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
324        store: PathBuf,
325        /// Optional project filter.
326        #[arg(long)]
327        project: Option<String>,
328        /// Optional channel filter.
329        #[arg(long)]
330        channel: Option<String>,
331    },
332    /// Builds, verifies, signs, and atomically publishes a live hot-update release from a `.json` UI spec, `.wasm` binary, or inline `--title` in one command.
333    Push {
334        /// Local update store root directory.
335        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
336        store: PathBuf,
337        /// Logical project identifier.
338        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
339        project: String,
340        /// Release channel name.
341        #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
342        channel: String,
343        /// Optional target route path to update (defaults to `"/dynamic-panel"` when neither `--route` nor `--slot` is specified).
344        #[arg(long)]
345        route: Option<String>,
346        /// Optional component slot identifier to update (defaults to `"promo_banner"` when neither `--route` nor `--slot` is specified).
347        #[arg(long)]
348        slot: Option<String>,
349        /// Path to a JSON `DynamicNodeSpec` or compiled `.wasm` artifact file.
350        #[arg(long)]
351        file: Option<PathBuf>,
352        /// Optional inline card title generating a ready-to-push declarative or WASM update.
353        #[arg(long)]
354        title: Option<String>,
355        /// Optional body copy paired with `--title` for quick live OTA updates.
356        #[arg(long)]
357        body: Option<String>,
358        /// Generate a genuine `.wasm` module binary when using `--title` instead of declarative JSON.
359        #[arg(long, default_value_t = false)]
360        wasm_widget: bool,
361        /// Optional RGB hex accent color (e.g. `0x16A34A` or `16A34A`) when using `--title`.
362        #[arg(long)]
363        accent_hex: Option<String>,
364        /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
365        #[arg(long)]
366        signing_key: Option<String>,
367        /// Environment variable name holding the offline signing secret.
368        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
369        signing_key_env: String,
370    },
371    /// Watches a `.json` UI spec or `.wasm` artifact file and automatically pushes signed live hot-update releases whenever it changes.
372    Watch {
373        /// Local update store root directory.
374        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
375        store: PathBuf,
376        /// Logical project identifier.
377        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
378        project: String,
379        /// Release channel name.
380        #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
381        channel: String,
382        /// Optional target route path to update.
383        #[arg(long)]
384        route: Option<String>,
385        /// Optional component slot identifier to update.
386        #[arg(long)]
387        slot: Option<String>,
388        /// Watched `.json` UI spec or `.wasm` binary file path.
389        #[arg(long)]
390        file: PathBuf,
391        /// File polling interval in milliseconds.
392        #[arg(long, default_value_t = DEFAULT_UPDATE_WATCH_POLL_MS)]
393        poll_ms: u64,
394        /// Perform a single verified push then exit immediately.
395        #[arg(long, default_value_t = false)]
396        once: bool,
397        /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
398        #[arg(long)]
399        signing_key: Option<String>,
400        /// Environment variable name holding the offline signing secret.
401        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
402        signing_key_env: String,
403    },
404    /// Initializes an atomic local OTA update store layout and optional project/channel config.
405    Init {
406        /// Local update store root directory.
407        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
408        store: PathBuf,
409        /// Default logical project identifier.
410        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
411        project: String,
412        /// Default release channel name.
413        #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
414        channel: String,
415        /// Optional explicit signing key (otherwise generates a fresh random hex secret).
416        #[arg(long)]
417        signing_key: Option<String>,
418        /// Emit machine-readable JSON output.
419        #[arg(long, default_value_t = false)]
420        json: bool,
421    },
422    /// Generates a cryptographically strong HMAC-SHA256 signing key hex string for OTA releases.
423    Keygen {
424        /// Number of random entropy bytes to generate (default `32` bytes = 64 hex chars).
425        #[arg(long, default_value_t = DEFAULT_KEYGEN_BYTES)]
426        bytes: usize,
427        /// Emit machine-readable JSON output.
428        #[arg(long, default_value_t = false)]
429        json: bool,
430    },
431    /// Compiles a Rust dynamic widget crate to `wasm32-unknown-unknown`, validates ABI exports, and optionally pushes a live OTA release.
432    Build {
433        /// Optional Cargo package name to build.
434        #[arg(short = 'p', long)]
435        package: Option<String>,
436        /// Optional path to the widget crate directory.
437        #[arg(long)]
438        path: Option<PathBuf>,
439        /// Destination file path for the verified `.wasm` widget binary.
440        #[arg(long)]
441        out: Option<PathBuf>,
442        /// Immediately sign and publish the compiled `.wasm` widget to `--store`.
443        #[arg(long, default_value_t = false)]
444        push: bool,
445        /// Local update store root directory when `--push` is set.
446        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
447        store: PathBuf,
448        /// Logical project identifier when `--push` is set.
449        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
450        project: String,
451        /// Release channel name when `--push` is set.
452        #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
453        channel: String,
454        /// Optional target route path when `--push` is set.
455        #[arg(long)]
456        route: Option<String>,
457        /// Optional target slot identifier when `--push` is set.
458        #[arg(long)]
459        slot: Option<String>,
460        /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
461        #[arg(long)]
462        signing_key: Option<String>,
463        /// Environment variable name holding the offline signing secret.
464        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
465        signing_key_env: String,
466        /// Compile the dynamic widget crate with `--release`.
467        #[arg(long, default_value_t = false)]
468        release: bool,
469        /// Emit machine-readable JSON output.
470        #[arg(long, default_value_t = false)]
471        json: bool,
472    },
473    /// Runs a unified single-command Hyperlane OTA server + live file watcher printing localhost and LAN URLs.
474    Dev {
475        /// Local update store root directory.
476        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
477        store: PathBuf,
478        /// Host bind address.
479        #[arg(long, default_value = DEFAULT_UPDATE_SERVER_HOST)]
480        host: String,
481        /// TCP listen port (`0` selects an ephemeral port).
482        #[arg(long, default_value_t = DEFAULT_UPDATE_SERVER_PORT)]
483        port: u16,
484        /// Optional external reverse-proxy base URL.
485        #[arg(long)]
486        proxy_base: Option<String>,
487        /// Logical project identifier.
488        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
489        project: String,
490        /// Release channel name.
491        #[arg(long, default_value = DEFAULT_DEV_UPDATE_CHANNEL)]
492        channel: String,
493        /// Optional target route path.
494        #[arg(long)]
495        route: Option<String>,
496        /// Optional component slot identifier.
497        #[arg(long)]
498        slot: Option<String>,
499        /// Optional `.json` spec or `.wasm` artifact file watched for automatic live pushes.
500        #[arg(long)]
501        file: Option<PathBuf>,
502        /// Watcher polling interval in milliseconds.
503        #[arg(long, default_value_t = DEFAULT_UPDATE_WATCH_POLL_MS)]
504        poll_ms: u64,
505        /// SSE keep-alive heartbeat interval in milliseconds.
506        #[arg(long, default_value_t = DEFAULT_UPDATE_HEARTBEAT_MS)]
507        heartbeat_ms: u64,
508        /// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
509        #[arg(long)]
510        signing_key: Option<String>,
511        /// Environment variable name holding the offline signing secret.
512        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
513        signing_key_env: String,
514        /// Validate startup and optional initial push then exit immediately.
515        #[arg(long, default_value_t = false)]
516        once: bool,
517        /// Emit machine-readable JSON output.
518        #[arg(long, default_value_t = false)]
519        json: bool,
520    },
521    /// Audits offline HMAC-SHA256 signatures, channel pointers, and SHA-256 integrity of every referenced blob in a store.
522    Verify {
523        /// Local update store root directory.
524        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
525        store: PathBuf,
526        /// Logical project identifier.
527        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
528        project: String,
529        /// Release channel name.
530        #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
531        channel: String,
532        /// Optional specific release sequence to verify (defaults to active release).
533        #[arg(long)]
534        release: Option<u64>,
535        /// Offline HMAC-SHA256 verification secret (or provide `--signing-key-env`).
536        #[arg(long)]
537        signing_key: Option<String>,
538        /// Environment variable name holding the verification secret.
539        #[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
540        signing_key_env: String,
541        /// Emit machine-readable JSON output.
542        #[arg(long, default_value_t = false)]
543        json: bool,
544    },
545    /// Compares two release sequences showing route, track, and content-addressed blob deltas.
546    Diff {
547        /// Local update store root directory.
548        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
549        store: PathBuf,
550        /// Logical project identifier.
551        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
552        project: String,
553        /// Release channel name.
554        #[arg(long, default_value = DEFAULT_UPDATE_CHANNEL)]
555        channel: String,
556        /// Baseline historical release sequence number.
557        #[arg(long)]
558        from: u64,
559        /// Target release sequence number to compare against `--from`.
560        #[arg(long)]
561        to: u64,
562        /// Emit machine-readable JSON output.
563        #[arg(long, default_value_t = false)]
564        json: bool,
565    },
566    /// Garbage-collects unreferenced blobs and stale staging directories while preserving active and recent releases.
567    Gc {
568        /// Local update store root directory.
569        #[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
570        store: PathBuf,
571        /// Number of most recent releases per channel to preserve.
572        #[arg(long, default_value_t = DEFAULT_GC_KEEP)]
573        keep: usize,
574        /// Report reclaimable files and bytes without deleting anything.
575        #[arg(long, default_value_t = false)]
576        dry_run: bool,
577        /// Emit machine-readable JSON output.
578        #[arg(long, default_value_t = false)]
579        json: bool,
580    },
581}
582
583/// Top-level `euv` CLI subcommands.
584#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
585pub enum Commands {
586    /// Runs an euv application for a target platform and render mode, with optional `--watch` hot reload.
587    Run {
588        /// Target platform to launch.
589        #[arg(long, value_enum, default_value_t = TargetArg::Native)]
590        target: TargetArg,
591        /// Optional HarmonyOS form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
592        #[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
593        form_factor: HarmonyFormFactorArg,
594        /// Rendering pipeline mode.
595        #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
596        render: RenderArg,
597        /// Build and run in release mode.
598        #[arg(long, default_value_t = false)]
599        release: bool,
600        /// Optional Cargo package name to run.
601        #[arg(short = 'p', long)]
602        package: Option<String>,
603        /// Enable file-watching hot reload and live OTA update serving.
604        #[arg(short = 'w', long, default_value_t = false)]
605        watch: bool,
606        /// HTTP hot-reload/OTA port when `--watch` is enabled.
607        #[arg(long, default_value_t = 8080)]
608        port: u16,
609        /// Print the execution plan without spawning Cargo.
610        #[arg(long, default_value_t = false)]
611        plan: bool,
612        /// Stream child process output directly to the terminal (defaults to `true` for interactive/TTY ergonomics).
613        #[arg(long, default_value_t = true, num_args = 0..=1, default_missing_value = "true")]
614        stream: bool,
615        /// Emit machine-readable JSON output.
616        #[arg(long, default_value_t = false)]
617        json: bool,
618    },
619    /// Starts the hot-reload and Dynamic WASM OTA development server for Web, Native, Docs, Terminal, Harmony, Wearable, MiniApp, or QuickApp.
620    Dev {
621        /// Development pipeline target (`web`, `native`, `docs`, `tui`, `cli`, `harmony`, `wearable`, `miniapp`, `quickapp`).
622        #[arg(long, value_enum, default_value_t = DevTargetArg::Web)]
623        target: DevTargetArg,
624        /// Rendering pipeline mode default.
625        #[arg(long, value_enum, default_value_t = RenderArg::Auto)]
626        render: RenderArg,
627        /// Build and serve in release mode when rebuilding Web or Native targets.
628        #[arg(long, default_value_t = false)]
629        release: bool,
630        /// Optional project root directory to watch (defaults to current directory).
631        #[arg(long)]
632        path: Option<PathBuf>,
633        /// Optional output directory for built bundles.
634        #[arg(long)]
635        out: Option<PathBuf>,
636        /// Optional Cargo package name to rebuild on changes.
637        #[arg(short = 'p', long)]
638        package: Option<String>,
639        /// Shared dev server bind, poll interval, and smoke-run flags.
640        #[command(flatten)]
641        server: ServerBindArgs,
642        /// Enable live Dynamic WASM OTA manifest + `.wasm` hot-update endpoint (`--ota=false` disables).
643        #[arg(long, default_value_t = true, num_args = 0..=1, default_missing_value = "true")]
644        ota: bool,
645        /// Enable sub-second hot-OTA widget/spec live swapping without restarting the host app.
646        #[arg(long, default_value_t = false)]
647        hot_ota: bool,
648        /// Watch a dynamic widget crate or declarative JSON spec path for automatic v1 OTA hot pushes.
649        #[arg(long)]
650        watch_ota: Option<PathBuf>,
651        /// Emit `Cross-Origin-Opener-Policy` and `Cross-Origin-Embedder-Policy` headers for SharedArrayBuffer / WASM threads.
652        #[arg(long, default_value_t = false)]
653        coop_coep: bool,
654        /// Logical project identifier used by the embedded v1 OTA server.
655        #[arg(long, default_value = DEFAULT_UPDATE_PROJECT)]
656        project: String,
657        /// Release channel name used by the embedded v1 OTA server.
658        #[arg(long, default_value = DEFAULT_DEV_UPDATE_CHANNEL)]
659        channel: String,
660        /// Optional HMAC-SHA256 signing secret for the embedded v1 OTA server.
661        #[arg(long)]
662        signing_key: Option<String>,
663        /// File watcher debounce interval in milliseconds before starting a rebuild.
664        #[arg(long, default_value_t = DEFAULT_DEV_DEBOUNCE_MS)]
665        debounce_ms: u64,
666        /// Print the structured dev server plan without spawning processes.
667        #[arg(long, default_value_t = false)]
668        plan: bool,
669        /// Emit machine-readable JSON output.
670        #[arg(long, default_value_t = false)]
671        json: bool,
672    },
673    /// Manages the Hyperlane HTTP + SSE dynamic update server and atomic local release store (`serve`, `stage`, `publish`, `rollback`, `status`, `push`, `watch`, `init`, `keygen`, `build`, `dev`, `verify`, `diff`, `gc`).
674    Update {
675        /// Dynamic update server or store management subcommand.
676        #[command(subcommand)]
677        action: UpdateAction,
678    },
679    /// Builds or live-serves a static or multi-locale WASM documentation site from project `.md` files.
680    Docs {
681        /// Optional `build` or `dev` subcommand (defaults to building all project `.md` files).
682        #[command(subcommand)]
683        action: Option<DocsAction>,
684        /// Shared source, output, title, base URL, and WASM flags.
685        #[command(flatten)]
686        build: DocsBuildArgs,
687        /// Enable live watch and SSE hot-reload dev server directly from `euv docs --watch`.
688        #[arg(short = 'w', long, default_value_t = false)]
689        watch: bool,
690        /// Shared dev server bind, poll interval, and smoke-run flags when `--watch` is active.
691        #[command(flatten)]
692        server: ServerBindArgs,
693    },
694    /// Builds native, mobile, simulator, terminal, wearable, HarmonyOS, Mini-Program, QuickApp, or Web bundles for one, multiple, or all targets.
695    Build {
696        /// Target platform(s) or group(s) (repeatable and comma-separated, e.g. `--target web,android,macos`).
697        #[arg(long, value_enum, value_delimiter = ',', action = ArgAction::Append)]
698        target: Vec<TargetArg>,
699        /// Shorthand for `--target all` across every supported production platform.
700        #[arg(long, default_value_t = false)]
701        all: bool,
702        /// Print the target readiness table for the current host and exit without building.
703        #[arg(long, default_value_t = false)]
704        list_targets: bool,
705        /// Optional Cargo package name to build.
706        #[arg(short = 'p', long)]
707        package: Option<String>,
708        /// Optional output directory for packaged artifacts.
709        #[arg(long)]
710        out_dir: Option<PathBuf>,
711        /// Optional exact output file path (e.g. APK path for single-file artifacts).
712        #[arg(long)]
713        out_file: Option<PathBuf>,
714        /// Optional archive file path (`.tar.gz` or `.zip`) packing the staged output directory.
715        #[arg(long)]
716        archive: Option<PathBuf>,
717        /// Optional asset URL base prefix for Web bundles (e.g. `./` or `/euv/`).
718        #[arg(long)]
719        base: Option<String>,
720        /// Skip targets whose required host OS or SDK toolchain is unavailable instead of aborting.
721        #[arg(long, default_value_t = false)]
722        skip_unavailable: bool,
723        /// Execute independent target builds in parallel across worker threads.
724        #[arg(long, default_value_t = false)]
725        parallel: bool,
726        /// Maximum concurrent target build jobs when `--parallel` is active.
727        #[arg(short = 'j', long)]
728        jobs: Option<usize>,
729        /// Emit a deterministic SHA-256 `euv-release.json` artifact inventory after building.
730        #[arg(long, default_value_t = false)]
731        manifest: bool,
732        /// Verify generated bundle integrity, SHA-256 manifest, zero-JS rules, and release AI-schema stripping.
733        #[arg(long, default_value_t = false)]
734        verify: bool,
735        /// Emit raw `.wasm` + icons + `build-plan.json` without running `wasm-bindgen-cli`.
736        #[arg(long, default_value_t = false)]
737        raw_wasm: bool,
738        /// Skip optional binaryen `wasm-opt` size optimization on Web builds.
739        #[arg(long, default_value_t = false)]
740        skip_wasm_opt: bool,
741        /// Build all compiled theme variants (`default` + `theme-*` features) for Web targets.
742        #[arg(long, default_value_t = false)]
743        theme_variants: bool,
744        /// Skip automatic simulator/emulator launch after mobile builds.
745        #[arg(long, default_value_t = false)]
746        no_launch: bool,
747        /// Install the built mobile/wearable/Harmony bundle onto a connected device or emulator.
748        #[arg(long, default_value_t = false)]
749        install: bool,
750        /// Run a headless smoke verification (`--headless --software`) after building native binaries.
751        #[arg(long, default_value_t = false)]
752        smoke: bool,
753        /// Include the `euv` CLI binary alongside the app binary in desktop bundles.
754        #[arg(long, default_value_t = false)]
755        include_cli: bool,
756        /// Explicit semantic version override (defaults to workspace `Cargo.toml` version).
757        #[arg(long)]
758        version: Option<String>,
759        /// Target native ABIs (repeatable/comma-separated, e.g. `--abi arm64-v8a,x86_64`).
760        #[arg(long, value_delimiter = ',', action = ArgAction::Append)]
761        abi: Vec<String>,
762        /// Additional Cargo feature flags to enable (repeatable/comma-separated).
763        #[arg(long, value_delimiter = ',', action = ArgAction::Append)]
764        features: Vec<String>,
765        /// Optional device or simulator identifier for `--install` or launch steps.
766        #[arg(long)]
767        device: Option<String>,
768        /// Optional custom PNG icon source path replacing the default euv brand mark.
769        #[arg(long)]
770        icon: Option<PathBuf>,
771        /// Optional HarmonyOS device form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
772        #[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
773        form_factor: HarmonyFormFactorArg,
774        /// Rendering pipeline mode override (defaults to `hardware` on Apple mobile/watch targets and `auto` elsewhere).
775        #[arg(long, value_enum)]
776        render: Option<RenderArg>,
777        /// Enable release optimization profile.
778        #[arg(long, default_value_t = false)]
779        release: bool,
780        /// Print structured JSON build plans without executing.
781        #[arg(long, default_value_t = false)]
782        plan: bool,
783        /// Emit machine-readable JSON output.
784        #[arg(long, default_value_t = false)]
785        json: bool,
786    },
787    /// Checks Rust compilation across one, multiple, or all cross-platform targets.
788    Check {
789        /// Check all supported platform targets in sequence.
790        #[arg(long, default_value_t = false)]
791        all_targets: bool,
792        /// Target platform(s) or group(s) to check (repeatable and comma-separated).
793        #[arg(long, value_enum, value_delimiter = ',', action = ArgAction::Append)]
794        target: Vec<TargetArg>,
795        /// Treat Rust compiler warnings as errors (`RUSTFLAGS="-D warnings"`).
796        #[arg(long, default_value_t = false)]
797        deny_warnings: bool,
798        /// Optional Cargo package name(s) to check (repeatable and comma-separated).
799        #[arg(short = 'p', long, value_delimiter = ',', action = ArgAction::Append)]
800        package: Vec<String>,
801        /// Print the planned commands without running Cargo.
802        #[arg(long, default_value_t = false)]
803        plan: bool,
804        /// Emit machine-readable JSON output.
805        #[arg(long, default_value_t = false)]
806        json: bool,
807    },
808    /// Runs unified `crate-cli` text/Rust formatting first, then normalizes indentation inside all `euv` macro blocks (`view!`, `style!`, etc.).
809    Fmt {
810        /// Verify formatting without modifying files.
811        #[arg(long, default_value_t = false)]
812        check: bool,
813        /// Optional root directory or file path (defaults to current directory).
814        #[arg(long)]
815        path: Option<PathBuf>,
816        /// Format only `euv` procedural macro bodies without invoking `crate-cli` or `cargo fmt`.
817        #[arg(long, default_value_t = false)]
818        macros_only: bool,
819    },
820    /// Inspects installed Rust targets, SDKs, and cross-platform tooling readiness.
821    Doctor {
822        /// Automatically install missing `rustup` targets applicable to this host OS.
823        #[arg(long, default_value_t = false)]
824        fix: bool,
825        /// Display the expanded per-target readiness matrix and install hints.
826        #[arg(long, default_value_t = false)]
827        targets: bool,
828        /// Emit machine-readable JSON output.
829        #[arg(long, default_value_t = false)]
830        json: bool,
831    },
832    /// Scaffolds a new cross-platform euv native project using keyless `style!` and `view!`.
833    New {
834        /// Name of the new project directory and crate.
835        name: String,
836        /// Optional parent directory (defaults to current working directory).
837        #[arg(long)]
838        path: Option<PathBuf>,
839        /// Project template preset (`app`, `web`, `dynamic-widget`, `docs`).
840        #[arg(long, value_enum, default_value_t = ProjectTemplateArg::App)]
841        template: ProjectTemplateArg,
842        /// Optional reverse-DNS mobile/desktop bundle identifier (e.g. `com.example.myapp`).
843        #[arg(long)]
844        bundle_id: Option<String>,
845        /// Emit machine-readable JSON output.
846        #[arg(long, default_value_t = false)]
847        json: bool,
848    },
849    /// Displays the per-target buildability matrix and required SDKs for the current host.
850    Targets {
851        /// Optional target or group filter(s) (repeatable and comma-separated).
852        #[arg(long, value_enum, value_delimiter = ',', action = ArgAction::Append)]
853        target: Vec<TargetArg>,
854        /// Show only targets that are ready to build on the current host.
855        #[arg(long, default_value_t = false)]
856        ready_only: bool,
857        /// Emit machine-readable JSON output.
858        #[arg(long, default_value_t = false)]
859        json: bool,
860    },
861    /// Cleans generated bundles (`dist/`), mobile host caches, icon caches, and stale OTA staging directories.
862    Clean {
863        /// Also invoke `cargo clean` for the current workspace or project.
864        #[arg(long, default_value_t = false)]
865        all: bool,
866        /// Optional project root directory (defaults to current working directory).
867        #[arg(long)]
868        path: Option<PathBuf>,
869        /// Preview directories and bytes to reclaim without deleting files.
870        #[arg(long, default_value_t = false)]
871        dry_run: bool,
872        /// Emit machine-readable JSON output.
873        #[arg(long, default_value_t = false)]
874        json: bool,
875    },
876    /// Generates shell tab-completion scripts (`bash`, `zsh`, `fish`, `powershell`) for all `euv` subcommands and targets.
877    Completions {
878        /// Target shell dialect.
879        #[arg(value_enum)]
880        shell: ShellKindArg,
881    },
882    /// Queries a live `DevAutomationBridge` for AI Schema / 9-rule layout anomalies or audits a local `dist/` artifact directory.
883    Inspect {
884        /// Live `DevAutomationBridge` base HTTP URL.
885        #[arg(long, default_value = DEFAULT_INSPECT_URL)]
886        url: String,
887        /// Local build output directory to audit (`euv-release.json`, SHA-256 integrity, zero-JS check, sizes).
888        #[arg(long)]
889        dist: Option<PathBuf>,
890        /// Focus output on 9-rule layout anomalies returned by the live automation bridge.
891        #[arg(long, default_value_t = false)]
892        anomalies: bool,
893        /// Emit machine-readable JSON output.
894        #[arg(long, default_value_t = false)]
895        json: bool,
896    },
897}