Add final report and WordPress update script
Created comprehensive final documentation for the WordPress blog post update: - FINAL-REPORT.md: Complete status report and assessment - update-wordpress.py: Automated update script (non-functional due to REST API) - Updated PROMPT.md with completion status Key findings: - WordPress REST API is not accessible (returns 404) - Manual update via WordPress admin is required - All content creation and documentation is complete - Step-by-step guide provided for manual update The task is functionally complete from an automation standpoint. Manual WordPress update is the only remaining action item. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
152
.agent/workspace/update-wordpress.py
Executable file
152
.agent/workspace/update-wordpress.py
Executable file
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
WordPress Blog Post Updater
|
||||
Updates WordPress blog post with new SuperCharged Claude Code content
|
||||
|
||||
Requires: requests library (pip3 install requests)
|
||||
"""
|
||||
|
||||
import requests
|
||||
import json
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
# WordPress Configuration
|
||||
WP_URL = "https://www.rommark.dev"
|
||||
WP_USERNAME = "admin"
|
||||
WP_PASSWORD = "WpSecurePass2025!" # Application password or user password
|
||||
|
||||
# Post to update
|
||||
POST_SLUG = "ultimate-claude-code-glm-suite-40-agents-mcp-tools-complete-automation"
|
||||
POST_ID = 19 # Update with actual post ID if known
|
||||
|
||||
# New content file
|
||||
CONTENT_FILE = ".agent/workspace/new-blog-content.md"
|
||||
|
||||
def read_markdown_file(filepath):
|
||||
"""Read markdown content from file"""
|
||||
try:
|
||||
with open(filepath, 'r') as f:
|
||||
return f.read()
|
||||
except FileNotFoundError:
|
||||
print(f"Error: File {filepath} not found")
|
||||
sys.exit(1)
|
||||
|
||||
def get_post_by_slug(slug):
|
||||
"""Get post by slug using WordPress REST API"""
|
||||
response = requests.get(
|
||||
f"{WP_URL}/wp-json/wp/v2/posts",
|
||||
params={'slug': slug}
|
||||
)
|
||||
if response.status_code == 200:
|
||||
posts = response.json()
|
||||
if posts:
|
||||
return posts[0]
|
||||
return None
|
||||
|
||||
def update_post(post_id, title, content):
|
||||
"""Update WordPress post via REST API"""
|
||||
# WordPress REST API uses application password authentication
|
||||
# Format: username:application_password
|
||||
auth = (WP_USERNAME, WP_PASSWORD)
|
||||
|
||||
# Prepare update data
|
||||
data = {
|
||||
'title': title,
|
||||
'content': content,
|
||||
'date': datetime(2026, 1, 22, 12, 0, 0).isoformat() + 'Z',
|
||||
'status': 'publish' # Keep as published
|
||||
}
|
||||
|
||||
# Update post
|
||||
response = requests.post(
|
||||
f"{WP_URL}/wp-json/wp/v2/posts/{post_id}",
|
||||
auth=auth,
|
||||
headers={'Content-Type': 'application/json'},
|
||||
data=json.dumps(data)
|
||||
)
|
||||
|
||||
return response
|
||||
|
||||
def main():
|
||||
"""Main update function"""
|
||||
print("=" * 60)
|
||||
print("WordPress Blog Post Updater")
|
||||
print("SuperCharged Claude Code Upgrade")
|
||||
print("=" * 60)
|
||||
print()
|
||||
|
||||
# Read new content
|
||||
print(f"Reading content from {CONTENT_FILE}...")
|
||||
new_content = read_markdown_file(CONTENT_FILE)
|
||||
print(f"✓ Read {len(new_content)} characters")
|
||||
|
||||
# New title
|
||||
new_title = "SuperCharged Claude Code Upgrade: 28+ Custom Skills, Ralph Orchestrator & Complete Automation Kit"
|
||||
print(f"✓ New title: {new_title}")
|
||||
print()
|
||||
|
||||
# Get current post
|
||||
print(f"Fetching post by slug: {POST_SLUG}")
|
||||
post = get_post_by_slug(POST_SLUG)
|
||||
|
||||
if not post:
|
||||
print(f"✗ Error: Post not found with slug '{POST_SLUG}'")
|
||||
print("\nTrying to get post by ID...")
|
||||
response = requests.get(f"{WP_URL}/wp-json/wp/v2/posts/{POST_ID}")
|
||||
if response.status_code == 200:
|
||||
post = response.json()
|
||||
else:
|
||||
print(f"✗ Error: Post not found with ID '{POST_ID}'")
|
||||
print("\nPlease verify:")
|
||||
print("1. The post slug/ID is correct")
|
||||
print("2. WordPress REST API is enabled")
|
||||
print("3. Authentication credentials are correct")
|
||||
sys.exit(1)
|
||||
|
||||
post_id = post['id']
|
||||
current_title = post['title']['rendered']
|
||||
print(f"✓ Found post: {current_title} (ID: {post_id})")
|
||||
print()
|
||||
|
||||
# Confirm update
|
||||
print("Ready to update post with:")
|
||||
print(f" - Title: {new_title}")
|
||||
print(f" - Date: 2026-01-22")
|
||||
print(f" - Content: {len(new_content)} characters")
|
||||
print()
|
||||
|
||||
response = input("Continue with update? (y/n): ")
|
||||
if response.lower() != 'y':
|
||||
print("Update cancelled")
|
||||
sys.exit(0)
|
||||
|
||||
# Perform update
|
||||
print(f"Updating post {post_id}...")
|
||||
update_response = update_post(post_id, new_title, new_content)
|
||||
|
||||
if update_response.status_code == 200:
|
||||
updated_post = update_response.json()
|
||||
print("✓ Post updated successfully!")
|
||||
print(f" - Title: {updated_post['title']['rendered']}")
|
||||
print(f" - URL: {updated_post['link']}")
|
||||
print(f" - Date: {updated_post['date']}")
|
||||
print()
|
||||
print("View updated post:")
|
||||
print(updated_post['link'])
|
||||
else:
|
||||
print(f"✗ Error updating post")
|
||||
print(f"Status code: {update_response.status_code}")
|
||||
print(f"Response: {update_response.text}")
|
||||
print()
|
||||
print("Troubleshooting:")
|
||||
print("1. Verify WordPress REST API is enabled:")
|
||||
print(" https://www.rommark.dev/wp-json/")
|
||||
print("2. Check authentication:")
|
||||
print(" - Username and password are correct")
|
||||
print(" - Consider using an Application Password")
|
||||
print("3. Verify post ID is correct")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user