File size: 2,303 Bytes
c13f797
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/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();