Skip to main content

euv_cli/dx/inspect/
struct.rs

1use super::*;
2
3/// Live inspection snapshot collected from a running `DevAutomationBridge`.
4#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
5pub struct LiveInspectReport {
6    /// Target `DevAutomationBridge` base HTTP URL.
7    pub(crate) url: String,
8    /// Whether the bridge responded over HTTP.
9    #[get(type(copy))]
10    pub(crate) reachable: bool,
11    /// Health status reported by `/ai/health` (or `"unreachable"`).
12    pub(crate) health_status: String,
13    /// Reported AI Schema protocol/version identifier, if present.
14    #[new(skip)]
15    pub(crate) protocol_version: String,
16    /// Active UI route reported by the live application snapshot.
17    #[new(skip)]
18    pub(crate) active_route: String,
19    /// Number of semantic scene nodes reported in the live snapshot.
20    #[new(skip)]
21    #[get(type(copy))]
22    pub(crate) node_count: usize,
23    /// Total detected 9-rule layout anomalies.
24    #[new(skip)]
25    #[get(type(copy))]
26    pub(crate) anomaly_count: usize,
27    /// Human-readable descriptions of each detected layout anomaly.
28    #[new(skip)]
29    pub(crate) anomalies: Vec<String>,
30    /// Optional connection or HTTP diagnostic error.
31    #[new(skip)]
32    pub(crate) error: Option<String>,
33}
34
35/// File path and byte length record inside a `DistInspectReport`.
36#[derive(Clone, Debug, Deserialize, Eq, Getter, New, PartialEq, Serialize)]
37pub struct DistFileStat {
38    /// Relative POSIX path beneath `dist_dir`.
39    pub(crate) path: String,
40    /// File byte size on disk.
41    #[get(type(copy))]
42    pub(crate) size_bytes: u64,
43}
44
45/// Audit summary of a local release artifact directory (`euv-release.json`, SHA-256, zero-JS check, sizes).
46#[derive(Clone, Data, Debug, Default, Deserialize, Eq, New, PartialEq, Serialize)]
47pub struct DistInspectReport {
48    /// Audited distribution directory path.
49    pub(crate) dist_dir: String,
50    /// Total regular files scanned.
51    #[get(type(copy))]
52    pub(crate) file_count: usize,
53    /// Aggregate size in bytes across all regular files.
54    #[get(type(copy))]
55    pub(crate) total_bytes: u64,
56    /// Largest files ordered descending by byte size.
57    #[new(skip)]
58    pub(crate) largest_files: Vec<DistFileStat>,
59    /// Any forbidden external `.js`, `.mjs`, or `.d.ts` files discovered.
60    #[new(skip)]
61    pub(crate) js_files: Vec<String>,
62    /// `true` when zero external `.js`/`.mjs`/`.d.ts` files exist.
63    #[new(skip)]
64    #[get(type(copy))]
65    pub(crate) zero_js_compliant: bool,
66    /// Whether `euv-release.json` exists in `dist_dir`.
67    #[new(skip)]
68    #[get(type(copy))]
69    pub(crate) manifest_present: bool,
70    /// Semantic version declared inside `euv-release.json`, if present.
71    #[new(skip)]
72    pub(crate) manifest_version: Option<String>,
73    /// Whether `euv-release.json` passed format, file existence, size, and SHA-256 verification.
74    #[new(skip)]
75    #[get(type(copy))]
76    pub(crate) manifest_verified: bool,
77    /// Any manifest or integrity errors discovered during verification.
78    #[new(skip)]
79    pub(crate) manifest_errors: Vec<String>,
80}