Commit Graph

25 Commits

Author SHA1 Message Date
Daniel Avila dae5faa009 migrate: Vercel → Cloudflare Pages + Workers (/mes → ~/bin/zsh-5/mes) (#571)
* migrate: Vercel → Cloudflare Pages + Workers para reducir costos ($110 → ~$0-5/mes)

- Cambia adaptador Astro de @astrojs/vercel a @astrojs/cloudflare (mode: 'directory')
- Agrega dashboard/wrangler.toml con nodejs_compat para compatibilidad total
- Crea cloudflare-workers/crons/ Worker que reemplaza los cron jobs de Vercel
  (claude-code-check cada 30min, health-check cada 1h en vez de cada 15min)
- Actualiza CI/CD: Vercel CLI → wrangler pages deploy (requiere CLOUDFLARE_API_TOKEN y CLOUDFLARE_ACCOUNT_ID en GitHub Secrets)
- Elimina crons duplicados del proyecto legacy aitmpl (root vercel.json)
- Quick win: agrega Cache-Control headers a components.json (86400s), plugins.json,
  trending-data.json y claude-jobs.json para cortar el costo de bandwidth de $53

Próximos pasos manuales (ver PR description):
1. Crear proyecto en Cloudflare Pages
2. Agregar secrets de Cloudflare en GitHub
3. Migrar env vars de Vercel a Cloudflare Dashboard
4. Deployar cloudflare-workers/crons con wrangler
5. Apuntar dominios a Cloudflare Pages

* fix: nodejs_compat_v2 + react-dom/server.node alias para Cloudflare Workers

- Cambia compatibility_flags de nodejs_compat a nodejs_compat_v2
- Agrega alias vite react-dom/server → react-dom/server.node para evitar
  MessageChannel error en module init time en Cloudflare Workers runtime
- Agrega ssr.noExternal para bundlear react-dom y aplicar el alias

* fix: revert compatibility_flags a nodejs_compat (estándar)

nodejs_compat_v2 no es el flag primario. El fix real del MessageChannel
error fue el alias vite react-dom/server → react-dom/server.node,
no el cambio de flag.

* fix: inject Cloudflare Pages runtime env into process.env via middleware

Add Astro middleware that copies context.locals.runtime.env (Cloudflare
Pages secrets) into process.env before each request, so API routes can
use process.env.X as a unified pattern without changing the call sites.

Also add || process.env.X fallbacks to all API routes/libs that were
using import.meta.env exclusively (build-time only in Vite).

Verified on staging: track-download-supabase, health-check,
claude-code-check, collections, github/token all return correct responses.
2026-05-08 20:24:28 -04:00
daniel 61691e7402 fix: Add CORS headers for components.json and trending-data.json
Allows app.aitmpl.com dashboard to fetch data cross-origin from
www.aitmpl.com without the bare domain 307 redirect issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:13:17 -05:00
daniel cf7e008c59 feat: Add monitoring points P1-P5 (installation outcomes, website events, API health)
- Create 3 Neon tables: installation_outcomes, website_events, api_health_logs
- Add API endpoints: track-installation-outcome, track-website-events, health-check
- Track CLI installation success/failure with timing and error classification
- Add website event tracker (search, cart, component views) with batched sendBeacon
- Add health-check cron every 15min with Discord alerts on failure
- Integrate tracking in all 6 installIndividual* functions with batchId support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 22:08:34 -05:00
Dani 02c946fbac add license and attribution info to README and adjust cron schedule in vercel.json 2025-11-04 12:02:06 -05:00
Dani 4cc03122b9 feat: Add Claude Code changelog monitor with Discord notifications
- Database schema for tracking Claude Code versions in Neon
- Automated parser for CHANGELOG.md with change classification
- Discord webhook integration with formatted embeds
- Vercel Cron job running every 4 hours
- Supports detection of features, fixes, improvements, and breaking changes

Endpoints:
- /api/claude-code-check - Main endpoint for version checking and notification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 14:11:23 -04:00
Dani 4fde0cf6e5 fix: add vercel.json with correct outputDirectory config 2025-10-07 17:17:50 -04:00
Dani 8ee17bda8e feat: implement plugin system with marketplace and category filters
- Add plugin marketplace system with 10 curated plugins
- Create plugin detail pages with installation instructions
- Add component installation modal with copy functionality
- Update Python script to extract plugin data with category/folder paths
- Add category filters that load correctly based on URL
- Update footer across all pages for consistency
- Fix install commands to use folder/name format

Features:
- Plugin cards with View Details button
- Individual component installation with proper paths
- Related plugins based on shared keywords
- Dynamic category loading for all filter types
- URL-based filter detection and category display

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-07 17:15:06 -04:00
Dani 787f9875b7 fix sitemap and robots.txt for SEO and add dev server 2025-09-18 10:39:11 -04:00
Dani aa329c6682 fix car and vercel routes 2025-09-10 19:41:25 -04:00
Dani 68f86cfbac Fix Vercel configuration - remove routes mixing with rewrites
Vercel doesn't allow mixing 'routes' with 'rewrites'. Changed to use
only rewrites with named parameters for cleaner syntax.

Changes:
- Remove 'routes' section (incompatible with 'rewrites')
- Use named parameters (:type/:name) instead of regex capture groups
- Add JSON Content-Type headers for all .json files
- Add 5-minute cache for JSON files

This ensures components.json and other JSON files are served correctly
with proper MIME types instead of HTML.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 17:58:34 -04:00
Dani cb54b6ff5a Fix Vercel routes to prevent JSON files from being rewritten
The component rewrite was intercepting /components.json requests,
returning HTML instead of JSON, causing "<!DOCTYPE... is not valid JSON" errors.

Changes:
- Add $ anchor to component rewrite pattern for exact matching
- Add explicit routes for .json files to ensure proper serving
- Add cache headers for JSON files (5 minute cache)
- Prevent rewrites from intercepting static JSON resources

This ensures /components.json returns actual JSON instead of HTML.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 17:55:25 -04:00
Dani 2844cf8022 Fix Vercel configuration for component rewrites
- Disable cleanUrls to prevent conflicts with rewrites
- Remove unnecessary JS/CSS rewrites (using absolute paths instead)
- Fix header paths from /docs/* to /* for proper MIME types
- Add explicit Content-Type headers for JS and CSS files

This should resolve the rewrite issue where /component/agent/name
was serving index.html instead of component.html.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 17:38:21 -04:00
Dani 7c4006766a Fix production component URLs and resource loading
- Reorder Vercel rewrites to prioritize component routes
- Add explicit JS and CSS route handling for SEO-friendly URLs
- Fix environment-specific resource loading in component.html
- Add debug logging for troubleshooting script loading issues

This resolves MIME type errors and ensures component.html loads
correctly for URLs like /component/agent/name in production.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 17:28:15 -04:00
Dani a6b9226cc0 fix routes vercel 2025-09-10 17:23:42 -04:00
Dani a3c0187e55 feat: component page improvements and SEO-friendly URLs
• Complete component page implementation with cart functionality
• Clean component names (remove .md/.json extensions in display)
• SEO-friendly URLs: /component/type/name format
• Local/production URL detection for development compatibility
• Improved header actions positioning and responsive design
• API keys setup (Anthropic + E2B) for sandbox execution
• Enhanced cart functionality with clean path/name display
• Share dropdown positioning fix (opens upward)
• Compact back navigation styling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 17:07:04 -04:00
Dani 41042d499f new CLAUDE.md and blog vercel routes 2025-09-02 09:15:15 -04:00
Dani 3a88de9e45 fix json 2025-08-27 23:53:13 -04:00
Dani e48f61e620 fix function vercel 2025-08-27 23:35:24 -04:00
Dani bf43cd68a4 vercel fix 2025-08-27 23:34:22 -04:00
Dani 54666aac92 fix: configure Vercel output directory
- Set output directory to 'docs' folder
- Add build command to skip unnecessary build step
- Maintain existing rewrite rules for proper routing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 14:37:53 -04:00
Dani 0e6ded1a4c fix: convert API to Vercel-compatible format
- Replace pool-based connection with @vercel/postgres sql template
- Use Vercel's auto-detection instead of explicit runtime config
- Convert all database queries to sql template literals
- Simplify table creation with proper error handling
- Maintain all functionality while ensuring Vercel compatibility

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 14:37:12 -04:00
Dani d6fc02b52f fix: update Vercel API configuration for proper deployment
- Fix runtime configuration to use @vercel/node instead of nodejs18.x
- Convert API to ES modules for Vercel compatibility
- Add package.json for API function dependencies
- Ensure proper module handling for @vercel/postgres

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 14:32:37 -04:00
Dani b5f5c49ec8 feat: add anonymous download tracking system with Vercel database integration
Implements a comprehensive download tracking system inspired by npm analytics
to monitor component usage and improve popular components.

Key features:
• Anonymous download tracking for all component types (agents, commands, mcps, settings, hooks)
• Vercel + PostgreSQL backend with dual endpoint strategy
• Privacy-first design with complete opt-out support
• Fire-and-forget tracking that never blocks user experience
• Comprehensive test suite and documentation

Backend changes:
• Created API endpoint /api/track-download.js with PostgreSQL integration
• Implemented proper database schema with download_stats aggregation
• Added request validation, rate limiting, and security measures
• Configured Vercel deployment with database functions

CLI changes:
• Enhanced TrackingService to support database + telemetry endpoints
• Added automatic tracking for all installation types
• Implemented graceful fallback when database is unavailable
• Maintains existing privacy and opt-out mechanisms

Testing & Documentation:
• Added comprehensive test suite (test-download-tracking.js)
• Created detailed documentation (DOWNLOAD_TRACKING.md)
• Included deployment instructions and troubleshooting guide
• Added security and compliance information

The system respects user privacy by:
- Only collecting anonymous usage metrics
- Providing multiple opt-out mechanisms (CCT_NO_TRACKING, CCT_NO_ANALYTICS, CI=true)
- Never storing personally identifiable information
- Using fire-and-forget requests with timeout limits

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-19 14:17:34 -04:00
Dani e66651c0c3 🚀 Major Performance Optimizations - Mobile Loading Issues Fixed
## Critical Issues Resolved:
- **Lazy loading**: Components.json now loads in 50-item batches instead of 1.6MB at once
- **Timeouts**: Added 8-second timeouts to prevent hanging fetches
- **Loading states**: Visual progress indicators for better UX
- **MutationObserver**: Optimized with debouncing and selective monitoring
- **Background loading**: Non-blocking progressive loading
- **Error handling**: Comprehensive fallbacks and user-friendly error messages

## Technical Improvements:
- RequestAnimationFrame instead of setTimeout for smoother animations
- Debounced DOM updates to prevent excessive reflows
- Intelligent caching with cache-friendly timestamps
- Progressive enhancement with fallback data
- Memory-efficient pagination system
- Performance-optimized CSS animations

## Mobile-Specific Fixes:
- Reduced initial payload from 1.6MB to ~200KB
- Prevented UI thread blocking during data parsing
- Added mobile-optimized loading states
- Improved error handling for slow connections

This should resolve the mobile freezing issues completely.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 13:57:26 -04:00
Dani 6fa212115a Add Vercel configuration for shopping cart deployment
- Configure static site deployment for docs/ folder
- Set up proper routing for SPA functionality
- Add security headers (X-Content-Type-Options, X-Frame-Options, X-XSS-Protection)
- Configure caching for static assets (JS/CSS)
- Enable filesystem routing with fallback to index.html
- Set project name as claude-code-templates-cart

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-06 10:53:15 -04:00