@souhengai/naxos 2.8.0 → 2.8.1

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/lib/postinstall.js +56 -0
  2. package/package.json +1 -1
@@ -10,6 +10,7 @@ const { existsSync, mkdirSync, chmodSync, renameSync, unlinkSync, createWriteStr
10
10
  const { join, dirname } = require("path");
11
11
  const https = require("https");
12
12
  const http = require("http");
13
+ const { execSync } = require("child_process");
13
14
 
14
15
  const BASE_URL = "https://mineify.de/naxos";
15
16
  const VERSION = require("../package.json").version;
@@ -104,6 +105,57 @@ function download(url, dest) {
104
105
  });
105
106
  }
106
107
 
108
+ /**
109
+ * Check if npm's global bin directory is in PATH.
110
+ * If not, warn the user with exact instructions for their platform.
111
+ */
112
+ function checkPath() {
113
+ let npmBin;
114
+ try {
115
+ npmBin = execSync("npm bin -g", { encoding: "utf-8" }).trim();
116
+ } catch {
117
+ try {
118
+ // Fallback: compute from npm prefix
119
+ const prefix = execSync("npm config get prefix", { encoding: "utf-8" }).trim();
120
+ npmBin = process.platform === "win32" ? prefix : join(prefix, "bin");
121
+ } catch {
122
+ return; // Can't determine — skip check
123
+ }
124
+ }
125
+
126
+ const pathSep = process.platform === "win32" ? ";" : ":";
127
+ const pathParts = (process.env.PATH || "").split(pathSep).map(p => p.toLowerCase().replace(/\\$/, "").replace(/\/$/, ""));
128
+ const needle = npmBin.toLowerCase().replace(/\\$/, "").replace(/\/$/, "");
129
+
130
+ if (pathParts.includes(needle)) {
131
+ return; // npm bin is in PATH — all good
132
+ }
133
+
134
+ // Not in PATH — print warning
135
+ console.log(" \x1b[33m⚠\x1b[0m npm's global bin directory is not in your PATH:");
136
+ console.log("");
137
+ console.log(" " + npmBin);
138
+ console.log("");
139
+
140
+ if (process.platform === "win32") {
141
+ console.log(" \x1b[1mTo fix on Windows:\x1b[0m");
142
+ console.log("");
143
+ console.log(" 1. Open \x1b[36mSystem Properties → Environment Variables\x1b[0m");
144
+ console.log(" 2. Edit \x1b[36mPath\x1b[0m under 'User variables'");
145
+ console.log(" 3. Click 'New' and add: \x1b[36m" + npmBin + "\x1b[0m");
146
+ console.log(" 4. Click OK and \x1b[1mopen a NEW terminal window\x1b[0m");
147
+ console.log("");
148
+ console.log(" \x1b[2mOr run this in PowerShell (restart terminal after):\x1b[0m");
149
+ console.log(" \x1b[36msetx PATH \"$env:PATH;" + npmBin + "\"\x1b[0m");
150
+ } else {
151
+ console.log(" \x1b[1mTo fix:\x1b[0m add this to your ~/.bashrc or ~/.zshrc:");
152
+ console.log(" \x1b[36mexport PATH=\"$PATH:" + npmBin + "\"\x1b[0m");
153
+ console.log("");
154
+ console.log(" Then restart your terminal or run: \x1b[36msource ~/.bashrc\x1b[0m");
155
+ }
156
+ console.log("");
157
+ }
158
+
107
159
  async function main() {
108
160
  console.log("");
109
161
  console.log(" \x1b[35mNaxos\x1b[0m v" + VERSION + " — Installing...");
@@ -136,6 +188,10 @@ async function main() {
136
188
 
137
189
  console.log(" \x1b[32m✓\x1b[0m Installed successfully!");
138
190
  console.log("");
191
+
192
+ // Check if the npm global bin dir is in PATH
193
+ checkPath();
194
+
139
195
  console.log(" Run \x1b[1mnaxos setup\x1b[0m to get started.");
140
196
  console.log("");
141
197
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@souhengai/naxos",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "Naxos — SouhengAI Autonomous Coding Agent",
5
5
  "bin": {
6
6
  "naxos": "bin/cli.js"