|
@@ -215,14 +215,29 @@ echo "Calling Claude Code with the issue information..."
|
|
|
echo "---"
|
|
echo "---"
|
|
|
|
|
|
|
|
# Call claude with the prompt in non-interactive mode
|
|
# Call claude with the prompt in non-interactive mode
|
|
|
-# --print: Non-interactive mode, prints output and exits
|
|
|
|
|
|
|
+# -p / --print: Non-interactive mode, prints output and exits
|
|
|
|
|
+# --output-format json: Get structured JSON output for programmatic parsing
|
|
|
# --dangerously-skip-permissions: Skip all permission prompts (safe in controlled environment)
|
|
# --dangerously-skip-permissions: Skip all permission prompts (safe in controlled environment)
|
|
|
# This allows Claude to run unattended without waiting for user input
|
|
# This allows Claude to run unattended without waiting for user input
|
|
|
-claude --print --dangerously-skip-permissions "$PROMPT"
|
|
|
|
|
-
|
|
|
|
|
|
|
+OUTPUT=$(claude -p "$PROMPT" --output-format json --dangerously-skip-permissions 2>&1)
|
|
|
EXIT_CODE=$?
|
|
EXIT_CODE=$?
|
|
|
|
|
|
|
|
echo "---"
|
|
echo "---"
|
|
|
echo "Claude Code execution completed (exit code: $EXIT_CODE)"
|
|
echo "Claude Code execution completed (exit code: $EXIT_CODE)"
|
|
|
|
|
|
|
|
|
|
+# Log the output for debugging
|
|
|
|
|
+if [ $EXIT_CODE -eq 0 ]; then
|
|
|
|
|
+ echo "Claude response received successfully"
|
|
|
|
|
+ # Parse JSON output to check for errors or important info
|
|
|
|
|
+ if command -v jq &> /dev/null; then
|
|
|
|
|
+ echo "Session details:"
|
|
|
|
|
+ echo "$OUTPUT" | jq -r '.sessionId, .cost, .duration' 2>/dev/null || echo "$OUTPUT"
|
|
|
|
|
+ else
|
|
|
|
|
+ echo "Output (first 500 chars): ${OUTPUT:0:500}"
|
|
|
|
|
+ fi
|
|
|
|
|
+else
|
|
|
|
|
+ echo "Error: Claude Code failed with exit code $EXIT_CODE"
|
|
|
|
|
+ echo "Output: $OUTPUT"
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
exit $EXIT_CODE
|
|
exit $EXIT_CODE
|