euv-cli 0.51.0

Cross-platform CLI tool for the euv native UI framework supporting run, build, check, fmt, doctor, new, and Hyperlane SSE dynamic updates across all supported platforms.
Documentation
/// Environment variable overriding the detected Blender executable path.
pub const ENV_EUV_BLENDER_BIN: &str = "EUV_BLENDER_BIN";

/// Default loopback host for the `euv blender live-sync` HTTP/SSE daemon.
pub const DEFAULT_BLENDER_SYNC_HOST: &str = "127.0.0.1";

/// Default TCP port for `euv blender live-sync` (chosen to avoid Blender Lab MCP port `9876`).
pub const DEFAULT_BLENDER_SYNC_PORT: u16 = 9877;

/// Default TCP port probed by `euv blender doctor` for the official Blender Lab MCP bridge.
pub const DEFAULT_BLENDER_MCP_PORT: u16 = 9876;

/// Default number of QEM LOD levels generated by `euv blender bake`.
pub const DEFAULT_BLENDER_BAKE_LODS: usize = 4;

/// Default file-watcher polling interval in milliseconds for `euv blender watch`.
pub const DEFAULT_BLENDER_WATCH_POLL_MS: u64 = 350;

/// Default SSE keep-alive heartbeat interval in milliseconds for `euv blender live-sync`.
pub const DEFAULT_BLENDER_HEARTBEAT_MS: u64 = 15_000;

/// Default maximum binary `.glb` / `.euv3d` upload size accepted by `POST /blender/asset/{id}` (64 MiB).
pub const DEFAULT_BLENDER_MAX_ASSET_BYTES: usize = 64 * 1024 * 1024;

/// Default bounded replay history capacity for `GET /blender/events` SSE streams.
pub const DEFAULT_BLENDER_EVENT_REPLAY_CAP: usize = 128;

/// Hyperlane route receiving fast JSON transform, camera, light, material, and morph deltas.
pub const BLENDER_ROUTE_DELTA: &str = "/blender/delta";

/// Hyperlane route receiving and serving selective binary `.glb` / `.euv3d` asset hot-swaps.
pub const BLENDER_ROUTE_ASSET: &str = "/blender/asset/{id}";

/// Hyperlane route streaming real-time `blender.delta` and `blender.asset` SSE events.
pub const BLENDER_ROUTE_EVENTS: &str = "/blender/events";

/// Hyperlane route serving JSON Live-Link daemon diagnostics and active asset metadata.
pub const BLENDER_ROUTE_STATUS: &str = "/blender/status";

/// Hyperlane route serving simple health status for the Blender Live-Link daemon.
pub const BLENDER_ROUTE_HEALTHZ: &str = "/healthz";

/// SSE event type emitted when a JSON scene delta is posted to `/blender/delta`.
pub const BLENDER_SSE_EVENT_DELTA: &str = "blender.delta";

/// SSE event type emitted when a binary `.glb` / `.euv3d` asset is hot-swapped via `/blender/asset/{id}`.
pub const BLENDER_SSE_EVENT_ASSET: &str = "blender.asset";

/// Canonical filename of the generated Blender 4.x / 5.x Live-Link Python add-on.
pub const BLENDER_LIVE_LINK_ADDON_FILENAME: &str = "euv_live_link.py";

/// Embedded Blender 4.x / 5.x headless `.blend` -> `.glb` exporter script with `extras.euv` annotation.
pub const EXPORT_BLEND_TO_GLB_PY: &str = include_str!("export_blend_to_glb.py");

/// Embedded Blender 4.x / 5.x Live-Link add-on Python source (`50ms`-debounced depsgraph sync).
pub const EUV_LIVE_LINK_ADDON_PY: &str = include_str!("euv_live_link.py");

/// Minimum Blender major version required for modern glTF 2.0 + Principled BSDF export.
pub(crate) const BLENDER_MIN_GLTF_MAJOR: u16 = 4;

/// Minimum Blender version (`5.1`) recommended for official Blender Lab MCP support.
pub(crate) const BLENDER_MCP_MIN_MAJOR: u16 = 5;

/// Minimum Blender minor version (`1`) paired with `BLENDER_MCP_MIN_MAJOR` for Blender Lab MCP.
pub(crate) const BLENDER_MCP_MIN_MINOR: u16 = 1;

/// TCP probe timeout in milliseconds when checking Blender Lab MCP bridge reachability.
pub(crate) const BLENDER_MCP_PROBE_TIMEOUT_MS: u64 = 150;

/// Default Blender binary name resolved through `PATH` on Unix hosts.
pub(crate) const BLENDER_BIN_UNIX: &str = "blender";

/// Default Blender binary name resolved through `PATH` on Windows hosts.
pub(crate) const BLENDER_BIN_WINDOWS: &str = "blender.exe";

