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 invercel.json:
Manual Trigger
Process Flow
- Fetch latest npm version from
https://registry.npmjs.org/@anthropic-ai/claude-code/latest - Check database if version already notified
- Fetch changelog from GitHub (
CHANGELOG.md) - Parse changes using Claude AI (via
_parser-claude.js) - Save to database (Neon PostgreSQL)
- Send Discord notification with formatted embed
- Update metadata tracking
Response
Success - New Version Detected
string
successstring
Version number detected (e.g.,
1.2.3)number
Database ID of the version record
object
object
Example Success Response
Success - Already Processed
string
already_processedstring
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
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
version- Latest version numbertime.modified- Publication timestamp
GitHub Changelog
Discord Webhook
Environment Variables
string
required
PostgreSQL connection string for Neon databaseFormat:
postgresql://user:pass@host/db?sslmode=requirestring
required
Discord webhook URL for changelog notificationsFallback:
DISCORD_WEBHOOK_URLstring
Environment mode (
development or production)Controls error detail visibilityCORS Support
OPTIONS requests return 200 OK.
Error Handling
Errors are logged and tracked:- Console logging: All errors logged with context
- Database tracking:
monitoring_metadatatable updated with error count and message - Graceful degradation: Metadata update failures donβt crash the endpoint
Example Manual Trigger
Monitoring
Check monitoring health: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.,
#123for version1.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_CHANGELOGenvironment variable