Skip to content

Commit 83ff993

Browse files
feat: Add signup command for onboarding
1 parent d77fecc commit 83ff993

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

src/cli/commands/signup.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { Command } from 'commander';
2+
import chalk from 'chalk';
3+
import open from 'open';
4+
import inquirer from 'inquirer';
5+
6+
export function registerSignupCommand(program: Command): void {
7+
program
8+
.command('signup')
9+
.alias('register')
10+
.description('Sign up for StackMemory hosted service')
11+
.option('--no-open', 'Do not automatically open browser')
12+
.action(async (options) => {
13+
console.log(chalk.cyan('🚀 StackMemory Hosted Service Signup\n'));
14+
15+
const signupUrl = 'https://stackmemory.ai/signup';
16+
17+
if (options.open !== false) {
18+
console.log(chalk.gray('Opening signup page in your browser...'));
19+
try {
20+
await open(signupUrl);
21+
console.log(chalk.green('✓ Opened: ') + chalk.cyan(signupUrl));
22+
} catch (error) {
23+
console.log(chalk.yellow('Could not open browser automatically.'));
24+
console.log(chalk.gray('Please visit: ') + chalk.cyan(signupUrl));
25+
}
26+
} else {
27+
console.log(chalk.gray('Visit this URL to sign up:'));
28+
console.log(chalk.cyan(signupUrl));
29+
}
30+
31+
console.log(chalk.gray('\nAfter signing up, you can login with:'));
32+
console.log(chalk.cyan(' stackmemory login'));
33+
34+
// Optional: Ask if they want to login now
35+
const { proceed } = await inquirer.prompt([
36+
{
37+
type: 'confirm',
38+
name: 'proceed',
39+
message: 'Have you completed signup and want to login now?',
40+
default: false,
41+
},
42+
]);
43+
44+
if (proceed) {
45+
// Import and run login command
46+
const { registerLoginCommand } = await import('./login.js');
47+
const loginCmd = new Command();
48+
registerLoginCommand(loginCmd);
49+
50+
// Execute login
51+
console.log(chalk.cyan('\n🔐 Proceeding to login...\n'));
52+
await loginCmd.parseAsync(['node', 'stackmemory', 'login']);
53+
} else {
54+
console.log(chalk.gray('\nWhen ready, run: ') + chalk.cyan('stackmemory login'));
55+
}
56+
});
57+
}

src/cli/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import createWorkflowCommand from './commands/workflow.js';
4040
import monitorCommand from './commands/monitor.js';
4141
import qualityCommand from './commands/quality.js';
4242
import { registerLoginCommand } from './commands/login.js';
43+
import { registerSignupCommand } from './commands/signup.js';
4344
import { registerLogoutCommand, registerDbCommands } from './commands/db.js';
4445
import { ProjectManager } from '../core/projects/project-manager.js';
4546
import Database from 'better-sqlite3';
@@ -430,6 +431,7 @@ program
430431
// Register project management commands
431432
// Register command modules
432433
registerOnboardingCommand(program);
434+
registerSignupCommand(program);
433435
registerLoginCommand(program);
434436
registerLogoutCommand(program);
435437
registerDbCommands(program);

0 commit comments

Comments
 (0)