Documentation
¶
Overview ¶
Package repometa scans a source repository and reports the components (buildable units) it contains, plus any monorepo workspace layouts it recognizes. It is intended to be imported by downstream tools that need to reason about arbitrary repositories without re-implementing discovery logic.
The API is unstable. See the repo README for scope and non-goals.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component struct {
Kind Kind
Root string // path relative to Manifest.Root; "." for the repo root
Evidence []Evidence
Confidence float64 // 0.0 – 1.0; heuristic hits report < 1.0
Workspaces []Workspace
Attributes map[string]string
}
Component describes a single buildable unit inside the repo, anchored at a specific directory. A directory may produce multiple Components when more than one ecosystem's manifest is present (e.g. a Rust crate with a co-located Node package).
type Evidence ¶
Evidence records a single fact that led to a Component being reported. Path is relative to Manifest.Root so evidence remains meaningful when the manifest is transported.
type Kind ¶
type Kind string
Kind identifies the type of a Component. Values are open-ended strings so new detectors can be added without breaking consumers on enum drift.
const ( KindGoModule Kind = "go-module" KindRustCrate Kind = "rust-crate" KindRustWorkspace Kind = "rust-workspace" KindPythonPackage Kind = "python-package" KindNodePackage Kind = "node-package" KindCMakeProject Kind = "cmake-project" KindMakeProject Kind = "make-project" KindCSource Kind = "c-source-tree" KindAsmSource Kind = "asm-source-tree" )
Kind values for every ecosystem detector shipped in this package. See the README's "Supported detectors" table for the mapping to ecosystem.
type Manifest ¶
Manifest is the result of scanning a repository. Consumers are expected to iterate Components; the ordering is deterministic (depth-first, lexicographic within a directory) so diff-friendly serializations are possible.
type Option ¶
type Option func(*options)
Option configures a Scan call.
func WithMaxDepth ¶
WithMaxDepth caps directory recursion depth. The scan root is depth 0.
func WithMaxDirs ¶
WithMaxDirs caps the total number of directories visited during the scan. The walk aborts silently when this cap is hit; Stats.DirCapHits will be non-zero when this happens.
func WithMaxFileSize ¶
WithMaxFileSize caps how many bytes any single manifest file may be read into memory. Files above this cap are skipped for content parsing but their presence is still recorded as evidence.
type ScanStats ¶
type ScanStats struct {
DirsVisited int
FilesSeen int
DepthCapHits int
DirCapHits int
SymlinksSkipped int
}
ScanStats reports counters from the walk, useful for downstream tools that want to know whether they hit a cap and should widen the scan.
type Workspace ¶
type Workspace struct {
Kind WorkspaceKind
Members []string
}
Workspace describes a monorepo layout anchored at a Component. Members are paths (relative to Manifest.Root) of the workspace's constituent packages. Members may be empty when the workspace kind was detected by file presence alone (see docs on each WorkspaceKind).
type WorkspaceKind ¶
type WorkspaceKind string
WorkspaceKind identifies the workspace / monorepo tooling in use.
const ( WorkspaceGo WorkspaceKind = "go-workspace" WorkspaceCargo WorkspaceKind = "cargo-workspace" WorkspaceNpmYarn WorkspaceKind = "npm-yarn-workspace" WorkspacePnpm WorkspaceKind = "pnpm-workspace" WorkspaceNx WorkspaceKind = "nx" WorkspaceTurborepo WorkspaceKind = "turborepo" WorkspaceUv WorkspaceKind = "uv-workspace" )
WorkspaceKind values for every workspace layout recognized by the detectors in this package.