@jonit-dev/night-watch-cli 1.8.12-beta.7 → 1.8.12-beta.9

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.
@@ -1246,8 +1246,40 @@ or set primaryFallbackPreset / primaryFallbackModel in night-watch.config.json."
1246
1246
 
1247
1247
  # ── Board mode issue discovery ────────────────────────────────────────────────
1248
1248
 
1249
+ is_audit_board_issue_json() {
1250
+ local issue_json="${1:?issue_json required}"
1251
+
1252
+ printf '%s' "${issue_json}" \
1253
+ | jq -r '[.title // "", .body // ""] | join("\n")' 2>/dev/null \
1254
+ | grep -Eiq '(^|[[:space:]])Audit:|Night Watch audit detected|Report:[[:space:]]+`?logs/audit-report\.md`?|Finding:[[:space:]]+[0-9]+'
1255
+ }
1256
+
1257
+ is_audit_paused_or_disabled() {
1258
+ local cli_bin="${1:?cli_bin required}"
1259
+ local project_dir="${2:?project_dir required}"
1260
+
1261
+ if (cd "${project_dir}" && "${cli_bin}" job is-paused audit >/dev/null 2>&1); then
1262
+ return 0
1263
+ fi
1264
+
1265
+ local audit_enabled
1266
+ audit_enabled=$(
1267
+ cd "${project_dir}" \
1268
+ && "${cli_bin}" config get audit.enabled 2>/dev/null \
1269
+ | tr '[:upper:]' '[:lower:]' \
1270
+ | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//'
1271
+ ) || true
1272
+
1273
+ if [ "${audit_enabled}" = "false" ]; then
1274
+ return 0
1275
+ fi
1276
+
1277
+ return 1
1278
+ }
1279
+
1249
1280
  # Get the next eligible issue from the board provider.
1250
- # Iterates through Ready issues sorted by priority, skipping any in cooldown.
1281
+ # Iterates through Ready issues sorted by priority, skipping audit findings when
1282
+ # audit is disabled/paused and skipping any in cooldown.
1251
1283
  # Prints the JSON of the first eligible issue to stdout, or nothing if none found.
1252
1284
  # Returns 0 on success, 1 if no Ready issues were returned, 2 if Ready issues
1253
1285
  # were found but every candidate was skipped due to cooldown.
@@ -1295,6 +1327,16 @@ find_eligible_board_issue() {
1295
1327
  number=$(printf '%s' "${issue}" | jq -r '.number' 2>/dev/null)
1296
1328
  title=$(printf '%s' "${issue}" | jq -r '.title // empty' 2>/dev/null)
1297
1329
 
1330
+ # Skip stale audit findings while the audit job is paused/disabled. Audit
1331
+ # cron/config gates stop new scans, but Ready board issues can outlive them.
1332
+ if [ -n "${project_dir}" ] \
1333
+ && is_audit_board_issue_json "${issue}" \
1334
+ && is_audit_paused_or_disabled "${cli_bin}" "${project_dir}"; then
1335
+ log "SKIP-BOARD: Issue #${number} — audit issue skipped because audit is paused or disabled"
1336
+ i=$((i + 1))
1337
+ continue
1338
+ fi
1339
+
1298
1340
  # Derive PRD name (same slug format used by the cron script for history keys)
1299
1341
  prd_name="${number}-$(printf '%s' "${title}" | tr '[:upper:]' '[:lower:]' | tr -cs 'a-z0-9' '-' | sed 's/^-\|-$//g')"
1300
1342
 
@@ -105,7 +105,7 @@ get_review_score() {
105
105
  # Look for review score comment from night-watch
106
106
  local score
107
107
  score=$(gh pr view "${pr_number}" --json comments \
108
- --jq '[.comments[].body | select(test("review score|score:? [0-9]+/100"; "i")) | capture("(?i)score:? *(?<s>[0-9]+)/100") | .s] | last | tonumber // -1' \
108
+ --jq '[.comments[].body | select(test("score[^0-9]{0,30}[0-9]+/100"; "i")) | capture("(?i)score[^0-9]{0,30}(?<s>[0-9]+)/100") | .s] | last | tonumber // -1' \
109
109
  2>/dev/null || echo "-1")
110
110
  echo "${score}"
111
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonit-dev/night-watch-cli",
3
- "version": "1.8.12-beta.7",
3
+ "version": "1.8.12-beta.9",
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": {