types

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment added in v0.2.7

type Environment struct {
	Name     string          `json:"name"`
	Username string          `json:"username"`
	Data     EnvironmentData `json:"data"`
}

Environment is a struct that holds the environment data, name, and username

type EnvironmentData

type EnvironmentData struct {
	StackmatchVersion string            `json:"stackmatch_version"`
	ScanDate          time.Time         `json:"scan_date"`
	System            SystemInfo        `json:"system"`
	Tools             map[string]string `json:"tools,omitempty"`
	PackageManagers   map[string]string `json:"package_managers,omitempty"`
	CodeEditors       map[string]string `json:"code_editors,omitempty"`
	// ConfiguredLanguages stores detected programming languages and their primary versions.
	ConfiguredLanguages map[string]string `json:"configured_languages,omitempty"`
	ConfigFiles         []string          `json:"config_files,omitempty"`
}

EnvironmentData represents the top-level structure for the scanned environment. This is the structure that will be serialized to/from JSON.

type EnvironmentHistory added in v0.2.7

type EnvironmentHistory struct {
	ID            string    `json:"id"`
	EnvironmentID string    `json:"environment_id"`
	Name          string    `json:"name"`
	Version       int       `json:"version"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedBy     string    `json:"updated_by"`
	Data          string    `json:"data"` // JSON string of the environment data
}

EnvironmentHistory represents a version history entry for an environment

type InstallOptions added in v0.2.5

type InstallOptions struct {
	DryRun     bool
	AssumeYes  bool
	NoDeps     bool
	SkipUpdate bool
}

InstallOptions contains options for package installation

func DefaultInstallOptions added in v0.2.5

func DefaultInstallOptions() InstallOptions

DefaultInstallOptions returns default installation options

type Installer added in v0.2.5

type Installer interface {
	// Name returns the name of the package manager
	Name() string

	// Type returns the package manager type (e.g., "apt", "homebrew")
	Type() PackageManagerType

	// IsAvailable checks if the package manager is available on the system
	IsAvailable() bool

	// InstallPackage installs a single package
	InstallPackage(ctx context.Context, pkg string) error

	// InstallVersion installs a specific version of a package
	InstallVersion(ctx context.Context, pkg string, version VersionConstraint) error

	// InstallMultiple installs multiple packages in a single operation when possible
	InstallMultiple(ctx context.Context, packages []string) error

	// InstallMultipleVersions installs multiple packages with specific versions
	InstallMultipleVersions(ctx context.Context, packages map[string]VersionConstraint) error

	// GetInstalledVersion gets information about an installed package
	GetInstalledVersion(ctx context.Context, pkg string) (*PackageVersionInfo, error)

	// CheckVersion checks if the installed package satisfies the version constraint
	CheckVersion(ctx context.Context, pkg string, constraint VersionConstraint) (*PackageVersionInfo, error)

	// UpdatePackageManager updates the package manager itself
	UpdatePackageManager(ctx context.Context) error

	// UninstallPackage uninstalls a package
	UninstallPackage(ctx context.Context, pkg string) error
}

Installer defines the interface for package manager operations

type PackageAlreadyInstalledError added in v0.2.5

type PackageAlreadyInstalledError struct {
	Package string
}

PackageAlreadyInstalledError is returned when a package is already installed

func (*PackageAlreadyInstalledError) Error added in v0.2.5

type PackageInfo added in v0.2.5

type PackageInfo struct {
	Name    string
	Version string // Optional version constraint
}

PackageInfo contains information about a package that can be installed

type PackageManagerType added in v0.2.5

type PackageManagerType string

PackageManagerType represents the type of package manager

const (
	TypeApt        PackageManagerType = "apt"
	TypeDnf        PackageManagerType = "dnf"
	TypeYum        PackageManagerType = "yum"
	TypePacman     PackageManagerType = "pacman"
	TypeSnap       PackageManagerType = "snap"
	TypeHomebrew   PackageManagerType = "homebrew"
	TypeChocolatey PackageManagerType = "chocolatey"
	TypeScoop      PackageManagerType = "scoop"
	TypeWinget     PackageManagerType = "winget"
)

Package manager type constants

type PackageNotFoundError added in v0.2.5

type PackageNotFoundError struct {
	Package string
}

PackageNotFoundError is returned when a package is not found in the repository

func (*PackageNotFoundError) Error added in v0.2.5

func (e *PackageNotFoundError) Error() string

type PackageVersionInfo added in v0.2.7

type PackageVersionInfo struct {
	Name       string // Package name
	Version    string // Installed version
	Latest     string // Latest available version (if available)
	Satisfies  bool   // Whether the installed version satisfies the constraint
	Constraint string // The version constraint that was checked (if any)
}

PackageVersionInfo contains version information about an installed package

type SystemInfo

type SystemInfo struct {
	OS       string `json:"os"`
	Arch     string `json:"arch"`
	Shell    string `json:"shell,omitempty"`
	Hostname string `json:"hostname,omitempty"` // Added Hostname as it's often useful
}

SystemInfo holds basic information about the operating system and architecture.

type VersionConstraint added in v0.2.7

type VersionConstraint struct {
	Version string // The version string (e.g., "1.2.3", ">=1.2.0 <2.0.0")
}

VersionConstraint represents a version constraint for a package

Jump to

Keyboard shortcuts

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