feat(packages): add packages command group with list

Description

Adds a new glab packages command group for the project package registry, addressing the request to upload/download generic packages without hand-rolling curl and a manually looked-up token.

This first MR adds the parent command (modeled on glab securefile) and the list subcommand, which lists a project's packages as JSON with --name filtering and --jq support.

The command is intentionally flat (glab packages <verb>). Only generic packages are supported for now; a --package-format flag can be added later without restructuring.

Note

The decision to stick to only JSON was intentional. This keeps the changes small in scope.

Resolves #7421 (closed)

How has this been tested?

Automated:

  • go test ./internal/commands/packages/... ./internal/commands/
  • golangci-lint run ./internal/commands/packages/... — 0 issues

Manual (against a project you can read, e.g. -R group/project):

  1. Build the branch: make build
  2. ./bin/glab packages list -R group/project — prints the project's packages as JSON.
  3. ./bin/glab packages ls -R group/project — the ls alias produces the same output.
  4. ./bin/glab packages list -R group/project --name some-package — only packages matching that name are returned.
  5. ./bin/glab packages list -R group/project --jq '.[].name'--jq filters the JSON to just the names.
  6. ./bin/glab packages list -R group/project --per-page 5 --page 2 — paginates the result.
  7. Run inside a repo clone with no -R and confirm it targets the current project.

Stacked MRs (review/merge bottom-up):

  1. !3393 (merged) — Add packages command group with list
  2. !3394 (merged) — Add packages upload command (depends on !3393 (merged))
  3. !3395 (merged) — Add packages download command (depends on !3394 (merged))
  4. !3396 (merged) — Add packages delete command (depends on !3395 (merged))
Edited by Oscar Tovar

Merge request reports

Loading