Skip to content

Commit dfb7c69

Browse files
authored
fix(cli): show splash screen on bare invocation and setup (#425)
1 parent d41ae9c commit dfb7c69

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

apps/cli/src/commands/setup.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ import path from 'node:path';
1111
import * as p from '@clack/prompts';
1212
import { type ShannonConfig, saveConfig } from '../config/writer.js';
1313
import { CURATED_PROVIDERS, type CuratedProviderId, isCuratedProvider, type OpenAiFormat } from '../model-spec.js';
14+
import { displaySplash } from '../splash.js';
1415
import { requireInteractive } from '../tty.js';
16+
import { getVersion } from '../version.js';
1517

1618
const SHANNON_HOME = path.join(os.homedir(), '.shannon');
1719

@@ -63,7 +65,8 @@ function modelIdPlaceholder(provider: string): string | undefined {
6365

6466
export async function setup(): Promise<void> {
6567
requireInteractive('setup', 'For non-interactive use, export credentials as env vars (e.g. ANTHROPIC_API_KEY).');
66-
p.intro('Shannon Setup');
68+
displaySplash(getVersion());
69+
p.intro('Setup');
6770

6871
// 1. Select provider. "Custom Base URL" is a route, not a provider — it asks
6972
// which API dialect the gateway speaks and configures that provider. "Other

apps/cli/src/index.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import { status } from './commands/status.js';
2020
import { stop } from './commands/stop.js';
2121
import { crash, fail, failUsage } from './errors.js';
2222
import { availableCommands, isHelpableCommand, printCommandHelp, START_OPTIONS } from './help.js';
23-
import { commandPrefix, getMode } from './mode.js';
23+
import { commandPrefix, getMode, isLocal } from './mode.js';
24+
import { displaySplash } from './splash.js';
2425
import { closestMatch } from './suggest.js';
2526
import { getVersion, getVersionLine } from './version.js';
2627

@@ -50,13 +51,13 @@ function renderStartOptions(): string {
5051
return START_OPTIONS.map(([flag, desc]) => ` ${flag.padEnd(flagWidth)} ${desc}`).join('\n');
5152
}
5253

53-
function showHelp(): void {
54+
function showHelp(withSplash: boolean): void {
5455
const mode = getMode();
5556
const prefix = commandPrefix();
5657

57-
console.log(`
58-
Shannon - AI Penetration Testing Framework
58+
const header = withSplash ? '' : '\nShannon - AI Penetration Testing Framework\n';
5959

60+
console.log(`${header}
6061
Usage:${
6162
mode === 'local'
6263
? ''
@@ -89,14 +90,7 @@ Examples:
8990
${prefix} reset
9091
9192
Run '${prefix} <command> --help' for help on a specific command.
92-
${
93-
mode === 'local'
94-
? `
95-
State directory: ./workspaces/`
96-
: `
97-
State directory: ~/.shannon/`
98-
}
99-
Monitor scans at http://localhost:8233
93+
10094
Docs & source: https://github.com/KeygraphHQ/shannon
10195
`);
10296
}
@@ -174,7 +168,9 @@ async function main(): Promise<void> {
174168
if (topic && isHelpableCommand(topic)) {
175169
printCommandHelp(topic);
176170
} else {
177-
showHelp();
171+
const bare = command === undefined;
172+
if (bare) displaySplash(isLocal() ? undefined : getVersion());
173+
showHelp(bare);
178174
}
179175
return;
180176
}

0 commit comments

Comments
 (0)