Skip to main content

bijux_cli/api/
version.rs

1#![forbid(unsafe_code)]
2//! Runtime version API.
3
4/// Runtime version source classification.
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub struct RuntimeVersionInfo {
7    /// Runtime binary/product name.
8    pub name: &'static str,
9    /// User-facing version string.
10    pub version: &'static str,
11    /// Semver-compatible runtime version.
12    pub semver: &'static str,
13    /// Version provenance source.
14    pub source: &'static str,
15    /// Optional commit identifier for the build.
16    pub git_commit: Option<&'static str>,
17    /// Optional repository dirty-state marker.
18    pub git_dirty: Option<bool>,
19    /// Runtime profile (`debug` or `release`).
20    pub build_profile: &'static str,
21}
22
23/// Runtime version string for user-visible output.
24#[must_use]
25pub const fn runtime_version() -> &'static str {
26    crate::shared::version::runtime_version()
27}
28
29/// Semver-compatible runtime version string used for compatibility checks.
30#[must_use]
31pub const fn runtime_semver() -> &'static str {
32    crate::shared::version::runtime_semver()
33}
34
35/// Runtime version source classification.
36#[must_use]
37pub fn runtime_version_source() -> &'static str {
38    crate::shared::version::runtime_version_source()
39}
40
41/// Runtime commit identifier when available.
42#[must_use]
43pub fn runtime_git_commit() -> Option<&'static str> {
44    crate::shared::version::runtime_git_commit()
45}
46
47/// Runtime dirty-state marker when available.
48#[must_use]
49pub fn runtime_git_dirty() -> Option<bool> {
50    crate::shared::version::runtime_git_dirty()
51}
52
53/// Runtime build profile (`debug` or `release`).
54#[must_use]
55pub fn runtime_build_profile() -> &'static str {
56    crate::shared::version::runtime_build_profile()
57}
58
59/// Canonical runtime version metadata.
60#[must_use]
61pub fn runtime_version_info() -> RuntimeVersionInfo {
62    let info = crate::shared::version::runtime_version_info();
63    RuntimeVersionInfo {
64        name: info.name,
65        version: info.version,
66        semver: info.semver,
67        source: info.source,
68        git_commit: info.git_commit,
69        git_dirty: info.git_dirty,
70        build_profile: info.build_profile,
71    }
72}
73
74/// Docker-style text line for `version` rendering.
75#[must_use]
76pub fn runtime_version_line() -> String {
77    crate::shared::version::runtime_version_line()
78}