@agenticmail/enterprise 0.5.331 → 0.5.332

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 (2) hide show
  1. package/dist/cli.js +77 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,19 +1,90 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ __require
4
+ } from "./chunk-KFQGP6VL.js";
2
5
 
3
6
  // src/cli.ts
4
- var [major] = process.versions.node.split(".").map(Number);
5
- if (major < 20) {
6
- console.error(`
7
- AgenticMail Enterprise requires Node.js 20 or higher.`);
8
- console.error(` You are running Node.js ${process.version}.`);
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
+ }
9
78
  console.error(`
10
- To upgrade:`);
79
+ Could not auto-install Node.js 20+. Please install manually:`);
11
80
  console.error(` brew install node@22 # macOS (Homebrew)`);
12
81
  console.error(` nvm install 22 # using nvm`);
13
82
  console.error(` curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash - # Linux
14
83
  `);
15
84
  process.exit(1);
16
85
  }
86
+ var _tryExec2;
87
+ var _findNode202;
17
88
  var args = process.argv.slice(2);
18
89
  var command = args[0];
19
90
  switch (command) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.331",
3
+ "version": "0.5.332",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {