//! The single source of version truth for the whole workspace.
//!
//! The TypeScript build suffered a three-way drift: `index.ts`'s
//! `VERSION = "0.1.0"`, `package.json`'s `"0.13.1"`, and `resolveVersion()`'s
//! filesystem-walk fallback `"0.0.0"` could all disagree. Cargo eliminates that:
//! `[workspace.package] version` flows into `CARGO_PKG_VERSION`, and every crate
//! reads the same compile-time constant. There is no runtime resolution and no
//! fallback to drift away from.
//!
//! Grep gate: no string-literal version constants may live anywhere outside the
//! workspace `Cargo.toml`; everything reads [`VERSION`].

/// The framework version, single-sourced from `[workspace.package] version`.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn version_is_the_cargo_package_version() {
        assert_eq!(VERSION, env!("CARGO_PKG_VERSION"));
        // The 0.13.x line continues from the npm package; assert the shape so a
        // mis-set workspace version is caught here rather than at publish time.
        assert!(
            VERSION.starts_with("0.1."),
            "unexpected version: {VERSION}"
        );
    }
}
