Automated code review service that combines LLM-powered diff analysis, voice-note transcription, and Discord notifications into a unified review pipeline.
logging modulepublish_skill() helper using the ClawHub CLIbash
# Set required environment variables
export OPENAI_API_KEY="sk-..."
export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..." # optional
# Run a review
python src/code_review_service.py
process_pull_request(pr_number, diff_url, voice_note_path=None)#End-to-end PR review: fetches diff, runs LLM analysis, optionally transcribes a voice note, and sends a Discord notification.
Returns a dict with keys: issues_found, suggestions, approval, summary, and optionally voice_note_transcription.
analyze_code_changes(diff_content)#Sends diff text to GPT-4o for analysis. Returns structured JSON with issues_found, suggestions, approval (approved/needs_changes/rejected), and summary.
transcribe_voice_note(audio_file_path)#Validates the audio file exists and is non-empty, then transcribes via Whisper-1. Returns the transcription text.
send_discord_notification(message, embed=None)#Posts a message (with optional rich embed) to the configured Discord webhook. Returns True on success.
publish_skill(skill_path, version)#Publishes a skill directory to ClawHub at the given version using the clawhub CLI.
VariableRequiredDefaultDescriptionOPENAI_API_KEYYes—OpenAI API key for GPT-4o and WhisperDISCORD_WEBHOOK_URLNo—Discord webhook URL for notificationsCLAWHUB_API_URLNohttps://api.clawhub.com/v1ClawHub API base URL
The included scripts/healthcheck.sh monitors nginx, docker, code-review-service, and whisper-api-gateway. It auto-restarts failed services and sends Discord alerts. Disk usage warnings trigger at 80% and critical alerts at 90%.
_validate_url() with scheme allowlist for all fetched URLsrequests calls (diff fetch + Discord webhook)except clauses with specific exception types ( requests.RequestException, FileNotFoundError, ValueError, json.JSONDecodeError)analyze_code_changes)logging module throughout; removed silent error swallowing