redshank-cli 0.2.2

CLI entry point for the Redshank investigation agent
//! Build script — embeds the current git SHA at compile time.

use std::process::Command;

fn main() {
    // Rerun if the git HEAD changes.
    println!("cargo:rerun-if-changed=../.git/HEAD");
    println!("cargo:rerun-if-changed=../.git/refs/heads/");

    let sha = Command::new("git")
        .args(["rev-parse", "--short", "HEAD"])
        .output()
        .ok()
        .filter(|o| o.status.success())
        .and_then(|o| String::from_utf8(o.stdout).ok())
        .map_or_else(|| "unknown".to_owned(), |s| s.trim().to_owned());

    println!("cargo:rustc-env=REDSHANK_GIT_SHA={sha}");
}