/automation - GitHub PR Automation System Integration
Automates GitHub PR monitoring, processing, and safety limit management.
/plugin marketplace add jleechanorg/claude-commands/plugin install claude-commands@claude-commands-marketplaceWhen this command is invoked, YOU (Claude) must execute these steps immediately: This is NOT documentation - these are COMMANDS to execute right now. Use TodoWrite to track progress through multi-phase workflows.
Action Steps: Always run these checks before executing any other phase.
jleechanorg-pr-automation is installedpip install jleechanorg-pr-automationexport GITHUB_TOKEN="your_token_here"Action Steps:
Action Steps:
When: /automation status
import os
from pathlib import Path
data_dir = os.environ.get('AUTOMATION_SAFETY_DATA_DIR')
if not data_dir:
default_dir = Path.home() / "Library" / "Application Support" / "worldarchitect-automation"
default_dir.mkdir(parents=True, exist_ok=True)
data_dir = str(default_dir)
safety = AutomationSafetyManager(data_dir)
Action Steps:
When: /automation monitor [repository]
run_monitoring_cycle_with_actionable_count(target_actionable_count=20)Action Steps:
When: /automation process <pr_number> --repo <repository>
import os
from pathlib import Path
data_dir = os.environ.get('AUTOMATION_SAFETY_DATA_DIR')
if not data_dir:
default_dir = Path.home() / "Library" / "Application Support" / "worldarchitect-automation"
default_dir.mkdir(parents=True, exist_ok=True)
data_dir = str(default_dir)
safety = AutomationSafetyManager(data_dir)
# Then check: safety.can_process_pr(pr_number, repo)
run_monitoring_cycle_with_actionable_count(target_actionable_count=1)safety.record_pr_attempt(pr_number, result, repo)Action Steps:
When: /automation safety <subaction>
Subactions:
5a. Safety Check: /automation safety check
safety from Phase 2/4 when available)5b. Safety Clear: /automation safety clear
safety when already initialized)5c. Safety Check PR: /automation safety check-pr <pr_number> --repo <repository>
safety when already initialized)Action Steps: For complex operations (monitor, process with multiple PRs)
Purpose: Seamless integration of jleechanorg-pr-automation with Claude Code workflows
Installation: pip install jleechanorg-pr-automation
# Check automation system status
/automation status
# Monitor all repositories for actionable PRs
/automation monitor
# Monitor specific repository
/automation monitor your-project.com
# Process a specific PR
/automation process 123 --repo jleechanorg/your-project.com
# Check safety limits
/automation safety check
# Check if specific PR can be processed
/automation safety check-pr 123 --repo jleechanorg/your-project.com
# Clear all safety data (use with caution)
/automation safety clear
Set these environment variables in your shell profile or .env file:
# Required
export GITHUB_TOKEN="your_github_token_here"
# Optional - Safety Limits
export AUTOMATION_PR_LIMIT=5 # Max attempts per PR (default: 5)
export AUTOMATION_GLOBAL_LIMIT=50 # Max global runs (default: 50)
export AUTOMATION_APPROVAL_HOURS=24 # Approval expiry (default: 24)
# Optional - Custom Workspace
export PR_AUTOMATION_WORKSPACE="/custom/path"
# Optional - Email Notifications
export SMTP_SERVER="smtp.gmail.com"
export SMTP_PORT=587
export EMAIL_USER="your-email@gmail.com"
export EMAIL_PASS="your-app-password"
export EMAIL_TO="recipient@example.com"
Automatically trigger PR automation after push:
.claude/hooks/post-push.sh:
#!/bin/bash
# Automatically check for PRs after pushing
REPO=$(gh repo view --json nameWithOwner -q .nameWithOwner)
BRANCH=$(git branch --show-current)
PR_NUMBER=$(gh pr list --head "$BRANCH" --json number -q '.[0].number')
if [[ -n "$PR_NUMBER" ]]; then
echo "🤖 PR #$PR_NUMBER detected - triggering automation"
jleechanorg-pr-monitor --target-pr "$PR_NUMBER" --target-repo "$REPO"
fi
Add to crontab for hourly PR monitoring:
0 * * * * cd $(git rev-parse --show-toplevel) && jleechanorg-pr-monitor
The automation system includes comprehensive safety limits:
The automation command composes well with other Claude Code commands:
# Comprehensive PR workflow
/pr "implement user auth" && /automation monitor
# Review and automate
/copilot && /automation process $PR_NUMBER --repo $REPO
# Execute and monitor
/execute "add new feature" && /automation monitor
Direct CLI usage (outside Claude Code):
# Monitor all repositories
jleechanorg-pr-monitor
# Process specific repository
jleechanorg-pr-monitor --single-repo your-project.com
# Process specific PR
jleechanorg-pr-monitor --target-pr 123 --target-repo jleechanorg/your-project.com
# Dry run (discovery only)
jleechanorg-pr-monitor --dry-run
# Safety CLI
automation-safety-cli status
automation-safety-cli clear
automation-safety-cli check-pr 123 --repo my-repo
automation/README.mdautomation/AUTOMATION_SAFETY_LIMITS.mdautomation/JLEECHANORG_AUTOMATION.md