nothumanallowed 15.1.3 → 15.1.4
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 +1 -1
- package/src/cli.mjs +80 -49
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nothumanallowed",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.4",
|
|
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
|
@@ -243,62 +243,93 @@ async function cmdSelfUpdate() {
|
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
const target = npmCheck.latest;
|
|
247
|
+
info(`Updating: ${npmCheck.current} → ${target}`);
|
|
248
|
+
|
|
249
|
+
// Step 1: Detect if we need sudo (check if global npm dir is writable)
|
|
250
|
+
let needsSudo = false;
|
|
251
|
+
try {
|
|
252
|
+
const globalDir = execSync('npm root -g 2>/dev/null', { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
253
|
+
if (globalDir) {
|
|
254
|
+
try {
|
|
255
|
+
const fs2 = await import('fs');
|
|
256
|
+
fs2.default.accessSync(globalDir, fs2.constants.W_OK);
|
|
257
|
+
} catch { needsSudo = true; }
|
|
258
|
+
}
|
|
259
|
+
} catch { needsSudo = true; }
|
|
247
260
|
|
|
248
|
-
|
|
249
|
-
try { execSync('npm cache clean --force 2>/dev/null', { timeout: 15000, stdio: 'ignore' }); } catch {}
|
|
250
|
-
try { execSync('sudo npm cache clean --force 2>/dev/null', { timeout: 15000, stdio: 'ignore' }); } catch {}
|
|
261
|
+
const sudo = needsSudo ? 'sudo ' : '';
|
|
251
262
|
|
|
252
|
-
//
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
263
|
+
// Step 2: Clean npm cache (the #1 cause of stale installs)
|
|
264
|
+
info('Cleaning npm cache...');
|
|
265
|
+
try { execSync(`${sudo}npm cache clean --force 2>/dev/null`, { timeout: 20000, stdio: 'ignore' }); } catch {}
|
|
266
|
+
|
|
267
|
+
// Step 3: Remove old package first (prevents stale symlinks)
|
|
268
|
+
info('Removing old version...');
|
|
269
|
+
try { execSync(`${sudo}npm uninstall -g nothumanallowed 2>/dev/null`, { timeout: 30000, stdio: 'ignore' }); } catch {}
|
|
270
|
+
|
|
271
|
+
// Step 4: Install exact version (NEVER use @latest — it can be stale)
|
|
272
|
+
info(`Installing v${target}...`);
|
|
273
|
+
const installCmd = `${sudo}npm install -g nothumanallowed@${target} --prefer-online --no-cache`;
|
|
274
|
+
try {
|
|
275
|
+
const output = execSync(installCmd, { encoding: 'utf-8', timeout: 120_000, stdio: ['inherit', 'pipe', 'pipe'] });
|
|
258
276
|
|
|
259
|
-
|
|
277
|
+
// Step 5: Verify the installation actually worked
|
|
278
|
+
let installedVersion = '';
|
|
260
279
|
try {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
} catch {}
|
|
283
|
-
return;
|
|
280
|
+
installedVersion = execSync('node -e "import(\'nothumanallowed/src/constants.mjs\').then(m=>console.log(m.VERSION)).catch(()=>{})" 2>/dev/null || true', { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
281
|
+
} catch {}
|
|
282
|
+
if (!installedVersion) {
|
|
283
|
+
try {
|
|
284
|
+
const npmRoot = execSync('npm root -g', { encoding: 'utf-8', timeout: 5000 }).trim();
|
|
285
|
+
const constFile = `${npmRoot}/nothumanallowed/src/constants.mjs`;
|
|
286
|
+
const fs2 = await import('fs');
|
|
287
|
+
if (fs2.default.existsSync(constFile)) {
|
|
288
|
+
const match = fs2.default.readFileSync(constFile, 'utf-8').match(/VERSION\s*=\s*'([^']+)'/);
|
|
289
|
+
if (match) installedVersion = match[1];
|
|
290
|
+
}
|
|
291
|
+
} catch {}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (installedVersion === target) {
|
|
295
|
+
ok(`Updated to v${target}!`);
|
|
296
|
+
} else if (output.includes('nothumanallowed@')) {
|
|
297
|
+
ok(`Updated! (npm reports success)`);
|
|
298
|
+
if (installedVersion && installedVersion !== target) {
|
|
299
|
+
warn(`Installed version appears to be ${installedVersion} — try: hash -r && nha version`);
|
|
284
300
|
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// EACCES = permission denied, try sudo next
|
|
288
|
-
if (msg.includes('EACCES') || msg.includes('permission denied')) continue;
|
|
289
|
-
// Other error — report and stop
|
|
290
|
-
fail(`Update failed: ${msg.slice(0, 200)}`);
|
|
291
|
-
console.log('');
|
|
292
|
-
info('Try manually: sudo npm install -g nothumanallowed@latest');
|
|
293
|
-
return;
|
|
301
|
+
} else {
|
|
302
|
+
warn('Install completed but could not verify version.');
|
|
294
303
|
}
|
|
295
|
-
}
|
|
296
304
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
305
|
+
if (needsSudo) info('(sudo was required on this system)');
|
|
306
|
+
|
|
307
|
+
// Step 6: Auto-restart daemon if running
|
|
308
|
+
try {
|
|
309
|
+
const { isRunning, stopDaemon } = await import('./services/ops-daemon.mjs');
|
|
310
|
+
if (isRunning()) {
|
|
311
|
+
info('Restarting ops daemon...');
|
|
312
|
+
await stopDaemon();
|
|
313
|
+
try {
|
|
314
|
+
execSync(`${sudo}nha ops start`, { timeout: 10_000, stdio: 'inherit' });
|
|
315
|
+
ok('Ops daemon restarted.');
|
|
316
|
+
} catch { warn('Could not auto-restart daemon. Run: nha ops start'); }
|
|
317
|
+
}
|
|
318
|
+
} catch {}
|
|
319
|
+
|
|
320
|
+
// Step 7: Tell user to refresh shell
|
|
321
|
+
console.log('');
|
|
322
|
+
info('If "nha version" still shows the old version, run: hash -r');
|
|
323
|
+
|
|
324
|
+
} catch (e) {
|
|
325
|
+
const msg = e.stderr || e.stdout || e.message || '';
|
|
326
|
+
fail(`Update failed: ${msg.slice(0, 300)}`);
|
|
327
|
+
console.log('');
|
|
328
|
+
info('Try manually:');
|
|
329
|
+
info(` ${sudo}npm cache clean --force`);
|
|
330
|
+
info(` ${sudo}npm install -g nothumanallowed@${target}`);
|
|
331
|
+
info(' hash -r');
|
|
332
|
+
}
|
|
302
333
|
}
|
|
303
334
|
|
|
304
335
|
// ── nha responder ─────────────────────────────────────────────────────────
|