Skip to content
mwtriggPublic

About

CLI for NuGet v3 feeds: search, push, pull, unlist, deprecate, plus `feed verify`, a spec-compliance oracle for any feed. No .NET needed.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

27 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nugctl

A CLI for managing packages on BaGetter and other NuGet v3-compatible feeds — search, push, pull, unlist, and deprecate packages without leaving the terminal.

Install

Download a release binary from the releases page, or build from source:

go build -o nugctl .

nugctl is a single static binary — no runtime dependencies.

Once installed, keep it current with:

nugctl upgrade

Quick start

# Add a profile (prompts for anything you don't pass as a flag)
nugctl auth login --name prod --url https://nuget.example.com/v3/index.json --api-key XXXX

# Search
nugctl package search newtonsoft --take 50

# Push / pull
nugctl package push ./bin/MyLib.1.2.3.nupkg
nugctl package pull MyLib --version 1.2.3 --output-dir ./out

# Inspect the feed itself
nugctl feed info

Profiles

nugctl stores one or more named feed profiles in ~/.config/nugctl/config.yml. Each profile has a URL, an optional API key, and an optional insecure flag.

nugctl auth login --name prod  --url https://nuget.example.com/v3/index.json --api-key XXXX
nugctl auth login --name local --url http://localhost:5555/v3/index.json          # unauthenticated
nugctl auth login --name dev   --url https://feed.internal/v3/index.json --insecure  # self-signed cert

nugctl profile list
nugctl profile use prod
nugctl profile delete dev

