nothumanallowed 14.1.71 → 14.1.73

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nothumanallowed",
3
- "version": "14.1.71",
3
+ "version": "14.1.73",
4
4
  "description": "NotHumanAllowed — 38 AI agents, 80 tools, Studio (visual agentic workflows). Email, calendar, browser automation, screen capture, canvas, cron/heartbeat, Alexandria E2E messaging, GitHub, Notion, Slack, voice chat, free AI (Liara), 28 languages. Zero-dependency CLI.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -57,7 +57,7 @@ export async function main(argv) {
57
57
  if (result?.updateAvailable) {
58
58
  console.log('');
59
59
  warn(`New NHA version available: ${result.current} → ${result.latest}`);
60
- info('Run "npm update -g nothumanallowed" to upgrade.');
60
+ info('Run "nha update" to upgrade (includes npm self-update).');
61
61
  }
62
62
  }).catch(() => {});
63
63
  }
@@ -142,7 +142,13 @@ export async function main(argv) {
142
142
  return cmdConfig(args);
143
143
 
144
144
  case 'update':
145
- return runUpdate();
145
+ await runUpdate();
146
+ // Also self-update the npm package
147
+ return cmdSelfUpdate();
148
+
149
+ case 'upgrade':
150
+ case 'self-update':
151
+ return cmdSelfUpdate();
146
152
 
147
153
  case 'doctor':
148
154
  return cmdDoctor();
@@ -173,6 +179,56 @@ export async function main(argv) {
173
179
  }
174
180
  }
175
181
 
182
+ // ── nha upgrade / self-update ──────────────────────────────────────────────
183
+ async function cmdSelfUpdate() {
184
+ const { execSync } = await import('child_process');
185
+
186
+ info('Checking for npm package updates...');
187
+ const npmCheck = await checkNpmVersion();
188
+ if (!npmCheck?.updateAvailable) {
189
+ ok(`NHA v${VERSION} is already the latest version.`);
190
+ return;
191
+ }
192
+
193
+ info(`Updating: ${npmCheck.current} → ${npmCheck.latest}`);
194
+
195
+ // Try without sudo first, then with sudo if needed (Linux/VM)
196
+ const cmds = [
197
+ 'npm install -g nothumanallowed@latest',
198
+ 'sudo npm install -g nothumanallowed@latest',
199
+ ];
200
+
201
+ for (const cmd of cmds) {
202
+ try {
203
+ const usingSudo = cmd.startsWith('sudo');
204
+ if (usingSudo) info('Retrying with sudo...');
205
+ const output = execSync(cmd, { encoding: 'utf-8', timeout: 120_000, stdio: ['inherit', 'pipe', 'pipe'] });
206
+ if (output.includes('nothumanallowed@')) {
207
+ ok(`Updated to v${npmCheck.latest}!`);
208
+ console.log('');
209
+ info('Restart the UI to apply: kill the process and run "nha ui" again.');
210
+ if (usingSudo) info('(sudo was required on this system)');
211
+ return;
212
+ }
213
+ } catch (e) {
214
+ const msg = e.stderr || e.message || '';
215
+ // EACCES = permission denied, try sudo next
216
+ if (msg.includes('EACCES') || msg.includes('permission denied')) continue;
217
+ // Other error — report and stop
218
+ fail(`Update failed: ${msg.slice(0, 200)}`);
219
+ console.log('');
220
+ info('Try manually: sudo npm install -g nothumanallowed@latest');
221
+ return;
222
+ }
223
+ }
224
+
225
+ fail('Update failed — could not install even with sudo.');
226
+ console.log('');
227
+ info('Try manually:');
228
+ info(' sudo npm install -g nothumanallowed@latest');
229
+ info('Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors');
230
+ }
231
+
176
232
  // ── nha responder ─────────────────────────────────────────────────────────
177
233
  async function cmdResponder(args) {
178
234
  const sub = args[0] || 'status';
@@ -723,7 +779,8 @@ function cmdHelp() {
723
779
  console.log(` ${C}Configuration${NC}`);
724
780
  console.log(` config Show current config`);
725
781
  console.log(` config set <k> <v> Set a config value`);
726
- console.log(` update Update agents & core files`);
782
+ console.log(` update Update agents, core files & npm package`);
783
+ console.log(` upgrade Update npm package only (alias: self-update)`);
727
784
  console.log(` doctor Health check`);
728
785
  console.log(` mcp Start MCP server (Claude Code, Cursor)\n`);
729
786
 
package/src/constants.mjs CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'url';
5
5
  const __filename = fileURLToPath(import.meta.url);
6
6
  const __dirname = path.dirname(__filename);
7
7
 
8
- export const VERSION = '14.1.71';
8
+ export const VERSION = '14.1.73';
9
9
  export const BASE_URL = 'https://nothumanallowed.com/cli';
10
10
  export const API_BASE = 'https://nothumanallowed.com/api/v1';
11
11
 
@@ -237,8 +237,19 @@ export function register(router) {
237
237
  // POST /api/update-npm — run npm install -g nothumanallowed@latest
238
238
  router.post('/api/update-npm', async (_req, res) => {
239
239
  const { exec } = await import('child_process');
240
- exec('npm install -g nothumanallowed@latest', { timeout: 60000 }, (err, stdout, stderr) => {
241
- if (err) return sendError(res, 500, stderr || err.message);
240
+ exec('npm install -g nothumanallowed@latest', { timeout: 120000 }, (err, stdout, stderr) => {
241
+ if (err) {
242
+ const msg = (stderr || err.message || '');
243
+ // Permission denied — retry with sudo (Linux/VM)
244
+ if (msg.includes('EACCES') || msg.includes('permission denied')) {
245
+ exec('sudo npm install -g nothumanallowed@latest', { timeout: 120000 }, (err2, stdout2, stderr2) => {
246
+ if (err2) return sendError(res, 500, stderr2 || err2.message);
247
+ sendJSON(res, 200, { ok: true, output: stdout2, sudo: true });
248
+ });
249
+ return;
250
+ }
251
+ return sendError(res, 500, msg);
252
+ }
242
253
  sendJSON(res, 200, { ok: true, output: stdout });
243
254
  });
244
255
  });