21 Commits

Author SHA1 Message Date
84e4f8e2ff feat(aur): rewrite with go-git, RPC batch queries, functional options
- Replace shell git clone with go-git for cloning/pulling PKGBUILDs
- Add rpcInfoMulti for batch AUR queries (single HTTP request)
- Add functional options: WithBuildDir, WithMakepkgFlags
- Implement proper remove/purge via pacman -R/-Rns
- Fix temp directory leak: buildPackage returns cleanup path
- Remove NameNormalizer (AUR names are plain identifiers)
- Update README capability matrix
- Remove duplicate platform stubs (flatpak, ports)
2026-03-10 17:41:03 +00:00
1a51a40e4e Merge branch 'cd/aur-implementation': AUR rewrite with go-git, RPC batch queries, functional options
# Conflicts:
#	flatpak/capabilities.go
#	ports/capabilities.go
#	ports/capabilities_openbsd.go
#	ports/ports_test.go
#	snap/capabilities.go
#	snap/snap_linux.go
#	snap/snap_other.go
2026-03-10 17:35:15 +00:00
c913d96de3 fix(ci): update integration tests for NameNormalizer, fix lint and Windows CI
- Update apk/pacman/snap/flatpak integration tests to assert
  NameNormalize=true (all managers now implement NameNormalizer)
- Update flatpak integration test to assert VersionQuery=true
- Remove unused aur functions: rpcInfoMulti, getAURBuildDir
- Wire AUR.Clean to call clean() for consistency
- Fix Windows CI: add shell:bash to avoid PowerShell arg splitting
  on -coverprofile=coverage-windows.out
2026-03-06 04:13:39 +00:00
151c657398 fix(flatpak): restore VersionQuerier functions lost in refactor
The capabilities_linux.go deletion moved VersionQuerier methods
(latestVersion, listUpgrades, upgradeAvailable, versionCmp) to
capabilities.go as receiver methods, but their platform implementations
were not added to flatpak_linux.go, causing build failure on Linux.

Also removes accidentally committed .DS_Store, .crush/, and AGENTS.md.
2026-03-06 03:15:43 +00:00
934c6610c5 feat: add Homebrew provider, implement NameNormalizer across all managers
- Add brew package for Homebrew support on macOS and Linux
- Implement NameNormalizer interface (NormalizeName, ParseArch) for all providers
- Add darwin platform detection with Homebrew as default
- Consolidate capabilities by removing separate *_linux.go/*_other.go files
- Update tests for new capability expectations
- Add comprehensive tests for AUR and brew providers
- Update README with capability matrix and modern Target API usage

💘 Generated with Crush

Assisted-by: AWS Claude Opus 4.5 via Crush <crush@charm.land>
2026-03-05 20:40:32 -05: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
4a711f0187 feat(flatpak): add VersionQuerier 2026-03-06 01:07:35 +00:00
c00133718e feat(flatpak): add VersionQuerier 2026-03-05 23:18:40 +00:00
4e90abc6a3 fix: update integration tests for Install/Remove multi-return signature 2026-03-01 00:47:23 +00:00
f2eff01ab4 feat: add PackageUpgrader interface for targeted package upgrades
Add optional PackageUpgrader interface with UpgradePackages method
that upgrades specific installed packages (unlike Upgrade which
upgrades everything).

Each backend uses native upgrade commands:
- apt: apt-get install --only-upgrade
- dnf: dnf upgrade <pkg>
- pacman: pacman -S <pkg>
- apk: apk upgrade <pkg>
- pkg (FreeBSD): pkg upgrade <pkg>
- flatpak: flatpak update <pkg>
- snap: snap refresh <pkg>

Non-installed packages are filtered out and returned as Unchanged.

Closes #31
2026-02-28 07:26:11 +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
aa34f1d896 fix(test): relax assertions for cross-distro compatibility
- apk: Search_NoResults may return error instead of empty
- apt: Info may not populate Description; ListRepos URL may be empty
- pacman: Groups may not exist in minimal containers
- dnf: FileList_NotInstalled doesn't guarantee ErrNotInstalled sentinel;
  GroupInfo_NotFound may return empty instead of error;
  Holder tests nested under Hold (skip all if versionlock unavailable)
- flatpak: Info/Version may not work on all app IDs after install
2026-02-26 03:10:55 +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
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
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
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
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