Leave --api-key blank (or don't pass it) for anonymous/unauthenticated feeds.

Configuring a connection

Every connection setting can be set three ways, in this order of precedence:

CLI flag > environment variable > profile (config file) > default

Setting Flag Env var Profile field
Active profile --profile, -p NUGCTL_PROFILE current_profile
Feed URL --url NUGCTL_URL url
API key --api-key NUGCTL_API_KEY api_key
Basic Auth user --basic-auth-user NUGCTL_BASIC_AUTH_USER basic_auth_user
Basic Auth pass --basic-auth-pass NUGCTL_BASIC_AUTH_PASS basic_auth_pass
Skip TLS verify --insecure NUGCTL_INSECURE insecure

This means a single flag or env var lets you override a profile for one call without editing the config file — handy in CI, or for pointing at a feed with a self-signed cert:

nugctl feed info --url https://feed.internal/v3/index.json --insecure
NUGCTL_URL=https://feed.internal/v3/index.json NUGCTL_INSECURE=true nugctl feed info

No profile or config file is required at all as long as --url/NUGCTL_URL supplies the feed URL — useful for CI environments with no ~/.config/nugctl. --profile/-p naming a profile that doesn't exist is still an error, so a typo doesn't fail silently.

--insecure skips TLS certificate verification (equivalent to curl -k) — use it for self-signed or internally-issued certs, not for feeds you don't trust.

HTTP Basic Auth

Some feeds sit behind a reverse proxy or gateway that gates access with its own HTTP Basic Auth, separate from the feed's own API key. Set --basic-auth-user (and --basic-auth-pass, prompted for if omitted) alongside whatever the feed itself requires — an API key and Basic Auth credentials are sent together when both are set:

nugctl auth login --name proxied --url https://feed.internal/v3/index.json \
  --api-key XXXX --basic-auth-user svc-nuget --basic-auth-pass XXXX

nugctl auth logout clears all stored credentials (API key and Basic Auth) from a profile.

Service index caching

nugctl caches each feed's service index (the resource-type → URL map from index.json) in ~/.config/nugctl/cache/, keyed by feed URL. A feed's resource URLs essentially never change, so this avoids an extra request to index.json before every command. The cache is revalidated with a conditional GET (ETag/Last-Modified) once it's older than 30 minutes, and any command that hits a 404 against a cached resource URL transparently re-fetches the index and retries once before failing.

Use --no-cache (env: NUGCTL_NO_CACHE) to bypass it for one call, or nugctl cache clear to remove it entirely.

Commands

Command Description
nugctl auth login Add or update a profile with feed credentials
nugctl auth logout Remove the API key from a profile
nugctl profile list List configured profiles
nugctl profile use <name> Set the active profile
nugctl profile delete <name> Delete a profile
nugctl feed info Show the feed's service index and capabilities
nugctl feed verify Validate a feed's NuGet v3 protocol conformance
nugctl feed deps Check whether packages' declared dependencies resolve in the feed
nugctl package search <query> Search for packages
nugctl package list --id <id> List all versions of a package
nugctl package info <id> Show package metadata
nugctl package push <file.nupkg> Push a package to the feed
nugctl package pull <id> Download a package from the feed
nugctl package unlist <id> Unlist (or hard-delete) a package version
nugctl package deprecate <id> Mark a package version as deprecated
nugctl package undeprecate <id> Clear deprecation from a package version
nugctl cache clear Remove all cached feed service indexes
nugctl upgrade Upgrade nugctl to the latest release

package can also be invoked as pkg or nupkg. Run any command with --help for its full flag list and examples, e.g. nugctl package search --help.

feed deps

Checks every package version in the feed (or just --package <id>) for dependencies that don't actually resolve — either the dependency package doesn't exist in the feed at all (missing), or it exists but no listed version satisfies the required range (unsatisfied):

nugctl feed deps
nugctl feed deps --package Newtonsoft.Json
nugctl feed deps -o json

A 429 or 503 response (e.g. from a feed's own rate limiter) is retried a few times with backoff, honoring the response's Retry-After header when it sends one, rather than aborting the scan outright. For a feed that rate-limits aggressively, cap the request rate up front instead of relying on retries:

nugctl feed deps --max-rps 5

feed verify

Checks a feed against the published NuGet v3 protocol (learn.microsoft.com/nuget/api) and reports each check as pass, fail, warn or skip. Built for CI: exit 0 means no check failed, 1 means at least one did, 2 means verify could not run at all (for example the service index was unreachable). Warnings and skips never change the exit code.

  • Read-only checks (always run): the service index advertises the core resources, under @type strings NuGet's own client looks up (client type string: ... warns otherwise); search and autocomplete answer in the documented shape; and, for one package, the registration (required properties, out-of-line pages, gzip), the flat container (version list, .nuspec download) and the package hash agree.
  • Negative checks (always run): 404 for a package that doesn't exist, and 401/403 for garbled credentials (only when credentials are configured).
  • Round-trip checks (--push, writable feeds only): push, find, download, unlist or delete, relist, plus extra packages that check the prerelease and semVerLevel search defaults, version normalization (1.00.0.0 is 1.0.0), original id casing, dependencies, the multipart field name and relist of an absent version.

A check fails when the feed breaks a rule the spec states. Where the spec allows a choice or the feature is optional (an uncompressed registration hive, a feed that replaces on re-push, no autocomplete resource), the check warns or skips instead. What is still unchecked is listed in docs/known-gaps.md.

Verifying a read-only or proxy feed

A feed you can't (or shouldn't) push to, such as a pull-through proxy of nuget.org or a read-only mirror, can still be verified: leave out --push, and name a package the feed can serve with --package:

nugctl feed verify --url https://proxy.example.com/v3/index.json --package Newtonsoft.Json
  • Without --push, verify sends no push, delete or relist. The one exception: when an API key or Basic Auth credentials are configured, the negative auth check sends one DELETE with deliberately wrong credentials for a random package id that doesn't exist. Leave credentials out (or use a read-only profile) if even that is unwelcome.
  • Without --package, verify picks the first package an unfiltered search returns. A proxy usually has nothing cached at first, so search comes back empty and the package checks skip. --package makes them run.
  • On a proxy, pick a package that exists upstream. The first request may make the proxy fetch it from upstream, so a slow first answer is normal.
  • This catches a broken service index, broken registration or flat-container responses and hash mismatches on the proxy itself; it doesn't exercise anything that needs a write.

Output

Every command supports -o table|json|yaml (default table). Use --properties to add specific columns to table output, or --all-properties / -A to include everything (this also switches the default format to YAML):

nugctl package search json --properties authors,tags
nugctl feed info --all-properties

Protocol support

nugctl speaks the NuGet v3 protocol (JSON service index + JSON resources) — this covers BaGetter, NuGet.org, Azure Artifacts, and most modern feeds. It does not currently support v2-only OData/Atom XML feeds (e.g. the Chocolatey community repository).

nugctl feed verify does not yet check everything the v3 spec requires; the unchecked areas are listed in docs/known-gaps.md.

Shell completion

nugctl completion bash|zsh|fish|powershell

License

MIT — see LICENSE.

About

CLI for NuGet v3 feeds: search, push, pull, unlist, deprecate, plus `feed verify`, a spec-compliance oracle for any feed. No .NET needed.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages