graph

package
v3.23.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package graph groups source files into logical subsystems for blueprint record generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoveredDirs added in v3.17.0

func CoveredDirs(routeFiles []string) map[string]bool

CoveredDirs returns the set of directories containing at least one of routeFiles. A directory in this set already has framework-based blueprint coverage (it contributed a route to some group) and must not be re-grouped by a supplemental, framework-agnostic pass — otherwise the same directory would receive two blueprint records.

Types

type DirectoryGrouper

type DirectoryGrouper struct{}

DirectoryGrouper groups files by their containing directory.

func (DirectoryGrouper) Group

func (DirectoryGrouper) Group(files []File) ([]Group, error)

Group implements Grouper by clustering files that share a containing directory. Groups are returned sorted by directory name; files within a group are sorted by path. The repo root is named ".".

type File

type File struct {
	Path    string // relative to the scan root
	Lang    lang.Language
	Symbols []symbols.Symbol
	Imports []string
}

File is one source file discovered during a framework-agnostic scan.

func CoveredDirExtras added in v3.17.0

func CoveredDirExtras(files []File, covered map[string]bool, routeFiles []string) []File

CoveredDirExtras returns the subset of files whose containing directory is in covered but whose own path is not itself one of routeFiles — e.g. helper.go living next to router.go in the same package. FilterUncovered already excludes their whole directory from the framework-agnostic supplemental pass (so the directory never gets a second, duplicate blueprint), but without this they were dropped from coverage entirely instead of being merged into the route group's existing blueprint.

func FilterUncovered added in v3.17.0

func FilterUncovered(files []File, covered map[string]bool) []File

FilterUncovered returns the subset of files whose containing directory is not in covered, preserving order.

type Group

type Group struct {
	Name  string
	Files []File
}

Group is a cluster of related files sharing a grouping identity.

type Grouper

type Grouper interface {
	Group(files []File) ([]Group, error)
}

Grouper clusters discovered files into logical groups for blueprint record generation. Directory grouping (Option A, see DirectoryGrouper) is the default. A future community-detection grouper (Option B — clustering by import graph connectivity) can implement this interface and be substituted in without changing the rest of the discover pipeline.

Jump to

Keyboard shortcuts

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