Skip to main content

module

Function module 

Source
pub fn module() -> ModuleDescriptor
Expand description

The evidence module: claims joined to the runs recorded against them.

The declaration is the whole of what the capabilities are — every projection, from the HTTP route to the MCP tool to the word a person types, is read out of what it returns. Nothing here caches: the ledger is a file that changes outside this process, and a cached answer would be exactly the stale evidence the module exists to name.

use majordomus_cli::capability::builtin::evidence::module;
use majordomus_cli::capability::CachePolicy;

let m = module();
let report = m
    .capabilities
    .iter()
    .find(|e| e.capability.id.as_str() == "evidence.report")
    .unwrap();
assert_eq!(report.capability.exposure.http.as_ref().unwrap().path, "/api/v1/evidence");
assert_eq!(
    report.capability.exposure.mcp.as_ref().unwrap().tool.as_deref(),
    Some("majordomus_evidence")
);

// `evidence.test` is spelled `majordomus evidence proves`: `test` is a word the fish
// completion adapter refuses, and the identity is not the command
let test = m
    .capabilities
    .iter()
    .find(|e| e.capability.id.as_str() == "evidence.test")
    .unwrap();
assert_eq!(test.capability.exposure.cli.as_ref().unwrap().path[1], "proves");

// the ledger changes outside this process: kept, if at all, per checkout state only
assert!(m.capabilities.iter().all(|e| matches!(
    e.capability.cache,
    CachePolicy::Disabled | CachePolicy::Checkout { .. }
)));