gitcollector

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package gitcollector provides git-aware file collection for LLM consumption

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOp

func GetOp() ops.RegisterableOp

NewGitFileCollectorActivity creates a new activity instance

Types

type FileCollectionError

type FileCollectionError struct {
	Path    string
	Reason  string
	Details map[string]interface{}
}

FileCollectionError represents an error during file collection

func (*FileCollectionError) Error

func (e *FileCollectionError) Error() string

Error implements the error interface

type FileStatistics

type FileStatistics struct {
	FilesByType      map[string]int `json:"files_by_type"`
	FilesByExtension map[string]int `json:"files_by_extension"`
	LargestFile      string         `json:"largest_file"`
	LargestFileSize  int64          `json:"largest_file_size"`
	SkippedFiles     int            `json:"skipped_files"`
	SkippedReasons   map[string]int `json:"skipped_reasons,omitempty"`
	TotalSize        int64          `json:"total_size"`
}

FileStatistics contains statistics about collected files

type GitFileCollectorInput

type GitFileCollectorInput struct {
	// Required
	ContextDir string `json:"context_dir" default:"{{ context.environment.worktree_path }}" validate:"required,dir"`

	// File filtering
	FilePatterns    []string `json:"file_patterns,omitempty" validate:"omitempty,dive,required"`
	ExcludePatterns []string `json:"exclude_patterns,omitempty" validate:"omitempty,dive,required"`

	// Size limits
	MaxFileSize  int `json:"max_file_size,omitempty" validate:"omitempty,gte=0"`
	MaxTotalSize int `json:"max_total_size,omitempty" validate:"omitempty,gte=0"`

	// Git options
	IncludeStaged    bool `json:"include_staged,omitempty"`
	IncludeUntracked bool `json:"include_untracked,omitempty"`
	UseGitignore     bool `json:"use_gitignore,omitempty"`
	ExcludeBinary    bool `json:"exclude_binary,omitempty"`

	// Processing options
	AutoDetectType  bool `json:"auto_detect_type,omitempty"`
	IncludeMetadata bool `json:"include_metadata,omitempty"`
}

GitFileCollectorInput defines the input parameters

type GitFileCollectorOutput

type GitFileCollectorOutput struct {
	Files      []file.File       `json:"files"`
	FileCount  int               `json:"file_count"`
	TotalSize  int64             `json:"total_size"`
	Repository GitRepositoryInfo `json:"repository"`
	Statistics FileStatistics    `json:"statistics,omitempty"`
}

GitFileCollectorOutput defines the output structure

type GitOperationError

type GitOperationError struct {
	Operation string
	Command   string
	ExitCode  int
	Stderr    string
	Message   string
}

GitOperationError represents an error from a git operation

func (*GitOperationError) Error

func (e *GitOperationError) Error() string

Error implements the error interface

type GitRepositoryInfo

type GitRepositoryInfo struct {
	Branch        string    `json:"branch"`
	CommitHash    string    `json:"commit_hash"`
	CommitMessage string    `json:"commit_message"`
	CommitTime    time.Time `json:"commit_time"`
	Author        string    `json:"author"`
	IsDirty       bool      `json:"is_dirty"`
	RemoteURL     string    `json:"remote_url,omitempty"`
}

GitRepositoryInfo contains git repository metadata

Jump to

Keyboard shortcuts

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