surjection-core 1.2.0

Core library of Surjection: MCP servers, skills and secret references for AI coding clients
Documentation
//! The pinned uv release Surjection downloads when no uv is on `PATH` (M52):
//! one archive per platform, with the SHA-256 and size of the archive and
//! of the `uv` and `uvx` inside it. Surjection checks a download against these
//! compiled values, never against a file fetched at install time.
//! `scripts/pin-uv.ps1 -Version <v>` generates them: it checks each archive
//! against both the release's `<archive>.sha256` and GitHub's API digest,
//! extracts it with the system tar and hashes `uv` and `uvx`.

/// The pinned uv release (published 2026-11-24).
pub const VERSION: &str = "0.13.10";

/// Where the release assets are downloaded from.
const RELEASES: &str = "https://github.com/astral-sh/uv/releases/download";

/// The largest archive accepted (the biggest pinned one is ~17 MiB).
pub const MAX_DOWNLOAD: u64 = 64 * 1024 * 1024;
/// The bound every pinned file stays under (the biggest `uv` is ~38 MiB;
/// checked by the pin test). Extraction reads at most the pinned size.
pub const MAX_FILE: u64 = 128 * 1024 * 1024;

/// One file inside a pinned archive.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PinnedFile {
    /// Its path inside the archive (`/`-separated).
    pub path: &'static str,
    pub sha256: &'static str,
    pub size: u64,
}

/// One platform's archive of the pinned release.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct PinnedUv {
    /// `std::env::consts::OS`.
    pub os: &'static str,
    /// `std::env::consts::ARCH`.
    pub arch: &'static str,
    /// The release asset's file name (`.zip` or `.tar.gz`).
    pub archive: &'static str,
    pub archive_sha256: &'static str,
    pub archive_size: u64,
    pub uv: PinnedFile,
    pub uvx: PinnedFile,
}

/// Every archive of the pinned release. No Windows on Arm: SkillSpector
/// has no yara-python wheel there anyway.
pub const PINNED: &[PinnedUv] = &[
    PinnedUv {
        os: "windows",
        arch: "x86_64",
        archive: "uv-x86_64-pc-windows-msvc.zip",
        archive_sha256: "297b3881fe1adfb922becc2c1613202abb41dc83ea5ff43d472aa087ca1f8683",
        archive_size: 15641577,
        uv: PinnedFile {
            path: "uv.exe",
            sha256: "9f9f3631112f847c81b2063637ce01f4dd8d65e8ac2a8f4bb1c121f7effa5c76",
            size: 32770864,
        },
        uvx: PinnedFile {
            path: "uvx.exe",
            sha256: "ecc61418ab3b09c9963bb0e04bd8b4a2ee9a25d40228446835e23e3c8139545c",
            size: 338736,
        },
    },
    PinnedUv {
        os: "linux",
        arch: "x86_64",
        archive: "uv-x86_64-unknown-linux-gnu.tar.gz",
        archive_sha256: "bf65ac1a0af10f92c522d91ac096c7c0a39657647b155577e7836c2cbbb4526c",
        archive_size: 17113138,
        uv: PinnedFile {
            path: "uv-x86_64-unknown-linux-gnu/uv",
            sha256: "bfe31619b549d39d9031cb2cadc5a95d1258efcad746628a3a6212da4ae5dfbf",
            size: 38538864,
        },
        uvx: PinnedFile {
            path: "uv-x86_64-unknown-linux-gnu/uvx",
            sha256: "844e0e7d7fc19c187ba4e23b256c1b9ae1e72ce02974e719979906d6fe0a76ad",
            size: 331352,
        },
    },
    PinnedUv {
        os: "linux",
        arch: "aarch64",
        archive: "uv-aarch64-unknown-linux-gnu.tar.gz",
        archive_sha256: "14590f644805a6234ffe071154340669e38137f38e60aa9629690119704107d2",
        archive_size: 16275135,
        uv: PinnedFile {
            path: "uv-aarch64-unknown-linux-gnu/uv",
            sha256: "54d8e2847b8da2889015e590ef80c4203e0730cd1b0c314da6d2dd11d5817217",
            size: 32711296,
        },
        uvx: PinnedFile {
            path: "uv-aarch64-unknown-linux-gnu/uvx",
            sha256: "8a5e35032e9b4cc5c031b22809151566513ba0de83f3cd604e87b274073895f4",
            size: 297680,
        },
    },
    PinnedUv {
        os: "macos",
        arch: "aarch64",
        archive: "uv-aarch64-apple-darwin.tar.gz",
        archive_sha256: "e419bf07533bdbf48795fc793601c834dd79db57a8c49ce8e25cfe3a8639958d",
        archive_size: 14700626,
        uv: PinnedFile {
            path: "uv-aarch64-apple-darwin/uv",
            sha256: "4ff271e49765b1d8ed72cfbf720401941efccac6b2997ce87bb05ee790312ab3",
            size: 28604656,
        },
        uvx: PinnedFile {
            path: "uv-aarch64-apple-darwin/uvx",
            sha256: "0d621b3bcc9ec4a1b55ce0499620f8518513bebf42e7a16b4b411717c42fd690",
            size: 334528,
        },
    },
    PinnedUv {
        os: "macos",
        arch: "x86_64",
        archive: "uv-x86_64-apple-darwin.tar.gz",
        archive_sha256: "153e03197588204c04fc4c81cc4bafbfa4280222a385e4ee36a87aeec0ae63b4",
        archive_size: 17489953,
        uv: PinnedFile {
            path: "uv-x86_64-apple-darwin/uv",
            sha256: "4ae0c9d36977fe47218549301930c4f7f9cf6706a9a30d75ad23ed496769d589",
            size: 39252576,
        },
        uvx: PinnedFile {
            path: "uv-x86_64-apple-darwin/uvx",
            sha256: "767d2ad8606dbb63c4f534ff470bcee06b9889069de3c575c5ac04842e8e56d2",
            size: 344176,
        },
    },
];

/// The pinned archive for `os` and `arch` (`std::env::consts` values).
pub fn pinned_for(os: &str, arch: &str) -> Option<&'static PinnedUv> {
    PINNED.iter().find(|pin| pin.os == os && pin.arch == arch)
}

/// The pinned archive of this build's platform; `None` elsewhere.
pub fn pinned() -> Option<&'static PinnedUv> {
    pinned_for(std::env::consts::OS, std::env::consts::ARCH)
}

/// The release download address of `archive`.
pub fn download_url(version: &str, archive: &str) -> String {
    format!("{RELEASES}/{version}/{archive}")
}