Documentation
¶
Index ¶
- Variables
- func PackageEntityName(name string) string
- func Register(p FileParser)
- func RegisterDefaults(reg *ParserRegistry)
- type AuxEntity
- type CodeOwner
- type FileParser
- func AsyncAPIParser() FileParser
- func CatalogParser() FileParser
- func CodeownersParser() FileParser
- func GoModParser() FileParser
- func K8sServiceParser() FileParser
- func OpenAPIParser() FileParser
- func PackageJSONParser() FileParser
- func PomParser() FileParser
- func ProtoParser() FileParser
- func SpringKafkaParser() FileParser
- type MergeMode
- type ParsedCatalog
- type ParsedCodeowners
- type ParsedFile
- type ParsedGoMod
- type ParsedPackageJSON
- type ParsedPom
- type ParsedRelation
- type ParserRegistry
Constants ¶
This section is empty.
Variables ¶
var Default = NewRegistry()
Functions ¶
func PackageEntityName ¶
func Register ¶
func Register(p FileParser)
func RegisterDefaults ¶
func RegisterDefaults(reg *ParserRegistry)
RegisterDefaults registers all built-in parsers on reg. Callers that need an isolated registry (e.g. the benchmark CLI) use this instead of the package-level Register helpers that modify Default.
Types ¶
type AuxEntity ¶
AuxEntity is an additional graph entity produced alongside the primary entity. Used by parsers that create multiple entities (e.g. CodeownersParser creates one team/person entity per owner).
type CodeOwner ¶
type CodeOwner struct {
// Raw is the original owner token as written in the file
// (e.g. "@myorg/backend-team", "@alice", "alice@example.com").
Raw string
// EntityName is the normalized identifier used as the knowledge-graph node name
// (e.g. "backend-team", "alice").
EntityName string
// EntityType is "team" for @org/team handles, "person" for @username or e-mail owners.
EntityType string
}
CodeOwner represents a single owner entry extracted from a CODEOWNERS file.
type FileParser ¶
type FileParser interface {
// FileType returns the classifier key used by classifyFile() and the indexer.
// Must be unique across the registry. Examples: "gomod", "catalog-info".
FileType() string
// Filenames returns the exact filenames (or suffix sentinels starting with ".")
// this parser handles. The scanner looks for these at the repo root.
// Examples: ["go.mod"], ["catalog-info.yaml"], [".proto"] (suffix match).
Filenames() []string
// Parse converts raw file bytes into a normalized graph-ready result.
Parse(data []byte) (ParsedFile, error)
}
FileParser is the extension point for manifest parsers. All methods must be safe for concurrent use (implementations are typically stateless).
func AsyncAPIParser ¶
func AsyncAPIParser() FileParser
func CatalogParser ¶
func CatalogParser() FileParser
func CodeownersParser ¶
func CodeownersParser() FileParser
CodeownersParser returns the FileParser for CODEOWNERS files.
func GoModParser ¶
func GoModParser() FileParser
func K8sServiceParser ¶
func K8sServiceParser() FileParser
func OpenAPIParser ¶
func OpenAPIParser() FileParser
func PackageJSONParser ¶
func PackageJSONParser() FileParser
func PomParser ¶
func PomParser() FileParser
func ProtoParser ¶
func ProtoParser() FileParser
ProtoParser returns the FileParser for *.proto files (suffix-matched by scanner).
func SpringKafkaParser ¶
func SpringKafkaParser() FileParser
type MergeMode ¶
type MergeMode int
MergeMode controls how upsertParsedFile() handles existing graph entities.
type ParsedCatalog ¶
type ParsedCatalog struct {
EntityName string
EntityType string
Observations []string
Relations []ParsedRelation
}
func ParseCatalog ¶
func ParseCatalog(data []byte) (ParsedCatalog, error)
type ParsedCodeowners ¶
type ParsedCodeowners struct {
// UniqueOwners contains every distinct owner token found across all rules.
UniqueOwners []CodeOwner
}
ParsedCodeowners holds the deduplicated set of owners found in a CODEOWNERS file.
func ParseCodeowners ¶
func ParseCodeowners(data []byte) ParsedCodeowners
ParseCodeowners parses raw CODEOWNERS file bytes and returns the deduplicated set of owner entries. It supports the three GitHub CODEOWNERS owner formats:
- @org/team → EntityType "team", EntityName = team slug (last path segment)
- @username → EntityType "person", EntityName = username (without @)
- user@email → EntityType "person", EntityName = local part before @
Lines starting with '#' and blank lines are ignored. Patterns without owners (lone path entries) are silently skipped.
type ParsedFile ¶
type ParsedFile struct {
EntityName string
EntityType string
Observations []string
Relations []ParsedRelation
MergeMode MergeMode
// AuxEntities are created/updated before Relations. Used when a single file
// produces multiple graph entities (e.g. CODEOWNERS produces one per owner).
AuxEntities []AuxEntity
}
ParsedFile is the normalized, graph-ready output every FileParser must return. EntityName must be non-empty unless AuxEntities is non-empty (codeowners pattern). EntityType defaults to "service" if blank. Observations and Relations may be nil or empty. MergeMode defaults to MergeModeUpsert if zero. Relations with From == "" have their From field filled with the derived repo service name. Relations with To == "" have their To field filled with the derived repo service name.
type ParsedGoMod ¶
type ParsedGoMod struct {
ModulePath string
EntityName string
GoVersion string
DirectDeps []string
}
func ParseGoMod ¶
func ParseGoMod(data []byte) (ParsedGoMod, error)
type ParsedPackageJSON ¶
func ParsePackageJSON ¶
func ParsePackageJSON(data []byte) (ParsedPackageJSON, error)
type ParsedPom ¶
type ParsedRelation ¶
type ParsedRelation struct {
From string
To string
RelationType string // e.g. "depends_on", "owns", "provides_api"
// Confidence is the edge reliability level. Parsers set "authoritative" for explicit
// contract files (AsyncAPI, OpenAPI, proto, go.mod, pom.xml, catalog, CODEOWNERS, package.json)
// and "inferred" for heuristic sources (Spring Kafka, K8s env vars).
// If empty, the indexer defaults to "authoritative".
Confidence string
}
ParsedRelation is a directed edge produced by a parser. If To is empty (""), the indexer fills it with the derived repo service name — used by CodeownersParser where the target service is context-dependent.
type ParserRegistry ¶
type ParserRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *ParserRegistry
func (*ParserRegistry) All ¶
func (r *ParserRegistry) All() []FileParser
func (*ParserRegistry) Get ¶
func (r *ParserRegistry) Get(fileType string) (FileParser, bool)
func (*ParserRegistry) Register ¶
func (r *ParserRegistry) Register(p FileParser)
func (*ParserRegistry) TargetFilenames ¶
func (r *ParserRegistry) TargetFilenames() []string