From dfb7c69d3b2847928be66ed716bb156f229cf909 Mon Sep 17 00:00:00 2001 From: ezl-keygraph Date: Wed, 19 Aug 2026 19:42:24 +0530 Subject: [PATCH] fix(cli): show splash screen on bare invocation and setup (#425) --- apps/cli/src/commands/setup.ts | 5 ++++- apps/cli/src/index.ts | 22 +++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/apps/cli/src/commands/setup.ts b/apps/cli/src/commands/setup.ts index 11bd69e..6555880 100644 --- a/apps/cli/src/commands/setup.ts +++ b/apps/cli/src/commands/setup.ts @@ -11,7 +11,9 @@ import path from 'node:path'; import * as p from '@clack/prompts'; import { type ShannonConfig, saveConfig } from '../config/writer.js'; import { CURATED_PROVIDERS, type CuratedProviderId, isCuratedProvider, type OpenAiFormat } from '../model-spec.js'; +import { displaySplash } from '../splash.js'; import { requireInteractive } from '../tty.js'; +import { getVersion } from '../version.js'; const SHANNON_HOME = path.join(os.homedir(), '.shannon'); @@ -63,7 +65,8 @@ function modelIdPlaceholder(provider: string): string | undefined { export async function setup(): Promise { requireInteractive('setup', 'For non-interactive use, export credentials as env vars (e.g. ANTHROPIC_API_KEY).'); - p.intro('Shannon Setup'); + displaySplash(getVersion()); + p.intro('Setup'); // 1. Select provider. "Custom Base URL" is a route, not a provider — it asks // which API dialect the gateway speaks and configures that provider. "Other diff --git a/apps/cli/src/index.ts b/apps/cli/src/index.ts index aa29560..9321f9e 100644 --- a/apps/cli/src/index.ts +++ b/apps/cli/src/index.ts @@ -20,7 +20,8 @@ import { status } from './commands/status.js'; import { stop } from './commands/stop.js'; import { crash, fail, failUsage } from './errors.js'; import { availableCommands, isHelpableCommand, printCommandHelp, START_OPTIONS } from './help.js'; -import { commandPrefix, getMode } from './mode.js'; +import { commandPrefix, getMode, isLocal } from './mode.js'; +import { displaySplash } from './splash.js'; import { closestMatch } from './suggest.js'; import { getVersion, getVersionLine } from './version.js'; @@ -50,13 +51,13 @@ function renderStartOptions(): string { return START_OPTIONS.map(([flag, desc]) => ` ${flag.padEnd(flagWidth)} ${desc}`).join('\n'); } -function showHelp(): void { +function showHelp(withSplash: boolean): void { const mode = getMode(); const prefix = commandPrefix(); - console.log(` -Shannon - AI Penetration Testing Framework + const header = withSplash ? '' : '\nShannon - AI Penetration Testing Framework\n'; + console.log(`${header} Usage:${ mode === 'local' ? '' @@ -89,14 +90,7 @@ Examples: ${prefix} reset Run '${prefix} --help' for help on a specific command. -${ - mode === 'local' - ? ` -State directory: ./workspaces/` - : ` -State directory: ~/.shannon/` -} -Monitor scans at http://localhost:8233 + Docs & source: https://github.com/KeygraphHQ/shannon `); } @@ -174,7 +168,9 @@ async function main(): Promise { if (topic && isHelpableCommand(topic)) { printCommandHelp(topic); } else { - showHelp(); + const bare = command === undefined; + if (bare) displaySplash(isLocal() ? undefined : getVersion()); + showHelp(bare); } return; }