natureco-cli 5.6.23 → 5.6.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "natureco-cli",
3
- "version": "5.6.23",
3
+ "version": "5.6.25",
4
4
  "description": "OpenClaw'dan daha güvenli, daha hızlı, daha ucuz AI agent CLI. Multi-agent, self-evolving skills, audit log, maliyet optimizasyonu ve NatureCo platform-native.",
5
5
  "bin": {
6
6
  "natureco": "bin/natureco.js"
@@ -74,6 +74,7 @@
74
74
  "node-telegram-bot-api": "^0.67.0",
75
75
  "openai": "^6.44.0",
76
76
  "pino": "^8.21.0",
77
+ "qrcode": "^1.5.4",
77
78
  "qrcode-terminal": "^0.12.0",
78
79
  "semver": "^7.8.1",
79
80
  "twilio": "^6.0.2",
@@ -6,16 +6,67 @@ const { execSync } = require('child_process');
6
6
 
7
7
  const { checkExistingToken } = require('./channel-helper');
8
8
 
9
- async function imessage(action) {
9
+ async function imessage(action, recipient, message) {
10
10
  if (!action || action === 'connect') return connectImessage();
11
11
  if (action === 'disconnect') return disconnectImessage();
12
12
  if (action === 'status') return statusImessage();
13
13
  if (action === 'probe') return probeImessage();
14
+ if (action === 'send') return sendMessage(recipient, message);
14
15
  console.log(chalk.red('\n❌ Unknown action\n'));
15
- console.log(chalk.gray('Available actions: connect, disconnect, status, probe\n'));
16
+ console.log(chalk.gray('Available actions: connect, disconnect, status, probe, send\n'));
16
17
  process.exit(1);
17
18
  }
18
19
 
20
+ /**
21
+ * v5.6.25: iMessage ile mesaj gönder
22
+ * @param {string} recipient - Telefon numarası veya Apple ID email
23
+ * @param {string} message - Mesaj metni
24
+ */
25
+ async function sendMessage(recipient, message) {
26
+ const config = getConfig();
27
+
28
+ if (!config.imessageCliPath) {
29
+ console.log(chalk.red('\n❌ iMessage bağlı değil. Önce "natureco imessage connect" çalıştırın.\n'));
30
+ process.exit(1);
31
+ }
32
+
33
+ if (!recipient) {
34
+ console.log(chalk.red('\n❌ Alıcı belirtilmedi\n'));
35
+ console.log(chalk.gray('Kullanım: natureco imessage send <numara|email> <mesaj>\n'));
36
+ console.log(chalk.gray('Örnek: natureco imessage send +905551234567 Merhaba!\n'));
37
+ process.exit(1);
38
+ }
39
+
40
+ if (!message) {
41
+ console.log(chalk.red('\n❌ Mesaj belirtilmedi\n'));
42
+ process.exit(1);
43
+ }
44
+
45
+ // Birden fazla kelimeyi birleştir
46
+ const fullMessage = process.argv.slice(process.argv.indexOf(recipient) + 1).join(' ') || message;
47
+
48
+ console.log(chalk.cyan(`\n📤 iMessage gönderiliyor...`));
49
+ console.log(chalk.gray(` Alıcı: ${recipient}`));
50
+ console.log(chalk.gray(` Mesaj: ${fullMessage.slice(0, 60)}${fullMessage.length > 60 ? '...' : ''}\n`));
51
+
52
+ try {
53
+ // imsg send komutu
54
+ const cmd = `${config.imessageCliPath} send --recipient "${recipient}" --text "${fullMessage.replace(/"/g, '\\"')}"`;
55
+ const output = execSync(cmd, { encoding: 'utf8', timeout: 30000 });
56
+
57
+ console.log(chalk.green('✅ Mesaj gönderildi!'));
58
+ if (output && output.trim()) {
59
+ console.log(chalk.gray(output.trim()));
60
+ }
61
+ return { success: true, recipient, message: fullMessage };
62
+ } catch (e) {
63
+ console.log(chalk.red('❌ Mesaj gönderilemedi'));
64
+ if (e.stderr) console.log(chalk.gray(e.stderr.toString()));
65
+ else if (e.message) console.log(chalk.gray(e.message));
66
+ return { success: false, error: e.message };
67
+ }
68
+ }
69
+
19
70
  async function connectImessage() {
20
71
  const config = getConfig();
21
72
  if (!config.providerUrl) {
@@ -1,6 +1,7 @@
1
1
  const chalk = require('chalk');
2
2
  const inquirer = require('../utils/inquirer-wrapper');
3
3
  const qrcode = require('qrcode-terminal');
4
+ const QRCode = require('qrcode');
4
5
  const fs = require('fs');
5
6
  const path = require('path');
6
7
  const os = require('os');
@@ -108,7 +109,22 @@ async function startWhatsAppConnection(sessionDir, botId, selectedBot, config) {
108
109
 
109
110
  // Display QR code in terminal
110
111
  qrcode.generate(qr, { small: true });
111
-
112
+
113
+ // v5.6.24: QR'i PNG olarak da kaydet, browserda ac
114
+ try {
115
+ const qrPngPath = path.join(sessionDir, 'qr.png');
116
+ await QRCode.toFile(qrPngPath, qr, {
117
+ type: 'png',
118
+ width: 600,
119
+ margin: 4,
120
+ color: { dark: '#000000', light: '#FFFFFF' }
121
+ });
122
+ console.log(chalk.green('\n📸 QR PNG kaydedildi: ' + qrPngPath));
123
+ console.log(chalk.cyan('🔗 Browserda acmak icin: open ' + qrPngPath));
124
+ } catch (e) {
125
+ // Sessizce gec, terminal QR yeterli
126
+ }
127
+
112
128
  console.log('');
113
129
  console.log(chalk.gray('1. WhatsApp\'ı açın'));
114
130
  console.log(chalk.gray('2. Ayarlar > Bağlı Cihazlar > Cihaz Bağla'));