minify

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 6 Imported by: 0

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 File

func File(path string, content []byte) Result

File minifies content addressed by path; the extension selects the strategy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL