natureco-cli 2.23.30 → 2.23.31

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.
Files changed (67) hide show
  1. package/bin/natureco.js +166 -163
  2. package/package.json +1 -1
  3. package/src/commands/acp.js +39 -0
  4. package/src/commands/admin-rpc.js +83 -0
  5. package/src/commands/agent.js +214 -23
  6. package/src/commands/agents.js +114 -30
  7. package/src/commands/approvals.js +172 -11
  8. package/src/commands/browser.js +815 -0
  9. package/src/commands/capability.js +195 -22
  10. package/src/commands/channels.js +422 -267
  11. package/src/commands/chat.js +5 -8
  12. package/src/commands/clawbot.js +19 -0
  13. package/src/commands/code.js +3 -2
  14. package/src/commands/commitments.js +125 -9
  15. package/src/commands/completion.js +40 -32
  16. package/src/commands/config.js +219 -30
  17. package/src/commands/configure.js +84 -67
  18. package/src/commands/cron.js +239 -19
  19. package/src/commands/daemon.js +34 -4
  20. package/src/commands/dashboard.js +47 -374
  21. package/src/commands/devices.js +53 -26
  22. package/src/commands/directory.js +146 -14
  23. package/src/commands/dns.js +148 -10
  24. package/src/commands/docs.js +119 -26
  25. package/src/commands/doctor.js +143 -492
  26. package/src/commands/exec-policy.js +57 -48
  27. package/src/commands/gateway.js +492 -249
  28. package/src/commands/health.js +141 -11
  29. package/src/commands/help.js +24 -25
  30. package/src/commands/hooks.js +141 -87
  31. package/src/commands/infer.js +1442 -41
  32. package/src/commands/logs.js +122 -99
  33. package/src/commands/mcp.js +121 -309
  34. package/src/commands/memory.js +128 -0
  35. package/src/commands/message.js +720 -140
  36. package/src/commands/models.js +39 -1
  37. package/src/commands/node.js +77 -77
  38. package/src/commands/nodes.js +278 -22
  39. package/src/commands/onboard.js +115 -56
  40. package/src/commands/pairing.js +108 -107
  41. package/src/commands/path.js +206 -0
  42. package/src/commands/plugins.js +35 -1
  43. package/src/commands/proxy.js +159 -8
  44. package/src/commands/qr.js +55 -13
  45. package/src/commands/reset.js +101 -94
  46. package/src/commands/secrets.js +104 -21
  47. package/src/commands/sessions.js +110 -51
  48. package/src/commands/setup.js +102 -649
  49. package/src/commands/skills.js +67 -1
  50. package/src/commands/status.js +101 -127
  51. package/src/commands/tasks.js +208 -100
  52. package/src/commands/terminal.js +130 -12
  53. package/src/commands/transcripts.js +24 -1
  54. package/src/commands/tui.js +41 -0
  55. package/src/commands/uninstall.js +73 -92
  56. package/src/commands/update.js +146 -91
  57. package/src/commands/webhooks.js +58 -66
  58. package/src/commands/wiki.js +783 -0
  59. package/src/utils/agents-md.js +85 -0
  60. package/src/utils/api.js +39 -40
  61. package/src/utils/format.js +144 -0
  62. package/src/utils/headless.js +2 -1
  63. package/src/utils/parallel-tools.js +106 -0
  64. package/src/utils/sub-agent.js +148 -0
  65. package/src/utils/token-budget.js +304 -0
  66. package/src/utils/tool-runner.js +7 -5
  67. package/src/utils/web-fetch.js +107 -0
@@ -1,6 +1,39 @@
1
1
  const chalk = require('chalk');
2
+ const F = require('../utils/format');
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
2
6
  const { getConfig, saveConfig } = require('../utils/config');
3
7
 
