@@ -45,26 +45,32 @@ if ! LOC_STATS=$(git diff --stat "$DIFF_TARGET" 2>&1); then
4545fi
4646echo " $LOC_STATS "
4747
48- echo " Requesting Gemini feedback..."
48+ if [ " ${GEMINI_ENABLE_SLOP_CHECK:- true} " == " false" ]; then
49+ echo " ⚠️ Gemini slop check disabled via GEMINI_ENABLE_SLOP_CHECK" >&2
50+ # We still want to generate the report based on the regex detector if it ran,
51+ # but we skip the Gemini API call.
52+ echo " Gemini feedback skipped (disabled via environment variable)." > " $GEMINI_SLOP_LOG "
53+ else
54+ echo " Requesting Gemini feedback..."
4955
50- # Generate Diff (limit size to 100KB to be safe)
51- if [ -z " $DIFF_ERROR " ]; then
56+ # Generate Diff (limit size to 100KB to be safe)
57+ if [ -z " $DIFF_ERROR " ]; then
5258 # Capture diff to file, respecting size limit
5359 if ! git diff " $DIFF_TARGET " | head -c " $DIFF_MAX_SIZE " > " $DIFF_FILE " ; then
54- echo " Diff generation failed." > " $DIFF_FILE "
60+ echo " Diff generation failed." > " $DIFF_FILE "
5561 else
56- # Check if we hit the limit
57- ACTUAL_SIZE=$( wc -c < " $DIFF_FILE " )
58- if [ " $ACTUAL_SIZE " -ge " $DIFF_MAX_SIZE " ]; then
59- echo " ⚠️ Warning: Diff truncated to ${DIFF_MAX_SIZE} bytes." >&2
60- echo " ... (Diff truncated at ${DIFF_MAX_SIZE} bytes) ..." >> " $DIFF_FILE "
61- fi
62+ # Check if we hit the limit
63+ ACTUAL_SIZE=$( wc -c < " $DIFF_FILE " )
64+ if [ " $ACTUAL_SIZE " -ge " $DIFF_MAX_SIZE " ]; then
65+ echo " ⚠️ Warning: Diff truncated to ${DIFF_MAX_SIZE} bytes." >&2
66+ echo " ... (Diff truncated at ${DIFF_MAX_SIZE} bytes) ..." >> " $DIFF_FILE "
67+ fi
6268 fi
63- else
69+ else
6470 echo " Diff generation skipped due to previous error: $DIFF_ERROR " > " $DIFF_FILE "
65- fi
71+ fi
6672
67- cat > " $TASK_FILE " << EOF
73+ cat > " $TASK_FILE " << EOF
6874Review the following code changes for "slop" (low-quality, repetitive, or filler content).
6975We have already run a regex-based detector.
7076
@@ -86,20 +92,21 @@ Please provide a concise assessment of the changes.
8692Keep your response short and focused on quality/slop.
8793EOF
8894
89- if [ -z " $GEMINI_API_KEY " ]; then
90- echo " ⚠️ GEMINI_API_KEY not set. Skipping Gemini feedback." >&2
91- echo " Gemini feedback skipped (missing API key)." > " $GEMINI_SLOP_LOG "
92- else
93- echo " Invoking Gemini client..."
94- GEMINI_EXIT_CODE=0
95- pnpm tsx scripts/gemini-client.ts \
96- --task-file " $TASK_FILE " \
97- --context " $DIFF_FILE " \
98- --output " $GEMINI_SLOP_LOG " || GEMINI_EXIT_CODE=$?
99-
100- if [ $GEMINI_EXIT_CODE -ne 0 ]; then
101- echo " ⚠️ Gemini client failed. Continuing with available reports." >&2
102- echo " Gemini feedback unavailable (client failed)." > " $GEMINI_SLOP_LOG "
95+ if [ -z " $GEMINI_API_KEY " ]; then
96+ echo " ⚠️ GEMINI_API_KEY not set. Skipping Gemini feedback." >&2
97+ echo " Gemini feedback skipped (missing API key)." > " $GEMINI_SLOP_LOG "
98+ else
99+ echo " Invoking Gemini client..."
100+ GEMINI_EXIT_CODE=0
101+ pnpm tsx scripts/gemini-client.ts \
102+ --task-file " $TASK_FILE " \
103+ --context " $DIFF_FILE " \
104+ --output " $GEMINI_SLOP_LOG " || GEMINI_EXIT_CODE=$?
105+
106+ if [ $GEMINI_EXIT_CODE -ne 0 ]; then
107+ echo " ⚠️ Gemini client failed. Continuing with available reports." >&2
108+ echo " Gemini feedback unavailable (client failed)." > " $GEMINI_SLOP_LOG "
109+ fi
103110 fi
104111fi
105112
0 commit comments