/// Canonical macOS system application path for Blender.
pub(crate) const BLENDER_MACOS_APP_BIN: &str = "/Applications/Blender.app/Contents/MacOS/Blender";

/// Relative user-home macOS application path for Blender.
pub(crate) const BLENDER_MACOS_HOME_APP_REL: &str =
    "Applications/Blender.app/Contents/MacOS/Blender";

/// Common Linux absolute candidate paths for Blender.
pub(crate) const BLENDER_LINUX_CANDIDATE_BINS: [&str; 3] = [
    "/usr/bin/blender",
    "/usr/local/bin/blender",
    "/snap/bin/blender",
];

/// Relative Windows Program Files folder housing Blender Foundation installations.
pub(crate) const BLENDER_WINDOWS_FOUNDATION_DIR: &str = "Blender Foundation";

/// Environment variable pointing to `HOME` on Unix hosts.
pub(crate) const BLENDER_ENV_HOME: &str = "HOME";

/// Environment variable pointing to `APPDATA` on Windows hosts.
pub(crate) const BLENDER_ENV_APPDATA: &str = "APPDATA";

/// Environment variable pointing to `ProgramFiles` on Windows hosts.
pub(crate) const BLENDER_ENV_PROGRAM_FILES: &str = "ProgramFiles";

/// Environment variable pointing to `PATH` executable search entries.
pub(crate) const BLENDER_ENV_PATH: &str = "PATH";

/// macOS Blender user configuration root relative to `$HOME`.
pub(crate) const BLENDER_MACOS_CONFIG_REL: &str = "Library/Application Support/Blender";

/// Linux Blender user configuration root relative to `$HOME`.
pub(crate) const BLENDER_LINUX_CONFIG_REL: &str = ".config/blender";

/// Relative path beneath a Blender version config directory containing user add-ons.
pub(crate) const BLENDER_ADDONS_REL: &str = "scripts/addons";

/// CLI argument passed to Blender for headless execution without GUI.
pub(crate) const BLENDER_ARG_BACKGROUND: &str = "--background";

/// CLI argument passed to Blender to run a Python script.
pub(crate) const BLENDER_ARG_PYTHON: &str = "--python";

/// CLI argument passed to Blender to query its version string.
pub(crate) const BLENDER_ARG_VERSION: &str = "--version";

/// CLI argument passed to Blender to evaluate an inline Python expression.
pub(crate) const BLENDER_ARG_PYTHON_EXPR: &str = "--python-expr";

/// Inline Python probe verifying `io_scene_gltf2` exporter availability inside Blender.
pub(crate) const BLENDER_PROBE_GLTF_EXPR: &str = "import bpy; print('EUV_GLTF_READY' if hasattr(bpy.ops.export_scene, 'gltf') else 'EUV_GLTF_MISSING')";

/// Marker emitted by `BLENDER_PROBE_GLTF_EXPR` when Blender's glTF 2.0 exporter is available.
pub(crate) const BLENDER_GLTF_READY_MARKER: &str = "EUV_GLTF_READY";

/// Argument separator forwarding trailing options to `export_blend_to_glb.py`.
pub(crate) const BLENDER_ARG_SEP: &str = "--";

/// Temp script filename prefix used during headless `.blend` -> `.glb` export.
pub(crate) const BLENDER_EXPORT_SCRIPT_PREFIX: &str = "euv_export_blend_to_glb";

/// Output manifest filename generated by `euv blender import`.
pub(crate) const BLENDER_IMPORT_MANIFEST_FILE: &str = "asset-manifest.json";

/// Lowercase extension matching `.blend` files.
pub(crate) const BLENDER_EXT_BLEND: &str = "blend";

/// Lowercase extension matching binary `.glb` files.
pub(crate) const BLENDER_EXT_GLB: &str = "glb";

/// Lowercase extension matching `.gltf` JSON files.
pub(crate) const BLENDER_EXT_GLTF: &str = "gltf";

/// Lowercase extension matching baked `.euv3d` files.
pub(crate) const BLENDER_EXT_EUV3D: &str = "euv3d";

/// Lowercase extension matching Wavefront `.obj` files.
pub(crate) const BLENDER_EXT_OBJ: &str = "obj";

/// Lowercase extension matching Wavefront `.mtl` material files.
pub(crate) const BLENDER_EXT_MTL: &str = "mtl";

/// Prefix matched in `blender --version` stdout (`"Blender X.Y.Z"`).
pub(crate) const BLENDER_VERSION_PREFIX: &str = "Blender ";

/// Four-byte little-endian glTF binary `.glb` magic (`"glTF"`).
pub(crate) const BLENDER_GLB_MAGIC: [u8; 4] = *b"glTF";

