jay-code
Version:
Streamlined AI CLI orchestration engine with mathematical rigor and enterprise-grade reliability
142 lines (123 loc) ⢠5.1 kB
text/typescript
/**
* Jay-Code CLI entry point - Remote execution friendly version
* This version can be run directly from GitHub
*/
import { VERSION } from '../core/version.js';
// Simple color functions
const chalk = {
red: (text: string) => `\x1b[31m${text}\x1b[0m`,
green: (text: string) => `\x1b[32m${text}\x1b[0m`,
yellow: (text: string) => `\x1b[33m${text}\x1b[0m`,
blue: (text: string) => `\x1b[34m${text}\x1b[0m`,
gray: (text: string) => `\x1b[90m${text}\x1b[0m`,
bold: (text: string) => `\x1b[1m${text}\x1b[0m`,
};
function printHelp() {
console.log(`
š§ Jay-Code v${VERSION} - Advanced AI Agent Orchestration System
USAGE:
jay-code [COMMAND] [OPTIONS]
COMMANDS:
init Initialize Claude Code integration files
start Start the orchestration system
agent Manage agents (spawn, list, terminate, info)
task Manage tasks (create, list, status, cancel, workflow)
memory Manage memory (query, export, import, stats, cleanup)
mcp Manage MCP server (status, tools, start, stop)
config Manage configuration (show, get, set, init, validate)
status Show system status
monitor Monitor system in real-time
session Manage terminal sessions
workflow Execute workflow files
claude Spawn Claude instances with specific configurations
version Show version information
help Show this help message
OPTIONS:
-c, --config <path> Path to configuration file
-v, --verbose Enable verbose logging
--help Show help for any command
EXAMPLES:
jay-code init # Initialize Claude Code integration
jay-code start # Start orchestration system
jay-code agent spawn researcher # Spawn a research agent
jay-code task create research "Analyze authentication patterns"
jay-code memory store key "value"
jay-code status # Check system status
For more info: https://github.com/ruvnet/claude-code-flow
`);
}
function printSuccess(message: string) {
console.log(chalk.green('ā
' + message));
}
function printError(message: string) {
console.log(chalk.red('ā ' + message));
}
function printWarning(message: string) {
console.log(chalk.yellow('ā ļø ' + message));
}
async function main() {
const args = Deno.args;
const command = args[0] || 'help';
const subArgs = args.slice(1);
switch (command) {
case '--help':
case '-h':
case 'help':
printHelp();
break;
case '--version':
case '-v':
case 'version':
console.log(`Jay-Code v${VERSION}`);
break;
case 'init':
printSuccess('Initializing Claude Code integration files...');
console.log('š This command would create:');
console.log(' - CLAUDE.md (Claude Code configuration)');
console.log(' - memory-bank.md (Memory system documentation)');
console.log(' - coordination.md (Agent coordination documentation)');
console.log(' - Memory folder structure');
console.log('\nš” To run locally, clone the repo and use:');
console.log(' git clone https://github.com/ruvnet/claude-code-flow.git');
console.log(' cd claude-code-flow');
console.log(' npm install -g jay-code');
console.log(' jay-code init');
break;
case 'install':
console.log(chalk.blue('š¦ Installing Jay-Code...'));
console.log('\nRun these commands to install:');
console.log(chalk.gray(' # Using npm (recommended)'));
console.log(' npm install -g jay-code');
console.log('');
console.log(chalk.gray(' # Or using Deno'));
console.log(' deno install --allow-all --name jay-code \\');
console.log(
' https://raw.githubusercontent.com/ruvnet/claude-code-flow/main/src/cli/index.ts',
);
console.log('');
console.log(chalk.gray(' # Or clone and build from source'));
console.log(' git clone https://github.com/ruvnet/claude-code-flow.git');
console.log(' cd claude-code-flow');
console.log(' deno task build');
break;
default:
printWarning(`Command '${command}' requires local installation.`);
console.log('\nš„ To use all features, install Jay-Code:');
console.log(' npm install -g jay-code');
console.log('\nš Or run directly with Deno:');
console.log(' deno install --allow-all --name jay-code \\');
console.log(
' https://raw.githubusercontent.com/ruvnet/claude-code-flow/main/src/cli/index.ts',
);
console.log('\nš Documentation: https://github.com/ruvnet/claude-code-flow');
console.log('š¬ Issues: https://github.com/ruvnet/claude-code-flow/issues');
break;
}
}
if (import.meta.url === `file://${Deno.execPath()}`) {
main().catch((error) => {
printError(`Error: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
});
}