repomap

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTokenBudget = 2048

Variables

This section is empty.

Functions

func Render

func Render(m *Map, tokenBudget int) string

Render writes a map as text for a prompt: a header, then the entries in rank order until the budget of tokenBudget tokens (about four characters each, DefaultTokenBudget when it is 0 or less) is reached. A nil map renders as an empty string.

Types

type Entry

type Entry struct {
	Path      string
	Language  string
	Package   string
	Imports   []string
	Symbols   []Symbol
	RankScore float64
}

Entry is one file of the map: its path, language and package, what it imports, the symbols it declares, and the rank score that orders it.

type Map

type Map struct {
	Root          string
	FilesScanned  int
	FilesIncluded int
	Entries       []Entry
}

Map is a ranked outline of a repository: how many files were scanned and how many were mapped, and the entries, best ranked first.

func Build

func Build(ctx context.Context, opts Options) (*Map, error)

Build scans the repository under opts.Root, keeps the Go source files (not the tests nor the generated files) that declare or import something, ranks them, favouring opts.FocusFiles and opts.FocusSymbols, and returns the map. Cancelling ctx stops the scan.

type Options

type Options struct {
	Root         string
	TokenBudget  int
	FocusFiles   []string
	FocusSymbols []string
}

Options configures a repository map: the directory to map (the working directory when empty), the budget in tokens of the rendered map, and the files and symbols that the ranking should favour.

type Symbol

type Symbol struct {
	Kind      string
	Name      string
	Signature string
	Exported  bool
	Line      int
}

Symbol is a declaration found in a file: its kind, name and signature, whether it is exported, and its line.

Jump to

Keyboard shortcuts

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