Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev # Start development server with nodemon (uses server-optimized.js) npm start # Start production server (uses server-optimized.js) npm run dev-worker # Start worker in development mode with nodemon npm run build # Update cache version for CSS/JS files
npm run start-worker # Start background scraper worker npm run test-worker # Test worker locally (same as start-worker)
# Test API endpoints curl "http://localhost:3000/api/status" curl "http://localhost:3000/api/divisions?filterEmpty=true" curl "http://localhost:3000/api/standings?division=9U-select&tier=all-tiers" # Enable debug mode in browser console localStorage.setItem('debugMode', 'true')
This is a Node.js web application that displays real-time baseball standings for York Simcoe Baseball Association (YSBA). The application uses Express for the server, vanilla JavaScript for the frontend, and relies entirely on pre-generated JSON files from GitHub Actions for data (no in-app scraping).
The application now includes a background worker system (
src/scraper/) that:
data/ysba.json, public/ysba.json)
- Main Express server handling all routes, API endpoints (serves cached JSON files only, no scraping)server-optimized.js
- GitHub Actions worker that orchestrates scraping, change detection, emails, and story generationscripts/github-action-scraper.js
- Modular Puppeteer-based scraping engine (extracted from original scraper.js)src/scraper/scraper.js
- Data formatting and structuring for clean JSON outputsrc/scraper/formatter.js
- File writing operations for JSON output to data/ and public/ directoriessrc/scraper/writer.js
- Multi-division configuration defining all divisions, tiers, and their settingsconfig.js
- Frontend application logic handling standings display, team schedules, and user interactionspublic/js/app.js
- SendGrid-powered email notification system with GitHub Gist backup for subscriber dataemail-service.js
- OpenAI-powered story generation system for homepage news contentai-story-service.js
The application supports multiple divisions with dynamic routing:
/{division}/{tier} (e.g., /13U-rep/A or /9U-select/all-tiers)Division configuration is centralized in
config.js using getDivisionConfig(division, tier).
Three-level caching system with 30-minute duration:
cachedDataByDivision[division-tier] - Main standings datateamScheduleCache[teamCode-division-tier] - Individual team schedulesallGamesCache[schedule-division-tier] - All games for background loadingScraping operations use
withBrowserSession() to coordinate Puppeteer instances and prevent conflicts. Only one browser session runs at a time.
Application Server (
server-optimized.js):
Background Worker (
scripts/github-action-scraper.js):
GET /api/standings?division=X&tier=Y - Get standings dataGET /api/divisions?filterEmpty=true - Get available divisionsGET /api/team/:teamCode/schedule?division=X&tier=Y - Get team scheduleGET /api/stories - Get pre-generated homepage storiesGET /api/status - Application health checkPOST /api/subscribe - Email subscriptionPOST /api/unsubscribe-token - Token-based unsubscribePOST /api/stories/generate - Manually trigger story generation (testing only)config.js - add division to appropriate section (rep/select)/?division=NEW-DIVISION&tier=TIER/api/standings endpointsrc/scraper/scraper.js - modify Puppeteer selectors/logicnpm run test-worker or npm run test-scraperpublic/js/app.jspublic/css/styles.cssnpm run build to update cache version for deploymentemail-service.js for email logic/api/subscribers/export for testing subscriber data