generator

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package generator generates NOTICE/HTML attribution artifacts from a CycloneDX SBOM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cfg Config) error

Run executes the generator with the given configuration.

Types

type Component

type Component struct {
	Name      string          `json:"name"`
	Version   string          `json:"version"`
	PURL      string          `json:"purl"`
	Copyright string          `json:"copyright"`
	Licenses  []LicenseChoice `json:"licenses"`
}

Component represents a component in the SBOM.

type Config

type Config struct {
	RepoName string

	SBOMPath         string
	HTMLTemplatePath string
	NoticeTplPath    string

	OutDir         string
	OutLicensesDir string

	SPDXVersion string

	IgnorePURLPatterns []*regexp.Regexp
}

Config the global configuration.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration.

type LicenseBlock

type LicenseBlock struct {
	ID     string
	Name   string
	Text   string
	UsedBy []OutComponent
}

LicenseBlock represents a license block in the output model.

type LicenseChoice

type LicenseChoice struct {
	Expression string `json:"expression"`
	License    *struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"license"`
}

LicenseChoice represents a license in a component.

type Model

type Model struct {
	GeneratedAt string
	Overview    []OverviewItem
	Licenses    []LicenseBlock
	Notices     []OutComponent
}

Model represents the data model for the output.

type OutComponent

type OutComponent struct {
	Name       string
	Version    string
	PURL       string
	URL        string
	LicenseIDs []string
	Copyright  string
}

OutComponent represents a component in the output model.

type OverviewItem

type OverviewItem struct {
	ID    string
	Name  string
	Count int
}

OverviewItem represents an overview item in the output model.

type SBOM

type SBOM struct {
	Components []Component `json:"components"`
}

SBOM represents a CycloneDX SBOM structure.

type UnknownLicensesError

type UnknownLicensesError struct {
	IDs []string
}

UnknownLicensesError indicates that some license expressions could not be resolved.

func (UnknownLicensesError) Error

func (e UnknownLicensesError) Error() string

Jump to

Keyboard shortcuts

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