@jonit-dev/night-watch-cli 1.8.3 → 1.8.4-beta.1
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/dist/cli.js +776 -324
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +8 -12
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +101 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/plan.d.ts +19 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +88 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/prd.d.ts +8 -14
- package/dist/commands/prd.d.ts.map +1 -1
- package/dist/commands/prd.js +238 -145
- package/dist/commands/prd.js.map +1 -1
- package/dist/scripts/night-watch-plan-cron.sh +130 -0
- package/dist/scripts/publish.sh +94 -26
- package/dist/templates/pr-reviewer.md +1 -1
- package/dist/templates/prd-creator.md +330 -0
- package/dist/templates/prd-executor.md +1 -0
- package/dist/templates/qa.md +8 -4
- package/dist/templates/skills/_codex-block.md +58 -0
- package/dist/templates/skills/nw-add-issue.md +39 -0
- package/dist/templates/skills/nw-board-sync.md +47 -0
- package/dist/templates/skills/nw-create-prd.md +61 -0
- package/dist/templates/skills/nw-review.md +39 -0
- package/dist/templates/skills/nw-run.md +39 -0
- package/dist/templates/skills/nw-slice.md +33 -0
- package/dist/templates/skills/skills/_codex-block.md +58 -0
- package/dist/templates/skills/skills/nw-add-issue.md +39 -0
- package/dist/templates/skills/skills/nw-board-sync.md +47 -0
- package/dist/templates/skills/skills/nw-create-prd.md +61 -0
- package/dist/templates/skills/skills/nw-review.md +39 -0
- package/dist/templates/skills/skills/nw-run.md +39 -0
- package/dist/templates/skills/skills/nw-slice.md +33 -0
- package/dist/web/assets/index-Cp7RYjoy.css +1 -0
- package/dist/web/assets/index-DTsfDC7m.js +381 -0
- package/dist/web/assets/index-ZABWMEZR.js +381 -0
- package/dist/web/index.html +2 -2
- package/package.json +12 -3
package/dist/scripts/publish.sh
CHANGED
|
@@ -4,6 +4,14 @@ set -euo pipefail
|
|
|
4
4
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
|
5
5
|
CLI_PKG="$REPO_ROOT/packages/cli"
|
|
6
6
|
PROJECTS_FILE="$HOME/.night-watch/projects.json"
|
|
7
|
+
BETA=false
|
|
8
|
+
|
|
9
|
+
# Parse flags
|
|
10
|
+
for arg in "$@"; do
|
|
11
|
+
case $arg in
|
|
12
|
+
--beta) BETA=true ;;
|
|
13
|
+
esac
|
|
14
|
+
done
|
|
7
15
|
|
|
8
16
|
cd "$REPO_ROOT"
|
|
9
17
|
|
|
@@ -11,16 +19,70 @@ cd "$REPO_ROOT"
|
|
|
11
19
|
# Force all npm calls to use the official registry where the auth token is stored.
|
|
12
20
|
export npm_config_registry=https://registry.npmjs.org
|
|
13
21
|
|
|
22
|
+
CURRENT_VERSION=$(node -p "require('$CLI_PKG/package.json').version")
|
|
23
|
+
|
|
24
|
+
# Confirmation prompt
|
|
25
|
+
echo ""
|
|
26
|
+
if [[ "$BETA" == true ]]; then
|
|
27
|
+
echo " ┌─────────────────────────────────────────────────────────┐"
|
|
28
|
+
echo " │ BETA RELEASE │"
|
|
29
|
+
echo " │ │"
|
|
30
|
+
echo " │ Published to: npm tag @beta │"
|
|
31
|
+
echo " │ Install with: npm i -g @jonit-dev/night-watch-cli@beta │"
|
|
32
|
+
echo " │ Current version: $CURRENT_VERSION"
|
|
33
|
+
echo " └─────────────────────────────────────────────────────────┘"
|
|
34
|
+
echo ""
|
|
35
|
+
read -r -p " Publish beta release? [y/N] " confirm
|
|
36
|
+
else
|
|
37
|
+
echo " ┌─────────────────────────────────────────────────────────┐"
|
|
38
|
+
echo " │ STABLE (LATEST) RELEASE │"
|
|
39
|
+
echo " │ │"
|
|
40
|
+
echo " │ WARNING: This publishes to the @latest npm tag. │"
|
|
41
|
+
echo " │ All users running 'npm update' will receive this. │"
|
|
42
|
+
echo " │ │"
|
|
43
|
+
echo " │ Only proceed if this version is production-ready. │"
|
|
44
|
+
echo " │ Current version: $CURRENT_VERSION"
|
|
45
|
+
echo " └─────────────────────────────────────────────────────────┘"
|
|
46
|
+
echo ""
|
|
47
|
+
read -r -p " Publish stable release to ALL users? [y/N] " confirm
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
|
|
51
|
+
echo "Aborted."
|
|
52
|
+
exit 0
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo ""
|
|
14
56
|
echo "==> Running verify + tests..."
|
|
15
57
|
yarn verify && yarn test
|
|
16
58
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
59
|
+
# Version bumping
|
|
60
|
+
IFS='.' read -r major minor patch_full <<< "$CURRENT_VERSION"
|
|
61
|
+
|
|
62
|
+
if [[ "$BETA" == true ]]; then
|
|
63
|
+
# Strip any existing pre-release suffix from patch
|
|
64
|
+
patch="${patch_full%%-*}"
|
|
65
|
+
|
|
66
|
+
# Check if current version is already a beta of the next patch
|
|
67
|
+
if [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-beta\.([0-9]+)$ ]]; then
|
|
68
|
+
# Bump beta number: 1.8.4-beta.0 -> 1.8.4-beta.1
|
|
69
|
+
base="${BASH_REMATCH[1]}"
|
|
70
|
+
beta_num="${BASH_REMATCH[2]}"
|
|
71
|
+
NEW_VERSION="$base-beta.$((beta_num + 1))"
|
|
72
|
+
else
|
|
73
|
+
# Start new beta: 1.8.3 -> 1.8.4-beta.0
|
|
74
|
+
NEW_VERSION="$major.$minor.$((patch + 1))-beta.0"
|
|
75
|
+
fi
|
|
76
|
+
NPM_TAG="beta"
|
|
77
|
+
else
|
|
78
|
+
# Stable: strip any pre-release suffix and bump patch
|
|
79
|
+
patch="${patch_full%%-*}"
|
|
80
|
+
NEW_VERSION="$major.$minor.$((patch + 1))"
|
|
81
|
+
NPM_TAG="latest"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
echo "==> Bumping version: $CURRENT_VERSION -> $NEW_VERSION"
|
|
22
85
|
|
|
23
|
-
# Update package.json
|
|
24
86
|
node -e "
|
|
25
87
|
const fs = require('fs');
|
|
26
88
|
const pkg = JSON.parse(fs.readFileSync('$CLI_PKG/package.json', 'utf8'));
|
|
@@ -33,9 +95,9 @@ git add "$CLI_PKG/package.json"
|
|
|
33
95
|
git commit -m "chore: bump version to $NEW_VERSION"
|
|
34
96
|
git push origin master
|
|
35
97
|
|
|
36
|
-
echo "==> Publishing to npm..."
|
|
98
|
+
echo "==> Publishing to npm (tag: $NPM_TAG)..."
|
|
37
99
|
cd "$CLI_PKG"
|
|
38
|
-
npm publish --access public
|
|
100
|
+
npm publish --access public --tag "$NPM_TAG"
|
|
39
101
|
|
|
40
102
|
echo "==> Installing globally (waiting for registry propagation)..."
|
|
41
103
|
echo " Waiting 60s for npm registry to propagate..."
|
|
@@ -54,25 +116,31 @@ for attempt in 1 2 3 4 5; do
|
|
|
54
116
|
done
|
|
55
117
|
night-watch --version
|
|
56
118
|
|
|
57
|
-
|
|
58
|
-
if [[
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
projects
|
|
62
|
-
.filter(p => p.path && !p.path.startsWith('/tmp/'))
|
|
63
|
-
.forEach(p => {
|
|
64
|
-
console.log(' Project: ' + p.name + ' (' + p.path + ')');
|
|
65
|
-
const { execSync } = require('child_process');
|
|
66
|
-
try {
|
|
67
|
-
execSync('night-watch update --projects ' + p.path, { stdio: 'inherit' });
|
|
68
|
-
} catch (e) {
|
|
69
|
-
console.error(' WARN: update failed for ' + p.name);
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
"
|
|
119
|
+
# Only update registered projects for stable releases
|
|
120
|
+
if [[ "$BETA" == true ]]; then
|
|
121
|
+
echo ""
|
|
122
|
+
echo "==> Skipping project updates (beta release)."
|
|
73
123
|
else
|
|
74
|
-
echo "
|
|
124
|
+
echo "==> Updating registered projects (skipping /tmp/*)..."
|
|
125
|
+
if [[ -f "$PROJECTS_FILE" ]]; then
|
|
126
|
+
node -e "
|
|
127
|
+
const projects = JSON.parse(require('fs').readFileSync('$PROJECTS_FILE', 'utf8'));
|
|
128
|
+
projects
|
|
129
|
+
.filter(p => p.path && !p.path.startsWith('/tmp/'))
|
|
130
|
+
.forEach(p => {
|
|
131
|
+
console.log(' Project: ' + p.name + ' (' + p.path + ')');
|
|
132
|
+
const { execSync } = require('child_process');
|
|
133
|
+
try {
|
|
134
|
+
execSync('night-watch update --projects ' + p.path, { stdio: 'inherit' });
|
|
135
|
+
} catch (e) {
|
|
136
|
+
console.error(' WARN: update failed for ' + p.name);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
"
|
|
140
|
+
else
|
|
141
|
+
echo " No projects file found at $PROJECTS_FILE, skipping."
|
|
142
|
+
fi
|
|
75
143
|
fi
|
|
76
144
|
|
|
77
145
|
echo ""
|
|
78
|
-
echo "Done! Published $NEW_VERSION"
|
|
146
|
+
echo "Done! Published $NEW_VERSION (@$NPM_TAG)"
|
|
@@ -187,7 +187,7 @@ Parse the review score from the comment body. Look for patterns like:
|
|
|
187
187
|
<If CI was fixed>### CI Failures Fixed:
|
|
188
188
|
- <job>: <what was wrong and how it was fixed><end>
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
Verification passes locally. Ready for re-review.
|
|
191
191
|
|
|
192
192
|
Night Watch PR Reviewer"
|
|
193
193
|
```
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
You are a **Principal Software Architect**. Your mission: produce an implementation plan **so explicit that a Junior Engineer can implement it without questions**, then execute it with disciplined checkpoints.
|
|
2
|
+
|
|
3
|
+
When this activates: `Planning Mode: Principal Architect`
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 0: Complexity Assessment (REQUIRED FIRST)
|
|
8
|
+
|
|
9
|
+
Before writing ANY plan, determine complexity level:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
COMPLEXITY SCORE (sum all that apply):
|
|
13
|
+
+1 Touches 1-5 files
|
|
14
|
+
+2 Touches 6-10 files
|
|
15
|
+
+3 Touches 10+ files
|
|
16
|
+
+2 New system/module from scratch
|
|
17
|
+
+2 Complex state logic / concurrency
|
|
18
|
+
+2 Multi-package changes
|
|
19
|
+
+1 Database schema changes
|
|
20
|
+
+1 External API integration
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Score | Level | Template Mode |
|
|
24
|
+
| ----- | ------ | ----------------------------------------------- |
|
|
25
|
+
| 1-3 | LOW | Minimal (skip sections marked with MEDIUM/HIGH) |
|
|
26
|
+
| 4-6 | MEDIUM | Standard (all sections) |
|
|
27
|
+
| 7+ | HIGH | Full + mandatory checkpoints every phase |
|
|
28
|
+
|
|
29
|
+
**State at plan start:** `Complexity: [SCORE] → [LOW/MEDIUM/HIGH] mode`
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Pre-Planning (Do Before Writing)
|
|
34
|
+
|
|
35
|
+
1. **Explore:** Read all relevant files. Never guess. Reuse existing code (DRY). Take a look at config/env files for relevant variables — use the project's existing pattern for loading them (e.g., env.ts, config.ts), never access `process.env` directly unless that's already the project pattern.
|
|
36
|
+
2. **Verify:** Identify existing utilities, schemas, helpers.
|
|
37
|
+
3. **Impact:** List files touched, features affected, risks.
|
|
38
|
+
4. **Ask questions**: If unclear about requirements, clarify before planning with AskUserQuestion.
|
|
39
|
+
5. **Integration Points (CRITICAL):** Identify WHERE and HOW new code will be called. New code that isn't connected to existing flows is dead code.
|
|
40
|
+
6. **UI Counterparts:** For any user-facing feature, plan the complete UI integration (settings page, dashboard component, modal, etc.)
|
|
41
|
+
|
|
42
|
+
### Integration Points Checklist (REQUIRED)
|
|
43
|
+
|
|
44
|
+
Before writing ANY plan, answer these questions:
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
**How will this feature be reached?**
|
|
48
|
+
- [ ] Entry point identified: [e.g., route, event, cron, CLI command]
|
|
49
|
+
- [ ] Caller file identified: [file that will invoke this new code]
|
|
50
|
+
- [ ] Registration/wiring needed: [e.g., add route to router, register handler, add menu item]
|
|
51
|
+
|
|
52
|
+
**Is this user-facing?**
|
|
53
|
+
- [ ] YES → UI components required (list them)
|
|
54
|
+
- [ ] NO → Internal/background feature (explain how it's triggered)
|
|
55
|
+
|
|
56
|
+
**Full user flow:**
|
|
57
|
+
1. User does: [action]
|
|
58
|
+
2. Triggers: [what code path]
|
|
59
|
+
3. Reaches new feature via: [specific connection point]
|
|
60
|
+
4. Result displayed in: [where user sees outcome]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**If you cannot complete this checklist, the feature design is incomplete.**
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Plan Structure
|
|
68
|
+
|
|
69
|
+
### 1. Context (Keep Brief)
|
|
70
|
+
|
|
71
|
+
**Problem:** 1-sentence issue being solved.
|
|
72
|
+
|
|
73
|
+
**Files Analyzed:** List paths inspected.
|
|
74
|
+
|
|
75
|
+
**Current Behavior:** 3-5 bullets max.
|
|
76
|
+
|
|
77
|
+
### 2. Solution
|
|
78
|
+
|
|
79
|
+
**Approach:** 3-5 bullets explaining the chosen solution.
|
|
80
|
+
|
|
81
|
+
**Architecture Diagram** (MEDIUM/HIGH complexity):
|
|
82
|
+
|
|
83
|
+
```mermaid
|
|
84
|
+
flowchart LR
|
|
85
|
+
Client --> API --> Service --> DB[(Database)]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Key Decisions:**
|
|
89
|
+
|
|
90
|
+
- [ ] Library/framework choices
|
|
91
|
+
- [ ] Error-handling strategy
|
|
92
|
+
- [ ] Reused utilities
|
|
93
|
+
|
|
94
|
+
**Data Changes:** New schemas/migrations, or "None"
|
|
95
|
+
|
|
96
|
+
### 3. Sequence Flow (MEDIUM/HIGH complexity)
|
|
97
|
+
|
|
98
|
+
```mermaid
|
|
99
|
+
sequenceDiagram
|
|
100
|
+
participant C as Controller
|
|
101
|
+
participant S as Service
|
|
102
|
+
participant DB
|
|
103
|
+
C->>S: methodName(dto)
|
|
104
|
+
alt Error case
|
|
105
|
+
S-->>C: ErrorType
|
|
106
|
+
else Success
|
|
107
|
+
S->>DB: query
|
|
108
|
+
DB-->>S: result
|
|
109
|
+
S-->>C: Response
|
|
110
|
+
end
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## 4. Execution Phases
|
|
116
|
+
|
|
117
|
+
**CRITICAL RULES:**
|
|
118
|
+
|
|
119
|
+
1. Each phase = ONE user-testable vertical slice
|
|
120
|
+
2. Max 5 files per phase (split if larger)
|
|
121
|
+
3. Each phase MUST include concrete tests
|
|
122
|
+
4. **Checkpoint after each phase** (automated ALWAYS required, manual ADDITIONAL for HIGH when needed)
|
|
123
|
+
|
|
124
|
+
### Phase Template
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
#### Phase N: [Name] - [User-visible outcome in 1 sentence]
|
|
128
|
+
|
|
129
|
+
**Files (max 5):**
|
|
130
|
+
|
|
131
|
+
- `src/path/file.ts` - what changes
|
|
132
|
+
|
|
133
|
+
**Implementation:**
|
|
134
|
+
|
|
135
|
+
- [ ] Step 1
|
|
136
|
+
- [ ] Step 2
|
|
137
|
+
|
|
138
|
+
**Tests Required:**
|
|
139
|
+
| Test File | Test Name | Assertion |
|
|
140
|
+
|-----------|-----------|-----------|
|
|
141
|
+
| `src/__tests__/feature.test.ts` | `should do X when Y` | `expect(result).toBe(Z)` |
|
|
142
|
+
|
|
143
|
+
**User Verification:**
|
|
144
|
+
|
|
145
|
+
- Action: [what to do]
|
|
146
|
+
- Expected: [what should happen]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 5. Checkpoint Protocol
|
|
152
|
+
|
|
153
|
+
After completing each phase, execute the checkpoint review.
|
|
154
|
+
|
|
155
|
+
### Automated Checkpoint (ALL complexities - ALWAYS REQUIRED)
|
|
156
|
+
|
|
157
|
+
Spawn the `prd-work-reviewer` agent to perform automated review:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
Use Task tool with:
|
|
161
|
+
- subagent_type: "prd-work-reviewer"
|
|
162
|
+
- prompt: "Review checkpoint for phase [N] of PRD at [prd_path]"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The agent will:
|
|
166
|
+
|
|
167
|
+
1. Compare implementation against PRD requirements
|
|
168
|
+
2. Run the project's verification commands
|
|
169
|
+
3. Identify any drift from specifications
|
|
170
|
+
4. Report corrections needed
|
|
171
|
+
|
|
172
|
+
**Continue to next phase only when agent reports PASS.**
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Manual Checkpoint (HIGH complexity - ADDITIONAL to automated)
|
|
177
|
+
|
|
178
|
+
For phases requiring manual verification IN ADDITION to automated checks (e.g., visual UI changes, external integrations):
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
## PHASE [N] COMPLETE - CHECKPOINT
|
|
182
|
+
|
|
183
|
+
Files changed: [list]
|
|
184
|
+
Tests passing: [yes/no]
|
|
185
|
+
Verify: [pass/fail]
|
|
186
|
+
|
|
187
|
+
**Manual verification needed:**
|
|
188
|
+
1. [ ] [Specific test action → expected result]
|
|
189
|
+
|
|
190
|
+
Reply "continue" to proceed to Phase [N+1], or report issues.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### When to Add Manual Checkpoint (in addition to automated)
|
|
194
|
+
|
|
195
|
+
| Scenario | Checkpoint Type |
|
|
196
|
+
| ----------------------------- | ------------------------------ |
|
|
197
|
+
| API/backend changes | Automated only |
|
|
198
|
+
| Database migrations | Automated only |
|
|
199
|
+
| Business logic | Automated only |
|
|
200
|
+
| UI visual changes | Automated + Manual |
|
|
201
|
+
| External service integration | Automated + Manual |
|
|
202
|
+
| Performance-sensitive changes | Automated + Manual |
|
|
203
|
+
|
|
204
|
+
**Automated is ALWAYS required.** Add manual when automated verification alone is insufficient.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 6. Verification Strategy
|
|
209
|
+
|
|
210
|
+
### Philosophy: Don't Trust, VERIFY
|
|
211
|
+
|
|
212
|
+
The goal is **proving things work**, not just "writing tests". Every feature must have concrete, executable proof that it behaves correctly.
|
|
213
|
+
|
|
214
|
+
**Core principle:** Code without verification is a liability. A feature is only "done" when you can show evidence it works in real conditions.
|
|
215
|
+
|
|
216
|
+
### Verification Types (Use Multiple)
|
|
217
|
+
|
|
218
|
+
| Type | When to Use | Example |
|
|
219
|
+
|------|-------------|---------|
|
|
220
|
+
| **Unit Tests** | Pure logic, utilities, transformers | `expect(calculatePrice(100, 0.1)).toBe(90)` |
|
|
221
|
+
| **Integration Tests** | Service interactions, DB operations | Test service method with real/mocked DB |
|
|
222
|
+
| **API Tests (curl/httpie)** | Endpoints, auth flows, webhooks | `curl -X POST /api/endpoint -d '{"data":"test"}'` |
|
|
223
|
+
| **E2E Tests** | User flows, UI behavior, full journeys | Navigate → interact → assert |
|
|
224
|
+
| **Manual Verification** | Visual changes, external integrations | Screenshot comparison, third-party dashboard check |
|
|
225
|
+
|
|
226
|
+
### Phase Verification Template
|
|
227
|
+
|
|
228
|
+
Each phase MUST include a **Verification Plan**:
|
|
229
|
+
|
|
230
|
+
```markdown
|
|
231
|
+
**Verification Plan:**
|
|
232
|
+
|
|
233
|
+
1. **Unit Tests:**
|
|
234
|
+
- File: `tests/unit/feature.test.ts`
|
|
235
|
+
- Tests: `should X when Y`, `should handle Z error`
|
|
236
|
+
|
|
237
|
+
2. **Integration Test:**
|
|
238
|
+
- File: `tests/integration/feature.test.ts`
|
|
239
|
+
- Tests: `should persist data correctly`, `should rollback on failure`
|
|
240
|
+
|
|
241
|
+
3. **API Proof (curl command):**
|
|
242
|
+
```bash
|
|
243
|
+
curl -X POST http://localhost:3000/api/feature \
|
|
244
|
+
-H "Content-Type: application/json" \
|
|
245
|
+
-d '{"input": "test"}' | jq .
|
|
246
|
+
# Expected: {"success": true, "id": "..."}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
4. **Evidence Required:**
|
|
250
|
+
- [ ] All tests pass
|
|
251
|
+
- [ ] curl commands return expected responses
|
|
252
|
+
- [ ] Verify command passes
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Verification Checklist by Feature Type
|
|
256
|
+
|
|
257
|
+
**API Endpoint:**
|
|
258
|
+
- [ ] Unit test for request validation
|
|
259
|
+
- [ ] Integration test for business logic
|
|
260
|
+
- [ ] curl command with expected response documented
|
|
261
|
+
- [ ] Error cases tested (400, 401, 403, 404, 500)
|
|
262
|
+
|
|
263
|
+
**Database Change:**
|
|
264
|
+
- [ ] Migration runs without error
|
|
265
|
+
- [ ] Rollback works
|
|
266
|
+
- [ ] Data integrity constraints tested
|
|
267
|
+
|
|
268
|
+
**UI Feature:**
|
|
269
|
+
- [ ] Component renders correctly (unit/snapshot test)
|
|
270
|
+
- [ ] User flow works E2E
|
|
271
|
+
- [ ] Loading and error states handled
|
|
272
|
+
|
|
273
|
+
**Background Job/Cron:**
|
|
274
|
+
- [ ] Job executes successfully
|
|
275
|
+
- [ ] Failure handling tested
|
|
276
|
+
- [ ] Idempotency verified (safe to re-run)
|
|
277
|
+
|
|
278
|
+
### Test Naming Convention
|
|
279
|
+
|
|
280
|
+
`should [expected behavior] when [condition]`
|
|
281
|
+
|
|
282
|
+
Examples:
|
|
283
|
+
- `should return 401 when token is missing`
|
|
284
|
+
- `should create user when valid data provided`
|
|
285
|
+
- `should rollback transaction when payment fails`
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## 7. Acceptance Criteria
|
|
290
|
+
|
|
291
|
+
Binary done checks:
|
|
292
|
+
|
|
293
|
+
- [ ] All phases complete
|
|
294
|
+
- [ ] All specified tests pass
|
|
295
|
+
- [ ] Project's verify command passes
|
|
296
|
+
- [ ] All automated checkpoint reviews passed (manual also passed if required)
|
|
297
|
+
- [ ] Feature is reachable (entry point connected, not orphaned code)
|
|
298
|
+
- [ ] UI exists for user-facing features (or explicitly marked internal-only)
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Quick Reference
|
|
303
|
+
|
|
304
|
+
### Vertical Slice (Good) vs Horizontal Layer (Bad)
|
|
305
|
+
|
|
306
|
+
| Good Phase | Bad Phase |
|
|
307
|
+
| -------------------------------- | -------------------- |
|
|
308
|
+
| One endpoint returning real data | All types and DTOs |
|
|
309
|
+
| One socket event working e2e | All socket handlers |
|
|
310
|
+
| One button doing one action | Entire backend layer |
|
|
311
|
+
|
|
312
|
+
**Litmus test:** Can you describe it as "User does X → sees Y"?
|
|
313
|
+
|
|
314
|
+
### Anti-Patterns
|
|
315
|
+
|
|
316
|
+
- Implementing multiple phases without checkpoints
|
|
317
|
+
- Phases with no user-testable outcome
|
|
318
|
+
- Type-check pass as sole verification
|
|
319
|
+
- Touching 10+ files in one phase
|
|
320
|
+
- Skipping automated review when available
|
|
321
|
+
- **Creating features in isolation** - code that exists but is never called from existing flows
|
|
322
|
+
- **Backend without UI** - user-facing features with no way for users to access them
|
|
323
|
+
|
|
324
|
+
## Principles
|
|
325
|
+
|
|
326
|
+
- **SRP, KISS, DRY, YAGNI** - Always
|
|
327
|
+
- **Composition > inheritance**
|
|
328
|
+
- **Explicit errors** - No silent failures
|
|
329
|
+
- **Automated verification** - Let the agent catch drift
|
|
330
|
+
- **Follow project conventions** - Check CLAUDE.md, AGENTS.md, or similar AI assistant docs
|
|
@@ -233,3 +233,4 @@ If two parallel agents modify the same file:
|
|
|
233
233
|
- **Full context** - each agent gets the complete phase spec + project rules
|
|
234
234
|
- **Verify always** - never skip verification between waves
|
|
235
235
|
- **Task tracking** - every phase is a tracked task with status updates
|
|
236
|
+
- **Clean up worktrees** - after opening a PR for a worktree branch, immediately remove the worktree to avoid blocking future `git checkout` operations
|
package/dist/templates/qa.md
CHANGED
|
@@ -98,17 +98,21 @@ Based on this output:
|
|
|
98
98
|
|
|
99
99
|
### Step 5: Run Tests
|
|
100
100
|
|
|
101
|
+
Use the paths and commands discovered in Step 3. Run tests from the project root using the project's test runner.
|
|
102
|
+
|
|
101
103
|
**UI Tests:**
|
|
102
104
|
|
|
103
105
|
```bash
|
|
104
|
-
|
|
106
|
+
# Use the playwright config and test directory discovered in Step 3
|
|
107
|
+
npx playwright test <discovered-e2e-dir> --reporter=list
|
|
105
108
|
```
|
|
106
109
|
|
|
107
|
-
**API Tests:**
|
|
110
|
+
**API/Unit Tests:**
|
|
108
111
|
|
|
109
112
|
```bash
|
|
110
|
-
|
|
111
|
-
#
|
|
113
|
+
# Use the test runner and directory discovered in Step 3
|
|
114
|
+
# e.g.: npx vitest run <discovered-test-dir> --reporter=verbose
|
|
115
|
+
# npx jest <discovered-test-dir> --verbose
|
|
112
116
|
```
|
|
113
117
|
|
|
114
118
|
Capture the test output for the report.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
## Night Watch Skills
|
|
2
|
+
|
|
3
|
+
The following Night Watch CLI commands are available. Use them when the user asks to manage PRDs, board issues, or trigger Night Watch operations.
|
|
4
|
+
|
|
5
|
+
### Create a PRD (`/nw-create-prd`)
|
|
6
|
+
|
|
7
|
+
Create a new PRD at `docs/prds/<name>.md`. Ask for feature title, assess complexity (1=Simple, 2=Medium, 3=Complex), split into phases with checkbox tasks, then write the file. Tell the user to run `night-watch run` to execute immediately.
|
|
8
|
+
|
|
9
|
+
### Add Issue to Board (`/nw-add-issue`)
|
|
10
|
+
|
|
11
|
+
Add a GitHub issue to the Night Watch board:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
night-watch board add-issue <issue-number>
|
|
15
|
+
night-watch board add-issue <issue-number> --column "In Progress"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Available columns: Draft, Ready, In Progress, Review, Done.
|
|
19
|
+
|
|
20
|
+
### Run Next PRD (`/nw-run`)
|
|
21
|
+
|
|
22
|
+
Manually trigger Night Watch to execute the next PRD:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
night-watch prd list # see what's queued
|
|
26
|
+
night-watch run # execute next PRD
|
|
27
|
+
night-watch run --prd <file> # run specific PRD
|
|
28
|
+
night-watch logs --follow # monitor progress
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Slice Roadmap (`/nw-slice`)
|
|
32
|
+
|
|
33
|
+
Break a high-level feature into multiple PRD files:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
night-watch slice
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Reads `docs/roadmap.md` and generates PRDs. Review and adjust output in `docs/prds/`.
|
|
40
|
+
|
|
41
|
+
### Sync Board (`/nw-board-sync`)
|
|
42
|
+
|
|
43
|
+
Sync the GitHub board with PRD/PR state:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
night-watch board status
|
|
47
|
+
night-watch board sync
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Review PRs (`/nw-review`)
|
|
51
|
+
|
|
52
|
+
Run automated PR review:
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
night-watch review
|
|
56
|
+
night-watch review --pr <number>
|
|
57
|
+
night-watch logs --type review
|
|
58
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Skill: nw-add-issue
|
|
2
|
+
|
|
3
|
+
Add an existing GitHub issue to the Night Watch project board for tracking and execution.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
When the user wants to add a GitHub issue to the Night Watch Kanban board.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **Check for issue number** — if not provided, list open issues:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
gh issue list --state open --limit 20
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Ask the user which issue(s) to add.
|
|
18
|
+
|
|
19
|
+
2. **Add the issue to the board**:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
night-watch board add-issue <issue-number>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. **Optionally specify a column** (default: "Ready"):
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
night-watch board add-issue <issue-number> --column "In Progress"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Available columns: `Draft`, `Ready`, `In Progress`, `Review`, `Done`
|
|
32
|
+
|
|
33
|
+
4. **Confirm** the issue was added and show its board position.
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
|
|
37
|
+
- Issues in "Ready" are picked up automatically by Night Watch on the next run
|
|
38
|
+
- Move issues to "Draft" if they're not yet ready for autonomous execution
|
|
39
|
+
- Use `night-watch board sync` if the board gets out of sync with PRDs
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Skill: nw-board-sync
|
|
2
|
+
|
|
3
|
+
Sync the GitHub Project board with the current state of Night Watch PRDs and pull requests.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
When the board is out of sync with PRD/PR status, or after manual changes to issues or PRDs.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. **View current board state**:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
night-watch board status
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. **Sync board with PRD filesystem**:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
night-watch board sync
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. **List open issues that may need board assignment**:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
gh issue list --state open --label "night-watch"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
4. **Add any missing issues to the board**:
|
|
30
|
+
```
|
|
31
|
+
night-watch board add-issue <number>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Board Columns
|
|
35
|
+
|
|
36
|
+
| Column | Meaning |
|
|
37
|
+
| ----------- | ------------------------------------------------ |
|
|
38
|
+
| Draft | Not ready for execution |
|
|
39
|
+
| Ready | Queued for Night Watch — picked up automatically |
|
|
40
|
+
| In Progress | Currently being implemented |
|
|
41
|
+
| Review | PR opened, awaiting review |
|
|
42
|
+
| Done | Merged and complete |
|
|
43
|
+
|
|
44
|
+
## Notes
|
|
45
|
+
|
|
46
|
+
- Night Watch auto-moves issues from Ready → In Progress when starting, and In Progress → Review when opening a PR
|
|
47
|
+
- Use `night-watch board setup` to create the board if it doesn't exist yet
|