models

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeSimplePackageAnalysisIdentifier

func MakeSimplePackageAnalysisIdentifier(ecosystem, name string) string

func SortPackages

func SortPackages(pkgs []PackageInfo)

Types

type Dependency

type Dependency struct {
	AnalysisIdentifier string   `json:"analysis_identifier"`
	Specifiers         []string `json:"specifiers"`
	EnvironmentMarker  *string  `json:"environment_marker,omitempty"`
	Extras             []string `json:"extras,omitempty"`
	ExtraMarker        *string  `json:"extra_marker,omitempty"`
	// Dev indicates this package would not exist in a production install.
	// True when the package is only reachable through dev dependency paths from root.
	Dev        bool          `json:"dev,omitempty"`
	ParseError *string       `json:"parse_error,omitempty"`
	Location   *LocationInfo `json:"source,omitempty"`
}

func (Dependency) GetEcosystem

func (d Dependency) GetEcosystem() string

func (Dependency) GetName

func (d Dependency) GetName() string

type DependencyMetadata

type DependencyMetadata struct {
	Status       string       `json:"status"` // "success" | "skipped" | "error"
	StatusReason *string      `json:"status_reason,omitempty"`
	Direct       []Dependency `json:"direct"`
	Transitive   []Dependency `json:"transitive,omitempty"`
	ParseErrors  []ParseError `json:"parse_errors,omitempty"`
}

DependencyMetadata represents source/dependencies.yml

type DepsTreeEdge

type DepsTreeEdge struct {
	// ParentKey: The package that depends on ChildKey.
	//   - Parsers initially set "" for direct dependencies; enrichLockfileEdges
	//     replaces this with the sourceKey (e.g., "source/github.com/foo/bar").
	//   - Full key with version for transitive dependencies.
	ParentKey string `json:"parent"`
	ChildKey  string `json:"child"`
	Ecosystem string `json:"ecosystem"`
	// Dev indicates this package would not exist in a production install.
	// True when the package is only reachable through dev dependency paths from root.
	Dev      bool          `json:"dev,omitempty"`
	Location *LocationInfo `json:"location,omitempty"`
}

DepsTreeEdge represents a dependency relationship from a lockfile.

Key format: "package/{ecosystem}/{name}?version={version}" Example: "package/npm/express?version=4.18.2"

type DetectedManifest

type DetectedManifest struct {
	Ecosystem      string  `json:"ecosystem"`
	PackageManager *string `json:"package_manager,omitempty"`
	// Multiple paths occur when package managers treat several files as one unit:
	// - Python: pyproject.toml + setup.cfg + setup.py (all define the same package)
	// - Ruby: gemspec + Gemfile (bundler reads both when Gemfile has `gemspec` directive)
	// Parsers must iterate ALL paths, not just Paths[0].
	Paths    []string `json:"paths"`
	Lockfile *string  `json:"lockfile,omitempty"`
}

type DistributionInfo

type DistributionInfo struct {
	URL           string `json:"url,omitempty"`
	Filename      string `json:"filename,omitempty"`
	Hash          string `json:"hash,omitempty"`
	HashAlgorithm string `json:"hash_algorithm,omitempty"` // "sha256", "sha512", "sha1"
}

DistributionInfo contains artifact download and integrity information

type DynamicDependency

type DynamicDependency struct {
	SourceFile string `json:"source_file"`
	Line       int    `json:"line"`
	Reason     string `json:"reason"`
}

DynamicDependency tracks dependencies whose names cannot be statically determined at parse time. This occurs in Ruby (e.g., `gem "rack-#{version}"`, `s.add_dependency MyGem::NAME`) and Python setup.py (e.g., reading name from a file or using string formatting).

type GitMetadata

type GitMetadata struct {
	SourceURL              string     `json:"source_url"`
	Status                 string     `json:"status"` // "success" | "skipped" | "error"
	CollectedAt            *time.Time `json:"collected_at,omitempty"`
	StatusReason           *string    `json:"status_reason,omitempty"`
	RecentAuthorsCount     *int       `json:"recent_authors_count,omitempty"`
	MaxMonthlyAuthorsCount *int       `json:"max_monthly_authors_count,omitempty"`
	MaxMonthlyWindowStart  *time.Time `json:"max_monthly_window_start,omitempty"`
	MaxMonthlyWindowEnd    *time.Time `json:"max_monthly_window_end,omitempty"`
	FirstCommit            *time.Time `json:"first_commit,omitempty"`
	LatestHumanCommit      *time.Time `json:"latest_human_commit,omitempty"`
	CommitCount            *int       `json:"commit_count,omitempty"`
	HumanCommitCount       *int       `json:"human_commit_count,omitempty"`
}

GitMetadata represents source/git.yml - git repository analysis

type LicenseFile

type LicenseFile struct {
	Path string `json:"path"`
}

