pub fn answer(
index: &Index,
product: &ProductModel,
registry: &CapabilityRegistry,
ledger: &Ledger,
uncommitted: &[Execution],
presented: &Presented,
key: &str,
) -> Result<SubjectEvidence, UnknownSubject>Expand description
One subject, judged at the presented revision from the two reports of the given ledger.
The caller passes the ledger and its uncommitted executions as evidence show --presented reads them: the checkout’s ledger and nothing for the working tree, the
commit’s ledger and crate::evidence::freshness::uncommitted for a presented commit.
An unknown key costs no git work. No adjuster is set; a caller that needs one builds the
Judge itself.
use majordomus_cli::evidence::subject;
use majordomus_cli::evidence::{Ledger, Presented};
use majordomus_cli::synthetic::SyntheticRepository;
let repo = SyntheticRepository::small().unwrap();
let ctx = repo.context().unwrap();
let (ledger, p) = (Ledger::empty(), Presented::WorkingTree);
let ask = |key: &str| {
subject::answer(&ctx.index, &ctx.product, &ctx.registry, &ledger, &[], &p, key)
};
assert!(ask("nonsense").is_err());
let tool = ask("mcp:majordomus_capabilities").unwrap();
assert_eq!(tool.members.len(), 1, "an alias is made of its capability");