kushi-agents 5.9.4 → 5.9.5

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/bin/cli.mjs +50 -2
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -33,6 +33,22 @@ if (args.length === 0) {
33
33
  process.exit(0);
34
34
  }
35
35
 
36
+ // ── version flag (v5.9.5+) ──────────────────────────────────────────────────
37
+ // `kushi --version` / `-v` / `version` → print version and exit. Previously
38
+ // these fell through to the installer's main() which printed the banner and
39
+ // started the install flow.
40
+ if (args.length > 0 && (args[0] === '--version' || args[0] === '-v' || args[0] === 'version')) {
41
+ const pathMod = await import('node:path');
42
+ const urlMod = await import('node:url');
43
+ const fsMod = await import('node:fs');
44
+ const here = pathMod.dirname(urlMod.fileURLToPath(import.meta.url));
45
+ const repoRoot = pathMod.resolve(here, '..');
46
+ let version = 'unknown';
47
+ try { version = JSON.parse(fsMod.readFileSync(pathMod.join(repoRoot, 'package.json'), 'utf-8')).version; } catch {}
48
+ console.log(version);
49
+ process.exit(0);
50
+ }
51
+
36
52
  // ── doctor verb (v5.4.0+) ───────────────────────────────────────────────────
37
53
  if (args.length > 0 && args[0] === 'doctor') {
38
54
  const { spawnSync } = await import('node:child_process');
@@ -276,6 +292,7 @@ Install (run via npx — first-time / host install):
276
292
  WorkIQ: --with-workiq | --workiq-path <abs> | --skip-workiq-check
277
293
 
278
294
  Run 'kushi <command> --help' for more information on a command (where supported).
295
+ Run 'kushi --version' to print the installed version.
279
296
  Docs: https://gim-home.github.io/kushi/
280
297
 
281
298
  In VS Code Chat the prefix is "@Kushi". In Clawpilot just say "kushi <verb>".
@@ -338,12 +355,43 @@ if (args.length > 0 && args[0] === 'uninstall' && !args.includes('--clawpilot')
338
355
 
339
356
  if (args.length > 0 && args[0] === 'upgrade') {
340
357
  // Upgrade: npm i -g @latest, then re-seed assets in cwd preserving config.
358
+ // v5.9.5: capture stderr so users see WHY npm failed; detect Windows
359
+ // self-replacement (kushi.cmd locked because it's the running shell) and
360
+ // print a clear "rerun from a fresh shell" hint.
341
361
  const { spawnSync } = await import('node:child_process');
342
362
  console.log('\n Upgrading kushi-agents globally via npm...\n');
343
363
  const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
344
- const r1 = spawnSync(npm, ['install', '-g', 'kushi-agents@latest'], { stdio: 'inherit' });
364
+ const r1 = spawnSync(npm, ['install', '-g', 'kushi-agents@latest'], {
365
+ stdio: ['inherit', 'inherit', 'pipe'],
366
+ encoding: 'utf-8',
367
+ });
345
368
  if (r1.status !== 0) {
346
- console.error('\n npm install failed.\n');
369
+ const stderr = (r1.stderr || '').toString();
370
+ if (stderr) {
371
+ console.error(stderr);
372
+ }
373
+ const looksLikeSelfReplace = process.platform === 'win32' && (
374
+ /EPERM|EBUSY|operation not permitted|kushi\.cmd|kushi-agents\.cmd|in use/i.test(stderr)
375
+ );
376
+ if (looksLikeSelfReplace) {
377
+ console.error([
378
+ '',
379
+ ' npm could not overwrite the running kushi.cmd shim.',
380
+ ' This is a known Windows limitation when `kushi upgrade` is launched from kushi itself.',
381
+ '',
382
+ ' Fix: open a NEW PowerShell window and run:',
383
+ '',
384
+ ' npm i -g kushi-agents@latest',
385
+ '',
386
+ ' Then re-seed your workspace:',
387
+ '',
388
+ ' cd ' + process.cwd(),
389
+ ' npx kushi-agents@latest --force',
390
+ '',
391
+ ].join('\n'));
392
+ } else if (!stderr) {
393
+ console.error('\n npm install failed (no stderr captured). Try:\n npm i -g kushi-agents@latest --foreground-scripts --loglevel=verbose\n');
394
+ }
347
395
  process.exit(r1.status ?? 1);
348
396
  }
349
397
  console.log('\n Refreshing assets in cwd (config preserved)...\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kushi-agents",
3
- "version": "5.9.4",
3
+ "version": "5.9.5",
4
4
  "description": "Install Kushi — multi-source project evidence agent with Comprehensive Structured Capture (CSC) into weekly-only files across Email, Teams, OneNote, Loop, SharePoint, Meetings, CRM, ADO. Meetings retain a sibling verbatim/ audit folder. WorkIQ-only for M365 sources (Graph / m365_* FORBIDDEN as fallbacks; user-paste is first-class). Host-agnostic.",
5
5
  "type": "module",
6
6
  "bin": {