pub fn produced_by(registry: &CapabilityRegistry) -> Option<ProducedBy>Expand description
Where else the changelog can be had, read off the declarations that already say so.
One answer for every writer of the document: the handler that serves it and the generator
that commits it both ask here, so the committed artifact and the live answer name the same
surfaces. The route, the tool and the resource are the capability’s own declaration; the
command line is the local command that renders this capability, which cli::LOCAL
declares once beside the reason it is local. Nothing is spelled out a second time, and a
page that lists these resolves each against the datasets the registry generates rather
than typing a route of its own. None only when the registry does not carry the
capability at all, which the module’s own test refuses.
use majordomus_cli::capability::builtin::release::{module, produced_by};
use majordomus_cli::capability::registry::CapabilityRegistry;
let registry = CapabilityRegistry::builder()
.with_modules(vec![module()])
.build()
.expect("the release module composes on its own");
let by = produced_by(®istry).expect("the registry carries release.changelog");
assert_eq!(by.capability, "release.changelog");
assert_eq!(by.cli.as_deref(), Some("majordomus release changelog"));
assert_eq!(by.http.as_deref(), Some("/api/v1/changelog"));
assert_eq!(by.mcp_tool.as_deref(), Some("majordomus_changelog"));
assert_eq!(by.mcp_resource.as_deref(), Some("majordomus://changelog"));