Help us shape the future of Go! Take the 2026 Go Developer Survey

report

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package report writes human- and agent-readable dry-run artifacts from a graph store.

Index

Constants

View Source
const SchemaVersion = 1

SchemaVersion is the version of manifest.json / graph.json shapes.

Variables

This section is empty.

Functions

func CopyArtifacts

func CopyArtifacts(srcDir, dstDir string) error

CopyArtifacts copies the standard report files from srcDir into dstDir.

func NewRunID

func NewRunID() string

NewRunID returns a unique run folder name: UTC timestamp with milliseconds plus a short random suffix so back-to-back runs in the same second do not collide.

func NormalizeImportTarget

func NormalizeImportTarget(importerPath, spec string) string

NormalizeImportTarget groups import specs for ranking using the importer's language. Relative specs are resolved against the importing file directory. Go keeps full package paths; JS/TS apply npm scoped/subpath rules; Python keeps dotted modules as-is. Unknown languages are conservative (no npm truncation).

Types

type Hub

type Hub struct {
	ID     graph.NodeID
	Kind   string
	Name   string
	Path   string
	Degree int
}

Hub is a ranked graph node for human navigation sections.

func ImportantFiles

func ImportantFiles(nodes []graph.Node, edges []graph.Edge, limit int) []Hub

ImportantFiles ranks file nodes by imports/calls activity attributed to them. Parsers attach imports to modules/packages and calls to functions/methods, so those edges are rolled up to the owning file via Path / contains ownership. Unresolved KindSymbol / KindImport targets never receive To-side credit.

func ImportantSymbols

func ImportantSymbols(nodes []graph.Node, edges []graph.Edge, limit int) []Hub

ImportantSymbols ranks resolved symbols (functions, methods, types, contracts) by undirected degree over calls / implements / consumes. Unresolved kind=symbol nodes and container kinds are excluded.

func TopImports

func TopImports(nodes []graph.Node, edges []graph.Edge, limit int) []Hub

TopImports ranks external/local dependency specs by how many distinct files import them. Per-file import nodes (import:path#spec) are grouped by a normalized target: package names stay as-is, relative specs are resolved against the importing file directory.

type Options

type Options struct {
	Repo   string
	Root   string // absolute path to the indexed repo root
	OutDir string
	Stats  index.Stats
	Store  graph.Store
	Now    time.Time // optional; defaults to time.Now().UTC()
}

Options configures Write.

type Result

type Result struct {
	ManifestPath string
	GraphPath    string
	ReportPath   string
	HTMLPath     string
}

Result lists paths written under OutDir.

func Write

func Write(opts Options) (Result, error)

Write dumps manifest.json, graph.json, GRAPH_REPORT.md, and graph.html into opts.OutDir.

Jump to

Keyboard shortcuts

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