guanghulab/scripts/engine-one-liner.js
Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

66 lines
4.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
/**
* 光湖驱动引擎 · 单行安装命令生成器
* Guanghu Drive Engine · One-liner Installer Generator
*
* 用途:生成一行命令,粘贴到任何服务器的终端即可安装引擎
*
* 运行node scripts/engine-one-liner.js
* 输出:一行 curl | bash 命令
*
* 版权:国作登字-2026-A-00037559 · TCS-0002∞
*/
const fs = require('fs');
const path = require('path');
// 引擎代码路径gatekeeper/index.js
const ENGINE_PATH = path.join(__dirname, '..', 'mcp-servers', 'zhuyuan-gateway', 'gatekeeper', 'index.js');
// ██████████████████████████████████████████████████████████████████████
// 第一步:读取引擎代码
// ██████████████████████████████████████████████████████████████████████
const engineCode = fs.readFileSync(ENGINE_PATH, 'utf-8');
const engineBase64 = Buffer.from(engineCode).toString('base64');
// 生成引擎文件名(带随机后缀防止多台服务器文件名冲突)
const FILENAME = 'ge.js';
// ██████████████████████████████████████████████████████████████████████
// 第二步:生成安装命令
// ██████████████████████████████████████████████████████████████████████
const oneLiner = `echo '${engineBase64}' | base64 -d > /tmp/${FILENAME} && node /tmp/${FILENAME} 3910 &`;
// ██████████████████████████████████████████████████████████████████████
// 第三步:输出
// ██████████████████████████████████████████████████████████████████████
console.log('');
console.log('╔══════════════════════════════════════════════════════════════╗');
console.log('║ 光湖驱动引擎 · 单行安装命令 ║');
console.log('╚══════════════════════════════════════════════════════════════╝');
console.log('');
console.log('▶ 复制下面这一整行命令,粘贴到服务器的终端,按回车:');
console.log('');
console.log(oneLiner);
console.log('');
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log('');
console.log('安装后:');
console.log(' 1. 引擎会在端口 3910 启动');
console.log(' 2. 第一次启动会自动生成 API 密钥');
console.log(' 3. 密钥显示在终端上(只看一次!)');
console.log(' 4. 把密钥复制下来发给铸渊');
console.log(' 5. 要验证: curl -X POST http://127.0.0.1:3910/health');
console.log('');
console.log('密钥保存在: ~/.gatekeeper/secret');
console.log('');
// 同时统计信息
console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
console.log(` 引擎代码: ${engineCode.length} 字符`);
console.log(` 打包后: ${engineBase64.length} 字符`);
console.log(` 单行命令: ${oneLiner.length} 字符`);
console.log('');