Skip to content

Add the ability to show package history#152

Open
anvacaru wants to merge 1 commit into
masterfrom
anvacaru/history
Open

Add the ability to show package history#152
anvacaru wants to merge 1 commit into
masterfrom
anvacaru/history

Conversation

@anvacaru

Copy link
Copy Markdown
Contributor

Adds a --history flag to kup list that shows the versions you have previously had installed for each package, reconstructed from the Nix profile generations.

  • kup list --history — print the version timeline for every package that appears in the generation history.
  • kup list <package> --history — print the timeline for a single package.

Each row shows the generation number, the date, and the version (git tag if known, otherwise the short commit; local checkout (<path>) for git+file:// builds). The version installed in the active generation is highlighted and marked with . Consecutive generations with the same package version are collapsed, so the table shows version changes rather than every generation bump.

How it works

Every kup install/update/uninstall creates a new Nix profile generation, stored as a profile-<N>-link symlink whose target contains a manifest.json (the same format reload_packages already parses). The history is built by reading those manifests in order:

Changes

  • src/kup/package.py: InstalledVersion dataclass, read_generation_manifests, GENERATION_LINK_RE.
  • src/kup/__main__.py: profile_generations_dir, build_history, _mark_current, _enrich_tags, _format_version, list_history; --history argument on the list subparser and its dispatch. The duplicated GitHub auth block in the existing version listing is factored into _github_auth.
  • src/kup/list-help.md, README.md: document the flag with an example.
  • src/tests/unit/test_unit.py: unit tests for generation parsing (including garbage-collected generations and uri normalization), the collapsing and current-version marking in build_history, local-checkout entries, package filtering, version formatting, and profile symlink resolution. The tests run offline.
image

@anvacaru anvacaru marked this pull request as ready for review June 23, 2026 08:47
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.

1 participant