Documentation
¶
Overview ¶
Package context provides global configuration and packaging logic for brfit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTokenTree ¶ added in v0.20.0
func BuildTokenTree(root string, files []FileTokenCount) string
BuildTokenTree generates a directory tree string with per-file token counts. Each file node shows its token count, and directory nodes show the sum of their children.
Types ¶
type FileTokenCount ¶ added in v0.20.0
FileTokenCount holds a file path and its token count.
type Options ¶
type Options struct {
// Path is the target path to scan.
Path string
// Version is the brf.it version string.
Version string
// Format is the output format ("xml" or "md").
Format string
// Output is the output file path (empty = stdout).
Output string
// IgnoreFiles is the list of custom ignore file paths.
IgnoreFiles []string
// IncludeHidden determines whether to include hidden files.
IncludeHidden bool
// IncludeBody determines whether to include function/method bodies.
IncludeBody bool
// IncludeImports determines whether to include import/export statements.
IncludeImports bool
// DedupeImports deduplicates imports across files and shows them globally.
// Requires IncludeImports to be true.
DedupeImports bool
// IncludeTree determines whether to include directory tree.
IncludeTree bool
// IncludePrivate determines whether to include private symbols.
IncludePrivate bool
// MaxFileSize is the maximum file size in bytes.
MaxFileSize int64
// MaxDocLength is the maximum length of documentation comments.
// 0 means no limit (default).
MaxDocLength int
// NoSchema skips the schema section in XML output.
NoSchema bool
// SecurityCheck enables secret detection and redaction.
SecurityCheck bool
// IncludeCallGraph enables function call graph extraction.
IncludeCallGraph bool
}
Options contains CLI options for packaging.
func DefaultOptions ¶
func DefaultOptions() *Options
DefaultOptions returns Options with sensible defaults.
type Packager ¶
type Packager struct {
// contains filtered or unexported fields
}
Packager orchestrates scanning, extraction, and formatting.
func NewDefaultPackager ¶
func NewDefaultPackager(scanOpts *scanner.ScanOptions) (*Packager, error)
NewDefaultPackager creates a Packager with default dependencies. Tokenizer is set to TiktokenTokenizer if available, otherwise NoOpTokenizer.
func NewPackager ¶
func NewPackager( s scanner.Scanner, e extractor.Extractor, f map[string]formatter.Formatter, ) *Packager
NewPackager creates a new Packager with the given dependencies. Tokenizer is set to NoOpTokenizer by default; use SetTokenizer to change.
func (*Packager) SetTokenizer ¶
SetTokenizer sets the tokenizer for the packager. Pass nil to disable token counting (uses NoOpTokenizer).
type Result ¶
type Result struct {
// Content is the formatted output bytes.
Content []byte
// TotalSignatures is the total number of signatures.
TotalSignatures int
// TotalFiles is the number of processed files.
TotalFiles int
// TotalSize is the total size of processed files.
TotalSize int64
// TokenCount is the number of tokens in the output.
// Returns 0 if token counting is disabled or tokenizer is not set.
TokenCount int
}
Result contains the final packaged output.