Documentation
¶
Index ¶
- type AddArgs
- type AddOut
- type BlameArgs
- type BlameLine
- type BlameOut
- type BlobEncoding
- type BranchInfo
- type BranchKind
- type BranchesArgs
- type BranchesOut
- type ChangedFileInfo
- type ChangedFilesArgs
- type ChangedFilesOut
- type CheckoutArgs
- type CheckoutOut
- type CommitArgs
- type CommitInfo
- type CommitOut
- type CreateBranchArgs
- type CreateBranchOut
- type CreateTagArgs
- type CreateTagOut
- type DeleteTagArgs
- type DeleteTagOut
- type DiffArgs
- type DiffKind
- type DiffOut
- type FileHistoryArgs
- type FileHistoryCommit
- type FileHistoryOut
- type FindReposArgs
- type FindReposOut
- type FoundRepoInfo
- type GitTool
- func (gt *GitTool) Add(ctx context.Context, args AddArgs) (*AddOut, error)
- func (gt *GitTool) AddTool() spec.Tool
- func (gt *GitTool) Blame(ctx context.Context, args BlameArgs) (*BlameOut, error)
- func (gt *GitTool) BlameTool() spec.Tool
- func (gt *GitTool) Branches(ctx context.Context, args BranchesArgs) (*BranchesOut, error)
- func (gt *GitTool) BranchesTool() spec.Tool
- func (gt *GitTool) ChangedFiles(ctx context.Context, args ChangedFilesArgs) (*ChangedFilesOut, error)
- func (gt *GitTool) ChangedFilesTool() spec.Tool
- func (gt *GitTool) Checkout(ctx context.Context, args CheckoutArgs) (*CheckoutOut, error)
- func (gt *GitTool) CheckoutTool() spec.Tool
- func (gt *GitTool) Commit(ctx context.Context, args CommitArgs) (*CommitOut, error)
- func (gt *GitTool) CommitTool() spec.Tool
- func (gt *GitTool) CreateBranch(ctx context.Context, args CreateBranchArgs) (*CreateBranchOut, error)
- func (gt *GitTool) CreateBranchTool() spec.Tool
- func (gt *GitTool) CreateTag(ctx context.Context, args CreateTagArgs) (*CreateTagOut, error)
- func (gt *GitTool) CreateTagTool() spec.Tool
- func (gt *GitTool) DeleteTag(ctx context.Context, args DeleteTagArgs) (*DeleteTagOut, error)
- func (gt *GitTool) DeleteTagTool() spec.Tool
- func (gt *GitTool) Diff(ctx context.Context, args DiffArgs) (*DiffOut, error)
- func (gt *GitTool) DiffTool() spec.Tool
- func (gt *GitTool) FileHistory(ctx context.Context, args FileHistoryArgs) (*FileHistoryOut, error)
- func (gt *GitTool) FileHistoryTool() spec.Tool
- func (gt *GitTool) FindRepos(ctx context.Context, args FindReposArgs) (*FindReposOut, error)
- func (gt *GitTool) FindReposTool() spec.Tool
- func (gt *GitTool) Grep(ctx context.Context, args GrepArgs) (*GrepOut, error)
- func (gt *GitTool) GrepTool() spec.Tool
- func (gt *GitTool) Init(ctx context.Context, args InitArgs) (*InitOut, error)
- func (gt *GitTool) InitTool() spec.Tool
- func (gt *GitTool) ListTree(ctx context.Context, args ListTreeArgs) (*ListTreeOut, error)
- func (gt *GitTool) ListTreeTool() spec.Tool
- func (gt *GitTool) Log(ctx context.Context, args LogArgs) (*LogOut, error)
- func (gt *GitTool) LogTool() spec.Tool
- func (gt *GitTool) ReadBlob(ctx context.Context, args ReadBlobArgs) (*ReadBlobOut, error)
- func (gt *GitTool) ReadBlobTool() spec.Tool
- func (gt *GitTool) RepoInfo(ctx context.Context, args RepoInfoArgs) (*RepoInfoOut, error)
- func (gt *GitTool) RepoInfoTool() spec.Tool
- func (gt *GitTool) Reset(ctx context.Context, args ResetArgs) (*ResetOut, error)
- func (gt *GitTool) ResetTool() spec.Tool
- func (gt *GitTool) Show(ctx context.Context, args ShowArgs) (*ShowOut, error)
- func (gt *GitTool) ShowTool() spec.Tool
- func (gt *GitTool) Status(ctx context.Context, args StatusArgs) (*StatusOut, error)
- func (gt *GitTool) StatusTool() spec.Tool
- func (gt *GitTool) Tags(ctx context.Context, args TagsArgs) (*TagsOut, error)
- func (gt *GitTool) TagsTool() spec.Tool
- type GitToolOption
- type GrepArgs
- type GrepMatch
- type GrepOut
- type IndexState
- type InitArgs
- type InitOut
- type ListTreeArgs
- type ListTreeOut
- type LogArgs
- type LogOut
- type OutputMeta
- type ReadBlobArgs
- type ReadBlobOut
- type RemoteInfo
- type RepoInfoArgs
- type RepoInfoOut
- type ResetArgs
- type ResetMode
- type ResetOut
- type ShowArgs
- type ShowOut
- type StatusArgs
- type StatusEntry
- type StatusOut
- type TagInfo
- type TagsArgs
- type TagsOut
- type TreeEntryInfo
- type TreeModeKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlameLine ¶
type BlameLine struct {
LineNumber int `json:"lineNumber"`
Text string `json:"text"`
Commit CommitInfo `json:"commit"`
}
type BlobEncoding ¶
type BlobEncoding string
const ( BlobEncodingAuto BlobEncoding = "auto" BlobEncodingText BlobEncoding = "text" BlobEncodingBase64 BlobEncoding = "base64" )
type BranchInfo ¶
type BranchInfo struct {
Name string `json:"name"`
Kind BranchKind `json:"kind"`
Hash string `json:"hash"`
Current bool `json:"current"`
}
type BranchKind ¶
type BranchKind string
const ( BranchKindLocal BranchKind = "local" BranchKindRemote BranchKind = "remote" BranchKindAll BranchKind = "all" )
type BranchesArgs ¶
type BranchesArgs struct {
RepoPath string `json:"repoPath"`
Kind BranchKind `json:"kind,omitempty"`
}
type BranchesOut ¶
type BranchesOut struct {
RepoPath string `json:"repoPath"`
Kind BranchKind `json:"kind"`
Current string `json:"current,omitempty"`
Branches []BranchInfo `json:"branches"`
}
type ChangedFileInfo ¶
type ChangedFilesArgs ¶
type ChangedFilesOut ¶
type ChangedFilesOut struct {
RepoPath string `json:"repoPath"`
Kind DiffKind `json:"kind"`
Base string `json:"base,omitempty"`
Target string `json:"target,omitempty"`
Paths []string `json:"paths,omitempty"`
MaxCount int `json:"maxCount"`
Files []ChangedFileInfo `json:"files"`
Count int `json:"count"`
Truncated bool `json:"truncated"`
}
type CheckoutArgs ¶
type CheckoutOut ¶
type CommitArgs ¶
type CommitInfo ¶
type CreateBranchArgs ¶
type CreateBranchOut ¶
type CreateTagArgs ¶
type CreateTagOut ¶
type CreateTagOut struct {
RepoPath string `json:"repoPath"`
Name string `json:"name"`
Target string `json:"target"`
TargetHash string `json:"targetHash"`
TargetShortHash string `json:"targetShortHash"`
TagHash string `json:"tagHash"`
Annotated bool `json:"annotated"`
Message string `json:"message,omitempty"`
TaggerName string `json:"taggerName,omitempty"`
TaggerEmail string `json:"taggerEmail,omitempty"`
When time.Time `json:"when,omitzero"`
Action string `json:"action"`
}
type DeleteTagArgs ¶
type DeleteTagOut ¶
type DiffArgs ¶
type DiffArgs struct {
RepoPath string `json:"repoPath"`
Kind DiffKind `json:"kind,omitempty"`
Base string `json:"base,omitempty"`
Target string `json:"target,omitempty"`
Paths []string `json:"paths,omitempty"`
ContextLines *int `json:"contextLines,omitempty"`
MaxBytes int `json:"maxBytes,omitempty"`
}
type DiffOut ¶
type DiffOut struct {
RepoPath string `json:"repoPath"`
Kind DiffKind `json:"kind"`
Base string `json:"base,omitempty"`
Target string `json:"target,omitempty"`
Paths []string `json:"paths,omitempty"`
ContextLines int `json:"contextLines"`
Diff string `json:"diff"`
Bytes int `json:"bytes"`
Truncated bool `json:"truncated"`
OmittedBinaryFiles int `json:"omittedBinaryFiles"`
SkippedLargeFiles int `json:"skippedLargeFiles"`
OutputMeta OutputMeta `json:"outputMeta"`
}
type FileHistoryArgs ¶
type FileHistoryCommit ¶
type FileHistoryCommit struct {
Commit CommitInfo `json:"commit"`
Path string `json:"path"`
Status string `json:"status"`
}
type FileHistoryOut ¶
type FileHistoryOut struct {
RepoPath string `json:"repoPath"`
Path string `json:"path"`
Revision string `json:"revision"`
MaxCommits int `json:"maxCommits"`
MaxWalk int `json:"maxWalk"`
FirstParent bool `json:"firstParent"`
Commits []FileHistoryCommit `json:"commits"`
Count int `json:"count"`
Walked int `json:"walked"`
Truncated bool `json:"truncated"`
RenameFollowing bool `json:"renameFollowing"`
Note string `json:"note,omitempty"`
}
type FindReposArgs ¶
type FindReposOut ¶
type FindReposOut struct {
RootPath string `json:"rootPath"`
MaxDepth int `json:"maxDepth"`
MaxRepos int `json:"maxRepos"`
MaxVisitedDirs int `json:"maxVisitedDirs"`
IncludeBare bool `json:"includeBare"`
Repos []FoundRepoInfo `json:"repos"`
Count int `json:"count"`
VisitedDirs int `json:"visitedDirs"`
SkippedByDepth int `json:"skippedByDepth"`
Truncated bool `json:"truncated"`
}
type FoundRepoInfo ¶
type GitTool ¶
type GitTool struct {
// contains filtered or unexported fields
}
GitTool is an instance-owned local Git tool runner.
It intentionally does not shell out to git. Implementations use pure Go Git operations and operate only on repositories supplied by input arguments.
Path handling follows the same broad pattern as FSTool:
- workBaseDir: base for resolving relative repoPath values
- allowedRoots: optional path allow-list
- blockSymlinks: blocks symlink traversal when supported by the path policy
func NewGitTool ¶
func NewGitTool(opts ...GitToolOption) (*GitTool, error)
func (*GitTool) Branches ¶
func (gt *GitTool) Branches(ctx context.Context, args BranchesArgs) (*BranchesOut, error)
func (*GitTool) BranchesTool ¶
func (*GitTool) ChangedFiles ¶
func (gt *GitTool) ChangedFiles(ctx context.Context, args ChangedFilesArgs) (*ChangedFilesOut, error)
func (*GitTool) ChangedFilesTool ¶
func (*GitTool) Checkout ¶
func (gt *GitTool) Checkout(ctx context.Context, args CheckoutArgs) (*CheckoutOut, error)
func (*GitTool) CheckoutTool ¶
func (*GitTool) CommitTool ¶
func (*GitTool) CreateBranch ¶
func (gt *GitTool) CreateBranch(ctx context.Context, args CreateBranchArgs) (*CreateBranchOut, error)
func (*GitTool) CreateBranchTool ¶
func (*GitTool) CreateTag ¶
func (gt *GitTool) CreateTag(ctx context.Context, args CreateTagArgs) (*CreateTagOut, error)
func (*GitTool) CreateTagTool ¶
func (*GitTool) DeleteTag ¶
func (gt *GitTool) DeleteTag(ctx context.Context, args DeleteTagArgs) (*DeleteTagOut, error)
func (*GitTool) DeleteTagTool ¶
func (*GitTool) FileHistory ¶
func (gt *GitTool) FileHistory(ctx context.Context, args FileHistoryArgs) (*FileHistoryOut, error)
func (*GitTool) FileHistoryTool ¶
func (*GitTool) FindRepos ¶
func (gt *GitTool) FindRepos(ctx context.Context, args FindReposArgs) (*FindReposOut, error)
func (*GitTool) FindReposTool ¶
func (*GitTool) ListTree ¶
func (gt *GitTool) ListTree(ctx context.Context, args ListTreeArgs) (*ListTreeOut, error)
func (*GitTool) ListTreeTool ¶
func (*GitTool) ReadBlob ¶
func (gt *GitTool) ReadBlob(ctx context.Context, args ReadBlobArgs) (*ReadBlobOut, error)
func (*GitTool) ReadBlobTool ¶
func (*GitTool) RepoInfo ¶
func (gt *GitTool) RepoInfo(ctx context.Context, args RepoInfoArgs) (*RepoInfoOut, error)
func (*GitTool) RepoInfoTool ¶
func (*GitTool) StatusTool ¶
type GitToolOption ¶
func WithAllowedRoots ¶
func WithAllowedRoots(roots []string) GitToolOption
WithAllowedRoots restricts all repository paths to be within one of the provided roots. Roots are canonicalized by the shared filesystem policy.
func WithBlockSymlinks ¶
func WithBlockSymlinks(block bool) GitToolOption
WithBlockSymlinks configures whether symlink traversal should be blocked.
func WithDefaultAuthor ¶
func WithDefaultAuthor(name, email string) GitToolOption
WithDefaultAuthor sets the fallback author used by Commit when neither tool args nor repository config provide an author.
func WithWorkBaseDir ¶
func WithWorkBaseDir(base string) GitToolOption
WithWorkBaseDir sets the base directory used to resolve relative repoPath values.
type GrepArgs ¶
type GrepArgs struct {
RepoPath string `json:"repoPath"`
Pattern string `json:"pattern"`
Revision string `json:"revision,omitempty"`
Paths []string `json:"paths,omitempty"`
Literal bool `json:"literal,omitempty"`
IgnoreCase bool `json:"ignoreCase,omitempty"`
ContextLines *int `json:"contextLines,omitempty"`
MaxMatches int `json:"maxMatches,omitempty"`
MaxFiles int `json:"maxFiles,omitempty"`
MaxBytes int `json:"maxBytes,omitempty"`
}
type GrepOut ¶
type GrepOut struct {
RepoPath string `json:"repoPath"`
Revision string `json:"revision"`
Pattern string `json:"pattern"`
Paths []string `json:"paths,omitempty"`
Literal bool `json:"literal"`
IgnoreCase bool `json:"ignoreCase"`
ContextLines int `json:"contextLines"`
MaxMatches int `json:"maxMatches"`
MaxFiles int `json:"maxFiles"`
MaxBytes int `json:"maxBytes"`
Matches []GrepMatch `json:"matches"`
Count int `json:"count"`
FilesVisited int `json:"filesVisited"`
Truncated bool `json:"truncated"`
OmittedBinaryFiles int `json:"omittedBinaryFiles"`
SkippedLargeFiles int `json:"skippedLargeFiles"`
OutputMeta OutputMeta `json:"outputMeta"`
}
type IndexState ¶
type ListTreeArgs ¶
type ListTreeOut ¶
type ListTreeOut struct {
RepoPath string `json:"repoPath"`
Revision string `json:"revision"`
Path string `json:"path"`
Recursive bool `json:"recursive"`
IncludeDirs bool `json:"includeDirs"`
MaxEntries int `json:"maxEntries"`
Entries []TreeEntryInfo `json:"entries"`
Count int `json:"count"`
Truncated bool `json:"truncated"`
}
type LogOut ¶
type LogOut struct {
RepoPath string `json:"repoPath"`
Revision string `json:"revision"`
MaxCount int `json:"maxCount"`
Commits []CommitInfo `json:"commits"`
}
type OutputMeta ¶
type ReadBlobArgs ¶
type ReadBlobArgs struct {
RepoPath string `json:"repoPath"`
Revision string `json:"revision,omitempty"`
Path string `json:"path"`
Encoding BlobEncoding `json:"encoding,omitempty"`
MaxBytes int `json:"maxBytes,omitempty"`
}
type ReadBlobOut ¶
type ReadBlobOut struct {
RepoPath string `json:"repoPath"`
Revision string `json:"revision"`
Path string `json:"path"`
Mode string `json:"mode"`
Hash string `json:"hash"`
Size int64 `json:"size"`
Encoding BlobEncoding `json:"encoding"`
Content string `json:"content,omitempty"`
Bytes int `json:"bytes"`
Truncated bool `json:"truncated"`
MaxBytes int `json:"maxBytes"`
IsBinary bool `json:"isBinary"`
ContentOmitted bool `json:"contentOmitted"`
OmissionReason string `json:"omissionReason,omitempty"`
OutputMeta OutputMeta `json:"outputMeta"`
}
type RemoteInfo ¶
type RepoInfoArgs ¶
type RepoInfoArgs struct {
RepoPath string `json:"repoPath"`
}
type RepoInfoOut ¶
type RepoInfoOut struct {
RepoPath string `json:"repoPath"`
GitDir string `json:"gitDir"`
Bare bool `json:"bare"`
HeadHash string `json:"headHash,omitempty"`
Branch string `json:"branch,omitempty"`
DetachedHead bool `json:"detachedHead"`
UnbornHead bool `json:"unbornHead"`
DefaultAuthorName string `json:"defaultAuthorName,omitempty"`
DefaultAuthorEmail string `json:"defaultAuthorEmail,omitempty"`
Remotes []RemoteInfo `json:"remotes,omitempty"`
LocalBranchCount int `json:"localBranchCount"`
RemoteBranchCount int `json:"remoteBranchCount"`
TagCount int `json:"tagCount"`
IndexState IndexState `json:"indexState,omitzero"`
}
type ShowOut ¶
type ShowOut struct {
RepoPath string `json:"repoPath"`
Revision string `json:"revision"`
Commit CommitInfo `json:"commit"`
ParentHashes []string `json:"parentHashes,omitempty"`
Patch string `json:"patch,omitempty"`
PatchBytes int `json:"patchBytes,omitempty"`
PatchTruncated bool `json:"patchTruncated,omitempty"`
OutputMeta OutputMeta `json:"outputMeta,omitzero"`
Note string `json:"note,omitempty"`
}
type StatusArgs ¶
type StatusArgs struct {
RepoPath string `json:"repoPath"`
}
type StatusEntry ¶
type StatusOut ¶
type StatusOut struct {
RepoPath string `json:"repoPath"`
HeadHash string `json:"headHash,omitempty"`
Branch string `json:"branch,omitempty"`
DetachedHead bool `json:"detachedHead"`
UnbornHead bool `json:"unbornHead"`
IsClean bool `json:"isClean"`
DefaultAuthorName string `json:"defaultAuthorName,omitempty"`
DefaultAuthorEmail string `json:"defaultAuthorEmail,omitempty"`
Remotes []RemoteInfo `json:"remotes,omitempty"`
Entries []StatusEntry `json:"entries,omitempty"`
Summary map[string]int `json:"summary,omitempty"`
IndexState IndexState `json:"indexState"`
}
type TagInfo ¶
type TagInfo struct {
Name string `json:"name"`
Hash string `json:"hash"`
ShortHash string `json:"shortHash"`
Annotated bool `json:"annotated"`
TargetHash string `json:"targetHash,omitempty"`
TargetType string `json:"targetType,omitempty"`
TaggerName string `json:"taggerName,omitempty"`
TaggerEmail string `json:"taggerEmail,omitempty"`
TaggerWhen time.Time `json:"taggerWhen,omitzero"`
Message string `json:"message,omitempty"`
}
type TreeEntryInfo ¶
type TreeEntryInfo struct {
Path string `json:"path"`
Kind TreeModeKind `json:"kind"`
Mode string `json:"mode"`
Hash string `json:"hash"`
Size int64 `json:"size,omitempty"`
}
type TreeModeKind ¶
type TreeModeKind string
const ( TreeModeKindTree TreeModeKind = "tree" TreeModeKindSymlink TreeModeKind = "symlink" TreeModeKindSubmodule TreeModeKind = "submodule" TreeModeKindBlob TreeModeKind = "blob" )