roocommander
Version:
Bridge Claude Code skills to Roo Code with intelligent orchestration. CLI tool + Custom Mode + 60+ production-tested skills for Cloudflare, AI, Frontend development.
207 lines ⢠8.23 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.cli = void 0;
exports.handleNoCommand = handleNoCommand;
const commander_1 = require("commander");
const chalk_1 = __importDefault(require("chalk"));
const inquirer_1 = __importDefault(require("inquirer"));
const list_js_1 = require("./commands/list.js");
const read_js_1 = require("./commands/read.js");
const search_js_1 = require("./commands/search.js");
const generate_index_js_1 = require("./commands/generate-index.js");
const sync_index_js_1 = require("./commands/sync-index.js");
const init_js_1 = require("./commands/init.js");
const global_installer_js_1 = require("./installer/global-installer.js");
const template_installer_js_1 = require("./installer/template-installer.js");
/**
* Main CLI Program
*
* Defines all commands and global options for roocommander.
*/
const cli = new commander_1.Command();
exports.cli = cli;
cli
.name('roocommander')
.description('CLI tool to bridge Claude Code skills with Roo Code')
.version('9.5.0');
/**
* Command: list
* Show all available skills with descriptions
*/
cli
.command('list')
.description('List all available skills from ~/.claude/skills/')
.option('-s, --source <path>', 'Custom skills directory path')
.option('-v, --verbose', 'Show full descriptions and details')
.action(async (options) => {
await (0, list_js_1.listCommand)(options);
});
/**
* Command: read <skill>
* Output skill content to stdout
*/
cli
.command('read <skill>')
.description('Read and output a specific skill content')
.option('-s, --source <path>', 'Custom skills directory path')
.option('-r, --raw', 'Output raw markdown without formatting')
.action(async (skill, options) => {
await (0, read_js_1.readCommand)(skill, options);
});
/**
* Command: search <keyword>
* Find skills matching keyword
*/
cli
.command('search <keyword>')
.description('Search for skills by keyword')
.option('-s, --source <path>', 'Custom skills directory path')
.option('-v, --verbose', 'Show full descriptions and details')
.action(async (keyword, options) => {
await (0, search_js_1.searchCommand)(keyword, options);
});
/**
* Command: generate-index
* Generate skills index markdown file
*/
cli
.command('generate-index')
.description('Generate skills index for custom instructions')
.option('-s, --source <path>', 'Custom skills directory path')
.option('-o, --output <path>', 'Output file path', '.roo/rules/01-skills-index.md')
.action(async (options) => {
await (0, generate_index_js_1.generateIndexCommand)(options);
});
/**
* Command: sync-index
* Update existing skills index
*/
cli
.command('sync-index')
.description('Update skills index after skills change')
.option('-s, --source <path>', 'Custom skills directory path')
.option('-o, --output <path>', 'Output file path', '.roo/rules/01-skills-index.md')
.action(async (options) => {
await (0, sync_index_js_1.syncIndexCommand)(options);
});
/**
* Command: init
* Initialize Roo Commander setup (global by default)
*/
cli
.command('init')
.description('Initialize Roo Commander (global by default, use --project for local)')
.option('-s, --source <path>', 'Custom skills directory path')
.option('-r, --repo <url>', 'GitHub repository URL for skills (e.g., user/repo)')
.option('--force', 'Force reinstall (overwrite existing files)')
.option('--project', 'Install to current project only (not globally)')
.option('--classic', 'Install classic MDTM-based version (v8) instead of modern')
.action(async (options) => {
await (0, init_js_1.initCommand)(options);
});
// Handle unknown commands
cli.on('command:*', () => {
console.error(chalk_1.default.red(`\nError: Unknown command '${cli.args.join(' ')}'`));
console.log(chalk_1.default.white('\nRun \'roocommander --help\' for available commands.\n'));
process.exit(1);
});
/**
* Smart auto-init when no command provided
* Detects installation status and offers appropriate actions
*/
async function handleNoCommand() {
const projectRoot = process.cwd();
const globalInstalled = (0, global_installer_js_1.isGloballyInstalled)();
const projectInstalled = (0, template_installer_js_1.isInstalled)(projectRoot);
// Case D: Both global AND project installed - show help
if (globalInstalled && projectInstalled) {
cli.help();
return;
}
// Case A: Nothing installed - first time setup
if (!globalInstalled && !projectInstalled) {
console.log(chalk_1.default.bold.cyan('\nš Welcome to Roo Commander!\n'));
console.log(chalk_1.default.white('Roo Commander bridges Claude Code skills to Roo Code with intelligent orchestration.\n'));
console.log(chalk_1.default.white('It looks like this is your first time running Roo Commander.'));
console.log(chalk_1.default.white('Let\'s get you set up with an interactive installation.\n'));
const { proceed } = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'proceed',
message: 'Continue with setup?',
default: true,
},
]);
if (proceed) {
await (0, init_js_1.initCommand)({});
}
else {
console.log(chalk_1.default.white('\nSetup cancelled. Run \'roocommander init\' when you\'re ready.\n'));
}
return;
}
// Case B: Global installed, but NOT in current project
if (globalInstalled && !projectInstalled) {
console.log(chalk_1.default.bold.cyan('\nš Roo Commander is installed globally\n'));
const { action } = await inquirer_1.default.prompt([
{
type: 'list',
name: 'action',
message: 'What would you like to do?',
choices: [
{ name: 'View available commands (help)', value: 'help', short: 'Help' },
{ name: 'Install to this project as well', value: 'install-project', short: 'Install to project' },
{ name: 'Exit', value: 'exit', short: 'Exit' },
],
default: 'help',
},
]);
if (action === 'help') {
console.log(); // blank line
cli.help();
}
else if (action === 'install-project') {
await (0, init_js_1.initCommand)({ project: true });
}
else {
console.log(chalk_1.default.white('\nExiting...\n'));
}
return;
}
// Case C: Project installed (current directory)
if (projectInstalled) {
console.log(chalk_1.default.bold.cyan('\nš Roo Commander is installed in this project\n'));
const { action } = await inquirer_1.default.prompt([
{
type: 'list',
name: 'action',
message: 'What would you like to do?',
choices: [
{ name: 'View available commands (help)', value: 'help', short: 'Help' },
{ name: 'Reinstall/reconfigure this project', value: 'reinstall', short: 'Reinstall' },
{ name: 'Install to a different folder', value: 'install-other', short: 'Install elsewhere' },
{ name: 'Exit', value: 'exit', short: 'Exit' },
],
default: 'help',
},
]);
if (action === 'help') {
console.log(); // blank line
cli.help();
}
else if (action === 'reinstall') {
await (0, init_js_1.initCommand)({ project: true, force: true });
}
else if (action === 'install-other') {
console.log(chalk_1.default.yellow('\nš” Tip: Navigate to the target folder and run \'roocommander init --project\'\n'));
}
else {
console.log(chalk_1.default.white('\nExiting...\n'));
}
return;
}
}
//# sourceMappingURL=cli.js.map