Merge pull request #267 from dexhorthy/dexter/eng-1511-make-npx-humanlayer-join-waitlist-sundeepmalladiio-work-2

waitlist command
This commit is contained in:
Dex
2025-07-03 11:45:06 -05:00
committed by GitHub
2 changed files with 68 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
import chalk from 'chalk'
interface JoinWaitlistOptions {
email: string
}
export async function joinWaitlistCommand(options: JoinWaitlistOptions): Promise<void> {
// Basic email validation
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
if (!emailRegex.test(options.email)) {
console.error(chalk.red('✗ Invalid email format'))
process.exit(1)
}
console.log(`Joining waitlist with email: ${options.email}...`)
try {
const response = await fetch('https://www.humanlayer.dev/api/waitlist', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'User-Agent': 'humanlayer-cli',
},
body: JSON.stringify({ email: options.email }),
})
if (!response.ok) {
// Try to parse error message from response
let errorMessage = `${response.status} ${response.statusText}`
try {
const errorData = await response.json()
if (errorData.message || errorData.error) {
errorMessage = errorData.message || errorData.error
}
} catch {
// Ignore JSON parse errors, use default message
}
throw new Error(errorMessage)
}
// Success!
console.log(chalk.green('✓ Successfully joined the HumanLayer Code waitlist!'))
console.log(`We'll contact you at ${options.email} when we're ready to onboard you.`)
console.log()
console.log(chalk.cyan('Next steps:'))
console.log(' • Check your email for a confirmation')
console.log(' • Check out https://humanlayer.dev')
console.log(' • Join our Discord community: https://humanlayer.dev/discord')
} catch (error) {
console.error(chalk.red('✗ Failed to join waitlist'))
if (error instanceof Error) {
console.error(chalk.red(`Error: ${error.message}`))
} else {
console.error(chalk.red(`Error: ${error}`))
}
process.exit(1)
}
}

View File

@@ -13,6 +13,7 @@ import { pingCommand } from './commands/ping.js'
import { launchCommand } from './commands/launch.js'
import { alertCommand } from './commands/alert.js'
import { thoughtsCommand } from './commands/thoughts.js'
import { joinWaitlistCommand } from './commands/joinWaitlist.js'
import { startDefaultMCPServer, startClaudeApprovalsMCPServer } from './mcp.js'
import {
getDefaultConfigPath,
@@ -74,7 +75,7 @@ program
.description('HumanLayer, but on your command-line.')
.version(packageJson.version)
const UNPROTECTED_COMMANDS = ['config', 'login', 'thoughts']
const UNPROTECTED_COMMANDS = ['config', 'login', 'thoughts', 'join-waitlist']
program.hook('preAction', async (thisCmd, actionCmd) => {
// Get the full command path by traversing up the command hierarchy
@@ -210,6 +211,13 @@ mcpCommand
// Add thoughts command
thoughtsCommand(program)
// Add join-waitlist command
program
.command('join-waitlist')
.description('Join the HumanLayer Code early access waitlist')
.requiredOption('--email <email>', 'Your email address')
.action(joinWaitlistCommand)
// Handle unknown commands
program.on('command:*', operands => {
console.error(`Unknown command: ${operands[0]}`)