Skip to main content

Endpoint

POST/GET /api/claude-code-check Monitors the @anthropic-ai/claude-code npm package for new releases and sends formatted Discord notifications. Runs automatically via Vercel Cron every 30 minutes.

Trigger Methods

Vercel Cron (Automatic)

Configured in vercel.json:
Runs every 30 minutes.

Manual Trigger

Process Flow

  1. Fetch latest npm version from https://registry.npmjs.org/@anthropic-ai/claude-code/latest
  2. Check database if version already notified
  3. Fetch changelog from GitHub (CHANGELOG.md)
  4. Parse changes using Claude AI (via _parser-claude.js)
  5. Save to database (Neon PostgreSQL)
  6. Send Discord notification with formatted embed
  7. Update metadata tracking

Response

Success - New Version Detected

string
success
string
Version number detected (e.g., 1.2.3)
number
Database ID of the version record
object
Summary of changes
number
Total number of changes
object
Change counts by type (features, fixes, improvements, breaking)
object
Discord notification status
boolean
Whether notification was sent
number
HTTP status code from Discord webhook

Example Success Response

Success - Already Processed

string
already_processed
string
Version number
string
Explanation message

Example Already Processed Response

Error Response (500)

string
Error type
string
Error message
string
Stack trace (development mode only)

Example Error Response

Discord Notification Format

The endpoint sends a rich embed to Discord:

Change Categories

  • ⚠️ Breaking Changes: Changes that break backwards compatibility
  • ✨ New Features: New functionality added
  • ⚑ Improvements: Enhancements to existing features
  • πŸ› Bug Fixes: Bug fixes and corrections
Only non-empty categories are included in the embed.

Database Schema

claude_code_versions

Stores version metadata:

claude_code_changes

Stores individual changes:

discord_notifications_log

Logs Discord webhook calls:

monitoring_metadata

Tracks monitoring statistics:

External Dependencies

NPM Registry API

Returns package metadata including:
  • version - Latest version number
  • time.modified - Publication timestamp

GitHub Changelog

Markdown changelog with version sections.

Discord Webhook

Sends formatted embeds to Discord channel.

Environment Variables

string
required
PostgreSQL connection string for Neon databaseFormat: postgresql://user:pass@host/db?sslmode=require
string
required
Discord webhook URL for changelog notificationsFallback: DISCORD_WEBHOOK_URL
string
Environment mode (development or production)Controls error detail visibility

CORS Support

Preflight OPTIONS requests return 200 OK.

Error Handling

Errors are logged and tracked:
  1. Console logging: All errors logged with context
  2. Database tracking: monitoring_metadata table updated with error count and message
  3. Graceful degradation: Metadata update failures don’t crash the endpoint

Example Manual Trigger

Monitoring

Check monitoring health:
View recent notifications:

Notes

  • The endpoint is idempotent: duplicate checks for the same version return already_processed
  • Changelog content is truncated to 50,000 characters before storage
  • GitHub URL uses version without dots (e.g., #123 for version 1.2.3)
  • Parser uses Claude AI (via _parser-claude.js) for intelligent changelog parsing
  • All timestamps stored in ISO 8601 format with timezone
  • Webhook URL can be overridden with DISCORD_WEBHOOK_URL_CHANGELOG environment variable