Commit Graph

39 Commits

Author SHA1 Message Date
e46b2b4ce4 feat: add testcontainers-based local integration tests
Run with: go test -tags containertest -v -count=1 -timeout 10m .

Spins up Debian, Alpine, Arch, and Fedora containers locally via Docker,
copies the module source in, and runs the full integration test suite
in each. All four distros pass.

Requires Docker. Use build tag 'containertest' (separate from 'integration'
which runs directly on the host).
2026-02-26 02:06:02 +00:00
ffc46dc56a Merge pull request #14 from gogrlx/cd/ci-fixes
fix(ci): fix integration test failures across distros
2026-02-25 21:00:42 -05:00
ba58e6bb8b fix(ci): fix apk/dnf latestVersion implementations
- apk: use 'apk search -e' instead of 'apk policy' (more portable)
- dnf: use 'dnf info' instead of 'dnf info --available' (Fedora 39 compat)
2026-02-26 01:58:23 +00:00
99dfc80003 fix(ci): pin fedora:39 for dnf4, fix test paths for debian/alpine
- Fedora 40+ ships dnf5 (not 41 as assumed) — pin to 39
- Debian container: /usr/bin/bash doesn't exist, use /usr/bin/dpkg
- Alpine: use busybox for LatestVersion test (always available)
2026-02-26 01:55:24 +00:00
0932da4d02 fix(ci): fix integration test failures across distros
- apk: Info test uses busybox (pre-installed) instead of curl (not installed)
- apk: LatestVersion test uses tree (installed during test)
- dpkg: Owner test uses /usr/bin/bash (not /bin/bash symlink)
- flatpak: List test checks both Name and Application ID fields
- dnf: pin Fedora to 41 (dnf4); dnf5 has incompatible output format
2026-02-26 01:52:46 +00:00
fa7bd7a79b fix: use snack.Manager interface type for capability assertions in integration tests
Type assertions require an interface type, not a concrete struct pointer.
Changed all integration tests from 'mgr := pkg.New()' to
'var mgr snack.Manager = pkg.New()' so capability checks like
mgr.(snack.VersionQuerier) compile correctly.
2026-02-26 01:47:25 +00:00
ae0709e2d4 fix: go mod tidy for testify transitive deps 2026-02-26 01:44:21 +00:00
43f43cd432 Merge pull request #13 from gogrlx/cd/integration-tests
feat: add integration tests and GitHub Actions CI
2026-02-25 20:43:55 -05:00
b443269594 feat: add integration tests and GitHub Actions CI
Add integration test files for all providers (apt, dpkg, pacman, apk,
dnf, rpm, flatpak, snap, pkg, detect) behind the 'integration' build
tag. Tests exercise real package operations: update, search, info,
install, verify, list, remove, and capability interfaces.

Add GitHub Actions workflow running unit tests on ubuntu-latest and
integration tests on Debian, Ubuntu, Fedora, Alpine, Arch Linux, and
Ubuntu+Flatpak containers/runners.
2026-02-26 01:42:19 +00:00
8364b44b25 Merge pull request #12 from gogrlx/cd/cql-review
fix: CQL review — correctness, safety, and standards
2026-02-25 20:39:11 -05:00
261fcfbec7 fix: improve correctness and safety
Pass 2 (Correctness & Safety):
- Separate stdout/stderr in apk list and search to prevent error messages
  from contaminating parsed output
- All providers verified: mutex on mutating ops, CommandContext everywhere,
  proper error wrapping, nil-safe parseInfo functions
2026-02-26 01:27:41 +00:00
6edb79df3f fix: improve feature completeness and correctness
Pass 1 (Feature & Completeness):
- Replace apt CLI with apt-get for listUpgrades (apt CLI is unstable for scripting)
- Verify snapd daemon is running in snap Available() check
- Add ErrDaemonNotRunning sentinel error for daemon-dependent managers
- Fix staticcheck S1011: replace loop with append(keys, matches...)
- Fix staticcheck SA1012: use context.TODO() instead of nil in dpkg tests
2026-02-26 01:26:51 +00:00
d4c7a058fb Merge pull request #11 from gogrlx/cd/bsd-pkg-ports
feat: add pkg (FreeBSD) and ports (OpenBSD) package managers
2026-02-25 20:23:53 -05:00
99dfe59f40 feat: add pkg (FreeBSD) and ports (OpenBSD) package manager implementations
pkg implements Manager, VersionQuerier, Cleaner, and FileOwner interfaces
wrapping FreeBSD's pkg(8) CLI. ports implements Manager wrapping OpenBSD's
pkg_add/pkg_delete/pkg_info tools.

