Add version control and changelog system

 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 <noreply@anthropic.com>
This commit is contained in:
megaproxy 2025-07-14 00:01:54 +01:00
parent 47f160a295
commit e0edcb391a
3 changed files with 246 additions and 0 deletions

114
.version-control.py Normal file
View file

@ -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 <noreply@anthropic.com>"
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")

86
CHANGELOG.md Normal file
View file

@ -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 <pet>` - Catch wild pets
- `!battle` - Start combat
- `!attack <move>` - Use battle moves
- `!team` - View active pets
- `!pets` - Complete collection (web)
- `!travel <location>` - Move between areas
- `!weather` - Check current weather
- `!achievements` - View progress
- `!activate/deactivate <pet>` - Manage team
- `!swap <pet1> <pet2>` - 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

46
setup-github.sh Executable file
View file

@ -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"