# Cache System Module - Simplified
# Avoids complex re-export patterns that cause Nushell 0.110.0 parser issues

# Import core only - other modules import their dependencies directly
# Selective imports (ADR-025 Phase 3 Layer 2).
# cache/metadata star-import was dead — dropped.
use lib_provisioning/config/cache/core.nu [get-cache-stats]

# Helper: Initialize cache system
export def init-cache-system [] {
    let home = ($env.HOME? | default "~" | path expand)
    let cache_base = ($home | path join ".provisioning" "cache" "config")

    for dir in ["nickel" "sops" "workspaces" "providers" "platform" "index"] {
        let dir_path = ($cache_base | path join $dir)
        if not ($dir_path | path exists) {
            mkdir $dir_path
        }
    }
}

# Helper: Get cache status summary
export def get-cache-summary [] {
    let stats = (get-cache-stats)
    $"Cache: ($stats.total_entries) entries, ($stats.total_size_mb | math round -p 1) MB"
}
