git

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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

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 (t *BranchTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*BranchTool) Call

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

func (t *BranchTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type CommitTool

type CommitTool struct{}

func NewCommitTool

func NewCommitTool() *CommitTool

func (*CommitTool) BackfillInput

func (t *CommitTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*CommitTool) Call

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

func (t *CommitTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type DiffTool

type DiffTool struct{}

func NewDiffTool

func NewDiffTool() *DiffTool

func (*DiffTool) BackfillInput

func (t *DiffTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*DiffTool) Call

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) Description

func (t *DiffTool) Description(_ context.Context) (string, error)

func (*DiffTool) FormatResult

func (t *DiffTool) FormatResult(data any) string

func (*DiffTool) IsConcurrencySafe

func (t *DiffTool) IsConcurrencySafe(_ map[string]any) bool

func (*DiffTool) IsEnabled

func (t *DiffTool) IsEnabled() bool

func (*DiffTool) IsReadOnly

func (t *DiffTool) IsReadOnly(_ map[string]any) bool

func (*DiffTool) ValidateInput

func (t *DiffTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type LogTool

type LogTool struct{}

func NewLogTool

func NewLogTool() *LogTool

func (*LogTool) BackfillInput

func (t *LogTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*LogTool) Call

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) Description

func (t *LogTool) Description(_ context.Context) (string, error)

func (*LogTool) FormatResult

func (t *LogTool) FormatResult(data any) string

func (*LogTool) IsConcurrencySafe

func (t *LogTool) IsConcurrencySafe(_ map[string]any) bool

func (*LogTool) IsEnabled

func (t *LogTool) IsEnabled() bool

func (*LogTool) IsReadOnly

func (t *LogTool) IsReadOnly(_ map[string]any) bool

func (*LogTool) ValidateInput

func (t *LogTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

type StatusTool

type StatusTool struct{}

func NewStatusTool

func NewStatusTool() *StatusTool

func (*StatusTool) BackfillInput

func (t *StatusTool) BackfillInput(_ context.Context, in map[string]any) map[string]any

func (*StatusTool) Call

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

func (t *StatusTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL