Skip to content

Conversation

@jacekradko
Copy link
Member

@jacekradko jacekradko commented Jan 6, 2026

Description

Before:

pnpx @clerk/upgrade@2.0.0-canary.v20260106140304  --skip-upgrade

 █▀▀ █   █▀▀ █▀█ █▄▀   █ █ █▀█ █▀▀ █▀█ ▄▀█ █▀▄ █▀▀
 █▄▄ █▄▄ ██▄ █▀▄ █ █   █▄█ █▀▀ █▄█ █▀▄ █▀█ █▄▀ ██▄

Hello friend! We're excited to help you upgrade Clerk modules. Before we get started, a couple
questions...

⛔ No upgrade path found for @clerk/nextjs. Your version may be too old for this upgrade tool.

After:

node ../../../javascript/packages/upgrade/dist/cli.js

 █▀▀ █   █▀▀ █▀█ █▄▀   █ █ █▀█ █▀▀ █▀█ ▄▀█ █▀▄ █▀▀
 █▄▄ █▄▄ ██▄ █▀▄ █ █   █▄█ █▀▀ █▄█ █▀▄ █▀█ █▄▀ ██▄

Hello friend! We're excited to help you upgrade Clerk modules. Before we get started, a couple
questions...

⚠️ Could not detect your @clerk/nextjs version (you may be using catalog: protocol or a non-standard version specifier).

Which upgrade would you like to perform?
  1) Core 3
  2) Core 2
Enter number: 1

🔧 Upgrade config
Clerk SDK: @clerk/nextjs
Upgrade: v6 → v7 (Core 3)

When the upgrade cli tries to parse a non-standard semver, it ends up at a dead end and the user cannot continue with the upgrade. Now we allow the user to pick the version they want to upgrade to manually

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Interactive release selection now available when the current SDK version cannot be automatically detected
    • Enhanced handling of non-standard version specifiers in package configurations
  • Tests

    • Added comprehensive test coverage for version detection edge cases and non-standard identifiers
  • Chores

    • Released patch upgrade

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Jan 6, 2026

🦋 Changeset detected

Latest commit: 3be37e2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@clerk/upgrade Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jan 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 6, 2026 3:48pm

@github-actions github-actions bot added the core-3 label Jan 6, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

This PR adds support for handling catalog: protocol version specifiers and introduces interactive release selection in the upgrade tool. A new getAvailableReleases() function enumerates available releases from the versions directory. The CLI has been updated to prompt users for a release selection when the current SDK version cannot be detected and no explicit release is provided. Test fixtures for Next.js with catalog dependencies are added, along with tests validating null return values for non-standard version specifiers like catalog: and workspace:\* protocols. A changeset documents the patch upgrade.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(upgrade): handle non-standard semver versions' accurately reflects the main change: enabling the upgrade tool to handle non-standard semver versions (like catalog: protocol) by allowing manual version selection when automatic detection fails.

📜 Recent review details

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ca4bb8f and 3be37e2.

⛔ Files ignored due to path filters (1)
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/smooth-foxes-jump.md
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/package.json
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/cli.js
  • packages/upgrade/src/config.js
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

All code must pass ESLint checks with the project's configuration

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/package.json
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Follow established naming conventions (PascalCase for components, camelCase for variables)

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
packages/**/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{test,spec}.{ts,tsx,js,jsx}: Unit tests are required for all new functionality
Verify proper error handling and edge cases
Include tests for all new features

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/integration/config.test.js
**/*.{test,spec,e2e}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use real Clerk instances for integration tests

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/integration/config.test.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use ESLint with custom configurations tailored for different package types

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use Prettier for code formatting across all packages

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/package.json
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
**/*

⚙️ CodeRabbit configuration file

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.

Files:

  • packages/upgrade/src/__tests__/integration/detect-sdk.test.js
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/package.json
  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
  • packages/upgrade/src/__tests__/integration/config.test.js
  • packages/upgrade/src/config.js
  • packages/upgrade/src/cli.js
**/package.json

📄 CodeRabbit inference engine (.cursor/rules/global.mdc)

Use pnpm as the package manager for this monorepo

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/package.json
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
**/*.ts?(x)

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components

**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
**/*.{md,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Update documentation for API changes

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g., UserProfile, NavigationMenu)
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/upgrade/src/__tests__/fixtures/nextjs-catalog/src/app.tsx
🧬 Code graph analysis (3)
packages/upgrade/src/__tests__/integration/detect-sdk.test.js (2)
packages/upgrade/src/util/detect-sdk.js (3)
  • version (63-67)
  • getSdkVersion (52-74)
  • getMajorVersion (76-86)
packages/upgrade/src/__tests__/helpers/create-fixture.js (1)
  • getFixturePath (9-11)
packages/upgrade/src/__tests__/integration/config.test.js (2)
packages/upgrade/src/config.js (4)
  • getAvailableReleases (10-18)
  • config (39-39)
  • config (63-63)
  • loadConfig (20-103)
packages/upgrade/src/cli.js (1)
  • config (160-160)
packages/upgrade/src/cli.js (3)
packages/upgrade/src/config.js (4)
  • getAvailableReleases (10-18)
  • config (39-39)
  • config (63-63)
  • loadConfig (20-103)
packages/upgrade/src/render.js (5)
  • renderError (63-65)
  • renderWarning (67-69)
  • renderNewline (71-73)
  • renderText (54-57)
  • promptSelect (110-132)
scripts/notify.mjs (1)
  • process (6-6)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (25)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
packages/upgrade/src/config.js (1)

10-18: LGTM!

The function correctly enumerates available releases by reading the versions directory, filtering for valid release directories with index.js files, and returning them in reverse sorted order (newest first). The implementation follows the same filesystem interaction pattern as the existing loadConfig function.

packages/upgrade/src/__tests__/integration/detect-sdk.test.js (1)

60-63: LGTM!

The tests correctly validate that non-standard version specifiers (catalog:, catalog:default, workspace:*) return null from both getSdkVersion and getMajorVersion, which aligns with the PR's objective to handle non-standard semver versions gracefully.

Also applies to: 87-97

packages/upgrade/src/__tests__/integration/config.test.js (1)

131-173: LGTM!

Tests properly cover the new getAvailableReleases() function and the loadConfig behavior with null versions. The test cases validate both success and failure paths for the interactive release selection flow.

packages/upgrade/src/cli.js (1)

122-160: LGTM!

The interactive release selection flow properly handles the case where version detection fails. Good handling of:

  • Empty releases edge case with clear error
  • Non-interactive mode with actionable guidance (--release flag)
  • User-friendly prompts in interactive mode
  • Proper integration with loadConfig using the selected release

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 6, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7540

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7540

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7540

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7540

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7540

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7540

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7540

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7540

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7540

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7540

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7540

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7540

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7540

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7540

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7540

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7540

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7540

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7540

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7540

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7540

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7540

commit: 3be37e2

@jacekradko jacekradko requested a review from brkalow January 6, 2026 16:25
@jacekradko jacekradko merged commit 158c604 into main Jan 6, 2026
46 checks passed
@jacekradko jacekradko deleted the feat/upgrade-handle-unknown-semver branch January 6, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants