@jonit-dev/night-watch-cli 1.7.42 → 1.7.45

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.
Files changed (36) hide show
  1. package/dist/cli.js +2342 -2001
  2. package/dist/commands/audit.d.ts.map +1 -1
  3. package/dist/commands/audit.js +23 -9
  4. package/dist/commands/audit.js.map +1 -1
  5. package/dist/commands/dashboard/tab-actions.d.ts.map +1 -1
  6. package/dist/commands/dashboard/tab-actions.js +8 -6
  7. package/dist/commands/dashboard/tab-actions.js.map +1 -1
  8. package/dist/commands/dashboard/tab-schedules.d.ts.map +1 -1
  9. package/dist/commands/dashboard/tab-schedules.js +23 -16
  10. package/dist/commands/dashboard/tab-schedules.js.map +1 -1
  11. package/dist/commands/dashboard/types.d.ts +1 -1
  12. package/dist/commands/dashboard/types.d.ts.map +1 -1
  13. package/dist/commands/dashboard.d.ts.map +1 -1
  14. package/dist/commands/dashboard.js +11 -7
  15. package/dist/commands/dashboard.js.map +1 -1
  16. package/dist/commands/prs.js +1 -1
  17. package/dist/commands/prs.js.map +1 -1
  18. package/dist/commands/qa.d.ts.map +1 -1
  19. package/dist/commands/qa.js +10 -6
  20. package/dist/commands/qa.js.map +1 -1
  21. package/dist/commands/review.d.ts.map +1 -1
  22. package/dist/commands/review.js +12 -13
  23. package/dist/commands/review.js.map +1 -1
  24. package/dist/commands/run.d.ts +12 -0
  25. package/dist/commands/run.d.ts.map +1 -1
  26. package/dist/commands/run.js +139 -56
  27. package/dist/commands/run.js.map +1 -1
  28. package/dist/commands/slice.d.ts.map +1 -1
  29. package/dist/commands/slice.js +12 -8
  30. package/dist/commands/slice.js.map +1 -1
  31. package/dist/commands/status.js +1 -1
  32. package/dist/commands/status.js.map +1 -1
  33. package/dist/scripts/night-watch-cron.sh +8 -5
  34. package/dist/scripts/night-watch-pr-reviewer-cron.sh +10 -6
  35. package/dist/templates/night-watch-pr-reviewer.md +20 -9
  36. package/package.json +1 -1
@@ -286,8 +286,9 @@ MERGED_PR_COUNT=$(count_prs_for_branch merged "${BRANCH_NAME}")
286
286
  if [ "${MERGED_PR_COUNT}" -gt 0 ]; then
287
287
  log "INFO: Found merged PR for ${BRANCH_NAME}; skipping provider run"
288
288
  if [ -n "${ISSUE_NUMBER}" ]; then
289
- # Board mode: move issue to Done
290
- "${NW_CLI}" board move-issue "${ISSUE_NUMBER}" --column "Done" 2>>"${LOG_FILE}" || true
289
+ # Board mode: close issue and move to Done
290
+ "${NW_CLI}" board close-issue "${ISSUE_NUMBER}" 2>>"${LOG_FILE}" || \
291
+ "${NW_CLI}" board move-issue "${ISSUE_NUMBER}" --column "Done" 2>>"${LOG_FILE}" || true
291
292
  emit_result "success_already_merged" "prd=${ELIGIBLE_PRD}|branch=${BRANCH_NAME}"
292
293
  exit 0
293
294
  elif finalize_prd_done "already merged on ${BRANCH_NAME}"; then
@@ -420,13 +421,14 @@ if [ ${EXIT_CODE} -eq 0 ]; then
420
421
  OPEN_PR_COUNT=$(count_prs_for_branch open "${BRANCH_NAME}")
421
422
  if [ "${OPEN_PR_COUNT}" -gt 0 ]; then
422
423
  if [ -n "${ISSUE_NUMBER}" ]; then
423
- # Board mode: move to Review and comment with PR URL
424
+ # Board mode: comment with PR URL, then close issue and move to Done
424
425
  PR_URL=$(gh pr list --state open --json headRefName,url \
425
426
  --jq ".[] | select(.headRefName == \"${BRANCH_NAME}\") | .url" 2>/dev/null || true)
426
- "${NW_CLI}" board move-issue "${ISSUE_NUMBER}" --column "Review" 2>>"${LOG_FILE}" || true
427
427
  if [ -n "${PR_URL}" ]; then
428
428
  "${NW_CLI}" board comment "${ISSUE_NUMBER}" --body "PR opened: ${PR_URL}" 2>>"${LOG_FILE}" || true
429
429
  fi
430
+ "${NW_CLI}" board close-issue "${ISSUE_NUMBER}" 2>>"${LOG_FILE}" || \
431
+ "${NW_CLI}" board move-issue "${ISSUE_NUMBER}" --column "Done" 2>>"${LOG_FILE}" || true
430
432
  emit_result "success_open_pr" "prd=${ELIGIBLE_PRD}|branch=${BRANCH_NAME}"
431
433
  elif finalize_prd_done "implemented, PR opened on ${BRANCH_NAME}"; then
432
434
  emit_result "success_open_pr" "prd=${ELIGIBLE_PRD}|branch=${BRANCH_NAME}"
@@ -439,7 +441,8 @@ if [ ${EXIT_CODE} -eq 0 ]; then
439
441
  MERGED_PR_COUNT=$(count_prs_for_branch merged "${BRANCH_NAME}")
440
442
  if [ "${MERGED_PR_COUNT}" -gt 0 ]; then
441
443
  if [ -n "${ISSUE_NUMBER}" ]; then
