From 7e67f338c34798c933e203ac4a9f93007989b111 Mon Sep 17 00:00:00 2001 From: Elisabeth Rulke Date: Wed, 29 Jul 2026 17:17:10 -0700 Subject: [PATCH] chore: upgrade AI SDK to v7 --- .github/workflows/pr-checks.yml | 3 +- lib/utils/branch-name-generator.ts | 6 +-- lib/utils/commit-message-generator.ts | 6 +-- lib/utils/title-generator.ts | 6 +-- package.json | 5 +- pnpm-lock.yaml | 76 +++++++++++++++++---------- 6 files changed, 55 insertions(+), 47 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index b1dd71b4..c165e6f2 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' - name: Setup pnpm uses: pnpm/action-setup@v4 @@ -46,4 +46,3 @@ jobs: - name: Run build run: pnpm build - diff --git a/lib/utils/branch-name-generator.ts b/lib/utils/branch-name-generator.ts index 3bf72096..e2473dac 100644 --- a/lib/utils/branch-name-generator.ts +++ b/lib/utils/branch-name-generator.ts @@ -10,10 +10,6 @@ export interface BranchNameOptions { export async function generateBranchName(options: BranchNameOptions): Promise { const { description, repoName, context } = options - if (!process.env.AI_GATEWAY_API_KEY) { - throw new Error('AI_GATEWAY_API_KEY environment variable is required') - } - // Create the prompt for branch name generation const prompt = `Generate a concise, descriptive Git branch name for the following task: @@ -37,7 +33,7 @@ Examples of good branch names: Return ONLY the branch name, nothing else.` try { - // Generate branch name using AI SDK 5 with AI Gateway + // Generate branch name using AI SDK 7 with AI Gateway const result = await generateText({ model: 'openai/gpt-5-nano', prompt, diff --git a/lib/utils/commit-message-generator.ts b/lib/utils/commit-message-generator.ts index 5e495959..2b2f1fc5 100644 --- a/lib/utils/commit-message-generator.ts +++ b/lib/utils/commit-message-generator.ts @@ -9,10 +9,6 @@ export interface CommitMessageOptions { export async function generateCommitMessage(options: CommitMessageOptions): Promise { const { description, repoName, context } = options - if (!process.env.AI_GATEWAY_API_KEY) { - throw new Error('AI_GATEWAY_API_KEY environment variable is required') - } - // Create the prompt for commit message generation const prompt = `Generate a concise, descriptive Git commit message for the following change: @@ -38,7 +34,7 @@ Examples of good commit messages: Return ONLY the commit message, nothing else.` try { - // Generate commit message using AI SDK 5 with AI Gateway + // Generate commit message using AI SDK 7 with AI Gateway const result = await generateText({ model: 'openai/gpt-5-nano', prompt, diff --git a/lib/utils/title-generator.ts b/lib/utils/title-generator.ts index 6d6dab6a..d5a7a8a1 100644 --- a/lib/utils/title-generator.ts +++ b/lib/utils/title-generator.ts @@ -9,10 +9,6 @@ export interface TitleGenerationOptions { export async function generateTaskTitle(options: TitleGenerationOptions): Promise { const { prompt, repoName, context } = options - if (!process.env.AI_GATEWAY_API_KEY) { - throw new Error('AI_GATEWAY_API_KEY environment variable is required') - } - // Create the prompt for title generation const systemPrompt = `Generate a concise, descriptive title for the following task: @@ -36,7 +32,7 @@ Examples of good titles: Return ONLY the title, nothing else.` try { - // Generate title using AI SDK 5 with AI Gateway + // Generate title using AI SDK 7 with AI Gateway const result = await generateText({ model: 'openai/gpt-5-nano', prompt: systemPrompt, diff --git a/package.json b/package.json index d7f92bb4..c6d49044 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "name": "coding-agent-template", "version": "2.0.0", "private": true, + "engines": { + "node": ">=22" + }, "scripts": { "dev": "next dev --webpack", "build": "next build --turbopack", @@ -42,7 +45,7 @@ "@vercel/sandbox": "^0.0.21", "@vercel/sdk": "^1.18.7", "@vercel/speed-insights": "^1.3.1", - "ai": "5.0.51", + "ai": "7.0.34", "arctic": "^3.7.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 56aa8237..e14b8da7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,8 +84,8 @@ importers: specifier: ^1.3.1 version: 1.3.1(next@16.0.10(@babel/core@7.28.6)(@opentelemetry/api@1.9.0)(react-dom@19.2.1(react@19.2.1))(react@19.2.1))(react@19.2.1) ai: - specifier: 5.0.51 - version: 5.0.51(zod@4.3.6) + specifier: 7.0.34 + version: 7.0.34(zod@4.3.6) arctic: specifier: ^3.7.0 version: 3.7.0 @@ -210,21 +210,21 @@ importers: packages: - '@ai-sdk/gateway@1.0.28': - resolution: {integrity: sha512-e9RKgWVDYHsd4UkKCgKQpK+nxLSDydN18yXctzgNlmf2R7BR+HqUsTKJdZT6ArSoXBWBGhyZss0cJJnpm6YVfw==} - engines: {node: '>=18'} + '@ai-sdk/gateway@4.0.26': + resolution: {integrity: sha512-b/nc3COKtk8IxzgcCi418IoZFky/Bw+Jg8+J0/SBBnu/mOXA4bkIKCu81coEtJAWuH2g5Fvvsa0ar7EpmzNWTw==} + engines: {node: '>=22'} peerDependencies: - zod: ^3.25.76 || ^4 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/provider-utils@3.0.9': - resolution: {integrity: sha512-Pm571x5efqaI4hf9yW4KsVlDBDme8++UepZRnq+kqVBWWjgvGhQlzU8glaFq0YJEB9kkxZHbRRyVeHoV2sRYaQ==} - engines: {node: '>=18'} + '@ai-sdk/provider-utils@5.0.12': + resolution: {integrity: sha512-bbhlOgHeYwrIGheLkM6fhS8hVger8uFPmcOLg+kxc9EFh7y30XYorWhthlYAgpadO3SJhFZrIcEknN7qEqEVvA==} + engines: {node: '>=22'} peerDependencies: - zod: ^3.25.76 || ^4 + zod: ^3.25.76 || ^4.1.8 - '@ai-sdk/provider@2.0.0': - resolution: {integrity: sha512-6o7Y2SeO9vFKB8lArHXehNuusnpddKPk7xqL7T2/b+OvXMRIXUO1rR4wcv1hAFUAT9avGZshty3Wlua/XA7TvA==} - engines: {node: '>=18'} + '@ai-sdk/provider@4.0.3': + resolution: {integrity: sha512-e0CpNWJUY7OxAFAnCZkw+ri9QOHWwTs1tXP42782KFGCU07qt8NiXCrCVowyCB5dP2r5/Uls+g2oPd8kOJn9dw==} + engines: {node: '>=22'} '@alloc/quick-lru@5.2.0': resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} @@ -2149,6 +2149,10 @@ packages: resolution: {integrity: sha512-59PBFx3T+k5hLTEWa3ggiMpGRz1OVvl9eN8SUai+A43IsqiOuAe7qPBf+cray/Fj6mkgnxm/D7IAtjc8zSHi7g==} engines: {node: '>= 18'} + '@vercel/oidc@3.2.0': + resolution: {integrity: sha512-UycprH3T6n3jH0k44NHMa7pnFHGu/N05MjojYr+Mc6I7obkoLIJujSWwin1pCvdy/eOxrI/l3uDLQsmcrOb4ug==} + engines: {node: '>= 20'} + '@vercel/sandbox@0.0.21': resolution: {integrity: sha512-j6nAUQyuw6znVaZGd7yI0nab1EWhEtIZPnTXvpDatJ2SObodYZOz5hGoLjCopAuhQBC7vOngbZ1bwP6HxtB5+g==} @@ -2185,6 +2189,9 @@ packages: '@vue/shared@3.5.27': resolution: {integrity: sha512-dXr/3CgqXsJkZ0n9F3I4elY8wM9jMJpP3pvRG52r6m0tu/MsAFIe6JpXVGeNMd/D9F4hQynWT8Rfuj0bdm9kFQ==} + '@workflow/serde@4.1.0': + resolution: {integrity: sha512-pav4F2BoirECWR7Nf1TKt+2eETcBj7jj4cBefQ8VXQCA6NPkaKeLfj/zMgi+3zYV5ZIBT4GuUiphsj0/b9hPQQ==} + accepts@2.0.0: resolution: {integrity: sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==} engines: {node: '>= 0.6'} @@ -2199,11 +2206,11 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - ai@5.0.51: - resolution: {integrity: sha512-ToKW099QWUJNqePZbWGg8FSfxTxS3UN9U6yCla8rYdW0EBTDNPnpRwK1N6ER9TfV+dFtdUu+ZgKSlhQnEThriQ==} - engines: {node: '>=18'} + ai@7.0.34: + resolution: {integrity: sha512-jDqclWYqPGFKcUG4CQiKcBiwi5XqVMqvYy6eJdujVpvE1SDoB6j7RtjrGYz3Bn5B1dzTj1StAlrOebY//WK9/Q==} + engines: {node: '>=22'} peerDependencies: - zod: ^3.25.76 || ^4 + zod: ^3.25.76 || ^4.1.8 ajv-formats@3.0.1: resolution: {integrity: sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==} @@ -3028,6 +3035,10 @@ packages: resolution: {integrity: sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==} engines: {node: '>=18.0.0'} + eventsource-parser@3.1.0: + resolution: {integrity: sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg==} + engines: {node: '>=18.0.0'} + eventsource@3.0.7: resolution: {integrity: sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==} engines: {node: '>=18.0.0'} @@ -4850,20 +4861,22 @@ packages: snapshots: - '@ai-sdk/gateway@1.0.28(zod@4.3.6)': + '@ai-sdk/gateway@4.0.26(zod@4.3.6)': dependencies: - '@ai-sdk/provider': 2.0.0 - '@ai-sdk/provider-utils': 3.0.9(zod@4.3.6) + '@ai-sdk/provider': 4.0.3 + '@ai-sdk/provider-utils': 5.0.12(zod@4.3.6) + '@vercel/oidc': 3.2.0 zod: 4.3.6 - '@ai-sdk/provider-utils@3.0.9(zod@4.3.6)': + '@ai-sdk/provider-utils@5.0.12(zod@4.3.6)': dependencies: - '@ai-sdk/provider': 2.0.0 + '@ai-sdk/provider': 4.0.3 '@standard-schema/spec': 1.1.0 - eventsource-parser: 3.0.6 + '@workflow/serde': 4.1.0 + eventsource-parser: 3.1.0 zod: 4.3.6 - '@ai-sdk/provider@2.0.0': + '@ai-sdk/provider@4.0.3': dependencies: json-schema: 0.4.0 @@ -6600,6 +6613,8 @@ snapshots: '@types/ms': 2.1.0 ms: 2.1.3 + '@vercel/oidc@3.2.0': {} + '@vercel/sandbox@0.0.21': dependencies: '@vercel/oidc': 2.0.2 @@ -6633,6 +6648,8 @@ snapshots: '@vue/shared@3.5.27': {} + '@workflow/serde@4.1.0': {} + accepts@2.0.0: dependencies: mime-types: 3.0.2 @@ -6644,12 +6661,11 @@ snapshots: acorn@8.15.0: {} - ai@5.0.51(zod@4.3.6): + ai@7.0.34(zod@4.3.6): dependencies: - '@ai-sdk/gateway': 1.0.28(zod@4.3.6) - '@ai-sdk/provider': 2.0.0 - '@ai-sdk/provider-utils': 3.0.9(zod@4.3.6) - '@opentelemetry/api': 1.9.0 + '@ai-sdk/gateway': 4.0.26(zod@4.3.6) + '@ai-sdk/provider': 4.0.3 + '@ai-sdk/provider-utils': 5.0.12(zod@4.3.6) zod: 4.3.6 ajv-formats@3.0.1(ajv@8.17.1): @@ -7642,6 +7658,8 @@ snapshots: eventsource-parser@3.0.6: {} + eventsource-parser@3.1.0: {} + eventsource@3.0.7: dependencies: eventsource-parser: 3.0.6