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/dist/cli.bundle.cjs +34 -23
- package/dist/cli.bundle.cjs.map +2 -2
- package/package.json +1 -1
- package/src/cli.ts +38 -23
- package/src/default-tools.json +1 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
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
|
-
|
|
51
|
+
UPDATE_COMMAND,
|
|
46
52
|
'fix',
|
|
47
53
|
'skills',
|
|
48
|
-
|
|
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
|
-
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
);
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
console.
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
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 {
|
package/src/default-tools.json
CHANGED
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.
|
|
7
|
+
export const VERSION = '0.62.4'; // x-release-please-version
|