use domain/cache/core.nu [cache-lookup, write-sync-request] export def derive-ncl-cache-key [ file_path: string import_paths: list = [] format: string = "json" ]: nothing -> string { if not ($file_path | path exists) { error make {msg: $"file not found: ($file_path)"} } let content = (open --raw $file_path | decode utf-8) $"($content)($format)" | hash sha256 } export def lookup-nickel-cache [ file_path: string --import-paths: list = [] --format: string = "json" ]: nothing -> record { let key = (derive-ncl-cache-key $file_path $import_paths $format) let result = (cache-lookup "nickel" $key) {valid: $result.valid, data: $result.data} } export def request-ncl-sync [ file_path: string --import-paths: list = [] ]: nothing -> nothing { write-sync-request [{path: $file_path, import_paths: $import_paths}] } export def get-nickel-cache-stats []: nothing -> record { {total_entries: 0, total_size_mb: 0.0, hit_count: 0, miss_count: 0} } export def clear-nickel-cache []: nothing -> nothing { use domain/cache/core.nu [cache-clear-type] cache-clear-type "nickel" } export def cache-nickel-compile [file_path: string, compiled_output: record]: nothing -> nothing {} export def warm-nickel-cache [workspace_path: string]: nothing -> nothing { if not ($workspace_path | path exists) { return } do {^ncl-sync warm $workspace_path} | complete | ignore }