Both use build tags (freebsd/openbsd) for real implementations with stub
files for other platforms. Includes parser tests for all output formats.
2026-02-26 01:23:42 +00:00
14ba7cfb53 Merge pull request #10 from gogrlx/cd/detect-cli
feat: implement detect package and snack CLI
2026-02-25 20:22:47 -05:00
ca2fdd49ac feat: implement detect package and snack CLI
- detect: auto-detection with Default(), All(), ByName()
  - Platform-specific probing via build tags (linux, freebsd, openbsd)
  - Linux probe order: apt, dnf, pacman, apk, flatpak, snap
- cmd/snack: full CLI with cobra + charmbracelet/fang
  - Subcommands: install, remove, purge, upgrade, update, list, search,
    info, which, hold, unhold, clean, detect, version
  - Global flags: --manager, --sudo, --yes, --dry-run
  - Capability type-assertions for FileOwner, Holder, Cleaner
- detect: basic compilation tests
2026-02-26 01:08:27 +00:00
10c8bd6f4d Merge pull request #9 from gogrlx/cd/dnf-rpm
feat: add dnf and rpm package manager implementations
2026-02-25 17:30:56 -05:00
2685dd945c feat: add dnf and rpm package manager implementations
Implements the dnf sub-package with Manager, VersionQuerier, Holder,
Cleaner, FileOwner, RepoManager, KeyManager, Grouper, and NameNormalizer
interfaces.

Implements the rpm sub-package with Manager, FileOwner, and
NameNormalizer interfaces.

Both follow the existing pattern: exported methods on struct delegate to
unexported functions, _linux.go for real implementations, _other.go with
build-tag stubs, embedded snack.Locker for mutating operations, and
compile-time interface checks.

Includes parser tests for all output formats.
2026-02-25 22:30:16 +00:00
c66d1eb773 Merge pull request #8 from gogrlx/cd/flatpak-snap
feat: add flatpak and snap package manager implementations
2026-02-25 17:28:52 -05:00
4beeb0a0d7 feat: add flatpak and snap package manager implementations
flatpak: implements Manager, Cleaner, and RepoManager interfaces
- Install/Remove/Purge/Upgrade with flatpak CLI
- Repository management (add/remove/list remotes)
- Autoremove unused runtimes

snap: implements Manager and VersionQuerier interfaces
- Install with --classic/--channel support via Target.FromRepo
- Remove/Purge/Upgrade via snap CLI
- Version queries with semver comparison
- Upgrade availability via snap refresh --list

Both packages follow the existing pattern:
- Exported methods on struct delegate to unexported functions
- _linux.go for real implementation, _other.go stubs
- Compile-time interface checks
- Parser tests for all output formats
2026-02-25 22:23:26 +00:00
0ebebfd93b Merge pull request #6 from gogrlx/cd/pacman-apk-capabilities
feat(pacman,apk): implement capability interfaces
2026-02-25 15:50:35 -05:00
5e3473684f Merge pull request #7 from gogrlx/cd/apt-dpkg-capabilities
feat(apt,dpkg): implement capability interfaces
2026-02-25 15:50:27 -05:00
e5c749558f feat(apt,dpkg): implement capability interfaces
apt: VersionQuerier, Holder, Cleaner, FileOwner, RepoManager, KeyManager, NameNormalizer
dpkg: FileOwner, NameNormalizer

All new interfaces follow the existing pattern of exported methods on
struct delegating to unexported platform-specific functions. Mutating
operations use Lock/Unlock; read-only operations do not.

Platform stubs in _other.go files return ErrUnsupportedPlatform.
Compile-time interface checks added for all implemented interfaces.
2026-02-25 20:47:44 +00:00
274b8c7d85 feat(pacman,apk): implement VersionQuerier, Cleaner, FileOwner, and Grouper interfaces
pacman:
- VersionQuerier: latestVersion via pacman -Si, listUpgrades via pacman -Qu,
  upgradeAvailable via pacman -Qu <pkg>, versionCmp via vercmp
- Cleaner: autoremove via pacman -Qdtq | pacman -Rns, clean via pacman -Sc
- FileOwner: fileList via pacman -Ql, owner via pacman -Qo
- Grouper: groupList/groupInfo via pacman -Sg, groupInstall via pacman -S
- Note: Holder skipped (no clean CLI support)

apk:
- VersionQuerier: latestVersion via apk policy, listUpgrades via apk upgrade --simulate,
  upgradeAvailable by checking upgrade list, versionCmp via apk version -t
- Cleaner: clean via apk cache clean, autoremove is no-op (not supported)
- FileOwner: fileList via apk info -L, owner via apk info --who-owns
2026-02-25 20:46:10 +00:00
5fd29c22fc Merge pull request #5 from gogrlx/cd/target-mutex-update
feat: per-provider mutex and Target-based package operations
2026-02-25 15:43:11 -05:00
ef81e027ce feat: add capability interfaces for extended package manager operations
Add optional interfaces that providers can implement beyond the base
Manager. grlx can type-assert to check support at runtime:

