Tai Groot 5163a948ea feat(apt,dpkg): implement apt and dpkg package manager wrappers
Implement the snack.Manager interface for both apt (Debian/Ubuntu) and
dpkg (low-level Debian package tool).

apt wraps apt-get, apt-cache, and dpkg-query for full package management.
dpkg wraps dpkg and dpkg-query for low-level .deb operations.
Upgrade and Update return ErrUnsupportedPlatform for dpkg.

Both packages include:
- Linux implementations with proper error wrapping
- Non-linux build stubs returning ErrUnsupportedPlatform
- Output parsing helpers with tests
- Functional options support (sudo, assume-yes, dry-run)
2026-02-25 20:25:19 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00
2026-02-25 20:01:51 +00:00

snack 🍿

Idiomatic Go wrappers for system package managers.

License 0BSD GoDoc

snack provides thin, context-aware Go bindings for system package managers. Think taigrr/systemctl but for package management.

Part of the grlx ecosystem.

Supported Package Managers

Package Manager Platform Status
pacman pacman Arch Linux 🚧
aur AUR (makepkg) Arch Linux 🚧
apk apk-tools Alpine Linux 🚧
apt APT (apt-get/apt-cache) Debian/Ubuntu 🚧
dpkg dpkg Debian/Ubuntu 🚧
dnf DNF Fedora/RHEL 🚧
rpm RPM Fedora/RHEL 🚧
flatpak Flatpak Cross-distro 🚧
snap snapd Cross-distro 🚧
pkg pkg(8) FreeBSD 🚧
ports ports/packages OpenBSD 🚧
detect Auto-detection All 🚧

Install

go get github.com/gogrlx/snack

Usage

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/gogrlx/snack"
    "github.com/gogrlx/snack/apt"
)

func main() {
    ctx := context.Background()
    mgr := apt.New()

    // Install a package
    err := mgr.Install(ctx, []string{"nginx"}, snack.WithSudo(), snack.WithAssumeYes())
    if err != nil {
        log.Fatal(err)
    }

    // Check if installed
    installed, err := mgr.IsInstalled(ctx, "nginx")
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("nginx installed:", installed)
}

Auto-detection

import "github.com/gogrlx/snack/detect"

mgr, err := detect.Default()
if err != nil {
    log.Fatal(err)
}
fmt.Println("Detected:", mgr.Name())

Design

  • Thin CLI wrappers β€” each sub-package wraps a package manager's CLI tools. No FFI, no library bindings.
  • Common interface β€” all managers implement snack.Manager, making them interchangeable.
  • Context-aware β€” all operations accept context.Context for cancellation and timeouts.
  • Platform-safe β€” build tags ensure packages compile everywhere but only run where appropriate.
  • No root assumption β€” use snack.WithSudo() when elevated privileges are needed.

Implementation Priority

  1. pacman + AUR (Arch Linux)
  2. apk (Alpine Linux)
  3. apt + dpkg (Debian/Ubuntu)
  4. dnf + rpm (Fedora/RHEL)
  5. flatpak + snap (cross-distro)
  6. pkg + ports (BSD)

CLI

A companion CLI tool is planned for direct terminal usage:

snack install nginx
snack remove nginx
snack search redis
snack list
snack upgrade

License

0BSD β€” see LICENSE.

Description
No description provided
Readme 0BSD 492 KiB
Languages
Go 99.8%
Shell 0.2%