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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
use super::*;
/// CLI target selector covering all 23 supported euv platforms plus `native` and `all`.
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
pub enum TargetArg {
/// Browser WebAssembly target (`wasm32-unknown-unknown`).
Web,
/// Android native NDK target (`aarch64-linux-android`).
Android,
/// iOS native UIKit/Metal target (`aarch64-apple-ios`).
Ios,
/// iPadOS native UIKit/Metal target (`aarch64-apple-ios`).
Ipad,
/// macOS native AppKit/Metal target (`aarch64-apple-darwin` / `x86_64-apple-darwin`).
Macos,
/// Windows native Win32/D3D12 target (`x86_64-pc-windows-msvc` / `aarch64-pc-windows-msvc`).
Windows,
/// Linux native Wayland/X11/Vulkan target (`x86_64-unknown-linux-gnu` / `aarch64-unknown-linux-gnu`).
Linux,
/// Interactive PTY Terminal UI target.
Tui,
/// Non-interactive static/pipe CLI terminal target.
Cli,
/// Google/Samsung Wear OS smartwatch target.
Wearos,
/// Apple watchOS smartwatch target.
Watchos,
/// Huawei HarmonyOS Watch wearable target.
#[value(name = "harmony-wearable")]
HarmonyWearable,
/// Xiaomi HyperOS / Vela Watch wearable target.
Vela,
/// Generic smart wearable target (OPPO / vivo / Garmin / ZeppOS).
Wearable,
/// HarmonyOS / OpenHarmony multi-form-factor native target (phone/tablet/pc/foldable/tv/car).
Harmony,
/// WeChat Mini-Program target (`wx`).
Wechat,
/// Alipay Mini-Program target (`my`).
Alipay,
/// Douyin / ByteDance Mini-Program target (`tt`).
Douyin,
/// Baidu Smart Mini-Program target (`swan`).
Baidu,
/// QQ Mini-Program target (`qq`).
Qq,
/// Kuaishou Mini-Program target (`ks`).
Kuaishou,
/// HarmonyOS Atomic Service target (`atomic`).
#[value(name = "harmony-atomic")]
HarmonyAtomic,
/// QuickApp Alliance / Huawei QuickApp target.
Quickapp,
/// Current host native target.
Native,
/// Every supported euv platform.
All,
}
/// Optional HarmonyOS / OpenHarmony device form factor selector for `euv build --target harmony`.
#[derive(Clone, Copy, Debug, Default, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
pub enum HarmonyFormFactorArg {
/// HarmonyOS phone device profile.
#[default]
Phone,
/// HarmonyOS tablet device profile.
Tablet,
/// HarmonyOS PC / 2-in-1 desktop device profile.
Pc,
/// HarmonyOS foldable display device profile.
Foldable,
/// HarmonyOS smart TV / Vision device profile.
Tv,
/// HarmonyOS automotive / cockpit device profile.
Car,
/// HarmonyOS smartwatch wearable device profile.
Wearable,
}
/// CLI render pipeline mode selector.
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
pub enum RenderArg {
/// Automatically prefer hardware GPU with software fallback.
Auto,
/// Deterministic software CPU rasterizer.
Software,
/// Native GPU instanced pipeline.
Hardware,
/// Hybrid CPU vector + GPU texture compositor.
Hybrid,
}
/// Target mode for the `euv dev` hot-reload and OTA development server.
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize, ValueEnum)]
pub enum DevTargetArg {
/// Build and live-reload all project Markdown documentation pages.
Docs,
/// Build and live-reload WebAssembly zero-JS bundles plus Dynamic WASM OTA feed.
Web,
/// Watch Rust sources, rebuild, hot-restart the native app, and serve Dynamic WASM OTA updates.
Native,
/// Watch Rust sources and relaunch interactive PTY Terminal UI builds.
Tui,
/// Watch Rust sources and rerun static/pipe CLI terminal builds.
Cli,
/// Watch Rust sources and rebuild HarmonyOS HAP bundles.
Harmony,
/// Watch Rust sources and rebuild wearable smartwatch bundles.
Wearable,
/// Watch Rust sources and rebuild Mini-Program bundles.
Miniapp,
/// Watch Rust sources and rebuild QuickApp bundles.
Quickapp,
}
/// Subcommands under `euv docs` for building or live-serving project Markdown documentation.
#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
pub enum DocsAction {
/// Builds all Markdown files under a project or docs directory into a static site.
Build {
/// Shared source, output, title, and base URL flags.
#[command(flatten)]
build: DocsBuildArgs,
},
/// Builds and serves Markdown documentation with live file-watching and SSE hot reload.
Dev {
/// Shared source, output, title, and base URL flags.
#[command(flatten)]
build: DocsBuildArgs,
/// Shared dev server bind, poll interval, and smoke-run flags.
#[command(flatten)]
server: ServerBindArgs,
},
}
/// Subcommands under `euv update` for operating the Hyperlane HTTP + SSE dynamic update server and local store.
#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
pub enum UpdateAction {
/// Starts the read-only Hyperlane HTTP + SSE dynamic update server backed by the local store directory.
Serve {
/// Local update store root directory (`staging/`, `blobs/`, `releases/`, `channels/`, `state/`).
#[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
store: PathBuf,
/// Host bind address.
#[arg(long, default_value = DEFAULT_UPDATE_SERVER_HOST)]
host: String,
/// TCP listen port (`0` selects an ephemeral port).
#[arg(long, default_value_t = DEFAULT_UPDATE_SERVER_PORT)]
port: u16,
/// SSE keep-alive heartbeat interval in milliseconds.
#[arg(long, default_value_t = DEFAULT_UPDATE_HEARTBEAT_MS)]
heartbeat_ms: u64,
/// Background channel pointer watcher polling interval in milliseconds.
#[arg(long, default_value_t = DEFAULT_UPDATE_WATCH_POLL_MS)]
poll_ms: u64,
/// Validate store layout and server bind readiness then exit immediately.
#[arg(long, default_value_t = false)]
once: bool,
/// Print the structured server configuration without binding sockets.
#[arg(long, default_value_t = false)]
plan: bool,
},
/// Stages and SHA-256-verifies a release manifest and its blobs into `staging/<stage_id>/`.
Stage {
/// Local update store root directory.
#[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
store: PathBuf,
/// Logical project identifier.
#[arg(long)]
project: String,
/// Release channel name (e.g. `prod`).
#[arg(long)]
channel: String,
/// Unique stage identifier name.
#[arg(long)]
stage_id: String,
/// Path to the draft JSON `ReleaseManifest` file.
#[arg(long)]
manifest: PathBuf,
/// Directory containing built artifact blobs referenced by `manifest`.
#[arg(long)]
blobs_dir: PathBuf,
},
/// Atomically signs and publishes a staged release with a strictly monotonic sequence number.
Publish {
/// Local update store root directory.
#[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
store: PathBuf,
/// Logical project identifier.
#[arg(long)]
project: String,
/// Release channel name.
#[arg(long)]
channel: String,
/// Previously staged directory name under `staging/`.
#[arg(long)]
stage_id: String,
/// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
#[arg(long)]
signing_key: Option<String>,
/// Environment variable name holding the offline signing secret.
#[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
signing_key_env: String,
},
/// Signs a NEW monotonic release pointing back to a historical release's verified blobs (never replaying old manifests).
Rollback {
/// Local update store root directory.
#[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
store: PathBuf,
/// Logical project identifier.
#[arg(long)]
project: String,
/// Release channel name.
#[arg(long)]
channel: String,
/// Historical release sequence whose verified artifacts should be restored.
#[arg(long)]
to_release: u64,
/// Offline HMAC-SHA256 signing secret (or provide `--signing-key-env`).
#[arg(long)]
signing_key: Option<String>,
/// Environment variable name holding the offline signing secret.
#[arg(long, default_value = ENV_UPDATE_SIGNING_KEY)]
signing_key_env: String,
},
/// Inspects active channel pointers, release counts, and content-addressed blob inventory in a local update store.
Status {
/// Local update store root directory.
#[arg(long, default_value = DEFAULT_UPDATE_STORE_DIR)]
store: PathBuf,
/// Optional project filter.
#[arg(long)]
project: Option<String>,
/// Optional channel filter.
#[arg(long)]
channel: Option<String>,
},
}
/// Top-level `euv` CLI subcommands.
#[derive(Clone, Debug, Eq, PartialEq, Subcommand)]
pub enum Commands {
/// Runs an euv application for a target platform and render mode, with optional `--watch` hot reload.
Run {
/// Target platform to launch.
#[arg(long, value_enum, default_value_t = TargetArg::Native)]
target: TargetArg,
/// Optional HarmonyOS form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
#[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
form_factor: HarmonyFormFactorArg,
/// Rendering pipeline mode.
#[arg(long, value_enum, default_value_t = RenderArg::Auto)]
render: RenderArg,
/// Build and run in release mode.
#[arg(long, default_value_t = false)]
release: bool,
/// Optional Cargo package name to run.
#[arg(long)]
package: Option<String>,
/// Enable file-watching hot reload and live OTA update serving.
#[arg(short = 'w', long, default_value_t = false)]
watch: bool,
/// HTTP hot-reload/OTA port when `--watch` is enabled.
#[arg(long, default_value_t = 8080)]
port: u16,
/// Print the execution plan without spawning Cargo.
#[arg(long, default_value_t = false)]
plan: bool,
},
/// Starts the hot-reload and Dynamic WASM OTA development server for Web, Native, Docs, Terminal, Harmony, Wearable, MiniApp, or QuickApp.
Dev {
/// Development pipeline target (`web`, `native`, `docs`, `tui`, `cli`, `harmony`, `wearable`, `miniapp`, `quickapp`).
#[arg(long, value_enum, default_value_t = DevTargetArg::Web)]
target: DevTargetArg,
/// Rendering pipeline mode default.
#[arg(long, value_enum, default_value_t = RenderArg::Auto)]
render: RenderArg,
/// Build and serve in release mode when rebuilding Web or Native targets.
#[arg(long, default_value_t = false)]
release: bool,
/// Optional project root directory to watch (defaults to current directory).
#[arg(long)]
path: Option<PathBuf>,
/// Optional output directory for built bundles.
#[arg(long)]
out: Option<PathBuf>,
/// Optional Cargo package name to rebuild on changes.
#[arg(long)]
package: Option<String>,
/// Shared dev server bind, poll interval, and smoke-run flags.
#[command(flatten)]
server: ServerBindArgs,
/// Enable live Dynamic WASM OTA manifest + `.wasm` hot-update endpoint (`--ota=false` disables).
#[arg(long, default_value_t = true, num_args = 0..=1, default_missing_value = "true")]
ota: bool,
/// Print the structured dev server plan without spawning processes.
#[arg(long, default_value_t = false)]
plan: bool,
},
/// Manages the Hyperlane HTTP + SSE dynamic update server and atomic local release store (`serve`, `stage`, `publish`, `rollback`, `status`).
Update {
/// Dynamic update server or store management subcommand.
#[command(subcommand)]
action: UpdateAction,
},
/// Builds or live-serves a static documentation site from all `.md` files in a project.
Docs {
/// Optional `build` or `dev` subcommand (defaults to building all project `.md` files).
#[command(subcommand)]
action: Option<DocsAction>,
/// Shared source, output, title, and base URL flags.
#[command(flatten)]
build: DocsBuildArgs,
/// Enable live watch and SSE hot-reload dev server directly from `euv docs --watch`.
#[arg(short = 'w', long, default_value_t = false)]
watch: bool,
/// Shared dev server bind, poll interval, and smoke-run flags when `--watch` is active.
#[command(flatten)]
server: ServerBindArgs,
},
/// Builds native, terminal, wearable, HarmonyOS, Mini-Program, QuickApp, or Web bundles for one or all targets.
Build {
/// Target platform (or `all`).
#[arg(long, value_enum, default_value_t = TargetArg::Native)]
target: TargetArg,
/// Optional HarmonyOS device form factor (`phone`, `tablet`, `pc`, `foldable`, `tv`, `car`, `wearable`).
#[arg(long, value_enum, default_value_t = HarmonyFormFactorArg::Phone)]
form_factor: HarmonyFormFactorArg,
/// Rendering pipeline mode default.
#[arg(long, value_enum, default_value_t = RenderArg::Auto)]
render: RenderArg,
/// Enable release optimization profile.
#[arg(long, default_value_t = false)]
release: bool,
/// Print structured JSON build plans without executing.
#[arg(long, default_value_t = false)]
plan: bool,
},
/// Checks Rust compilation across one or all cross-platform targets.
Check {
/// Check all supported platform targets in sequence.
#[arg(long, default_value_t = false)]
all_targets: bool,
/// Single target to check when `--all-targets` is omitted.
#[arg(long, value_enum, default_value_t = TargetArg::Native)]
target: TargetArg,
/// Optional Cargo package name to check.
#[arg(long)]
package: Option<String>,
/// Print the planned commands without running Cargo.
#[arg(long, default_value_t = false)]
plan: bool,
},
/// Runs unified `crate-cli` text/Rust formatting first, then normalizes indentation inside all `euv` macro blocks (`view!`, `style!`, etc.).
Fmt {
/// Verify formatting without modifying files.
#[arg(long, default_value_t = false)]
check: bool,
/// Optional root directory or file path (defaults to current directory).
#[arg(long)]
path: Option<PathBuf>,
/// Format only `euv` procedural macro bodies without invoking `crate-cli` or `cargo fmt`.
#[arg(long, default_value_t = false)]
macros_only: bool,
},
/// Inspects installed Rust targets, SDKs, and cross-platform tooling readiness.
Doctor {
/// Emit machine-readable JSON output.
#[arg(long, default_value_t = false)]
json: bool,
},
/// Scaffolds a new cross-platform euv native project.
New {
/// Name of the new project directory and crate.
name: String,
/// Optional parent directory (defaults to current working directory).
#[arg(long)]
path: Option<PathBuf>,
},
}