@jonit-dev/night-watch-cli 1.7.60 → 1.7.63

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 (52) hide show
  1. package/dist/cli.js +999 -1764
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/audit.d.ts.map +1 -1
  4. package/dist/commands/audit.js +6 -2
  5. package/dist/commands/audit.js.map +1 -1
  6. package/dist/commands/cron.d.ts.map +1 -1
  7. package/dist/commands/cron.js +1 -81
  8. package/dist/commands/cron.js.map +1 -1
  9. package/dist/commands/init.d.ts.map +1 -1
  10. package/dist/commands/init.js +1 -4
  11. package/dist/commands/init.js.map +1 -1
  12. package/dist/commands/install.d.ts.map +1 -1
  13. package/dist/commands/install.js +26 -24
  14. package/dist/commands/install.js.map +1 -1
  15. package/dist/commands/qa.d.ts.map +1 -1
  16. package/dist/commands/qa.js +6 -2
  17. package/dist/commands/qa.js.map +1 -1
  18. package/dist/commands/queue.d.ts +8 -0
  19. package/dist/commands/queue.d.ts.map +1 -0
  20. package/dist/commands/queue.js +259 -0
  21. package/dist/commands/queue.js.map +1 -0
  22. package/dist/commands/review.d.ts.map +1 -1
  23. package/dist/commands/review.js +6 -2
  24. package/dist/commands/review.js.map +1 -1
  25. package/dist/commands/run.d.ts.map +1 -1
  26. package/dist/commands/run.js +10 -2
  27. package/dist/commands/run.js.map +1 -1
  28. package/dist/commands/shared/env-builder.d.ts +5 -2
  29. package/dist/commands/shared/env-builder.d.ts.map +1 -1
  30. package/dist/commands/shared/env-builder.js +23 -2
  31. package/dist/commands/shared/env-builder.js.map +1 -1
  32. package/dist/commands/slice.d.ts.map +1 -1
  33. package/dist/commands/slice.js +2 -1
  34. package/dist/commands/slice.js.map +1 -1
  35. package/dist/commands/uninstall.d.ts.map +1 -1
  36. package/dist/commands/uninstall.js +3 -1
  37. package/dist/commands/uninstall.js.map +1 -1
  38. package/dist/scripts/night-watch-audit-cron.sh +22 -0
  39. package/dist/scripts/night-watch-cron.sh +25 -1
  40. package/dist/scripts/night-watch-helpers.sh +166 -1
  41. package/dist/scripts/night-watch-pr-reviewer-cron.sh +24 -0
  42. package/dist/scripts/night-watch-qa-cron.sh +24 -2
  43. package/dist/scripts/night-watch-slicer-cron.sh +30 -2
  44. package/dist/scripts/publish.sh +61 -0
  45. package/dist/templates/audit.md +7 -0
  46. package/dist/templates/night-watch.config.json +13 -0
  47. package/dist/templates/qa.md +12 -0
  48. package/dist/web/assets/index-B3CnV08_.js +365 -0
  49. package/dist/web/assets/index-BIONU0qz.css +1 -0
  50. package/dist/web/assets/index-yKEQysks.js +365 -0
  51. package/dist/web/index.html +2 -2
  52. package/package.json +1 -1
@@ -3,6 +3,7 @@ You are the Night Watch Code Auditor. Your job is to scan the codebase for real
3
3
  ## What to look for
4
4
 
5
5
  ### 1) Critical runtime and security risks
6
+
6
7
  1. **Empty or swallowed catches** - `catch` blocks that discard meaningful errors in non-trivial paths.
7
8
  2. **Critical TODOs/FIXMEs/HACKs** - comments mentioning `bug`, `security`, `race`, `leak`, `crash`, `hotfix`, `rollback`, `unsafe`.
8
9
  3. **Hardcoded secrets or tokens** - API keys, passwords, tokens in source (exclude env var references).
@@ -10,12 +11,14 @@ You are the Night Watch Code Auditor. Your job is to scan the codebase for real
10
11
  5. **Unsafe type assertions** - `as any`, `as unknown as X`, dangerous non-null assertions (`!`) on uncertain input.
