Skip to content

npm Plugin

@theholocron/holocron-plugin-npm registry

npm · GitHub

Install

pnpm add -D @theholocron/holocron-plugin-npm

Capabilities

CapabilityToken
registryHOLOCRON_NPM_TOKEN (npm)

The token is the stage-only granular token that holocron publish package --initial stages new packages with (npm stage token). It is held in the agent layer only.

providers: {
registry: "npm",
}

The organization’s holocron_capabilities property must allow registry (holocron apply properties) before a repo declares it. publish package does not read the capability yet: it still asks npm itself.

Terminal window
# Store in keyring
holocron new token npm <TOKEN>
# Or via env var
export HOLOCRON_NPM_TOKEN=<TOKEN>
# Also recognized:
export NPM_TOKEN=<TOKEN>

Make the token by hand at the npm tokens page: Read and write, the @theholocron scope, 2FA bypass unchecked and a short expiry. npm has no API for it. What can and cannot be checked for it: npm.

holocron probe npm token --environment agent asks the registry who the token is (GET /-/whoami) and never prints the token. Rows:

Row Meaning
token ok when a token is set
layer with --environment, ok when the layer is one that should hold the token (agent), info for any other
valid ok with the user name when the registry accepts the token; fail when it refuses it (401, 403) or does not answer
rotation info: npm does not expose a token’s age or expiry to the token, so it says so and the 30 days (7 days before an expiry) are a reminder
permissions info: npm does not report a token’s permissions, so the probe cannot tell a stage-only token from one that can publish directly

holocron provider npm whoami reports the same identity and rotation facts, and holocron doctor tokens fails an agent Environment that has no valid HOLOCRON_NPM_TOKEN.

Method Description
whoami() Who the token is: { username }
latestVersion(name) The latest version of a package, or undefined when the registry does not have it

It is built on @theholocron/npm-client.