repomap

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package repomap scans a workspace into a compact, deterministic repository map.

Index

Constants

View Source
const (
	DefaultMaxFiles = workspaceindex.DefaultMaxFiles
	DefaultMaxDepth = workspaceindex.DefaultMaxDepth
)
View Source
const (
	MatchReasonExactBasename  = "exact-basename"
	MatchReasonPrefixBasename = "prefix-basename"
	MatchReasonPathSegment    = "path-segment"
	MatchReasonSubstring      = "substring"
	MatchReasonFuzzy          = "fuzzy"
	MatchReasonMultiTerm      = "multi-term"
)

Variables

This section is empty.

Functions

func RenderPrompt

func RenderPrompt(snapshot Snapshot, budget int) string

RenderPrompt renders a compact, deterministic repository map without exceeding budget bytes. For very small budgets it returns an empty string.

Types

type Count

type Count struct {
	Name  string `json:"name"`
	Count int    `json:"fileCount"`
}

type File

type File struct {
	Path      string `json:"path"`
	Language  string `json:"language,omitempty"`
	Extension string `json:"extension,omitempty"`
	Depth     int    `json:"depth,omitempty"`
}

type Options

type Options struct {
	MaxFiles int
	// MaxDepth is measured as path separators below the root. Zero means root
	// files only; negative values use DefaultMaxDepth.
	MaxDepth            int
	MaxBytesPerFileName int
}

type RepoMap

type RepoMap = Snapshot

RepoMap is kept as a semantic alias for call sites/tests that use the product term instead of the storage term.

type SearchResult

type SearchResult struct {
	Path   string
	Score  int
	Reason string
}
func Search(snapshot Snapshot, query string, limit int) []SearchResult

type Snapshot

type Snapshot struct {
	Root            string   `json:"root"`
	Files           []File   `json:"files"`
	FileCount       int      `json:"fileCount"`
	DirectoryCount  int      `json:"directoryCount"`
	MaxDepth        int      `json:"maxDepth"`
	LanguageCounts  []Count  `json:"languages"`
	ExtensionCounts []Count  `json:"extensions"`
	ImportantFiles  []string `json:"importantFiles"`
	Tree            []string `json:"tree"`
	Truncated       bool     `json:"truncated,omitempty"`
}

func Scan

func Scan(root string, options Options) (Snapshot, error)

Jump to

Keyboard shortcuts

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