- VersionQuerier: LatestVersion, ListUpgrades, UpgradeAvailable, VersionCmp
- Holder: Hold, Unhold, ListHeld (version pinning)
- Cleaner: Autoremove, Clean (orphan/cache cleanup)
- FileOwner: FileList, Owner (file-to-package mapping)
- RepoManager: ListRepos, AddRepo, RemoveRepo
- KeyManager: AddKey, RemoveKey, ListKeys (GPG signing keys)
- Grouper: GroupList, GroupInfo, GroupInstall
- NameNormalizer: NormalizeName, ParseArch

Also adds GetCapabilities() helper, Repository type, and updated README.
2026-02-25 20:42:04 +00:00
0d6c5d9e17 feat: add per-provider mutex and Target-aware implementations
- Add snack.Locker embed for per-provider mutex serialization
- Update all providers (pacman, apk, apt, dpkg) to use []Target
  with version pinning support (pkg=version syntax)
- Add lock/unlock to all mutating operations (Install, Remove, Purge,
  Upgrade, Update)
- Add snack.TargetNames helper and formatTargets per provider
- apt: add FromRepo (-t) and Reinstall support
- dpkg: use Target.Source for .deb file paths in Install
2026-02-25 20:35:45 +00:00
4c07b78423 Merge pull request #4 from gogrlx/cd/apt-dpkg
feat: add Target type for per-package version/repo/source constraints
2026-02-25 15:33:27 -05:00
6cbfc96e3d feat: add Target type for per-package version/repo/source constraints
Breaking change to Manager interface: Install/Remove/Purge now accept
[]Target instead of []string. Target supports Version pinning, FromRepo
constraints, and Source paths — matching SaltStack's pkgs list semantics.

Also adds WithRefresh, WithFromRepo, WithReinstall options.
2026-02-25 20:32:25 +00:00
290f97a04f feat: add Target type for per-package version/repo/source constraints
Breaking change to Manager interface: Install/Remove/Purge now accept
[]Target instead of []string. Target supports Version pinning, FromRepo
constraints, and Source paths — matching SaltStack's pkgs list semantics.

Also adds WithRefresh, WithFromRepo, WithReinstall options.
2026-02-25 20:32:16 +00:00
48315f9bec Merge pull request #2 from gogrlx/cd/apk
feat(apk): implement apk-tools package manager wrapper
2026-02-25 15:30:23 -05:00
2f9ea83fcb Merge pull request #1 from gogrlx/cd/pacman
feat(pacman): implement Manager interface for pacman package manager
2026-02-25 15:30:15 -05:00
073c347c47 Merge pull request #3 from gogrlx/cd/apt-dpkg
feat(apt,dpkg): implement apt and dpkg package manager wrappers
2026-02-25 15:30:02 -05:00
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
6480c1142d feat(apk): implement apk-tools package manager wrapper
Implements the snack.Manager interface for Alpine Linux's apk-tools:
- Install, Remove, Purge, Upgrade, Update operations
- List installed, Search, Info, IsInstalled, Version queries
- Output parsing for apk list, search, and info formats
- Linux-only implementation with build-tag stubs for other platforms
- Options support: WithSudo, WithDryRun, WithRoot
- Tests for all output parsing functions
2026-02-25 20:24:10 +00:00
7d3eb1f98b feat(pacman): implement Manager interface for pacman package manager
Adds full pacman wrapper with:
- All Manager interface methods (Install, Remove, Purge, Upgrade, Update,
  List, Search, Info, IsInstalled, Version, Available)
- Linux implementation using exec.CommandContext
- Non-linux stubs returning ErrUnsupportedPlatform
- Output parsing for -Q, -Ss, -Si formats
- Options support: WithSudo, WithAssumeYes, WithDryRun, WithRoot
- Unit tests for parsing and argument building
2026-02-25 20:23:28 +00:00
f04365e600 chore: add GitHub Sponsors funding 2026-02-25 20:10:53 +00:00
d7755453ca feat: add CLI scaffold with cobra + fang 2026-02-25 20:09:38 +00:00
08514a27e1 feat: initial project scaffold
- Common Manager interface, Package type, functional options
- Sentinel errors for common package manager failures
- Sub-package stubs for: pacman, aur, apk, apt, dpkg, dnf, rpm,
  flatpak, snap, pkg (FreeBSD), ports (OpenBSD)
- detect/ package for auto-detection of system package manager
- 0BSD license
2026-02-25 20:01:51 +00:00