Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateProgress(current, total int) float64
- func ClearByteSlice(b []byte)
- func ClearLine()
- func ClearString(s *string)
- func ContainsURL(fieldLabel string) bool
- func CopyFile(src, dst string) error
- func EnsureDirectory(path string, perm os.FileMode) error
- func ExtractURL(text string) string
- func FileExists(path string) bool
- func FindConfigFiles(rootPath string) ([]string, error)
- func FindFiles(rootPath string, opts FileDiscoveryOptions) ([]string, error)
- func FindJSONFiles(rootPath string) ([]string, error)
- func FormatDuration(d time.Duration) string
- func FormatDurationLong(d time.Duration) string
- func FormatTimeAgo(t time.Time) string
- func GenerateRepoBirdURL(runID string) string
- func GetAPIURL(configFallback ...string) string
- func InitClipboard() error
- func IsDirectory(path string) bool
- func IsNonEmptyNumber(s string) bool
- func IsTerminalStatus(status models.RunStatus) bool
- func IsURL(text string) bool
- func LoadConfigFromFile(filepath string) (*models.RunConfig, string, error)
- func LoadConfigFromFileNoPrompts(filepath string) (*models.RunConfig, string, error)
- func LoadConfigFromFileWithPrompts(filepath string) (*models.RunConfig, string, *prompts.ValidationPromptHandler, error)
- func LoadMarkdownOrJSONConfig(filepath string) (*models.RunConfig, string, error)
- func MarshalJSON(v interface{}) ([]byte, error)
- func MarshalJSONIndent(v interface{}, prefix, indent string) ([]byte, error)
- func MarshalJSONIndentToString(v interface{}) (string, error)
- func MarshalJSONToString(v interface{}) (string, error)
- func MaskAPIKey(apiKey string) string
- func MaskSensitiveString(value string, showChars int) string
- func NewClipboardError(message string) error
- func OpenURL(ctx context.Context, urlStr string) error
- func OpenURLWithTimeout(urlStr string) error
- func ParseJSONFromStdin() (*models.RunConfig, error)
- func ParseJSONFromStdinWithPrompts() (*models.RunConfig, *prompts.ValidationPromptHandler, error)
- func ParseMarkdownConfig(filepath string) (*models.RunConfig, string, error)
- func ParseMarkdownConfigFromReader(r io.Reader) (*models.RunConfig, string, error)
- func ParseYAMLConfig(filepath string) (*models.RunConfig, error)
- func ParseYAMLConfigFromReader(r io.Reader) (*models.RunConfig, error)
- func ParseYAMLConfigFromReaderWithPrompts(r io.Reader) (*models.RunConfig, *prompts.ValidationPromptHandler, error)
- func ParseYAMLConfigWithPrompts(filepath string) (*models.RunConfig, *prompts.ValidationPromptHandler, error)
- func ReadFileWithError(path string) ([]byte, error)
- func ReadPromptInput(input string) (string, error)
- func RedactAuthHeader(headerValue string) string
- func RemoveFileIfExists(path string) error
- func SanitizeErrorMessage(err error, apiKey string) string
- func ShowPollingProgress(startTime time.Time, status string, message string)
- func SuggestFieldName(input string, validFields []string) string
- func TruncateMultiline(s string, maxWidth int) string
- func TruncateSimple(s string, maxLen int) string
- func TruncateWithEllipsis(s string, maxWidth int) string
- func UnmarshalJSON(data []byte, v interface{}) error
- func ValidateAPIKeyFormat(apiKey string) error
- func ValidateRunConfig(config *models.RunConfig) error
- func WriteFileWithError(path string, data []byte, perm os.FileMode) error
- func WriteToClipboard(ctx context.Context, text string) error
- func WriteToClipboardWithTimeout(text string) error
- type ClipboardError
- type CompletionFunc
- type FileDiscoveryOptions
- type FileInfo
- type GenericPollConfig
- type GenericPollFunc
- type GenericPoller
- type MarkdownConfig
- type PollConfig
- type PollFunc
- type Poller
- type PullRequestConfig
- type UpdateCallback
- type YAMLConfig
Constants ¶
Variables ¶
var DefaultIgnorePatterns = []string{
"node_modules", ".git", "build", "dist", "target",
"bin", ".cache", ".next", ".vscode", ".idea",
"vendor", "__pycache__", ".nuxt", ".output",
".svelte-kit", ".turbo", "coverage", ".nyc_output",
}
Functions ¶
func CalculateProgress ¶
CalculateProgress returns a progress percentage
func ClearByteSlice ¶
func ClearByteSlice(b []byte)
ClearByteSlice overwrites a byte slice with zeros
func ClearString ¶
func ClearString(s *string)
ClearString attempts to clear a string from memory (best effort) Note: In Go, this is not guaranteed due to garbage collection and string immutability
func ContainsURL ¶
ContainsURL checks if a field label typically contains URLs
func EnsureDirectory ¶
EnsureDirectory ensures a directory exists, creating it if necessary
func ExtractURL ¶
ExtractURL extracts the first URL from a string
func FindConfigFiles ¶
FindConfigFiles finds all config files (JSON, YAML, and Markdown) in a directory structure
func FindFiles ¶
func FindFiles(rootPath string, opts FileDiscoveryOptions) ([]string, error)
FindFiles recursively finds files matching the given options
func FindJSONFiles ¶
FindJSONFiles finds JSON files in the given directory with default options
func FormatDuration ¶
FormatDuration formats a duration in a human-readable way
func FormatDurationLong ¶
FormatDurationLong formats a duration in a detailed human-readable format
func FormatTimeAgo ¶
FormatTimeAgo formats a time as a human-readable "ago" string
func GenerateRepoBirdURL ¶
GenerateRepoBirdURL generates a RepoBird URL for a given run ID
func GetAPIURL ¶
GetAPIURL returns the appropriate API URL based on environment Priority: REPOBIRD_API_URL > REPOBIRD_ENV=dev > configFallback > default
func InitClipboard ¶
func InitClipboard() error
InitClipboard tries to initialize the clipboard It will detect if CGO is available and set the appropriate mode
func IsNonEmptyNumber ¶
IsNonEmptyNumber checks if a string contains a non-empty number (digits only)
func IsTerminalStatus ¶
func LoadConfigFromFile ¶
LoadConfigFromFile loads configuration from JSON, YAML, or Markdown files
func LoadConfigFromFileNoPrompts ¶
LoadConfigFromFileNoPrompts loads config without showing validation prompts
func LoadConfigFromFileWithPrompts ¶
func LoadConfigFromFileWithPrompts(filepath string) (*models.RunConfig, string, *prompts.ValidationPromptHandler, error)
LoadConfigFromFileWithPrompts loads configuration and returns validation prompts for processing
func LoadMarkdownOrJSONConfig ¶
LoadMarkdownOrJSONConfig loads configuration from either markdown or JSON file
func MarshalJSON ¶
MarshalJSON marshals an interface to JSON with standardized error handling
func MarshalJSONIndent ¶
MarshalJSONIndent marshals an interface to pretty-printed JSON with standardized error handling
func MarshalJSONIndentToString ¶
MarshalJSONIndentToString marshals an interface to a pretty-printed JSON string
func MarshalJSONToString ¶
MarshalJSONToString marshals an interface to a JSON string
func MaskAPIKey ¶
MaskAPIKey masks an API key for secure display, showing only the first 4 characters
func MaskSensitiveString ¶
MaskSensitiveString masks any sensitive string for display
func NewClipboardError ¶
NewClipboardError creates a new clipboard error
func OpenURLWithTimeout ¶
OpenURLWithTimeout is a convenience function that creates a context with default timeout
func ParseJSONFromStdin ¶
ParseJSONFromStdin parses JSON from stdin with unknown field support and warnings
func ParseJSONFromStdinWithPrompts ¶
func ParseJSONFromStdinWithPrompts() (*models.RunConfig, *prompts.ValidationPromptHandler, error)
ParseJSONFromStdinWithPrompts parses JSON from stdin with validation prompts
func ParseMarkdownConfig ¶
ParseMarkdownConfig reads and parses a markdown file with frontmatter
func ParseMarkdownConfigFromReader ¶
ParseMarkdownConfigFromReader parses markdown config from an io.Reader
func ParseYAMLConfig ¶
ParseYAMLConfig reads and parses a YAML configuration file
func ParseYAMLConfigFromReader ¶
ParseYAMLConfigFromReader parses YAML config from an io.Reader
func ParseYAMLConfigFromReaderWithPrompts ¶
func ParseYAMLConfigFromReaderWithPrompts(r io.Reader) (*models.RunConfig, *prompts.ValidationPromptHandler, error)
ParseYAMLConfigFromReaderWithPrompts parses YAML config from an io.Reader with validation prompts
func ParseYAMLConfigWithPrompts ¶
func ParseYAMLConfigWithPrompts(filepath string) (*models.RunConfig, *prompts.ValidationPromptHandler, error)
ParseYAMLConfigWithPrompts reads and parses a YAML configuration file with validation prompts
func ReadFileWithError ¶
ReadFileWithError reads a file and returns standardized error messages
func ReadPromptInput ¶ added in v0.1.5
ReadPromptInput reads prompt content from either a literal string or a file. If the input starts with '@', it reads from the file specified after the @. If the input is '-', it reads from stdin. Otherwise, it returns the input as-is.
Examples:
- "Fix the bug" returns "Fix the bug"
- "@prompt.txt" reads content from prompt.txt
- "@/path/to/prompt.md" reads content from /path/to/prompt.md
- "-" reads from stdin
- "@@literal" returns "@literal" (double @ escapes the @)
func RedactAuthHeader ¶
RedactAuthHeader redacts the Authorization header value for logging
func RemoveFileIfExists ¶
RemoveFileIfExists removes a file if it exists, ignoring not-exist errors
func SanitizeErrorMessage ¶
SanitizeErrorMessage removes sensitive information from error messages
func ShowPollingProgress ¶
func SuggestFieldName ¶
SuggestFieldName suggests the most similar field name for an unknown field
func TruncateMultiline ¶
TruncateMultiline truncates a string handling newlines and tabs. Takes only the first line and converts tabs to spaces. Uses rune counting for proper unicode handling.
func TruncateSimple ¶
TruncateSimple truncates a string based on byte length. This is faster but doesn't handle unicode display width correctly. Use this for non-display purposes or when you know the string is ASCII.
func TruncateWithEllipsis ¶
TruncateWithEllipsis truncates a string to fit within maxWidth using display width (handles unicode/emoji properly). This should be used for terminal display where visual width matters.
func UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into an interface with standardized error handling
func ValidateAPIKeyFormat ¶
ValidateAPIKeyFormat performs basic validation on API key format without revealing specifics about what's wrong
func ValidateRunConfig ¶
ValidateRunConfig validates a RunConfig structure and applies defaults
func WriteFileWithError ¶
WriteFileWithError writes data to a file with standardized error messages
func WriteToClipboard ¶
WriteToClipboard writes text to the system clipboard with context support It uses CGO clipboard if available, otherwise falls back to OS commands
func WriteToClipboardWithTimeout ¶
WriteToClipboardWithTimeout is a convenience function that creates a context with default timeout
Types ¶
type ClipboardError ¶
type ClipboardError struct {
Message string
}
ClipboardError represents a clipboard operation error
func (ClipboardError) Error ¶
func (e ClipboardError) Error() string
type CompletionFunc ¶
CompletionFunc checks if the result is in a terminal state
type FileDiscoveryOptions ¶
type GenericPollConfig ¶
type GenericPollConfig struct {
Interval time.Duration
MaxInterval time.Duration
BackoffFactor float64
Timeout time.Duration
ShowProgress bool
Debug bool
}
GenericPollConfig holds configuration for polling operations
type GenericPollFunc ¶
PollFunc is a generic function that fetches the current state
type GenericPoller ¶
type GenericPoller[T any] struct { // contains filtered or unexported fields }
GenericPoller handles polling operations with exponential backoff
func NewGenericPoller ¶
func NewGenericPoller[T any](config *GenericPollConfig) *GenericPoller[T]
NewGenericPoller creates a new generic poller
func (*GenericPoller[T]) PollUntilComplete ¶
func (p *GenericPoller[T]) PollUntilComplete( ctx context.Context, pollFunc GenericPollFunc[T], isComplete CompletionFunc[T], onUpdate UpdateCallback[T], ) (T, error)
PollUntilComplete polls until the completion function returns true
type MarkdownConfig ¶
type MarkdownConfig struct {
Prompt string `yaml:"prompt" json:"prompt"`
Repository string `yaml:"repository" json:"repository"`
Source string `yaml:"source" json:"source"`
Target string `yaml:"target" json:"target"`
BaseBranch string `yaml:"baseBranch" json:"baseBranch"`
OutputMode string `yaml:"outputMode" json:"outputMode"`
OutputBranch string `yaml:"outputBranch" json:"outputBranch"`
PRTargetBranch string `yaml:"prTargetBranch" json:"prTargetBranch"`
OutputBranchPolicy string `yaml:"outputBranchPolicy" json:"outputBranchPolicy"`
RunType string `yaml:"runType" json:"runType"`
Title string `yaml:"title" json:"title"`
Context string `yaml:"context" json:"context"`
Files []string `yaml:"files" json:"files"`
ProviderCredentialID string `yaml:"providerCredentialId" json:"providerCredentialId"`
ProviderMode string `yaml:"providerMode" json:"providerMode"`
OpenCodeModel string `yaml:"opencodeModel,omitempty" json:"opencodeModel,omitempty"`
OpenCodeProvider string `yaml:"opencodeProvider,omitempty" json:"opencodeProvider,omitempty"`
ReasoningEffort string `yaml:"reasoningEffort,omitempty" json:"reasoningEffort,omitempty"`
GitLabCredential *models.GitLabCredentialRequest `yaml:"gitlabCredential,omitempty" json:"gitlabCredential,omitempty"`
BranchOnly bool `yaml:"branchOnly" json:"branchOnly"`
AcknowledgePromptRisk bool `yaml:"acknowledgePromptRisk" json:"acknowledgePromptRisk"`
PullRequest *PullRequestConfig `yaml:"pullRequest,omitempty" json:"pullRequest,omitempty"`
Metadata map[string]interface{} `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}
MarkdownConfig represents the frontmatter structure in markdown task files
type PollConfig ¶
type PollConfig struct {
Interval time.Duration
MaxDuration time.Duration
ShowProgress bool
Debug bool
}
func DefaultPollConfig ¶
func DefaultPollConfig() *PollConfig
type Poller ¶
type Poller struct {
// contains filtered or unexported fields
}
func NewPoller ¶
func NewPoller(config *PollConfig) *Poller
type PullRequestConfig ¶
type PullRequestConfig struct {
Create bool `yaml:"create" json:"create"`
Draft bool `yaml:"draft" json:"draft"`
}
PullRequestConfig represents pull request configuration
type UpdateCallback ¶
type UpdateCallback[T any] func(T)
UpdateCallback is called with each poll result
type YAMLConfig ¶
type YAMLConfig struct {
Prompt string `yaml:"prompt" json:"prompt"`
Repository string `yaml:"repository" json:"repository"`
Source string `yaml:"source" json:"source"`
Target string `yaml:"target" json:"target"`
BaseBranch string `yaml:"baseBranch" json:"baseBranch"`
OutputMode string `yaml:"outputMode" json:"outputMode"`
OutputBranch string `yaml:"outputBranch" json:"outputBranch"`
PRTargetBranch string `yaml:"prTargetBranch" json:"prTargetBranch"`
OutputBranchPolicy string `yaml:"outputBranchPolicy" json:"outputBranchPolicy"`
RunType string `yaml:"runType" json:"runType"`
Title string `yaml:"title" json:"title"`
Context string `yaml:"context" json:"context"`
Files []string `yaml:"files" json:"files"`
ProviderCredentialID string `yaml:"providerCredentialId" json:"providerCredentialId"`
ProviderMode string `yaml:"providerMode" json:"providerMode"`
OpenCodeModel string `yaml:"opencodeModel,omitempty" json:"opencodeModel,omitempty"`
OpenCodeProvider string `yaml:"opencodeProvider,omitempty" json:"opencodeProvider,omitempty"`
ReasoningEffort string `yaml:"reasoningEffort,omitempty" json:"reasoningEffort,omitempty"`
GitLabCredential *models.GitLabCredentialRequest `yaml:"gitlabCredential,omitempty" json:"gitlabCredential,omitempty"`
BranchOnly bool `yaml:"branchOnly" json:"branchOnly"`
AcknowledgePromptRisk bool `yaml:"acknowledgePromptRisk" json:"acknowledgePromptRisk"`
PullRequest *PullRequestConfig `yaml:"pullRequest,omitempty" json:"pullRequest,omitempty"`
Metadata map[string]interface{} `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}
YAMLConfig represents the structure of a YAML configuration file