A comprehensive Node.js project (terminal CLI tool) that combines GitHub stargazer analytics with an interactive cyberpunk-themed raffle system for selecting winners from your stargazers.
This project consists of two main components:
-
GitHub Stargazers Analytics (
github-stargazers.js) - Fetches and analyzes stargazers from GitHub repositories -
Cyberpunk Raffle System (
raffle-winner.js) - An interactive, animated raffle system for selecting winners
- API Integration: Fetches stargazer data from GitHub repositories
- Configurable Repository: Set target repository via environment variables
- Rate Limiting: Handles GitHub API rate limits gracefully
- Authentication: Supports both authenticated and unauthenticated requests
- Data Export: Generates JSON reports and summaries
- Advanced Filtering: Filter stargazers by date, time ranges, and timezone
- Timezone Support: Filter stargazers by specific timezones (UTC, regional, etc.)
- Time Range Filtering: Filter stargazers within specific time windows on a given date
- Interactive Validation: User confirmation for invalid timezones before processing
- Optimized Pagination: Efficient API usage with early termination
- Enhanced Error Handling: Comprehensive validation and user-friendly error messages
# Fetch all stargazers (requires GITHUB_TOKEN for private repos)
node github-stargazers.js
# Fetch with specific options
node github-stargazers.js --sort desc --limit 20
# Filter by specific date
node github-stargazers.js --date 2025-08-20
# Get just 5 most recent stargazers
node github-stargazers.js --limit 5# Filter stargazers by time range on a specific date
node github-stargazers.js --date 2025-02-26 --from 09:00 --to 17:00
# Filter with timezone support (UTC)
node github-stargazers.js --date 2025-02-26 --from 09:00 --to 17:00 --timezone UTC
# Filter with regional timezone (Eastern Time)
node github-stargazers.js --date 2025-02-26 --from 09:00 --to 17:00 --timezone America/New_York
# Filter with seconds precision
node github-stargazers.js --date 2025-02-26 --from 09:30:00 --to 18:30:00 --timezone Europe/London# Set target repository via environment variables (optional)
export STARGAZERS_REPO_OWNER="your_org_or_username"
export STARGAZERS_REPO_NAME="your_repository_name"
# Default repository: SolaceLabs/solace-agent-mesh
# Examples:
export STARGAZERS_REPO_OWNER="nodejs"
export STARGAZERS_REPO_NAME="node"# Set your GitHub token (required for private repos or higher rate limits)
export GITHUB_TOKEN="your_github_token_here"
# For organizations with SAML enforcement, authorize your token:
# 1. Go to https://github.com/settings/tokens
# 2. Find your token and click "Configure"
# 3. Grant access to the required organization--sort <asc|desc>: Sort order (default: desc)--limit <number>: Maximum number of stargazers to fetch--date <YYYY-MM-DD>: Filter stargazers by specific date--from <HH:MM[:SS]>: Filter from time (requires --date and --to)--to <HH:MM[:SS]>: Filter to time (requires --date and --from)--timezone <tz>: Timezone for time filtering (if not specified, local timezone will be used)--help: Show help information
- Time Range Required:
--fromand--tomust be used together - Date Required: Time filtering requires
--dateparameter - Timezone Support: Use standard IANA timezone identifiers
- Time Formats: Supports both
HH:MMandHH:MM:SSformats - Local Default: If no timezone specified, uses your machine's local timezone
UTC- Coordinated Universal TimeAmerica/New_York- Eastern Time (US)America/Los_Angeles- Pacific Time (US)Europe/London- British TimeEurope/Paris- Central European TimeAsia/Tokyo- Japan Standard TimeAsia/Shanghai- China Standard Time
๐ก Tip: For a complete list of valid timezone identifiers, visit: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
stargazers-detailed.json: Complete stargazer data with user profilesstargazers-report.json: Processed statistics and analyticsstargazers-summary-{timestamp}.json: Summary with usernames and datesparticipants.txt: Generated from stargazer data for raffle system
The script now includes comprehensive validation and user-friendly error messages:
- Unknown Options: Detects and reports unknown command-line options
- Invalid Parameters: Validates parameter values and formats
- Required Combinations: Ensures
--fromand--toare used together - Parameter Dependencies: Validates that time filtering requires date parameter
- Timezone Validation: Checks for valid timezone identifiers
# โ Invalid: Using --from without --to
node github-stargazers.js --date 2025-02-26 --from 09:00
# Error: --from and --to must be used together as a time range
# โ Invalid: Using time parameters without date
node github-stargazers.js --from 09:00 --to 17:00
# Error: --from and --to options can only be used with --date option
# โ Invalid: Unknown option
node github-stargazers.js --unknown-option
# Error: Unknown option '--unknown-option'
# โ Invalid: Invalid time format
node github-stargazers.js --date 2025-02-26 --from 25:00 --to 17:00
# Error: Invalid from time '25:00'. Must be HH:MM or HH:MM:SS format
# โ ๏ธ Interactive: Invalid timezone with user confirmation
node github-stargazers.js --date 2025-02-26 --from 09:00 --to 17:00 --timezone invalid
# Warning: Unknown timezone 'invalid'
# This will fall back to local timezone (Asia/Calcutta)
# Do you want to proceed with local timezone? (y/N):The script now includes interactive validation for invalid timezones:
- Early Detection: Invalid timezones are detected before any processing begins
- User Confirmation: Script asks for confirmation before proceeding
- Clear Information: Shows the invalid timezone and fallback timezone
- User Control: User can choose to proceed or cancel the operation
$ node github-stargazers.js --date 2025-02-26 --from 09:00 --to 17:00 --timezone invalid
โ ๏ธ Warning: Unknown timezone 'invalid'
This will fall back to local timezone (Asia/Calcutta)
Do you want to proceed with local timezone? (y/N): y
โ
Proceeding with local timezone...
๐ GitHub Stargazers Fetcher
...- Unauthenticated: 60 requests/hour
- Authenticated: 5,000 requests/hour
- SAML Organizations: Requires token authorization
- Interactive Animation: Cyberpunk-themed terminal animations
- ASCII Art Display: Beautiful ASCII art for winner names
- Configurable Rounds: Customizable number of elimination rounds
- Winner Tracking: Saves winners to prevent duplicate selections
- Frame-based UI: Terminal frame with cyberpunk styling
- Confetti Animation: Celebratory animations for winners
๐ก Pro Tip: For the best experience, run the raffle system in a full-screen terminal window. The cyberpunk animations, ASCII art display, and winner announcements work best with maximum terminal space. The animations are designed to fill the entire screen for maximum visual impact! ๐ฎ
# Run raffle with default settings (3 rounds)
node raffle-winner.js participants.txt
# Run with custom number of rounds
node raffle-winner.js participants.txt -rounds 5
# Interactive mode (press ENTER between stages)
node raffle-winner.js participants.txt -interactive
# Combine options
node raffle-winner.js participants.txt -rounds 1 -interactive-rounds <number>: Number of elimination rounds (default: 3)-interactive: Wait for key press between stagesparticipants.txt: File containing participant names (one per line)
Create a participants.txt file with one participant name per line. This can be:
Option 1: Direct output from GitHub Stargazers script
Option 2: Custom file with participant names
Alice Johnson
Bob Smith
Charlie Brown
Diana Prince
Eve Wilson
Note: The file can be either a direct output from the github-stargazers script (containing GitHub usernames) or a custom file with a list of names (newline-separated list).
- Welcome Animation: Cyberpunk-themed introduction
- Statistics Display: Shows total participants and previous winners
- Elimination Rounds: Progressive elimination with animations
- Final Countdown: Dramatic countdown to winner selection
- Confetti Celebration: Animated celebration with winner display
- ASCII Art Winner: Beautiful ASCII art display of winner name
- Winners are automatically saved to
raffle-winners.json - Previous winners are excluded from future raffles
- Option to reset the raffle when all participants have won
- Cyberpunk Wheel: Spinning wheel animation during selection
- Neural Scan: Sci-fi themed scanning animations
- Elimination Effects: Progressive elimination with visual feedback
- Confetti Burst: Celebratory particle effects
- ASCII Art: Custom ASCII art generation for winner names
- Node.js (v14 or higher)
- GitHub Personal Access Token (for stargazers analytics)
# Clone or download the project
git clone <repository-url>
cd github-stargazers
# No additional dependencies required - uses only Node.js built-ins๐บ Display Tip: For the best raffle experience, ensure your terminal window is in full-screen mode before running the raffle system. The cyberpunk animations and ASCII art are designed to utilize the entire terminal space for maximum visual impact!
# Set GitHub token for stargazers analytics
export GITHUB_TOKEN="your_github_token_here"
# Set target repository (optional - defaults to SolaceLabs/solace-agent-mesh)
export STARGAZERS_REPO_OWNER="your_org_or_username"
export STARGAZERS_REPO_NAME="your_repository_name"
# Create participants file for raffle
echo "Participant 1" > participants.txt
echo "Participant 2" >> participants.txt
echo "Participant 3" >> participants.txtgithub-stargazers/
โโโ README.md # This file
โโโ github-stargazers.js # Main stargazers analytics script
โโโ raffle-winner.js # Cyberpunk raffle system
โโโ github-stargazers-setup.md # Detailed setup guide
โโโ participants.txt # Raffle participants (create this)
โโโ raffle-winners.json # Generated: raffle winners
โโโ stargazers-detailed.json # Generated: detailed stargazer data
โโโ stargazers-report.json # Generated: analytics report
โโโ stargazers-summary-*.json # Generated: timestamped summaries
- Community Engagement: Track and reward your stargazers
- Analytics: Understand your project's growth and engagement
- Rewards: Run raffles to give back to your community
- Time-based Analysis: Analyze stargazer patterns during specific events or announcements
- Global Reach: Filter stargazers by timezone to understand international engagement
- Multi-Repository Analysis: Analyze stargazers from different repositories using environment variables
- Team Building: Use raffles for internal team events
- Community Management: Engage with your GitHub community
- Data Analysis: Analyze stargazer patterns and trends
- Business Hours Analysis: Filter stargazers during business hours in specific timezones
- Event Impact: Measure the impact of announcements or releases by time
- Conference Giveaways: Select winners from event participants
- Hackathon Prizes: Fair selection of contest winners
- Community Rewards: Reward active community members
- Time-limited Contests: Filter participants who engaged during specific contest periods
- Global Events: Analyze participation across different timezones for international events
- Set
STARGAZERS_REPO_OWNERandSTARGAZERS_REPO_NAMEenvironment variables - Adjust rate limiting and pagination settings
- Customize output formats and data processing
- Modify timezone validation and confirmation behavior
- Modify ASCII art characters in
createSmallAsciiArt() - Adjust animation timings and delays
- Customize cyberpunk themes and colors
- Add new elimination round types
# Error: API rate limit exceeded
# Solution: Wait for rate limit reset or use authenticated requests
export GITHUB_TOKEN="your_token_here"# Error: Resource protected by organization SAML enforcement
# Solution: Authorize your token for the organization
# Go to https://github.com/settings/tokens and configure organization access# Error: File not found: participants.txt
# Solution: Create the participants file
echo "Participant Name" > participants.txt- Optimized Pagination: Stops early when limit reached
- Batch Processing: Efficient API usage with delays
- Memory Efficient: Processes data in chunks
- Smooth Animations: 60fps terminal animations
- Responsive UI: Adapts to terminal size
- Fast Execution: Minimal delays for quick results
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
- GitHub API for providing stargazer data
- Node.js community for excellent documentation
- All the stargazers who make open source projects thrive!
Happy Raffling! ๐ฒโจ
