@@ -117,22 +117,30 @@ If you need to see specific files first, indicate which ones you need to examine
117117EOF
118118)
119119
120- # Run Claude CLI to analyze the issue using a temp file for the prompt
120+ # Run Claude CLI to analyze the issue
121121echo " Sending request to Claude for issue analysis..."
122122
123- # Create a temporary file for the prompt
123+ # Create a temporary file for the prompt for debugging
124124PROMPT_FILE=$( mktemp)
125125echo " $ANALYZE_PROMPT " > " $PROMPT_FILE "
126+ echo " Prompt saved to $PROMPT_FILE for debugging"
126127
127- # Use claude with the -f flag to read from a file
128- if ! claude -f " $PROMPT_FILE " > " $RESPONSE_FILE " ; then
128+ # Use claude with the -p flag (print) and -d (debug) and pipe input
129+ echo " Running: cat prompt | claude -p -d"
130+ if ! cat " $PROMPT_FILE " | claude -p -d > " $RESPONSE_FILE " 2> /tmp/claude_error_$ISSUE_NUMBER .log; then
129131 echo " Error: Claude API request failed. Check your API key and connectivity."
130- cat " $PROMPT_FILE " | head -20 # Show part of the prompt for debugging
132+ echo " Claude CLI version:"
133+ claude --version || echo " Failed to get version"
134+ echo " Error log (if available):"
135+ cat /tmp/claude_error_$ISSUE_NUMBER .log || echo " No error log available"
136+ echo " Prompt (first 20 lines):"
137+ cat " $PROMPT_FILE " | head -20
131138 exit 1
132139fi
133140
134- # Clean up the prompt file
135- rm -f " $PROMPT_FILE "
141+ # Keep prompt file for debugging
142+ echo " Prompt saved to $PROMPT_FILE for debugging"
143+ echo " Response saved to $RESPONSE_FILE "
136144
137145# Parse Claude's response to extract files to examine
138146FILES_TO_EXAMINE=$( grep -Eo " Files Involved:.*" -A 20 " $RESPONSE_FILE " | grep -v " Proposed Changes:" | grep -v " Testing Plan:" | grep " /" | sed -E ' s/^[ -]*([^ ].*)/\1/' | sed -E ' s/ *$//' | grep -v " ^$" )
@@ -182,21 +190,28 @@ If you need to create a completely new file, specify the full file path and prov
182190EOF
183191)
184192
185- # Run Claude CLI to implement the fix using a temp file for the prompt
193+ # Run Claude CLI to implement the fix
186194echo " Sending request to Claude for implementation details..."
187195
188- # Create a temporary file for the prompt
196+ # Create a temporary file for the prompt for debugging
189197IMPL_PROMPT_FILE=$( mktemp)
190198echo " $IMPLEMENT_PROMPT " > " $IMPL_PROMPT_FILE "
199+ echo " Implementation prompt saved to $IMPL_PROMPT_FILE for debugging"
191200
192- # Use claude with the -f flag to read from a file
193- if ! claude -f " $IMPL_PROMPT_FILE " > " $FIX_DETAILS_FILE " ; then
201+ # Use claude with the -p flag (print) and -d (debug) and pipe input
202+ echo " Running: cat prompt | claude -p -d for implementation details"
203+ if ! cat " $IMPL_PROMPT_FILE " | claude -p -d > " $FIX_DETAILS_FILE " 2> /tmp/claude_impl_error_$ISSUE_NUMBER .log; then
194204 echo " Error: Claude API request failed when generating implementation details."
205+ echo " Error log (if available):"
206+ cat /tmp/claude_impl_error_$ISSUE_NUMBER .log || echo " No implementation error log available"
207+ echo " Implementation prompt (first 20 lines):"
208+ cat " $IMPL_PROMPT_FILE " | head -20
195209 exit 1
196210fi
197211
198- # Clean up the prompt file
199- rm -f " $IMPL_PROMPT_FILE "
212+ # Keep prompt file for debugging
213+ echo " Implementation prompt saved to $IMPL_PROMPT_FILE for debugging"
214+ echo " Implementation response saved to $FIX_DETAILS_FILE "
200215
201216# Parse Claude's response to extract file paths and changes
202217FILES_TO_MODIFY=$( grep -o " For file [^ ]*:" " $FIX_DETAILS_FILE " | sed -E ' s/For file ([^:]*):$/\1/' )
0 commit comments