Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix: Resolve shell syntax errors in AI reviewer script

LearningCircuitcd0546d4cf71
diff --git a/github/scripts/ai-reviewer.sh b/github/scripts/ai-reviewer.sh
index 08d3baf81e..ff92865be2 100755
--- a/github/scripts/ai-reviewer.sh
+++ b/github/scripts/ai-reviewer.sh
@@ -2,8 +2,6 @@
# AI Code Reviewer Script - Comprehensive Review
# Usage: ./ai-reviewer.sh <DIFF_CONTENT> <API_KEY>
-# DIFF_CONTENT: The git diff content
-# API_KEY: OpenRouter API key
set -e
@@ -11,71 +9,38 @@ DIFF_CONTENT="$1"
API_KEY="$2"
if [ -z "$DIFF_CONTENT" ] || [ -z "$API_KEY" ]; then
- echo "Usage: $0 <DIFF_CONTENT> <API_KEY>"
+ echo '{"status":"fail","security_issues":[],"performance_issues":[],"quality_issues":[],"warnings":[{"type":"input","message":"Missing required parameters"}],"suggestions":[]}'
exit 1
fi
-# Comprehensive review prompt covering all aspects
-SYSTEM_PROMPT="You are a helpful code reviewer analyzing pull requests. Provide a comprehensive review covering security, performance, code quality, and best practices. Respond ONLY with valid JSON containing status, issues, warnings, and suggestions arrays."
-
-USER_PROMPT="Please analyze this code diff comprehensively and respond with JSON:
-
-Review Focus Areas:
-- Security: Look for hardcoded secrets, SQL injection, XSS, authentication issues, input validation problems
-- Performance: Check for inefficient algorithms, N+1 queries, missing indexes, memory issues, blocking operations
-- Code Quality: Evaluate readability, maintainability, proper error handling, naming conventions, documentation
-- Best Practices: Ensure adherence to coding standards, proper patterns, type safety, dead code removal
-
-Respond with this JSON format:
+# Create a temporary file with the request
+cat > request.json << EOF
{
- \"status\": \"pass|fail|warning\",
- \"security_issues\": [
- {\"type\": \"security\", \"file\": \"path\", \"line\": 42, \"message\": \"Security issue description\"}
- ],
- \"performance_issues\": [
- {\"type\": \"performance\", \"file\": \"path\", \"line\": 42, \"message\": \"Performance issue description\"}
- ],
- \"quality_issues\": [
- {\"type\": \"quality\", \"file\": \"path\", \"line\": 42, \"message\": \"Quality issue description\"}
+ "model": "z-ai/glm-4.6",
+ "messages": [
+ {
+ "role": "system",
+ "content": "You are a helpful code reviewer analyzing pull requests. Provide a comprehensive review covering security, performance, code quality, and best practices. Respond ONLY with valid JSON containing status, issues, warnings, and suggestions arrays."
+ },
+ {
+ "role": "user",
+ "content": "Please analyze this code diff comprehensively and respond with JSON:\n\nReview Focus Areas:\n- Security: Look for hardcoded secrets, SQL injection, XSS, authentication issues, input validation problems\n- Performance: Check for inefficient algorithms, N+1 queries, missing indexes, memory issues, blocking operations\n- Code Quality: Evaluate readability, maintainability, proper error handling, naming conventions, documentation\n- Best Practices: Ensure adherence to coding standards, proper patterns, type safety, dead code removal\n\nRespond with this JSON format:\n{\n \"status\": \"pass|fail|warning\",\n \"security_issues\": [\n {\"type\": \"security\", \"file\": \"path\", \"line\": 42, \"message\": \"Security issue description\"}\n ],\n \"performance_issues\": [\n {\"type\": \"performance\", \"file\": \"path\", \"line\": 42, \"message\": \"Performance issue description\"}\n ],\n \"quality_issues\": [\n {\"type\": \"quality\", \"file\": \"path\", \"line\": 42, \"message\": \"Quality issue description\"}\n ],\n \"warnings\": [\n {\"type\": \"general\", \"message\": \"General suggestion for improvement\"}\n ],\n \"suggestions\": [\n {\"type\": \"enhancement\", \"message\": \"Positive recommendation\"}\n ]\n}\n\nStatus logic:\n- \"fail\" = Critical security or performance issues that must be addressed\n- \"warning\" = Important issues that should be addressed but do not block merge\n- \"pass\" = No critical issues found (only suggestions and minor improvements)\n\nCode diff to analyze:\n$DIFF_CONTENT"
+ }
],
- \"warnings\": [
- {\"type\": \"general\", \"message\": \"General suggestion for improvement\"}
- ],
- \"suggestions\": [
- {\"type\": \"enhancement\", \"message\": \"Positive recommendation\"}
- ]
+ "temperature": 0.1,
+ "max_tokens": 2000
}
-
-Status logic:
-- \"fail\" = Critical security or performance issues that must be addressed
-- \"warning\" = Important issues that should be addressed but don't block merge
-- \"pass\" = No critical issues found (only suggestions and minor improvements)
-
-Code diff to analyze:
-$DIFF_CONTENT"
-
-FULL_USER_PROMPT="$USER_PROMPT"
+EOF
# Make API call to OpenRouter
RESPONSE=$(curl -s -X POST "https://openrouter.ai/api/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-H "HTTP-Referer: https://github.com/LearningCircuit/local-deep-research" \
- -d "{
- \"model\": \"z-ai/glm-4.6\",
- \"messages\": [
- {
- \"role\": \"system\",
- \"content\": \"$SYSTEM_PROMPT\"
- },
- {
- \"role\": \"user\",
- \"content\": \"$FULL_USER_PROMPT\"
- }
- ],
- \"temperature\": 0.1,
- \"max_tokens\": 2000
- }")
+ -d @request.json)
+
+# Clean up temporary file
+rm -f request.json
# Check if API call was successful
if [ -z "$RESPONSE" ]; then