@jonit-dev/night-watch-cli 1.8.12-beta.13 → 1.8.12-beta.14
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.
|
@@ -89,6 +89,26 @@ emit_result() {
|
|
|
89
89
|
fi
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
is_pr_open() {
|
|
93
|
+
local pr_number="${1:?PR number required}"
|
|
94
|
+
local pr_state=""
|
|
95
|
+
|
|
96
|
+
pr_state=$(gh pr view "${pr_number}" --json state --jq '.state // ""' 2>/dev/null || echo "")
|
|
97
|
+
case "${pr_state}" in
|
|
98
|
+
OPEN)
|
|
99
|
+
return 0
|
|
100
|
+
;;
|
|
101
|
+
MERGED|CLOSED)
|
|
102
|
+
return 1
|
|
103
|
+
;;
|
|
104
|
+
esac
|
|
105
|
+
|
|
106
|
+
# Backward-compatible fallback for older gh versions or tests that do not
|
|
107
|
+
# support the state field. Treat an unknown/empty state as open only when the
|
|
108
|
+
# PR is still viewable by number.
|
|
109
|
+
gh pr view "${pr_number}" --json number >/dev/null 2>&1
|
|
110
|
+
}
|
|
111
|
+
|
|
92
112
|
require_provider_on_path() {
|
|
93
113
|
if ! ensure_provider_on_path "${PROVIDER_CMD}"; then
|
|
94
114
|
echo "ERROR: Provider '${PROVIDER_CMD}' not found in PATH or common installation locations" >&2
|
|
@@ -720,7 +740,7 @@ fi
|
|
|
720
740
|
|
|
721
741
|
if [ -n "${TARGET_PR}" ]; then
|
|
722
742
|
OPEN_PRS=$(
|
|
723
|
-
if
|
|
743
|
+
if is_pr_open "${TARGET_PR}"; then
|
|
724
744
|
echo "1"
|
|
725
745
|
else
|
|
726
746
|
echo "0"
|
|
@@ -971,6 +991,7 @@ if [ -z "${TARGET_PR}" ] && [ "${WORKER_MODE}" != "1" ] && [ "${PARALLEL_ENABLED
|
|
|
971
991
|
EXIT_CODE=0
|
|
972
992
|
AUTO_MERGED_PRS=""
|
|
973
993
|
AUTO_MERGE_FAILED_PRS=""
|
|
994
|
+
ACTUAL_REVIEWED_PRS=""
|
|
974
995
|
NO_CHANGES_PRS=""
|
|
975
996
|
MAX_WORKER_ATTEMPTS=1
|
|
976
997
|
MAX_WORKER_FINAL_SCORE=""
|
|
@@ -1015,6 +1036,7 @@ if [ -z "${TARGET_PR}" ] && [ "${WORKER_MODE}" != "1" ] && [ "${PARALLEL_ENABLED
|
|
|
1015
1036
|
worker_status=$(printf '%s' "${worker_result}" | sed -n 's/^NIGHT_WATCH_RESULT:\([^|]*\).*$/\1/p')
|
|
1016
1037
|
worker_auto_merged=$(printf '%s' "${worker_result}" | grep -oP '(?<=auto_merged=)[^|]+' || true)
|
|
1017
1038
|
worker_auto_merge_failed=$(printf '%s' "${worker_result}" | grep -oP '(?<=auto_merge_failed=)[^|]+' || true)
|
|
1039
|
+
worker_reviewed_prs=$(printf '%s' "${worker_result}" | grep -oP '(?<=prs=)[^|]+' || true)
|
|
1018
1040
|
worker_attempts=$(printf '%s' "${worker_result}" | grep -oP '(?<=attempts=)[^|]+' || true)
|
|
1019
1041
|
worker_final_score=$(printf '%s' "${worker_result}" | grep -oP '(?<=final_score=)[^|]+' || true)
|
|
1020
1042
|
worker_no_changes=$(printf '%s' "${worker_result}" | grep -oP '(?<=no_changes_needed=)[^|]+' || true)
|
|
@@ -1022,6 +1044,9 @@ if [ -z "${TARGET_PR}" ] && [ "${WORKER_MODE}" != "1" ] && [ "${PARALLEL_ENABLED
|
|
|
1022
1044
|
|
|
1023
1045
|
AUTO_MERGED_PRS=$(append_csv "${AUTO_MERGED_PRS}" "${worker_auto_merged}")
|
|
1024
1046
|
AUTO_MERGE_FAILED_PRS=$(append_csv "${AUTO_MERGE_FAILED_PRS}" "${worker_auto_merge_failed}")
|
|
1047
|
+
if [ "${worker_status}" = "success_reviewed" ]; then
|
|
1048
|
+
ACTUAL_REVIEWED_PRS=$(append_csv "${ACTUAL_REVIEWED_PRS}" "${worker_reviewed_prs}")
|
|
1049
|
+
fi
|
|
1025
1050
|
NO_CHANGES_PRS=$(append_csv "${NO_CHANGES_PRS}" "${worker_no_changes_prs}")
|
|
1026
1051
|
if [ -z "${worker_no_changes_prs}" ] && [ "${worker_no_changes}" = "1" ]; then
|
|
1027
1052
|
NO_CHANGES_PRS=$(append_csv "${NO_CHANGES_PRS}" "#${worker_pr}")
|
|
@@ -1066,7 +1091,7 @@ if [ -z "${TARGET_PR}" ] && [ "${WORKER_MODE}" != "1" ] && [ "${PARALLEL_ENABLED
|
|
|
1066
1091
|
# worker runs may have left behind.
|
|
1067
1092
|
cleanup_reviewer_worktrees
|
|
1068
1093
|
|
|
1069
|
-
emit_final_status "${EXIT_CODE}" "${
|
|
1094
|
+
emit_final_status "${EXIT_CODE}" "${ACTUAL_REVIEWED_PRS}" "${AUTO_MERGED_PRS}" "${AUTO_MERGE_FAILED_PRS}" "${MAX_WORKER_ATTEMPTS}" "${MAX_WORKER_FINAL_SCORE}" "0" "${NO_CHANGES_PRS}"
|
|
1070
1095
|
exit "${EXIT_CODE}"
|
|
1071
1096
|
fi
|
|
1072
1097
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jonit-dev/night-watch-cli",
|
|
3
|
-
"version": "1.8.12-beta.
|
|
3
|
+
"version": "1.8.12-beta.14",
|
|
4
4
|
"description": "AI agent that implements your specs, opens PRs, and reviews code overnight. Queue GitHub issues or PRDs, wake up to pull requests.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|