11
12
 
12
13
  ### 2) Scalability and performance hotspots
14
+
13
15
  1. **N+1 / repeated expensive work** - repeated DB/API/file operations in loops.
14
16
  2. **Unbounded processing** - full in-memory loading of large datasets, missing pagination/streaming/chunking.
15
17
  3. **Blocking work on hot paths** - sync I/O or CPU-heavy work in frequent request/loop paths.
16
18
  4. **Missing backpressure/limits** - unbounded queues, retries, fan-out, or concurrency.
17
19
 
18
20
  ### 3) Architecture and maintainability risks
21
+
19
22
  1. **Architecture violations** - business logic mixed into transport/UI/glue layers; hidden cross-layer dependencies.
20
23
  2. **SRP violations** - modules/functions/classes doing multiple unrelated responsibilities.
21
24
  3. **DRY violations** - duplicated logic likely to drift and cause inconsistent behavior.
@@ -34,10 +37,12 @@ You are the Night Watch Code Auditor. Your job is to scan the codebase for real
34
37
  ## How to scan
35
38
 
36
39
  Use file-reading/search tools and scan systematically, prioritizing:
40
+
37
41
  - `src/` (core TypeScript implementation)
38
42
  - `scripts/` (automation and shell execution paths)
39
43
 
40
44
  For each potential issue, verify:
45
+
41
46
  1. It is real and actionable.
42
47
  2. It has concrete impact (correctness, security, scalability, operability, maintainability).
43
48
  3. The fix direction is clear.
@@ -61,6 +66,7 @@ Generated: <ISO timestamp>
61
66
  ## Findings
62
67
 
63
68
  ### Finding 1
69
+
64
70
  - **Location**: `src/path/to/file.ts:42`
65
71
  - **Severity**: critical | high | medium | low
66
72
  - **Category**: empty_catch | critical_todo | hardcoded_secret | unhandled_promise | unsafe_assertion | scalability_hotspot | architecture_violation | srp_violation | dry_violation | kiss_violation | solid_violation | yagni_violation
@@ -69,6 +75,7 @@ Generated: <ISO timestamp>
69
75
  - **Suggested Fix**: Specific fix direction (minimal, pragmatic)
70
76
 
71
77
  ### Finding 2
78
+
72
79
  ...
73
80
  ```
74
81
 
@@ -21,6 +21,7 @@
21
21
  "cronSchedule": "0 0-21 * * *",
22
22
  "reviewerSchedule": "0 0,3,6,9,12,15,18,21 * * *",
23
23
  "cronScheduleOffset": 0,
24
+ "schedulingPriority": 3,
24
25
  "maxRetries": 3,
25
26
  "reviewerMaxRetries": 2,
26
27
  "reviewerRetryDelay": 30,
@@ -39,6 +40,18 @@
39
40
  "enabled": true,
40
41
  "provider": "github"
41
42
  },
43
+ "queue": {
44
+ "enabled": true,
45
+ "maxConcurrency": 1,
46
+ "maxWaitTime": 7200,
47
+ "priority": {
48
+ "executor": 50,
49
+ "reviewer": 40,
50
+ "slicer": 30,
51
+ "qa": 20,
52
+ "audit": 10
53
+ }
54
+ },
42
55
  "jobProviders": {},
43
56
  "autoMerge": false,
44
57
  "autoMergeMethod": "squash",
@@ -3,6 +3,7 @@ You are the Night Watch QA agent. Your job is to analyze open PRs, generate appr
3
3
  ## Context
4
4
 
5
5
  You are running inside a worktree checked out to a PR branch. Your goal is to:
6
+
6
7
  1. Analyze what changed in this PR compared to the base branch
7
8
  2. Determine if the changes are UI-related, API-related, or both
8
9
  3. Generate appropriate tests (Playwright e2e for UI, integration tests for API)
@@ -10,6 +11,7 @@ You are running inside a worktree checked out to a PR branch. Your goal is to:
10
11
  5. Commit the tests and artifacts, then comment on the PR with results
11
12
 
12
13
  ## Environment Variables Available
14
+
13
15
  - `NW_QA_ARTIFACTS` — What to capture: "screenshot", "video", or "both" (default: "both")
14
16
  - `NW_QA_AUTO_INSTALL_PLAYWRIGHT` — "1" to auto-install Playwright if missing
15
17
 
@@ -18,6 +20,7 @@ You are running inside a worktree checked out to a PR branch. Your goal is to:
18
20
  ### Step 1: Analyze the PR diff
19
21
 
20
22
  Get the diff against the base branch:
23
+
21
24
  ```
