Skip to content

Commit 1f74c34

Browse files
author
Test User
committed
Enhance init wizard and dashboard agents
1 parent 3304e8e commit 1f74c34

8 files changed

Lines changed: 1125 additions & 394 deletions

File tree

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Night Watch Init Wizard Preview</title>
7+
<style>
8+
:root { color-scheme: dark; }
9+
body { margin: 0; min-height: 100vh; background: #101214; color: #e9edf0; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: grid; place-items: start center; padding: 32px; }
10+
main { width: min(1120px, 100%); }
11+
h1 { font-size: 22px; line-height: 1.2; margin: 0 0 14px; font-weight: 700; letter-spacing: 0; }
12+
p { margin: 0 0 18px; color: #aab4bd; font-size: 14px; }
13+
pre { margin: 0; padding: 24px; border: 1px solid #30363d; border-radius: 8px; background: #050607; color: #d6dde3; overflow: auto; line-height: 1.42; font-size: 13px; tab-size: 2; box-shadow: 0 20px 70px rgba(0,0,0,.35); }
14+
</style>
15+
</head>
16+
<body>
17+
<main>
18+
<h1>Night Watch Init Wizard Preview</h1>
19+
<p>Captured from a disposable git repo using the rebuilt beta CLI.</p>
20+
<pre>
21+
22+
Night Watch CLI - Initializing
23+
────────────────────────────────────────
24+
● Step 01/14 ━─────────── 7%
25+
Checking Node.js version...
26+
✔ Node.js version v24.16.0 (&gt;= 22.0.0)
27+
● Step 02/14 ━━────────── 14%
28+
Checking git repository...
29+
✔ Git repository found
30+
● Step 03/14 ━━━───────── 21%
31+
Detecting AI providers...
32+
ℹ Auto-selected Codex.
33+
● Step 04/14 ━━━───────── 29%
34+
Checking GitHub integration prerequisites...
35+
ℹ No GitHub remote detected. Board setup will be skipped for now.
36+
● Step 05/14 ━━━━──────── 36%
37+
Detecting test frameworks...
38+
ℹ Playwright: not found
39+
ℹ Skipping Playwright install. QA can auto-install during execution if enabled.
40+
41+
Project Configuration
42+
────────────────────────────────────────
43+
Project night-watch-preview-NWCj1u
44+
Default branch main
45+
Provider codex
46+
Jobs Executor: 5 * * * * (At 5 minutes past the hour), Reviewer: 25 */3 * * * (At 25 minutes past the hour, every 3 hours), QA: 45 2,10,18 * * * (At 02:45, 10:45 and 18:45), Slicer: 35 */6 * * * (At 35 minutes past the hour, every 6 hours), PR Conflict Solver: 15 6,14,22 * * * (At 06:15, 14:15 and 22:15), Manager: 15 7 * * * (At 07:15)
47+
Notifications Skipped
48+
49+
● Step 06/14 ━━━━━─────── 43%
50+
Creating PRD directory structure...
51+
✔ Created /tmp/night-watch-preview-NWCj1u/docs/prds/
52+
✔ Created /tmp/night-watch-preview-NWCj1u/docs/prds/done/
53+
● Step 07/14 ━━━━━━────── 50%
54+
Creating logs directory...
55+
✔ Created /tmp/night-watch-preview-NWCj1u/logs/
56+
Created: /tmp/night-watch-preview-NWCj1u/.gitignore (with Night Watch entries)
57+
● Step 08/14 ━━━━━━━───── 57%
58+
Creating instructions directory...
59+
✔ Created /tmp/night-watch-preview-NWCj1u/instructions/
60+
Created: /tmp/night-watch-preview-NWCj1u/instructions/executor.md (bundled)
61+
Created: /tmp/night-watch-preview-NWCj1u/instructions/prd-executor.md (bundled)
62+
Created: /tmp/night-watch-preview-NWCj1u/instructions/pr-reviewer.md (bundled)
63+
Created: /tmp/night-watch-preview-NWCj1u/instructions/qa.md (bundled)
64+
Created: /tmp/night-watch-preview-NWCj1u/instructions/audit.md (bundled)
65+
Created: /tmp/night-watch-preview-NWCj1u/instructions/prd-creator.md (bundled)
66+
● Step 09/14 ━━━━━━━━──── 64%
67+
Creating configuration file...
68+
✔ Created /tmp/night-watch-preview-NWCj1u/night-watch.config.json
69+
● Step 10/14 ━━━━━━━━━─── 71%
70+
Setting up GitHub Project board...
71+
ℹ No GitHub remote detected — skipping board setup. Run `night-watch board setup` manually.
72+
● Step 11/14 ━━━━━━━━━─── 79%
73+
Syncing Night Watch labels to GitHub...
74+
ℹ Skipping label sync (no GitHub remote or gh not authenticated).
75+
● Step 12/14 ━━━━━━━━━━── 86%
76+
Registering project in global registry...
77+
✔ Registered as "night-watch-preview-NWCj1u" in global registry
78+
● Step 13/14 ━━━━━━━━━━━─ 93%
79+
Installing Night Watch skills...
80+
✔ Installed 6 skills to AGENTS.md
81+
/nw-create-prd
82+
/nw-add-issue
83+
/nw-run
84+
/nw-slice
85+
/nw-board-sync
86+
/nw-review
87+
● Step 14/14 ━━━━━━━━━━━━ 100%
88+
Initialization complete!
89+
90+
Initialization Complete
91+
────────────────────────────────────────
92+
┌─────────────────┬────────────────────────────────────────┐
93+
│ Created Files │ │
94+
├─────────────────┼────────────────────────────────────────┤
95+
│ PRD Directory │ docs/prds/done/ │
96+
├─────────────────┼────────────────────────────────────────┤
97+
│ Logs Directory │ logs/ │
98+
├─────────────────┼────────────────────────────────────────┤
99+
│ Instructions │ instructions/executor.md (bundled) │
100+
├─────────────────┼────────────────────────────────────────┤
101+
│ │ instructions/prd-executor.md (bundled) │
102+
├─────────────────┼────────────────────────────────────────┤
103+
│ │ instructions/pr-reviewer.md (bundled) │
104+
├─────────────────┼────────────────────────────────────────┤
105+
│ │ instructions/qa.md (bundled) │
106+
├─────────────────┼────────────────────────────────────────┤
107+
│ │ instructions/audit.md (bundled) │
108+
├─────────────────┼────────────────────────────────────────┤
109+
│ │ instructions/prd-creator.md (bundled) │
110+
├─────────────────┼────────────────────────────────────────┤
111+
│ Config File │ night-watch.config.json │
112+
├─────────────────┼────────────────────────────────────────┤
113+
│ Board Setup │ Skipped (no GitHub remote) │
114+
├─────────────────┼────────────────────────────────────────┤
115+
│ Label Sync │ Skipped (no GitHub remote) │
116+
├─────────────────┼────────────────────────────────────────┤
117+
│ Global Registry │ ~/.night-watch/projects.json │
118+
├─────────────────┼────────────────────────────────────────┤
119+
│ Skills │ 6 skills → AGENTS.md │
120+
└─────────────────┴────────────────────────────────────────┘
121+
122+
Configuration
123+
────────────────────────────────────────
124+
Provider codex
125+
Enabled jobs Executor: 5 * * * * (At 5 minutes past the hour), Reviewer: 25 */3 * * * (At 25 minutes past the hour, every 3 hours), QA: 45 2,10,18 * * * (At 02:45, 10:45 and 18:45), Slicer: 35 */6 * * * (At 35 minutes past the hour, every 6 hours), PR Conflict Solver: 15 6,14,22 * * * (At 06:15, 14:15 and 22:15), Manager: 15 7 * * * (At 07:15)
126+
Notifications Skipped
127+
Board Skipped (no GitHub remote)
128+
Skills 6 skills → AGENTS.md
129+
Playwright not installed
130+
131+
132+
Next Steps
133+
────────────────────────────────────────
134+
ℹ 1. Add your PRD files to docs/prds/
135+
ℹ 2. Run `night-watch install` to set up cron jobs
136+
ℹ 3. Run `night-watch doctor` to verify the full setup
137+
ℹ 4. Or run `night-watch run` to execute PRDs manually
138+
ℹ 5. Use /nw-create-prd, /nw-run, /nw-add-issue and more in your AI assistant
139+
140+
(node:65351) Warning: The 'NO_COLOR' env is ignored due to the 'FORCE_COLOR' env being set.
141+
(Use `node --trace-warnings ...` to show where the warning was created)
142+
</pre>
143+
</main>
144+
</body>
145+
</html>

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"url": "https://github.com/jonit-dev/night-watch-cli/issues"
5757
},
5858
"dependencies": {
59+
"@inquirer/prompts": "^8.5.2",
5960
"better-sqlite3": "^12.6.2",
6061
"blessed": "^0.1.81",
6162
"chalk": "^5.6.2",

packages/cli/src/__tests__/commands/init.test.ts

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ import { fileURLToPath } from 'url';
77
import { getDefaultConfig } from '@night-watch/core';
88
import {
99
applyJobSelectionToConfig,
10+
buildBundleJobSelection,
1011
buildDefaultJobSelection,
1112
buildProviderChoices,
1213
buildProviderSummary,
1314
buildInitConfig,
1415
chooseProviderByPrecedence,
1516
chooseProviderForNonInteractive,
1617
describeCronSchedule,
18+
getInitCustomizationChoices,
1719
getInitJobCatalog,
1820
getDetectedProviderPresets,
1921
getGitHubRemoteStatus,
2022
isInteractiveInitSession,
23+
normalizeCronSchedulePromptInput,
2124
resolveTemplatePath,
2225
selectProviderOverrideByIndex,
2326
shouldPromptProviderOverride,
@@ -333,6 +336,13 @@ describe('init command', () => {
333336
expect(describeCronSchedule('bad')).toBe('bad');
334337
});
335338

339+
it('should accept enter or yes as the default cron schedule in prompts', () => {
340+
expect(normalizeCronSchedulePromptInput('', '5 * * * *')).toBe('5 * * * *');
341+
expect(normalizeCronSchedulePromptInput('y', '5 * * * *')).toBe('5 * * * *');
342+
expect(normalizeCronSchedulePromptInput('yes', '5 * * * *')).toBe('5 * * * *');
343+
expect(normalizeCronSchedulePromptInput('0 9 * * *', '5 * * * *')).toBe('0 9 * * *');
344+
});
345+
336346
it('should generate the full current config shape with init overrides', () => {
337347
const defaults = getDefaultConfig();
338348

@@ -432,8 +442,7 @@ describe('init command', () => {
432442
expect(config.autoMerge).toBe(true);
433443
});
434444

435-
it('should keep deterministic default job selection for non-interactive init', () => {
436-
const defaults = getDefaultConfig();
445+
it('should default init job selection to the core onboarding jobs', () => {
437446
const selection = buildDefaultJobSelection({ reviewerEnabled: false });
438447
const config = applyJobSelectionToConfig(
439448
buildInitConfig({
@@ -446,15 +455,55 @@ describe('init command', () => {
446455
selection,
447456
);
448457

449-
expect(config.executorEnabled).toBe(defaults.executorEnabled);
458+
expect(config.executorEnabled).toBe(true);
450459
expect(config.reviewerEnabled).toBe(false);
451-
expect(config.qa.enabled).toBe(defaults.qa.enabled);
452-
expect(config.roadmapScanner.enabled).toBe(defaults.roadmapScanner.enabled);
453-
expect(config.prResolver.enabled).toBe(defaults.prResolver.enabled);
454-
expect(config.manager.enabled).toBe(defaults.manager.enabled);
455-
expect(config.audit.enabled).toBe(defaults.audit.enabled);
456-
expect(config.analytics.enabled).toBe(defaults.analytics.enabled);
457-
expect(config.merger.enabled).toBe(defaults.merger.enabled);
460+
expect(config.qa.enabled).toBe(true);
461+
expect(config.roadmapScanner.enabled).toBe(false);
462+
expect(config.prResolver.enabled).toBe(false);
463+
expect(config.manager.enabled).toBe(false);
464+
expect(config.audit.enabled).toBe(false);
465+
expect(config.analytics.enabled).toBe(false);
466+
expect(config.merger.enabled).toBe(false);
467+
});
468+
469+
it('should keep the recommended guided bundle focused on core jobs', () => {
470+
const selection = buildBundleJobSelection('recommended');
471+
472+
expect(selection.enabledJobs).toEqual(['executor', 'reviewer', 'qa']);
473+
});
474+
475+
it('should make notification customization an explicit single-choice action', () => {
476+
const choices = getInitCustomizationChoices({ playwrightDetected: false });
477+
478+
expect(choices[0]).toMatchObject({
479+
value: 'notifications',
480+
label: 'Notifications',
481+
});
482+
expect(choices.map((choice) => choice.value)).toEqual([
483+
'notifications',
484+
'jobs',
485+
'provider',
486+
'playwright',
487+
'done',
488+
]);
489+
});
490+
491+
it('should hide Playwright customization when Playwright is already detected', () => {
492+
const choices = getInitCustomizationChoices({ playwrightDetected: true });
493+
494+
expect(choices.map((choice) => choice.value)).toEqual([
495+
'notifications',
496+
'jobs',
497+
'provider',
498+
'done',
499+
]);
500+
});
501+
502+
it('should not expose notification event selection in onboarding prompts', () => {
503+
const initSource = fs.readFileSync(path.join(PROJECT_ROOT, 'src/commands/init.ts'), 'utf-8');
504+
505+
expect(initSource).not.toContain('Notification events CSV');
506+
expect(initSource).not.toContain('Default events:');
458507
});
459508

460509
it('should reject unknown job and malformed schedule flags', () => {
@@ -643,6 +692,24 @@ describe('init command', () => {
643692
command: 'local-agent',
644693
});
645694
});
695+
696+
it('should invite users to Discord after init completes', () => {
697+
execSync('git init', { cwd: tempDir, stdio: 'pipe' });
698+
execSync('git config user.email "test@test.com"', { cwd: tempDir, stdio: 'pipe' });
699+
execSync('git config user.name "Test"', { cwd: tempDir, stdio: 'pipe' });
700+
701+
const output = execSync(
702+
`${TSX_CMD} init --yes --custom-provider-command local-agent --custom-provider-name "Local Agent" --custom-provider-id local-agent`,
703+
{
704+
encoding: 'utf-8',
705+
cwd: tempDir,
706+
stdio: 'pipe',
707+
timeout: 15000,
708+
},
709+
);
710+
711+
expect(output).toContain('Join the Night Watch Discord: https://discord.gg/maCPEJzPXa');
712+
});
646713
});
647714

648715
describeIfExternalTools('--no-reviewer flag', () => {
@@ -738,8 +805,8 @@ describe('init command', () => {
738805
expect(summary).toContain('Also available: Claude');
739806
});
740807

741-
it('should only prompt for provider override in interactive sessions with multiple presets', () => {
742-
expect(shouldPromptProviderOverride(true, ['codex', 'claude'])).toBe(true);
808+
it('should not force provider override during default onboarding', () => {
809+
expect(shouldPromptProviderOverride(true, ['codex', 'claude'])).toBe(false);
743810
expect(shouldPromptProviderOverride(true, ['codex'])).toBe(false);
744811
expect(shouldPromptProviderOverride(false, ['codex', 'claude'])).toBe(false);
745812
});

0 commit comments

Comments
 (0)