LicenseFile is a raw license-file candidate produced by the on-disk scanner before any SPDX matching. Path is relative to the repo root. File contents are deliberately not retained here — SPDX matching re-reads from the working tree — so that persisted artifacts don't duplicate license texts.

type LocationInfo

type LocationInfo struct {
	File       *string `json:"file,omitempty"`
	LineNumber *int    `json:"ln,omitempty"`
}

type Maintainer

type Maintainer struct {
	Name                string     `json:"name,omitempty"`
	Email               string     `json:"email,omitempty"`
	Role                string     `json:"role,omitempty"` // "maintainer" (npm), "author"/"maintainer" (pypi), "owner" (rubygems)
	FirstPublishVersion *string    `json:"first_publish_version,omitempty"`
	FirstPublishDate    *time.Time `json:"first_publish_date,omitempty"`
	LastPublishVersion  *string    `json:"last_publish_version,omitempty"`
	LastPublishDate     *time.Time `json:"last_publish_date,omitempty"`
	VersionCount        int        `json:"version_count,omitempty"`
	IsActive            *bool      `json:"is_active,omitempty"`
}

Maintainer represents a package maintainer/owner across all ecosystems

func (Maintainer) IsExplicitlyInactive

func (m Maintainer) IsExplicitlyInactive() bool

type ManifestResult

type ManifestResult struct {
	DetectedManifest
	Name                 *string             `json:"name,omitempty"`
	Private              bool                `json:"private,omitempty"`
	IsDynamic            bool                `json:"is_dynamic,omitempty"`
	DynamicReason        *string             `json:"dynamic_reason,omitempty"`
	InstallScripts       []string            `json:"install_scripts,omitempty"`
	Dependencies         []Dependency        `json:"dependencies"`
	DynamicDependencies  []DynamicDependency `json:"dynamic_dependencies,omitempty"`
	LockfileDependencies []DepsTreeEdge      `json:"lockfile_dependencies"`
	ParseError           *string             `json:"parse_error,omitempty"`
}

type ManifestsResult

type ManifestsResult struct {
	Manifests   []ManifestResult `json:"manifests"`
	ParseErrors []ParseError     `json:"parse_errors,omitempty"`
}

type Package

type Package struct {
	Name         string       `json:"name"`
	Ecosystem    string       `json:"ecosystem"`
	Dependencies []Dependency `json:"dependencies"`
	Version      *string      `json:"version,omitempty"`
	License      *string      `json:"license,omitempty"`
	SourceURL    *string      `json:"source_url,omitempty"`
	SourceURLKey *string      `json:"source_url_key,omitempty"`
	ReleaseDate  *time.Time   `json:"release_date,omitempty"`
	Status       string       `json:"status"`
}

type PackageInfo

type PackageInfo struct {
	Ecosystem string `json:"ecosystem"`
	Name      string `json:"name"`
	Version   string `json:"version,omitempty"`
	Private   bool   `json:"private,omitempty"`
}

type PackageMetadata

type PackageMetadata struct {
	Ecosystem    string            `json:"ecosystem"`
	PackageName  string            `json:"package_name"`
	Version      *string           `json:"version,omitempty"`
	Description  *string           `json:"description,omitempty"`
	Homepage     *string           `json:"homepage,omitempty"`
	SourceURL    *string           `json:"source_url,omitempty"`
	License      *string           `json:"license,omitempty"`
	ReleaseDate  *time.Time        `json:"release_date,omitempty"`
	Dependencies []Dependency      `json:"dependencies,omitempty"`
	Maintainers  []Maintainer      `json:"maintainers,omitempty"`
	Distribution *DistributionInfo `json:"distribution,omitempty"`
	Status       string            `json:"status"` // "success" | "skipped" | "error"
	CollectedAt  *time.Time        `json:"collected_at,omitempty"`
	StatusReason *string           `json:"status_reason,omitempty"`
}

PackageMetadata represents package.yml - ecosystem package data

func (*PackageMetadata) HasLicense

func (p *PackageMetadata) HasLicense() bool

type ParseError

type ParseError struct {
	FilePath  string `json:"file_path"`
	Error     string `json:"error"`
	ErrorType string `json:"error_type,omitempty"` // "read_error" | "parse_error"
}

ParseError represents a dependency file that failed to parse

type VersionInfo

type VersionInfo struct {
	Version    string    `json:"version"`
	ReleasedAt time.Time `json:"released_at"`
}

type VersionMetadata

type VersionMetadata struct {
	Ecosystem     string        `json:"ecosystem"`
	PackageName   string        `json:"package_name"`
	Versions      []VersionInfo `json:"versions"`
	LatestVersion *VersionInfo  `json:"latest_version,omitempty"`
	CollectedAt   *time.Time    `json:"collected_at,omitempty"`
	Status        string        `json:"status"` // "success", "skip", "error"
	Message       string        `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

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