name: release-typescript description: Release the @freenetorg/freenet-stdlib npm package. Use when the user says "release the typescript package", "publish stdlib to npm", "cut a typescript release", "bump and publish ts", "release ts sdk", or similar. Runs scripts/release-typescript-ver.sh end-to-end including version bump, build, publish, tag, and push.
Release @freenetorg/freenet-stdlib
Release the TypeScript SDK to npm. Package: @freenetorg/freenet-stdlib. Registry: npmjs.org. Publish requires 2FA OTP or access token.
Two release paths
Path A — CI (preferred)
- Bump
typescript/package.jsonversion. - PR → merge to main.
- Tag + push:
git tag -a typescript-v<version> -m "..." && git push origin typescript-v<version>. .github/workflows/release.ymlverifies tag matches package.json, builds, tests, packs, publishes viaNPM_TOKENsecret.
Path B — Local (fallback)
Use scripts/release-typescript-ver.sh. See sections below.
Inputs to gather before starting
Ask the user (only what is not already clear from the request):
- Version bump: major / minor / patch / explicit (e.g.
0.3.0). Default suggestion: minor if API additions, patch if fixes only. Show current version fromtypescript/package.jsonfirst. - OTP: 6-digit code from authenticator. Required for
npm publish. Ask right before publish, not at start (codes expire in ~30s). - Push tag after publish? Default yes.
Pre-flight checks
Run before touching anything:
git status— working tree must be clean.git rev-parse --abbrev-ref HEAD— confirm onmain(or ask user if branch is intentional).npm whoami— confirm logged in. If not, ask user to runnpm loginin their terminal (interactive, they must do it).npm view @freenetorg/freenet-stdlib@<new-version> version— must fail (version must not already exist).git tag -l "typescript-v<new-version>"— must be empty.
If any check fails, stop and surface the problem.
Bump + commit
- Edit
typescript/package.json— updateversionfield only. - Dry-run the release script to verify the tarball contents:
Expected: ~240+ files, all underbash scripts/release-typescript-ver.sh --dry-rundist/src/, nodist/tests/leakage. Size ~70-80 kB packed. If tests appear in tarball, stop —filesglobs in package.json broken. - Commit:
git add typescript/package.json git commit -m "chore(typescript): bump to <new-version>"
Publish
Two auth paths. Prefer token (non-interactive, no timer):
Token (preferred):
bash scripts/release-typescript-ver.sh --yes --token <npm_token>
Or set NPM_TOKEN env var and omit the flag. Token must have publish scope for the package and "bypass 2FA" enabled if org enforces 2FA.
OTP (interactive auth):
bash scripts/release-typescript-ver.sh --yes --otp <6-digit-code>
Ask user for OTP right before running — codes expire in ~30s.
Flags:
--yes— skip confirmation prompts (required under Bash tool)--token <tok>— npm access token; auth via temp userconfig (not written to$HOME/.npmrc)--otp <code>— 2FA code passed tonpm publish --otp
Never commit tokens. Never write token to .npmrc in repo. Script uses mktemp + trap to clean temp userconfig.
On 403 E2FA/EOTP: OTP expired or token lacks 2FA bypass. Retry with fresh value.
On success: script publishes, creates tag typescript-v<version>, prompts for push. With --yes it auto-pushes. If user wanted to skip push, add --skip-push and push manually later.
Post-publish verification
npm view @freenetorg/freenet-stdlib version— should show new version.git log -1 --format=%H+git tag --points-at HEAD— tag should point at bump commit.git push origin main— push the bump commit itself (tag push is separate from branch push).
Script reference
scripts/release-typescript-ver.sh flags:
--dry-run— build + pack preview only--yes/-y— non-interactive (required when invoked via Bash tool)--otp <code>— npm 2FA code--token <tok>— npm access token (also readsNPM_TOKENenv var)--skip-push— local tag only--skip-tests— skipnpm test(use when tests just ran)
Common failures
- Dirty working tree: commit or stash first.
- Tag exists: version already released. Bump again.
- npm 403 E2FA: OTP missing/expired. Pass fresh
--otp. - npm 403 EOTP: same, fresh OTP.
- Test failures in CI but not locally:
npm testusesmock-socket+ws; checktests/websocket-interface.test.tsif WebSocket flakes. - Tarball has
dist/tests/:filesglobs inpackage.jsontoo broad; must bedist/src/**notdist/**.
Do not
- Never amend the bump commit after tagging — tag would point at orphaned SHA.
- Never
npm unpublish— blocked by npm after 72h and bad practice. If a bad version ships, publish a patch. - Never run with
--yeswithout user confirmation on version + OTP. - Never pipe OTP into stdin of
npm publish; use--otpflag.