diff --git a/docs/changelog/release-notes.mdx b/docs/changelog/release-notes.mdx index 04363a7b..6348bf92 100644 --- a/docs/changelog/release-notes.mdx +++ b/docs/changelog/release-notes.mdx @@ -26,6 +26,15 @@ rss: true + + `v0.151.0` + +## New features + +- **Private npm registry auth** - Plugin npm sources now support `authTokenEnvVar` for token-based authentication with private registries (JFrog Artifactory, AWS CodeArtifact, GitHub Packages) + + + `v0.150.0` diff --git a/docs/enterprise/enterprise-plugin-registry.mdx b/docs/enterprise/enterprise-plugin-registry.mdx index f61b94e2..64dd1892 100644 --- a/docs/enterprise/enterprise-plugin-registry.mdx +++ b/docs/enterprise/enterprise-plugin-registry.mdx @@ -242,6 +242,35 @@ See [Plugins ยท Pinning a marketplace to a ref or commit](/cli/configuration/plu Version pinning via the per-plugin `version` field is not currently supported. To pin a plugin's version, pin the marketplace it lives in via `ref` or `sha`. +## Private npm registry authentication + +For plugins distributed as npm packages from private registries that require token-based authentication (JFrog Artifactory, AWS CodeArtifact, GitHub Packages), use the `authTokenEnvVar` field in the plugin source to specify which environment variable holds the auth token: + +```json +{ + "plugins": [ + { + "name": "internal-tools", + "description": "Internal tooling plugin", + "source": { + "source": "npm", + "package": "@acme/droid-internal-tools", + "registry": "https://acme.jfrog.io/artifactory/api/npm/npm-virtual/", + "authTokenEnvVar": "JFROG_NPM_TOKEN" + } + } + ] +} +``` + +At install time, Droid reads the token from the named environment variable and writes a registry-path-scoped `_authToken` entry into a temporary `.npmrc`. The token never persists on disk beyond the install. If the variable is not set, the install fails early with an actionable error telling users which variable to export. + +Ensure your onboarding documentation instructs developers to export the required token: + +```bash +export JFROG_NPM_TOKEN="$(jfrog rt access-token-create --groups readers | jq -r .access_token)" +``` + ## Private repository access For private Git repositories, ensure Droid can authenticate: diff --git a/docs/guides/building/building-plugins.mdx b/docs/guides/building/building-plugins.mdx index 9ba4d5b5..31e147ce 100644 --- a/docs/guides/building/building-plugins.mdx +++ b/docs/guides/building/building-plugins.mdx @@ -343,7 +343,7 @@ Pinning behavior depends on the source type. Git-based sources (`github`, `url`, | `github` | `repo`, `ref?`, `sha?` | Plugin is hosted in its own GitHub repository. | | `url` | `url`, `ref?`, `sha?` | Plugin is hosted on a non-GitHub git host (GitLab, Bitbucket, self-hosted). | | `git-subdir` | `url`, `path`, `ref?`, `sha?` | Plugin lives inside a subdirectory of a larger git repository, such as a monorepo. | -| `npm` | `package`, `version?`, `registry?` | Plugin is published as an npm package. | +| `npm` | `package`, `version?`, `registry?`, `authTokenEnvVar?` | Plugin is published as an npm package. | #### npm packages @@ -388,11 +388,42 @@ Install from a private registry: } ``` +Authenticate with a private registry that requires a token (for example JFrog Artifactory, AWS CodeArtifact, or GitHub Packages): + +```json +{ + "name": "pr-triage", + "source": { + "source": "npm", + "package": "@your-org/droid-pr-triage", + "registry": "https://acme.jfrog.io/artifactory/api/npm/npm-virtual/", + "authTokenEnvVar": "JFROG_NPM_TOKEN" + } +} +``` + +Users must set the named environment variable before launching Droid: + +```bash +# bash/zsh +export JFROG_NPM_TOKEN="your-token-here" +``` + +```powershell +# PowerShell +$env:JFROG_NPM_TOKEN="your-token-here" +``` + + +Never commit tokens to source control or paste them into marketplace JSON. The `authTokenEnvVar` field stores only the variable name, not the secret itself. + + | Field | Required | Description | | :---- | :------- | :---------- | | `package` | Yes | npm package name. Scoped packages (`@scope/name`) are supported. | | `version` | No | npm version, range, or dist-tag (for example `2.4.0`, `^2.0.0`, `latest`). Defaults to `latest`. Tarball URLs, `file:` paths, `git+...` specs, and `npm:` aliases are rejected; the source must resolve through the configured registry. | | `registry` | No | Custom registry URL. Defaults to the system npm registry. Must be `https://` with no embedded credentials, query string, or fragment, so that secrets stay in your registry client config rather than the marketplace JSON. The setting is scoped to the install run and never written to your global `~/.npmrc`. | +| `authTokenEnvVar` | No | Name of an environment variable that holds an authentication token for the private registry (for example `JFROG_NPM_TOKEN`). Must be a valid shell variable name (`[A-Za-z_][A-Za-z0-9_]*`). Only takes effect when `registry` is also set. At install time, Droid reads the token from this variable and writes a path-scoped `_authToken` entry into a temporary `.npmrc` that is cleaned up after install. If the variable is not set, the install fails early with a clear error. | **Layout requirements.** The published package root must contain a plugin manifest. Both the native Droid layout (`.factory-plugin/plugin.json`, `droids/`, `mcp.json`) and the Claude Code layout (`.claude-plugin/plugin.json`, `agents/`, `.mcp.json`) are accepted. Claude Code layouts are translated into Droid form when the package is copied into the plugin cache.