mirror of
https://github.com/humanlayer/humanlayer.git
synced 2025-08-20 19:01:22 +03:00
Merge pull request #267 from dexhorthy/dexter/eng-1511-make-npx-humanlayer-join-waitlist-sundeepmalladiio-work-2
waitlist command
This commit is contained in:
59
hlyr/src/commands/joinWaitlist.ts
Normal file
59
hlyr/src/commands/joinWaitlist.ts
Normal 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)
|
||||
}
|
||||
}
|
||||
@@ -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]}`)
|
||||
|
||||
Reference in New Issue
Block a user