Documentation
¶
Overview ¶
Package git is the codefly Git toolbox: every git operation an agent might want to perform, exposed as typed Tool RPCs through the codefly.services.toolbox.v0 contract.
This is the canonical replacement for `bash -c "git ..."` — agents that need to interact with a repository call a Tool here (git.status, git.log, git.diff, ...) and get structured results back. The Bash toolbox refuses any `git` invocation by referring the caller to this toolbox via the canonical-binary registry.
Implementation uses go-git (github.com/go-git/go-git/v5) — pure Go, no shell-out, no /usr/bin/git dependency. That's what makes the OS-level sandbox tight: even if the bash parser is fooled, the spawned shell can't reach a git binary because none was granted into the sandbox.
Phase 1 ships a minimal tool set proving the contract integration: status, log, diff. Add tools as needed; the dispatcher in CallTool is a switch on tool name, the input schemas are inline.
Permissions: this toolbox declares `canonical_for: [git]` in its manifest. Sandbox: read+write the workspace root, deny network (push/pull come later with explicit network grants).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
Server implements the codefly.services.toolbox.v0.Toolbox contract for git operations against a single workspace directory.
Embeds *registry.Base for the four boilerplate RPCs (ListTools, ListToolSummaries, DescribeTool, CallTool); the plugin only owns Identity() + Tools() and the per-tool handler methods.
Construct with the workspace root; every Tool dispatches against that directory. Multi-repo workspaces would either need one Server per repo (the simple route) or a Roots-based tool argument that scopes per-call (the MCP-shape route, deferred until we have the multi-repo use case in front of us).
func New ¶
New returns a Server bound to the given workspace directory. workspace must be an existing directory that contains a `.git` entry — validation defers to the first git operation that needs to open the repo, which surfaces a clear go-git error.
func (*Server) Identity ¶
func (s *Server) Identity(_ context.Context, _ *toolboxv0.IdentityRequest) (*toolboxv0.IdentityResponse, error)
func (*Server) Tools ¶
func (s *Server) Tools() []*registry.ToolDefinition
Tools is the single source of truth for this toolbox's callable surface. The four RPCs (ListTools / ListToolSummaries / DescribeTool / CallTool) all project from this slice via registry.Base.
Authors editing tools here must keep:
- SummaryDescription (one line, ≤120 chars) — drives routing
- LongDescription (multi-paragraph OK) — drives the per-call spec; spell out edge cases and when not to use
- Examples (≥1) — LLMs do dramatically better with examples than with schemas alone
- Tags — at minimum the toolbox name + a read-only/destructive marker; add domain tags to help pre-filtering
- Handler — the implementation. Base.CallTool dispatches here.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
git-toolbox
command
Command git-toolbox is the standalone binary form of the codefly git toolbox.
|
Command git-toolbox is the standalone binary form of the codefly git toolbox. |