Skip to content
PolyPack
Docs: The polypack CLI

The polypack CLI

Sign a machine in and set up npm, Composer and docker in one command.

polypack is a small command-line program for macOS, Linux and Windows. It signs your machine in to your Team through the browser and sets up your package managers, so you never copy or paste a Token. It is MIT licensed, and PolyPack distributes it.

Install

macOS and Linux · checks the download against SHA256SUMS, and its signature by PolyPack's key (with openssl)
curl -fsSL https://polypack.io/install.sh | sh

On Windows, download polypack-windows-amd64.exe (or arm64), and check it against SHA256SUMS beside it. Every release is listed at index.json.

When an install fails

Check this machine and project
polypack doctor

For each Team you are signed in to, and any PolyPack registry your npm or Composer config points at, it checks that the Team's hosts answer and what each package manager sends them:

  • npm: which registry each of the Team's scopes installs from (this project's .npmrc first, then yours), and the Token npm sends there.
  • Composer: the Token it sends (this project's auth.json, COMPOSER_AUTH, or your global auth.json), and whether this project's composer.json has the Team's repository.
  • docker: the Token in docker's config or credential helper, when your Plan includes container images.

PolyPack says what it makes of each Token: who it belongs to, what it may do and until when, or why it is refused (expired, revoked, another Team's, or not allowed from your address). Each problem comes with the command that fixes it. It changes nothing, shows a Token only as polypack_… and its last four characters, as the panel does, and exits with 1 when it finds a problem.

Update

Update to the latest version · checks the download against its SHA256SUMS
polypack update

It replaces the polypack you run with the latest release for your platform. If it is installed where you cannot write, such as /usr/local/bin, run sudo polypack update, or the install line again. --version v0.9.0 installs a particular release (PolyPack has every release from v0.8.0).

Releases come from PolyPack itself, checked against a SHA256SUMS signed by PolyPack's key, which is built into the CLI, so a release PolyPack cannot vouch for is never installed from there. If PolyPack cannot be reached, nothing changes: try again later. polypack update --channel beta follows beta releases from then on, and --channel latest goes back.

At most once a day, alongside whatever command you run, the CLI asks for the latest release, and tells you after the command when a newer one is out. It never waits more than 2 seconds for the answer, and stays quiet in CI, when its output is not a terminal, and in polypack ci. Set POLYPACK_NO_UPDATE_CHECK=1 to turn it off.

Sign in

Sign this machine in
polypack login
  1. The CLI shows a code, such as BCDF-GHJK, and opens PolyPack in your browser. Sign in there if you are not already.
  2. Check that the code and your machine's name match, choose your Team, and select Approve. Only approve a sign-in you started yourself.
  3. The CLI receives a read-only Member Token for that Team, valid for 90 days, and sets up your package managers.

The Token appears under My Tokens as "CLI on" and your machine's name, so you can revoke it there. If your Team requires single sign-on, open the Team in PolyPack first, then approve.

What it sets up

  • npm: your Team's scopes and the Token, in a marked block in your own ~/.npmrc. Run it again and the block is replaced; nothing else in the file changes.
  • Composer: the Token in Composer's global auth.json. It prints the composer config repositories… line to run in each project.
  • docker: docker login to your Team's image host, when your Plan includes container images and docker is installed.
  • Bundler: the Token for your Team's host in your own ~/.bundle/config, as bundle config would write it. It prints the Gemfile source block for your Team's gems.

It never writes into a project, so nothing it sets up can be committed by mistake. To set up only some of them, name them: polypack setup --npm, --composer, --docker or --rubygems, in any combination.

Commands

  • polypack login: sign this machine in, then set it up. --name names the machine; --no-setup skips the setup.
  • polypack setup: set up again, for every Team you are signed in to.
  • polypack whoami: who each Team's Token belongs to.
  • polypack logout: revoke the Token and remove what setup wrote. --team picks one Team.
  • polypack doctor: check what npm, Composer, Bundler and docker send to your Team, and whether this project's Gemfile keeps your Team's gems in a source block, and say what to fix. See below.
  • polypack update: install the latest release in place of this one.
  • polypack ci @hopper/ui --team hopper: in a GitHub Actions job with id-token: write, exchange GitHub's ID token for a Token that publishes that one Pack, and set npm, or docker and helm, up with it; with --files or --rubygems, put it where polypack files upload or gem push finds it. PolyPack's GitHub Action runs it.
  • polypack verify npm @hopper/ui@1.1.0, polypack verify oci api:1.1.0 or polypack verify gem hopper-widgets@1.4.0 (with --platform for a platform gem): check a version's signed provenance, and that the registry serves what was published. See Signatures and provenance.

Run polypack login again for each Team you belong to. For CI, use a Team Token instead (see CI), and to publish from GitHub Actions, trusted publishing. Plain npm logout also revokes the Token it uses.