feat: add setup channel verification checklist output
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { renderOperatorPackStatus, renderSummary } from './summary.js';
|
||||
import { renderOnboardingChecklist, renderOperatorPackStatus, renderSummary } from './summary.js';
|
||||
import type { SetupConfig } from './config.js';
|
||||
|
||||
describe('renderSummary', () => {
|
||||
@@ -64,3 +64,28 @@ describe('renderSummary', () => {
|
||||
expect(renderOperatorPackStatus(config)).toBe('Operator Pack: disabled');
|
||||
});
|
||||
});
|
||||
|
||||
describe('renderOnboardingChecklist', () => {
|
||||
it('includes start command, webchat URL, and doctor hint', () => {
|
||||
const config = {
|
||||
server: { port: 19100, localhost: true },
|
||||
} as unknown as SetupConfig;
|
||||
|
||||
const output = renderOnboardingChecklist(config, { configPath: '/tmp/flynn.yaml' });
|
||||
expect(output).toContain('flynn start --config /tmp/flynn.yaml');
|
||||
expect(output).toContain('http://localhost:19100/#/chat');
|
||||
expect(output).toContain('flynn doctor');
|
||||
});
|
||||
|
||||
it('includes channel-specific verification hints', () => {
|
||||
const config = {
|
||||
server: { port: 18800, localhost: true },
|
||||
telegram: { bot_token: 'x', allowed_chat_ids: [1] },
|
||||
slack: { bot_token: 'x', app_token: 'y', signing_secret: 'z', allowed_channel_ids: ['C1'] },
|
||||
} as unknown as SetupConfig;
|
||||
|
||||
const output = renderOnboardingChecklist(config);
|
||||
expect(output).toContain('Telegram: send `/status`');
|
||||
expect(output).toContain('Slack: message the bot');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -82,3 +82,33 @@ export function renderSummary(config: SetupConfig): string {
|
||||
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
export function renderOnboardingChecklist(config: SetupConfig, opts?: { configPath?: string }): string {
|
||||
const lines: string[] = [];
|
||||
const startCmd = opts?.configPath
|
||||
? `flynn start --config ${opts.configPath}`
|
||||
: 'flynn start';
|
||||
|
||||
lines.push('Quick start checklist:');
|
||||
lines.push(` 1. Start Flynn: ${startCmd}`);
|
||||
|
||||
const port = config.server?.port ?? 18800;
|
||||
lines.push(` 2. Open WebChat: http://localhost:${port}/#/chat`);
|
||||
lines.push(' 3. Send `/status` to verify model + gateway health');
|
||||
|
||||
if (config.telegram) {
|
||||
lines.push(' 4. Telegram: send `/status` to your bot from an allowed chat ID');
|
||||
}
|
||||
if (config.discord) {
|
||||
lines.push(' 4. Discord: mention the bot in an allowed server (`@bot /status`)');
|
||||
}
|
||||
if (config.slack) {
|
||||
lines.push(' 4. Slack: message the bot in an allowed channel (`/status`)');
|
||||
}
|
||||
if (config.whatsapp) {
|
||||
lines.push(' 4. WhatsApp: scan QR on first run, then send `/status`');
|
||||
}
|
||||
|
||||
lines.push(' 5. Run `flynn doctor` if any channel test fails');
|
||||
return lines.join('\n');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user