Documentation ¶
Overview ¶
core/cache.go
core/command.go
core/config.go
core/constants.go
core/dependency.go
core/logger.go
core/plugin_registry.go
core/project.go
core/resolver.go
core/security.go
core/utils.go
Index ¶
- Constants
- func CacheDependency(dep Dependency, data io.Reader) error
- func GenerateSecurityReport(reports []SecurityReport, format, outputPath string) error
- func InitializeLogger()
- func InitializeProject(name, version, description string, authors []string) error
- func IsWindows() bool
- func LogFatal(err error)
- type Author
- type Command
- type Config
- type Dependency
- type EnvironmentConfig
- type Executor
- type PackageManagerPlugin
- type PluginRegistry
- type ProjectConfig
- type RealExecutor
- type Resolver
- type SecurityReport
- type SecurityVulnerability
Constants ¶
const ( PluginAPIVersion = "1.0.0" MaxConcurrency = 5 // Adjust as needed )
const PluginAPIVersion = "1.0"
PluginAPIVersion defines the current version of the plugin API
Variables ¶
This section is empty.
Functions ¶
func CacheDependency ¶
func CacheDependency(dep Dependency, data io.Reader) error
CacheDependency caches the downloaded package data.
func GenerateSecurityReport ¶
func GenerateSecurityReport(reports []SecurityReport, format, outputPath string) error
GenerateSecurityReport generates a security report in the specified format.
func InitializeProject ¶
InitializeProject initializes a new pkgmgr project by creating a pkgmgr.yaml file.
Types ¶
type Author ¶
type Author struct { Name string `yaml:"name" validate:"required"` Email string `yaml:"email" validate:"required,email"` }
Author represents a project author.
type Config ¶
type Config struct { Project ProjectConfig `yaml:"project" validate:"required,dive"` Environments map[string]EnvironmentConfig `yaml:"environments" validate:"required,dive"` TrustedSources map[string][]string `yaml:"trusted_sources" validate:"required,dive,dive,uri"` }
Config represents the entire project configuration.
type Dependency ¶
type Dependency struct { Name string `yaml:"name" validate:"required"` Version string `yaml:"version" validate:"required"` Constraint *semver.Constraints `yaml:"-"` }
Dependency represents a package dependency.
func (*Dependency) Validate ¶
func (d *Dependency) Validate() error
Validate parses and validates the dependency.
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Dependencies map[string][]Dependency `yaml:"dependencies" validate:"required,dive,dive"`
}
EnvironmentConfig holds dependencies for a specific environment.
type PackageManagerPlugin ¶
type PackageManagerPlugin interface { APIVersion() string Language() string Initialize(config Config) error Install(deps []Dependency) error Update(deps []Dependency) error Remove(dep Dependency) error List() ([]Dependency, error) ListVersions(depName string) ([]string, error) GetTransitiveDependencies(depName, version string) ([]Dependency, error) GetVulnerabilities() ([]SecurityVulnerability, error) Cleanup() error }
PackageManagerPlugin defines the interface that all language-specific plugins must implement.
type PluginRegistry ¶
type PluginRegistry struct {
// contains filtered or unexported fields
}
PluginRegistry manages all registered plugins.
func GetPluginRegistry ¶
func GetPluginRegistry() *PluginRegistry
GetPluginRegistry returns the singleton instance of PluginRegistry.
func NewPluginRegistry ¶
func NewPluginRegistry() *PluginRegistry
NewPluginRegistry creates a new PluginRegistry instance.
func (*PluginRegistry) GetAllPlugins ¶
func (pr *PluginRegistry) GetAllPlugins() map[string]PackageManagerPlugin
GetAllPlugins retrieves all registered plugins.
func (*PluginRegistry) GetPlugin ¶
func (pr *PluginRegistry) GetPlugin(lang string) (PackageManagerPlugin, bool)
GetPlugin retrieves a plugin by language.
func (*PluginRegistry) RegisterPlugin ¶
func (pr *PluginRegistry) RegisterPlugin(lang string, plugin PackageManagerPlugin) error
RegisterPlugin registers a new plugin.
type ProjectConfig ¶
type ProjectConfig struct { Name string `yaml:"name" validate:"required"` Version string `yaml:"version" validate:"required,semver"` Description string `yaml:"description"` Authors []Author `yaml:"authors" validate:"dive"` }
ProjectConfig holds project metadata.
type RealExecutor ¶
type RealExecutor struct{}
RealExecutor is the default implementation of Executor using exec.Command.
func (*RealExecutor) Run ¶
func (e *RealExecutor) Run(cmd *Command) error
type Resolver ¶
type Resolver struct { Config Config PluginRegistry *PluginRegistry // contains filtered or unexported fields }
Resolver handles dependency resolution.
func NewResolver ¶
func NewResolver(config Config, pr *PluginRegistry) *Resolver
NewResolver creates a new Resolver instance.
func (*Resolver) CollectSecurityReports ¶
CollectSecurityReports collects security vulnerabilities from each plugin and generates reports.
func (*Resolver) ResolveDependencies ¶
ResolveDependencies resolves all dependencies recursively for a given environment.
type SecurityReport ¶
type SecurityReport struct { Language string `json:"language"` Vulnerabilities []SecurityVulnerability `json:"vulnerabilities"` }
SecurityReport represents a security report for a language.
type SecurityVulnerability ¶
type SecurityVulnerability struct { Package string `json:"package"` Vulnerability string `json:"vulnerability"` Severity string `json:"severity,omitempty"` Description string `json:"description,omitempty"` }
SecurityVulnerability represents a security issue found in a dependency.