@jonit-dev/night-watch-cli 1.1.3 → 1.1.5
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.
- package/README.md +48 -426
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/doctor.d.ts +16 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +155 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +15 -9
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +10 -2
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/prd.d.ts +24 -0
- package/dist/commands/prd.d.ts.map +1 -0
- package/dist/commands/prd.js +283 -0
- package/dist/commands/prd.js.map +1 -0
- package/dist/commands/review.d.ts.map +1 -1
- package/dist/commands/review.js +28 -0
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/run.d.ts +19 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +64 -6
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +27 -6
- package/dist/commands/status.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +67 -1
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -1
- package/dist/templates/prd-template.d.ts +11 -0
- package/dist/templates/prd-template.d.ts.map +1 -0
- package/dist/templates/prd-template.js +166 -0
- package/dist/templates/prd-template.js.map +1 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/github.d.ts +30 -0
- package/dist/utils/github.d.ts.map +1 -0
- package/dist/utils/github.js +104 -0
- package/dist/utils/github.js.map +1 -0
- package/dist/utils/notify.d.ts +63 -0
- package/dist/utils/notify.d.ts.map +1 -0
- package/dist/utils/notify.js +237 -0
- package/dist/utils/notify.js.map +1 -0
- package/package.json +4 -4
- package/scripts/night-watch-cron.sh +13 -2
- package/scripts/night-watch-helpers.sh +51 -0
- package/scripts/test-helpers.bats +77 -0
- package/templates/prd.md +26 -0
package/README.md
CHANGED
|
@@ -10,6 +10,17 @@ Night Watch is a battle-tested autonomous PRD executor that uses AI provider CLI
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## Table of Contents
|
|
14
|
+
|
|
15
|
+
- [Quick Start](#quick-start)
|
|
16
|
+
- [Supported Providers](#supported-providers)
|
|
17
|
+
- [Using GLM-5 or Custom Endpoints](#using-glm-5-or-custom-endpoints)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Documentation](#documentation)
|
|
20
|
+
- [License](#license)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
13
24
|
## Quick Start
|
|
14
25
|
|
|
15
26
|
```bash
|
|
@@ -21,7 +32,7 @@ cd your-project
|
|
|
21
32
|
night-watch init
|
|
22
33
|
|
|
23
34
|
# 3. Check provider detection
|
|
24
|
-
night-watch run --dry-run
|
|
35
|
+
night-watch run --dry-run
|
|
25
36
|
|
|
26
37
|
# 4. Add your PRD files
|
|
27
38
|
echo "# My First PRD\n\nImplement feature X..." > docs/PRDs/night-watch/my-feature.md
|
|
@@ -35,472 +46,83 @@ night-watch install # Setup automated cron
|
|
|
35
46
|
|
|
36
47
|
## Supported Providers
|
|
37
48
|
|
|
38
|
-
Night Watch acts as a wrapper/orchestrator that calls CLI-based AI coding tools. The following providers are supported:
|
|
39
|
-
|
|
40
49
|
| Provider | CLI Command | Auto-Mode Flag | Slash Commands |
|
|
41
50
|
|----------|-------------|----------------|----------------|
|
|
42
51
|
| `claude` | `claude` | `--dangerously-skip-permissions` | `-p "/command-name"` |
|
|
43
52
|
| `codex` | `codex` | `--yolo` | `--prompt "text"` |
|
|
44
53
|
|
|
45
|
-
**Provider Detection:**
|
|
46
|
-
- Night Watch auto-detects your provider based on the `provider` field in `night-watch.config.json`
|
|
47
54
|
- Default provider is `claude`
|
|
48
|
-
- Change
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Installation
|
|
53
|
-
|
|
54
|
-
### npm (Recommended)
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npm install -g night-watch-cli
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### npx (No install)
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
npx night-watch-cli init
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### From Source
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
git clone https://github.com/joaopio/night-watch-cli.git
|
|
70
|
-
cd night-watch-cli
|
|
71
|
-
npm install
|
|
72
|
-
npm run build
|
|
73
|
-
npm link
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## Commands Reference
|
|
79
|
-
|
|
80
|
-
### `night-watch init`
|
|
81
|
-
|
|
82
|
-
Initialize Night Watch in your project. Creates all necessary directories, configuration files, and provider slash commands.
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
night-watch init # Initialize with defaults
|
|
86
|
-
night-watch init --force # Overwrite existing configuration
|
|
87
|
-
night-watch init --prd-dir docs/prds # Custom PRD directory
|
|
88
|
-
night-watch init --provider codex # Use codex provider
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**What it creates:**
|
|
92
|
-
- `docs/PRDs/night-watch/done/` — Directory for completed PRDs
|
|
93
|
-
- `docs/PRDs/night-watch/NIGHT-WATCH-SUMMARY.md` — Progress tracking file
|
|
94
|
-
- `logs/` — Log files directory (added to .gitignore)
|
|
95
|
-
- `.claude/commands/night-watch.md` — Claude slash command for PRD execution
|
|
96
|
-
- `.claude/commands/night-watch-pr-reviewer.md` — Claude slash command for PR review
|
|
97
|
-
- `night-watch.config.json` — Configuration file
|
|
98
|
-
|
|
99
|
-
**Prerequisites:**
|
|
100
|
-
- Git repository
|
|
101
|
-
- GitHub CLI (`gh`) authenticated
|
|
102
|
-
- Provider CLI installed (Claude CLI or Codex)
|
|
103
|
-
|
|
104
|
-
---
|
|
105
|
-
|
|
106
|
-
### `night-watch run`
|
|
107
|
-
|
|
108
|
-
Execute the PRD executor. Scans for eligible PRDs and implements them using the configured provider CLI.
|
|
109
|
-
|
|
110
|
-
```bash
|
|
111
|
-
night-watch run # Execute PRD executor
|
|
112
|
-
night-watch run --dry-run # Show what would be executed (with diagnostics)
|
|
113
|
-
night-watch run --provider codex # Override provider
|
|
114
|
-
night-watch run --timeout 3600 # Override max runtime (1 hour)
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
### `night-watch review`
|
|
120
|
-
|
|
121
|
-
Execute the PR reviewer. Finds open PRs on night-watch/ or feat/ branches, checks CI status and review scores, and fixes issues.
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
night-watch review # Execute PR reviewer
|
|
125
|
-
night-watch review --dry-run # Show PRs needing work (with diagnostics)
|
|
126
|
-
night-watch review --provider codex # Override provider
|
|
127
|
-
night-watch review --timeout 1800 # Override max runtime (30 min)
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
---
|
|
131
|
-
|
|
132
|
-
### `night-watch install`
|
|
133
|
-
|
|
134
|
-
Install crontab entries for automated execution.
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
night-watch install # Install with default schedules
|
|
138
|
-
night-watch install --schedule "0 * * * *" # Custom executor schedule
|
|
139
|
-
night-watch install --reviewer-schedule "0 */2 * * *" # Custom reviewer schedule
|
|
140
|
-
night-watch install --no-reviewer # Skip reviewer cron
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**Default Schedules:**
|
|
144
|
-
- Executor: `0 0-15 * * *` (hourly from midnight to 3pm UTC)
|
|
145
|
-
- Reviewer: `0 0,3,6,9,12,15 * * *` (every 3 hours)
|
|
55
|
+
- Change with `--provider codex` flag or `"provider": "codex"` in config
|
|
146
56
|
|
|
147
57
|
---
|
|
148
58
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
Remove crontab entries for the current project.
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
night-watch uninstall
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
---
|
|
59
|
+
## Using GLM-5 or Custom Endpoints
|
|
158
60
|
|
|
159
|
-
|
|
61
|
+
Night Watch supports passing custom environment variables to the provider CLI via the `providerEnv` config field. This lets you point the Claude CLI at any Anthropic-compatible endpoint — including **GLM-5**.
|
|
160
62
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
night-watch status # Basic status
|
|
165
|
-
night-watch status --verbose # Detailed status with log snippets
|
|
166
|
-
night-watch status --json # Output as JSON
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
**Status shows:**
|
|
170
|
-
- Process status (executor/reviewer running or not)
|
|
171
|
-
- PRD status (pending vs completed)
|
|
172
|
-
- PR status (open PRs on night-watch/feat branches)
|
|
173
|
-
- Crontab status (installed or not)
|
|
174
|
-
- Log file status (size, last lines)
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
### `night-watch logs`
|
|
179
|
-
|
|
180
|
-
View log output from executor and reviewer.
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
night-watch logs # View last 50 lines of all logs
|
|
184
|
-
night-watch logs -n 100 # View last 100 lines
|
|
185
|
-
night-watch logs --follow # Follow logs in real-time
|
|
186
|
-
night-watch logs --type run # View executor logs only
|
|
187
|
-
night-watch logs --type review # View reviewer logs only
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
## Configuration
|
|
193
|
-
|
|
194
|
-
Configuration is loaded in this order (later overrides earlier):
|
|
195
|
-
1. Default values
|
|
196
|
-
2. Config file (`night-watch.config.json`)
|
|
197
|
-
3. Environment variables
|
|
198
|
-
4. CLI flags
|
|
199
|
-
|
|
200
|
-
### Config File
|
|
201
|
-
|
|
202
|
-
Create `night-watch.config.json` in your project root:
|
|
63
|
+
Add `providerEnv` to your `night-watch.config.json`:
|
|
203
64
|
|
|
204
65
|
```json
|
|
205
66
|
{
|
|
206
|
-
"projectName": "my-project",
|
|
207
|
-
"defaultBranch": "main",
|
|
208
67
|
"provider": "claude",
|
|
209
|
-
"
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
"branchPrefix": "night-watch",
|
|
214
|
-
"branchPatterns": ["feat/", "night-watch/"],
|
|
215
|
-
"minReviewScore": 80,
|
|
216
|
-
"maxLogSize": 524288,
|
|
217
|
-
"cronSchedule": "0 0-15 * * *",
|
|
218
|
-
"reviewerSchedule": "0 0,3,6,9,12,15 * * *"
|
|
68
|
+
"providerEnv": {
|
|
69
|
+
"ANTHROPIC_API_KEY": "your-glm5-api-key",
|
|
70
|
+
"ANTHROPIC_BASE_URL": "https://your-glm5-endpoint.example.com"
|
|
71
|
+
}
|
|
219
72
|
}
|
|
220
73
|
```
|
|
221
74
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
**
|
|
225
|
-
|
|
226
|
-
| Variable | Config Key |
|
|
227
|
-
|----------|------------|
|
|
228
|
-
| `NW_PRD_DIR` | `prdDir` |
|
|
229
|
-
| `NW_MAX_RUNTIME` | `maxRuntime` |
|
|
230
|
-
| `NW_REVIEWER_MAX_RUNTIME` | `reviewerMaxRuntime` |
|
|
231
|
-
| `NW_BRANCH_PREFIX` | `branchPrefix` |
|
|
232
|
-
| `NW_BRANCH_PATTERNS` | `branchPatterns` (JSON array or comma-separated) |
|
|
233
|
-
| `NW_MIN_REVIEW_SCORE` | `minReviewScore` |
|
|
234
|
-
| `NW_MAX_LOG_SIZE` | `maxLogSize` |
|
|
235
|
-
| `NW_CRON_SCHEDULE` | `cronSchedule` |
|
|
236
|
-
| `NW_REVIEWER_SCHEDULE` | `reviewerSchedule` |
|
|
237
|
-
| `NW_PROVIDER` | `provider` |
|
|
238
|
-
|
|
239
|
-
### CLI Flags
|
|
240
|
-
|
|
241
|
-
Flags override all other configuration:
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
night-watch run --provider codex --timeout 3600
|
|
245
|
-
night-watch review --provider claude --timeout 1800
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## PRD Format
|
|
251
|
-
|
|
252
|
-
Night Watch looks for PRD files in `docs/PRDs/night-watch/` (configurable). PRDs are markdown files with optional dependency declarations.
|
|
253
|
-
|
|
254
|
-
### Basic PRD
|
|
255
|
-
|
|
256
|
-
```markdown
|
|
257
|
-
# Feature: User Authentication
|
|
258
|
-
|
|
259
|
-
## Overview
|
|
260
|
-
Implement user authentication using JWT tokens.
|
|
261
|
-
|
|
262
|
-
## Requirements
|
|
263
|
-
- [ ] Login endpoint
|
|
264
|
-
- [ ] Logout endpoint
|
|
265
|
-
- [ ] Token refresh
|
|
266
|
-
- [ ] Password hashing
|
|
267
|
-
|
|
268
|
-
## Acceptance Criteria
|
|
269
|
-
- Users can log in with email/password
|
|
270
|
-
- Tokens expire after 24 hours
|
|
271
|
-
- All endpoints have proper error handling
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### PRD with Dependencies
|
|
75
|
+
These variables are:
|
|
76
|
+
- **Injected into the provider CLI process** at runtime (`night-watch run`, `night-watch review`)
|
|
77
|
+
- **Exported in cron entries** when you run `night-watch install`, so automated runs also pick them up
|
|
78
|
+
- **Visible in `--dry-run` output** for easy debugging
|
|
275
79
|
|
|
276
|
-
|
|
277
|
-
# Feature: User Profile
|
|
80
|
+
### Common Use Cases
|
|
278
81
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
## Requirements
|
|
285
|
-
- [ ] Profile page
|
|
286
|
-
- [ ] Edit profile
|
|
287
|
-
- [ ] Avatar upload
|
|
288
|
-
```
|
|
82
|
+
| Use Case | Environment Variables |
|
|
83
|
+
|----------|----------------------|
|
|
84
|
+
| GLM-5 via custom endpoint | `ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL` |
|
|
85
|
+
| Proxy / VPN routing | `HTTPS_PROXY`, `HTTP_PROXY` |
|
|
86
|
+
| Custom model selection | Any provider-specific env var |
|
|
289
87
|
|
|
290
|
-
|
|
88
|
+
See [Configuration > Provider Environment](docs/configuration.md#provider-environment-providerenv) for full details.
|
|
291
89
|
|
|
292
90
|
---
|
|
293
91
|
|
|
294
|
-
##
|
|
295
|
-
|
|
296
|
-
### Architecture Overview
|
|
297
|
-
|
|
298
|
-
```
|
|
299
|
-
+-------------------------------------------------------------+
|
|
300
|
-
| Night Watch CLI |
|
|
301
|
-
| (Node.js wrapper for discoverability, config, distribution) |
|
|
302
|
-
+-------------------------------------------------------------+
|
|
303
|
-
|
|
|
304
|
-
v
|
|
305
|
-
+-------------------------------------------------------------+
|
|
306
|
-
| Bash Scripts |
|
|
307
|
-
| (Battle-tested core logic for PRD execution and review) |
|
|
308
|
-
| |
|
|
309
|
-
| +---------------------+ +--------------------------------+ |
|
|
310
|
-
| | night-watch-cron.sh | | night-watch-pr-reviewer-cron.sh | |
|
|
311
|
-
| | (PRD Executor) | | (PR Reviewer) | |
|
|
312
|
-
| +---------------------+ +--------------------------------+ |
|
|
313
|
-
| | | |
|
|
314
|
-
| +-----------+--------------+ |
|
|
315
|
-
| v |
|
|
316
|
-
| +-----------------------------+ |
|
|
317
|
-
| | night-watch-helpers.sh | |
|
|
318
|
-
| | (Shared utilities) | |
|
|
319
|
-
| +-----------------------------+ |
|
|
320
|
-
+-------------------------------------------------------------+
|
|
321
|
-
|
|
|
322
|
-
v
|
|
323
|
-
+-------------------------------------------------------------+
|
|
324
|
-
| External Tools |
|
|
325
|
-
| |
|
|
326
|
-
| +----------------+ +------------+ +------------------+ |
|
|
327
|
-
| | Provider CLI | | GitHub CLI | | Git Worktrees | |
|
|
328
|
-
| | (Claude/Codex) | | (PR mgmt) | | (Isolation) | |
|
|
329
|
-
| +----------------+ +------------+ +------------------+ |
|
|
330
|
-
+-------------------------------------------------------------+
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
### PRD Execution Flow
|
|
334
|
-
|
|
335
|
-
1. **Scan for PRDs** — Find markdown files in `docs/PRDs/night-watch/`
|
|
336
|
-
2. **Check dependencies** — Skip PRDs with unmet dependencies
|
|
337
|
-
3. **Check for open PRs** — Skip PRDs that already have an open PR
|
|
338
|
-
4. **Acquire lock** — Prevent concurrent executions
|
|
339
|
-
5. **Create worktree** — Isolate changes in a git worktree
|
|
340
|
-
6. **Launch Provider CLI** — Execute PRD using provider CLI with slash command
|
|
341
|
-
7. **Verify PR created** — Check that a PR was opened
|
|
342
|
-
8. **Mark done** — Move PRD to `done/` directory
|
|
343
|
-
9. **Cleanup** — Remove lock files and worktrees
|
|
344
|
-
|
|
345
|
-
### PR Review Flow
|
|
346
|
-
|
|
347
|
-
1. **Find open PRs** — Search for PRs on `night-watch/` or `feat/` branches
|
|
348
|
-
2. **Check CI status** — Identify failed checks
|
|
349
|
-
3. **Check review scores** — Find PRs with score < 80/100
|
|
350
|
-
4. **Acquire lock** — Prevent concurrent executions
|
|
351
|
-
5. **Launch Provider CLI** — Execute PR fix using provider CLI with slash command
|
|
352
|
-
6. **Cleanup** — Remove lock files
|
|
353
|
-
|
|
354
|
-
---
|
|
355
|
-
|
|
356
|
-
## Troubleshooting
|
|
357
|
-
|
|
358
|
-
### "Current directory is not a git repository"
|
|
359
|
-
|
|
360
|
-
Run `night-watch init` from the root of a git repository:
|
|
361
|
-
|
|
362
|
-
```bash
|
|
363
|
-
cd your-project
|
|
364
|
-
git init # if not already a git repo
|
|
365
|
-
night-watch init
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
### "GitHub CLI (gh) is not authenticated"
|
|
369
|
-
|
|
370
|
-
Authenticate with GitHub:
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
gh auth login
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### "Provider CLI is not available"
|
|
377
|
-
|
|
378
|
-
Install the appropriate provider CLI:
|
|
379
|
-
|
|
380
|
-
```bash
|
|
381
|
-
# Claude CLI
|
|
382
|
-
# Follow instructions at https://docs.anthropic.com/en/docs/claude-cli
|
|
383
|
-
|
|
384
|
-
# Codex CLI
|
|
385
|
-
# Follow instructions at https://github.com/openai/codex
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### "Night Watch is already installed"
|
|
389
|
-
|
|
390
|
-
Uninstall first, then reinstall:
|
|
391
|
-
|
|
392
|
-
```bash
|
|
393
|
-
night-watch uninstall
|
|
394
|
-
night-watch install
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
### "Lock file exists but process not running"
|
|
92
|
+
## Installation
|
|
398
93
|
|
|
399
|
-
|
|
94
|
+
### npm (Recommended)
|
|
400
95
|
|
|
401
96
|
```bash
|
|
402
|
-
|
|
97
|
+
npm install -g night-watch-cli
|
|
403
98
|
```
|
|
404
99
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
### Logs not being created
|
|
408
|
-
|
|
409
|
-
Ensure the logs directory exists and is writable:
|
|
100
|
+
### npx (No install)
|
|
410
101
|
|
|
411
102
|
```bash
|
|
412
|
-
|
|
413
|
-
chmod 755 logs
|
|
103
|
+
npx night-watch-cli init
|
|
414
104
|
```
|
|
415
105
|
|
|
416
|
-
###
|
|
417
|
-
|
|
418
|
-
Check:
|
|
419
|
-
1. PRD is in the correct directory (`docs/PRDs/night-watch/`)
|
|
420
|
-
2. Dependencies are satisfied (check `done/` directory)
|
|
421
|
-
3. No open PR exists for this PRD
|
|
422
|
-
4. Run `night-watch run --dry-run` to see what would be processed
|
|
423
|
-
|
|
424
|
-
---
|
|
425
|
-
|
|
426
|
-
## Contributing
|
|
427
|
-
|
|
428
|
-
### Development Setup
|
|
106
|
+
### From Source
|
|
429
107
|
|
|
430
108
|
```bash
|
|
431
|
-
git clone https://github.com/
|
|
109
|
+
git clone https://github.com/jonit-dev/night-watch-cli.git
|
|
432
110
|
cd night-watch-cli
|
|
433
|
-
npm install
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
### Build
|
|
437
|
-
|
|
438
|
-
```bash
|
|
439
|
-
npm run build
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
### Test
|
|
443
|
-
|
|
444
|
-
```bash
|
|
445
|
-
npm test
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### Run in Development
|
|
449
|
-
|
|
450
|
-
```bash
|
|
451
|
-
npm run dev -- init
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### Project Structure
|
|
455
|
-
|
|
456
|
-
```
|
|
457
|
-
night-watch-cli/
|
|
458
|
-
+-- bin/
|
|
459
|
-
| +-- night-watch.mjs # ESM entry point
|
|
460
|
-
+-- src/
|
|
461
|
-
| +-- cli.ts # CLI entry
|
|
462
|
-
| +-- config.ts # Config loader
|
|
463
|
-
| +-- types.ts # TypeScript types
|
|
464
|
-
| +-- constants.ts # Default values
|
|
465
|
-
| +-- commands/ # Command implementations
|
|
466
|
-
| | +-- init.ts
|
|
467
|
-
| | +-- run.ts
|
|
468
|
-
| | +-- review.ts
|
|
469
|
-
| | +-- install.ts
|
|
470
|
-
| | +-- uninstall.ts
|
|
471
|
-
| | +-- status.ts
|
|
472
|
-
| | +-- logs.ts
|
|
473
|
-
| +-- utils/
|
|
474
|
-
| +-- shell.ts # Shell execution
|
|
475
|
-
| +-- crontab.ts # Crontab management
|
|
476
|
-
+-- scripts/ # Bundled bash scripts
|
|
477
|
-
| +-- night-watch-cron.sh
|
|
478
|
-
| +-- night-watch-pr-reviewer-cron.sh
|
|
479
|
-
| +-- night-watch-helpers.sh
|
|
480
|
-
+-- templates/ # Template files
|
|
481
|
-
| +-- night-watch.md
|
|
482
|
-
| +-- night-watch-pr-reviewer.md
|
|
483
|
-
| +-- night-watch.config.json
|
|
484
|
-
+-- dist/ # Compiled output
|
|
111
|
+
npm install && npm run build && npm link
|
|
485
112
|
```
|
|
486
113
|
|
|
487
114
|
---
|
|
488
115
|
|
|
489
|
-
##
|
|
490
|
-
|
|
491
|
-
To publish a new version to npm:
|
|
492
|
-
|
|
493
|
-
```bash
|
|
494
|
-
# 1. Update version in package.json
|
|
495
|
-
# 2. Build and test
|
|
496
|
-
npm run build
|
|
497
|
-
npm test
|
|
498
|
-
|
|
499
|
-
# 3. Publish to npm (public access)
|
|
500
|
-
npm run publish:npm
|
|
501
|
-
```
|
|
116
|
+
## Documentation
|
|
502
117
|
|
|
503
|
-
|
|
118
|
+
| Document | Description |
|
|
119
|
+
|----------|-------------|
|
|
120
|
+
| [Commands Reference](docs/commands.md) | All CLI commands and their options |
|
|
121
|
+
| [Configuration](docs/configuration.md) | Config file, environment variables, CLI flags, `providerEnv`, notifications |
|
|
122
|
+
| [PRD Format](docs/prd-format.md) | How to write PRDs, dependencies, lifecycle |
|
|
123
|
+
| [Architecture](docs/architecture.md) | System design, execution flows, project structure |
|
|
124
|
+
| [Troubleshooting](docs/troubleshooting.md) | Common errors and how to fix them |
|
|
125
|
+
| [Contributing](docs/contributing.md) | Development setup, building, testing, publishing |
|
|
504
126
|
|
|
505
127
|
---
|
|
506
128
|
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,8 @@ import { installCommand } from './commands/install.js';
|
|
|
10
10
|
import { uninstallCommand } from './commands/uninstall.js';
|
|
11
11
|
import { statusCommand } from './commands/status.js';
|
|
12
12
|
import { logsCommand } from './commands/logs.js';
|
|
13
|
+
import { prdCommand } from './commands/prd.js';
|
|
14
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
13
15
|
// Get package.json version
|
|
14
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
17
|
const __dirname = dirname(__filename);
|
|
@@ -31,5 +33,9 @@ installCommand(program);
|
|
|
31
33
|
uninstallCommand(program);
|
|
32
34
|
statusCommand(program);
|
|
33
35
|
logsCommand(program);
|
|
36
|
+
// Register prd command
|
|
37
|
+
prdCommand(program);
|
|
38
|
+
// Register doctor command
|
|
39
|
+
doctorCommand(program);
|
|
34
40
|
program.parse();
|
|
35
41
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,2BAA2B;AAC3B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAC9D,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,kDAAkD,CAAC;KAC/D,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAEhC,wBAAwB;AACxB,WAAW,CAAC,OAAO,CAAC,CAAC;AAErB,uBAAuB;AACvB,UAAU,CAAC,OAAO,CAAC,CAAC;AAEpB,0BAA0B;AAC1B,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvB,4BAA4B;AAC5B,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAC1B,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,WAAW,CAAC,OAAO,CAAC,CAAC;AAErB,uBAAuB;AACvB,UAAU,CAAC,OAAO,CAAC,CAAC;AAEpB,0BAA0B;AAC1B,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doctor command for Night Watch CLI
|
|
3
|
+
* Validates webhook configuration and checks system health
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { WebhookConfig } from "../types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Validate a single webhook configuration and return a list of issues.
|
|
9
|
+
* Returns an empty array if the webhook is valid.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateWebhook(webhook: WebhookConfig): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Register the doctor command on the program
|
|
14
|
+
*/
|
|
15
|
+
export declare function doctorCommand(program: Command): void;
|
|
16
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAW5C;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,EAAE,CAmDhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAiGpD"}
|