Help us shape the future of Go! Take the 2026 Go Developer Survey

compress

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package compress extracts signature-only summaries of source files using tree-sitter grammars registered in internal/lang. The result keeps doc comments and declaration signatures while dropping bodies, so an LLM can reason about structure without paying for implementation tokens. The cgo build provides the real engine; the no-cgo build keeps the original source.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor struct {
	// contains filtered or unexported fields
}

Compressor produces signature summaries for registered languages by delegating to the pooled tree-sitter engine in internal/lang/signature.

func New

func New() *Compressor

New returns a Compressor backed by a signature engine with a parser pool for every registered language.

func (*Compressor) Compress

func (c *Compressor) Compress(src []byte, id lang.ID) (string, bool)

Compress returns a signature-only summary of src for id. The boolean result reports whether any declaration was emitted; false means the source is returned unchanged (nothing to compress or a parse failure).

func (*Compressor) LanguageForPath

func (c *Compressor) LanguageForPath(path string) (lang.ID, bool)

LanguageForPath returns the language for a path that has a registered signature spec, if any.

Jump to

Keyboard shortcuts

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