8
+ const APPROVALS_FILE = path.join(os.homedir(), '.natureco', 'approvals.json');
9
+ const ALLOWLIST_FILE = path.join(os.homedir(), '.natureco', 'approval-allowlist.json');
10
+
11
+ function loadQueue() {
12
+ if (!fs.existsSync(APPROVALS_FILE)) return [];
13
+ try { return JSON.parse(fs.readFileSync(APPROVALS_FILE, 'utf-8')); }
14
+ catch { return []; }
15
+ }
16
+
17
+ function saveQueue(items) {
18
+ const dir = path.dirname(APPROVALS_FILE);
19
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
20
+ fs.writeFileSync(APPROVALS_FILE, JSON.stringify(items, null, 2), 'utf-8');
21
+ }
22
+
23
+ function genId() { return Date.now().toString(36) + Math.random().toString(36).slice(2, 6); }
24
+
25
+ function loadAllowlist() {
26
+ if (!fs.existsSync(ALLOWLIST_FILE)) return [];
27
+ try { return JSON.parse(fs.readFileSync(ALLOWLIST_FILE, 'utf-8')); }
28
+ catch { return []; }
29
+ }
30
+
31
+ function saveAllowlist(patterns) {
32
+ const dir = path.dirname(ALLOWLIST_FILE);
33
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
34
+ fs.writeFileSync(ALLOWLIST_FILE, JSON.stringify(patterns, null, 2), 'utf-8');
35
+ }
36
+
4
37
  function approvals(args) {
5
38
  const [action, ...params] = args || [];
6
39
 
@@ -9,34 +42,103 @@ function approvals(args) {
9
42
  if (action === 'approve') return approveReq(params[0]);
10
43
  if (action === 'reject') return rejectReq(params[0]);
11
44
  if (action === 'set-policy') return setPolicy(params[0]);
45
+ if (action === 'add') return addReq(params.join(' '));
46
+ if (action === 'get') return getReq(params[0]);
47
+ if (action === 'set') return setPolicy(params[0]);
48
+ if (action === 'allowlist' && params[0] === 'add') return allowlistAdd(params.slice(1).join(' '));
49
+ if (action === 'allowlist' && params[0] === 'remove') return allowlistRemove(params.slice(1).join(' '));
50
+ if (action === 'allowlist') return listAllowlist();
12
51
 
13
52
  console.log(chalk.red(`\n ❌ Bilinmeyen komut: ${action}\n`));
14
- console.log(chalk.gray(' Kullanım: natureco approvals [list|pending|approve|reject|set-policy]\n'));
53
+ console.log(chalk.gray(' Kullanım: natureco approvals [list|pending|approve|reject|set-policy|set|add|get|allowlist]\n'));
15
54
  process.exit(1);
16
55
  }
17
56
 
18
57
  function listApprovals() {
19
58
  const config = getConfig();
20
59
  const policy = config.execApprovalPolicy || 'auto';
21
- console.log(chalk.cyan('\n 📋 Exec Approvals\n'));
22
- console.log(chalk.gray(' ' + '─'.repeat(48)));
23
- console.log(` ${chalk.white('Policy:')} ${chalk.cyan(policy)}`);
24
- console.log(chalk.gray('\n Pending: use') + chalk.cyan(' natureco approvals pending'));
25
- console.log();
60
+ const queue = loadQueue();
61
+
62
+ F.header('Approvals');
63
+ F.kv('Policy', policy);
64
+ F.kv('Queue', `${queue.filter(r => r.status === 'pending').length} pending`);
65
+
66
+ const rows = queue.map(r => [
67
+ r.id,
68
+ r.source || 'cli',
69
+ r.text,
70
+ r.status,
71
+ ]);
72
+ F.table(['ID', 'Requester', 'Command', 'Status'], rows);
26
73
  }
27
74
 
28
75
  function listPending() {
29
- console.log(chalk.cyan('\n ⏳ Pending Approvals\n'));
30
- console.log(chalk.gray(' ' + '─'.repeat(48)));
31
- console.log(chalk.gray(' No pending approvals.\n'));
76
+ const queue = loadQueue().filter(r => r.status === 'pending');
77
+ if (queue.length === 0) {
78
+ F.info('No pending approvals.');
79
+ return;
80
+ }
81
+
82
+ const rows = queue.map(r => [
83
+ r.id,
84
+ r.source || 'cli',
85
+ r.text,
86
+ r.status,
87
+ ]);
88
+ F.table(['ID', 'Requester', 'Command', 'Status'], rows);
89
+ }
90
+
91
+ function addReq(text) {
92
+ if (!text) {
93
+ console.log(chalk.red('\n ❌ Request text gerekli\n'));
94
+ process.exit(1);
95
+ }
96
+ const queue = loadQueue();
97
+ const r = { id: genId(), text, status: 'pending', source: 'cli', createdAt: new Date().toISOString(), resolvedAt: null };
98
+ queue.push(r);
99
+ saveQueue(queue);
100
+ console.log(chalk.yellow(`\n ⏳ Onay beklemede: ${r.id}\n`));
101
+ console.log(` ${chalk.white(text)}`);
102
+ console.log(chalk.gray(` Onaylamak için: natureco approvals approve ${r.id}`));
103
+ console.log();
32
104
  }
33
105
 
34
106
  function approveReq(id) {
35
- console.log(chalk.green(`\n ✅ Approved: ${id || 'all pending'}\n`));
107
+ const queue = loadQueue();
108
+ if (id) {
109
+ const r = queue.find(x => x.id === id);
110
+ if (!r) { console.log(chalk.red(`\n ❌ Request bulunamadı: ${id}\n`)); process.exit(1); }
111
+ if (r.status !== 'pending') { console.log(chalk.yellow(`\n ⚠️ "${id}" zaten ${r.status}\n`)); return; }
112
+ r.status = 'approved';
113
+ r.resolvedAt = new Date().toISOString();
114
+ saveQueue(queue);
115
+ F.success(`Approved: ${r.text}`);
116
+ return;
117
+ }
118
+ const pending = queue.filter(r => r.status === 'pending');
119
+ if (pending.length === 0) { console.log(chalk.gray('\n Bekleyen onay yok\n')); return; }
120
+ for (const r of pending) { r.status = 'approved'; r.resolvedAt = new Date().toISOString(); }
121
+ saveQueue(queue);
122
+ F.success(`${pending.length} requests approved`);
36
123
  }
37
124
 
38
125
  function rejectReq(id) {
39
- console.log(chalk.gray(`\n ❌ Rejected: ${id || 'all pending'}\n`));
126
+ const queue = loadQueue();
127
+ if (id) {
128
+ const r = queue.find(x => x.id === id);
129
+ if (!r) { console.log(chalk.red(`\n ❌ Request bulunamadı: ${id}\n`)); process.exit(1); }
130
+ if (r.status !== 'pending') { console.log(chalk.yellow(`\n ⚠️ "${id}" zaten ${r.status}\n`)); return; }
131
+ r.status = 'rejected';
132
+ r.resolvedAt = new Date().toISOString();
133
+ saveQueue(queue);
134
+ F.error(`Rejected: ${r.text}`);
135
+ return;
136
+ }
137
+ const pending = queue.filter(r => r.status === 'pending');
138
+ if (pending.length === 0) { console.log(chalk.gray('\n Bekleyen onay yok\n')); return; }
139
+ for (const r of pending) { r.status = 'rejected'; r.resolvedAt = new Date().toISOString(); }
140
+ saveQueue(queue);
141
+ F.error(`${pending.length} requests rejected`);
40
142
  }
41
143
 
42
144
  function setPolicy(policy) {
@@ -50,4 +152,63 @@ function setPolicy(policy) {
50
152
  console.log(chalk.green(`\n ✅ Approval policy: ${policy}\n`));
51
153
  }
52
154
 
155
+ function getReq(id) {
156
+ if (!id) {
157
+ console.log(chalk.red('\n ❌ Request ID gerekli\n'));
158
+ process.exit(1);
159
+ }
160
+ const queue = loadQueue();
161
+ const r = queue.find(x => x.id === id);
162
+ if (!r) {
163
+ console.log(chalk.red(`\n ❌ Request bulunamadı: ${id}\n`));
164
+ process.exit(1);
165
+ }
166
+ F.kv('ID', r.id);
167
+ F.kv('Text', r.text);
168
+ F.kv('Status', r.status);
169
+ F.kv('Source', r.source || 'cli');
170
+ F.kv('Created', r.createdAt ? new Date(r.createdAt).toLocaleString() : '-');
171
+ F.kv('Resolved', r.resolvedAt ? new Date(r.resolvedAt).toLocaleString() : '-');
172
+ }
173
+
174
+ function listAllowlist() {
175
+ const patterns = loadAllowlist();
176
+ if (patterns.length === 0) {
177
+ F.info('No patterns in allowlist.');
178
+ return;
179
+ }
180
+ F.list(patterns);
181
+ }
182
+
183
+ function allowlistAdd(pattern) {
184
+ if (!pattern) {
185
+ console.log(chalk.red('\n ❌ Pattern gerekli\n'));
186
+ process.exit(1);
187
+ }
188
+ const patterns = loadAllowlist();
189
+ if (patterns.includes(pattern)) {
190
+ F.warning(`Pattern already in allowlist: ${pattern}`);
191
+ return;
192
+ }
193
+ patterns.push(pattern);
194
+ saveAllowlist(patterns);
195
+ F.success(`Added to allowlist: ${pattern}`);
196
+ }
197
+
198
+ function allowlistRemove(pattern) {
199
+ if (!pattern) {
200
+ console.log(chalk.red('\n ❌ Pattern gerekli\n'));
201
+ process.exit(1);
202
+ }
203
+ let patterns = loadAllowlist();
204
+ const initial = patterns.length;
205
+ patterns = patterns.filter(p => p !== pattern);
206
+ if (patterns.length === initial) {
207
+ F.warning(`Pattern not found in allowlist: ${pattern}`);
208
+ return;
209
+ }
210
+ saveAllowlist(patterns);
211
+ F.success(`Removed from allowlist: ${pattern}`);
212
+ }
213
+
53
214
  module.exports = approvals;