euv-cli 0.50.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
use super::*;

/// Single verified asset record inside `euv-release.json`.
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ReleaseManifestFileEntry {
    /// Forward-slash relative path from the distribution root.
    pub(crate) path: String,
    /// Lowercase hexadecimal SHA-256 digest of the file bytes.
    pub(crate) sha256: String,
    /// Exact byte length of the file on disk.
    #[get(type(copy))]
    pub(crate) size: u64,
}

/// Deterministic SHA-256 inventory manifest written to `euv-release.json`.
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct ReleaseAssetManifest {
    /// Manifest format version (always `1`).
    #[get(type(copy))]
    pub(crate) format: u32,
    /// Numeric semantic version (`MAJOR.MINOR.PATCH`).
    pub(crate) version: String,
    /// Lexicographically sorted list of verified release files.
    pub(crate) files: Vec<ReleaseManifestFileEntry>,
}

/// Binary scan report proving whether dev-only AI schema markers leaked into an artifact.
#[derive(Clone, Data, Debug, Deserialize, Eq, New, PartialEq, Serialize)]
pub struct AiSchemaScanReport {
    /// Filesystem path of the scanned artifact.
    pub(crate) path: PathBuf,
    /// Number of `euv.ai.schema.v1` occurrences found.
    #[get(type(copy))]
    pub(crate) v1_matches: usize,
    /// Number of `euv.ai.schema.v2` occurrences found.
    #[get(type(copy))]
    pub(crate) v2_matches: usize,
    /// Combined count of v1 and v2 schema marker hits.
    #[get(type(copy))]
    pub(crate) total_matches: usize,
}

/// Single file entry to write into a pure-Rust PKZIP archive.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct ZipEntryInput {
    /// Forward-slash archive-relative path (e.g. `classes.dex` or `lib/arm64-v8a/lib.so`).
    pub(crate) archive_path: String,
    /// Raw uncompressed entry payload bytes.
    pub(crate) data: Vec<u8>,
    /// When `true`, forces PKZIP method 0 (STORED / uncompressed); otherwise uses DEFLATE if smaller.
    #[get(type(copy))]
    pub(crate) stored: bool,
    /// UNIX permission bits stored in external file attributes (e.g. `0o644` or `0o755`).
    #[get(type(copy))]
    pub(crate) unix_mode: u32,
}

/// Single file or directory entry to write into a pure-Rust `.tar.gz` archive.
#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
pub struct TarEntryInput {
    /// Forward-slash archive-relative path.
    pub(crate) archive_path: String,
    /// Raw file payload bytes (empty for directories).
    pub(crate) data: Vec<u8>,
    /// UNIX permission bits (e.g. `0o644` or `0o755`).
    #[get(type(copy))]
    pub(crate) unix_mode: u32,
    /// Whether this entry represents a directory record.
    #[get(type(copy))]
    pub(crate) is_dir: bool,
}

/// Internal LSB-first bit reader used by the pure-Rust RFC 1951 DEFLATE decompressor.
pub(crate) struct DeflateBitReader<'a> {
    /// Input byte slice being decoded.
    pub(crate) bytes: &'a [u8],
    /// Current byte index inside `bytes`.
    pub(crate) byte_pos: usize,
    /// Buffered bits pending consumption.
    pub(crate) bit_buf: u64,
    /// Number of valid low bits currently inside `bit_buf`.
    pub(crate) bit_count: u32,
}

/// Internal LSB-first bit writer used by the pure-Rust RFC 1951 DEFLATE compressor.
pub(crate) struct DeflateBitWriter {
    /// Output encoded bytes.
    pub(crate) out: Vec<u8>,
    /// Buffered bits pending byte flush.
    pub(crate) bit_buf: u64,
    /// Number of buffered low bits in `bit_buf`.
    pub(crate) bit_count: u32,
}

/// Canonical Huffman decoding table constructed from code bit lengths.
pub(crate) struct HuffmanDecoder {
    /// Number of symbols assigned each bit length `1..=15`.
    pub(crate) counts: [u16; DEFLATE_MAX_BITS + 1],
    /// Symbols sorted canonically by `(bit_length, symbol)`.
    pub(crate) symbols: Vec<u16>,
}

/// Internal metadata record accumulated while writing PKZIP entries for the Central Directory.
pub(crate) struct ZipCentralRecord {
    /// UTF-8 archive entry name bytes.
    pub(crate) name_bytes: Vec<u8>,
    /// Compression method written to headers (`0` stored or `8` deflate).
    pub(crate) method: u16,
    /// General-purpose bit flags.
    pub(crate) flags: u16,
    /// CRC-32 of the uncompressed data.
    pub(crate) crc32: u32,
    /// Compressed byte size.
    pub(crate) compressed_size: u32,
    /// Uncompressed byte size.
    pub(crate) uncompressed_size: u32,
    /// Byte offset of the Local File Header within the archive.
    pub(crate) local_offset: u32,
    /// External file attributes (UNIX mode in upper 16 bits).
    pub(crate) external_attrs: u32,
}

/// Preserved raw entry extracted from an existing ZIP archive before appending new entries.
pub(crate) struct ExistingZipRawEntry {
    /// UTF-8 archive entry name.
    pub(crate) name: String,
    /// Original compression method.
    pub(crate) method: u16,
    /// Original general-purpose bit flags.
    pub(crate) flags: u16,
    /// Original CRC-32 checksum.
    pub(crate) crc32: u32,
    /// Original compressed payload bytes.
    pub(crate) compressed_data: Vec<u8>,
    /// Original uncompressed byte length.
    pub(crate) uncompressed_size: u32,
    /// Original external file attributes.
    pub(crate) external_attrs: u32,
}