Documentation
¶
Overview ¶
Package git provides structured tools for git operations.
Why structured tools instead of bash? The Bash tool can run git commands, but returns raw text. These tools return typed JSON — the agent can reason about branches, diffs, and commit history without parsing shell output, and the engine can apply permission guards to destructive operations (commit, push, reset).
Implementation notes for contributors:
- All tools use os/exec to invoke the local git binary — no external API, no credentials needed for most read operations.
- git_commit and git_push set RequiresPermission: true so the user is prompted before the engine touches the repo history.
- Keep each tool focused: git_status only reports state, git_commit only creates commits — do not combine operations in one tool call.
See GitHub issue for full implementation spec.
Index ¶
- Variables
- type BranchTool
- func (t *BranchTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *BranchTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *BranchTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *BranchTool) Definition() tool.Definition
- func (t *BranchTool) Description(_ context.Context) (string, error)
- func (t *BranchTool) FormatResult(data any) string
- func (t *BranchTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *BranchTool) IsEnabled() bool
- func (t *BranchTool) IsReadOnly(_ map[string]any) bool
- func (t *BranchTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
- type CommitTool
- func (t *CommitTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *CommitTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *CommitTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *CommitTool) Definition() tool.Definition
- func (t *CommitTool) Description(_ context.Context) (string, error)
- func (t *CommitTool) FormatResult(data any) string
- func (t *CommitTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *CommitTool) IsEnabled() bool
- func (t *CommitTool) IsReadOnly(_ map[string]any) bool
- func (t *CommitTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
- type DiffTool
- func (t *DiffTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *DiffTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *DiffTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *DiffTool) Definition() tool.Definition
- func (t *DiffTool) Description(_ context.Context) (string, error)
- func (t *DiffTool) FormatResult(data any) string
- func (t *DiffTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *DiffTool) IsEnabled() bool
- func (t *DiffTool) IsReadOnly(_ map[string]any) bool
- func (t *DiffTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
- type LogTool
- func (t *LogTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *LogTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *LogTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *LogTool) Definition() tool.Definition
- func (t *LogTool) Description(_ context.Context) (string, error)
- func (t *LogTool) FormatResult(data any) string
- func (t *LogTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *LogTool) IsEnabled() bool
- func (t *LogTool) IsReadOnly(_ map[string]any) bool
- func (t *LogTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
- type StatusTool
- func (t *StatusTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *StatusTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *StatusTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *StatusTool) Definition() tool.Definition
- func (t *StatusTool) Description(_ context.Context) (string, error)
- func (t *StatusTool) FormatResult(data any) string
- func (t *StatusTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *StatusTool) IsEnabled() bool
- func (t *StatusTool) IsReadOnly(_ map[string]any) bool
- func (t *StatusTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotImplemented = errors.New("git tools: not implemented — see GitHub issue")
ErrNotImplemented is returned by all git tools until os/exec wrappers are complete.
Functions ¶
This section is empty.
Types ¶
type BranchTool ¶
type BranchTool struct{}
func NewBranchTool ¶
func NewBranchTool() *BranchTool
func (*BranchTool) BackfillInput ¶
func (*BranchTool) Call ¶
func (t *BranchTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*BranchTool) CheckPermissions ¶
func (t *BranchTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*BranchTool) Definition ¶
func (t *BranchTool) Definition() tool.Definition
func (*BranchTool) Description ¶
func (t *BranchTool) Description(_ context.Context) (string, error)
func (*BranchTool) FormatResult ¶
func (t *BranchTool) FormatResult(data any) string
func (*BranchTool) IsConcurrencySafe ¶
func (t *BranchTool) IsConcurrencySafe(_ map[string]any) bool
func (*BranchTool) IsEnabled ¶
func (t *BranchTool) IsEnabled() bool
func (*BranchTool) IsReadOnly ¶
func (t *BranchTool) IsReadOnly(_ map[string]any) bool
func (*BranchTool) ValidateInput ¶
type CommitTool ¶
type CommitTool struct{}
func NewCommitTool ¶
func NewCommitTool() *CommitTool
func (*CommitTool) BackfillInput ¶
func (*CommitTool) Call ¶
func (t *CommitTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*CommitTool) CheckPermissions ¶
func (t *CommitTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*CommitTool) Definition ¶
func (t *CommitTool) Definition() tool.Definition
func (*CommitTool) Description ¶
func (t *CommitTool) Description(_ context.Context) (string, error)
func (*CommitTool) FormatResult ¶
func (t *CommitTool) FormatResult(data any) string
func (*CommitTool) IsConcurrencySafe ¶
func (t *CommitTool) IsConcurrencySafe(_ map[string]any) bool
func (*CommitTool) IsEnabled ¶
func (t *CommitTool) IsEnabled() bool
func (*CommitTool) IsReadOnly ¶
func (t *CommitTool) IsReadOnly(_ map[string]any) bool
func (*CommitTool) ValidateInput ¶
type DiffTool ¶
type DiffTool struct{}
func NewDiffTool ¶
func NewDiffTool() *DiffTool
func (*DiffTool) BackfillInput ¶
func (*DiffTool) Call ¶
func (t *DiffTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*DiffTool) CheckPermissions ¶
func (t *DiffTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*DiffTool) Definition ¶
func (t *DiffTool) Definition() tool.Definition
func (*DiffTool) FormatResult ¶
type LogTool ¶
type LogTool struct{}
func NewLogTool ¶
func NewLogTool() *LogTool
func (*LogTool) BackfillInput ¶
func (*LogTool) Call ¶
func (t *LogTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*LogTool) CheckPermissions ¶
func (t *LogTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*LogTool) Definition ¶
func (t *LogTool) Definition() tool.Definition
func (*LogTool) FormatResult ¶
type StatusTool ¶
type StatusTool struct{}
func NewStatusTool ¶
func NewStatusTool() *StatusTool
func (*StatusTool) BackfillInput ¶
func (*StatusTool) Call ¶
func (t *StatusTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*StatusTool) CheckPermissions ¶
func (t *StatusTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*StatusTool) Definition ¶
func (t *StatusTool) Definition() tool.Definition
func (*StatusTool) Description ¶
func (t *StatusTool) Description(_ context.Context) (string, error)
func (*StatusTool) FormatResult ¶
func (t *StatusTool) FormatResult(data any) string
func (*StatusTool) IsConcurrencySafe ¶
func (t *StatusTool) IsConcurrencySafe(_ map[string]any) bool
func (*StatusTool) IsEnabled ¶
func (t *StatusTool) IsEnabled() bool
func (*StatusTool) IsReadOnly ¶
func (t *StatusTool) IsReadOnly(_ map[string]any) bool
func (*StatusTool) ValidateInput ¶
Click to show internal directories.
Click to hide internal directories.