uloop-cli 0.48.2 → 0.48.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uloop-cli",
3
- "version": "0.48.2",
3
+ "version": "0.48.4",
4
4
  "//version": "x-release-please-version",
5
5
  "description": "CLI tool for Unity Editor communication via uLoopMCP",
6
6
  "main": "dist/cli.bundle.cjs",
package/src/cli.ts CHANGED
@@ -351,10 +351,70 @@ compdef _uloop uloop`;
351
351
  /* eslint-enable no-useless-escape */
352
352
  }
353
353
 
354
+ /**
355
+ * Get the currently installed version of uloop-cli from npm.
356
+ */
357
+ function getInstalledVersion(callback: (version: string | null) => void): void {
358
+ const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
359
+ const child = spawn(npmCommand, ['list', '-g', 'uloop-cli', '--json'], {
360
+ shell: true,
361
+ });
362
+
363
+ let stdout = '';
364
+ child.stdout.on('data', (data: Buffer) => {
365
+ stdout += data.toString();
366
+ });
367
+
368
+ child.on('close', (code) => {
369
+ if (code !== 0) {
370
+ callback(null);
371
+ return;
372
+ }
373
+
374
+ let parsed: unknown;
375
+ try {
376
+ parsed = JSON.parse(stdout);
377
+ } catch {
378
+ callback(null);
379
+ return;
380
+ }
381
+
382
+ if (typeof parsed !== 'object' || parsed === null) {
383
+ callback(null);
384
+ return;
385
+ }
386
+
387
+ const deps = (parsed as Record<string, unknown>)['dependencies'];
388
+ if (typeof deps !== 'object' || deps === null) {
389
+ callback(null);
390
+ return;
391
+ }
392
+
393
+ const uloopCli = (deps as Record<string, unknown>)['uloop-cli'];
394
+ if (typeof uloopCli !== 'object' || uloopCli === null) {
395
+ callback(null);
396
+ return;
397
+ }
398
+
399
+ const version = (uloopCli as Record<string, unknown>)['version'];
400
+ if (typeof version !== 'string') {
401
+ callback(null);
402
+ return;
403
+ }
404
+
405
+ callback(version);
406
+ });
407
+
408
+ child.on('error', () => {
409
+ callback(null);
410
+ });
411
+ }
412
+
354
413
  /**
355
414
  * Update uloop CLI to the latest version using npm.
356
415
  */
357
416
  function updateCli(): void {
417
+ const previousVersion = VERSION;
358
418
  console.log('Updating uloop-cli to the latest version...');
359
419
 
360
420
  const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
@@ -365,8 +425,13 @@ function updateCli(): void {
365
425
 
366
426
  child.on('close', (code) => {
367
427
  if (code === 0) {
368
- console.log('\n✅ uloop-cli has been updated successfully!');
369
- console.log('Run "uloop --version" to check the new version.');
428
+ getInstalledVersion((newVersion) => {
429
+ if (newVersion && newVersion !== previousVersion) {
430
+ console.log(`\n✅ uloop-cli updated: v${previousVersion} -> v${newVersion}`);
431
+ } else {
432
+ console.log(`\n✅ Already up to date (v${previousVersion})`);
433
+ }
434
+ });
370
435
  } else {
371
436
  console.error(`\n❌ Update failed with exit code ${code}`);
372
437
  process.exit(1);
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.48.2",
2
+ "version": "0.48.4",
3
3
  "tools": [
4
4
  {
5
5
  "name": "compile",
package/src/version.ts CHANGED
@@ -4,4 +4,4 @@
4
4
  * This file exists to avoid bundling the entire package.json into the CLI bundle.
5
5
  * This version is automatically updated by release-please.
6
6
  */
7
- export const VERSION = '0.48.2'; // x-release-please-version
7
+ export const VERSION = '0.48.4'; // x-release-please-version