feat(platform): add PackageManager interface and Pacman implementation

This commit is contained in:
MDietermann
2026-04-13 20:00:11 +02:00
parent 3b666615d7
commit 83cf7f0e72
3 changed files with 180 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package platform
import "context"
// PackageManager abstracts OS-level package operations so later plans
// can add Debian/Fedora without touching modules.
type PackageManager interface {
Name() string
IsInstalled(ctx context.Context, pkg string) (bool, error)
Install(ctx context.Context, pkgs []string) error
Update(ctx context.Context) error
}
// Runner executes a command with arguments. Injected into package managers
// so tests can stub shell-outs.
type Runner interface {
Run(ctx context.Context, name string, args ...string) error
Output(ctx context.Context, name string, args ...string) ([]byte, error)
}