@vooodooo/magic
Version:
Vooodooo - AI orchestration platform
258 lines • 9.15 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const index_1 = require("./index");
// Create CLI program
const program = new commander_1.Command();
program
.name('vooodooo')
.description('Vooodooo CLI - AI-first planning and documentation')
.version('0.1.0');
// Agent commands
program
.command('agent:list')
.description('List available agents')
.option('-d, --dir <directory>', 'Agents directory')
.action(async (options) => {
const agentManager = (0, index_1.createAgentManager)({
agentsDir: options.dir
});
const agents = agentManager.listAgents();
if (agents.length === 0) {
console.log('No agents found');
return;
}
console.log('Available agents:');
agents.forEach(agent => {
console.log(`- ${agent.name} (${agent.role}): ${agent.description}`);
});
});
program
.command('agent:activate <name>')
.description('Activate an agent')
.option('-d, --dir <directory>', 'Agents directory')
.option('-r, --rules <directory>', 'Cursor rules directory')
.action(async (name, options) => {
const agentManager = (0, index_1.createAgentManager)({
agentsDir: options.dir,
cursorRulesDir: options.rules
});
const success = agentManager.activateAgent(name);
if (!success) {
process.exit(1);
}
});
program
.command('agent:deactivate')
.description('Deactivate the current agent')
.option('-r, --rules <directory>', 'Cursor rules directory')
.action(async (options) => {
const agentManager = (0, index_1.createAgentManager)({
cursorRulesDir: options.rules
});
agentManager.deactivateAgent();
});
// Plan commands
program
.command('plan:create')
.description('Create a plan from a template')
.option('-t, --template <id>', 'Template ID', 'default')
.option('-o, --output <path>', 'Output path', './plan.md')
.option('-n, --name <name>', 'Project name', 'Project')
.option('-d, --description <description>', 'Project description', '')
.option('--templates-dir <directory>', 'Templates directory')
.action(async (options) => {
const planSystem = (0, index_1.createPlanSystem)(options.templatesDir);
// Get template
const template = planSystem.getTemplate(options.template);
if (!template) {
console.error(`Template not found: ${options.template}`);
const templates = planSystem.getTemplates();
if (templates.length > 0) {
console.log('Available templates:');
templates.forEach(t => console.log(`- ${t.id}: ${t.name}`));
}
else {
console.log('No templates found');
}
process.exit(1);
}
// Generate plan
try {
planSystem.generatePlan({
templateId: options.template,
values: {
projectName: options.name,
description: options.description,
// Add other values as needed
date: new Date().toISOString().split('T')[0]
},
outputPath: options.output
});
console.log(`Plan created: ${options.output}`);
}
catch (error) {
console.error('Error creating plan:', error);
process.exit(1);
}
});
program
.command('plan:list')
.description('List available plan templates')
.option('--templates-dir <directory>', 'Templates directory')
.action(async (options) => {
const planSystem = (0, index_1.createPlanSystem)(options.templatesDir);
const templates = planSystem.getTemplates();
if (templates.length === 0) {
console.log('No templates found');
return;
}
console.log('Available templates:');
templates.forEach(template => {
console.log(`- ${template.id}: ${template.name}`);
});
});
// Documentation commands
program
.command('docs:create-human')
.description('Convert AI documentation to human-readable format')
.option('-s, --source <path>', 'Source AI documentation file or directory', './docs/ai')
.option('-o, --output <path>', 'Output path for human documentation', './docs/human')
.option('-r, --recursive', 'Process directories recursively', false)
.action(async (options) => {
const docSystem = (0, index_1.createDocSystem)();
try {
await docSystem.convertAiToHuman({
input: options.source,
output: options.output,
recursive: options.recursive
});
console.log('Documentation converted successfully');
}
catch (error) {
console.error('Error converting documentation:', error);
process.exit(1);
}
});
program
.command('docs:create-ai')
.description('Convert human documentation to AI-optimized format')
.option('-s, --source <path>', 'Source human documentation file or directory', './docs/human')
.option('-o, --output <path>', 'Output path for AI documentation', './docs/ai')
.option('-r, --recursive', 'Process directories recursively', false)
.action(async (options) => {
const docSystem = (0, index_1.createDocSystem)();
try {
await docSystem.convertHumanToAi({
input: options.source,
output: options.output,
recursive: options.recursive
});
console.log('Documentation converted successfully');
}
catch (error) {
console.error('Error converting documentation:', error);
process.exit(1);
}
});
// Initialize command
program
.command('init')
.description('Initialize Vooodooo in the current directory')
.option('--with-sobriquet', 'Set up Sobriquet plugin support', false)
.action(async (options) => {
// Create directories
const dirs = [
'./agents',
'./docs/ai',
'./docs/human',
'./templates/plans',
'./plugins'
];
for (const dir of dirs) {
try {
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
const path = await Promise.resolve().then(() => __importStar(require('path')));
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
console.log(`Created directory: ${dir}`);
}
}
catch (error) {
console.error(`Error creating directory ${dir}:`, error);
}
}
// Create .vooodooorc.js configuration file
try {
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
const content = `module.exports = {
plugins: [
${options.withSobriquet ? "'vooodooo-sobriquet'" : ''}
],
agents: {
defaultAgent: 'visionary-architect'
},
planning: {
templatesDir: './templates/plans',
outputDir: './plans'
},
documentation: {
aiDir: './docs/ai',
humanDir: './docs/human'
}
};`;
fs.writeFileSync('./.vooodooorc.js', content, 'utf8');
console.log('Created .vooodooorc.js configuration file');
}
catch (error) {
console.error('Error creating configuration file:', error);
}
console.log('Vooodooo initialized successfully!');
if (options.withSobriquet) {
console.log('\nTo complete Sobriquet setup:');
console.log('1. Install vooodooo-sobriquet: npm install vooodooo-sobriquet');
console.log('2. Create domain-specific agents in ./agents directory');
console.log('3. Create domain-specific templates in ./templates/plans directory');
}
});
// Parse command line arguments
program.parse(process.argv);
// Show help if no command provided
if (!process.argv.slice(2).length) {
program.outputHelp();
}
//# sourceMappingURL=cli.js.map