mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Add What's New admin console and changelog script integration (#5804)
- Add CRUD handlers for managing what's-new entries stored in S3 - Add whats_new.html template with add/edit/delete forms - Add navigation link to layout.html - Add player-friendly summary generation to generate_changelog.sh - Add seed JSON file for initial data The admin console at /whats-new allows managing changelog entries that will be displayed to players in the Unity client. The script integration generates summaries and opens the admin console with pre-populated content after sending weekly changelogs. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -373,6 +373,115 @@ send_email_fastmail() {
|
||||
echo "Email sent successfully"
|
||||
}
|
||||
|
||||
# Generate player-friendly "What's New" summary
|
||||
# This creates a short summary suitable for in-game display
|
||||
generate_whats_new_summary() {
|
||||
local pr_file="$1"
|
||||
local output_file="/tmp/eagle0_whats_new_$$.txt"
|
||||
|
||||
echo "Generating player-friendly What's New summary..." >&2
|
||||
|
||||
# Create a prompt for player-facing summary
|
||||
local prompt_file="/tmp/eagle0_whats_new_prompt_$$.txt"
|
||||
|
||||
cat > "$prompt_file" <<'WHATS_NEW_PROMPT'
|
||||
Based on these merged PRs, write a SHORT player-friendly summary.
|
||||
Focus only on changes players will notice. Ignore internal/technical changes.
|
||||
|
||||
Output format (exactly this format, no markdown, no extra text):
|
||||
TITLE: (5-10 words describing the main change)
|
||||
DESCRIPTION: (1-2 sentences, what players can now do differently)
|
||||
CATEGORY: (one of: feature, improvement, fix, content)
|
||||
|
||||
If there are multiple notable player-visible changes, pick the single most important one.
|
||||
If there are no player-visible changes at all, output exactly: NONE
|
||||
|
||||
Examples of good output:
|
||||
TITLE: Bug Reporting
|
||||
DESCRIPTION: You can now report bugs directly from the Settings menu.
|
||||
CATEGORY: feature
|
||||
|
||||
TITLE: Faster Reconnection
|
||||
DESCRIPTION: The game now reconnects more smoothly after network interruptions.
|
||||
CATEGORY: improvement
|
||||
|
||||
Here are the merged PRs:
|
||||
|
||||
WHATS_NEW_PROMPT
|
||||
|
||||
cat "$pr_file" >> "$prompt_file"
|
||||
|
||||
# Use Claude CLI to generate the summary
|
||||
if ! command -v claude &> /dev/null; then
|
||||
echo "NONE"
|
||||
rm -f "$prompt_file"
|
||||
return
|
||||
fi
|
||||
|
||||
cat "$prompt_file" | claude --print > "$output_file" 2>/dev/null
|
||||
|
||||
rm -f "$prompt_file"
|
||||
|
||||
# Check if the output is NONE
|
||||
if grep -q "^NONE$" "$output_file"; then
|
||||
echo "NONE"
|
||||
rm -f "$output_file"
|
||||
return
|
||||
fi
|
||||
|
||||
# Return the output
|
||||
cat "$output_file"
|
||||
rm -f "$output_file"
|
||||
}
|
||||
|
||||
# URL encode a string for use in query parameters
|
||||
urlencode() {
|
||||
local string="$1"
|
||||
local strlen=${#string}
|
||||
local encoded=""
|
||||
local pos c o
|
||||
|
||||
for (( pos=0 ; pos<strlen ; pos++ )); do
|
||||
c=${string:$pos:1}
|
||||
case "$c" in
|
||||
[-_.~a-zA-Z0-9] ) o="${c}" ;;
|
||||
* ) printf -v o '%%%02x' "'$c"
|
||||
esac
|
||||
encoded+="${o}"
|
||||
done
|
||||
echo "${encoded}"
|
||||
}
|
||||
|
||||
# Open the admin console with pre-populated what's new content
|
||||
open_whats_new_preview() {
|
||||
local title="$1"
|
||||
local description="$2"
|
||||
local category="$3"
|
||||
|
||||
local encoded_title=$(urlencode "$title")
|
||||
local encoded_desc=$(urlencode "$description")
|
||||
local encoded_cat=$(urlencode "$category")
|
||||
|
||||
local preview_url="https://admin.eagle0.net/whats-new?preview=true&title=${encoded_title}&description=${encoded_desc}&category=${encoded_cat}"
|
||||
|
||||
echo ""
|
||||
echo "=== What's New Preview ==="
|
||||
echo "Title: $title"
|
||||
echo "Description: $description"
|
||||
echo "Category: $category"
|
||||
echo ""
|
||||
echo "Opening admin console preview..."
|
||||
|
||||
# Open the URL in the default browser
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
open "$preview_url"
|
||||
elif command -v xdg-open &> /dev/null; then
|
||||
xdg-open "$preview_url"
|
||||
else
|
||||
echo "Preview URL: $preview_url"
|
||||
fi
|
||||
}
|
||||
|
||||
# Update the tag to mark this run
|
||||
update_tag() {
|
||||
echo "Updating $TAG_NAME tag..."
|
||||
@@ -462,6 +571,26 @@ main() {
|
||||
|
||||
# Update tag for next run
|
||||
update_tag
|
||||
|
||||
# Generate player-friendly What's New summary and open admin preview
|
||||
echo ""
|
||||
echo "Generating What's New summary for in-game display..."
|
||||
whats_new_output=$(generate_whats_new_summary "$pr_file")
|
||||
|
||||
if [[ "$whats_new_output" != "NONE" ]]; then
|
||||
# Parse the output
|
||||
title=$(echo "$whats_new_output" | grep "^TITLE:" | sed 's/^TITLE:[[:space:]]*//')
|
||||
description=$(echo "$whats_new_output" | grep "^DESCRIPTION:" | sed 's/^DESCRIPTION:[[:space:]]*//')
|
||||
category=$(echo "$whats_new_output" | grep "^CATEGORY:" | sed 's/^CATEGORY:[[:space:]]*//')
|
||||
|
||||
if [[ -n "$title" && -n "$description" ]]; then
|
||||
open_whats_new_preview "$title" "$description" "$category"
|
||||
else
|
||||
echo "Could not parse What's New output, skipping preview"
|
||||
fi
|
||||
else
|
||||
echo "No player-visible changes detected, skipping What's New preview"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user