sane-assistant / src /cli.ts
agenthinkmesh's picture
Upload project files
c13f797 verified
Raw History Blame Contribute Delete
2.3 kB
#!/usr/bin/env node
import { Command } from 'commander';
import chalk from 'chalk';
const program = new Command();
program
.name('sane')
.description('🦅 صانع — المساعد الشخصي الذكي للخليج العربي')
.version('1.0.0');
program
.command('start')
.description('تشغيل صانع | Start San\'e gateway')
.option('-p, --port <port>', 'رقم المنفذ', '18789')
.option('-v, --verbose', 'وضع التفصيل')
.action(async (options) => {
if (options.verbose) {
process.env.LOG_LEVEL = 'debug';
}
if (options.port) {
process.env.SANE_GATEWAY_PORT = options.port;
}
const { SaneGateway } = await import('./gateway');
const gateway = new SaneGateway();
await gateway.initialize();
});
program
.command('onboard')
.description('إعداد صانع لأول مرة | First-time setup wizard')
.action(async () => {
await import('./cli/onboard');
});
program
.command('chat')
.description('محادثة مباشرة في الطرفية | Chat directly in terminal')
.action(async () => {
await import('./cli/chat');
});
program
.command('status')
.description('حالة صانع | Check San\'e status')
.action(async () => {
const axios = (await import('axios')).default;
const port = process.env.SANE_GATEWAY_PORT || '18789';
try {
const response = await axios.get(`http://localhost:${port}/health`);
console.log(chalk.green('✅ صانع يعمل:'));
console.log(JSON.stringify(response.data, null, 2));
} catch {
console.log(chalk.red('❌ صانع لا يعمل. شغّله بـ: sane start'));
}
});
program
.command('skills')
.description('عرض المهارات المتاحة | List available skills')
.action(async () => {
const { SkillsLoader } = await import('./skills-loader');
const loader = new SkillsLoader();
await loader.loadAll();
const skills = loader.listSkills();
console.log(chalk.cyan('\n🦅 المهارات المتاحة في صانع:\n'));
for (const skill of skills) {
console.log(chalk.yellow(` ${skill.nameAr}`) + chalk.gray(` (${skill.name})`));
console.log(chalk.gray(` ${skill.description}`));
}
console.log();
});
program.parse();