reference

package
v0.5.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: PostgreSQL Imports: 6 Imported by: 0

Documentation

Overview

Package reference derives a module's reference pages from the files it embeds, and answers the routing questions `pgedge llms` and the generator ask of them.

The layout is the contract. A package's llms.txt is its index page, and every llms/**/*.txt beneath it is one more page whose scope is the file path with the directory separators and the extension removed: llms/database/mcp.txt under "starfleet byoc" is the page for `pgedge starfleet byoc database mcp`. Nothing declares the set, so there is no list to fall behind the files, and every gate that needs the set reads it from here rather than keeping its own.

Index

Constants

View Source
const PageSizeBudget = 25 * 1024

PageSizeBudget bounds one reference page below the module index.

The split exists so an agent working on one resource reads that resource's page and nothing else; a page has to be small enough for that to be a saving. 25 KB is about 6k tokens. The module index is not bound by it: an index carries the cross-cutting prose every resource shares once, and its own budget is a separate question.

Variables

This section is empty.

Functions

func Children

func Children(docs []module.Document, scope string) []module.Document

Children returns the pages one word below scope, in scope order. They are what a routing table lists and what Tab completion offers.

func Find

func Find(docs []module.Document, scope string) (module.Document, bool)

Find returns the page for exactly this scope.

func FromFS

func FromFS(fsys fs.FS, dir, scope string) ([]module.Document, error)

FromFS returns the pages a package embeds, sorted by scope. dir is the package's path under the repository root and scope its command path under `pgedge`, "" for the root; both are recorded on every page so a caller can go from a served page back to its file.

func LongestPrefix

func LongestPrefix(docs []module.Document, scope string) (
	module.Document, bool,
)

LongestPrefix returns the page whose scope is the longest prefix of scope, word-wise, so a miss can be reported against the nearest page that does exist.

func Scopes

func Scopes(docs []module.Document) []string

Scopes returns every page's scope, in order, which is the set of ownership scopes the generator and the conformance gate share.

func TopicSummary

func TopicSummary(body []byte) (string, bool)

TopicSummary reports whether a page is a topic page, one that documents a task spanning several resources rather than a command, and returns the summary its routing-table row shows. A topic page says so on its first line, `<!-- topic: <summary> -->`, because nothing else tells it apart from a resource page whose command was deleted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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