Skip to content

Commit ca592c3

Browse files
committed
feat: add interactive tour command for onboarding
- New 'socket tour' command for guided walkthrough - 10-step interactive tour covering all major features - Shows real commands users can run during tour - Safe command execution for demonstrations - Non-interactive mode shows tour summary - Tour integrated into help system as option 1 - Highlights for new users in help menu Tour covers: 1. Authentication setup 2. Vulnerability scanning 3. Package safety checks 4. Natural language interface 5. Fixing vulnerabilities 6. Secure package installation 7. Dependency optimization 8. Offline mode 9. CI/CD integration 10. Organization management Each step includes: - Clear explanations - Example commands - Tips and best practices - Option to run safe commands Usage: - socket tour # Start interactive tour - socket --help # Tour is option 1 - socket --help=tour # Show tour info
1 parent 740836d commit ca592c3

File tree

5 files changed

+392
-3
lines changed

5 files changed

+392
-3
lines changed

src/commands.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import { cmdWhoami } from './commands/whoami/cmd-whoami.mts'
3535
import { cmdWrapper } from './commands/wrapper/cmd-wrapper.mts'
3636
import { cmdYarn } from './commands/yarn/cmd-yarn.mts'
3737
import { cmdAsk } from './commands/ask/cmd-ask.mts'
38+
import { cmdTour } from './commands/tour/cmd-tour.mts'
3839
import { isSeaBinary } from './utils/sea.mts'
3940

4041
export const rootCommands = {
@@ -69,6 +70,7 @@ export const rootCommands = {
6970
security: cmdOrganizationPolicySecurity,
7071
...(isSeaBinary() ? { 'self-update': cmdSelfUpdate } : {}),
7172
'threat-feed': cmdThreatFeed,
73+
tour: cmdTour,
7274
uninstall: cmdUninstall,
7375
uv: cmdUv,
7476
whoami: cmdWhoami,

src/commands/tour/cmd-tour.mts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/** @fileoverview Interactive tour command for Socket CLI */
2+
3+
import { buildCommand } from '../../utils/command-builder.mts'
4+
import { runInteractiveTour, showTourSummary } from '../../utils/interactive-tour.mts'
5+
import isInteractive from '@socketregistry/is-interactive/index.cjs'
6+
7+
export const cmdTour = buildCommand({
8+
name: 'tour',
9+
description: 'Interactive guided tour of Socket CLI features',
10+
handler: async () => {
11+
if (isInteractive()) {
12+
await runInteractiveTour()
13+
} else {
14+
showTourSummary()
15+
}
16+
},
17+
examples: [
18+
{ command: '', description: 'Start the interactive tour' },
19+
],
20+
})

src/utils/interactive-help.mts

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,36 @@ interface HelpCategory {
1515
}
1616

1717
const helpCategories: HelpCategory[] = [
18+
{
19+
title: 'Guided Tour',
20+
key: 'tour',
21+
icon: '🎯',
22+
description: 'Take an interactive tour of Socket CLI',
23+
content: () => {
24+
logger.log(colors.cyan('\n🎯 Socket CLI Guided Tour\n'))
25+
logger.log('The interactive tour will walk you through:')
26+
logger.log('')
27+
logger.log(' 1. Authentication and setup')
28+
logger.log(' 2. Scanning for vulnerabilities')
29+
logger.log(' 3. Checking package safety')
30+
logger.log(' 4. Using natural language commands')
31+
logger.log(' 5. Fixing security issues')
32+
logger.log(' 6. Secure package installation')
33+
logger.log(' 7. Dependency optimization')
34+
logger.log(' 8. Offline mode and caching')
35+
logger.log(' 9. CI/CD integration')
36+
logger.log(' 10. Organization management')
37+
logger.log('')
38+
logger.log(colors.bold('To start the tour:'))
39+
logger.log(' socket tour')
40+
logger.log('')
41+
logger.log(colors.gray('The tour is interactive and will:'))
42+
logger.log(colors.gray(' • Show real commands you can use'))
43+
logger.log(colors.gray(' • Let you run safe examples'))
44+
logger.log(colors.gray(' • Provide tips and best practices'))
45+
logger.log(colors.gray(' • Take about 5-10 minutes'))
46+
},
47+
},
1848
{
1949
title: 'Security Scanning',
2050
key: 'scan',
@@ -220,6 +250,7 @@ const helpCategories: HelpCategory[] = [
220250
{ cmd: 'scan', desc: 'Security scanning' },
221251
{ cmd: 'security', desc: 'Security policy' },
222252
{ cmd: 'threat-feed', desc: 'Threat intelligence' },
253+
{ cmd: 'tour', desc: '🎯 Interactive guided tour' },
223254
{ cmd: 'whoami', desc: 'Current user info' },
224255
{ cmd: 'wrapper', desc: 'CDN wrapper' },
225256
{ cmd: 'yarn', desc: 'Secure yarn wrapper' },
@@ -241,6 +272,9 @@ const helpCategories: HelpCategory[] = [
241272
description: 'Get started quickly',
242273
content: () => {
243274
logger.log(colors.cyan('\n🚀 Quick Start Guide\n'))
275+
logger.log(colors.bold('New to Socket CLI?'))
276+
logger.log(' socket tour # Take the interactive tour!')
277+
logger.log('')
244278
logger.log(colors.bold('1. First-time setup:'))
245279
logger.log(' socket login # Authenticate')
246280
logger.log(' socket config auto # Auto-configure')
@@ -277,7 +311,9 @@ export async function showInteractiveHelp(): Promise<void> {
277311
logger.log('')
278312
logger.log(colors.gray('Run with an interactive terminal to select a category'))
279313
logger.log(colors.gray('Or use: socket --help=<category>'))
280-
logger.log(colors.gray('Categories: scan, fix, pm, pkg, org, config, ask, all, quick'))
314+
logger.log(colors.gray('Categories: tour, scan, fix, pm, pkg, org, config, ask, all, quick'))
315+
logger.log('')
316+
logger.log(colors.bold('💡 New user? Try: socket tour'))
281317
return
282318
}
283319

@@ -286,7 +322,8 @@ export async function showInteractiveHelp(): Promise<void> {
286322

287323
try {
288324
while (true) {
289-
logger.log(colors.bold('What can I help you with?\n'))
325+
logger.log(colors.bold('What can I help you with?'))
326+
logger.log(colors.dim('💡 New user? Start with option 1 for a guided tour!\n'))
290327
showCategoryList()
291328
logger.log('')
292329

0 commit comments

Comments
 (0)