@kya-os/cli
Version:
CLI for KYA-OS MCP-I setup and management
160 lines • 5.5 kB
JavaScript
import inquirer from 'inquirer';
import chalk from 'chalk';
export async function promptForInit(defaults = {}) {
console.log(chalk.cyan('\n🚀 MCP-I Initialization\n'));
const answers = await inquirer.prompt([
{
type: 'input',
name: 'name',
message: 'What\'s your agent name?',
default: defaults.name || 'My MCP Agent',
validate: (input) => {
if (!input.trim())
return 'Agent name is required';
if (input.length < 3)
return 'Agent name must be at least 3 characters';
if (input.length > 50)
return 'Agent name must be less than 50 characters';
return true;
}
},
{
type: 'input',
name: 'description',
message: 'Brief description of your agent:',
default: defaults.description || 'An MCP server that provides helpful tools',
validate: (input) => {
if (!input.trim())
return 'Description is required';
if (input.length > 200)
return 'Description must be less than 200 characters';
return true;
}
},
{
type: 'input',
name: 'repository',
message: 'Repository URL (optional):',
default: defaults.repository,
filter: (input) => input.trim() || undefined
},
{
type: 'list',
name: 'directories',
message: 'Which directories should list your agent?',
choices: [
{ name: 'All verified directories (recommended)', value: 'verified' },
{ name: 'Specific directories only', value: 'specific' },
{ name: 'None (registry only)', value: 'none' }
],
default: 'verified'
},
{
type: 'checkbox',
name: 'specificDirectories',
message: 'Select directories:',
choices: [
{ name: 'Smithery', value: 'smithery' },
{ name: 'Glama', value: 'glama' },
{ name: 'Cursor', value: 'cursor' }
],
when: (answers) => answers.directories === 'specific',
validate: (input) => {
if (input.length === 0)
return 'Please select at least one directory';
return true;
}
},
{
type: 'confirm',
name: 'confirmRegistration',
message: 'Register agent with knowthat.ai now?',
default: true
},
{
type: 'confirm',
name: 'confirmEnvCreation',
message: 'Create environment files?',
default: true
}
]);
return answers;
}
export async function confirmOverwrite(filename) {
const { confirm } = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: chalk.yellow(`${filename} already exists. Overwrite?`),
default: false
}
]);
return confirm;
}
export async function confirmRotation() {
const answers = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: chalk.yellow('Are you sure you want to rotate your keys? This cannot be undone.'),
default: false
},
{
type: 'input',
name: 'reason',
message: 'Reason for rotation:',
when: (answers) => answers.confirm,
default: 'Manual rotation'
}
]);
return {
confirm: answers.confirm,
reason: answers.reason || 'Manual rotation'
};
}
export async function selectPlatform(detected) {
const { platform } = await inquirer.prompt([
{
type: 'list',
name: 'platform',
message: 'Select your deployment platform:',
choices: [
{ name: 'Next.js / Vercel', value: 'vercel' },
{ name: 'Node.js', value: 'node' },
{ name: 'AWS Lambda', value: 'lambda' },
{ name: 'Docker', value: 'docker' },
{ name: 'Other', value: 'unknown' }
],
default: detected || 'node'
}
]);
return platform;
}
export async function confirmMcpVariableReplacement(existingDid) {
console.log(chalk.yellow('\n⚠ Existing MCP Identity detected!'));
console.log(` Current DID: ${chalk.cyan(existingDid)}`);
console.log('\n This will replace your existing agent identity.');
console.log(' Make sure you have backed up your private key if needed.\n');
const { confirm } = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Replace existing MCP identity variables?',
default: false
}
]);
return confirm;
}
export function showSuccess(message) {
console.log(chalk.green(`\n✅ ${message}\n`));
}
export function showError(message) {
console.log(chalk.red(`\n❌ Error: ${message}\n`));
}
export function showWarning(message) {
console.log(chalk.yellow(`\n⚠️ Warning: ${message}\n`));
}
export function showInfo(message) {
console.log(chalk.blue(`\nℹ️ ${message}\n`));
}
//# sourceMappingURL=prompts.js.map