Skip to main content

Module commit

Module commit 

Source
Expand description

The commit module: what this repository holds a commit to, what the working tree would commit, and which scope the history gives a set of paths.

Three read-only capabilities over crate::commit. Nothing here decides anything: the grammar, the policy, the judge and the planner are the domain’s, and this module is the declaration that carries them onto the surfaces — the MCP tool, the HTTP route, the OpenAPI operation, the Cockpit payload and the generated reference — without any of them holding a second copy of a rule.

The mutation is deliberately not here. Making a commit is a repository mutation, and the exposure policy (command_graph::policy) stops every machine surface at local mutation: an agent may ask what a commit would be and whether a message passes, and a person at a terminal is who commits. That is not a limitation worked around, it is the arrangement this repository chose, and the commit subsystem is shaped to it — which is why the planner and the judge are pure functions of a tree and a message.

use majordomus_cli::capability::builtin::commit::module;

// The declaration is the only place these names exist; every surface derives from it.
let m = module();
assert_eq!(m.id.as_str(), "commit");
let plan = m.capabilities.iter().find(|e| e.capability.id.as_str() == "commit.plan").unwrap();
let exposure = &plan.capability.exposure;
assert_eq!(exposure.mcp.as_ref().and_then(|m| m.tool.as_deref()), Some("majordomus_commit_plan"));
assert_eq!(exposure.http.as_ref().map(|h| h.path.as_str()), Some("/api/v1/commit/plan"));

Structs§

HistoryInput
Which range of history to judge.
ScopesReport
The vocabulary, with the policy that reads it.
ValidateInput
A message to judge, and what is known about the commit it would make.

Constants§

PLAN_URI
The URI under which the plan over the working tree is read as an MCP resource.
SCOPES_URI
The URI under which the scope vocabulary is read as an MCP resource.

Functions§

module
The module. The module: three read-only capabilities over the commit domain, plus the range judge.