Documentation
¶
Overview ¶
Package format renders a scanned document in configurable output styles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
type Document struct {
DirectoryTree string
Files []FileEntry
TotalTokens int
// Instructions is an optional task/directive section emitted before the
// repository body when set (--prompt).
Instructions string
}
Document is the complete set of data handed to a Renderer.
type FileEntry ¶
type FileEntry struct {
Path string
Content []byte
Tokens int
IsCompressed bool
Language string
// Picker-only fields, populated by CollectPicker for the interactive TUI.
// SigContent is the signature-only (tree-sitter) rendering of Content.
SigContent []byte
TokensFull int
TokensSig int
SecretCount int
RankScore float64
Hidden bool
GitIgnored bool
}
FileEntry holds one file's content and metadata for rendering.
type JSONFileEntry ¶
type JSONFileEntry struct {
Path string `json:"path"`
Content string `json:"content"` // Base64 encoded content
Tokens int `json:"tokens,omitempty"`
}
JSONFileEntry is the wire format for a single file in JSON output.
type RenderOptions ¶
type RenderOptions struct {
UseColors bool
Highlight highlight.Options
// Sections, when non-nil, collects one byte range per rendered file
// (XML/Markdown/Plain only; JSON marshals whole and records nothing).
// Offsets index the exact bytes written to w.
Sections *[]Section
}
RenderOptions controls terminal-only presentation features.
type Renderer ¶
Renderer renders a Document to w.
func NewRenderer ¶
NewRenderer returns a Renderer for the given style.
func NewRendererWithOptions ¶
func NewRendererWithOptions(style Style, options RenderOptions) (Renderer, error)
NewRendererWithOptions creates a renderer with explicit terminal display options. Non-terminal renderers ignore highlighting options.
type Section ¶ added in v1.4.0
Section is one file's byte range inside a rendered document. Start is the offset of the file block's first byte, End one past its last byte, so doc[Start:End] is exactly that file's rendered block. Tokens is the file's token count at render time.
type Style ¶
type Style string
Style identifies a supported output format.
func ParseStyle ¶
ParseStyle converts a style string to a Style, defaulting to plain.