go-tokenless 0.1.0 → 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/README.md +107 -69
- package/dist/chunks/chunk-NBTQMDVT.js +175 -0
- package/dist/chunks/{mcp-MGGBVTDL.js → mcp-LB3P2FNE.js} +8 -8
- package/dist/cli.js +7 -4
- package/llms.txt +4 -4
- package/package.json +2 -1
- package/server.json +2 -2
- package/skills/go-tokenless/SKILL.md +3 -2
- package/dist/chunks/chunk-222RNRMY.js +0 -164
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// go-tokenless (MIT) https://github.com/Continuous-Actions/go-tokenless. Generated file, do not edit.
|
|
3
3
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
4
|
-
import{b as
|
|
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
5
|
|
|
6
6
|
Usage:
|
|
7
7
|
npx go-tokenless [plan] Show what would change (default; writes nothing)
|
|
@@ -17,6 +17,9 @@ Options:
|
|
|
17
17
|
--npm-version <range>
|
|
18
18
|
npm version for the inserted upgrade step (default ^12).
|
|
19
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.
|
|
20
23
|
--npm-args "<args>"
|
|
21
24
|
Extra arguments added to every npm command it generates
|
|
22
25
|
(the upgrade step and the npm trust commands), e.g. "--registry=https://registry.npmjs.org"
|
|
@@ -24,8 +27,8 @@ Options:
|
|
|
24
27
|
-v, --version Show the version
|
|
25
28
|
|
|
26
29
|
Exit codes: 0 ok, 1 blocked (errors to fix by hand), 2 usage error, 3 unexpected error.
|
|
27
|
-
Docs: https://github.com/Continuous-Actions/go-tokenless`;async function O(e){let
|
|
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]}
|
|
28
31
|
|
|
29
|
-
${
|
|
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}
|
|
30
33
|
|
|
31
|
-
${
|
|
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# go-tokenless
|
|
2
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
|
|
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
4
|
|
|
5
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
6
|
|
|
@@ -8,8 +8,8 @@ Use it when a user wants to remove an npm token from CI, set up trusted publishi
|
|
|
8
8
|
|
|
9
9
|
- `npx -y go-tokenless` (plan, read-only; add `--json` for machine output with `status`, `changes`, `diff`, `findings`, `trust`, `nextSteps`)
|
|
10
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? }`)
|
|
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.
|
|
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
13
|
|
|
14
14
|
Exit codes: 0 ok, 1 blocked (errors need a human), 2 usage error, 3 unexpected error.
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ Exit codes: 0 ok, 1 blocked (errors need a human), 2 usage error, 3 unexpected e
|
|
|
19
19
|
- `applied`: files written; `nextSteps` remain
|
|
20
20
|
- `already-tokenless`: nothing to change
|
|
21
21
|
- `no-publish-workflow`: nothing publishes to npm from GitHub Actions
|
|
22
|
-
- `blocked`:
|
|
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
23
|
|
|
24
24
|
## Supported
|
|
25
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "go-tokenless",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
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
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@modelcontextprotocol/server": "2.1.0",
|
|
32
32
|
"@types/node": "24.19.1",
|
|
33
33
|
"esbuild": "0.28.2",
|
|
34
|
+
"fast-check": "4.10.2",
|
|
34
35
|
"typescript": "7.0.2",
|
|
35
36
|
"vite": "8.3.2",
|
|
36
37
|
"vitest": "5.0.3",
|
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"url": "https://github.com/Continuous-Actions/go-tokenless",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "
|
|
10
|
+
"version": "1.0.0",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "go-tokenless",
|
|
15
|
-
"version": "
|
|
15
|
+
"version": "1.0.0",
|
|
16
16
|
"transport": { "type": "stdio" },
|
|
17
17
|
"packageArguments": [{ "type": "positional", "value": "mcp" }]
|
|
18
18
|
}
|
|
@@ -11,7 +11,7 @@ description: Migrate npm publishing in GitHub Actions from NPM_TOKEN / NODE_AUTH
|
|
|
11
11
|
- `ready`: changes are listed in `changes` and `diff`.
|
|
12
12
|
- `already-tokenless`: nothing to change; see `nextSteps`.
|
|
13
13
|
- `no-publish-workflow`: no workflow publishes to npm. Stop.
|
|
14
|
-
- `blocked`: `findings` with `level: "error"` must be fixed first (self-hosted
|
|
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
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
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
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;
|
|
@@ -20,6 +20,7 @@ description: Migrate npm publishing in GitHub Actions from NPM_TOKEN / NODE_AUTH
|
|
|
20
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
21
|
|
|
22
22
|
Rules:
|
|
23
|
-
- Don't
|
|
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
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.
|
|
25
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).
|