toga-ai 1.0.21 → 1.0.22

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/package.json +1 -1
  2. package/scripts/install.js +38 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",
@@ -45,6 +45,25 @@ function getBundleVersion() {
45
45
  }
46
46
  }
47
47
 
48
+ function getLatestNpmVersion() {
49
+ try {
50
+ const result = spawnSync('npm', ['view', 'toga-ai', 'version', '--json'], {
51
+ stdio: 'pipe', shell: false, timeout: 5000,
52
+ });
53
+ if (result.status !== 0 || !result.stdout) return null;
54
+ return result.stdout.toString().trim().replace(/"/g, '');
55
+ } catch (e) { return null; }
56
+ }
57
+
58
+ function semverLt(a, b) {
59
+ const parse = (v) => v.replace(/[^0-9.]/g, '').split('.').map(Number);
60
+ const [aMajor, aMinor, aPatch] = parse(a);
61
+ const [bMajor, bMinor, bPatch] = parse(b);
62
+ if (aMajor !== bMajor) return aMajor < bMajor;
63
+ if (aMinor !== bMinor) return aMinor < bMinor;
64
+ return aPatch < bPatch;
65
+ }
66
+
48
67
  /* ------------------------------------------------------------------ */
49
68
  /* repo discovery (git update source) */
50
69
  /* ------------------------------------------------------------------ */
@@ -491,6 +510,25 @@ function main() {
491
510
 
492
511
  const bundleVersion = getBundleVersion();
493
512
 
513
+ // Warn if running a stale npx-cached version (common Windows problem).
514
+ // Skip during --post-install (npm already ran the right version).
515
+ if (!isPostInstall) {
516
+ const latestVersion = getLatestNpmVersion();
517
+ if (latestVersion && semverLt(bundleVersion, latestVersion)) {
518
+ console.log('');
519
+ console.log('⚠ STALE VERSION DETECTED');
520
+ console.log('═════════════════════════════════════════════');
521
+ console.log(' You are running toga-ai@' + bundleVersion + ' but toga-ai@' + latestVersion + ' is available.');
522
+ console.log(' Your npx cache has an old version. Run the following to fix it:');
523
+ console.log('');
524
+ console.log(' npm cache clean --force');
525
+ console.log(' npx toga-ai@latest');
526
+ console.log('');
527
+ console.log(' (This is a common npx caching issue on Windows.)');
528
+ process.exit(1);
529
+ }
530
+ }
531
+
494
532
  console.log('');
495
533
  console.log('toga-ai — TOGA Technology Claude harness');
496
534
  console.log('═════════════════════════════════════════════');