From e0edcb391a79193fc7a451005859129940e959d0 Mon Sep 17 00:00:00 2001 From: megaproxy Date: Mon, 14 Jul 2025 00:01:54 +0100 Subject: [PATCH] Add version control and changelog system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ Added automatic version management: - CHANGELOG.md with complete v0.1.0 history - Version control helper script for automated commits - GitHub setup script for easy repository connection - Semantic versioning support (Major.Minor.Patch) šŸ”„ Future workflow automation: - Automatic changelog updates - Descriptive commit messages - Version tagging for releases - Automatic GitHub pushes šŸ”§ Generated with Claude Code šŸ¤– Co-Authored-By: Claude --- .version-control.py | 114 ++++++++++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 86 +++++++++++++++++++++++++++++++++ setup-github.sh | 46 ++++++++++++++++++ 3 files changed, 246 insertions(+) create mode 100644 .version-control.py create mode 100644 CHANGELOG.md create mode 100755 setup-github.sh diff --git a/.version-control.py b/.version-control.py new file mode 100644 index 0000000..275e2ad --- /dev/null +++ b/.version-control.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python3 +""" +Version Control Helper for PetBot +Automatically manages commits, tags, and changelog updates +""" + +import subprocess +import sys +from datetime import datetime + +def run_command(cmd): + """Run a shell command and return output""" + try: + result = subprocess.run(cmd, shell=True, capture_output=True, text=True) + return result.returncode == 0, result.stdout.strip(), result.stderr.strip() + except Exception as e: + return False, "", str(e) + +def get_current_version(): + """Get the latest version tag""" + success, output, _ = run_command("git describe --tags --abbrev=0") + if success and output: + return output + return "v0.1.0" # Default if no tags + +def increment_version(version, increment_type="minor"): + """Increment version number""" + if version.startswith('v'): + version = version[1:] + + parts = version.split('.') + major, minor, patch = int(parts[0]), int(parts[1]), int(parts[2]) + + if increment_type == "major": + major += 1 + minor = 0 + patch = 0 + elif increment_type == "minor": + minor += 1 + patch = 0 + else: # patch + patch += 1 + + return f"v{major}.{minor}.{patch}" + +def update_changelog(version, changes): + """Update CHANGELOG.md with new version""" + date = datetime.now().strftime("%Y-%m-%d") + + new_entry = f""" +## [{version}] - {date} + +{changes} + +--- + +""" + + # Read current changelog + try: + with open("CHANGELOG.md", "r") as f: + content = f.read() + except FileNotFoundError: + content = "# Changelog\n\n" + + # Insert new entry after the header + lines = content.split('\n') + header_end = 0 + for i, line in enumerate(lines): + if line.startswith('## [v') or line.startswith('## Version History'): + header_end = i + break + + if header_end == 0: + # Add after initial header + for i, line in enumerate(lines): + if line.strip() == "" and i > 5: # Find first empty line after headers + header_end = i + break + + # Insert new content + lines.insert(header_end, new_entry.strip()) + + # Write back + with open("CHANGELOG.md", "w") as f: + f.write('\n'.join(lines)) + +def commit_and_tag(message, version, push=True): + """Create commit and tag""" + # Add all changes + run_command("git add .") + + # Create commit + commit_msg = f"{message}\n\nšŸ”§ Generated with Claude Code\nšŸ¤– Co-Authored-By: Claude " + success, _, error = run_command(f'git commit -m "{commit_msg}"') + + if not success and "nothing to commit" not in error: + print(f"Commit failed: {error}") + return False + + # Create tag + tag_msg = f"Release {version}: {message}" + run_command(f'git tag -a {version} -m "{tag_msg}"') + + # Push if requested + if push: + run_command("git push") + run_command("git push --tags") + + return True + +if __name__ == "__main__": + print("PetBot Version Control Helper") + print("This script is used internally by Claude Code") \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..15d2e35 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,86 @@ +# Changelog + +All notable changes to PetBot IRC Game will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v0.1.0] - 2025-07-13 + +### šŸŽ® Major Features Added +- **Complete IRC Pet Collection Game** - Pokemon-style gameplay in IRC +- **Dynamic Weather System** - Real-time weather affecting spawn rates +- **Web Dashboard** - Modern web interface for player stats and collections +- **Turn-Based Battles** - Strategic combat with type effectiveness +- **Multi-Location Exploration** - 6 themed locations with unique spawns +- **Achievement System** - Unlock new areas by completing challenges +- **Player Progression** - Experience, levels, and team management + +### šŸŒ¤ļø Weather System +- **Background Task System** - Automatic weather updates every 5 minutes +- **Dynamic Durations** - Weather lasts 30 minutes to 3 hours +- **6 Weather Types** - Each with unique spawn modifiers: + - Sunny (1.5x Fire/Grass) - 60-120 min + - Rainy (2.0x Water) - 45-90 min + - Thunderstorm (2.0x Electric) - 30-60 min + - Blizzard (1.7x Ice/Water) - 60-120 min + - Earthquake (1.8x Rock) - 30-90 min + - Calm (1.0x Normal) - 90-180 min +- **Continuous Coverage** - No more expired weather periods +- **Location-Specific** - Each location has appropriate weather patterns + +### šŸ› Bug Fixes +- **Database Persistence** - Players retain data after bot restarts +- **Player Page Display** - Fixed "player not found" errors on individual pages +- **Achievement Counts** - Corrected SQL query Cartesian product issue +- **Travel Requirements** - Added specific achievement requirement messages +- **Battle Move Colors** - Different colors for each move type for clarity +- **Locations Page** - Fixed column indexing and display issues + +### šŸ”§ Technical Implementation +- **Modular Architecture** - Clean separation of concerns +- **Async Database** - SQLite with aiosqlite for performance +- **Background Tasks** - Proper async task management +- **Error Handling** - Robust error handling throughout +- **Clean Shutdown** - Graceful cleanup of background tasks +- **PM Flood Prevention** - Web links instead of message spam + +### šŸ“Š Statistics +- **6,235+ lines of code** across 31 files +- **6 game locations** with unique spawns +- **15+ IRC commands** for gameplay +- **8 database tables** with relationships +- **Web server** with 5 main pages +- **Background weather task** running continuously + +### šŸŽÆ Commands Added +- `!start` - Begin your journey +- `!explore` - Find wild pets +- `!catch ` - Catch wild pets +- `!battle` - Start combat +- `!attack ` - Use battle moves +- `!team` - View active pets +- `!pets` - Complete collection (web) +- `!travel ` - Move between areas +- `!weather` - Check current weather +- `!achievements` - View progress +- `!activate/deactivate ` - Manage team +- `!swap ` - Reorganize team +- `!moves` - View pet abilities +- `!flee` - Escape battles + +--- + +## Version History + +### Versioning Scheme +- **Major.Minor.Patch** (e.g., v1.0.0) +- **Major**: Breaking changes or major feature releases +- **Minor**: New features, significant improvements +- **Patch**: Bug fixes, small improvements + +### Planned Releases +- **v0.2**: PvP battles between players +- **v0.3**: Pet evolution system +- **v0.4**: Trading system +- **v0.5**: Seasonal events and more locations \ No newline at end of file diff --git a/setup-github.sh b/setup-github.sh new file mode 100755 index 0000000..36a2d56 --- /dev/null +++ b/setup-github.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# GitHub Setup Script for PetBot +# Run this script after creating your GitHub repository + +echo "šŸš€ PetBot GitHub Setup" +echo "======================" + +# Check if we're in a git repository +if [ ! -d ".git" ]; then + echo "āŒ Error: Not in a git repository" + exit 1 +fi + +# Ask for GitHub repository URL +echo "šŸ“ Please enter your GitHub repository URL:" +echo " (e.g., https://github.com/yourusername/petbot-irc-game.git)" +read -p "URL: " REPO_URL + +if [ -z "$REPO_URL" ]; then + echo "āŒ Error: No URL provided" + exit 1 +fi + +# Add remote origin +echo "šŸ”— Adding GitHub remote..." +git remote add origin "$REPO_URL" + +# Push to GitHub +echo "ā¬†ļø Pushing to GitHub..." +git push -u origin main + +# Push tags +echo "šŸ·ļø Pushing tags..." +git push --tags + +echo "āœ… Setup complete!" +echo "" +echo "šŸŽÆ Your repository is now on GitHub:" +echo " Repository: $REPO_URL" +echo " Current version: v0.1.0" +echo "" +echo "šŸ”„ Future updates will be automatic:" +echo " - Claude will commit changes with descriptive messages" +echo " - Changelog will be updated automatically" +echo " - Version tags will be created for releases" +echo " - All changes will be pushed to GitHub" \ No newline at end of file