13 Commits

Author SHA1 Message Date
1410e4888c chore: update Go to 1.26.1, fix goimports formatting, add tests
- Update go.mod from Go 1.26.0 to 1.26.1
- Update dependencies: golang.org/x/sync, golang.org/x/sys,
  charmbracelet/x/exp/charmtone, mattn/go-runewidth
- Fix goimports formatting in 10 files
- Add apk/normalize_test.go: tests for normalizeName and
  parseArchNormalize with all known arch suffixes
- Add rpm/parse_test.go: tests for parseList, parseInfo,
  parseArchSuffix, and normalizeName (all at 100% coverage)
- All tests pass with -race, staticcheck and go vet clean
2026-03-08 12:47:30 +00:00
1fa7de6d66 feat: add PackageUpgrade to Capabilities, exhaustive detect + CLI tests
- Add PackageUpgrade field to Capabilities struct and GetCapabilities
- Add PackageUpgrade to all 11 provider capability tests
- Add pkg-upgrade to CLI detect command output
- Expand detect tests: ByName for all managers, concurrent Reset,
  HasBinary, candidates/allManagers coverage
- Add cmd/snack unit tests: targets, opts, getManager, version
- 838 tests passing, 0 failures
2026-03-06 01:07:35 +00:00
c34b7a467c test: exhaustive unit tests for all provider-specific interfaces
Add 740 total tests (up from ~200) covering:
- Compile-time interface compliance for all providers
- GetCapabilities assertions for every provider
- Parse function edge cases: empty, malformed, single-entry, multi-entry
- apt: extract inline parse logic into testable functions (parsePolicyCandidate,
  parseUpgradeSimulation, parseHoldList, parseOwner, parseSourcesLine)
- dnf/rpm: edge cases for both dnf4 and dnf5 parsers, normalize/parseArch
- pacman/aur: parseUpgrades, parseGroupPkgSet, capabilities
- apk: parseUpgradeSimulation, parseListLine, SupportsDryRun
- flatpak/snap: semverCmp, stripNonNumeric edge cases
- pkg/ports: all parse functions with thorough edge cases

Every provider now has:
- Interface compliance checks (what it implements AND what it doesn't)
- Capabilities test via snack.GetCapabilities()
- Parse function unit tests with table-driven edge cases
2026-03-06 01:07:35 +00:00
6ff778c857 fix(test): use non-installed package in dpkg/rpm Install_Unsupported tests
The tests expected Install("tree") to error because dpkg/rpm need
a .deb/.rpm file path. But "tree" is pre-installed in CI containers,
so the code short-circuits to "unchanged" and returns nil.

Use a non-existent package name instead to exercise the actual
install failure path.
2026-03-01 07:32:55 +00:00
4e90abc6a3 fix: update integration tests for Install/Remove multi-return signature 2026-03-01 00:47:23 +00:00
copilot-swe-agent[bot]
a3e4827e5e Fix Reinstall, version-pinned, error propagation, and DryRun bugs in Install/Remove pre-filter
Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
2026-02-28 06:59:51 +00:00
copilot-swe-agent[bot]
34578efcad Update all package managers to return InstallResult/RemoveResult
Change Install and Remove method signatures across all package manager
implementations (apt, apk, dnf, pacman, rpm, dpkg, snap, flatpak, ports,
pkg) to match the updated Manager interface.

- Wrapper files: update Install/Remove to return (snack.InstallResult, error)
  and (snack.RemoveResult, error) respectively
- Platform files (_linux.go, _openbsd.go, _freebsd.go): implement pre-check
  logic using isInstalled() to classify packages as unchanged or to-process,
  run command on actionable packages only, then collect results with version()
- Stub files (_other.go): return (snack.InstallResult{}, ErrUnsupportedPlatform)
  and (snack.RemoveResult{}, ErrUnsupportedPlatform)
- DNF special case: add v5 bool parameter to internal install/remove functions
  and thread d.v5 from the wrapper; update Purge to discard the result
- cmd/snack/main.go: update install/remove commands to discard InstallResult/
  RemoveResult and return only the error to cobra

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-28 06:31:01 +00:00
387e951b86 fix: use snack.Manager interface type for type assertions, drop coverpkg 2026-02-26 02:53:39 +00:00
b12f956e45 test: exhaustive integration tests with codecov
- Root package unit tests: Targets, TargetNames, ApplyOptions, error sentinels
- Every provider integration test now covers:
  - All Manager interface methods (positive + negative cases)
  - GetCapabilities verification (assert expected interfaces)
  - VersionQuerier: LatestVersion, ListUpgrades, UpgradeAvailable, VersionCmp
  - Holder: Hold, ListHeld, Unhold (apt, dnf)
  - Cleaner: Autoremove, Clean
  - FileOwner: FileList, Owner (+ not-found cases)
  - RepoManager: ListRepos (apt, dnf, flatpak)
  - KeyManager: ListKeys (apt, dnf)
  - Grouper: GroupList, GroupInfo (pacman, dnf)
  - NameNormalizer: NormalizeName, ParseArch table tests (apt, dpkg, dnf, rpm)
- Containertest matrix: 5 distros (debian, alpine, arch, fedora39, fedora-latest)
- CI: coverage profiles uploaded per-job, merged in codecov job
- Added .gitignore for coverage files
2026-02-26 02:50:48 +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
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
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
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