go-tokenless 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +170 -2
- package/dist/chunks/chunk-NBTQMDVT.js +175 -0
- package/dist/chunks/mcp-LB3P2FNE.js +83 -0
- package/dist/cli.js +34 -0
- package/llms.txt +32 -0
- package/package.json +54 -4
- package/server.json +20 -0
- package/skills/go-tokenless/SKILL.md +26 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// go-tokenless (MIT) https://github.com/Continuous-Actions/go-tokenless. Generated file, do not edit.
|
|
3
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
4
|
+
import{b as w,c as d,d as k,e as v,f as y}from"./chunks/chunk-NBTQMDVT.js";import{resolve as S}from"node:path";var b="1.0.0",g=`go-tokenless: switch npm publishing in GitHub Actions to trusted publishing (no NPM_TOKEN).
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
npx go-tokenless [plan] Show what would change (default; writes nothing)
|
|
8
|
+
npx go-tokenless apply Rewrite the workflows and package.json files
|
|
9
|
+
npx go-tokenless mcp Run as an MCP server over stdio (for AI agents)
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
--json Machine-readable output (the full plan)
|
|
13
|
+
--diff Include a unified diff in text output
|
|
14
|
+
--repo o/r GitHub owner/repo (default: from git remote "origin")
|
|
15
|
+
--cwd <dir> Repository root (default: current directory)
|
|
16
|
+
--offline Skip npm registry lookups
|
|
17
|
+
--npm-version <range>
|
|
18
|
+
npm version for the inserted upgrade step (default ^12).
|
|
19
|
+
Other versions may break publishing; a warning is shown.
|
|
20
|
+
--read-token <SECRET>
|
|
21
|
+
Give install steps (npm ci, pnpm install, ...) a read-only npm token
|
|
22
|
+
from this secret, for private packages. Publish steps stay tokenless.
|
|
23
|
+
--npm-args "<args>"
|
|
24
|
+
Extra arguments added to every npm command it generates
|
|
25
|
+
(the upgrade step and the npm trust commands), e.g. "--registry=https://registry.npmjs.org"
|
|
26
|
+
-h, --help Show this help
|
|
27
|
+
-v, --version Show the version
|
|
28
|
+
|
|
29
|
+
Exit codes: 0 ok, 1 blocked (errors to fix by hand), 2 usage error, 3 unexpected error.
|
|
30
|
+
Docs: https://github.com/Continuous-Actions/go-tokenless`;async function O(e){let o=[...e],r=n=>{let s=o.indexOf(n);return s<0?!1:(o.splice(s,1),!0)},t=n=>{let s=o.indexOf(n);if(s<0)return;let u=o[s+1];if(u===void 0||u.startsWith("--")&&n!=="--npm-args")throw new d(`${n} needs a value`);return o.splice(s,2),u};if(r("-h")||r("--help"))return console.log(g),0;if(r("-v")||r("--version"))return console.log(b),0;let x=r("--json"),E=r("--diff"),m=r("--offline"),l=t("--repo"),p=t("--npm-version"),c=t("--npm-args"),f=t("--read-token"),h=S(t("--cwd")??"."),i=o.shift()??"plan";if(o.length>0)return console.error(`Unknown argument: ${o[0]}
|
|
31
|
+
|
|
32
|
+
${g}`),2;if(l!==void 0&&!/^[\w.-]+\/[\w.-]+$/.test(l))return console.error("--repo must look like owner/repo"),2;try{w({npmVersion:p,npmArgs:c,readToken:f})}catch(n){return console.error(String(n.message)),2}if(i==="mcp"){let{serve:n}=await import("./chunks/mcp-LB3P2FNE.js");return n(b),-1}let a;if(i==="plan")a=(await k(h,{repo:l,offline:m,npmVersion:p,npmArgs:c,readToken:f})).plan;else if(i==="apply")a=await v(h,{repo:l,offline:m,npmVersion:p,npmArgs:c,readToken:f});else return console.error(`Unknown command: ${i}
|
|
33
|
+
|
|
34
|
+
${g}`),2;return console.log(x?JSON.stringify(a,null,2):y(a,{diff:E||i==="plan"})),a.status==="blocked"?1:0}O(process.argv.slice(2)).then(e=>{e>=0&&(process.exitCode=e)},e=>{console.error(`go-tokenless: ${e instanceof Error?e.message:String(e)}`),process.exitCode=e instanceof d?2:3});export{O as main};
|
package/llms.txt
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# go-tokenless
|
|
2
|
+
|
|
3
|
+
> CLI and MCP server (`npx go-tokenless`) that migrates npm publishing in GitHub Actions from stored tokens (NPM_TOKEN, NODE_AUTH_TOKEN) to npm trusted publishing (OIDC). It edits only the lines that need changing in `.github/workflows/*.yml` and `package.json`: removes token env vars and `.npmrc` token lines, adds `permissions: id-token: write`, makes sure npm is 11.5.1+ (Node 24, or an `npm install -g npm@^12` step pinned to one major), sets setup-node `registry-url`, updates JS-DevTools/npm-publish to v4, and fixes `repository.url`. It prints the `npm trust github` command for each package and the steps that need the user's npm 2FA. It never touches the npm account, git history or secrets.
|
|
4
|
+
|
|
5
|
+
Use it when a user wants to remove an npm token from CI, set up trusted publishing / OIDC / provenance for npm, fix `npm publish` errors ENEEDAUTH, E404 or E422 (repository.url) in GitHub Actions, or prepare for npm removing direct token publishing in January 2027.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
- `npx -y go-tokenless` (plan, read-only; add `--json` for machine output with `status`, `changes`, `diff`, `findings`, `trust`, `nextSteps`)
|
|
10
|
+
- `npx -y go-tokenless apply` (write the changes)
|
|
11
|
+
- `npx -y go-tokenless mcp` (MCP server over stdio; tools `plan_trusted_publishing`, `apply_trusted_publishing`, input `{ path, repo?, offline?, npmVersion?, npmArgs?, readToken? }`)
|
|
12
|
+
- `--npm-version <range>` overrides the npm installed by the upgrade step (default `^12`; other versions trigger a warning, below 11.5.1 is refused). `--npm-args "<args>"` appends extra arguments to every generated npm command. `--read-token <SECRET>` gives install steps (`npm ci`, `pnpm install`, ...) a read-only `NODE_AUTH_TOKEN` from that secret for private org packages, while publish steps stay tokenless.
|
|
13
|
+
|
|
14
|
+
Exit codes: 0 ok, 1 blocked (errors need a human), 2 usage error, 3 unexpected error.
|
|
15
|
+
|
|
16
|
+
## Status values
|
|
17
|
+
|
|
18
|
+
- `ready`: changes available
|
|
19
|
+
- `applied`: files written; `nextSteps` remain
|
|
20
|
+
- `already-tokenless`: nothing to change
|
|
21
|
+
- `no-publish-workflow`: nothing publishes to npm from GitHub Actions
|
|
22
|
+
- `blocked`: a human must decide; nothing is written. Causes: a publish job reachable by untrusted triggers (pull_request_target, issue_comment, workflow_run), a self-hosted runner, repository.url pointing at another repo, YAML anchors, or a token passed to a job whose publish command can't be found (`publish-not-found`)
|
|
23
|
+
|
|
24
|
+
## Supported
|
|
25
|
+
|
|
26
|
+
npm publish, pnpm publish, Yarn Berry `yarn npm publish` (4.10.3+), changesets/action, semantic-release (@semantic-release/npm 13.1.0+), release-please + npm publish, Lerna 9+, Nx release, JS-DevTools/npm-publish, release-it (needs `npm.skipChecks: true`), reusable workflows. `bun publish` and Yarn 1 `yarn publish` are flagged (not supported by those tools).
|
|
27
|
+
|
|
28
|
+
## Docs
|
|
29
|
+
|
|
30
|
+
- README: https://github.com/Continuous-Actions/go-tokenless#readme
|
|
31
|
+
- Agent Skill: https://github.com/Continuous-Actions/go-tokenless/blob/main/skills/go-tokenless/SKILL.md
|
|
32
|
+
- npm trusted publishing: https://docs.npmjs.com/trusted-publishers
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "go-tokenless",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Switch npm publishing in GitHub Actions from NPM_TOKEN to trusted publishing (OIDC) with one command. CLI, MCP server and Agent Skill.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.14"
|
|
9
|
+
},
|
|
10
|
+
"bin": "dist/cli.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"server.json",
|
|
13
|
+
"dist",
|
|
14
|
+
"skills",
|
|
15
|
+
"llms.txt"
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Continuous-Actions/go-tokenless.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/Continuous-Actions/go-tokenless#readme",
|
|
22
|
+
"bugs": "https://github.com/Continuous-Actions/go-tokenless/issues",
|
|
23
|
+
"mcpName": "io.github.Continuous-Actions/go-tokenless",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "node scripts/build.mjs",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"check": "tsc -p tsconfig.json && node scripts/build.mjs && vitest run"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@modelcontextprotocol/server": "2.1.0",
|
|
32
|
+
"@types/node": "24.19.1",
|
|
33
|
+
"esbuild": "0.28.2",
|
|
34
|
+
"fast-check": "4.10.2",
|
|
35
|
+
"typescript": "7.0.2",
|
|
36
|
+
"vite": "8.3.2",
|
|
37
|
+
"vitest": "5.0.3",
|
|
38
|
+
"yaml": "2.9.1",
|
|
39
|
+
"zod": "4.6.5"
|
|
40
|
+
},
|
|
41
|
+
"packageManager": "yarn@4.18.1",
|
|
42
|
+
"keywords": [
|
|
43
|
+
"npm",
|
|
44
|
+
"trusted-publishing",
|
|
45
|
+
"oidc",
|
|
46
|
+
"npm-token",
|
|
47
|
+
"provenance",
|
|
48
|
+
"github-actions",
|
|
49
|
+
"publish",
|
|
50
|
+
"release",
|
|
51
|
+
"changesets",
|
|
52
|
+
"semantic-release",
|
|
53
|
+
"mcp",
|
|
54
|
+
"agent-skill"
|
|
55
|
+
]
|
|
56
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.Continuous-Actions/go-tokenless",
|
|
4
|
+
"title": "go-tokenless",
|
|
5
|
+
"description": "Move npm publishing in GitHub Actions from NPM_TOKEN to trusted publishing (OIDC).",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/Continuous-Actions/go-tokenless",
|
|
8
|
+
"source": "github"
|
|
9
|
+
},
|
|
10
|
+
"version": "1.0.0",
|
|
11
|
+
"packages": [
|
|
12
|
+
{
|
|
13
|
+
"registryType": "npm",
|
|
14
|
+
"identifier": "go-tokenless",
|
|
15
|
+
"version": "1.0.0",
|
|
16
|
+
"transport": { "type": "stdio" },
|
|
17
|
+
"packageArguments": [{ "type": "positional", "value": "mcp" }]
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: go-tokenless
|
|
3
|
+
description: Migrate npm publishing in GitHub Actions from NPM_TOKEN / NODE_AUTH_TOKEN secrets to npm trusted publishing (OIDC, provenance). Use when the user wants to remove or rotate an npm token, set up npm trusted publishing or OIDC, fix ENEEDAUTH / 404 / E422 errors from `npm publish` in CI, prepare for npm's January 2027 removal of token publishing, or asks to make releases more secure. Works with npm, pnpm, Yarn Berry, changesets, semantic-release, release-please, Lerna, Nx and JS-DevTools/npm-publish.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Move npm publishing to trusted publishing with go-tokenless
|
|
7
|
+
|
|
8
|
+
1. **Plan (writes nothing):** run from the repository root:
|
|
9
|
+
`npx -y go-tokenless --json`
|
|
10
|
+
Read `status`:
|
|
11
|
+
- `ready`: changes are listed in `changes` and `diff`.
|
|
12
|
+
- `already-tokenless`: nothing to change; see `nextSteps`.
|
|
13
|
+
- `no-publish-workflow`: no workflow publishes to npm. Stop.
|
|
14
|
+
- `blocked`: `findings` with `level: "error"` must be fixed first. Examples: `untrusted-trigger` (publishing from pull_request_target/issue_comment/workflow_run), `self-hosted-runner`, `repository-mismatch`, `yaml-anchors`, `publish-not-found`. Nothing was written. Explain them to the user; never work around `untrusted-trigger` by granting `id-token: write` yourself.
|
|
15
|
+
2. **Apply:** `npx -y go-tokenless apply`. It edits only the needed lines in `.github/workflows/*.yml` and `package.json` files. Show the user the diff (`git diff`) and commit on a branch.
|
|
16
|
+
3. **Hand the user the remaining steps from `nextSteps` verbatim.** They need the user's npm account with 2FA, so never try to do them yourself:
|
|
17
|
+
- run each `trust[].command` (`npm trust github <pkg> --repo <owner/repo> --file <workflow.yml> --allow-publish --yes`), or use npmjs.com → package → Settings → Trusted publishing;
|
|
18
|
+
- packages with `published: false` must be published once by hand first;
|
|
19
|
+
- after the first successful release, `gh secret delete <name>` for the secrets listed and revoke the token on npmjs.com.
|
|
20
|
+
4. Surface every `warning` finding to the user (for example tool versions that are too old, `bun publish`, or a reusable workflow whose caller needs `id-token: write`).
|
|
21
|
+
|
|
22
|
+
Rules:
|
|
23
|
+
- Don't leave or add `NODE_AUTH_TOKEN` on publish steps: npm falls back to a configured token, so the old token stays in use and can't be deleted.
|
|
24
|
+
- Trusted publishing works only on GitHub-hosted runners and needs npm 11.5.1+ (Node 24 ships it). The inserted upgrade step is pinned to `npm@^12`; only pass `--npm-version` if the user asks, and relay the warning it produces. Use `--npm-args "<args>"` for extra npm flags such as a registry mirror.
|
|
25
|
+
- If installs need private packages from the user's npm org, add `--read-token NPM_READ_TOKEN` (any secret name). Install steps get a read-only token; publish steps stay tokenless. Tell the user to create a read-only granular token and `gh secret set` it.
|
|
26
|
+
- An MCP server is available as `npx -y go-tokenless mcp` with tools `plan_trusted_publishing` and `apply_trusted_publishing` (argument `path`: absolute repo root).
|