uloop-cli 0.62.2 → 0.62.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.62.2",
3
+ "version": "0.62.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
@@ -38,14 +38,20 @@ interface CliOptions extends GlobalOptions {
38
38
  [key: string]: unknown;
39
39
  }
40
40
 
41
+ const LAUNCH_COMMAND = 'launch' as const;
42
+ const UPDATE_COMMAND = 'update' as const;
43
+
44
+ // commander.js built-in flags that exit immediately without needing Unity
45
+ const NO_SYNC_FLAGS = ['-v', '--version', '-h', '--help'] as const;
46
+
41
47
  const BUILTIN_COMMANDS = [
42
48
  'list',
43
49
  'sync',
44
50
  'completion',
45
- 'update',
51
+ UPDATE_COMMAND,
46
52
  'fix',
47
53
  'skills',
48
- 'launch',
54
+ LAUNCH_COMMAND,
49
55
  'focus-window',
50
56
  ] as const;
51
57
 
@@ -743,6 +749,13 @@ function commandExists(cmdName: string): boolean {
743
749
  return tools.tools.some((t) => t.name === cmdName);
744
750
  }
745
751
 
752
+ function shouldSkipAutoSync(cmdName: string | undefined, args: string[]): boolean {
753
+ if (cmdName === LAUNCH_COMMAND || cmdName === UPDATE_COMMAND) {
754
+ return true;
755
+ }
756
+ return args.some((arg) => (NO_SYNC_FLAGS as readonly string[]).includes(arg));
757
+ }
758
+
746
759
  /**
747
760
  * Main entry point with auto-sync for unknown commands.
748
761
  */
@@ -751,24 +764,29 @@ async function main(): Promise<void> {
751
764
  return;
752
765
  }
753
766
 
754
- // Check if cache version is outdated and auto-sync if needed
755
- const cachedVersion = loadToolsCache().version;
756
- if (hasCacheFile() && cachedVersion !== VERSION) {
757
- console.log(
758
- `\x1b[33mCache outdated (${cachedVersion} ${VERSION}). Syncing tools from Unity...\x1b[0m`,
759
- );
760
- try {
761
- await syncTools({});
762
- console.log('\x1b[32m✓ Tools synced successfully.\x1b[0m\n');
763
- } catch (error) {
764
- const message = error instanceof Error ? error.message : String(error);
765
- if (isConnectionError(message)) {
766
- console.error('\x1b[33mWarning: Failed to sync tools. Using cached definitions.\x1b[0m');
767
- console.error("\x1b[33mRun 'uloop sync' manually when Unity is available.\x1b[0m\n");
768
- } else {
769
- console.error('\x1b[33mWarning: Failed to sync tools. Using cached definitions.\x1b[0m');
770
- console.error(`\x1b[33mError: ${message}\x1b[0m`);
771
- console.error("\x1b[33mRun 'uloop sync' manually when Unity is available.\x1b[0m\n");
767
+ const args = process.argv.slice(2);
768
+ const cmdName = args.find((arg) => !arg.startsWith('-'));
769
+
770
+ if (!shouldSkipAutoSync(cmdName, args)) {
771
+ // Check if cache version is outdated and auto-sync if needed
772
+ const cachedVersion = loadToolsCache().version;
773
+ if (hasCacheFile() && cachedVersion !== VERSION) {
774
+ console.log(
775
+ `\x1b[33mCache outdated (${cachedVersion} → ${VERSION}). Syncing tools from Unity...\x1b[0m`,
776
+ );
777
+ try {
778
+ await syncTools({});
779
+ console.log('\x1b[32m✓ Tools synced successfully.\x1b[0m\n');
780
+ } catch (error) {
781
+ const message = error instanceof Error ? error.message : String(error);
782
+ if (isConnectionError(message)) {
783
+ console.error('\x1b[33mWarning: Failed to sync tools. Using cached definitions.\x1b[0m');
784
+ console.error("\x1b[33mRun 'uloop sync' manually when Unity is available.\x1b[0m\n");
785
+ } else {
786
+ console.error('\x1b[33mWarning: Failed to sync tools. Using cached definitions.\x1b[0m');
787
+ console.error(`\x1b[33mError: ${message}\x1b[0m`);
788
+ console.error("\x1b[33mRun 'uloop sync' manually when Unity is available.\x1b[0m\n");
789
+ }
772
790
  }
773
791
  }
774
792
  }
@@ -779,9 +797,6 @@ async function main(): Promise<void> {
779
797
  registerToolCommand(tool);
780
798
  }
781
799
 
782
- const args = process.argv.slice(2);
783
- const cmdName = args.find((arg) => !arg.startsWith('-'));
784
-
785
800
  if (cmdName && !commandExists(cmdName)) {
786
801
  console.log(`\x1b[33mUnknown command '${cmdName}'. Syncing tools from Unity...\x1b[0m`);
787
802
  try {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.62.2",
2
+ "version": "0.62.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.62.2'; // x-release-please-version
7
+ export const VERSION = '0.62.4'; // x-release-please-version