Commit Graph

116 Commits

Author SHA1 Message Date
d30c9fec0e docs: fix capability matrix — snap supports Clean 2026-03-06 04:20:10 +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
ffbe0e12ba Merge branch 'cd/add-winget': add winget support for Windows 2026-03-06 03:40:39 +00:00
6237a5f23a Merge branch 'cd/fix-flatpak-build': fix ports/detect build issues 2026-03-06 03:40:37 +00:00
ac15ab5a49 feat(winget): add integration tests, CI, and README updates
- Add winget_integration_test.go for Windows integration testing
- Add Windows CI job (windows-latest) for unit + detect tests
- Add cross-compile CI matrix (windows, darwin, freebsd, openbsd)
- Update README with winget in supported managers and capability matrix
- Include Windows coverage in codecov upload
2026-03-06 03:40:13 +00:00
9e9fb1a822 ci: add Windows runner and cross-compile jobs for winget
- New 'windows' job runs unit tests on windows-latest with coverage
- New 'cross-compile' matrix job builds for windows/darwin/freebsd/openbsd
- Integration test file for winget (gated behind integration build tag)
- Windows coverage included in codecov upload
2026-03-06 03:29:47 +00:00
aed2ee8b86 feat(winget): add Windows Package Manager support
Implements the full snack.Manager interface for winget:
- Install/Remove/Purge/Upgrade via winget CLI
- Search/List/Info/IsInstalled/Version queries
- Source (repository) management via RepoManager
- Version querying via VersionQuerier
- Targeted package upgrades via PackageUpgrader
- Name normalization via NameNormalizer

All commands use --disable-interactivity, --accept-source-agreements,
and --accept-package-agreements for non-interactive operation.

Parser handles winget's fixed-width tabular output by detecting column
positions from the header/separator lines. Includes VT100 escape
sequence stripping and progress line filtering.

Windows-only via build tags; other platforms return
ErrUnsupportedPlatform. Registered in detect_windows.go as the
default Windows package manager.
2026-03-06 03:26:47 +00:00
84f9cbc9cf fix(ports,detect): remove duplicate funcs and fix windows build
ports/capabilities_openbsd.go duplicated autoremove, clean, fileList,
and owner already defined in ports_openbsd.go, breaking OpenBSD builds.

detect/detect_other.go build tag didn't exclude windows, conflicting
with detect_windows.go declarations.
2026-03-06 03:19:49 +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
724ecc866e fix(ci): update snap test caps, install Flatseal in flatpak CI
- snap integration test asserted Clean=false, but snap now implements
  Cleaner — updated to assert True
- flatpak CI job now installs Flatseal before running integration tests
  so Version/List tests have a known installed package
2026-03-06 01:14:20 +00:00
77bdcfef3a feat(ci): add goreleaser config and release workflow v0.2.0 2026-03-06 01:07:39 +00:00
80ea10dcff fix(detect): add stub for unsupported platforms (darwin, windows, etc.)
detect package failed to compile on non-Linux/FreeBSD/OpenBSD because
candidates() and allManagers() had no fallback. Added detect_other.go
with empty implementations.
2026-03-06 01:07:35 +00:00
85e06ffc44 docs: rewrite README with current API, capabilities table, CLI docs
- Fix usage examples to use snack.Targets() and snack.Target
- Replace construction emoji status with actual extras per provider
- Document all interfaces including PackageUpgrader and DryRunner
- Add Options section documenting all functional options
- Add full CLI command reference with examples
- Remove implementation priority (everything is implemented)
2026-03-06 01:07:35 +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
60b68060e7 test(dpkg,apk): exhaustive tests for dpkg extras, fix apk parseInfoNameVersion panic
- dpkg: add normalize_test.go with NormalizeName/ParseArch table tests
- dpkg: add capabilities, DryRunner, interface compliance, parse edge cases
- apk: fix parseInfoNameVersion panic on empty input
- apk: add empty/whitespace test cases for parseInfoNameVersion

