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,71 +1,80 @@
1
1
  const chalk = require('chalk');
2
- const { getConfig, saveConfig } = require('../utils/config');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const os = require('os');
5
+
6
+ const POLICY_FILE = path.join(os.homedir(), '.natureco', 'exec-policy.json');
7
+
8
+ const PRESETS = {
9
+ strict: { allowCommands: false, allowScripts: false, timeout: 10000, sandbox: 'strict', approvals: 'all' },
10
+ permissive: { allowCommands: true, allowScripts: true, timeout: 60000, sandbox: 'none', approvals: 'none' },
11
+ default: { allowCommands: true, allowScripts: false, timeout: 30000, sandbox: 'isolated', approvals: 'write' },
12
+ };
13
+
14
+ function loadPolicy() {
15
+ if (!fs.existsSync(POLICY_FILE)) return { ...PRESETS.default };
16
+ try { return JSON.parse(fs.readFileSync(POLICY_FILE, 'utf8')); }
17
+ catch { return { ...PRESETS.default }; }
18
+ }
19
+
20
+ function savePolicy(policy) {
21
+ const dir = path.dirname(POLICY_FILE);
22
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
23
+ fs.writeFileSync(POLICY_FILE, JSON.stringify(policy, null, 2), 'utf8');
24
+ }
3
25
 
4
26
  function execPolicy(args) {
5
27
  const [action, ...params] = args || [];
6
28
 
7
- if (!action || action === 'show') return showPolicy();
8
- if (action === 'set') return setPolicy(params[0]);
9
- if (action === 'sync') return syncPolicy();
29
+ if (!action || action === 'show') return cmdShow();
30
+ if (action === 'preset') return cmdPreset(params[0]);
31
+ if (action === 'set') return cmdSet(params[0], params.slice(1).join(' '));
10
32
 
11
- console.log(chalk.red(`\n Bilinmeyen komut: ${action}\n`));
12
- console.log(chalk.gray(' Kullanım: natureco exec-policy [show|set|sync]\n'));
33
+ console.log(chalk.red(`\n Unknown exec-policy action: ${action}\n`));
34
+ console.log(chalk.gray(' Usage: natureco exec-policy <action> [params]'));
35
+ console.log(chalk.gray(' Actions: show, preset <name>, set <key> <value>\n'));
13
36
  process.exit(1);
14
37
  }
15
38
 
16
- function showPolicy() {
17
- const config = getConfig();
18
- const policy = config.execPolicy || 'default';
39
+ function cmdShow() {
40
+ const policy = loadPolicy();
19
41
 
20
- console.log(chalk.cyan('\n 📋 Exec Policy\n'));
42
+ console.log(chalk.cyan('\n Execution Policy\n'));
21
43
  console.log(chalk.gray(' ' + '─'.repeat(48)));
22
- console.log(` ${chalk.white('Policy:')} ${chalk.cyan(policy)}`);
23
- console.log(` ${chalk.white('Allow commands:')} ${chalk.gray(config.execAllowCommands !== false ? 'Yes' : 'No')}`);
24
- console.log(` ${chalk.white('Timeout:')} ${chalk.gray(config.execTimeout || 30000)}ms`);
25
- console.log(` ${chalk.white('Sandbox:')} ${chalk.gray(config.execSandbox || 'none')}`);
26
- console.log();
27
- console.log(chalk.gray(' Set policy:'));
28
- console.log(chalk.cyan(' natureco exec-policy set <policy>'));
29
- console.log(chalk.cyan(' natureco exec-policy sync\n'));
44
+ for (const [key, val] of Object.entries(policy)) {
45
+ const display = typeof val === 'boolean' ? (val ? chalk.green('yes') : chalk.red('no')) : chalk.white(val);
46
+ console.log(` ${chalk.white(key)}: ${display}`);
47
+ }
48
+ console.log('');
49
+ console.log(chalk.gray(' Presets: strict, permissive, default\n'));
30
50
  }
31
51
 
32
- function setPolicy(policy) {
33
- if (!policy) {
34
- console.log(chalk.red('\n Policy gerekli\n'));
52
+ function cmdPreset(name) {
53
+ if (!name || !PRESETS[name]) {
54
+ console.log(chalk.red(`\n Unknown preset: ${name}\n`));
55
+ console.log(chalk.gray(' Available presets: strict, permissive, default\n'));
35
56
  process.exit(1);
36
57
  }
37
58
 
38
- const config = getConfig();
39
- config.execPolicy = policy;
40
- saveConfig(config);
41
- console.log(chalk.green(`\n ✅ Exec policy: ${policy}\n`));
59
+ savePolicy({ ...PRESETS[name] });
60
+ console.log(chalk.green(`\n Policy set to "${name}" preset.\n`));
42
61
  }
43
62
 
44
- function syncPolicy() {
45
- const config = getConfig();
46
- console.log(chalk.cyan('\n 🔄 Syncing exec policy...\n'));
47
-
48
- const defaults = {
49
- execPolicy: 'default',
50
- execAllowCommands: true,
51
- execTimeout: 30000,
52
- execSandbox: 'none'
53
- };
54
-
55
- let changed = 0;
56
- for (const [key, val] of Object.entries(defaults)) {
57
- if (config[key] === undefined) {
58
- config[key] = val;
59
- changed++;
60
- }
63
+ function cmdSet(key, value) {
64
+ if (!key || value === undefined) {
65
+ console.log(chalk.red('\n Usage: natureco exec-policy set <key> <value>\n'));
66
+ process.exit(1);
61
67
  }
62
68
 
63
- if (changed > 0) {
64
- saveConfig(config);
65
- console.log(chalk.green(` Synced ${changed} policy settings\n`));
66
- } else {
67
- console.log(chalk.gray(' ✅ Already in sync\n'));
68
- }
69
+ const policy = loadPolicy();
70
+
71
+ if (value === 'true') value = true;
72
+ else if (value === 'false') value = false;
73
+ else if (!isNaN(value)) value = Number(value);
74
+
75
+ policy[key] = value;
76
+ savePolicy(policy);
77
+ console.log(chalk.green(`\n Policy "${key}" set to ${JSON.stringify(value)}.\n`));
69
78
  }
70
79
 
71
80
  module.exports = execPolicy;