Skip to content

Add ghpkg .NET tool for managing GitHub package versions - #1

Merged
damianh merged 7 commits into
mainfrom
damianh-gh-package-manager-cli
Aug 8, 2026
Merged

Add ghpkg .NET tool for managing GitHub package versions#1
damianh merged 7 commits into
mainfrom
damianh-gh-package-manager-cli

Conversation

@damianh

@damianh damianh commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Why

Cleaning up old GitHub package versions (NuGet/npm) through the web UI is tedious, one version at a time. This adds ghpkg, an interactive .NET 10 global tool for browsing and bulk-deleting package versions.

What

  • Interactive TUI (Spectre.Console): pick scope (user or org), package type (nuget/npm), package, then multi-select versions to delete with confirmation and progress display. Warns when all versions are selected, since that removes the package entirely.
  • Auth via gh CLI: runs gh auth token under the hood, so no separate PAT management. Friendly errors when gh is missing or unauthenticated.
  • GitHub REST API client: paginated listing of packages/versions and version deletion for both user and org scopes, with actionable messages for 401/403/404/rate-limit responses (e.g. suggests gh auth refresh -s read:packages,delete:packages).
  • CLI options (System.CommandLine): --owner, --type, --package, and --dry-run to preview deletions; anything omitted is prompted interactively.
  • Packaged as a dotnet tool (PackAsTool, command name ghpkg) with README covering install and usage.
  • CI workflow: build + pack validation on push/PR to main.
  • Release workflow (manual dispatch): CalVer versioning (YYYY.M.<run-number>), packs, pushes to NuGet.org (requires NUGET_ORG_APIKEY secret), tags, and creates a GitHub release.

Validation

  • Clean build, --help verified.
  • Live smoke test against the GitHub API: auth token retrieval worked and the expected 403 (token lacking read:packages) surfaced the friendly guidance.
  • dotnet pack + global tool install/uninstall round-trip tested locally.

damianh and others added 4 commits August 8, 2026 15:35
Interactive Spectre.Console TUI to browse and delete NuGet/npm package
versions for user or org scope, authenticated via gh CLI token.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CI builds and packs on push/PR to main. Release workflow (manual
dispatch) computes YYYY.M.<run-number>, packs, pushes to NuGet.org,
tags, and creates a GitHub release.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Shorter command name; drops the gh- prefix which implied a gh CLI
extension. Renames project folder, csproj, solution, namespaces,
workflows, and README. User-agent version now derived from assembly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@damianh damianh changed the title Add gh-pkgclean .NET tool for managing GitHub package versions Add ghpkg .NET tool for managing GitHub package versions Aug 8, 2026
damianh and others added 3 commits August 8, 2026 16:33
Fetches orgs via GET /user/orgs and presents a selection list, with a
manual-entry option and graceful fallback to a text prompt when the
token lacks read:org.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
After deleting (or cancelling) versions, the package list is refetched
and shown again with a (quit) option instead of exiting. Explicit
--package invocations remain one-shot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Before the version list, choose None / All / Prerelease only to
pre-check items, then fine-tune with space toggles. Prerelease is
detected by a hyphen in the version (SemVer).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@damianh
damianh merged commit 332d70b into main Aug 8, 2026
1 check passed
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