/// Two-byte RFC 1952 gzip header magic for compressed `.blend` files.
pub(crate) const BLENDER_GZIP_MAGIC: [u8; 2] = [0x1f, 0x8b];

/// Four-byte Zstandard header magic for compressed `.blend` files.
pub(crate) const BLENDER_ZSTD_MAGIC: [u8; 4] = [0x28, 0xb5, 0x2f, 0xfd];

/// Route parameter key capturing `{id}` on `/blender/asset/{id}`.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_ROUTE_PARAM_ID: &str = "id";

/// SSE topic name used inside `SseHub` for all Blender Live-Link broadcasts.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_LIVE_SSE_TOPIC: &str = "blender:live";

/// SSE initial connection comment sent immediately upon subscribing to `/blender/events`.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_SSE_CONNECTED_COMMENT: &str = "euv-blender-live-sync connected";

/// SSE periodic keep-alive comment sent on idle `/blender/events` streams.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_SSE_HEARTBEAT_COMMENT: &str = "keep-alive";

/// HTTP MIME type for JSON Live-Link responses.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_MIME_JSON: &str = "application/json; charset=utf-8";

/// HTTP MIME type for binary `.glb` asset responses.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_MIME_GLB: &str = "model/gltf-binary";

/// HTTP MIME type for binary `.euv3d` asset responses.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_MIME_OCTET: &str = "application/octet-stream";

/// HTTP `Cache-Control` directive preventing stale caching on Live-Link endpoints.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_CACHE_NO_CACHE: &str = "no-cache, no-store, must-revalidate";

/// Lowercase `Last-Event-ID` HTTP header key for SSE reconnect replay.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_HDR_LAST_EVENT_ID: &str = "last-event-id";

/// Query parameter fallback for `last_event_id` on `/blender/events`.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_QUERY_LAST_EVENT_ID: &str = "last_event_id";

/// HTTP `ETag` header key emitted on `GET /blender/asset/{id}`.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_HDR_ETAG: &str = "ETag";

/// HTTP `X-Accel-Buffering` header name disabling reverse-proxy SSE buffering.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_HDR_ACCEL_BUFFERING: &str = "X-Accel-Buffering";

/// HTTP `X-Accel-Buffering` value disabling buffering.
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_VAL_NO_BUFFER: &str = "no";

/// JSON error body for unsupported HTTP methods (`405`).
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_ERR_METHOD_NOT_ALLOWED: &str = "{\"error\":\"method_not_allowed\"}";

/// JSON error body for unconfigured Live-Link listener state (`503`).
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_ERR_UNCONFIGURED: &str = "{\"error\":\"live_sync_unconfigured\"}";

/// JSON error body for invalid asset ID or malformed delta JSON (`400`).
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_ERR_BAD_REQUEST: &str = "{\"error\":\"bad_request\"}";

/// JSON error body for missing asset identifier on `GET /blender/asset/{id}` (`404`).
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_ERR_NOT_FOUND: &str = "{\"error\":\"asset_not_found\"}";

/// JSON error body when an uploaded binary asset exceeds `max_asset_bytes` (`413`).
#[cfg(feature = "update-server")]
pub(crate) const BLENDER_ERR_PAYLOAD_TOO_LARGE: &str = "{\"error\":\"payload_too_large\"}";

/// Error returned when `euv blender live-sync` is invoked without the `update-server` feature enabled.
#[cfg(not(feature = "update-server"))]
pub(crate) const ERR_BLENDER_LIVE_SYNC_DISABLED: &str =
    "euv-cli was built without the `update-server` feature required for `euv blender live-sync`";

/// Error returned when a `.blend` file export requires Blender but no Blender executable was found.
pub(crate) const ERR_BLENDER_BINARY_MISSING: &str = "Blender binary not found; pass `--blender-bin`, set `EUV_BLENDER_BIN`, or install Blender 4.0+/5.1+";

/// Error returned when a file extension or binary magic header is not a supported 3D asset format.
pub(crate) const ERR_BLENDER_UNSUPPORTED_FORMAT: &str =
    "Unsupported 3D asset format; expected .blend, .glb, .gltf, .euv3d, or .obj";

/// Error returned when an uploaded Live-Link asset has zero bytes.
#[cfg(feature = "update-server")]
pub(crate) const ERR_BLENDER_EMPTY_ASSET: &str = "Imported 3D asset contains zero meshes";

/// Error returned when an asset identifier contains invalid path characters.
pub(crate) const ERR_BLENDER_INVALID_ASSET_ID: &str =
    "Invalid Blender asset identifier (only ASCII alphanumeric, `-`, `_`, `.` allowed)";

