Skip to main content

Crate newt_git

Crate newt_git 

Source
Expand description

newt-git — the embedded git engine for newt agents.

Wraps grit-lib (a pure-Rust, from-scratch git reimplementation, MIT) behind the GitCaveats OCAP surface. Every operation takes the already-composed &GitCaveats and fails closed; results are this crate’s own structured serde models, converted at the grit-lib boundary — so grit-lib’s pre-1.0 API churn is contained to this one crate and never leaks into the rest of the workspace.

Scope: LOCAL ops — reads (open/status/log/diff) and writes (add/commit/branch), each gated by the matching GitCaveats axis and fail-closed without it. Network ops (clone/fetch/push) are deferred (PR5) — fail-closed under the OCAP deviation ratchet, riding the SSH transport. We depend ONLY on the MIT grit-lib, never the GPL-2.0 grit-legacy.

Structs§

Author
Commit authorship — supplied by the caller (e.g. from the agent identity).
CommitInfo
One commit’s metadata.
DiffReport
The set of files a diff touched.
FileChange
A single changed path. status is git’s status letter (M/A/D/R/C/…).
GitEngine
An embedded git engine bound to one repository.
LocalGitTool
The on-disk GitEngine adapted to newt-core’s GitTool seam. The binary constructs one per session (root = workspace, author = the resolved agent identity) and injects it into the agent loop; execute_tool’s git arm calls dispatch. A fresh GitEngine::open per call keeps it stateless and cheap (no long-lived handle across turns).
RebaseReport
Outcome of a rebase.
RebaseStep
One entry in a structured rebase plan.
StatusReport
Working-tree status — the porcelain facts, no presentation.

Enums§

DiffSpec
Which diff to compute.
GitError
Errors from the embedded git engine.
RebaseAction
What a rebase step does with its commit.