diff --git a/.github/workflows/release-astro.yml b/.github/workflows/release-astro.yml new file mode 100644 index 00000000..249a7013 --- /dev/null +++ b/.github/workflows/release-astro.yml @@ -0,0 +1,155 @@ +name: Release Astro integration + +# Publishes @genclass/astro to npm from a tag `astro-v` whose version equals packages/astro/package.json (e.g. +# astro-v0.1.0), with npm provenance, the same way release-playwright.yml publishes @genclass/playwright. +# Authentication: npm trusted publishing (OIDC, `id-token: write`); no npm token is stored in the repository. +# +# Owner setup: +# - First version only: npm configures trusted publishing from a package's own settings page, so the package must exist +# before this workflow can publish it. Push the tag once: the run builds, tests (the generated script, the hook, then +# one `astro build` of the fixture site), packs, installs the tarball next to the runtime npm serves and uploads it +# as the `astro-tarball` artifact, and its publish step fails without a trusted publisher. Publish that exact tarball +# once from your own npm login (`npm publish genclass-astro-.tgz --access public`), then on npmjs.com: +# @genclass/astro → Settings → Trusted publishing → GitHub Actions: organization genclass-dev, repository GenClass, +# workflow filename release-astro.yml, environment npm-publish. Later versions publish from here. +# - The npm-publish GitHub environment (shared with the other release workflows) asks its reviewers to approve each +# run, and has to allow the tag rule `astro-v*`. +# +# The integration only injects the import of the runtime (`@genclass/runtime/auto`), a peer dependency: the run checks +# that the runtime this repository builds, which the fixture site is built with, is on npm, and that it and the one +# `npm install @genclass/runtime@beta` gets are inside the integration's peer range. +# Being on npm is the listing: astro.build/integrations reads npm weekly for the keywords `astro-integration` and +# `withastro`, which the run holds in package.json (docs/adoption/listings/astro-integration.md). Nothing is submitted +# from here. + +on: + push: + tags: ["astro-v*"] + +permissions: + contents: read + +concurrency: + group: release-astro-${{ github.ref }} + cancel-in-progress: false + +jobs: + publish: + name: "@genclass/astro: verify, build, test, publish with provenance" + runs-on: ubuntu-latest + timeout-minutes: 30 + environment: npm-publish + permissions: + contents: read + id-token: write # OIDC token for npm trusted publishing and the provenance attestation + env: + ONNXRUNTIME_NODE_INSTALL: skip + ASTRO_TELEMETRY_DISABLED: "1" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + # Astro 7 declares Node 22.23 / 24.15 or later (integrations.yml runs the same line) + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + cache: npm + + # trusted publishing needs npm >= 11.5.1 + - name: npm 11 + run: npm install -g npm@11 && npm --version + + - name: The tag names the package version, and npm serves a runtime inside the peer range + run: | + TAG="${GITHUB_REF_NAME#astro-v}" + PKG=$(node -p "require('./packages/astro/package.json').version") + echo "tag $TAG, package.json $PKG" + test "$TAG" = "$PKG" + grep -qF "## $PKG" packages/astro/CHANGELOG.md + # (`! grep` would not stop a `bash -e` step, so the refusals here are spelled out) + if grep -qF "## $PKG (unreleased)" packages/astro/CHANGELOG.md; then echo "::error::the CHANGELOG still calls $PKG unreleased"; exit 1; fi + # the keywords the integrations library and `astro add` find the package by + node -e 'const k = require("./packages/astro/package.json").keywords; for (const w of ["astro-integration", "withastro"]) if (!k.includes(w)) { console.error("keyword missing: " + w); process.exit(1); }' + # the runtime this repository builds is the one the fixture site below is built with: npm must serve that + # version, and the peer range must take it and the version `npm install @genclass/runtime@beta` gets + RT=$(node -p "require('./packages/runtime/package.json').version") + PEER=$(node -p "require('./packages/astro/package.json').peerDependencies['@genclass/runtime']") + IN_RANGE=$(npm view "@genclass/runtime@$PEER" version --json) + BETA=$(npm view @genclass/runtime dist-tags.beta) + echo "runtime here $RT, npm's beta $BETA, peer range $PEER" + grep -qF "\"$RT\"" <<< "$IN_RANGE" || { echo "::error::@genclass/runtime $RT is not on npm inside the peer range"; exit 1; } + grep -qF "\"$BETA\"" <<< "$IN_RANGE" || { echo "::error::npm's beta, @genclass/runtime $BETA, is outside the peer range"; exit 1; } + + - name: Install + run: npm ci --no-audit --no-fund + + - name: Build the runtime (the fixture imports it) + run: npm run build -w @genclass/runtime + + - name: Typecheck, build + run: | + npm run typecheck -w @genclass/astro + npm run build -w @genclass/astro + + - name: Tests (generated script, the hook, one astro build of the fixture) + working-directory: packages/astro + run: npx vitest run + + - name: Pack + id: pack + working-directory: packages/astro + run: | + FILE=$(npm pack --silent | tail -1) + echo "file=$FILE" >> "$GITHUB_OUTPUT" + sha512sum "$FILE" + tar -tzf "$FILE" | sort > "$FILE.files.txt" + cat "$FILE.files.txt" + # the tarball holds the built integration and its types; no tests or sources + grep -qx "package/dist/index.js" "$FILE.files.txt" + grep -qx "package/dist/index.d.ts" "$FILE.files.txt" + grep -qx "package/README.md" "$FILE.files.txt" + grep -qx "package/CHANGELOG.md" "$FILE.files.txt" + grep -qx "package/LICENSE" "$FILE.files.txt" + if grep -qE "^package/(test|src)/" "$FILE.files.txt"; then echo "::error::tests or sources are in the tarball"; exit 1; fi + + # The README's install line, with the tarball in place of the name (npm adds the `astro` peer). npm only warns + # about a peer range that is not met, so `npm ls` (which fails on one) is the check. + - name: The tarball installs next to the runtime npm serves, and loads + run: | + mkdir -p "$RUNNER_TEMP/try" && cd "$RUNNER_TEMP/try" + npm init -y > /dev/null + npm install --no-audit --no-fund --ignore-scripts "$GITHUB_WORKSPACE/packages/astro/${{ steps.pack.outputs.file }}" @genclass/runtime@beta + npm ls @genclass/astro @genclass/runtime astro + node --input-type=module -e 'const g = (await import("@genclass/astro")).default; const i = g(); console.log("integration:", typeof g, i.name, Object.keys(i.hooks).join(","))' | grep -qx "integration: function @genclass/astro astro:config:setup" + + - uses: actions/upload-artifact@v4 + with: + name: astro-tarball + path: | + packages/astro/${{ steps.pack.outputs.file }} + packages/astro/${{ steps.pack.outputs.file }}.files.txt + if-no-files-found: error + + - name: Publish with provenance + working-directory: packages/astro + run: | + VERSION=$(node -p "require('./package.json').version") + case "$VERSION" in + *-*) DIST_TAG=$(echo "${VERSION#*-}" | cut -d. -f1) ;; + *) DIST_TAG=latest ;; + esac + npm publish "${{ steps.pack.outputs.file }}" --provenance --access public --tag "$DIST_TAG" + + - name: Verify the registry signature and provenance + run: | + VERSION=$(node -p "require('./packages/astro/package.json').version") + mkdir -p "$RUNNER_TEMP/verify" && cd "$RUNNER_TEMP/verify" + npm init -y > /dev/null + for i in $(seq 1 40); do npm view "@genclass/astro@$VERSION" version --prefer-online && break; sleep 20; done + for i in $(seq 1 10); do npm install --no-audit --no-fund --ignore-scripts "@genclass/astro@$VERSION" @genclass/runtime@beta && break; sleep 30; done + for i in $(seq 1 20); do npm audit signatures && break; echo "attestations not served yet, retry $i"; sleep 30; done + # the published integration is importable by name next to the runtime, with the default export `astro add` needs + npm ls @genclass/astro @genclass/runtime astro + node --input-type=module -e 'const g = (await import("@genclass/astro")).default; const i = g(); console.log("integration:", typeof g, i.name, Object.keys(i.hooks).join(","))' | grep -qx "integration: function @genclass/astro astro:config:setup" diff --git a/.github/workflows/release-nuxt.yml b/.github/workflows/release-nuxt.yml new file mode 100644 index 00000000..029ce0e1 --- /dev/null +++ b/.github/workflows/release-nuxt.yml @@ -0,0 +1,154 @@ +name: Release Nuxt module + +# Publishes @genclass/nuxt to npm from a tag `nuxt-v` whose version equals packages/nuxt/package.json (e.g. +# nuxt-v0.1.0), with npm provenance, the same way release-playwright.yml publishes @genclass/playwright. +# Authentication: npm trusted publishing (OIDC, `id-token: write`); no npm token is stored in the repository. +# +# Owner setup: +# - First version only: npm configures trusted publishing from a package's own settings page, so the package must exist +# before this workflow can publish it. Push the tag once: the run builds, tests (the generated code, then one +# `nuxt build` of the fixture app), packs, installs the tarball next to the runtime npm serves and uploads it as the +# `nuxt-tarball` artifact, and its publish step fails without a trusted publisher. Publish that exact tarball once +# from your own npm login (`npm publish genclass-nuxt-.tgz --access public`), then on npmjs.com: +# @genclass/nuxt → Settings → Trusted publishing → GitHub Actions: organization genclass-dev, repository GenClass, +# workflow filename release-nuxt.yml, environment npm-publish. Later versions publish from here. +# - The npm-publish GitHub environment (shared with the other release workflows) asks its reviewers to approve each +# run, and has to allow the tag rule `nuxt-v*`. +# +# The module only generates the import of the runtime (`@genclass/runtime/auto`), a peer dependency: the run checks +# that the runtime this repository builds, which the fixture app is built with, is on npm, and that it and the one +# `npm install @genclass/runtime@beta` gets are inside the module's peer range. +# After the first version is on npm: the nuxt.com/modules entry can be synced (docs/adoption/listings/nuxt-modules.yml; +# a pull request to nuxt/modules by the owner, nothing is submitted from here). + +on: + push: + tags: ["nuxt-v*"] + +permissions: + contents: read + +concurrency: + group: release-nuxt-${{ github.ref }} + cancel-in-progress: false + +jobs: + publish: + name: "@genclass/nuxt: verify, build, test, publish with provenance" + runs-on: ubuntu-latest + timeout-minutes: 30 + environment: npm-publish + permissions: + contents: read + id-token: write # OIDC token for npm trusted publishing and the provenance attestation + env: + ONNXRUNTIME_NODE_INSTALL: skip + NUXT_TELEMETRY_DISABLED: "1" + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + # Nuxt 4.6 declares Node 22.23 / 24.15 or later (integrations.yml runs the same line) + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + cache: npm + + # trusted publishing needs npm >= 11.5.1 + - name: npm 11 + run: npm install -g npm@11 && npm --version + + - name: The tag names the package version, and npm serves a runtime inside the peer range + run: | + TAG="${GITHUB_REF_NAME#nuxt-v}" + PKG=$(node -p "require('./packages/nuxt/package.json').version") + echo "tag $TAG, package.json $PKG" + test "$TAG" = "$PKG" + grep -qF "## $PKG" packages/nuxt/CHANGELOG.md + # (`! grep` would not stop a `bash -e` step, so the refusals here are spelled out) + if grep -qF "## $PKG (unreleased)" packages/nuxt/CHANGELOG.md; then echo "::error::the CHANGELOG still calls $PKG unreleased"; exit 1; fi + # the runtime this repository builds is the one the fixture app below is built with: npm must serve that + # version, and the peer range must take it and the version `npm install @genclass/runtime@beta` gets + RT=$(node -p "require('./packages/runtime/package.json').version") + PEER=$(node -p "require('./packages/nuxt/package.json').peerDependencies['@genclass/runtime']") + IN_RANGE=$(npm view "@genclass/runtime@$PEER" version --json) + BETA=$(npm view @genclass/runtime dist-tags.beta) + echo "runtime here $RT, npm's beta $BETA, peer range $PEER" + grep -qF "\"$RT\"" <<< "$IN_RANGE" || { echo "::error::@genclass/runtime $RT is not on npm inside the peer range"; exit 1; } + grep -qF "\"$BETA\"" <<< "$IN_RANGE" || { echo "::error::npm's beta, @genclass/runtime $BETA, is outside the peer range"; exit 1; } + + - name: Install + run: npm ci --no-audit --no-fund + + - name: Build the runtime (the fixture imports it) + run: npm run build -w @genclass/runtime + + - name: Typecheck, build + run: | + npm run typecheck -w @genclass/nuxt + npm run build -w @genclass/nuxt + + - name: Tests (generated code, one nuxt build of the fixture) + working-directory: packages/nuxt + run: npx vitest run + + - name: Pack + id: pack + working-directory: packages/nuxt + run: | + FILE=$(npm pack --silent | tail -1) + echo "file=$FILE" >> "$GITHUB_OUTPUT" + sha512sum "$FILE" + tar -tzf "$FILE" | sort > "$FILE.files.txt" + cat "$FILE.files.txt" + # the tarball holds the built module, its types and the module's own record; no tests, sources or playground + grep -qx "package/dist/module.mjs" "$FILE.files.txt" + grep -qx "package/dist/types.d.mts" "$FILE.files.txt" + grep -qx "package/dist/module.json" "$FILE.files.txt" + grep -qx "package/README.md" "$FILE.files.txt" + grep -qx "package/CHANGELOG.md" "$FILE.files.txt" + grep -qx "package/LICENSE" "$FILE.files.txt" + if grep -qE "^package/(test|src|playground)/" "$FILE.files.txt"; then echo "::error::tests, sources or the playground are in the tarball"; exit 1; fi + test "$(node -p "require('./dist/module.json').version")" = "$(node -p "require('./package.json').version")" + + # The README's install line, with the tarball in place of the name. npm only warns about a peer range that is + # not met, so `npm ls` (which fails on one) is the check. + - name: The tarball installs next to the runtime npm serves, and loads + run: | + mkdir -p "$RUNNER_TEMP/try" && cd "$RUNNER_TEMP/try" + npm init -y > /dev/null + npm install --no-audit --no-fund --ignore-scripts "$GITHUB_WORKSPACE/packages/nuxt/${{ steps.pack.outputs.file }}" @genclass/runtime@beta + npm ls @genclass/nuxt @genclass/runtime + node --input-type=module -e 'const m = (await import("@genclass/nuxt")).default; const meta = await m.getMeta(); console.log("module:", meta.name, meta.configKey)' | grep -qx "module: @genclass/nuxt genclass" + + - uses: actions/upload-artifact@v4 + with: + name: nuxt-tarball + path: | + packages/nuxt/${{ steps.pack.outputs.file }} + packages/nuxt/${{ steps.pack.outputs.file }}.files.txt + if-no-files-found: error + + - name: Publish with provenance + working-directory: packages/nuxt + run: | + VERSION=$(node -p "require('./package.json').version") + case "$VERSION" in + *-*) DIST_TAG=$(echo "${VERSION#*-}" | cut -d. -f1) ;; + *) DIST_TAG=latest ;; + esac + npm publish "${{ steps.pack.outputs.file }}" --provenance --access public --tag "$DIST_TAG" + + - name: Verify the registry signature and provenance + run: | + VERSION=$(node -p "require('./packages/nuxt/package.json').version") + mkdir -p "$RUNNER_TEMP/verify" && cd "$RUNNER_TEMP/verify" + npm init -y > /dev/null + for i in $(seq 1 40); do npm view "@genclass/nuxt@$VERSION" version --prefer-online && break; sleep 20; done + for i in $(seq 1 10); do npm install --no-audit --no-fund --ignore-scripts "@genclass/nuxt@$VERSION" @genclass/runtime@beta && break; sleep 30; done + for i in $(seq 1 20); do npm audit signatures && break; echo "attestations not served yet, retry $i"; sleep 30; done + # the published module is importable by name next to the runtime, and says who it is + npm ls @genclass/nuxt @genclass/runtime + node --input-type=module -e 'const m = (await import("@genclass/nuxt")).default; const meta = await m.getMeta(); console.log("module:", meta.name, meta.configKey)' | grep -qx "module: @genclass/nuxt genclass" diff --git a/.github/workflows/release-sv.yml b/.github/workflows/release-sv.yml new file mode 100644 index 00000000..18d82c2b --- /dev/null +++ b/.github/workflows/release-sv.yml @@ -0,0 +1,176 @@ +name: Release Svelte CLI add-on + +# Publishes @genclass/sv to npm from a tag `sv-v` whose version equals packages/sv/package.json (e.g. +# sv-v0.1.0), with npm provenance, the same way release-playwright.yml publishes @genclass/playwright. +# Authentication: npm trusted publishing (OIDC, `id-token: write`); no npm token is stored in the repository. +# +# Owner setup: +# - First version only: npm configures trusted publishing from a package's own settings page, so the package must exist +# before this workflow can publish it. Push the tag once: the run builds, tests (the edits, then end to end on the +# Svelte CLI's add-on harness in Chromium), packs, applies the packed add-on to a new SvelteKit app through the +# Svelte CLI npm serves and uploads the tarball as the `sv-tarball` artifact, and its publish step fails without a +# trusted publisher. Publish that exact tarball once from your own npm login +# (`npm publish genclass-sv-.tgz --access public`), then on npmjs.com: @genclass/sv → Settings → Trusted +# publishing → GitHub Actions: organization genclass-dev, repository GenClass, workflow filename release-sv.yml, +# environment npm-publish. Later versions publish from here. +# - The npm-publish GitHub environment (shared with the other release workflows) asks its reviewers to approve each +# run, and has to allow the tag rule `sv-v*`. +# +# The add-on writes a range of @genclass/runtime into the app's package.json (RUNTIME_RANGE in packages/sv/src/edit.ts): +# the run checks that the runtime this repository builds, which the end-to-end apps run, is on npm, and that it and +# the one `npm install @genclass/runtime@beta` gets are inside that range. +# Being on npm is the listing: the Svelte CLI's docs send people to packages with the `sv-add` keyword, which the run +# holds in package.json, and `npx sv add @genclass` reads the package from npm (docs/adoption/listings/svelte.md). +# Nothing is submitted from here. + +on: + push: + tags: ["sv-v*"] + +permissions: + contents: read + +concurrency: + group: release-sv-${{ github.ref }} + cancel-in-progress: false + +jobs: + publish: + name: "@genclass/sv: verify, build, test, publish with provenance" + runs-on: ubuntu-latest + timeout-minutes: 30 + environment: npm-publish + permissions: + contents: read + id-token: write # OIDC token for npm trusted publishing and the provenance attestation + env: + ONNXRUNTIME_NODE_INSTALL: skip + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org + cache: npm + + # trusted publishing needs npm >= 11.5.1 (Node 22 ships npm 10) + - name: npm 11 + run: npm install -g npm@11 && npm --version + + - name: The tag names the package version, and npm serves a runtime inside the range the add-on writes + run: | + TAG="${GITHUB_REF_NAME#sv-v}" + PKG=$(node -p "require('./packages/sv/package.json').version") + echo "tag $TAG, package.json $PKG" + test "$TAG" = "$PKG" + grep -qF "## $PKG" packages/sv/CHANGELOG.md + # (`! grep` would not stop a `bash -e` step, so the refusals here are spelled out) + if grep -qF "## $PKG (unreleased)" packages/sv/CHANGELOG.md; then echo "::error::the CHANGELOG still calls $PKG unreleased"; exit 1; fi + # what the Svelte CLI needs of a community add-on: the keyword its docs search by, and `sv` as a peer + node -e 'const p = require("./packages/sv/package.json"); if (!p.keywords.includes("sv-add")) { console.error("keyword missing: sv-add"); process.exit(1); } if (!p.peerDependencies.sv) { console.error("sv is not a peer dependency"); process.exit(1); }' + # the runtime this repository builds is the one the end-to-end apps below run: npm must serve that version, + # and the range the add-on writes must take it and the version `npm install @genclass/runtime@beta` gets + RT=$(node -p "require('./packages/runtime/package.json').version") + RANGE=$(grep -oE 'RUNTIME_RANGE = "[^"]+"' packages/sv/src/edit.ts | cut -d'"' -f2) + test -n "$RANGE" + IN_RANGE=$(npm view "@genclass/runtime@$RANGE" version --json) + BETA=$(npm view @genclass/runtime dist-tags.beta) + echo "runtime here $RT, npm's beta $BETA, written range $RANGE" + grep -qF "\"$RT\"" <<< "$IN_RANGE" || { echo "::error::@genclass/runtime $RT is not on npm inside the range the add-on writes"; exit 1; } + grep -qF "\"$BETA\"" <<< "$IN_RANGE" || { echo "::error::npm's beta, @genclass/runtime $BETA, is outside the range the add-on writes"; exit 1; } + + - name: Install + run: npm ci --no-audit --no-fund + + # sv/testing installs the scaffolded apps with pnpm + - name: pnpm + run: npm install -g pnpm@10 + + - name: Typecheck + run: npm run typecheck -w @genclass/sv + + - name: Build + run: | + npm run build -w @genclass/runtime + npm run build -w @genclass/sv + + - name: Unit tests + working-directory: packages/sv + run: npx vitest run --project unit + + - name: Chromium + run: npx playwright install --with-deps chromium + + - name: End to end (scaffold, apply, check, build, Chromium, remove) + working-directory: packages/sv + run: npx vitest run --project e2e + + - name: Pack + id: pack + working-directory: packages/sv + run: | + FILE=$(npm pack --silent | tail -1) + echo "file=$FILE" >> "$GITHUB_OUTPUT" + sha512sum "$FILE" + tar -tzf "$FILE" | sort > "$FILE.files.txt" + cat "$FILE.files.txt" + # the tarball holds the one built file (sv-utils bundled in), and every file package.json's exports name; + # no tests or sources + grep -qx "package/dist/index.js" "$FILE.files.txt" + grep -qx "package/README.md" "$FILE.files.txt" + grep -qx "package/CHANGELOG.md" "$FILE.files.txt" + grep -qx "package/LICENSE" "$FILE.files.txt" + if grep -qE "^package/(test|src)/" "$FILE.files.txt"; then echo "::error::tests or sources are in the tarball"; exit 1; fi + node -e 'const e = require("./package.json").exports["."]; for (const f of Object.values(e)) console.log("package/" + f.replace(/^\.\//, ""))' | while read -r f; do grep -qxF "$f" "$FILE.files.txt" || { echo "::error::exports names $f, which is not in the tarball"; exit 1; }; done + + # The end-to-end test above applies the add-on from its sources with the Svelte CLI this repository pins. This + # applies the packed file through the Svelte CLI that `npx sv` gets today: the add-on sits in a node_modules + # folder next to `sv`, as the CLI places one it downloads, so its `import "sv"` resolves the same way. Nothing + # is installed into the app and no browser runs. + - name: The packed add-on applies through the Svelte CLI npm serves + run: | + mkdir -p "$RUNNER_TEMP/try" && cd "$RUNNER_TEMP/try" + npm init -y > /dev/null + npm install --no-audit --no-fund --ignore-scripts "$GITHUB_WORKSPACE/packages/sv/${{ steps.pack.outputs.file }}" sv@latest + npm ls @genclass/sv sv + node --input-type=module -e 'const a = (await import("@genclass/sv")).default; console.log("add-on:", a.id, typeof a.run)' | grep -qx "add-on: @genclass/sv function" + RANGE=$(grep -oE 'RUNTIME_RANGE = "[^"]+"' "$GITHUB_WORKSPACE/packages/sv/src/edit.ts" | cut -d'"' -f2) + npx --no-install sv create app --template minimal --types ts --no-add-ons --no-install + cd app + npx --no-install sv add "file:../node_modules/@genclass/sv=mode:observe+telemetry:no" --no-git-check --no-download-check --no-install + test "$(node -p "require('./package.json').dependencies['@genclass/runtime']")" = "$RANGE" + grep -qxF 'import "@genclass/runtime/auto";' src/hooks.client.ts + grep -qF '' src/app.html + + - uses: actions/upload-artifact@v4 + with: + name: sv-tarball + path: | + packages/sv/${{ steps.pack.outputs.file }} + packages/sv/${{ steps.pack.outputs.file }}.files.txt + if-no-files-found: error + + - name: Publish with provenance + working-directory: packages/sv + run: | + VERSION=$(node -p "require('./package.json').version") + case "$VERSION" in + *-*) DIST_TAG=$(echo "${VERSION#*-}" | cut -d. -f1) ;; + *) DIST_TAG=latest ;; + esac + npm publish "${{ steps.pack.outputs.file }}" --provenance --access public --tag "$DIST_TAG" + + - name: Verify the registry signature and provenance + run: | + VERSION=$(node -p "require('./packages/sv/package.json').version") + mkdir -p "$RUNNER_TEMP/verify" && cd "$RUNNER_TEMP/verify" + npm init -y > /dev/null + for i in $(seq 1 40); do npm view "@genclass/sv@$VERSION" version --prefer-online && break; sleep 20; done + for i in $(seq 1 10); do npm install --no-audit --no-fund --ignore-scripts "@genclass/sv@$VERSION" && break; sleep 30; done + for i in $(seq 1 20); do npm audit signatures && break; echo "attestations not served yet, retry $i"; sleep 30; done + # the published add-on loads next to the `sv` peer npm adds, and says who it is + npm ls @genclass/sv sv + node --input-type=module -e 'const a = (await import("@genclass/sv")).default; console.log("add-on:", a.id, typeof a.run)' | grep -qx "add-on: @genclass/sv function" diff --git a/AGENTS.md b/AGENTS.md index c6bbc071..04d940d5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,9 +22,9 @@ Default mode is `observe` (report only); `guard` is opt-in; `heal` is experiment | `demos/` | six demo apps with a chaos backend and Playwright trials; `bench/heal/` runs them per mode | | `packages/mcp/` | `@genclass/mcp`: the MCP server for coding agents (bridge on 127.0.0.1:47357, store, explore verdicts, replays, regression-test generation, 9 tools incl. `genclass_scan`, which runs the runtime CLI's `scan`); no runtime deps; `test/e2e/race.e2e.mjs` is the real-browser check (not in CI's main job). `plugin/` is the Claude Code plugin (also an Agent Plugins package); `server.json`, the plugin, `.claude-plugin/`, `.cursor-plugin/`, `gemini-extension.json`, `llms-install.md` and the READMEs pin its version (`npm run sync -w @genclass/mcp` after a version bump; `test/manifests.test.ts` fails otherwise); `scripts/plugin-repo.mjs` assembles genclass-dev/genclass-plugin (the plugin at a repository root with its marketplace files and the released server vendored from npm under `server/`, which `.mcp.json` and the hook there run with `node` from `${CLAUDE_PLUGIN_ROOT}`, for the Claude directory's 50 MiB archive limit and its holds on `npx` launchers and lockfiles, Codex, Gemini CLI, `gh skill`; that repository re-syncs daily from main and is never edited by hand) | | `packages/cli/` | `genclass` (`npx genclass`): the one way to set GenClass up, `genclass dashboard` (one app, whole, in the terminal) and `genclass suggest`. Plain ESM `.mjs` in `src/` (`main.mjs` names the command to the runtime CLI's modules, which it reuses from `packages/runtime/bin/lib`: sign-in, project detection, `init`; `state.mjs` reads the seven steps of a project from disk and from genclass.dev (account, runtime, dashboard, test workflow, GitHub App, coding agent, suggestions); `setup.mjs` and `actions.mjs` walk them, one Enter each, in a short view that `d` expands; `art.mjs` is the opening wordmark; `app.mjs` is `genclass dashboard`, which reads `GET /api/cli/app` (the dashboard's own numbers; a CLI session approved before the approval page said so is asked to sign in again); `views.mjs` is the rest of the dashboard from the same answer (`problems`, `analytics`, `events`, `health`, `agent`, `report`); `kinds.mjs` holds the dashboard page's own texts for each kind and its fix prompts (a test reads `telemetry-worker/src/pages.ts` and fails when a sentence differs); `fix.mjs` hands a problem to the person's coding agent with that prompt (it starts `claude`, `codex`, `cursor-agent` or `gemini` on a key press, or copies or prints; GenClass changes no code); `site.mjs` is `genclass site
`, genclass.dev's site check (`POST /api/scan/crawl`, the scanner's only way in since 2026-11-17): only for a site the account has shown is its own (`GET /api/scan/verify`), an optional test account whose password goes in that POST body and nowhere else, the findings to the agent through `fix-page.mjs` `handOff`; `ask.mjs` is a question to genclass.dev's model; `manage.mjs` is the account's side (`apps`, `plan`, `team`, `connections`, `export`, `funnels`, `agent link`) over the routes a newer approval lists, with `session.mjs` saying why a call was refused and what to do next; `home.mjs` is the prompt the command stays open on after the walk (a command, or a sentence that is a question); `name.mjs` makes every screen say `genclass` once it is installed, `npx genclass` until then; `suggest/` measures the repository and the live site (`repo.mjs`, `site.mjs`), runs the catalog of checks (`checks.mjs`) and asks genclass.dev to order and explain what failed (`digest.mjs` is everything that is sent); `tui.mjs` is the look); `build.mjs` bundles it into one file with no dependencies (`dist/genclass.mjs`) with the runtime and MCP versions it installs; tests in `test/` (`server.test.ts` runs it against the collector in process). The server side is `telemetry-worker/src/cli.ts`, `suggest.ts` (rule 11) and `ask.ts` (rule 12). On npm as `genclass` since 2026-11-12, released by `release-cli.yml` on a `cli-v*` tag; it is the first install line the README names | -| `packages/sv/` | `@genclass/sv`: the Svelte CLI community add-on (`npx sv add @genclass`): adds the runtime, the `/auto` import first in `src/hooks.client` (never the devtools overlay) and (default) the telemetry opt-out meta in `src/app.html`, all with the `genclass:init` marker so `remove` undoes it; bundles `@sveltejs/sv-utils`, `sv` is a peer; `test/e2e/` runs sv's add-on harness (pnpm, Chromium) | +| `packages/sv/` | `@genclass/sv`: the Svelte CLI community add-on (`npx sv add @genclass`): adds the runtime, the `/auto` import first in `src/hooks.client` (never the devtools overlay) and (default) the telemetry opt-out meta in `src/app.html`, all with the `genclass:init` marker so `remove` undoes it; bundles `@sveltejs/sv-utils`, `sv` is a peer; `test/e2e/` runs sv's add-on harness (pnpm, Chromium); released by `release-sv.yml` on a `sv-v*` tag (not on npm yet), which also applies the packed add-on through the Svelte CLI npm serves | | `packages/playwright/` | `@genclass/playwright`: the fixture (`src/fixture.ts`, `install.ts`, `page.ts`, `chaos.ts`, `races.ts`: puts the runtime's script-tag build on every `page` in observe mode with telemetry off, seeded chaos that holds matched fetch/XHR requests with `page.route` and `route.fallback()`, witnesses through the agent entry with every hold off, one `genclass-races/1` file per test in `test-results/genclass/`, with where the test is declared (`location`), which the GitHub App's inline comments use) and the reporter + pure summariser that read those files and write `genclass-report.md` for the PR; peer deps only (`@playwright/test`, `@genclass/runtime`); zero-edit mode (`src/register.ts`, `wrap.ts`, `worker.ts`, `run.ts`: the command `genclass-playwright-run` gives an unmodified suite the same instrumentation by wrapping public Playwright objects in the worker process; `docs/github-app/workflows/genclass.yml` is the one file a repository adds); `test/e2e/run.mjs` is the real-browser check of both (its own workflow) | -| `packages/nuxt/`, `packages/astro/` | `@genclass/nuxt` (a Nuxt module, `@nuxt/kit`, built with `@nuxt/module-builder`) and `@genclass/astro` (an Astro integration, `injectScript("page", ...)`): from options `{ mode, token?, telemetry?, devtools? }` they generate the runtime's own one line (`/auto` or `/auto/guard`) plus a `window.GENCLASS_CONFIG` module imported before it; browser only, nothing on the server; `@genclass/runtime` is a peer dependency. The generated code is pure (`src/source.ts`, `src/index.ts`) and the tests check it exactly, then build one fixture app. Workflow: `integrations.yml` (Node 24) | +| `packages/nuxt/`, `packages/astro/` | `@genclass/nuxt` (a Nuxt module, `@nuxt/kit`, built with `@nuxt/module-builder`) and `@genclass/astro` (an Astro integration, `injectScript("page", ...)`): from options `{ mode, token?, telemetry?, devtools? }` they generate the runtime's own one line (`/auto` or `/auto/guard`) plus a `window.GENCLASS_CONFIG` module imported before it; browser only, nothing on the server; `@genclass/runtime` is a peer dependency. The generated code is pure (`src/source.ts`, `src/index.ts`) and the tests check it exactly, then build one fixture app. Workflow: `integrations.yml` (Node 24); released by `release-nuxt.yml` on a `nuxt-v*` tag and `release-astro.yml` on an `astro-v*` tag (neither is on npm yet), which also install the packed tarball next to the runtime npm serves | | `docs/adoption/listings/` | how the framework packages and templates get listed (nuxt.com/modules entry and steps, astro.build/integrations, sveltesociety.dev, awesome-vue and Angular lists): research and draft entries; nothing is submitted from the repo | | `bench/visual/` | the visual checks' bench (GitHub Actions only, `.github/workflows/visual-measure.yml`): false reports on the demos, templates, compat apps and about 40 public sites, recall on faults planted from the harness, cost; public sites are counted per check kind only, never named in the repo, its run logs or plain artifacts (per-site results only encrypted with the `VISUAL_BENCH_KEY` secret) | | `bench/stall/` | `request-stalled` on the demos (`run.ts`, local, headless Chromium): false reports on clean and chaos trials, recall on planted 60 s hangs; numbers in RESULTS.md section 23 | @@ -118,7 +118,11 @@ Azure, `git push`, `npm publish`. equals `packages/runtime/package.json`; `.github/workflows/release-mcp.yml` on a `mcp-v*` tag for `@genclass/mcp` (its first version is published once by the owner from the workflow's tarball, because npm sets up trusted publishing from an existing package); `.github/workflows/release-cli.yml` on a `cli-v*` tag for `genclass` - (0.1.0 was published that way by the owner on 2026-11-12). Never `npm publish` by hand otherwise. Never push without being asked. + (0.1.0 was published that way by the owner on 2026-11-12); `release-playwright.yml` on a `playwright-v*` tag for + `@genclass/playwright`; `release-nuxt.yml` on a `nuxt-v*` tag for `@genclass/nuxt`, `release-astro.yml` on an + `astro-v*` tag for `@genclass/astro` and `release-sv.yml` on a `sv-v*` tag for `@genclass/sv` (none of the three is + on npm yet: each first version is the owner's one publish from that workflow's tarball, as for `@genclass/mcp`). + Never `npm publish` by hand otherwise. Never push without being asked. 10. **The GitHub App acts only where it is installed, and only from evidence** (`telemetry-worker/src/github/`, `docs/github-app/DESIGN.md`; with the app, 2026-11-09). No code path comments, opens an issue or opens a pull request on a repository without an installation, mentions a person, or contacts anyone; nothing in this repository diff --git a/docs/adoption/listings/astro-integration.md b/docs/adoption/listings/astro-integration.md index 83529c76..76152352 100644 --- a/docs/adoption/listings/astro-integration.md +++ b/docs/adoption/listings/astro-integration.md @@ -50,8 +50,9 @@ it to `astro.config`). ## Steps -1. Publish `@genclass/astro` 0.1.0 to npm through a release workflow (AGENTS.md rule 9; a tag convention and - workflow like `release-mcp.yml` would be needed for this package). +1. Publish `@genclass/astro` 0.1.0 to npm through its release workflow (AGENTS.md rule 9): + `.github/workflows/release-astro.yml`, on an `astro-v0.1.0` tag. The first version is the owner's one publish from + the run's `astro-tarball` artifact; the workflow's header has the steps. 2. Wait for the weekly update. The entry appears at https://astro.build/integrations/ under Utilities, and in the "Recently Added" filter, with the npm description as its text. No action is needed. 3. Optional, after the package is on npm: open an issue at diff --git a/docs/adoption/listings/nuxt-modules.yml b/docs/adoption/listings/nuxt-modules.yml index 169b80f8..1327154b 100644 --- a/docs/adoption/listings/nuxt-modules.yml +++ b/docs/adoption/listings/nuxt-modules.yml @@ -2,8 +2,9 @@ # this repository; this is the draft and the steps, written 2026-10-24 from https://github.com/nuxt/modules (README, # "Contribution" and "Schema") and its lib/categories.ts. # -# Prerequisite: @genclass/nuxt 0.1.0 published on npm (the release workflow; AGENTS.md rule 9). The list reads the -# package's description, npm name and maintainers from npm, so the entry cannot be synced before that. +# Prerequisite: @genclass/nuxt 0.1.0 published on npm (.github/workflows/release-nuxt.yml on a `nuxt-v0.1.0` tag; the +# first version is the owner's one publish from the run's `nuxt-tarball` artifact; AGENTS.md rule 9). The list reads +# the package's description, npm name and maintainers from npm, so the entry cannot be synced before that. # # Steps (a pull request, no issue first): # 1. Fork https://github.com/nuxt/modules, clone it, `pnpm install`. diff --git a/docs/adoption/listings/svelte.md b/docs/adoption/listings/svelte.md index 621e80f3..4e3e5017 100644 --- a/docs/adoption/listings/svelte.md +++ b/docs/adoption/listings/svelte.md @@ -1,8 +1,10 @@ # Svelte listings for @genclass/sv Where the SvelteKit add-on (`packages/sv`, npm `@genclass/sv`) can be listed, with the text to paste. Submit only -after `@genclass/sv@0.1.0` and `@genclass/runtime@0.3.0-beta.1` are both on npm: the add-on writes -`^0.3.0-beta.1`, which npm cannot install before that runtime release exists. +after `@genclass/sv@0.1.0` is on npm (`.github/workflows/release-sv.yml` on a `sv-v0.1.0` tag; the first version is +the owner's one publish from the run's `sv-tarball` artifact). The add-on writes `@genclass/runtime` `^0.3.0-beta.1`, +which npm resolves to the newest 0.3.0 beta (checked 2026-11-19: `0.3.0-beta.7`, the `beta` tag); the release run +stops if that stops being true. ## npm keyword search (no submission) diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md index 8a578236..63cfcbbb 100644 --- a/packages/astro/CHANGELOG.md +++ b/packages/astro/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.1.0 (unreleased) +## 0.1.0 - First version: an Astro integration that installs [`@genclass/runtime`](https://www.npmjs.com/package/@genclass/runtime) the recommended way, in the browser only. @@ -13,3 +13,7 @@ - The runtime modules the script imports are added to Vite's `optimizeDeps.include`: the injected script is a virtual module Vite's dependency scan does not see, and without this `astro dev` discovered them on the first page request and re-optimized with a reload (a "504 Outdated Optimize Dep" console error on a cold start). +- Released by `.github/workflows/release-astro.yml` on an `astro-v` tag, with npm provenance. Before it + publishes, the run builds the fixture site, installs the packed tarball next to the runtime + `npm install @genclass/runtime@beta` gets, and stops if that runtime is outside the peer range or a keyword the + integrations library reads is missing. diff --git a/packages/nuxt/CHANGELOG.md b/packages/nuxt/CHANGELOG.md index c1e47b11..3d7a40bc 100644 --- a/packages/nuxt/CHANGELOG.md +++ b/packages/nuxt/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.1.0 (unreleased) +## 0.1.0 - First version: a Nuxt module (`@nuxt/kit`, built with `@nuxt/module-builder`) that installs [`@genclass/runtime`](https://www.npmjs.com/package/@genclass/runtime) the recommended way, in the browser only. @@ -12,3 +12,6 @@ `"always"` also in production. Nothing runs on the server. `@genclass/runtime` is a peer dependency (`>=0.3.0-beta.1`, the newest line: `npm install @genclass/runtime@beta`; npm's `latest`, 0.2.x, has no token, dashboard or analytics and does not satisfy it). Tested with Nuxt 4.6; the module declares `nuxt: ">=3.17.0"`. +- Released by `.github/workflows/release-nuxt.yml` on a `nuxt-v` tag, with npm provenance. Before it + publishes, the run builds the fixture app, installs the packed tarball next to the runtime + `npm install @genclass/runtime@beta` gets, and stops if that runtime is outside the peer range. diff --git a/packages/sv/CHANGELOG.md b/packages/sv/CHANGELOG.md index 1c9dc76d..2c4e5ce2 100644 --- a/packages/sv/CHANGELOG.md +++ b/packages/sv/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 0.1.0 (unreleased) +## 0.1.0 - First version: a community add-on for the Svelte CLI, `npx sv add @genclass` and `npx sv create --add @genclass`. SvelteKit only (`unsupported("Requires SvelteKit")` elsewhere). @@ -16,3 +16,8 @@ Running the add-on again with the same answers changes nothing. - Next steps say what the model download costs, whether diagnostics are sent, and how to undo the setup. - Bundled with `@sveltejs/sv-utils` 1.0.2 (one file, `sv` external); no dependencies of its own. +- `package.json`: `exports` no longer names `./dist/index.d.ts`. The build writes no type file (the Svelte CLI loads + the add-on, nothing imports it), so the entry pointed at a file that was never in the package. +- Released by `.github/workflows/release-sv.yml` on a `sv-v` tag, with npm provenance. Before it publishes, + the run applies the packed add-on to a new SvelteKit app through the Svelte CLI that `npx sv` gets that day, and + stops if the runtime `npm install @genclass/runtime@beta` gets is outside the range the add-on writes. diff --git a/packages/sv/package.json b/packages/sv/package.json index 2f4d950e..1199ee9b 100644 --- a/packages/sv/package.json +++ b/packages/sv/package.json @@ -22,7 +22,6 @@ ], "exports": { ".": { - "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json"