From dbb996dd4ce21a1164b34f7b06f61afff2ee8576 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 2 Aug 2026 22:38:47 -0500 Subject: [PATCH 1/4] fix(package): declare npm publication metadata Link the package to its public source, issue tracker, and documentation so npm Trusted Publishing can validate provenance and consumers receive canonical project links. Signed-off-by: Diego Resendez --- package.json | 8 ++++++++ test/package-metadata.test.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 test/package-metadata.test.ts diff --git a/package.json b/package.json index c9e3eaa..6c0b28d 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,14 @@ "description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.", "license": "MIT", "author": "green-tea contributors", + "repository": { + "type": "git", + "url": "git+https://github.com/Expressive-Tea/green-tea.git" + }, + "bugs": { + "url": "https://github.com/Expressive-Tea/green-tea/issues" + }, + "homepage": "https://green-tea.expressive-tea.io/docs/", "keywords": [ "http", "framework", diff --git a/test/package-metadata.test.ts b/test/package-metadata.test.ts new file mode 100644 index 0000000..6790f86 --- /dev/null +++ b/test/package-metadata.test.ts @@ -0,0 +1,33 @@ +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; + +import { describe, expect, it } from 'vitest'; + +interface PackageMetadata { + readonly repository?: { + readonly type?: string; + readonly url?: string; + }; + readonly bugs?: { + readonly url?: string; + }; + readonly homepage?: string; +} + +const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as PackageMetadata; + +describe('package publication metadata', () => { + it('links npm provenance to the public GitHub repository', () => { + expect(packageJson.repository).toEqual({ + type: 'git', + url: 'git+https://github.com/Expressive-Tea/green-tea.git', + }); + }); + + it('links npm consumers to support and documentation', () => { + expect(packageJson.bugs).toEqual({ + url: 'https://github.com/Expressive-Tea/green-tea/issues', + }); + expect(packageJson.homepage).toBe('https://green-tea.expressive-tea.io/docs/'); + }); +}); From 29aafde84c870c6f77a2857de20dbe699ca5a257 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 2 Aug 2026 22:38:56 -0500 Subject: [PATCH 2/4] fix(ci): make Verdaccio staging idempotent Stage only release branches and preserve immutable versions. Repeated identical candidates now exit successfully, while content changes under an existing version require a prerelease bump. Signed-off-by: Diego Resendez --- .github/workflows/stage.yml | 36 +++++++++++++++++++++++----------- scripts/staging-integrity.ts | 13 ++++++++++++ test/staging-integrity.test.ts | 19 ++++++++++++++++++ test/staging-workflow.test.ts | 17 ++++++++++++++++ 4 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 scripts/staging-integrity.ts create mode 100644 test/staging-integrity.test.ts create mode 100644 test/staging-workflow.test.ts diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index e3d2c15..792f854 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -1,13 +1,12 @@ name: Stage → Verdaccio -# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub), on every merge -# to main. Publishes the package as-is — version comes from package.json (a prerelease -# like 26.7.1-beta.N) — to the internal Verdaccio under the `stg` dist-tag. This registry -# rejects overwriting an existing version, so the step unpublishes it first (a no-op on the -# first publish) then publishes fresh. +# Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub) for release +# branches. Publishes prereleases to the internal Verdaccio under the `stg` dist-tag. +# Existing versions are skipped only when the packed contents are identical; changed +# contents under an existing version fail and require a prerelease bump. on: push: - branches: [main] + branches: ['release/**'] jobs: publish-stg: @@ -19,13 +18,28 @@ jobs: with: node-version: '22' - run: npm ci - # `npm publish` runs prepublishOnly (lint + complexity + typecheck + test + build) - # as its own gate before anything leaves the machine. - - name: Publish to Verdaccio (unpublish + publish) + - run: npm audit + - name: Validate release candidate + run: npm run prepublishOnly + - name: Publish prerelease to Verdaccio env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH }} run: | npm config set //npm.svc.zoit.services/:_authToken "$NODE_AUTH_TOKEN" VER=$(node -p "require('./package.json').version") - npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true - npm publish --registry https://npm.svc.zoit.services --tag stg + case "$VER" in + *-*) ;; + *) echo "Refusing to stage non-prerelease version: $VER" >&2; exit 1 ;; + esac + + PACK_JSON=$(npm pack --json --dry-run --ignore-scripts) + LOCAL_INTEGRITY=$(node -e "let s='';process.stdin.on('data',d=>s+=d);process.stdin.on('end',()=>console.log(JSON.parse(s)[0].integrity))" <<< "$PACK_JSON") + EXISTING_INTEGRITY=$(npm view "@green-tea/core@$VER" dist.integrity --registry https://npm.svc.zoit.services 2>/dev/null || true) + ACTION=$(npx tsx scripts/staging-integrity.ts "$LOCAL_INTEGRITY" ${EXISTING_INTEGRITY:+"$EXISTING_INTEGRITY"}) + + if [ "$ACTION" = "skip" ]; then + echo "@green-tea/core@$VER is already staged with identical contents" + exit 0 + fi + + npm publish --ignore-scripts --registry https://npm.svc.zoit.services --tag stg diff --git a/scripts/staging-integrity.ts b/scripts/staging-integrity.ts new file mode 100644 index 0000000..e24199d --- /dev/null +++ b/scripts/staging-integrity.ts @@ -0,0 +1,13 @@ +export type StagingAction = 'publish' | 'skip'; + +export function decideStagingPublish(localIntegrity: string, existingIntegrity?: string): StagingAction { + if (existingIntegrity === undefined) return 'publish'; + if (existingIntegrity === localIntegrity) return 'skip'; + + throw new Error('Version already exists in Verdaccio with different contents'); +} + +if (require.main === module) { + const [, , localIntegrity, existingIntegrity] = process.argv; + console.log(decideStagingPublish(localIntegrity, existingIntegrity)); +} diff --git a/test/staging-integrity.test.ts b/test/staging-integrity.test.ts new file mode 100644 index 0000000..ea71f4c --- /dev/null +++ b/test/staging-integrity.test.ts @@ -0,0 +1,19 @@ +import { describe, expect, it } from 'vitest'; + +import { decideStagingPublish } from '../scripts/staging-integrity'; + +describe('decideStagingPublish', () => { + it('publishes a version that is not in Verdaccio', () => { + expect(decideStagingPublish('sha512-local')).toBe('publish'); + }); + + it('skips an existing version with identical package contents', () => { + expect(decideStagingPublish('sha512-local', 'sha512-local')).toBe('skip'); + }); + + it('rejects an existing version with different package contents', () => { + expect(() => decideStagingPublish('sha512-local', 'sha512-other')).toThrow( + 'Version already exists in Verdaccio with different contents', + ); + }); +}); diff --git a/test/staging-workflow.test.ts b/test/staging-workflow.test.ts new file mode 100644 index 0000000..3d2e4f4 --- /dev/null +++ b/test/staging-workflow.test.ts @@ -0,0 +1,17 @@ +import { readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; + +import { describe, expect, it } from 'vitest'; + +const workflow = readFileSync(resolve(process.cwd(), '.github/workflows/stage.yml'), 'utf8'); + +describe('Verdaccio staging workflow', () => { + it('publishes immutable prereleases only from release branches', () => { + expect(workflow).toContain("branches: ['release/**']"); + expect(workflow).toContain('npm audit'); + expect(workflow).toContain('npm run prepublishOnly'); + expect(workflow).toContain('scripts/staging-integrity.ts'); + expect(workflow).toContain('npm publish --ignore-scripts'); + expect(workflow).not.toContain('npm unpublish'); + }); +}); From 9398a5a2dfc04775b4d238039b451dfc510378c3 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Sun, 2 Aug 2026 22:42:39 -0500 Subject: [PATCH 3/4] fix(ci): keep Verdaccio staging mutable Replace an existing prerelease before publishing the refreshed candidate. Verdaccio remains mutable for validation while npmjs release versions stay immutable. Signed-off-by: Diego Resendez --- .github/workflows/stage.yml | 16 +++------------- scripts/staging-integrity.ts | 13 ------------- test/staging-integrity.test.ts | 19 ------------------- test/staging-workflow.test.ts | 6 +++--- 4 files changed, 6 insertions(+), 48 deletions(-) delete mode 100644 scripts/staging-integrity.ts delete mode 100644 test/staging-integrity.test.ts diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index 792f854..993ed1c 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -2,8 +2,8 @@ name: Stage → Verdaccio # Staging publish. Runs on GITEA ONLY (the `if` guards against GitHub) for release # branches. Publishes prereleases to the internal Verdaccio under the `stg` dist-tag. -# Existing versions are skipped only when the packed contents are identical; changed -# contents under an existing version fail and require a prerelease bump. +# Staging versions are intentionally mutable: an existing prerelease is removed before +# publishing the updated release candidate under the same version. on: push: branches: ['release/**'] @@ -31,15 +31,5 @@ jobs: *-*) ;; *) echo "Refusing to stage non-prerelease version: $VER" >&2; exit 1 ;; esac - - PACK_JSON=$(npm pack --json --dry-run --ignore-scripts) - LOCAL_INTEGRITY=$(node -e "let s='';process.stdin.on('data',d=>s+=d);process.stdin.on('end',()=>console.log(JSON.parse(s)[0].integrity))" <<< "$PACK_JSON") - EXISTING_INTEGRITY=$(npm view "@green-tea/core@$VER" dist.integrity --registry https://npm.svc.zoit.services 2>/dev/null || true) - ACTION=$(npx tsx scripts/staging-integrity.ts "$LOCAL_INTEGRITY" ${EXISTING_INTEGRITY:+"$EXISTING_INTEGRITY"}) - - if [ "$ACTION" = "skip" ]; then - echo "@green-tea/core@$VER is already staged with identical contents" - exit 0 - fi - + npm unpublish "@green-tea/core@$VER" --registry https://npm.svc.zoit.services --force 2>/dev/null || true npm publish --ignore-scripts --registry https://npm.svc.zoit.services --tag stg diff --git a/scripts/staging-integrity.ts b/scripts/staging-integrity.ts deleted file mode 100644 index e24199d..0000000 --- a/scripts/staging-integrity.ts +++ /dev/null @@ -1,13 +0,0 @@ -export type StagingAction = 'publish' | 'skip'; - -export function decideStagingPublish(localIntegrity: string, existingIntegrity?: string): StagingAction { - if (existingIntegrity === undefined) return 'publish'; - if (existingIntegrity === localIntegrity) return 'skip'; - - throw new Error('Version already exists in Verdaccio with different contents'); -} - -if (require.main === module) { - const [, , localIntegrity, existingIntegrity] = process.argv; - console.log(decideStagingPublish(localIntegrity, existingIntegrity)); -} diff --git a/test/staging-integrity.test.ts b/test/staging-integrity.test.ts deleted file mode 100644 index ea71f4c..0000000 --- a/test/staging-integrity.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { describe, expect, it } from 'vitest'; - -import { decideStagingPublish } from '../scripts/staging-integrity'; - -describe('decideStagingPublish', () => { - it('publishes a version that is not in Verdaccio', () => { - expect(decideStagingPublish('sha512-local')).toBe('publish'); - }); - - it('skips an existing version with identical package contents', () => { - expect(decideStagingPublish('sha512-local', 'sha512-local')).toBe('skip'); - }); - - it('rejects an existing version with different package contents', () => { - expect(() => decideStagingPublish('sha512-local', 'sha512-other')).toThrow( - 'Version already exists in Verdaccio with different contents', - ); - }); -}); diff --git a/test/staging-workflow.test.ts b/test/staging-workflow.test.ts index 3d2e4f4..e216dc6 100644 --- a/test/staging-workflow.test.ts +++ b/test/staging-workflow.test.ts @@ -6,12 +6,12 @@ import { describe, expect, it } from 'vitest'; const workflow = readFileSync(resolve(process.cwd(), '.github/workflows/stage.yml'), 'utf8'); describe('Verdaccio staging workflow', () => { - it('publishes immutable prereleases only from release branches', () => { + it('replaces mutable prereleases only from release branches', () => { expect(workflow).toContain("branches: ['release/**']"); expect(workflow).toContain('npm audit'); expect(workflow).toContain('npm run prepublishOnly'); - expect(workflow).toContain('scripts/staging-integrity.ts'); + expect(workflow).toContain('npm unpublish'); expect(workflow).toContain('npm publish --ignore-scripts'); - expect(workflow).not.toContain('npm unpublish'); + expect(workflow).not.toContain('scripts/staging-integrity.ts'); }); }); From 3a8d93320dd82666150a725a0938abc6106d3630 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Fri, 7 Aug 2026 14:22:43 -0500 Subject: [PATCH 4/4] chore: clear the dependency advisories blocking CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both audit trees were failing, for unrelated reasons and with different fixes. **Root — undici, high.** miniflare 4.20260730.0 (the newest stable) pulls undici 7.28.0, and the advisory range is 7.0.0–7.28.0. `npm audit fix --force` wants miniflare 5.20260801.1-alpha: a breaking major, and an alpha, to patch a devDependency that never ships. undici 7.29.0 is outside the range, so pin it through `overrides` instead — same approach already used for find-my-way and hyperid. **website — js-yaml, high.** Reached through Starlight. 4.3.1 carries the fix and the bump is not breaking, so a plain `npm audit fix` covers it. Verified: root and website audits both report 0 vulnerabilities; 357 tests pass; `test:edge` still passes, which is the one that actually exercises miniflare against the pinned undici; `docs:build` produces its 23 pages. Co-Authored-By: Claude Opus 5 (1M context) --- package-lock.json | 54 +++------------------------------------ package.json | 5 ++-- website/package-lock.json | 18 +++---------- 3 files changed, 9 insertions(+), 68 deletions(-) diff --git a/package-lock.json b/package-lock.json index 97da65b..f62ff56 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1194,9 +1194,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1214,9 +1211,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1234,9 +1228,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1254,9 +1245,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1274,9 +1262,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1294,9 +1279,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1314,9 +1296,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1334,9 +1313,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "LGPL-3.0-or-later", "optional": true, "os": [ @@ -1354,9 +1330,6 @@ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1380,9 +1353,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1406,9 +1376,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1432,9 +1399,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1458,9 +1422,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1484,9 +1445,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1510,9 +1468,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -1536,9 +1491,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0", "optional": true, "os": [ @@ -7976,9 +7928,9 @@ } }, "node_modules/undici": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.28.0.tgz", - "integrity": "sha512-cRZYrTDwWznlnRiPjggAGxZXanty6M8RV1ff8Wm4LWXBp7/IG8v5DnOm74DtUBp9OONpK75YlPnIjQqX0dBDtA==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", + "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 6c0b28d..36a63a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@green-tea/core", "version": "26.8.0-beta.0", - "description": "A zen, opinionated, type-safe framework — your API is a graph, not a middleware chain.", + "description": "A zen, opinionated, type-safe framework \u2014 your API is a graph, not a middleware chain.", "license": "MIT", "author": "green-tea contributors", "repository": { @@ -126,7 +126,8 @@ "hyperid": { "uuid": "11.1.1" } - } + }, + "undici": "7.29.0" }, "devDependencies": { "@eslint/js": "^9.39.5", diff --git a/website/package-lock.json b/website/package-lock.json index 95d845d..dd061ab 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -70,9 +70,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -89,9 +86,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -108,9 +102,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -127,9 +118,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3848,9 +3836,9 @@ } }, "node_modules/js-yaml": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", - "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz", + "integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==", "funding": [ { "type": "github",