Documentation
¶
Overview ¶
Package refs implements context reference expansion for the TUI. It parses @ref syntax and expands file, folder, git, and web references into inline content that can be shown in chat messages.
Index ¶
Constants ¶
const ( // MaxLinesPerRef is the maximum number of lines for a single reference. MaxLinesPerRef = 500 // MaxFolderEntries is the maximum number of entries in a folder listing. MaxFolderEntries = 200 )
Constants for truncation limits.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Expander ¶
type Expander struct {
// contains filtered or unexported fields
}
Expander processes context references in user input.
func NewExpander ¶
NewExpander creates a new Expander with the given work directory.
type ExpansionResult ¶
type ExpansionResult struct {
// Original is the original input message.
Original string
// Expanded is the message with reference content appended.
Expanded string
// RefsFound is the list of references found.
RefsFound []ParsedRef
// RefsExpanded maps reference raw values to their expanded content.
RefsExpanded map[string]string
// Warnings contains warning messages for invalid refs.
Warnings []string
// Truncated indicates which refs were truncated.
Truncated []string
}
ExpansionResult contains the result of expanding references.
type ParsedRef ¶
type ParsedRef struct {
Type RefType
RawValue string // Original @ref string including the type prefix
Value string // Parsed value (path, URL, etc.)
LineRange *LineRange // For @file:path:start-end
}
ParsedRef represents a parsed @ref reference.
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator enforces security policies on references.
func NewValidator ¶
NewValidator creates a new Validator with default security policies.
func (*Validator) IsBinaryFile ¶
IsBinaryFile checks if a file is binary by examining its content.
func (*Validator) IsBinaryPath ¶
IsBinaryPath checks if a file path points to a known binary file type.
func (*Validator) ValidateFile ¶
ValidateFile validates a file reference for security and accessibility.
func (*Validator) ValidateFolder ¶
ValidateFolder validates a folder reference for security and accessibility.
func (*Validator) ValidatePath ¶
ValidatePath checks if a path is safe to access. Returns an error with a warning message if the path is blocked.