807 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
e38a787beb feat(ports): add VersionQuerier, Cleaner, FileOwner, PackageUpgrader 2026-03-06 01:07:35 +00:00
6ba3d75258 feat(snap): add Cleaner 2026-03-06 01:07:35 +00:00
4a711f0187 feat(flatpak): add VersionQuerier 2026-03-06 01:07:35 +00:00
0b4c596fad Merge pull request #39 from gogrlx/dependabot/go_modules/github.com/cloudflare/circl-1.6.3
chore(deps): bump github.com/cloudflare/circl from 1.6.1 to 1.6.3
2026-03-05 20:04:12 -05:00
dependabot[bot]
18fabed79a chore(deps): bump github.com/cloudflare/circl from 1.6.1 to 1.6.3
Bumps [github.com/cloudflare/circl](https://github.com/cloudflare/circl) from 1.6.1 to 1.6.3.
- [Release notes](https://github.com/cloudflare/circl/releases)
- [Commits](https://github.com/cloudflare/circl/compare/v1.6.1...v1.6.3)

---
updated-dependencies:
- dependency-name: github.com/cloudflare/circl
  dependency-version: 1.6.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-05 23:19:53 +00:00
e1d89fa485 Merge pull request #38 from gogrlx/cd/aur-implementation
feat(aur): implement native AUR client
2026-03-05 18:09:56 -05:00
b8714a4969 refactor(aur): use go-git instead of git CLI
Replace exec.Command git clone/pull with go-git's PlainCloneContext
and Worktree.Pull. Removes git binary dependency — only makepkg and
pacman are needed on the host now.
2026-03-05 22:58:26 +00:00
eb999ad391 feat(aur): implement native AUR client
Native Go implementation using the AUR RPC v5 API for search/info
queries and git+makepkg+pacman for building and installing packages.

Implements:
- Manager (full: Install, Remove, Purge, Upgrade, Update, List, Search,
  Info, IsInstalled, Version)
- VersionQuerier (LatestVersion, ListUpgrades, UpgradeAvailable, VersionCmp)
- Cleaner (Autoremove via pacman, Clean build dir)
- PackageUpgrader (UpgradePackages)

Key design decisions:
- No CLI wrapper (paru/yay) — uses AUR RPC API directly + git clone
- Packages are built with makepkg and installed via pacman -U
- Foreign packages (pacman -Qm) are treated as AUR packages for List
- Batch RPC queries (rpcInfoMulti) for efficient upgrade checks
- Configurable build directory and makepkg flags
- Not added to detect.Default() candidates (AUR supplements pacman,
  not replaces it) but available via detect.ByName("aur")
2026-03-05 22:50:35 +00:00
42c2e8ac05 ci: add goreleaser config and release workflow 2026-03-05 22:43:40 +00:00
34ce21618d Merge pull request #36 from gogrlx/cd/ci-improvements
ci: add staticcheck lint job and Go version matrix
2026-03-05 17:39:20 -05:00
342f10f38b ci: drop Go 1.25 from matrix (go.mod requires 1.26) 2026-03-05 22:37:56 +00:00
e9dc88f83a ci: add staticcheck lint job and Go version matrix for unit tests 2026-03-05 22:35:33 +00:00
597a4f9d72 Merge pull request #33 from gogrlx/cd/openbsd-detect-and-tests
fix(detect): wire up ports package for OpenBSD detection
2026-03-05 12:29:34 -05:00
8a9bba55cf Merge pull request #34 from gogrlx/cd/apt-test-coverage
fix(apt): fix extractURL multi-token options parsing and add unit tests
2026-03-05 12:26:45 -05:00
8075e74393 Merge pull request #35 from gogrlx/cd/pacman-test-coverage
test(pacman): add comprehensive unit tests for pure functions
2026-03-05 12:26:23 -05:00
ad45cfaef5 test(pacman): add comprehensive unit tests for pure functions
Add parse_test.go with edge case tests for parseList, parseSearch,
and parseInfo (empty input, whitespace, missing fields, colons in
values, no-repo names, partial installed markers).

Add helpers_test.go with tests for formatTargets, buildArgs option
combinations, parseUpgrades (standard + fallback format),
parseGroupPkgSet (duplicates, single-field lines), and interface
checks.

Coverage: 16.2% -> 24.1%.
2026-03-05 10:02:36 +00:00
6c8d0d367b fix(apt): fix extractURL multi-token options parsing and add unit tests
- Fix bug in extractURL where multi-token option blocks like
  [arch=amd64 signed-by=/path/key.gpg] were not properly skipped,
  causing the option value to be returned instead of the URL
- Add comprehensive unit tests for parseList, parseSearch, parseInfo
  edge cases (empty input, missing fields, special characters)
- Add unit tests for normalizeName and parseArch covering all
  supported Debian architectures and edge cases
- Add unit tests for formatTargets, buildArgs (all option combos),
  and extractURL (basic, options, signed-by)
- Coverage: apt package 7.5% -> 17.1%
2026-03-05 09:33:36 +00:00
90ca983200 fix(detect): wire up ports package for OpenBSD detection
The ports package was fully implemented but detect_openbsd.go still
returned nil candidates with a stale TODO. Wire up ports.New() so
OpenBSD systems can auto-detect their package manager.

Also adds:
- Unit tests for GetCapabilities with mock managers (base + full)
- Unit tests for Locker mutual exclusion
- Edge case tests for ports parser (empty input, whitespace, fallback)
- Minor dep updates (charmbracelet/ultraviolet, charmbracelet/x)
2026-03-05 09:03:38 +00:00
397e865107 Merge pull request #32 from gogrlx/cd/update-deps
chore(deps): update all dependencies
2026-03-01 10:49:14 -05: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
f85e215981 fix: update apt/dpkg integration tests for 2-value Install/Remove returns 2026-03-01 01:44:50 +00:00
4e90abc6a3 fix: update integration tests for Install/Remove multi-return signature 2026-03-01 00:47:23 +00:00
e7018f3602 chore(deps): update all dependencies 2026-02-28 08:00:44 +00:00
e4844cca05 Merge cd/upgrade-packages: add PackageUpgrader interface (#31) 2026-02-28 07:26:52 +00:00
8306da6223 refactor(apt): build upgrade args directly instead of post-hoc insertion
Avoids fragile slice manipulation when injecting --only-upgrade flag.
2026-02-28 07:26:48 +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
5629e41aeb style: goimports formatting 2026-02-28 07:09:07 +00:00
83d92be37a refactor(snack): merge GroupIsInstalled into Grouper interface
GroupQuerier was an unnecessary indirection — GroupIsInstalled is a group
operation and belongs on Grouper. No v1 stability guarantee, so breaking
the interface is fine.
2026-02-28 07:08:34 +00:00
bbb745434e Merge remote-tracking branch 'origin/copilot/add-isheld-method-to-holder-interface' into cd/integration-copilot-prs 2026-02-28 07:07:25 +00:00
c55027f9b7 merge: resolve pacman capabilities conflict (keep both interfaces) 2026-02-28 07:07:21 +00:00
b0e39036de Merge remote-tracking branch 'origin/copilot/add-install-remove-changes-reporting' into cd/integration-copilot-prs 2026-02-28 07:07:00 +00:00
ae56fb541d Merge remote-tracking branch 'origin/copilot/add-group-is-installed-check' into cd/integration-copilot-prs 2026-02-28 07:07:00 +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