assura 0.4.1

Contract-first AI-native language. Write what it should do. AI proves it does.
//! Shared helpers for assura CLI integration tests.
//!
//! Each integration test binary compiles this module independently; helpers
//! used by only some binaries would otherwise warn as dead_code.
#![allow(dead_code)]

use std::path::PathBuf;

/// Path to the `assura` binary, guaranteed to exist by Cargo.
pub fn assura_bin() -> PathBuf {
    PathBuf::from(env!("CARGO_BIN_EXE_assura"))
}

/// Workspace root (two levels up from crate manifest).
pub fn workspace_root() -> String {
    env!("CARGO_MANIFEST_DIR").replace("/crates/assura-cli", "")
}

/// Unique temp dir (using tempfile for strong uniqueness across parallel tests).
/// The TempDir guard is leaked so the directory persists for the duration of the
/// test (and is cleaned up by explicit remove_dir_all at end of each test or OS).
pub fn unique_temp(prefix: &str) -> std::path::PathBuf {
    let d = tempfile::Builder::new()
        .prefix(&format!("{}_", prefix))
        .tempdir()
        .expect("failed to create unique temp dir");
    let p = d.path().to_path_buf();
    std::mem::forget(d);
    p
}