Skip to content

Feature/flatpak homebrew macports - #11

Merged
padovanl merged 5 commits into
mainfrom
feature/flatpak-homebrew-macports
Aug 31, 2026
Merged

padovanl merged 5 commits into
mainfrom
feature/flatpak-homebrew-macports

Conversation

@padovanl

Copy link
Copy Markdown
Owner

Closes #9

Closes #9.

pkgtui only knew apt and snap, and built its two tabs unconditionally:
on a Mac it launched into a window that could never show a package.

Three new backends under internal/, each keeping command execution
separate from output parsing so the parsers stay unit-testable without
the real tool on the machine:

- flatpak: apps (not runtimes) via "flatpak list --columns", updates via
  "remote-ls --updates", search, and masking as the hold/unhold action.
  Runs with a fixed LC_ALL so glib's locale-aware size formatting can't
  turn "1,2 MB" into a thousandfold overestimate, and never through
  sudo: flatpak asks polkit itself.
- homebrew: formulae and casks together, "brew outdated --json=v2" for
  upgrades, autoremove as the orphaned view, pin as the hold, cleanup as
  a disk-report entry, and installed_on_request + "brew uses" as
  provenance. Sizes come from measuring the keg, since brew reports none
  anywhere. Read-only calls set HOMEBREW_NO_AUTO_UPDATE so opening a tab
  can't kick off a git fetch.
- macports: active versions from "port installed", "port outdated",
  leaves as the orphaned view, and the inactive versions MacPorts keeps
  after every upgrade as disk-report entries.

The UI side stops assuming exactly two backends: tabs are now built from
whichever managers report Available(), falling back to all of them when
none are (so a fresh Mac gets a window that explains itself instead of an
empty one), and the overlap view (O) reports a package installed through
any two backends rather than specifically apt and snap.

Releases now also build darwin_amd64/darwin_arm64, which is what makes
the three backends above actually usable on Apple Silicon.
Follow-up to the three new backends, closing the gaps they left against
what apt and snap already offer.

pkg.PPAManager becomes pkg.RepoManager: same three operations, plus the
noun the backend uses for these ("PPA", "remote") and the shape its add
command expects, so the screen stops telling flatpak users about PPAs and
/etc/apt/sources.list.d. AddRepoCmd returns nil for a spec it can't use,
and the panel repeats that backend's hint instead of confirming a command
that can't run. The rebindable action keeps its "ppa" id in config.json,
so an existing rebinding of P survives.

flatpak implements it over "flatpak remotes"/remote-add/remote-delete,
taking either "NAME LOCATION" or a lone .flatpakrepo URL (named after the
file, which is the form a project's install page actually hands out).

flatpak also gains a disk-cleanup entry for unused runtimes, deliberately
as a single row that hands off to "flatpak uninstall --unused": working
out which runtimes are unused from the outside means guessing at
extensions and base runtimes, and a wrong guess uninstalls something
still in use.

macports gains "why is this installed", which its registry can answer
exactly: the requested flag for manual-vs-dependency, port dependents for
the reverse deps.
A darwin tarball is not how anyone installs a CLI on a Mac. Every release
now also generates a Homebrew cask and commits it to Casks/ in this repo,
making the install:

    brew tap padovanl/pkgtui https://github.com/padovanl/pkgtui
    brew install --cask pkgtui

and every later "brew upgrade" work like it does for anything else.

A cask, not a formula: it's what Homebrew now uses for a plain prebuilt
binary, and casks clear the Gatekeeper quarantine attribute themselves —
these binaries aren't notarized, so that would otherwise bite on first
run. The generated cask covers Apple Silicon, Intel and Linuxbrew.

The tap lives in this repository rather than a separate padovanl/homebrew-tap
so it needs no second repo and no personal access token: the release
workflow's own GITHUB_TOKEN can already write here. The cost is the
explicit URL in the tap command, since Homebrew only infers that for repos
named homebrew-*. CONTRIBUTING notes what to change if main ever gets
branch protection, which would break the push after the binaries are
already out.

Verified with goreleaser v2.18.0 locally: "goreleaser check" passes and
"goreleaser release --snapshot --clean --skip=publish" produces the four
archives, both .debs, the checksums and dist/homebrew/Casks/pkgtui.rb with
the right per-arch URLs and sha256s.
The nav still said "beyond apt" for a section now about every backend,
and the hero's terminal mock showed two tabs when the app draws one per
package manager it finds.
@padovanl
padovanl merged commit 0046ebe into main Aug 31, 2026
2 checks passed
@padovanl
padovanl deleted the feature/flatpak-homebrew-macports branch August 31, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Flatpak, Homebrew, and MacPorts

1 participant