pub fn index(
index: &Index,
product: &ProductModel,
registry: &CapabilityRegistry,
) -> SubjectIndexExpand description
Every subject of a repository, derived from what it declares.
use majordomus_cli::capability::Provenance;
use majordomus_cli::evidence::subject;
use majordomus_cli::synthetic::SyntheticRepository;
let repo = SyntheticRepository::small().unwrap();
let ctx = repo.context().unwrap();
let s = subject::index(&ctx.index, &ctx.product, &ctx.registry);
// every builtin capability with a tool is reachable by that tool's name
for c in ctx.registry.iter() {
if !matches!(c.provenance, Provenance::Builtin { .. }) {
continue;
}
if let Some(tool) = c.exposure.mcp.as_ref().and_then(|m| m.tool.as_deref()) {
let alias = s.get(&format!("mcp:{tool}")).unwrap();
assert_eq!(alias.alias_of, Some(format!("capability:{}", c.id)));
}
}