/// Error returned when `export_blend_to_glb.py` fails to run inside headless Blender.
pub(crate) const ERR_BLENDER_EXPORT_FAILED: &str = "Headless Blender glTF export failed";

/// Error returned when `--input` does not exist on disk.
pub(crate) const ERR_BLENDER_INPUT_MISSING: &str = "Input 3D asset path does not exist";

/// Human-readable status token for verified checks.
pub(crate) const BLENDER_STATUS_OK: &str = "ok";

/// Human-readable status token for unavailable optional integrations.
pub(crate) const BLENDER_STATUS_MISSING: &str = "missing";

/// Human-readable compression label for uncompressed `.blend` files.
pub(crate) const BLENDER_COMP_NONE: &str = "none";

/// Human-readable compression label for gzip-compressed `.blend` files.
pub(crate) const BLENDER_COMP_GZIP: &str = "gzip";

/// Human-readable compression label for zstd-compressed `.blend` files.
pub(crate) const BLENDER_COMP_ZSTD: &str = "zstd";

/// Fallback generator string assigned when converting an `.obj` mesh into `ImportedScene3D`.
pub(crate) const BLENDER_OBJ_GENERATOR: &str = "euv-cli OBJ importer";

/// Fallback asset stem used when an input file path lacks a UTF-8 file stem.
pub(crate) const BLENDER_DEFAULT_ASSET_STEM: &str = "scene";

/// Lowercase label for `.euv3d` `SceneMetadataJson` section.
pub(crate) const SECTION_LABEL_METADATA: &str = "scene_metadata_json";

/// Lowercase label for `.euv3d` `Vertices` section.
pub(crate) const SECTION_LABEL_VERTICES: &str = "vertices";

/// Lowercase label for `.euv3d` `Indices` section.
pub(crate) const SECTION_LABEL_INDICES: &str = "indices";

/// Lowercase label for `.euv3d` `SkinInfluences` section.
pub(crate) const SECTION_LABEL_SKINS: &str = "skin_influences";

/// Lowercase label for `.euv3d` `MorphDeltas` section.
pub(crate) const SECTION_LABEL_MORPHS: &str = "morph_deltas";

/// Lowercase label for `.euv3d` `Meshlets` section.
pub(crate) const SECTION_LABEL_MESHLETS: &str = "meshlets";

/// Lowercase label for `.euv3d` `LodTable` section.
pub(crate) const SECTION_LABEL_LOD_TABLE: &str = "lod_table";

/// Lowercase label for `.euv3d` `Bvh4Nodes` section.
pub(crate) const SECTION_LABEL_BVH4_NODES: &str = "bvh4_nodes";

/// Lowercase label for `.euv3d` `BvhTri4Packets` section.
pub(crate) const SECTION_LABEL_BVH_PACKETS: &str = "bvh_tri4_packets";

/// Lowercase label for `.euv3d` `BvhTriangles` section.
pub(crate) const SECTION_LABEL_BVH_TRIANGLES: &str = "bvh_triangles";

/// Lowercase label for `.euv3d` `AnimationsBlob` section.
pub(crate) const SECTION_LABEL_ANIMATIONS: &str = "animations_blob";

/// Lowercase label for `.euv3d` `TexturesBlob` section.
pub(crate) const SECTION_LABEL_TEXTURES: &str = "textures_blob";

/// Format label for `.blend` files.
pub(crate) const FORMAT_LABEL_BLEND: &str = "blend";

/// Format label for binary `.glb` files.
pub(crate) const FORMAT_LABEL_GLB: &str = "glb";

/// Format label for JSON `.gltf` files.
pub(crate) const FORMAT_LABEL_GLTF: &str = "gltf";

/// Format label for `.euv3d` files.
pub(crate) const FORMAT_LABEL_EUV3D: &str = "euv3d";

/// Format label for `.obj` files.
pub(crate) const FORMAT_LABEL_OBJ: &str = "obj";

/// Origin label when Blender was passed via `--blender-bin`.
pub(crate) const SOURCE_LABEL_CLI_FLAG: &str = "cli-flag";

/// Origin label when Blender was resolved from `EUV_BLENDER_BIN`.
pub(crate) const SOURCE_LABEL_ENV_VAR: &str = "env-var";

/// Origin label when Blender was discovered on `PATH`.
pub(crate) const SOURCE_LABEL_PATH: &str = "path";

/// Origin label when Blender was discovered in standard OS install directories.
pub(crate) const SOURCE_LABEL_OS_INSTALL: &str = "os-install";

/// Origin label when Blender was not found on the host.
pub(crate) const SOURCE_LABEL_NOT_FOUND: &str = "not-found";

/// Key identifying the `mtllib` directive in Wavefront `.obj` files.
pub(crate) const OBJ_DIRECTIVE_MTLLIB: &str = "mtllib ";