22
25
  git diff origin/${DEFAULT_BRANCH}...HEAD --name-only
23
26
  git diff origin/${DEFAULT_BRANCH}...HEAD --stat
@@ -28,6 +31,7 @@ Read the changed files to understand what the PR introduces.
28
31
  ### Step 2: Classify and Decide
29
32
 
30
33
  Based on the diff, determine:
34
+
31
35
  - **UI changes**: New/modified components, pages, layouts, styles, client-side logic
32
36
  - **API changes**: New/modified endpoints, controllers, services, middleware, database queries
33
37
  - **Both**: PR touches both UI and API code
@@ -36,6 +40,7 @@ Based on the diff, determine:
36
40
  ### Step 3: Prepare Test Infrastructure
37
41
 
38
42
  **For UI tests (Playwright):**
43
+
39
44
  1. Check if Playwright is available: `npx playwright --version`
40
45
  2. If not available and `NW_QA_AUTO_INSTALL_PLAYWRIGHT=1`:
41
46
  - Run `npm install -D @playwright/test` (or yarn/pnpm equivalent based on lockfile)
@@ -43,12 +48,14 @@ Based on the diff, determine:
43
48
  3. If not available and auto-install is disabled, skip UI tests and note in the report
44
49
 
45
50
  **For API tests:**
51
+
46
52
  - Use the project's existing test framework (vitest, jest, or mocha — detect from package.json)
47
53
  - If no test framework exists, use vitest
48
54
 
49
55
  ### Step 4: Generate Tests
50
56
 
51
57
  **UI Tests (Playwright):**
58
+
52
59
  - Create test files in `tests/e2e/qa/` (or the project's existing e2e directory)
53
60
  - Test the specific feature/page changed in the PR
54
61
  - Configure Playwright for artifacts based on `NW_QA_ARTIFACTS`:
@@ -59,6 +66,7 @@ Based on the diff, determine:
59
66
  - Include at minimum: navigation to the feature, interaction with key elements, visual assertions
60
67
 
61
68
  **API Tests:**
69
+
62
70
  - Create test files in `tests/integration/qa/` (or the project's existing test directory)
63
71
  - Test the specific endpoints changed in the PR
64
72
  - Include: happy path, error cases, validation checks
@@ -67,11 +75,13 @@ Based on the diff, determine:
67
75
  ### Step 5: Run Tests
68
76
 
69
77
  **UI Tests:**
78
+
70
79
  ```bash
71
80
  npx playwright test tests/e2e/qa/ --reporter=list
72
81
  ```
73
82
 
74
83
  **API Tests:**
84
+
75
85
  ```bash
76
86
  npx vitest run tests/integration/qa/ --reporter=verbose
77
87
  # (or equivalent for the project's test runner)
@@ -82,6 +92,7 @@ Capture the test output for the report.
82
92
  ### Step 6: Collect Artifacts
83
93
 
84
94
  Move Playwright artifacts (screenshots, videos) to `qa-artifacts/` in the project root:
95
+
85
96
  ```bash
86
97
  mkdir -p qa-artifacts
87
98
  # Copy from playwright-report/ or test-results/ to qa-artifacts/
@@ -150,6 +161,7 @@ Video artifact committed to \`qa-artifacts/\` — view in the PR's file changes.
150
161
  ```
151
162
 
152
163
  ### Important Rules
164
+
153
165
  - Process each PR **once** per run. Do NOT loop or retry after pushing.
154
166
  - Do NOT modify existing project tests — only add new files in `qa/` subdirectories.
155
167
  - If tests fail, still commit and report — the failures are useful information.