ecosystem

package
v0.0.14-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicEcosystemHandler

type BasicEcosystemHandler struct {
	// contains filtered or unexported fields
}

BasicEcosystemHandler provides a basic implementation of EcosystemHandler that can be extended for specific ecosystems

func NewBasicEcosystemHandler

func NewBasicEcosystemHandler(languageID string, ecosystemInfo EcosystemInfo) *BasicEcosystemHandler

NewBasicEcosystemHandler creates a new basic ecosystem handler

func (*BasicEcosystemHandler) GetEcosystemInfo

func (h *BasicEcosystemHandler) GetEcosystemInfo() EcosystemInfo

GetEcosystemInfo returns the ecosystem information

func (*BasicEcosystemHandler) GetLanguageID

func (h *BasicEcosystemHandler) GetLanguageID() string

GetLanguageID returns the language identifier

func (*BasicEcosystemHandler) ProcessLicenses

func (h *BasicEcosystemHandler) ProcessLicenses(knowledgeDB *bun.DB, sbom interface{}, licensePolicy interface{}, start time.Time) interface{}

ProcessLicenses processes license analysis for this ecosystem This is a basic implementation that should be overridden by specific handlers

func (*BasicEcosystemHandler) ProcessVulnerabilities

func (h *BasicEcosystemHandler) ProcessVulnerabilities(projectURL string, knowledgeDB *bun.DB, sbom interface{}, start time.Time) interface{}

ProcessVulnerabilities processes vulnerability analysis for this ecosystem This is a basic implementation that should be overridden by specific handlers

func (*BasicEcosystemHandler) SupportsLanguageID

func (h *BasicEcosystemHandler) SupportsLanguageID(languageID string) bool

SupportsLanguageID checks if this handler supports the given language ID

type DetectedLanguage

type DetectedLanguage struct {
	Name  string `json:"name"`
	Icon  string `json:"icon"`
	Color string `json:"color"`
}

DetectedLanguage represents a detected programming language in a project

type EcosystemHandler

type EcosystemHandler interface {
	// GetLanguageID returns the language identifier (e.g., "JS", "PHP")
	GetLanguageID() string

	// GetEcosystemInfo returns the ecosystem information
	GetEcosystemInfo() EcosystemInfo

	// ProcessLicenses processes license analysis for this ecosystem
	// Using interface{} for now to avoid dependency issues, will be properly typed later
	ProcessLicenses(knowledgeDB *bun.DB, sbom interface{}, licensePolicy interface{}, start time.Time) interface{}

	// ProcessVulnerabilities processes vulnerability analysis for this ecosystem
	// Using interface{} for now to avoid dependency issues, will be properly typed later
	ProcessVulnerabilities(projectURL string, knowledgeDB *bun.DB, sbom interface{}, start time.Time) interface{}

	// SupportsLanguageID checks if this handler supports the given language ID
	SupportsLanguageID(languageID string) bool
}

EcosystemHandler interface defines the contract for handling different package ecosystems

type EcosystemInfo

type EcosystemInfo struct {
	Name                  string   `json:"name"`
	Ecosystem             string   `json:"ecosystem"`
	Language              string   `json:"language"`
	PackageManagerPattern string   `json:"packageManagerPattern"` // Will be converted to RegExp in frontend
	DefaultPackageManager string   `json:"defaultPackageManager"`
	Icon                  string   `json:"icon"`
	Color                 string   `json:"color"`
	Website               string   `json:"website"`
	PurlType              string   `json:"purlType"`
	RegistryUrl           string   `json:"registryUrl"`
	Tools                 []string `json:"tools"`
}

EcosystemInfo contains information about a package ecosystem

type EcosystemMapper

type EcosystemMapper struct {
	// contains filtered or unexported fields
}

EcosystemMapper provides utilities for mapping between plugins, ecosystems, and languages

func NewEcosystemMapper

func NewEcosystemMapper() *EcosystemMapper

NewEcosystemMapper creates a new EcosystemMapper with the default ecosystem mapping

