diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 897d845..e7df195 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,4 +1,4 @@ -name: Publish @verdict/node to npm +name: Publish @bodanglin/verdict-node to npm on: release: @@ -26,13 +26,15 @@ jobs: run: npm run build - name: Run tests run: npm test - - name: Verify package contents - run: npm pack --dry-run - - name: Upload package artifacts + - name: Verify package contents and smoke install + run: npm run verify:package + - name: Dry-run publish gate + run: npm publish --dry-run --access public + - name: Upload release notes uses: actions/upload-artifact@v7 with: - name: verdict-node-package - path: dist/ + name: verdict-node-release-notes + path: CHANGELOG.md publish-to-npm: needs: build-and-test @@ -46,12 +48,16 @@ jobs: with: node-version: "22" registry-url: https://registry.npmjs.org - - name: Download package artifacts - uses: actions/download-artifact@v7 - with: - name: verdict-node-package - path: dist/ - - name: Publish to npm - run: npm publish --access public --provenance + - name: Install dependencies + run: npm ci + - name: Build + run: npm run build + - name: Verify package before publish + run: npm run verify:package + - name: Assert requested version matches package.json + if: ${{ github.event_name == 'workflow_dispatch' && inputs.version != '' }} + run: node -e "const expected=process.env.INPUT_VERSION; const actual=require('./package.json').version; if (actual !== expected) throw new Error(`workflow version ${expected} != package.json ${actual}`)" env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + INPUT_VERSION: ${{ inputs.version }} + - name: Publish to npm + run: npm publish --access public --provenance \ No newline at end of file diff --git a/README.md b/README.md index ed24e2e..8bd542c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# @verdict/node — TypeScript Middleware for Verdict Routing +# @bodanglin/verdict-node — TypeScript Middleware for Verdict Routing -[![npm](https://img.shields.io/npm/v/@verdict/node.svg)](https://www.npmjs.com/package/@verdict/node) +[![npm](https://img.shields.io/npm/v/@bodanglin/verdict-node.svg)](https://www.npmjs.com/package/@bodanglin/verdict-node) [![TypeScript](https://img.shields.io/badge/typescript-strict-blue.svg)](https://www.typescriptlang.org/) [![Tests](https://img.shields.io/badge/tests-139%20passing-brightgreen.svg)](<>) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) @@ -9,9 +9,9 @@ --- -## What is @verdict/node? +## What is @bodanglin/verdict-node? -`@verdict/node` is the TypeScript gateway integration layer for the **Verdict** ecosystem. It accepts an Express/Next.js request, classifies criticality, discovers models from your configured OpenAI-compatible upstream (default: OmniRoute at `http://localhost:20128/v1`), rewrites the selected model, and forwards non-streaming SSE responses. +`@bodanglin/verdict-node` is the TypeScript gateway integration layer for the **Verdict** ecosystem. It accepts an Express/Next.js request, classifies criticality, discovers models from your configured OpenAI-compatible upstream (default: OmniRoute at `http://localhost:20128/v1`), rewrites the selected model, and forwards non-streaming SSE responses. **Works with any OpenAI-compatible client**: Claude Code, Codex, Cursor, Cline, Hermes, Agents SDK, raw HTTP. @@ -51,11 +51,11 @@ behind an install fallback. ## Install ```bash -npm install @verdict/node +npm install @bodanglin/verdict-node # or -pnpm add @verdict/node +pnpm add @bodanglin/verdict-node # or -yarn add @verdict/node +yarn add @bodanglin/verdict-node ``` **Peer dependency**: `express@>=5.0.0 <6` @@ -66,7 +66,7 @@ yarn add @verdict/node ```typescript import express from 'express'; -import { verdictMiddleware } from '@verdict/node/middleware'; +import { verdictMiddleware } from '@bodanglin/verdict-node/middleware'; const app = express(); app.use(express.json()); @@ -96,7 +96,7 @@ node dist/index.js ## Configuration ```typescript -import { verdictMiddleware, VerdictConfig } from '@verdict/node/middleware'; +import { verdictMiddleware, VerdictConfig } from '@bodanglin/verdict-node/middleware'; const config: VerdictConfig = { // Upstream OpenAI-compatible endpoint @@ -146,14 +146,14 @@ Express middleware that: ### Types ```typescript -// From @verdict/node +// From @bodanglin/verdict-node import type { VerdictConfig, ModelInfo, CriticalityLevel, ChatCompletionRequest, ChatCompletionResponse, -} from '@verdict/node'; +} from '@bodanglin/verdict-node'; ``` --- @@ -226,7 +226,7 @@ verdict-node/ | Package | Purpose | | ----------------------------------------------------------------- | -------------------------------------- | | [`verdict-core`](https://github.com/verdict/verdict-core) | Python control plane | -| `@verdict/node` | Express/Next.js middleware (this repo) | +| `@bodanglin/verdict-node` | Express/Next.js middleware (this repo) | | [`verdict-cockpit`](https://github.com/verdict/verdict-cockpit) | Next.js dashboard | | [`verdict-risk`](https://github.com/verdict/verdict-risk) | Risk engine | | [`verdict-edge`](https://github.com/verdict/verdict-edge) | Edge mining framework | diff --git a/scripts/verify-package.mjs b/scripts/verify-package.mjs index 8f49732..421a5c1 100644 --- a/scripts/verify-package.mjs +++ b/scripts/verify-package.mjs @@ -4,6 +4,7 @@ import { tmpdir } from 'node:os'; import { basename, join, resolve } from 'node:path'; const packageName = '@bodanglin/verdict-node'; +const repoCompiler = resolve(process.cwd(), 'node_modules/.bin/tsc'); const allowedTopLevel = new Set(['CHANGELOG.md', 'LICENSE', 'README.md', 'dist', 'package.json']); const requiredFiles = new Set([ 'CHANGELOG.md', @@ -157,9 +158,8 @@ void validate; )}\n`, 'utf8' ); - const tsc = resolve('node_modules/.bin/tsc'); try { - run(tsc, ['--project', join(consumerDirectory, 'tsconfig.json')], { + run(repoCompiler, ['--project', join(consumerDirectory, 'tsconfig.json')], { cwd: consumerDirectory, }); } catch (error) {