Documentation
¶
Overview ¶
Package types defines the core language contracts shared by every driver and the registry. It is a leaf package: drivers import it, and nothing inside it imports back, which keeps the driver/facade graph cycle-free.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultRetention ¶
DefaultRetention returns the baseline retention priority for a role: how strongly the utility optimizer should keep files of that role under a token budget. Entrypoints and docs carry the most context for an LLM, so they get the highest guarantees; derivations and noise get none.
Types ¶
type Classification ¶
type Classification struct {
Role Role
Adjustment float64
Confidence float64
Reason string
// Retention is the default importance of the file's role: how strongly
// the utility optimizer should keep it under a token budget. Zero means
// the role carries no retention guarantee. Drivers and the shared role
// table may set it; the config layer can override per role.
Retention float64
}
Classification is a soft selection signal for ranking and budgeting.
type ImportScanner ¶
type ImportScanner interface {
// Imports returns the import targets referenced by content as
// repo-relative path prefixes (e.g. "internal/app" for a Go import of
// "example.com/mod/internal/app"). moduleRoot is the repo's module path
// (e.g. the go.mod module line); drivers use it to strip the module
// prefix from absolute imports. Unresolvable or external references may
// be omitted.
Imports(path, moduleRoot string, content []byte) []string
}
ImportScanner is an optional capability of a Language that returns the import paths referenced by a file's content. It powers reverse import fan-in for centrality scoring. Import syntax is language knowledge, so the parsing and module-root stripping rules live in each driver rather than in the ranker.
type Language ¶
type Language interface {
ID() ID
Name() string
Extensions() []string
// Classify returns the architectural role of a normalized, lowercase,
// slash-separated path and its lowercase basename.
Classify(path, filename string) Classification
// ShouldSkipSmart reports whether the path matches a smart-filter rule.
ShouldSkipSmart(path, filename string, content []byte) (bool, string)
}
Language is the contract every driver implements. Signature extraction (Grammar + SignatureSpec) is provided separately through the cgo-only signature package so this common interface builds without cgo.
type Role ¶
type Role string
Role describes the likely architecture purpose of a file.
const ( RoleUnknown Role = "unknown" RoleEntrypoint Role = "entrypoint" RoleAPI Role = "api" RoleImpl Role = "implementation" RoleTest Role = "test" RoleFixture Role = "fixture" RoleMock Role = "mock" RoleConfig Role = "config" RoleSchema Role = "schema" RoleDocs Role = "docs" RoleGenerated Role = "generated" RoleExample Role = "example" RoleVendor Role = "vendor" )
type SignatureResolver ¶
SignatureResolver is an optional capability of a Language that maps a path to the signature registry ID for it. The catch-all "other" driver implements it so secondary languages resolve to their own grammar and declaration rules.