@jonit-dev/night-watch-cli 1.7.84 → 1.7.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -90,6 +90,14 @@ emit_result() {
90
90
  fi
91
91
  }
92
92
 
93
+ extract_review_score_from_text() {
94
+ local review_text="${1:-}"
95
+ printf '%s' "${review_text}" \
96
+ | grep -oP '(?:Overall\s+)?Score:\*?\*?\s*\d+/100' \
97
+ | tail -1 \
98
+ | grep -oP '\d+(?=/100)' || echo ""
99
+ }
100
+
93
101
  # ── Global Job Queue Gate ────────────────────────────────────────────────────
94
102
  # Acquire global gate before per-project lock to serialize jobs across projects.
95
103
  # When gate is busy, enqueue the job and exit cleanly.
@@ -393,10 +401,7 @@ get_pr_score() {
393
401
  fi
394
402
  } | sort -u
395
403
  )
396
- echo "${all_comments}" \
397
- | grep -oP 'Overall Score:\*?\*?\s*(\d+)/100' \
398
- | tail -1 \
399
- | grep -oP '\d+(?=/100)' || echo ""
404
+ extract_review_score_from_text "${all_comments}"
400
405
  }
401
406
 
402
407
  # Count failed CI checks for a PR.
@@ -645,10 +650,7 @@ while IFS=$'\t' read -r pr_number pr_branch; do
645
650
  fi
646
651
  } | sort -u
647
652
  )
648
- LATEST_SCORE=$(echo "${ALL_COMMENTS}" \
649
- | grep -oP 'Overall Score:\*?\*?\s*(\d+)/100' \
650
- | tail -1 \
651
- | grep -oP '\d+(?=/100)' || echo "")
653
+ LATEST_SCORE=$(extract_review_score_from_text "${ALL_COMMENTS}")
652
654
  if [ -n "${LATEST_SCORE}" ] && [ "${LATEST_SCORE}" -lt "${MIN_REVIEW_SCORE}" ]; then
653
655
  log "INFO: PR #${pr_number} (${pr_branch}) has review score ${LATEST_SCORE}/100 (threshold: ${MIN_REVIEW_SCORE})"
654
656
  NEEDS_WORK=1
@@ -686,10 +688,7 @@ if [ "${NEEDS_WORK}" -eq 0 ]; then
686
688
  fi
687
689
  } | sort -u
688
690
  )
689
- PR_SCORE=$(echo "${PR_COMMENTS}" \
690
- | grep -oP 'Overall Score:\*?\*?\s*(\d+)/100' \
691
- | tail -1 \
692
- | grep -oP '\d+(?=/100)' || echo "")
691
+ PR_SCORE=$(extract_review_score_from_text "${PR_COMMENTS}")
693
692
 
694
693
  # Skip PRs without a score or with score below threshold
695
694
  [ -z "${PR_SCORE}" ] && continue
@@ -915,9 +914,14 @@ if ! assert_isolated_worktree "${PROJECT_DIR}" "${REVIEW_WORKTREE_DIR}" "reviewe
915
914
  exit 1
916
915
  fi
917
916
 
918
- REVIEWER_PROMPT_PATH=$(resolve_instruction_path_with_fallback "${REVIEW_WORKTREE_DIR}" "pr-reviewer.md" "night-watch-pr-reviewer.md" || true)
917
+ SHARED_REVIEW_PROMPT_PATH="${REVIEW_WORKTREE_DIR}/.github/prompts/pr-review.md"
918
+ if [ -f "${SHARED_REVIEW_PROMPT_PATH}" ]; then
919
+ REVIEWER_PROMPT_PATH="${SHARED_REVIEW_PROMPT_PATH}"
920
+ else
921
+ REVIEWER_PROMPT_PATH=$(resolve_instruction_path_with_fallback "${REVIEW_WORKTREE_DIR}" "pr-reviewer.md" "night-watch-pr-reviewer.md" || true)
922
+ fi
919
923
  if [ -z "${REVIEWER_PROMPT_PATH}" ]; then
920
- log "FAIL: Missing reviewer prompt file. Checked pr-reviewer.md/night-watch-pr-reviewer.md in instructions/, .claude/commands/, and bundled templates/"
924
+ log "FAIL: Missing reviewer prompt file. Checked .github/prompts/pr-review.md plus pr-reviewer.md/night-watch-pr-reviewer.md in instructions/, .claude/commands/, and bundled templates/"
921
925
  emit_result "failure" "reason=missing_reviewer_prompt"
922
926
  exit 1
923
927
  fi
@@ -1225,10 +1229,7 @@ if [ "${AUTO_MERGE}" = "1" ] && [ ${EXIT_CODE} -eq 0 ]; then
1225
1229
  fi
1226
1230
  } | sort -u
1227
1231
  )
1228
- LATEST_SCORE=$(echo "${ALL_COMMENTS}" \
1229
- | grep -oP 'Overall Score:\*?\*?\s*(\d+)/100' \
1230
- | tail -1 \
1231
- | grep -oP '\d+(?=/100)' || echo "")
1232
+ LATEST_SCORE=$(extract_review_score_from_text "${ALL_COMMENTS}")
1232
1233
 
1233
1234
  # Skip PRs without a score
1234
1235
  if [ -z "${LATEST_SCORE}" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonit-dev/night-watch-cli",
3
- "version": "1.7.84",
3
+ "version": "1.7.85",
4
4
  "description": "Autonomous PRD execution using AI Provider CLIs + cron",
5
5
  "type": "module",
6
6
  "bin": {