From 29ea1b4dec5dfa79d630ffd757ea52bbd98bda1a Mon Sep 17 00:00:00 2001 From: Chris Garber Date: Sun, 15 Nov 2026 13:47:09 -0500 Subject: [PATCH] fix: upgrade Fern CLI to restore SDK preview CI --- .github/actions/setup-fern/action.yml | 2 +- fern/fern.config.json | 2 +- scripts/fern/README.md | 6 +++--- scripts/fern/run.cjs | 8 ++++---- scripts/fern/run.test.cjs | 10 +++++----- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/actions/setup-fern/action.yml b/.github/actions/setup-fern/action.yml index 6c88a7490..07fc48904 100644 --- a/.github/actions/setup-fern/action.yml +++ b/.github/actions/setup-fern/action.yml @@ -9,7 +9,7 @@ runs: - name: Install pinned Fern shell: bash run: | - npm install --prefix "$RUNNER_TEMP/vapi-fern" --no-save --no-audit --no-fund fern-api@5.169.0 + npm install --prefix "$RUNNER_TEMP/vapi-fern" --no-save --no-audit --no-fund fern-api@5.216.0 echo "FERN_CLI_PATH=$RUNNER_TEMP/vapi-fern/node_modules/fern-api/cli.cjs" >> "$GITHUB_ENV" - name: Test cache safeguards shell: bash diff --git a/fern/fern.config.json b/fern/fern.config.json index cdb74702f..e3a5916a7 100644 --- a/fern/fern.config.json +++ b/fern/fern.config.json @@ -1,4 +1,4 @@ { "organization": "vapi", - "version": "5.169.0" + "version": "5.216.0" } diff --git a/scripts/fern/README.md b/scripts/fern/README.md index ad46ddb35..3f88b7bd9 100644 --- a/scripts/fern/README.md +++ b/scripts/fern/README.md @@ -49,7 +49,7 @@ original Fern commands also removes this optimization. ## Local verification ```sh -npm install --prefix /tmp/vapi-fern --no-save fern-api@5.169.0 +npm install --prefix /tmp/vapi-fern --no-save fern-api@5.216.0 export FERN_CLI_PATH=/tmp/vapi-fern/node_modules/fern-api/cli.cjs node --test scripts/fern/*.test.cjs node scripts/fern/run.cjs check --local --log-level debug @@ -57,9 +57,9 @@ node scripts/fern/run.cjs generate --docs --preview --log-level debug ``` The CLI compatibility tests exercise the installed bundle when `FERN_CLI_PATH` is set; -without it, the installed-bundle checks are skipped. The wrapper pins Fern 5.169.0 +without it, the installed-bundle checks are skipped. The wrapper pins Fern 5.216.0 and verifies CLI SHA-256 -`773ec0a808a2c4d03c894c81c6159f8e3fe8db5a873c287cdce5b140eed8b809`. +`acd2771ffed03658a03590ea9fa6ee764df52e52284665eb8574cd8efacb4923`. The timing measurements below predate this upgrade. Preview generation publishes remotely and requires separate authorization. diff --git a/scripts/fern/run.cjs b/scripts/fern/run.cjs index 8857c6662..a4c81261a 100644 --- a/scripts/fern/run.cjs +++ b/scripts/fern/run.cjs @@ -4,9 +4,9 @@ const os = require('node:os'); const { spawnSync } = require('node:child_process'); const { digest } = require('./example-cache.cjs'); -const VERSION = '5.169.0'; -const CLI_SHA256 = '773ec0a808a2c4d03c894c81c6159f8e3fe8db5a873c287cdce5b140eed8b809'; -const MARKER = 'function KOm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})'; +const VERSION = '5.216.0'; +const CLI_SHA256 = 'acd2771ffed03658a03590ea9fa6ee764df52e52284665eb8574cd8efacb4923'; +const MARKER = 'function HQm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})'; const MEDIA_MARKER = 'generateOrValidateExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i})'; function inputDigest(root) { @@ -27,7 +27,7 @@ function main() { if (digest(source) !== CLI_SHA256 || source.split(MARKER).length !== 2 || source.split(MEDIA_MARKER).length !== 2) throw new Error('Unexpected Fern CLI contents. Refusing to apply the cache adapter.'); const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'vapi-fern-')); const patched = source - .replace(MARKER, 'function KOm(args){return globalThis.__vapiFernExamples(args,()=>vapiOriginalExamples(args))}function vapiOriginalExamples({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})') + .replace(MARKER, 'function HQm(args){return globalThis.__vapiFernExamples(args,()=>vapiOriginalExamples(args))}function vapiOriginalExamples({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})') .replace(MEDIA_MARKER, 'generateOrValidateExample(args){return globalThis.__vapiFernExamples({context:this.context,breadcrumbs:this.breadcrumbs,mediaExampleArgs:args},()=>this.vapiOriginalMediaExample(args))}vapiOriginalMediaExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i})'); try { const cli = path.join(temporary, 'fern.cjs'); diff --git a/scripts/fern/run.test.cjs b/scripts/fern/run.test.cjs index 09ba2013e..429896020 100644 --- a/scripts/fern/run.test.cjs +++ b/scripts/fern/run.test.cjs @@ -7,9 +7,9 @@ const vm = require('node:vm'); const { spawnSync } = require('node:child_process'); const { digest } = require('./example-cache.cjs'); -const version = '5.169.0'; -const checksum = '773ec0a808a2c4d03c894c81c6159f8e3fe8db5a873c287cdce5b140eed8b809'; -const marker = 'function KOm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})'; +const version = '5.216.0'; +const checksum = 'acd2771ffed03658a03590ea9fa6ee764df52e52284665eb8574cd8efacb4923'; +const marker = 'function HQm({propertySchema:e,breadcrumbs:t,context:r,propertyId:n})'; const mediaMarker = 'generateOrValidateExample({schema:t,example:r,generateOptionalProperties:n,exampleGenerationStrategy:i})'; const fixture = `${marker}{return e}class Media{${mediaMarker}{return t}}`; const wrapper = fs.readFileSync(path.join(__dirname, 'run.cjs'), 'utf8'); @@ -80,7 +80,7 @@ test('both emitted wrappers call the cache and preserve original generation', () const patched = h.calls.writes[0][1]; const calls = []; const context = { __vapiFernExamples(args, generate) { calls.push(args); return generate(); } }; - const result = vm.runInNewContext(`${patched};[KOm({propertySchema:'property'}),new Media().generateOrValidateExample({schema:'media'})]`, context); + const result = vm.runInNewContext(`${patched};[HQm({propertySchema:'property'}),new Media().generateOrValidateExample({schema:'media'})]`, context); assert.deepEqual(Array.from(result), ['property', 'media']); assert.equal(calls.length, 2); assert.equal(calls[0].propertySchema, 'property'); @@ -134,7 +134,7 @@ for (const args of [['--version'], ['--help'], ['check', '--help'], ['generate', assert.equal(result.status, 0, result.stderr); assert.match(result.stderr, /\[fern-example-cache\]/); assert.ok(result.stdout.trim()); - if (args[0] === '--version') assert.match(result.stdout, /5\.169\.0/); + if (args[0] === '--version') assert.match(result.stdout, /5\.216\.0/); assert.deepEqual(fs.readdirSync(temporary), []); }); }