@agenticmail/enterprise 0.5.332 → 0.5.333

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.
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Pure CJS — runs on ANY Node version, even ancient ones
5
+ var major = parseInt(process.versions.node.split('.')[0]);
6
+
7
+ if (major >= 20) {
8
+ // Good — load the real CLI
9
+ require('../dist/cli.js');
10
+ } else {
11
+ // Need to upgrade Node first
12
+ var execSync = require('child_process').execSync;
13
+ var spawnSync = require('child_process').spawnSync;
14
+ var os = require('os');
15
+ var path = require('path');
16
+
17
+ function tryExec(cmd) {
18
+ try { return execSync(cmd, { stdio: 'pipe', timeout: 5000 }).toString().trim(); } catch(e) { return ''; }
19
+ }
20
+
21
+ function findNode20() {
22
+ var paths = ['/opt/homebrew/bin/node', '/usr/local/bin/node'];
23
+ for (var i = 0; i < paths.length; i++) {
24
+ var ver = tryExec(paths[i] + ' --version 2>/dev/null');
25
+ if (ver && parseInt(ver.replace('v', '')) >= 20) return paths[i];
26
+ }
27
+ // Check nvm
28
+ var nvmDir = path.join(os.homedir(), '.nvm', 'versions', 'node');
29
+ var dirs = tryExec('ls -d ' + nvmDir + '/v2[0-9]* ' + nvmDir + '/v3[0-9]* 2>/dev/null');
30
+ if (dirs) { var last = dirs.split('\n').pop(); if (last) return path.join(last, 'bin', 'node'); }
31
+ return null;
32
+ }
33
+
34
+ console.log('\n AgenticMail Enterprise requires Node.js 20+. You have ' + process.version + '.');
35
+
36
+ // Check if newer Node already exists
37
+ var existing = findNode20();
38
+ if (existing) {
39
+ console.log(' Found Node 20+ at ' + existing + '. Re-launching...\n');
40
+ var r = spawnSync(existing, [path.join(__dirname, '..', 'dist', 'cli.js')].concat(process.argv.slice(2)), { stdio: 'inherit' });
41
+ process.exit(r.status || 0);
42
+ }
43
+
44
+ // Try auto-install
45
+ var installed = false;
46
+ var platform = os.platform();
47
+
48
+ if (platform === 'darwin' && tryExec('which brew')) {
49
+ console.log(' Installing Node.js 22 via Homebrew (this may take a minute)...\n');
50
+ try {
51
+ execSync('brew install node@22', { stdio: 'inherit', timeout: 300000 });
52
+ try { execSync('brew link --overwrite node@22 2>&1', { stdio: 'pipe', timeout: 30000 }); } catch(e) {}
53
+ installed = true;
54
+ } catch(e) {}
55
+ } else if (platform === 'linux' && tryExec('which apt-get')) {
56
+ console.log(' Installing Node.js 22 via apt (this may take a minute)...\n');
57
+ try {
58
+ execSync('curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs', { stdio: 'inherit', timeout: 300000 });
59
+ installed = true;
60
+ } catch(e) {}
61
+ } else if (platform === 'linux' && tryExec('which dnf')) {
62
+ console.log(' Installing Node.js 22 via dnf (this may take a minute)...\n');
63
+ try {
64
+ execSync('curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash - && sudo dnf install -y nodejs', { stdio: 'inherit', timeout: 300000 });
65
+ installed = true;
66
+ } catch(e) {}
67
+ }
68
+
69
+ if (installed) {
70
+ var newNode = findNode20() || tryExec('which node');
71
+ var newVer = tryExec((newNode || 'node') + ' --version');
72
+ if (newNode && parseInt((newVer || '').replace('v', '')) >= 20) {
73
+ console.log('\n Node.js ' + newVer + ' installed! Re-launching...\n');
74
+ var r2 = spawnSync(newNode, [path.join(__dirname, '..', 'dist', 'cli.js')].concat(process.argv.slice(2)), { stdio: 'inherit' });
75
+ process.exit(r2.status || 0);
76
+ }
77
+ }
78
+
79
+ console.error('\n Could not auto-install Node.js 20+. Please install manually:');
80
+ console.error(' brew install node@22 # macOS (Homebrew)');
81
+ console.error(' nvm install 22 # using nvm');
82
+ console.error(' curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - # Linux\n');
83
+ process.exit(1);
84
+ }
package/dist/cli.js CHANGED
@@ -1,90 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- __require
4
- } from "./chunk-KFQGP6VL.js";
5
2
 
