UNPKG

evolve-memory-system

Version:

一个集成了GraphRAG, LMCE和MCP工具的本地记忆系统,专为小说《进化》设计。

72 lines (62 loc) 2.43 kB
#!/usr/bin/env node const { program } = require('commander'); const chalk = require('chalk'); const spawn = require('cross-spawn'); const path = require('path'); const os = require('os'); // 获取Evolve主目录 const EVOLVE_HOME = path.join(os.homedir(), '.evolve'); program .version('1.0.5') .description(chalk.cyan('Evolve Memory System CLI - 小说《进化》记忆系统管理工具')); program .command('start') .description(chalk.green('🚀 启动所有服务 (Neo4j, LMCE, MCP)')) .action(() => { console.log(chalk.blue('正在启动所有服务...')); const scriptPath = path.join(__dirname, 'scripts', 'start-all.sh'); // 设置工作目录为EVOLVE_HOME spawn.sync(scriptPath, [], { stdio: 'inherit', cwd: EVOLVE_HOME }); }); program .command('stop') .description(chalk.red('🛑 停止所有服务')) .action(() => { console.log(chalk.yellow('正在停止所有服务...')); const scriptPath = path.join(__dirname, 'scripts', 'stop-all.sh'); // 设置工作目录为EVOLVE_HOME spawn.sync(scriptPath, [], { stdio: 'inherit', cwd: EVOLVE_HOME }); }); program .command('status') .description(chalk.yellow('📊 检查所有服务状态')) .action(() => { console.log(chalk.magenta('正在检查服务状态...')); const scriptPath = path.join(__dirname, 'scripts', 'status.sh'); // 设置工作目录为EVOLVE_HOME spawn.sync(scriptPath, [], { stdio: 'inherit', cwd: EVOLVE_HOME }); }); program .command('init-db') .description(chalk.blue('🔄 初始化或重置数据库')) .option('--reset', '清空并重置数据库') .action((options) => { console.log(chalk.blue('正在初始化数据库...')); const scriptPath = path.join(__dirname, 'scripts', 'init-graphrag.py'); const args = options.reset ? ['reset'] : []; // 设置工作目录为EVOLVE_HOME spawn.sync('python3', [scriptPath, ...args], { stdio: 'inherit', cwd: EVOLVE_HOME }); }); program .command('connect-claude') .description(chalk.magenta('🔗 连接到Claude Code')) .action(() => { console.log(chalk.blue('正在配置Claude Code工具...')); const configPath = path.join(__dirname, '.claude', 'tools'); console.log(chalk.green(`请将以下路径添加到Claude Code的工具配置中:`)); console.log(chalk.yellow(configPath)); }); program.parse(process.argv); if (!program.args.length) { program.help(); }