Compare commits

Author SHA1 Message Date
chrnx 5e9ca2678b test(rate-limit): give peers on different addresses separate budgets on every runtime
CI / dco (pull_request) Successful in 3s
CI / build (pull_request) Successful in 13s
CI / runtimes (bun) (pull_request) Failing after 10s
CI / runtimes (edge) (pull_request) Successful in 7s
CI / runtimes (deno) (pull_request) Failing after 8s
The default keyOf buckets callers by ctx.ip. serveDeno and serveBun left ctx.ip empty until
core #116 (merged in core #117), so every caller on those runtimes shared the 'unknown' bucket
and the first one to reach max locked out everybody else.

This drives the plugin's default keyOf over a real socket: one dual-stack listener, client A over
127.0.0.1 and client B over ::1, max: 1. A's second request must be 429 and B's first 200, with two
distinct ctx.ip values. Node's listen() path runs the same test as the control and passes on any
core; on Deno and Bun it passes only on a core that carries #116, and fails on 26.9.0-beta.2.
Hosts without an IPv6 loopback fall back to 127.0.0.1 and 127.0.0.2, which only Linux routes.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-10-10 11:57:43 -05:00
chrnx c87dccedd0 Merge pull request 'fix(ci): install bun in the release workflow' (#11) from fix/release-needs-bun into develop
CI / dco (pull_request) Successful in 5s
CI / runtimes (bun) (pull_request) Successful in 12s
CI / dco (push) Has been skipped
CI / build (pull_request) Successful in 13s
CI / runtimes (edge) (pull_request) Successful in 8s
CI / runtimes (deno) (pull_request) Successful in 12s
CI / runtimes (bun) (push) Successful in 10s
CI / runtimes (deno) (push) Successful in 10s
CI / runtimes (edge) (push) Successful in 9s
CI / build (push) Successful in 15s
Promote → GitHub / push-github (push) Successful in 6s
2026-09-23 17:53:05 +00:00
chrnx fc495fa3cb fix(ci): install bun in the release workflow
CI / dco (pull_request) Successful in 4s
CI / build (pull_request) Successful in 14s
CI / runtimes (deno) (pull_request) Successful in 10s
CI / runtimes (bun) (pull_request) Successful in 10s
CI / runtimes (edge) (pull_request) Successful in 9s
`release.yml` runs `npm run test:bun` but never installed bun. `ci.yml` gets
away with one setup action per matrix entry; the release job runs every suite in
the same job, so it needs both.

Leaving it out does not skip the suite. `scripts/run-runtime.mjs` spawns `bun`,
gets `ENOENT`, and `process.exit(status ?? 1)` turns a missing binary into a
failure — verified: `spawnSync` on a missing command returns `status: null`,
which that expression maps to 1.

Nothing would have been published, since the gates run before the publish. What
it would have cost is a tag sitting on GitHub with no release against it, which
has to be deleted before the same tag can be tried again.

Found during the pre-flight for the first tag, by checking which tools the steps
use against which ones the job installs, rather than by pushing the tag and
reading the failure.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-09-23 12:52:21 -05:00
chrnx 1f3a42e747 Merge pull request 'ci: publish to JSR from a dated tag, and close the changelogs' (#9) from ci/release-to-jsr into develop
CI / dco (pull_request) Successful in 5s
CI / build (pull_request) Successful in 12s
CI / runtimes (bun) (pull_request) Successful in 13s
CI / runtimes (deno) (pull_request) Successful in 12s
CI / build (push) Successful in 14s
CI / runtimes (edge) (push) Successful in 10s
Promote → GitHub / push-github (push) Successful in 5s
CI / runtimes (edge) (pull_request) Successful in 9s
CI / dco (push) Has been skipped
CI / runtimes (bun) (push) Successful in 10s
CI / runtimes (deno) (push) Successful in 10s
2026-09-23 17:35:33 +00:00
chrnx d5e8c8a827 fix(ci): stop a failed publish from reporting as a successful release
CI / runtimes (edge) (pull_request) Successful in 7s
CI / dco (pull_request) Successful in 4s
CI / build (pull_request) Successful in 14s
CI / runtimes (bun) (pull_request) Successful in 9s
CI / runtimes (deno) (pull_request) Successful in 12s
Two bugs in one line, both silent, both found in review before anything shipped.

**The pipe swallowed the exit status.** `deno publish | tee` reports the status
of the last command in the pipeline, and that is `tee`, which always succeeds.
GitHub's default shell is `bash -e` *without* `pipefail`, so a failed publish
would have been a green step — and the workflow would have gone on to cut a
GitHub release for it. Demonstrated rather than assumed:

    bash -e   -c 'false | tee /dev/null'  -> exit 0
    bash -eo pipefail -c 'false | tee /dev/null'  -> exit 1

Naming `shell: bash` gets `-eo pipefail`.

**And the log was going to be empty anyway.** deno's logger is env_logger,
whose default target is stderr, so the `Successfully published` lines never
reach stdout. Measured against a real `deno publish`: 0 lines on stdout, all of
them on stderr. So `--notes` would have found nothing and announced that nothing
shipped, on every successful release. `2>&1` fixes it.

The second bug is the reason for the third change: `--notes` now refuses a log
carrying neither marker instead of reporting it as "nothing was published". A log
this script cannot read and a release where nothing shipped are indistinguishable
from the text, and guessing wrong is silent in the direction that matters. Now it
fails and says to check the redirect and the pipeline.

Verified all three paths: an empty log exits 1, an all-skipped log renders the
"already on JSR" line and exits 0, and a real publish log renders per-package
sections.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-09-23 12:34:30 -05:00
chrnx 32baf0c592 ci: publish to JSR from a dated tag, and close the changelogs
CI / build (pull_request) Successful in 15s
CI / runtimes (edge) (pull_request) Successful in 8s
CI / dco (pull_request) Successful in 4s
CI / runtimes (bun) (pull_request) Successful in 10s
CI / runtimes (deno) (pull_request) Successful in 12s
Adds the release workflow and the script it leans on, plus the `[Unreleased]`
sections these three packages have carried since they were written.

**The tag is a date, not a version.** `release-26.9.23` says when; the release
body says what moved. A version-shaped tag would be a lie here — three packages
carry three independent versions, so `plugins-v26.9.0` would match none of them
and invite being read as `@green-tea/jwt@26.9.0`.

**Tag-driven, not push-driven.** JSR's own setup page offers an example that
publishes on every push to `main`. For this repository that means every
promotion publishes, and a JSR version can never be replaced or removed, so one
distracted merge would burn a version number permanently. A tag is a decision; a
merge is not.

**Publishing all three at once is safe, and that is measured rather than
assumed.** `deno publish` queries the registry per package and drops the ones
already there (`filter_out_published_packages` in denoland/deno,
cli/tools/publish/mod.rs); skipping logs a warning, and a workspace with nothing
left to do exits 0 with "All packages are already published". So a tag cut after
changing one package publishes that one and leaves the others alone, with no
per-package logic here.

`scripts/release.mjs --check` runs **before** the publish and refuses when a
version about to ship has no changelog entry. That ordering is the point: core's
equivalent runs after npm and JSR have already published, so a missing heading
fails a release that has already shipped. Worth not inheriting.

`--notes` builds the release body from what `deno publish` actually reported
rather than from a prediction of it — predicting means duplicating Deno's
filtering and being wrong about it silently.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-09-23 12:30:18 -05:00
6 changed files with 378 additions and 3 deletions

No files matched your search

+98
View File
@@ -0,0 +1,98 @@
name: Release → JSR
# Publishes the workspace to JSR. Runs on GITHUB ONLY, on a `release-*` tag.
#
# **The tag is a date, not a version.** `release-26.9.23` says when, and the release body says what
# moved. A version-shaped tag would be a lie here: three packages carry three independent versions,
# so `plugins-v26.9.0` would match none of them and invite exactly the confusion of reading it as
# `@green-tea/jwt@26.9.0`.
#
# Tag-driven rather than push-driven, unlike the example JSR's own setup page offers. That example
# publishes on every push to `main`, which for this repository means every promotion publishes — and
# a JSR version can never be replaced or removed, so a distracted merge would burn a version number
# forever. A tag is a decision; a merge is not.
#
# Publishing all three at once is safe, and this is the fact the whole design rests on: `deno publish`
# queries the registry per package and drops the ones already there, logging
# `Warning: Skipping, already published` for each. If every version is already published it prints
# `Success: All packages are already published` and exits 0. So a tag cut after changing one package
# publishes that one and leaves the others alone, with no per-package logic here.
# (denoland/deno, cli/tools/publish/mod.rs — `filter_out_published_packages`.)
on:
push:
tags: ['release-*']
jobs:
publish:
if: ${{ github.server_url == 'https://github.com' }}
runs-on: ubuntu-latest
permissions:
id-token: write # OIDC — this is what publishes, and what earns provenance
contents: write # create the GitHub release for this tag
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
- uses: denoland/setup-deno@v2
with:
deno-version: v2.x
# Both runtimes, because the gates below run both suites. `ci.yml` installs these one per
# matrix entry; here every suite runs in the same job, so both have to be present. Leaving
# bun out does not skip its suite — `scripts/run-runtime.mjs` spawns `bun`, gets ENOENT, and
# `process.exit(status ?? 1)` turns that into a failure that aborts the release.
- uses: oven-sh/setup-bun@v2
- run: npm ci
# The same gates CI runs. They ran on `main` already, and they run again here because this is
# the last moment they can still change the outcome: after the publish there is no amending a
# version, only publishing another one.
- run: npm run lint
- run: npm run format:check
- run: npm run typecheck
- run: npm run complexity:check
- run: npm test
- run: npm run test:deno
- run: npm run test:bun
- run: npm run test:edge
# Before the publish, on purpose. This reports which versions the tag would ship and refuses
# when one has no CHANGELOG entry — a package whose own changelog says it was never released
# is not something to discover afterwards, because afterwards is permanent.
- name: Every version about to ship has a changelog entry
run: node scripts/release.mjs --check
# JSR checks things no other gate does — slow types, module analysis — and learning about them
# mid-publish leaves a tag half-shipped.
- run: deno publish --dry-run
# No token: OIDC exchanges the workflow's id-token, which is also what attaches provenance.
# `tee` because the release body is built from what this actually did rather than from a guess
# about what it would do.
#
# Two details in this one line, both of which produce a *silently wrong* release when missed:
#
# `shell: bash` — the default shell here is `bash -e`, without `pipefail`, so a pipeline
# reports the exit status of its LAST command. That is `tee`, which always
# succeeds. A failed publish would have been reported as a green step, and
# a GitHub release created for it. Naming the shell gets `-eo pipefail`.
#
# `2>&1` — deno's logger is env_logger, whose default target is stderr, so every
# "Successfully published" line goes there. Measured: a publish writes 0
# lines to stdout and all of them to stderr. Without this the log is empty
# and the release notes say nothing shipped while three packages did.
- name: Publish
shell: bash
run: deno publish 2>&1 | tee /tmp/publish.log
- name: Release notes
run: node scripts/release.mjs --notes /tmp/publish.log "$GITHUB_REF_NAME" > /tmp/notes.md
- name: GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes-file /tmp/notes.md \
--prerelease
+3 -1
View File
@@ -1,9 +1,11 @@
# Changelog # Changelog
## [Unreleased] ## [26.9.0-beta.0] - 2026-09-23
### Added ### Added
- `jwt({ keys, provides? })`: loads each JWK file while providers boot and publishes a `JwtRegistry` - `jwt({ keys, provides? })`: loads each JWK file while providers boot and publishes a `JwtRegistry`
under `provides` (default `jwt`). `Signer` signs with `iat` and a random `jti`, and verifies issuer under `provides` (default `jwt`). `Signer` signs with `iat` and a random `jti`, and verifies issuer
and audience. `JwtRegistry.publicJwk(name)` returns a key's public half for a JWKS endpoint. and audience. `JwtRegistry.publicJwk(name)` returns a key's public half for a JWKS endpoint.
[26.9.0-beta.0]: https://jsr.io/@green-tea/jwt@26.9.0-beta.0
+3 -1
View File
@@ -1,6 +1,6 @@
# Changelog # Changelog
## [Unreleased] ## [26.9.0-beta.0] - 2026-09-23
### Added ### Added
@@ -8,3 +8,5 @@
`render()`. Counts `request:end` as requests and `request:failed` separately, labelled on the `render()`. Counts `request:end` as requests and `request:failed` separately, labelled on the
bounded `route` rather than on the caller-controlled `name`. `prometheus` is a `TransformerFn` for bounded `route` rather than on the caller-controlled `name`. `prometheus` is a `TransformerFn` for
serving `render()` from a route the application owns. Closes green-tea#68. serving `render()` from a route the application owns. Closes green-tea#68.
[26.9.0-beta.0]: https://jsr.io/@green-tea/metrics@26.9.0-beta.0
+3 -1
View File
@@ -1,6 +1,6 @@
# Changelog # Changelog
## [Unreleased] ## [26.9.0-beta.0] - 2026-09-23
### Added ### Added
@@ -8,3 +8,5 @@
(default `rateLimit`). Exceeding a rule throws `TooManyRequests`, a branded 429 carrying (default `rateLimit`). Exceeding a rule throws `TooManyRequests`, a branded 429 carrying
`Retry-After`. The default `MemoryStore` sweeps expired windows on an interval and is released by `Retry-After`. The default `MemoryStore` sweeps expired windows on an interval and is released by
the plugin's `onShutdown`. the plugin's `onShutdown`.
[26.9.0-beta.0]: https://jsr.io/@green-tea/rate-limit@26.9.0-beta.0
+123
View File
@@ -0,0 +1,123 @@
// The default `keyOf` buckets callers by `ctx.ip`, so it is only as good as the address the serving
// path hands it. Node's `listen()` has always filled `ctx.ip` from the socket. `serveDeno` and
// `serveBun` left it as `''` until core #116 (merged in core #117), which put every caller in the
// one `'unknown'` bucket: the first client to reach `max` locked out everybody else.
//
// So this runs over a real socket on each runtime, with the plugin's default `keyOf`, rather than
// through `app.fetch` with a hand-written one — `app.fetch` has no peer, and a custom `keyOf` would
// test the test. Two clients reach one dual-stack listener, one over IPv4 and one over IPv6, which is
// the cheapest way to get two distinct peer addresses on one host.
//
// Against a core without #116 the Deno and Bun runs fail here, on purpose. Node is the control: its
// path never had the bug and must stay green.
import { strict as assert } from 'node:assert';
import { createServer } from 'node:net';
import type { AddressInfo } from 'node:net';
import { test } from 'node:test';
import { createApp, ctx, Get, Module, needs, Route } from '@green-tea/core';
import type { App } from '@green-tea/core';
import { rateLimit } from '../src/index.ts';
import type { RateLimiter } from '../src/index.ts';
@Route('/')
class Probe {
@Get('/probe')
async probe(@needs('rateLimit') limit: RateLimiter, @ctx() context: { ip?: string }) {
await limit('signin');
return { ip: context.ip };
}
}
@Module({ mountpoint: '/', controllers: [Probe] })
class ProbeModule {}
/** A running server, whichever helper started it. */
interface Served {
port: number;
close(): Promise<void>;
}
interface RuntimeGlobals {
Deno?: unknown;
Bun?: unknown;
}
/**
* Serves `app` on `hostname` through the helper this runtime actually uses in production.
*
* The adapters are imported lazily because each one only works on its own runtime. Node takes no
* hostname: `listen(port)` binds the unspecified address, which is dual-stack wherever IPv6 exists.
*/
async function serve(app: App, hostname: string): Promise<Served> {
const globals = globalThis as RuntimeGlobals;
if (globals.Deno) {
const { serveDeno } = await import('@green-tea/core/deno');
const server = await serveDeno(app, { hostname, port: 0, onListen: () => {} });
const { port } = (server as unknown as { addr: { port: number } }).addr;
return { port, close: () => server.close({ timeoutMs: 1_000 }) };
}
if (globals.Bun) {
const { serveBun } = await import('@green-tea/core/bun');
const server = await serveBun(app, { hostname, port: 0 });
return { port: server.port, close: () => server.close({ timeoutMs: 1_000 }) };
}
const server = await app.listen(0);
return { port: (server.address() as AddressInfo).port, close: () => app.close({ timeoutMs: 1_000 }) };
}
/** Whether this host can bind the IPv6 loopback at all; some CI containers cannot. */
function ipv6Available(): Promise<boolean> {
return new Promise((resolve) => {
const probe = createServer();
probe.once('error', () => resolve(false));
probe.listen(0, '::1', () => probe.close(() => resolve(true)));
});
}
test('two peers on different addresses get separate budgets on the real serving path', async (t) => {
// Without IPv6, the fallback is two IPv4 loopback addresses. Every 127/8 address answers on Linux,
// which is what CI runs; macOS configures only 127.0.0.1, so there the fallback cannot connect.
const ipv6 = await ipv6Available();
const [hostname, a, b] = ipv6 ? ['::', '127.0.0.1', '[::1]'] : ['0.0.0.0', '127.0.0.1', '127.0.0.2'];
if (!ipv6) t.diagnostic('no IPv6 loopback: falling back to 127.0.0.1 and 127.0.0.2 (Linux only)');
const app = createApp({
modules: [ProbeModule],
plugins: [rateLimit({ rules: { signin: { windowMs: 60_000, max: 1, message: 'too many' } } })],
});
const server = await serve(app, hostname);
const hit = (host: string) => fetch(`http://${host}:${server.port}/probe`);
try {
const first = await hit(a);
assert.equal(first.status, 200);
const { ip: ipA } = (await first.json()) as { ip?: string };
assert.equal((await hit(a)).status, 429, 'client A was not limited at max: 1');
const other = await hit(b);
const body = (await other.text()) || '(empty body)';
// Checked before B's status so a regression names its cause: an empty `ctx.ip` is what folds both
// clients into one bucket, and the 429 that follows is only its symptom.
assert.ok(ipA, `ctx.ip was empty for client A on this serving path: ${JSON.stringify(ipA)}`);
assert.equal(other.status, 200, `client B shared client A's bucket (ctx.ip ${JSON.stringify(ipA)}): ${body}`);
const { ip: ipB } = JSON.parse(body) as { ip?: string };
assert.ok(ipB, 'ctx.ip was empty for client B');
assert.notEqual(ipA, ipB, 'both clients reported the same ctx.ip');
} finally {
await server.close();
}
});
+148
View File
@@ -0,0 +1,148 @@
#!/usr/bin/env node
// Two jobs around a `deno publish`, both about the same thing: a JSR version can never be replaced
// or removed, so anything wrong has to be caught *before* the publish rather than reported after it.
//
// --check Which packages this tag would publish, and whether each has a CHANGELOG entry
// to match. Exits non-zero when one does not. Run this BEFORE publishing.
// --notes <log> The GitHub release body, built from what `deno publish` actually did.
//
// The order matters and is the whole point of splitting it in two. core's equivalent script runs
// after npm and JSR have already published, so a missing heading fails a release that has already
// shipped — a wart worth not inheriting.
import { readFileSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
const ROOT = new URL('..', import.meta.url).pathname;
const PACKAGES = join(ROOT, 'packages');
const REPO = 'Expressive-Tea/green-tea-plugins';
/** Every workspace package, with the version its deno.json declares. */
function readPackages() {
return readdirSync(PACKAGES, { withFileTypes: true })
.filter((entry) => entry.isDirectory())
.map((entry) => {
const deno = JSON.parse(readFileSync(join(PACKAGES, entry.dir ?? entry.name, 'deno.json'), 'utf8'));
return { dir: entry.name, name: deno.name, version: deno.version };
});
}
/** Whether JSR already serves this exact version. A 404 for a package with no versions at all is
* not an error — it is what every one of these looks like until its first publish. */
async function isPublished({ name, version }) {
const [scope, pkg] = name.replace(/^@/, '').split('/');
const url = `https://api.jsr.io/scopes/${scope}/packages/${pkg}/versions/${version}`;
const response = await fetch(url, { headers: { accept: 'application/json' } });
if (response.status === 404) return false;
if (!response.ok) throw new Error(`${name}@${version}: ${url} answered ${response.status}`);
return true;
}
/** One version's section of a package CHANGELOG, heading excluded. */
function changelogSection(dir, version) {
const lines = readFileSync(join(PACKAGES, dir, 'CHANGELOG.md'), 'utf8').split('\n');
const start = lines.findIndex((line) => line.startsWith(`## [${version}]`));
if (start === -1) return null;
const rest = lines.slice(start + 1);
const end = rest.findIndex((line) => line.startsWith('## '));
return (end === -1 ? rest : rest.slice(0, end))
// Link reference definitions belong to the file, not to the entry. Nothing separates them from
// the last section, so without this they ride along into the release body as a stray line.
.filter((line) => !/^\[[^\]]+\]:\s/.test(line))
.join('\n')
.trim();
}
async function check() {
const packages = readPackages();
const published = await Promise.all(packages.map(isPublished));
const pending = packages.filter((_, i) => !published[i]);
if (pending.length === 0) {
console.log('Nothing to publish: every package version is already on JSR.');
return 0;
}
let missing = 0;
for (const pkg of pending) {
const section = changelogSection(pkg.dir, pkg.version);
if (section) {
console.log(` ok ${pkg.name}@${pkg.version}`);
} else {
// Deliberately an error rather than a warning. A version heading is a claim that the release
// exists, and publishing without one leaves a package on JSR that its own changelog says was
// never released — permanently, because the version cannot be replaced.
console.error(` MISSING ${pkg.name}@${pkg.version} has no "## [${pkg.version}]" in packages/${pkg.dir}/CHANGELOG.md`);
missing += 1;
}
}
packages
.filter((_, i) => published[i])
.forEach((pkg) => console.log(` skip ${pkg.name}@${pkg.version} (already on JSR)`));
return missing === 0 ? 0 : 1;
}
/** Parse what `deno publish` reported. Its own output is the only honest source for this: predicting
* it means duplicating the filtering Deno already did, and being wrong about it silently. */
function notes(logPath, tag) {
const log = readFileSync(logPath, 'utf8');
// Colour codes survive when a terminal is attached and vanish in CI. Strip either way.
const plain = log.replace(/\u001b\[[0-9;]*m/g, '');
const shipped = [...plain.matchAll(/Successfully published (@[^@\s]+\/[^@\s]+)@(\S+)/g)]
.map(([, name, version]) => ({ name, version }));
// A log carrying neither marker is not "nothing was published" — it is a log this script cannot
// read, and the two are indistinguishable from the text alone. Saying nothing shipped when three
// packages did is the worse failure, and it is silent, so refuse instead of guessing.
//
// This is not hypothetical: the first version of this workflow piped only stdout, while deno logs
// to stderr, so every successful release would have produced an empty log and a release body
// announcing that nothing happened.
if (shipped.length === 0 && !/already published/.test(plain)) {
throw new Error(
`${logPath} contains neither "Successfully published" nor "already published". ` +
'Either the publish did not run, or its output is not being captured — check that the step ' +
'redirects stderr (deno logs there) and that the pipeline uses pipefail.',
);
}
if (shipped.length === 0) {
return `No package versions were published by \`${tag}\` — every version in the workspace was already on JSR.`;
}
const byName = Object.fromEntries(readPackages().map((pkg) => [pkg.name, pkg.dir]));
const body = shipped.map(({ name, version }) => {
const dir = byName[name];
const section = (dir && changelogSection(dir, version)) || '_No changelog entry._';
const link = `https://github.com/${REPO}/blob/${tag}/packages/${dir}/CHANGELOG.md`;
return `## [${name}@${version}](https://jsr.io/${name}@${version})\n\n${section}\n\n[Full changelog](${link})`;
});
const untouched = readPackages().filter((pkg) => !shipped.some((s) => s.name === pkg.name));
const footer = untouched.length
? `\n\n---\n\nUnchanged in this release: ${untouched.map((p) => `\`${p.name}@${p.version}\``).join(', ')}.`
: '';
return `${body.join('\n\n')}${footer}`;
}
const [mode, arg] = process.argv.slice(2);
if (mode === '--check') {
process.exit(await check());
} else if (mode === '--notes') {
if (!arg) {
console.error('usage: release.mjs --notes <publish-log> [tag]');
process.exit(2);
}
console.log(notes(arg, process.argv[4] ?? 'main'));
} else {
console.error('usage: release.mjs --check | --notes <publish-log> [tag]');
process.exit(2);
}