feat(setup): offer automation/operator-pack during first-run wizard
This commit is contained in:
@@ -26,6 +26,7 @@ describe('first-run wizard integration', () => {
|
||||
'n', // confirm: Configure a fast tier? (no)
|
||||
'', // ask: Gateway port (default)
|
||||
'n', // confirm: Add a messaging channel? (no)
|
||||
'n', // confirm: Configure automation now? (no)
|
||||
]);
|
||||
const p = createPrompter(rl);
|
||||
|
||||
@@ -53,6 +54,7 @@ describe('first-run wizard integration', () => {
|
||||
'123:ABCdef', // password: Bot token
|
||||
'12345678', // ask: Allowed chat IDs
|
||||
'n', // confirm: Add another channel? (no)
|
||||
'n', // confirm: Configure automation now? (no)
|
||||
]);
|
||||
const p = createPrompter(rl);
|
||||
|
||||
@@ -63,4 +65,38 @@ describe('first-run wizard integration', () => {
|
||||
expect(config.telegram!.bot_token).toBe('123:ABCdef');
|
||||
expect(config.telegram!.allowed_chat_ids).toEqual([12345678]);
|
||||
});
|
||||
|
||||
it('can configure operator pack during first-run wizard', async () => {
|
||||
const rl = mockReadline([
|
||||
'1', // choose: Anthropic
|
||||
'sk-ant-key', // password: API key
|
||||
'', // ask: Model (default)
|
||||
'n', // confirm: Configure a fast tier? (no)
|
||||
'', // ask: Gateway port (default)
|
||||
'y', // confirm: Add a messaging channel? (yes)
|
||||
'1', // choose: Telegram
|
||||
'123:ABCdef', // password: Bot token
|
||||
'12345678', // ask: Allowed chat IDs
|
||||
'n', // confirm: Add another channel? (no)
|
||||
'y', // confirm: Configure automation now? (yes)
|
||||
'y', // confirm: Enable operator automation pack? (yes)
|
||||
'', // ask: Backup cron schedule (default)
|
||||
'', // ask: Daily briefing cron schedule (default)
|
||||
'', // confirm: Include default MinIO sync task? (default yes)
|
||||
'n', // confirm: Enable cron scheduler? (no)
|
||||
'n', // confirm: Enable webhook receiver? (no)
|
||||
'n', // confirm: Configure Google services? (no)
|
||||
]);
|
||||
const p = createPrompter(rl);
|
||||
|
||||
const builder = await runFirstRunWizard(p);
|
||||
const config = builder.build() as Record<string, unknown>;
|
||||
const backup = config.backup as Record<string, unknown>;
|
||||
const automation = config.automation as Record<string, unknown>;
|
||||
const heartbeat = automation.heartbeat as Record<string, unknown>;
|
||||
|
||||
expect(backup.enabled).toBe(true);
|
||||
expect(backup.schedule).toBe('0 2 * * *');
|
||||
expect(heartbeat.enabled).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -69,5 +69,12 @@ export async function runFirstRunWizard(p: Prompter): Promise<ConfigBuilder> {
|
||||
p.println();
|
||||
await setupChannels(p, builder);
|
||||
|
||||
// Step 3: Optional automation pack
|
||||
p.println();
|
||||
const configureAutomation = await p.confirm('Configure automation now (operator pack, cron, webhooks, Google services)?', false);
|
||||
if (configureAutomation) {
|
||||
await setupAutomation(p, builder);
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user