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
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
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
.npmrcfirst, then yours), and the Token npm sends there. - Composer: the Token it sends (this project's
auth.json,COMPOSER_AUTH, or your globalauth.json), and whether this project'scomposer.jsonhas 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
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
polypack login
- The CLI shows a code, such as
BCDF-GHJK, and opens PolyPack in your browser. Sign in there if you are not already. - Check that the code and your machine's name match, choose your Team, and select Approve. Only approve a sign-in you started yourself.
- 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 thecomposer config repositories…line to run in each project. - docker:
docker loginto 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, asbundle configwould write it. It prints the Gemfilesourceblock 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.--namenames the machine;--no-setupskips 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.--teampicks 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 withid-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--filesor--rubygems, put it wherepolypack files uploadorgem pushfinds it. PolyPack's GitHub Action runs it.polypack verify npm @hopper/ui@1.1.0,polypack verify oci api:1.1.0orpolypack verify gem hopper-widgets@1.4.0(with--platformfor 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.