Documentation
¶
Overview ¶
Package minify produces a denser, token-cheaper VIEW of a source file for read-only exploration. It strips comments and redundant whitespace so the model can scan or understand code for far fewer tokens than read_file's raw, line-numbered output — without ever changing the file on disk.
Correctness over aggression: Go is minified through the real go/parser AST (guaranteed valid, comment-free output), and any file it cannot parse — or any non-Go file — falls back to a conservative whitespace normalization that can never alter code meaning (it strips no comments, since doing that safely needs a real parser per language). The transform is therefore incapable of corrupting what the model sees: the worst case is "no reduction", never "wrong content".
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
Content string // minified (or whitespace-normalized) text; never line-numbered
Language string // strategy taken: "go" or "text"
Applied bool // true only when real comment-stripping minification ran
}
Result is the outcome of minifying one file's bytes.
func ContextualFragment ¶
ContextualFragment minifies a bounded fragment after checking its starting position against the complete source. A Go range that begins inside a string or comment must remain verbatim apart from whitespace normalization: parsing that fragment by itself would mistake literal text for Go syntax.