uloop-cli 0.60.0 → 0.61.0
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 +176 -52
- package/dist/cli.bundle.cjs.map +3 -3
- package/package.json +2 -2
- package/src/commands/launch.ts +20 -73
- package/src/default-tools.json +1 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uloop-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
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",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"commander": "14.0.2",
|
|
45
|
-
"launch-unity": "0.
|
|
45
|
+
"launch-unity": "0.15.0",
|
|
46
46
|
"semver": "7.7.3"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
package/src/commands/launch.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI command for launching Unity projects.
|
|
3
|
-
*
|
|
3
|
+
* Delegates to launch-unity's orchestrateLaunch() for all orchestration logic.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// CLI commands output to console by design
|
|
@@ -9,21 +9,11 @@
|
|
|
9
9
|
import { Command } from 'commander';
|
|
10
10
|
import { resolve } from 'path';
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
findUnityProjectBfs,
|
|
14
|
-
getUnityVersion,
|
|
15
|
-
launch,
|
|
16
|
-
findRunningUnityProcess,
|
|
17
|
-
focusUnityProcess,
|
|
18
|
-
killRunningUnity,
|
|
19
|
-
handleStaleLockfile,
|
|
20
|
-
ensureProjectEntryAndUpdate,
|
|
21
|
-
updateLastModifiedIfExists,
|
|
22
|
-
LaunchResolvedOptions,
|
|
23
|
-
} from 'launch-unity';
|
|
12
|
+
import { orchestrateLaunch } from 'launch-unity';
|
|
24
13
|
|
|
25
14
|
interface LaunchCommandOptions {
|
|
26
15
|
restart?: boolean;
|
|
16
|
+
quit?: boolean;
|
|
27
17
|
platform?: string;
|
|
28
18
|
maxDepth?: string;
|
|
29
19
|
addUnityHub?: boolean;
|
|
@@ -33,9 +23,14 @@ interface LaunchCommandOptions {
|
|
|
33
23
|
export function registerLaunchCommand(program: Command): void {
|
|
34
24
|
program
|
|
35
25
|
.command('launch')
|
|
36
|
-
.description(
|
|
26
|
+
.description(
|
|
27
|
+
'Open a Unity project with the matching Editor version installed by Unity Hub.\n' +
|
|
28
|
+
'Auto-detects project path and Unity version from ProjectSettings/ProjectVersion.txt.\n' +
|
|
29
|
+
"Run 'uloop launch -h' for all options. Details: https://github.com/hatayama/LaunchUnityCommand",
|
|
30
|
+
)
|
|
37
31
|
.argument('[project-path]', 'Path to Unity project')
|
|
38
32
|
.option('-r, --restart', 'Kill running Unity and restart')
|
|
33
|
+
.option('-q, --quit', 'Gracefully quit running Unity')
|
|
39
34
|
.option('-p, --platform <platform>', 'Build target (e.g., Android, iOS)')
|
|
40
35
|
.option('--max-depth <n>', 'Search depth when project-path is omitted', '3')
|
|
41
36
|
.option('-a, --add-unity-hub', 'Add to Unity Hub (does not launch)')
|
|
@@ -49,7 +44,7 @@ function parseMaxDepth(value: string | undefined): number {
|
|
|
49
44
|
if (value === undefined) {
|
|
50
45
|
return 3;
|
|
51
46
|
}
|
|
52
|
-
const parsed = parseInt(value, 10);
|
|
47
|
+
const parsed: number = parseInt(value, 10);
|
|
53
48
|
if (Number.isNaN(parsed)) {
|
|
54
49
|
console.error(`Error: Invalid --max-depth value: "${value}". Must be an integer.`);
|
|
55
50
|
process.exit(1);
|
|
@@ -61,65 +56,17 @@ async function runLaunchCommand(
|
|
|
61
56
|
projectPath: string | undefined,
|
|
62
57
|
options: LaunchCommandOptions,
|
|
63
58
|
): Promise<void> {
|
|
64
|
-
const maxDepth = parseMaxDepth(options.maxDepth);
|
|
59
|
+
const maxDepth: number = parseMaxDepth(options.maxDepth);
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const depthInfo = maxDepth === -1 ? 'unlimited' : String(maxDepth);
|
|
71
|
-
console.log(
|
|
72
|
-
`No project-path provided. Searching under ${searchRoot} (max-depth: ${depthInfo})...`,
|
|
73
|
-
);
|
|
74
|
-
const found = findUnityProjectBfs(searchRoot, maxDepth);
|
|
75
|
-
if (!found) {
|
|
76
|
-
console.error(`Error: Unity project not found under ${searchRoot}.`);
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
console.log(`Selected project: ${found}`);
|
|
80
|
-
resolvedProjectPath = found;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const unityVersion = getUnityVersion(resolvedProjectPath);
|
|
84
|
-
|
|
85
|
-
const unityHubOnlyMode = options.addUnityHub === true || options.favorite === true;
|
|
86
|
-
if (unityHubOnlyMode) {
|
|
87
|
-
console.log(`Detected Unity version: ${unityVersion}`);
|
|
88
|
-
console.log(`Project Path: ${resolvedProjectPath}`);
|
|
89
|
-
const now = new Date();
|
|
90
|
-
await ensureProjectEntryAndUpdate(
|
|
91
|
-
resolvedProjectPath,
|
|
92
|
-
unityVersion,
|
|
93
|
-
now,
|
|
94
|
-
options.favorite === true,
|
|
95
|
-
);
|
|
96
|
-
console.log('Unity Hub entry updated.');
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (options.restart === true) {
|
|
101
|
-
await killRunningUnity(resolvedProjectPath);
|
|
102
|
-
} else {
|
|
103
|
-
const runningProcess = await findRunningUnityProcess(resolvedProjectPath);
|
|
104
|
-
if (runningProcess) {
|
|
105
|
-
console.log(
|
|
106
|
-
`Unity process already running for project: ${resolvedProjectPath} (PID: ${runningProcess.pid})`,
|
|
107
|
-
);
|
|
108
|
-
await focusUnityProcess(runningProcess.pid);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
await handleStaleLockfile(resolvedProjectPath);
|
|
114
|
-
|
|
115
|
-
const resolved: LaunchResolvedOptions = {
|
|
116
|
-
projectPath: resolvedProjectPath,
|
|
61
|
+
await orchestrateLaunch({
|
|
62
|
+
projectPath: projectPath ? resolve(projectPath) : undefined,
|
|
63
|
+
searchRoot: process.cwd(),
|
|
64
|
+
searchMaxDepth: maxDepth,
|
|
117
65
|
platform: options.platform,
|
|
118
66
|
unityArgs: [],
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
await updateLastModifiedIfExists(resolvedProjectPath, now);
|
|
67
|
+
restart: options.restart === true,
|
|
68
|
+
quit: options.quit === true,
|
|
69
|
+
addUnityHub: options.addUnityHub === true,
|
|
70
|
+
favoriteUnityHub: options.favorite === true,
|
|
71
|
+
});
|
|
125
72
|
}
|
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.
|
|
7
|
+
export const VERSION = '0.61.0'; // x-release-please-version
|