mongodb-claude-setup
Version:
Intelligent MongoDB development ecosystem for Claude Code with modular agent installation
212 lines ⢠8.47 kB
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const ora_1 = __importDefault(require("ora"));
const inquirer_1 = __importDefault(require("inquirer"));
const installer_1 = require("../components/installer");
const environment_1 = require("../utils/environment");
const banner_1 = require("../utils/banner");
const components_1 = require("../utils/components");
const updater_1 = require("../components/updater");
const uninstaller_1 = require("../components/uninstaller");
const planner_1 = require("../utils/planner");
const components_2 = require("../utils/components");
const program = new commander_1.Command();
program
.name('mongodb-claude-setup')
.description('Intelligent MongoDB development ecosystem for Claude Code')
.version('1.0.0');
// Main installation command
program
.option('--all', 'Install all MongoDB components')
.option('--agent <agents>', 'Install specific agents (comma-separated)')
.option('--command <commands>', 'Install specific commands (comma-separated)')
.option('--category <category>', 'Install by category (design, deployment, optimization)')
.option('--preset <preset>', 'Install preset configuration (minimal, developer, devops, full)')
.option('--mcp-only', 'Install only MCP servers')
.option('--interactive', 'Interactive installation mode')
.option('--dry-run', 'Show what would be installed without actually installing')
.option('--skip-validation', 'Skip environment validation (use if Cline is installed but not detected)')
.action(async (options) => {
try {
(0, banner_1.showBanner)();
// Validate environment (unless skipped)
if (options.skipValidation) {
console.log(chalk_1.default.yellow('ā ļø Environment validation skipped'));
}
else {
const spinner = (0, ora_1.default)('Validating environment...').start();
const envCheck = await (0, environment_1.validateEnvironment)();
if (!envCheck.valid) {
spinner.fail('Environment validation failed');
console.log(chalk_1.default.red('Issues found:'));
envCheck.issues.forEach((issue) => console.log(chalk_1.default.red(` ⢠${issue}`)));
console.log(chalk_1.default.yellow('\nš” Tip: Use --skip-validation to bypass this check if Cline is installed but not detected'));
process.exit(1);
}
spinner.succeed('Environment validated');
}
// Determine installation mode
let installConfig;
if (options.interactive || (!options.all && !options.agent && !options.command && !options.category && !options.preset && !options.mcpOnly)) {
installConfig = await interactiveSetup();
}
else {
installConfig = parseOptions(options);
}
// Show installation plan
console.log(chalk_1.default.blue('\nš Installation Plan:'));
showInstallationPlan(installConfig);
if (options.dryRun) {
console.log(chalk_1.default.yellow('\nš Dry run completed. No changes made.'));
return;
}
// Confirm installation
const { confirm } = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Proceed with installation?',
default: true
}
]);
if (!confirm) {
console.log(chalk_1.default.yellow('Installation cancelled.'));
return;
}
// Perform installation
await (0, installer_1.setupMongoDB)(installConfig);
console.log(chalk_1.default.green('\nā
MongoDB Claude ecosystem installed successfully!'));
console.log(chalk_1.default.blue('\nš Next steps:'));
console.log(' ⢠Restart Claude Code to load new agents');
console.log(' ⢠Try: "Help me design a MongoDB schema"');
console.log(' ⢠Use /mongo-schema-design for interactive design');
}
catch (error) {
console.error(chalk_1.default.red('\nā Installation failed:'), error.message);
process.exit(1);
}
});
// List available components
program
.command('list')
.description('List available components')
.option('--agents', 'List available agents')
.option('--commands', 'List available commands')
.option('--categories', 'List available categories')
.action((options) => {
(0, components_1.listComponents)(options);
});
// Update components
program
.command('update')
.description('Update installed components')
.option('--all', 'Update all components')
.option('--agent <agents>', 'Update specific agents')
.action(async (options) => {
await (0, updater_1.updateComponents)(options);
});
// Uninstall components
program
.command('uninstall')
.description('Uninstall components')
.option('--all', 'Uninstall all MongoDB components')
.option('--agent <agents>', 'Uninstall specific agents')
.action(async (options) => {
await (0, uninstaller_1.uninstallComponents)(options);
});
async function interactiveSetup() {
console.log(chalk_1.default.blue('\nšÆ Interactive MongoDB Setup'));
const answers = await inquirer_1.default.prompt([
{
type: 'list',
name: 'setupType',
message: 'What type of setup do you need?',
choices: [
{ name: 'šØ Schema Design & Architecture', value: 'design' },
{ name: 'š Full Development Stack', value: 'developer' },
{ name: 'āļø DevOps & Production', value: 'devops' },
{ name: 'š§ Custom Selection', value: 'custom' },
{ name: 'š¦ Everything', value: 'all' }
]
}
]);
if (answers.setupType === 'custom') {
return await customSetup();
}
return { preset: answers.setupType };
}
async function customSetup() {
const components = (0, components_2.getAvailableComponents)();
const answers = await inquirer_1.default.prompt([
{
type: 'checkbox',
name: 'agents',
message: 'Select agents to install:',
choices: components.agents.map(agent => ({
name: `${agent.name} - ${agent.description}`,
value: agent.id
}))
},
{
type: 'checkbox',
name: 'commands',
message: 'Select commands to install:',
choices: components.commands.map(cmd => ({
name: `${cmd.name} - ${cmd.description}`,
value: cmd.id
}))
}
]);
return answers;
}
function parseOptions(options) {
const config = {};
if (options.all) {
config.preset = 'all';
}
else if (options.preset) {
config.preset = options.preset;
}
else if (options.category) {
config.category = options.category;
}
else {
if (options.agent) {
config.agents = options.agent.split(',').map(s => s.trim());
}
if (options.command) {
config.commands = options.command.split(',').map(s => s.trim());
}
if (options.mcpOnly) {
config.mcpOnly = true;
}
}
return config;
}
function showInstallationPlan(config) {
const plan = (0, planner_1.getInstallationPlan)(config);
if (plan.mcps.length > 0) {
console.log(chalk_1.default.cyan(' MCP Servers:'));
plan.mcps.forEach(mcp => console.log(` ⢠${mcp}`));
}
if (plan.agents.length > 0) {
console.log(chalk_1.default.green(' Agents:'));
plan.agents.forEach(agent => console.log(` ⢠${agent}`));
}
if (plan.commands.length > 0) {
console.log(chalk_1.default.yellow(' Commands:'));
plan.commands.forEach(cmd => console.log(` ⢠${cmd}`));
}
if (plan.settings.length > 0) {
console.log(chalk_1.default.magenta(' Settings:'));
plan.settings.forEach(setting => console.log(` ⢠${setting}`));
}
}
program.parse();
//# sourceMappingURL=cli.js.map
;