442
- "${NW_CLI}" board move-issue "${ISSUE_NUMBER}" --column "Done" 2>>"${LOG_FILE}" || true
444
+ "${NW_CLI}" board close-issue "${ISSUE_NUMBER}" 2>>"${LOG_FILE}" || \
445
+ "${NW_CLI}" board move-issue "${ISSUE_NUMBER}" --column "Done" 2>>"${LOG_FILE}" || true
443
446
  emit_result "success_already_merged" "prd=${ELIGIBLE_PRD}|branch=${BRANCH_NAME}"
444
447
  elif finalize_prd_done "already merged on ${BRANCH_NAME}"; then
445
448
  emit_result "success_already_merged" "prd=${ELIGIBLE_PRD}|branch=${BRANCH_NAME}"
@@ -210,9 +210,12 @@ if [ "${NEEDS_WORK}" -eq 0 ]; then
210
210
  [ -z "${pr_number}" ] || [ -z "${pr_branch}" ] && continue
211
211
  printf '%s\n' "${pr_branch}" | grep -Eq "${BRANCH_REGEX}" || continue
212
212
 
213
- # Check CI status
214
- FAILED_CHECKS=$(gh pr checks "${pr_number}" 2>/dev/null | grep -ci 'fail' || true)
215
- [ "${FAILED_CHECKS}" -gt 0 ] && continue
213
+ # Check CI status - must have ALL checks passing (not just "no failures")
214
+ # gh pr checks exits 0 if all pass, 8 if pending, non-zero otherwise
215
+ if ! gh pr checks "${pr_number}" --required >/dev/null 2>&1; then
216
+ log "AUTO-MERGE: PR #${pr_number} has pending or failed CI checks"
217
+ continue
218
+ fi
216
219
 
217
220
  # Check review score
218
221
  PR_COMMENTS=$(
@@ -474,9 +477,10 @@ if [ "${AUTO_MERGE}" = "1" ] && [ ${EXIT_CODE} -eq 0 ]; then
474
477
  continue
475
478
  fi
476
479
 
477
- # Check CI status - must have no failures
478
- FAILED_CHECKS=$(gh pr checks "${pr_number}" 2>/dev/null | grep -ci 'fail' || true)
479
- if [ "${FAILED_CHECKS}" -gt 0 ]; then
480
+ # Check CI status - must have ALL checks passing (not just "no failures")
481
+ # gh pr checks exits 0 if all pass, 8 if pending, non-zero otherwise
482
+ if ! gh pr checks "${pr_number}" --required >/dev/null 2>&1; then
483
+ log "AUTO-MERGE: PR #${pr_number} has pending or failed CI checks"
480
484
  continue
481
485
  fi
482
486
 
@@ -105,22 +105,30 @@ A PR needs attention if **any** of the following: merge conflicts present, revie
105
105
  - Push the clean branch: `git push --force-with-lease origin <branch-name>`
106
106
  - **Do NOT leave any conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`) in any file.**
107
107
 
108
- d. **Address CI failures** (if any):
109
- - Read the failed job logs carefully to understand the root cause.
110
- - **typecheck failures**: Fix TypeScript type errors.
111
- - **lint failures**: Fix ESLint violations.
112
- - **test failures**: Fix broken tests or update tests to match code changes.
113
- - **build failures**: Fix compilation/bundling errors.
114
- - **verify failures**: This runs after all others -- usually means one of the above needs fixing.
115
-
116
- e. **Address review feedback** (if score < 80):
108
+ d. **Address review feedback** (if score < 80):
117
109
  - Read the review comments carefully. Extract areas for improvement, bugs found, issues found, and specific file/line suggestions.
110
+ - For each review suggestion:
111
+ - If you agree, implement the change.
112
+ - If you do not agree, do not implement it blindly. Capture a short technical reason and include that reason in the PR comment.
118
113
  - Fix bugs identified.
119
114
  - Improve error handling if flagged.
120
115
  - Add missing tests if coverage was noted.
121
116
  - Refactor code if structure was criticized.
122
117
  - Follow all project conventions from AI assistant documentation files (e.g., CLAUDE.md, AGENTS.md, or similar).
123
118
 
119
+ e. **Address CI failures** (if any):
120
+ - Check CI status and identify non-passing checks:
121
+ ```
122
+ gh pr checks <number> --json name,state,conclusion
123
+ ```
124
+ - Read the failed job logs carefully to understand the root cause.
125
+ - **typecheck failures**: Fix TypeScript type errors.
126
+ - **lint failures**: Fix ESLint violations.
127
+ - **test failures**: Fix broken tests or update tests to match code changes.
128
+ - **build failures**: Fix compilation/bundling errors.
129
+ - **verify failures**: This runs after all others -- usually means one of the above needs fixing.
130
+ - Re-run local equivalents of the failing jobs before pushing to confirm the CI issues are fixed.
131
+
124
132
  f. **Run verification**: Run the project's test/lint commands (e.g., `npm test`, `npm run lint`, `npm run verify` or equivalent). Fix until it passes.
125
133
 
126
134
  g. **Commit and push** the fixes (only if there are staged changes beyond the rebase):
@@ -157,6 +165,9 @@ A PR needs attention if **any** of the following: merge conflicts present, revie
157
165
  - <fix 1>
158
166
  - <fix 2>
159
167
 
168
+ <If any review suggestions were not applied>### Review Feedback Not Applied:
169
+ - <suggestion>: <short technical reason><end>
170
+
160
171
  <If CI was fixed>### CI Failures Fixed:
161
172
  - <job>: <what was wrong and how it was fixed><end>
162
173
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jonit-dev/night-watch-cli",
3
- "version": "1.7.42",
3
+ "version": "1.7.45",
4
4
  "description": "Autonomous PRD execution using AI Provider CLIs + cron",
5
5
  "type": "module",
6
6
  "bin": {