Expand description
Backend-agnostic VCS provenance types and trailer-block helpers.
The engine’s git-bound bits — the Vcs trait, gix-using
repository helpers, VcsError and its From<gix::*> conversions
— live in memstead_git_branch::vcs. What stays
here is the data model that travels through every commit (caller
actor, client identity, optional tool name and provenance note) and
the deterministic helpers that turn that data into the author
signature and trailer block. Both adapters (legacy disk + git-tree)
call the helpers so two paths produce byte-identical commit
messages for the same logical input.
Structs§
- Client
Id - Identity of the process speaking to the engine. For MCP, this is the
clientInfofrom the initialize handshake (e.g.ClientId { name: "claude-code", version: "2.1.0" }). For CLI-direct mutations, the crate populates it with its own name and version. - Commit
Context - Provenance bundle for a single commit. Produced at the caller boundary
(
memstead-mcptool handler,memstead-clisubcommand, engine-internal drift flush) and threaded through to the VCS commit path.
Enums§
- Actor
- Caller categories for the
Actor:trailer and for picking an author signature.AgentandCliget their author from the pairedClientIdwhen one is present;Externalalways uses the syntheticexternal <external@memstead.io>identity (no client is known);Unknownfalls back to the committer identity.
Functions§
- author_
identity - Build the per-commit author
(name, email)pair from the context.Nonemeans “fall back to the committer identity” — adapters then reuse the committer signature for the author slot. - format_
commit_ message - Append the trailer block to the caller’s prose, separated by exactly
one blank line. Normalises trailing newlines so
"subject"and"subject\n"both produce"subject\n\nActor: …\n…". - parse_
client_ id - Inverse of the
name@versionrendering used in both the commit trailer block (Client: <name>@<version>) and the folder-backend JSONL changelog ("client": "<name>@<version>"). Splits on the last@because client names may legitimately contain.and-; versions never contain@. ReturnsNonefor malformed input (no@, empty name, empty version) so tolerant readers drop the field rather than constructing a half-record. - sanitise_
client_ name - Sanitise a raw client name to a git-safe local-part matching
[a-z0-9._-]+. Empty/whitespace-only input falls back to"unknown".