func NewEcosystemMapperWithCustomMap

func NewEcosystemMapperWithCustomMap(ecosystemMap PluginEcosystemMap) *EcosystemMapper

NewEcosystemMapperWithCustomMap creates a new EcosystemMapper with a custom ecosystem mapping

func (*EcosystemMapper) DetectEcosystemFromName

func (em *EcosystemMapper) DetectEcosystemFromName(name string) (string, bool)

DetectEcosystemFromName detects ecosystem from dependency name patterns

func (*EcosystemMapper) GetEcosystemFromPurl

func (em *EcosystemMapper) GetEcosystemFromPurl(purl string) (string, bool)

GetEcosystemFromPurl extracts ecosystem from Package URL (PURL)

func (*EcosystemMapper) GetEcosystemInfo

func (em *EcosystemMapper) GetEcosystemInfo(pluginName string) (EcosystemInfo, bool)

GetEcosystemInfo returns ecosystem information for a given plugin name

func (*EcosystemMapper) GetSupportedEcosystems

func (em *EcosystemMapper) GetSupportedEcosystems() []string

GetSupportedEcosystems returns all supported ecosystem names

func (*EcosystemMapper) GetSupportedPlugins

func (em *EcosystemMapper) GetSupportedPlugins() []string

GetSupportedPlugins returns all supported SBOM plugin names

func (*EcosystemMapper) IsValidEcosystem

func (em *EcosystemMapper) IsValidEcosystem(ecosystem string) bool

IsValidEcosystem checks if an ecosystem filter is supported

func (*EcosystemMapper) MapPackageManagerToEcosystem

func (em *EcosystemMapper) MapPackageManagerToEcosystem(packageManager string) (string, bool)

MapPackageManagerToEcosystem maps a package manager string to an ecosystem

type HandlerRegistry

type HandlerRegistry struct {
	// contains filtered or unexported fields
}

HandlerRegistry manages ecosystem handlers

func CreateDefaultHandlers

func CreateDefaultHandlers() *HandlerRegistry

CreateDefaultHandlers creates default handlers for supported ecosystems

func NewHandlerRegistry

func NewHandlerRegistry() *HandlerRegistry

NewHandlerRegistry creates a new handler registry

func (*HandlerRegistry) GetAllHandlers

func (r *HandlerRegistry) GetAllHandlers() map[string]EcosystemHandler

GetAllHandlers returns all registered handlers

func (*HandlerRegistry) GetHandler

func (r *HandlerRegistry) GetHandler(languageID string) (EcosystemHandler, bool)

GetHandler returns the handler for a specific language

func (*HandlerRegistry) GetSupportedLanguages

func (r *HandlerRegistry) GetSupportedLanguages() []string

GetSupportedLanguages returns all supported language IDs

func (*HandlerRegistry) RegisterHandler

func (r *HandlerRegistry) RegisterHandler(languageID string, handler EcosystemHandler)

RegisterHandler registers an ecosystem handler for a language

type MergeStrategy

type MergeStrategy string

MergeStrategy defines different strategies for merging multi-language results

const (
	MergeStrategyUnion        MergeStrategy = "union"        // Combine all results
	MergeStrategyIntersection MergeStrategy = "intersection" // Only results present in all languages
	MergeStrategyPriority     MergeStrategy = "priority"     // Prioritize results from specific languages
)

type PluginEcosystemMap

type PluginEcosystemMap map[string]EcosystemInfo

PluginEcosystemMap maps plugin names to their ecosystem information

func GetDefaultEcosystemMap

func GetDefaultEcosystemMap() PluginEcosystemMap

GetDefaultEcosystemMap returns the default mapping of plugins to ecosystems

type ResultMerger

type ResultMerger[T any] interface {
	// MergeWorkspaces merges results from multiple language ecosystems into a unified result
	MergeWorkspaces(results []T) T

	// GetMergeStrategy returns the merge strategy used by this merger
	GetMergeStrategy() string
}

ResultMerger provides generic functionality for merging analysis results from multiple ecosystems

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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