6
3
  // src/cli.ts
7
- var _nodeMajor = parseInt(process.versions.node.split(".")[0]);
8
- if (_nodeMajor < 20) {
9
- let _tryExec = function(cmd) {
10
- try {
11
- return execSync(cmd, { stdio: "pipe", timeout: 5e3 }).toString().trim();
12
- } catch {
13
- return "";
14
- }
15
- }, _findNode20 = function() {
16
- for (const p of ["/opt/homebrew/bin/node", "/usr/local/bin/node"]) {
17
- const ver = _tryExec(`${p} --version 2>/dev/null`);
18
- if (ver && parseInt(ver.replace("v", "")) >= 20) return p;
19
- }
20
- const nvmDir = `${os.homedir()}/.nvm/versions/node`;
21
- const dirs = _tryExec(`ls -d ${nvmDir}/v2[0-9]* ${nvmDir}/v3[0-9]* 2>/dev/null`);
22
- if (dirs) {
23
- const last = dirs.split("\n").pop();
24
- if (last) return `${last}/bin/node`;
25
- }
26
- return null;
27
- };
28
- _tryExec2 = _tryExec, _findNode202 = _findNode20;
29
- const { execSync, spawnSync } = __require("child_process");
30
- const os = __require("os");
31
- console.log(`
32
- AgenticMail Enterprise requires Node.js 20+. You have ${process.version}.`);
33
- const _existingNode = _findNode20();
34
- if (_existingNode) {
35
- console.log(` Found Node 20+ at ${_existingNode}. Re-launching...
36
- `);
37
- const r = spawnSync(_existingNode, process.argv.slice(1), { stdio: "inherit" });
38
- process.exit(r.status ?? 1);
39
- }
40
- let _installed = false;
41
- if (os.platform() === "darwin" && _tryExec("which brew")) {
42
- console.log(" Installing Node.js 22 via Homebrew (this may take a minute)...\n");
43
- try {
44
- execSync("brew install node@22", { stdio: "inherit", timeout: 3e5 });
45
- try {
46
- execSync("brew link --overwrite node@22", { stdio: "pipe", timeout: 3e4 });
47
- } catch {
48
- }
49
- _installed = true;
50
- } catch {
51
- }
52
- } else if (os.platform() === "linux" && _tryExec("which apt-get")) {
53
- console.log(" Installing Node.js 22 via apt (this may take a minute)...\n");
54
- try {
55
- execSync("curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs", { stdio: "inherit", timeout: 3e5 });
56
- _installed = true;
57
- } catch {
58
- }
59
- } else if (os.platform() === "linux" && _tryExec("which dnf")) {
60
- console.log(" Installing Node.js 22 via dnf (this may take a minute)...\n");
61
- try {
62
- execSync("curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo bash - && sudo dnf install -y nodejs", { stdio: "inherit", timeout: 3e5 });
63
- _installed = true;
64
- } catch {
65
- }
66
- }
67
- if (_installed) {
68
- const newNode = _findNode20() || _tryExec("which node");
69
- const newVer = _tryExec(`${newNode} --version`);
70
- if (newNode && parseInt((newVer || "").replace("v", "")) >= 20) {
71
- console.log(`
72
- Node.js ${newVer} installed! Re-launching...
73
- `);
74
- const r = spawnSync(newNode, process.argv.slice(1), { stdio: "inherit" });
75
- process.exit(r.status ?? 1);
76
- }
77
- }
78
- console.error(`
79
- Could not auto-install Node.js 20+. Please install manually:`);
80
- console.error(` brew install node@22 # macOS (Homebrew)`);
81
- console.error(` nvm install 22 # using nvm`);
82
- console.error(` curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - # Linux
83
- `);
84
- process.exit(1);
85
- }
86
- var _tryExec2;
87
- var _findNode202;
88
4
  var args = process.argv.slice(2);
89
5
  var command = args[0];
90
6
  switch (command) {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.332",
3
+ "version": "0.5.333",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
7
- "agenticmail-enterprise": "dist/cli.js",
8
- "enterprise": "dist/cli.js",
7
+ "agenticmail-enterprise": "bin/agenticmail-enterprise.js",
8
+ "enterprise": "bin/agenticmail-enterprise.js",
9
9
  "agenticmail-registry": "dist/registry/cli.js"
10
10
  },
11
11
  "exports": {