uloop-cli 0.68.3 → 0.69.1
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 +209 -113
- package/dist/cli.bundle.cjs.map +4 -4
- package/knip.json +4 -0
- package/package.json +4 -3
- package/src/__tests__/execute-tool.test.ts +10 -0
- package/src/__tests__/port-resolver.test.ts +68 -0
- package/src/__tests__/project-validator.test.ts +121 -0
- package/src/arg-parser.ts +0 -118
- package/src/cli.ts +24 -1
- package/src/compile-helpers.ts +5 -5
- package/src/default-tools.json +1 -1
- package/src/direct-unity-client.ts +8 -3
- package/src/execute-tool.ts +26 -0
- package/src/port-resolver.ts +39 -18
- package/src/project-root.ts +1 -1
- package/src/project-validator.ts +71 -0
- package/src/simple-framer.ts +2 -2
- package/src/skills/skills-manager.ts +9 -13
- package/src/skills/target-config.ts +1 -1
- package/src/spinner.ts +1 -1
- package/src/version.ts +1 -1
package/dist/cli.bundle.cjs
CHANGED
|
@@ -5384,7 +5384,7 @@ var require_semver2 = __commonJS({
|
|
|
5384
5384
|
|
|
5385
5385
|
// src/cli.ts
|
|
5386
5386
|
var import_fs8 = require("fs");
|
|
5387
|
-
var
|
|
5387
|
+
var import_path10 = require("path");
|
|
5388
5388
|
var import_os2 = require("os");
|
|
5389
5389
|
var import_child_process = require("child_process");
|
|
5390
5390
|
|
|
@@ -5408,7 +5408,7 @@ var {
|
|
|
5408
5408
|
// src/execute-tool.ts
|
|
5409
5409
|
var readline = __toESM(require("readline"), 1);
|
|
5410
5410
|
var import_fs5 = require("fs");
|
|
5411
|
-
var
|
|
5411
|
+
var import_path6 = require("path");
|
|
5412
5412
|
var semver = __toESM(require_semver2(), 1);
|
|
5413
5413
|
|
|
5414
5414
|
// src/direct-unity-client.ts
|
|
@@ -5542,7 +5542,9 @@ var DirectUnityClient = class {
|
|
|
5542
5542
|
this.receiveBuffer = extractResult.remainingData;
|
|
5543
5543
|
const response = JSON.parse(extractResult.jsonContent);
|
|
5544
5544
|
if (response.error) {
|
|
5545
|
-
|
|
5545
|
+
const data = response.error.data;
|
|
5546
|
+
const dataMessage = data !== null && data !== void 0 && typeof data === "object" && "message" in data ? ` (${data.message})` : "";
|
|
5547
|
+
reject(new Error(`Unity error: ${response.error.message}${dataMessage}`));
|
|
5546
5548
|
return;
|
|
5547
5549
|
}
|
|
5548
5550
|
resolve7(response.result);
|
|
@@ -5736,7 +5738,12 @@ function findUnityProjectInParentsWithoutUloop(startPath) {
|
|
|
5736
5738
|
}
|
|
5737
5739
|
|
|
5738
5740
|
// src/port-resolver.ts
|
|
5739
|
-
var
|
|
5741
|
+
var UnityNotRunningError = class extends Error {
|
|
5742
|
+
constructor(projectRoot) {
|
|
5743
|
+
super("UNITY_NOT_RUNNING");
|
|
5744
|
+
this.projectRoot = projectRoot;
|
|
5745
|
+
}
|
|
5746
|
+
};
|
|
5740
5747
|
function normalizePort(port) {
|
|
5741
5748
|
if (typeof port !== "number") {
|
|
5742
5749
|
return null;
|
|
@@ -5780,11 +5787,7 @@ async function resolveUnityPort(explicitPort, projectPath) {
|
|
|
5780
5787
|
}
|
|
5781
5788
|
if (projectPath !== void 0) {
|
|
5782
5789
|
const resolved = validateProjectPath(projectPath);
|
|
5783
|
-
|
|
5784
|
-
if (settingsPort2 !== null) {
|
|
5785
|
-
return settingsPort2;
|
|
5786
|
-
}
|
|
5787
|
-
return DEFAULT_PORT;
|
|
5790
|
+
return await readPortFromSettingsOrThrow(resolved);
|
|
5788
5791
|
}
|
|
5789
5792
|
const projectRoot = findUnityProjectRoot();
|
|
5790
5793
|
if (projectRoot === null) {
|
|
@@ -5792,39 +5795,98 @@ async function resolveUnityPort(explicitPort, projectPath) {
|
|
|
5792
5795
|
"Unity project not found. Use --port or --project-path option to specify the target."
|
|
5793
5796
|
);
|
|
5794
5797
|
}
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
return
|
|
5798
|
+
return await readPortFromSettingsOrThrow(projectRoot);
|
|
5799
|
+
}
|
|
5800
|
+
function createSettingsReadError(projectRoot) {
|
|
5801
|
+
const settingsPath = (0, import_path2.join)(projectRoot, "UserSettings/UnityMcpSettings.json");
|
|
5802
|
+
return new Error(
|
|
5803
|
+
`Could not read Unity server port from settings.
|
|
5804
|
+
|
|
5805
|
+
Settings file: ${settingsPath}
|
|
5806
|
+
|
|
5807
|
+
Run 'uloop launch -r' to restart Unity, or use --port to specify the port directly.`
|
|
5808
|
+
);
|
|
5800
5809
|
}
|
|
5801
|
-
async function
|
|
5810
|
+
async function readPortFromSettingsOrThrow(projectRoot) {
|
|
5802
5811
|
const settingsPath = (0, import_path2.join)(projectRoot, "UserSettings/UnityMcpSettings.json");
|
|
5803
5812
|
if (!(0, import_fs2.existsSync)(settingsPath)) {
|
|
5804
|
-
|
|
5813
|
+
throw createSettingsReadError(projectRoot);
|
|
5805
5814
|
}
|
|
5806
5815
|
let content;
|
|
5807
5816
|
try {
|
|
5808
5817
|
content = await (0, import_promises.readFile)(settingsPath, "utf-8");
|
|
5809
5818
|
} catch {
|
|
5810
|
-
|
|
5819
|
+
throw createSettingsReadError(projectRoot);
|
|
5811
5820
|
}
|
|
5812
|
-
let
|
|
5821
|
+
let parsed;
|
|
5813
5822
|
try {
|
|
5814
|
-
|
|
5823
|
+
parsed = JSON.parse(content);
|
|
5815
5824
|
} catch {
|
|
5816
|
-
|
|
5825
|
+
throw createSettingsReadError(projectRoot);
|
|
5826
|
+
}
|
|
5827
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
5828
|
+
throw createSettingsReadError(projectRoot);
|
|
5829
|
+
}
|
|
5830
|
+
const settings = parsed;
|
|
5831
|
+
if (settings.isServerRunning === false) {
|
|
5832
|
+
throw new UnityNotRunningError(projectRoot);
|
|
5833
|
+
}
|
|
5834
|
+
const port = resolvePortFromUnitySettings(settings);
|
|
5835
|
+
if (port === null) {
|
|
5836
|
+
throw createSettingsReadError(projectRoot);
|
|
5837
|
+
}
|
|
5838
|
+
return port;
|
|
5839
|
+
}
|
|
5840
|
+
|
|
5841
|
+
// src/project-validator.ts
|
|
5842
|
+
var import_node_assert = __toESM(require("node:assert"), 1);
|
|
5843
|
+
var import_promises2 = require("fs/promises");
|
|
5844
|
+
var import_path3 = require("path");
|
|
5845
|
+
var ProjectMismatchError = class extends Error {
|
|
5846
|
+
constructor(expectedProjectRoot, connectedProjectRoot) {
|
|
5847
|
+
super("PROJECT_MISMATCH");
|
|
5848
|
+
this.expectedProjectRoot = expectedProjectRoot;
|
|
5849
|
+
this.connectedProjectRoot = connectedProjectRoot;
|
|
5850
|
+
}
|
|
5851
|
+
};
|
|
5852
|
+
var JSON_RPC_METHOD_NOT_FOUND = -32601;
|
|
5853
|
+
async function normalizePath(path) {
|
|
5854
|
+
const resolved = await (0, import_promises2.realpath)(path);
|
|
5855
|
+
return resolved.replace(/\/+$/, "");
|
|
5856
|
+
}
|
|
5857
|
+
async function validateConnectedProject(client, expectedProjectRoot) {
|
|
5858
|
+
(0, import_node_assert.default)(client.isConnected(), "client must be connected before validation");
|
|
5859
|
+
let response;
|
|
5860
|
+
try {
|
|
5861
|
+
response = await client.sendRequest("get-version", {});
|
|
5862
|
+
} catch (error) {
|
|
5863
|
+
if (error instanceof Error && (error.message.includes(`${JSON_RPC_METHOD_NOT_FOUND}`) || /method not found/i.test(error.message) || /unknown tool/i.test(error.message))) {
|
|
5864
|
+
console.error(
|
|
5865
|
+
"Warning: Could not verify project identity (get-version not available). Consider updating uLoopMCP package."
|
|
5866
|
+
);
|
|
5867
|
+
return;
|
|
5868
|
+
}
|
|
5869
|
+
throw error;
|
|
5870
|
+
}
|
|
5871
|
+
if (typeof response?.DataPath !== "string" || response.DataPath.length === 0) {
|
|
5872
|
+
console.error("Warning: Could not verify project identity (invalid get-version response).");
|
|
5873
|
+
return;
|
|
5874
|
+
}
|
|
5875
|
+
const connectedProjectRoot = (0, import_path3.dirname)(response.DataPath);
|
|
5876
|
+
const normalizedExpected = await normalizePath(expectedProjectRoot);
|
|
5877
|
+
const normalizedConnected = await normalizePath(connectedProjectRoot);
|
|
5878
|
+
if (normalizedExpected !== normalizedConnected) {
|
|
5879
|
+
throw new ProjectMismatchError(normalizedExpected, normalizedConnected);
|
|
5817
5880
|
}
|
|
5818
|
-
return resolvePortFromUnitySettings(settings);
|
|
5819
5881
|
}
|
|
5820
5882
|
|
|
5821
5883
|
// src/tool-cache.ts
|
|
5822
5884
|
var import_fs3 = require("fs");
|
|
5823
|
-
var
|
|
5885
|
+
var import_path4 = require("path");
|
|
5824
5886
|
|
|
5825
5887
|
// src/default-tools.json
|
|
5826
5888
|
var default_tools_default = {
|
|
5827
|
-
version: "0.
|
|
5889
|
+
version: "0.69.1",
|
|
5828
5890
|
tools: [
|
|
5829
5891
|
{
|
|
5830
5892
|
name: "compile",
|
|
@@ -6293,16 +6355,16 @@ var CACHE_DIR = ".uloop";
|
|
|
6293
6355
|
var CACHE_FILE = "tools.json";
|
|
6294
6356
|
function getCacheDir(projectPath) {
|
|
6295
6357
|
if (projectPath !== void 0) {
|
|
6296
|
-
return (0,
|
|
6358
|
+
return (0, import_path4.join)(projectPath, CACHE_DIR);
|
|
6297
6359
|
}
|
|
6298
6360
|
const projectRoot = findUnityProjectRoot();
|
|
6299
6361
|
if (projectRoot === null) {
|
|
6300
|
-
return (0,
|
|
6362
|
+
return (0, import_path4.join)(process.cwd(), CACHE_DIR);
|
|
6301
6363
|
}
|
|
6302
|
-
return (0,
|
|
6364
|
+
return (0, import_path4.join)(projectRoot, CACHE_DIR);
|
|
6303
6365
|
}
|
|
6304
6366
|
function getCachePath(projectPath) {
|
|
6305
|
-
return (0,
|
|
6367
|
+
return (0, import_path4.join)(getCacheDir(projectPath), CACHE_FILE);
|
|
6306
6368
|
}
|
|
6307
6369
|
function getDefaultTools() {
|
|
6308
6370
|
return default_tools_default;
|
|
@@ -6353,7 +6415,7 @@ function getCachedServerVersion() {
|
|
|
6353
6415
|
}
|
|
6354
6416
|
|
|
6355
6417
|
// src/version.ts
|
|
6356
|
-
var VERSION = "0.
|
|
6418
|
+
var VERSION = "0.69.1";
|
|
6357
6419
|
|
|
6358
6420
|
// src/spinner.ts
|
|
6359
6421
|
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
@@ -6388,10 +6450,10 @@ function createSpinner(initialMessage) {
|
|
|
6388
6450
|
}
|
|
6389
6451
|
|
|
6390
6452
|
// src/compile-helpers.ts
|
|
6391
|
-
var
|
|
6453
|
+
var import_node_assert2 = __toESM(require("node:assert"), 1);
|
|
6392
6454
|
var import_fs4 = require("fs");
|
|
6393
6455
|
var net2 = __toESM(require("net"), 1);
|
|
6394
|
-
var
|
|
6456
|
+
var import_path5 = require("path");
|
|
6395
6457
|
var SAFE_REQUEST_ID_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
6396
6458
|
var COMPILE_FORCE_RECOMPILE_ARG_KEYS = [
|
|
6397
6459
|
"ForceRecompile",
|
|
@@ -6451,22 +6513,22 @@ function ensureCompileRequestId(args) {
|
|
|
6451
6513
|
return requestId;
|
|
6452
6514
|
}
|
|
6453
6515
|
function getCompileResultFilePath(projectRoot, requestId) {
|
|
6454
|
-
(0,
|
|
6516
|
+
(0, import_node_assert2.default)(
|
|
6455
6517
|
SAFE_REQUEST_ID_PATTERN.test(requestId),
|
|
6456
6518
|
`requestId contains unsafe characters: '${requestId}'`
|
|
6457
6519
|
);
|
|
6458
|
-
return (0,
|
|
6520
|
+
return (0, import_path5.join)(projectRoot, "Temp", "uLoopMCP", "compile-results", `${requestId}.json`);
|
|
6459
6521
|
}
|
|
6460
6522
|
function isUnityBusyByLockFiles(projectRoot) {
|
|
6461
|
-
const compilingLockPath = (0,
|
|
6523
|
+
const compilingLockPath = (0, import_path5.join)(projectRoot, "Temp", "compiling.lock");
|
|
6462
6524
|
if ((0, import_fs4.existsSync)(compilingLockPath)) {
|
|
6463
6525
|
return true;
|
|
6464
6526
|
}
|
|
6465
|
-
const domainReloadLockPath = (0,
|
|
6527
|
+
const domainReloadLockPath = (0, import_path5.join)(projectRoot, "Temp", "domainreload.lock");
|
|
6466
6528
|
if ((0, import_fs4.existsSync)(domainReloadLockPath)) {
|
|
6467
6529
|
return true;
|
|
6468
6530
|
}
|
|
6469
|
-
const serverStartingLockPath = (0,
|
|
6531
|
+
const serverStartingLockPath = (0, import_path5.join)(projectRoot, "Temp", "serverstarting.lock");
|
|
6470
6532
|
return (0, import_fs4.existsSync)(serverStartingLockPath);
|
|
6471
6533
|
}
|
|
6472
6534
|
function stripUtf8Bom(content) {
|
|
@@ -6676,15 +6738,15 @@ function checkUnityBusyState(projectPath) {
|
|
|
6676
6738
|
if (projectRoot === null) {
|
|
6677
6739
|
return;
|
|
6678
6740
|
}
|
|
6679
|
-
const compilingLock = (0,
|
|
6741
|
+
const compilingLock = (0, import_path6.join)(projectRoot, "Temp", "compiling.lock");
|
|
6680
6742
|
if ((0, import_fs5.existsSync)(compilingLock)) {
|
|
6681
6743
|
throw new Error("UNITY_COMPILING");
|
|
6682
6744
|
}
|
|
6683
|
-
const domainReloadLock = (0,
|
|
6745
|
+
const domainReloadLock = (0, import_path6.join)(projectRoot, "Temp", "domainreload.lock");
|
|
6684
6746
|
if ((0, import_fs5.existsSync)(domainReloadLock)) {
|
|
6685
6747
|
throw new Error("UNITY_DOMAIN_RELOAD");
|
|
6686
6748
|
}
|
|
6687
|
-
const serverStartingLock = (0,
|
|
6749
|
+
const serverStartingLock = (0, import_path6.join)(projectRoot, "Temp", "serverstarting.lock");
|
|
6688
6750
|
if ((0, import_fs5.existsSync)(serverStartingLock)) {
|
|
6689
6751
|
throw new Error("UNITY_SERVER_STARTING");
|
|
6690
6752
|
}
|
|
@@ -6707,12 +6769,16 @@ async function executeToolCommand(toolName, params, globalOptions) {
|
|
|
6707
6769
|
let lastError;
|
|
6708
6770
|
let immediateResult;
|
|
6709
6771
|
const projectRoot = globalOptions.projectPath !== void 0 ? validateProjectPath(globalOptions.projectPath) : findUnityProjectRoot();
|
|
6772
|
+
const shouldValidateProject = portNumber === void 0 && projectRoot !== null;
|
|
6710
6773
|
let requestDispatched = false;
|
|
6711
6774
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
6712
6775
|
checkUnityBusyState(globalOptions.projectPath);
|
|
6713
6776
|
const client = new DirectUnityClient(port);
|
|
6714
6777
|
try {
|
|
6715
6778
|
await client.connect();
|
|
6779
|
+
if (shouldValidateProject) {
|
|
6780
|
+
await validateConnectedProject(client, projectRoot);
|
|
6781
|
+
}
|
|
6716
6782
|
spinner.update(`Executing ${toolName}...`);
|
|
6717
6783
|
requestDispatched = true;
|
|
6718
6784
|
const result = await client.sendRequest(toolName, params);
|
|
@@ -6824,6 +6890,8 @@ async function listAvailableTools(globalOptions) {
|
|
|
6824
6890
|
portNumber = parsed;
|
|
6825
6891
|
}
|
|
6826
6892
|
const port = await resolveUnityPort(portNumber, globalOptions.projectPath);
|
|
6893
|
+
const projectRoot = globalOptions.projectPath !== void 0 ? validateProjectPath(globalOptions.projectPath) : findUnityProjectRoot();
|
|
6894
|
+
const shouldValidateProject = portNumber === void 0 && projectRoot !== null;
|
|
6827
6895
|
const restoreStdin = suppressStdinEcho();
|
|
6828
6896
|
const spinner = createSpinner("Connecting to Unity...");
|
|
6829
6897
|
let lastError;
|
|
@@ -6832,6 +6900,9 @@ async function listAvailableTools(globalOptions) {
|
|
|
6832
6900
|
const client = new DirectUnityClient(port);
|
|
6833
6901
|
try {
|
|
6834
6902
|
await client.connect();
|
|
6903
|
+
if (shouldValidateProject) {
|
|
6904
|
+
await validateConnectedProject(client, projectRoot);
|
|
6905
|
+
}
|
|
6835
6906
|
spinner.update("Fetching tool list...");
|
|
6836
6907
|
const result = await client.sendRequest("get-tool-details", { IncludeDevelopmentOnly: false });
|
|
6837
6908
|
if (!result.Tools || !Array.isArray(result.Tools)) {
|
|
@@ -6881,6 +6952,8 @@ async function syncTools(globalOptions) {
|
|
|
6881
6952
|
portNumber = parsed;
|
|
6882
6953
|
}
|
|
6883
6954
|
const port = await resolveUnityPort(portNumber, globalOptions.projectPath);
|
|
6955
|
+
const projectRoot = globalOptions.projectPath !== void 0 ? validateProjectPath(globalOptions.projectPath) : findUnityProjectRoot();
|
|
6956
|
+
const shouldValidateProject = portNumber === void 0 && projectRoot !== null;
|
|
6884
6957
|
const restoreStdin = suppressStdinEcho();
|
|
6885
6958
|
const spinner = createSpinner("Connecting to Unity...");
|
|
6886
6959
|
let lastError;
|
|
@@ -6889,6 +6962,9 @@ async function syncTools(globalOptions) {
|
|
|
6889
6962
|
const client = new DirectUnityClient(port);
|
|
6890
6963
|
try {
|
|
6891
6964
|
await client.connect();
|
|
6965
|
+
if (shouldValidateProject) {
|
|
6966
|
+
await validateConnectedProject(client, projectRoot);
|
|
6967
|
+
}
|
|
6892
6968
|
spinner.update("Syncing tools...");
|
|
6893
6969
|
const result = await client.sendRequest("get-tool-details", { IncludeDevelopmentOnly: false });
|
|
6894
6970
|
spinner.stop();
|
|
@@ -6943,7 +7019,7 @@ function pascalToKebabCase(pascal) {
|
|
|
6943
7019
|
|
|
6944
7020
|
// src/skills/skills-manager.ts
|
|
6945
7021
|
var import_fs7 = require("fs");
|
|
6946
|
-
var
|
|
7022
|
+
var import_path8 = require("path");
|
|
6947
7023
|
var import_os = require("os");
|
|
6948
7024
|
|
|
6949
7025
|
// src/skills/deprecated-skills.ts
|
|
@@ -6956,15 +7032,15 @@ var DEPRECATED_SKILLS = [
|
|
|
6956
7032
|
|
|
6957
7033
|
// src/tool-settings-loader.ts
|
|
6958
7034
|
var import_fs6 = require("fs");
|
|
6959
|
-
var
|
|
7035
|
+
var import_path7 = require("path");
|
|
6960
7036
|
var ULOOP_DIR = ".uloop";
|
|
6961
7037
|
var TOOL_SETTINGS_FILE = "settings.tools.json";
|
|
6962
7038
|
function loadDisabledTools(projectPath) {
|
|
6963
|
-
const projectRoot = projectPath !== void 0 ? (0,
|
|
7039
|
+
const projectRoot = projectPath !== void 0 ? (0, import_path7.resolve)(projectPath) : findUnityProjectRoot();
|
|
6964
7040
|
if (projectRoot === null) {
|
|
6965
7041
|
return [];
|
|
6966
7042
|
}
|
|
6967
|
-
const settingsPath = (0,
|
|
7043
|
+
const settingsPath = (0, import_path7.join)(projectRoot, ULOOP_DIR, TOOL_SETTINGS_FILE);
|
|
6968
7044
|
let content;
|
|
6969
7045
|
try {
|
|
6970
7046
|
content = (0, import_fs6.readFileSync)(settingsPath, "utf-8");
|
|
@@ -7039,7 +7115,7 @@ var SkillsPathConstants = class _SkillsPathConstants {
|
|
|
7039
7115
|
];
|
|
7040
7116
|
};
|
|
7041
7117
|
function getGlobalSkillsDir(target) {
|
|
7042
|
-
return (0,
|
|
7118
|
+
return (0, import_path8.join)((0, import_os.homedir)(), target.projectDir, "skills");
|
|
7043
7119
|
}
|
|
7044
7120
|
function getProjectSkillsDir(target) {
|
|
7045
7121
|
const status = getUnityProjectStatus();
|
|
@@ -7054,11 +7130,11 @@ function getProjectSkillsDir(target) {
|
|
|
7054
7130
|
Please install uLoopMCP package first, then run this command again.`
|
|
7055
7131
|
);
|
|
7056
7132
|
}
|
|
7057
|
-
return (0,
|
|
7133
|
+
return (0, import_path8.join)(status.path, target.projectDir, "skills");
|
|
7058
7134
|
}
|
|
7059
7135
|
function getSkillPath(skillDirName, target, global) {
|
|
7060
7136
|
const baseDir = global ? getGlobalSkillsDir(target) : getProjectSkillsDir(target);
|
|
7061
|
-
return (0,
|
|
7137
|
+
return (0, import_path8.join)(baseDir, skillDirName, target.skillFileName);
|
|
7062
7138
|
}
|
|
7063
7139
|
function isSkillInstalled(skill, target, global) {
|
|
7064
7140
|
const skillPath = getSkillPath(skill.dirName, target, global);
|
|
@@ -7066,8 +7142,8 @@ function isSkillInstalled(skill, target, global) {
|
|
|
7066
7142
|
}
|
|
7067
7143
|
function isSkillOutdated(skill, target, global) {
|
|
7068
7144
|
const baseDir = global ? getGlobalSkillsDir(target) : getProjectSkillsDir(target);
|
|
7069
|
-
const skillDir = (0,
|
|
7070
|
-
const skillPath = (0,
|
|
7145
|
+
const skillDir = (0, import_path8.join)(baseDir, skill.dirName);
|
|
7146
|
+
const skillPath = (0, import_path8.join)(skillDir, target.skillFileName);
|
|
7071
7147
|
if (!(0, import_fs7.existsSync)(skillPath)) {
|
|
7072
7148
|
return false;
|
|
7073
7149
|
}
|
|
@@ -7078,7 +7154,7 @@ function isSkillOutdated(skill, target, global) {
|
|
|
7078
7154
|
if ("additionalFiles" in skill && skill.additionalFiles) {
|
|
7079
7155
|
const additionalFiles = skill.additionalFiles;
|
|
7080
7156
|
for (const [relativePath, expectedContent] of Object.entries(additionalFiles)) {
|
|
7081
|
-
const filePath = (0,
|
|
7157
|
+
const filePath = (0, import_path8.join)(skillDir, relativePath);
|
|
7082
7158
|
if (!(0, import_fs7.existsSync)(filePath)) {
|
|
7083
7159
|
return true;
|
|
7084
7160
|
}
|
|
@@ -7154,11 +7230,11 @@ function scanEditorFolderForSkills(editorPath, skills, sourceType, warnLegacy =
|
|
|
7154
7230
|
if (EXCLUDED_DIRS2.has(entry.name)) {
|
|
7155
7231
|
continue;
|
|
7156
7232
|
}
|
|
7157
|
-
const fullPath = (0,
|
|
7233
|
+
const fullPath = (0, import_path8.join)(editorPath, entry.name);
|
|
7158
7234
|
if (entry.isDirectory()) {
|
|
7159
|
-
const skillDir = (0,
|
|
7160
|
-
const skillMdPath = (0,
|
|
7161
|
-
const legacySkillMdPath = (0,
|
|
7235
|
+
const skillDir = (0, import_path8.join)(fullPath, SkillsPathConstants.SKILL_DIR);
|
|
7236
|
+
const skillMdPath = (0, import_path8.join)(skillDir, SkillsPathConstants.SKILL_FILE);
|
|
7237
|
+
const legacySkillMdPath = (0, import_path8.join)(fullPath, SkillsPathConstants.SKILL_FILE);
|
|
7162
7238
|
if (warnLegacy && !(0, import_fs7.existsSync)(skillMdPath) && (0, import_fs7.existsSync)(legacySkillMdPath)) {
|
|
7163
7239
|
warnLegacySkillStructure(fullPath, legacySkillMdPath);
|
|
7164
7240
|
}
|
|
@@ -7196,7 +7272,7 @@ function findEditorFolders(basePath, maxDepth = 2) {
|
|
|
7196
7272
|
if (!entry.isDirectory() || EXCLUDED_DIRS2.has(entry.name)) {
|
|
7197
7273
|
continue;
|
|
7198
7274
|
}
|
|
7199
|
-
const fullPath = (0,
|
|
7275
|
+
const fullPath = (0, import_path8.join)(currentPath, entry.name);
|
|
7200
7276
|
if (entry.name === "Editor") {
|
|
7201
7277
|
editorFolders.push(fullPath);
|
|
7202
7278
|
} else {
|
|
@@ -7215,9 +7291,9 @@ function collectProjectSkills(excludedRoots = []) {
|
|
|
7215
7291
|
const skills = [];
|
|
7216
7292
|
const seenNames = /* @__PURE__ */ new Set();
|
|
7217
7293
|
const searchPaths = [
|
|
7218
|
-
(0,
|
|
7219
|
-
(0,
|
|
7220
|
-
(0,
|
|
7294
|
+
(0, import_path8.join)(projectRoot, SkillsPathConstants.ASSETS_DIR),
|
|
7295
|
+
(0, import_path8.join)(projectRoot, SkillsPathConstants.PACKAGES_DIR),
|
|
7296
|
+
(0, import_path8.join)(projectRoot, SkillsPathConstants.LIBRARY_DIR, SkillsPathConstants.PACKAGE_CACHE_DIR)
|
|
7221
7297
|
];
|
|
7222
7298
|
for (const searchPath of searchPaths) {
|
|
7223
7299
|
if (!(0, import_fs7.existsSync)(searchPath)) {
|
|
@@ -7251,22 +7327,22 @@ function getAllSkillStatuses(target, global) {
|
|
|
7251
7327
|
}
|
|
7252
7328
|
function installSkill(skill, target, global) {
|
|
7253
7329
|
const baseDir = global ? getGlobalSkillsDir(target) : getProjectSkillsDir(target);
|
|
7254
|
-
const skillDir = (0,
|
|
7255
|
-
const skillPath = (0,
|
|
7330
|
+
const skillDir = (0, import_path8.join)(baseDir, skill.dirName);
|
|
7331
|
+
const skillPath = (0, import_path8.join)(skillDir, target.skillFileName);
|
|
7256
7332
|
(0, import_fs7.mkdirSync)(skillDir, { recursive: true });
|
|
7257
7333
|
(0, import_fs7.writeFileSync)(skillPath, skill.content, "utf-8");
|
|
7258
7334
|
if ("additionalFiles" in skill && skill.additionalFiles) {
|
|
7259
7335
|
const additionalFiles = skill.additionalFiles;
|
|
7260
7336
|
for (const [relativePath, content] of Object.entries(additionalFiles)) {
|
|
7261
|
-
const fullPath = (0,
|
|
7262
|
-
(0, import_fs7.mkdirSync)((0,
|
|
7337
|
+
const fullPath = (0, import_path8.join)(skillDir, relativePath);
|
|
7338
|
+
(0, import_fs7.mkdirSync)((0, import_path8.dirname)(fullPath), { recursive: true });
|
|
7263
7339
|
(0, import_fs7.writeFileSync)(fullPath, content);
|
|
7264
7340
|
}
|
|
7265
7341
|
}
|
|
7266
7342
|
}
|
|
7267
7343
|
function uninstallSkill(skill, target, global) {
|
|
7268
7344
|
const baseDir = global ? getGlobalSkillsDir(target) : getProjectSkillsDir(target);
|
|
7269
|
-
const skillDir = (0,
|
|
7345
|
+
const skillDir = (0, import_path8.join)(baseDir, skill.dirName);
|
|
7270
7346
|
if (!(0, import_fs7.existsSync)(skillDir)) {
|
|
7271
7347
|
return false;
|
|
7272
7348
|
}
|
|
@@ -7284,7 +7360,7 @@ function installAllSkills(target, global) {
|
|
|
7284
7360
|
};
|
|
7285
7361
|
const baseDir = global ? getGlobalSkillsDir(target) : getProjectSkillsDir(target);
|
|
7286
7362
|
for (const deprecatedName of DEPRECATED_SKILLS) {
|
|
7287
|
-
const deprecatedDir = (0,
|
|
7363
|
+
const deprecatedDir = (0, import_path8.join)(baseDir, deprecatedName);
|
|
7288
7364
|
if ((0, import_fs7.existsSync)(deprecatedDir)) {
|
|
7289
7365
|
(0, import_fs7.rmSync)(deprecatedDir, { recursive: true, force: true });
|
|
7290
7366
|
result.deprecatedRemoved++;
|
|
@@ -7328,7 +7404,7 @@ function uninstallAllSkills(target, global) {
|
|
|
7328
7404
|
const result = { removed: 0, notFound: 0 };
|
|
7329
7405
|
const baseDir = global ? getGlobalSkillsDir(target) : getProjectSkillsDir(target);
|
|
7330
7406
|
for (const deprecatedName of DEPRECATED_SKILLS) {
|
|
7331
|
-
const deprecatedDir = (0,
|
|
7407
|
+
const deprecatedDir = (0, import_path8.join)(baseDir, deprecatedName);
|
|
7332
7408
|
if ((0, import_fs7.existsSync)(deprecatedDir)) {
|
|
7333
7409
|
(0, import_fs7.rmSync)(deprecatedDir, { recursive: true, force: true });
|
|
7334
7410
|
result.removed++;
|
|
@@ -7359,7 +7435,7 @@ function collectAllSkills() {
|
|
|
7359
7435
|
return dedupeSkillsByName([packageSkills, cliOnlySkills, projectSkills]);
|
|
7360
7436
|
}
|
|
7361
7437
|
function collectPackageSkillsFromRoot(packageRoot) {
|
|
7362
|
-
const mcpToolsRoot = (0,
|
|
7438
|
+
const mcpToolsRoot = (0, import_path8.join)(
|
|
7363
7439
|
packageRoot,
|
|
7364
7440
|
SkillsPathConstants.EDITOR_DIR,
|
|
7365
7441
|
SkillsPathConstants.API_DIR,
|
|
@@ -7373,7 +7449,7 @@ function collectPackageSkillsFromRoot(packageRoot) {
|
|
|
7373
7449
|
return skills;
|
|
7374
7450
|
}
|
|
7375
7451
|
function collectCliOnlySkills() {
|
|
7376
|
-
const cliOnlyRoot = (0,
|
|
7452
|
+
const cliOnlyRoot = (0, import_path8.resolve)(
|
|
7377
7453
|
__dirname,
|
|
7378
7454
|
SkillsPathConstants.DIST_PARENT_DIR,
|
|
7379
7455
|
SkillsPathConstants.SRC_DIR,
|
|
@@ -7405,7 +7481,7 @@ function collectSkillFolderFilesRecursive(baseDir, currentDir, additionalFiles)
|
|
|
7405
7481
|
if (isExcludedFile(entry.name)) {
|
|
7406
7482
|
continue;
|
|
7407
7483
|
}
|
|
7408
|
-
const fullPath = (0,
|
|
7484
|
+
const fullPath = (0, import_path8.join)(currentDir, entry.name);
|
|
7409
7485
|
const relativePath = fullPath.slice(baseDir.length + 1);
|
|
7410
7486
|
if (entry.isDirectory()) {
|
|
7411
7487
|
if (EXCLUDED_DIRS2.has(entry.name)) {
|
|
@@ -7444,13 +7520,13 @@ function dedupeSkillsByName(skillGroups) {
|
|
|
7444
7520
|
}
|
|
7445
7521
|
function resolvePackageRoot(projectRoot) {
|
|
7446
7522
|
const candidates = [];
|
|
7447
|
-
candidates.push((0,
|
|
7523
|
+
candidates.push((0, import_path8.join)(projectRoot, SkillsPathConstants.PACKAGES_DIR, SkillsPathConstants.SRC_DIR));
|
|
7448
7524
|
const manifestPaths = resolveManifestPackagePaths(projectRoot);
|
|
7449
7525
|
for (const manifestPath of manifestPaths) {
|
|
7450
7526
|
candidates.push(manifestPath);
|
|
7451
7527
|
}
|
|
7452
7528
|
for (const packageName of SkillsPathConstants.PACKAGE_NAMES) {
|
|
7453
|
-
candidates.push((0,
|
|
7529
|
+
candidates.push((0, import_path8.join)(projectRoot, SkillsPathConstants.PACKAGES_DIR, packageName));
|
|
7454
7530
|
}
|
|
7455
7531
|
const directRoot = resolveFirstPackageRoot(candidates);
|
|
7456
7532
|
if (directRoot) {
|
|
@@ -7459,7 +7535,7 @@ function resolvePackageRoot(projectRoot) {
|
|
|
7459
7535
|
return resolvePackageCacheRoot(projectRoot);
|
|
7460
7536
|
}
|
|
7461
7537
|
function resolveManifestPackagePaths(projectRoot) {
|
|
7462
|
-
const manifestPath = (0,
|
|
7538
|
+
const manifestPath = (0, import_path8.join)(
|
|
7463
7539
|
projectRoot,
|
|
7464
7540
|
SkillsPathConstants.PACKAGES_DIR,
|
|
7465
7541
|
SkillsPathConstants.MANIFEST_FILE
|
|
@@ -7511,10 +7587,10 @@ function resolveDependencyPath(rawPath, projectRoot) {
|
|
|
7511
7587
|
if (normalizedPath.startsWith("//")) {
|
|
7512
7588
|
normalizedPath = normalizedPath.slice(2);
|
|
7513
7589
|
}
|
|
7514
|
-
if ((0,
|
|
7590
|
+
if ((0, import_path8.isAbsolute)(normalizedPath)) {
|
|
7515
7591
|
return normalizedPath;
|
|
7516
7592
|
}
|
|
7517
|
-
return (0,
|
|
7593
|
+
return (0, import_path8.resolve)(projectRoot, normalizedPath);
|
|
7518
7594
|
}
|
|
7519
7595
|
function resolveFirstPackageRoot(candidates) {
|
|
7520
7596
|
for (const candidate of candidates) {
|
|
@@ -7526,7 +7602,7 @@ function resolveFirstPackageRoot(candidates) {
|
|
|
7526
7602
|
return null;
|
|
7527
7603
|
}
|
|
7528
7604
|
function resolvePackageCacheRoot(projectRoot) {
|
|
7529
|
-
const packageCacheDir = (0,
|
|
7605
|
+
const packageCacheDir = (0, import_path8.join)(
|
|
7530
7606
|
projectRoot,
|
|
7531
7607
|
SkillsPathConstants.LIBRARY_DIR,
|
|
7532
7608
|
SkillsPathConstants.PACKAGE_CACHE_DIR
|
|
@@ -7542,7 +7618,7 @@ function resolvePackageCacheRoot(projectRoot) {
|
|
|
7542
7618
|
if (!isTargetPackageCacheDir(entry.name)) {
|
|
7543
7619
|
continue;
|
|
7544
7620
|
}
|
|
7545
|
-
const candidate = (0,
|
|
7621
|
+
const candidate = (0, import_path8.join)(packageCacheDir, entry.name);
|
|
7546
7622
|
const resolvedRoot = resolvePackageRootCandidate(candidate);
|
|
7547
7623
|
if (resolvedRoot) {
|
|
7548
7624
|
return resolvedRoot;
|
|
@@ -7554,7 +7630,7 @@ function resolvePackageRootCandidate(candidate) {
|
|
|
7554
7630
|
if (!(0, import_fs7.existsSync)(candidate)) {
|
|
7555
7631
|
return null;
|
|
7556
7632
|
}
|
|
7557
|
-
const directToolsPath = (0,
|
|
7633
|
+
const directToolsPath = (0, import_path8.join)(
|
|
7558
7634
|
candidate,
|
|
7559
7635
|
SkillsPathConstants.EDITOR_DIR,
|
|
7560
7636
|
SkillsPathConstants.API_DIR,
|
|
@@ -7563,8 +7639,8 @@ function resolvePackageRootCandidate(candidate) {
|
|
|
7563
7639
|
if ((0, import_fs7.existsSync)(directToolsPath)) {
|
|
7564
7640
|
return candidate;
|
|
7565
7641
|
}
|
|
7566
|
-
const nestedRoot = (0,
|
|
7567
|
-
const nestedToolsPath = (0,
|
|
7642
|
+
const nestedRoot = (0, import_path8.join)(candidate, SkillsPathConstants.PACKAGES_DIR, SkillsPathConstants.SRC_DIR);
|
|
7643
|
+
const nestedToolsPath = (0, import_path8.join)(
|
|
7568
7644
|
nestedRoot,
|
|
7569
7645
|
SkillsPathConstants.EDITOR_DIR,
|
|
7570
7646
|
SkillsPathConstants.API_DIR,
|
|
@@ -7596,12 +7672,12 @@ function isUnderExcludedRoots(targetPath, excludedRoots) {
|
|
|
7596
7672
|
return false;
|
|
7597
7673
|
}
|
|
7598
7674
|
function isPathUnder(childPath, parentPath) {
|
|
7599
|
-
const resolvedChild = (0,
|
|
7600
|
-
const resolvedParent = (0,
|
|
7675
|
+
const resolvedChild = (0, import_path8.resolve)(childPath);
|
|
7676
|
+
const resolvedParent = (0, import_path8.resolve)(parentPath);
|
|
7601
7677
|
if (resolvedChild === resolvedParent) {
|
|
7602
7678
|
return true;
|
|
7603
7679
|
}
|
|
7604
|
-
return resolvedChild.startsWith(resolvedParent +
|
|
7680
|
+
return resolvedChild.startsWith(resolvedParent + import_path8.sep);
|
|
7605
7681
|
}
|
|
7606
7682
|
|
|
7607
7683
|
// src/skills/target-config.ts
|
|
@@ -7786,20 +7862,20 @@ Uninstalling uloop skills (${location})...`);
|
|
|
7786
7862
|
}
|
|
7787
7863
|
|
|
7788
7864
|
// src/commands/launch.ts
|
|
7789
|
-
var
|
|
7865
|
+
var import_path9 = require("path");
|
|
7790
7866
|
|
|
7791
7867
|
// node_modules/launch-unity/dist/lib.js
|
|
7792
7868
|
var import_node_child_process = require("node:child_process");
|
|
7793
7869
|
var import_node_fs2 = require("node:fs");
|
|
7794
|
-
var
|
|
7870
|
+
var import_promises4 = require("node:fs/promises");
|
|
7795
7871
|
var import_node_path2 = require("node:path");
|
|
7796
7872
|
var import_node_util = require("node:util");
|
|
7797
7873
|
|
|
7798
7874
|
// node_modules/launch-unity/dist/unityHub.js
|
|
7799
|
-
var
|
|
7875
|
+
var import_promises3 = require("node:fs/promises");
|
|
7800
7876
|
var import_node_fs = require("node:fs");
|
|
7801
7877
|
var import_node_path = require("node:path");
|
|
7802
|
-
var
|
|
7878
|
+
var import_node_assert3 = __toESM(require("node:assert"), 1);
|
|
7803
7879
|
var resolveUnityHubProjectFiles = () => {
|
|
7804
7880
|
if (process.platform === "darwin") {
|
|
7805
7881
|
const home = process.env.HOME;
|
|
@@ -7826,7 +7902,7 @@ var removeTrailingSeparators = (target) => {
|
|
|
7826
7902
|
}
|
|
7827
7903
|
return trimmed;
|
|
7828
7904
|
};
|
|
7829
|
-
var
|
|
7905
|
+
var normalizePath2 = (target) => {
|
|
7830
7906
|
const resolvedPath = (0, import_node_path.resolve)(target);
|
|
7831
7907
|
return removeTrailingSeparators(resolvedPath);
|
|
7832
7908
|
};
|
|
@@ -7834,14 +7910,14 @@ var resolvePathWithActualCase = (target) => {
|
|
|
7834
7910
|
try {
|
|
7835
7911
|
return removeTrailingSeparators(import_node_fs.realpathSync.native(target));
|
|
7836
7912
|
} catch {
|
|
7837
|
-
return
|
|
7913
|
+
return normalizePath2(target);
|
|
7838
7914
|
}
|
|
7839
7915
|
};
|
|
7840
7916
|
var toComparablePath = (value) => {
|
|
7841
7917
|
return value.replace(/\\/g, "/").toLocaleLowerCase();
|
|
7842
7918
|
};
|
|
7843
7919
|
var pathsEqual = (left, right) => {
|
|
7844
|
-
return toComparablePath(
|
|
7920
|
+
return toComparablePath(normalizePath2(left)) === toComparablePath(normalizePath2(right));
|
|
7845
7921
|
};
|
|
7846
7922
|
var safeParseProjectsJson = (content) => {
|
|
7847
7923
|
try {
|
|
@@ -7866,7 +7942,7 @@ var ensureProjectEntryAndUpdate = async (projectPath, version, when, setFavorite
|
|
|
7866
7942
|
}
|
|
7867
7943
|
for (const path of candidates) {
|
|
7868
7944
|
logDebug(`Trying Unity Hub file: ${path}`);
|
|
7869
|
-
const content = await (0,
|
|
7945
|
+
const content = await (0, import_promises3.readFile)(path, "utf8").catch(() => void 0);
|
|
7870
7946
|
if (!content) {
|
|
7871
7947
|
logDebug("Read failed or empty content, skipping.");
|
|
7872
7948
|
continue;
|
|
@@ -7901,7 +7977,7 @@ var ensureProjectEntryAndUpdate = async (projectPath, version, when, setFavorite
|
|
|
7901
7977
|
}
|
|
7902
7978
|
};
|
|
7903
7979
|
try {
|
|
7904
|
-
await (0,
|
|
7980
|
+
await (0, import_promises3.writeFile)(path, JSON.stringify(updatedJson, void 0, 2), "utf8");
|
|
7905
7981
|
logDebug("Write succeeded.");
|
|
7906
7982
|
} catch (error) {
|
|
7907
7983
|
logDebug(`Write failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -7918,7 +7994,7 @@ var updateLastModifiedIfExists = async (projectPath, when) => {
|
|
|
7918
7994
|
let content;
|
|
7919
7995
|
let json;
|
|
7920
7996
|
try {
|
|
7921
|
-
content = await (0,
|
|
7997
|
+
content = await (0, import_promises3.readFile)(path, "utf8");
|
|
7922
7998
|
} catch {
|
|
7923
7999
|
continue;
|
|
7924
8000
|
}
|
|
@@ -7946,7 +8022,7 @@ var updateLastModifiedIfExists = async (projectPath, when) => {
|
|
|
7946
8022
|
lastModified: when.getTime()
|
|
7947
8023
|
};
|
|
7948
8024
|
try {
|
|
7949
|
-
await (0,
|
|
8025
|
+
await (0, import_promises3.writeFile)(path, JSON.stringify(json, void 0, 2), "utf8");
|
|
7950
8026
|
} catch {
|
|
7951
8027
|
}
|
|
7952
8028
|
return;
|
|
@@ -7970,7 +8046,7 @@ var resolveUnityHubProjectsInfoFile = () => {
|
|
|
7970
8046
|
return void 0;
|
|
7971
8047
|
};
|
|
7972
8048
|
var parseCliArgs = (cliArgsString) => {
|
|
7973
|
-
(0,
|
|
8049
|
+
(0, import_node_assert3.default)(cliArgsString !== null && cliArgsString !== void 0, "cliArgsString must not be null");
|
|
7974
8050
|
const trimmed = cliArgsString.trim();
|
|
7975
8051
|
if (trimmed.length === 0) {
|
|
7976
8052
|
return [];
|
|
@@ -8026,7 +8102,7 @@ var groupCliArgs = (args) => {
|
|
|
8026
8102
|
return groups;
|
|
8027
8103
|
};
|
|
8028
8104
|
var getProjectCliArgs = async (projectPath) => {
|
|
8029
|
-
(0,
|
|
8105
|
+
(0, import_node_assert3.default)(projectPath !== null && projectPath !== void 0, "projectPath must not be null");
|
|
8030
8106
|
const infoFilePath = resolveUnityHubProjectsInfoFile();
|
|
8031
8107
|
if (!infoFilePath) {
|
|
8032
8108
|
logDebug("projectsInfo.json path could not be resolved.");
|
|
@@ -8035,7 +8111,7 @@ var getProjectCliArgs = async (projectPath) => {
|
|
|
8035
8111
|
logDebug(`Reading projectsInfo.json: ${infoFilePath}`);
|
|
8036
8112
|
let content;
|
|
8037
8113
|
try {
|
|
8038
|
-
content = await (0,
|
|
8114
|
+
content = await (0, import_promises3.readFile)(infoFilePath, "utf8");
|
|
8039
8115
|
} catch {
|
|
8040
8116
|
logDebug("projectsInfo.json not found or not readable.");
|
|
8041
8117
|
return [];
|
|
@@ -8047,7 +8123,7 @@ var getProjectCliArgs = async (projectPath) => {
|
|
|
8047
8123
|
logDebug("projectsInfo.json parse failed.");
|
|
8048
8124
|
return [];
|
|
8049
8125
|
}
|
|
8050
|
-
const normalizedProjectPath =
|
|
8126
|
+
const normalizedProjectPath = normalizePath2(projectPath);
|
|
8051
8127
|
const projectKey = Object.keys(json).find((key) => pathsEqual(key, normalizedProjectPath));
|
|
8052
8128
|
if (!projectKey) {
|
|
8053
8129
|
logDebug(`No entry found for project: ${normalizedProjectPath}`);
|
|
@@ -8126,7 +8202,7 @@ var removeTrailingSeparators2 = (target) => {
|
|
|
8126
8202
|
}
|
|
8127
8203
|
return trimmed;
|
|
8128
8204
|
};
|
|
8129
|
-
var
|
|
8205
|
+
var normalizePath3 = (target) => {
|
|
8130
8206
|
const resolvedPath = (0, import_node_path2.resolve)(target);
|
|
8131
8207
|
const trimmed = removeTrailingSeparators2(resolvedPath);
|
|
8132
8208
|
return trimmed;
|
|
@@ -8135,7 +8211,7 @@ var toComparablePath2 = (value) => {
|
|
|
8135
8211
|
return value.replace(/\\/g, "/").toLocaleLowerCase();
|
|
8136
8212
|
};
|
|
8137
8213
|
var pathsEqual2 = (left, right) => {
|
|
8138
|
-
return toComparablePath2(
|
|
8214
|
+
return toComparablePath2(normalizePath3(left)) === toComparablePath2(normalizePath3(right));
|
|
8139
8215
|
};
|
|
8140
8216
|
function extractProjectPath(command) {
|
|
8141
8217
|
const match = command.match(PROJECT_PATH_PATTERN);
|
|
@@ -8196,7 +8272,7 @@ async function listUnityProcessesMac() {
|
|
|
8196
8272
|
}
|
|
8197
8273
|
processes.push({
|
|
8198
8274
|
pid: pidValue,
|
|
8199
|
-
projectPath:
|
|
8275
|
+
projectPath: normalizePath3(projectArgument)
|
|
8200
8276
|
});
|
|
8201
8277
|
}
|
|
8202
8278
|
return processes;
|
|
@@ -8244,7 +8320,7 @@ async function listUnityProcessesWindows() {
|
|
|
8244
8320
|
}
|
|
8245
8321
|
processes.push({
|
|
8246
8322
|
pid: pidValue,
|
|
8247
|
-
projectPath:
|
|
8323
|
+
projectPath: normalizePath3(projectArgument)
|
|
8248
8324
|
});
|
|
8249
8325
|
}
|
|
8250
8326
|
return processes;
|
|
@@ -8259,7 +8335,7 @@ async function listUnityProcesses() {
|
|
|
8259
8335
|
return [];
|
|
8260
8336
|
}
|
|
8261
8337
|
async function findRunningUnityProcess(projectPath) {
|
|
8262
|
-
const normalizedTarget =
|
|
8338
|
+
const normalizedTarget = normalizePath3(projectPath);
|
|
8263
8339
|
const processes = await listUnityProcesses();
|
|
8264
8340
|
return processes.find((candidate) => pathsEqual2(candidate.projectPath, normalizedTarget));
|
|
8265
8341
|
}
|
|
@@ -8360,14 +8436,14 @@ async function handleStaleLockfile(projectPath) {
|
|
|
8360
8436
|
console.log(`UnityLockfile found without active Unity process: ${lockfilePath}`);
|
|
8361
8437
|
console.log("Assuming previous crash. Cleaning Temp directory and continuing launch.");
|
|
8362
8438
|
try {
|
|
8363
|
-
await (0,
|
|
8439
|
+
await (0, import_promises4.rm)(tempDirectoryPath, { recursive: true, force: true });
|
|
8364
8440
|
console.log("Deleted Temp directory.");
|
|
8365
8441
|
} catch (error) {
|
|
8366
8442
|
const message = error instanceof Error ? error.message : String(error);
|
|
8367
8443
|
console.warn(`Failed to delete Temp directory: ${message}`);
|
|
8368
8444
|
}
|
|
8369
8445
|
try {
|
|
8370
|
-
await (0,
|
|
8446
|
+
await (0, import_promises4.rm)(lockfilePath, { force: true });
|
|
8371
8447
|
console.log("Deleted UnityLockfile.");
|
|
8372
8448
|
} catch (error) {
|
|
8373
8449
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -8382,7 +8458,7 @@ async function deleteRecoveryDirectory(projectPath) {
|
|
|
8382
8458
|
}
|
|
8383
8459
|
console.log(`Deleting recovery directory: ${recoveryPath}`);
|
|
8384
8460
|
try {
|
|
8385
|
-
await (0,
|
|
8461
|
+
await (0, import_promises4.rm)(recoveryPath, { recursive: true, force: true });
|
|
8386
8462
|
console.log("Deleted recovery directory.");
|
|
8387
8463
|
} catch (error) {
|
|
8388
8464
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -8537,7 +8613,7 @@ function findUnityProjectBfs(rootDir, maxDepth) {
|
|
|
8537
8613
|
rootCanonical = rootDir;
|
|
8538
8614
|
}
|
|
8539
8615
|
queue.push({ dir: rootCanonical, depth: 0 });
|
|
8540
|
-
const visited = /* @__PURE__ */ new Set([toComparablePath2(
|
|
8616
|
+
const visited = /* @__PURE__ */ new Set([toComparablePath2(normalizePath3(rootCanonical))]);
|
|
8541
8617
|
while (queue.length > 0) {
|
|
8542
8618
|
const current = queue.shift();
|
|
8543
8619
|
if (!current) {
|
|
@@ -8545,7 +8621,7 @@ function findUnityProjectBfs(rootDir, maxDepth) {
|
|
|
8545
8621
|
}
|
|
8546
8622
|
const { dir, depth } = current;
|
|
8547
8623
|
if (isUnityProjectRoot(dir)) {
|
|
8548
|
-
return
|
|
8624
|
+
return normalizePath3(dir);
|
|
8549
8625
|
}
|
|
8550
8626
|
const canDescend = maxDepth === -1 || depth < maxDepth;
|
|
8551
8627
|
if (!canDescend) {
|
|
@@ -8566,7 +8642,7 @@ function findUnityProjectBfs(rootDir, maxDepth) {
|
|
|
8566
8642
|
} catch {
|
|
8567
8643
|
continue;
|
|
8568
8644
|
}
|
|
8569
|
-
const key = toComparablePath2(
|
|
8645
|
+
const key = toComparablePath2(normalizePath3(childCanonical));
|
|
8570
8646
|
if (visited.has(key)) {
|
|
8571
8647
|
continue;
|
|
8572
8648
|
}
|
|
@@ -8724,7 +8800,7 @@ function parseMaxDepth(value) {
|
|
|
8724
8800
|
async function runLaunchCommand(projectPath, options) {
|
|
8725
8801
|
const maxDepth = parseMaxDepth(options.maxDepth);
|
|
8726
8802
|
await orchestrateLaunch({
|
|
8727
|
-
projectPath: projectPath ? (0,
|
|
8803
|
+
projectPath: projectPath ? (0, import_path9.resolve)(projectPath) : void 0,
|
|
8728
8804
|
searchRoot: process.cwd(),
|
|
8729
8805
|
searchMaxDepth: maxDepth,
|
|
8730
8806
|
platform: options.platform,
|
|
@@ -9056,6 +9132,26 @@ async function runWithErrorHandling(fn) {
|
|
|
9056
9132
|
try {
|
|
9057
9133
|
await fn();
|
|
9058
9134
|
} catch (error) {
|
|
9135
|
+
if (error instanceof UnityNotRunningError) {
|
|
9136
|
+
console.error("\x1B[31mError: Unity Editor for this project is not running.\x1B[0m");
|
|
9137
|
+
console.error("");
|
|
9138
|
+
console.error(` Project: ${error.projectRoot}`);
|
|
9139
|
+
console.error("");
|
|
9140
|
+
console.error("Start the Unity Editor for this project and try again.");
|
|
9141
|
+
process.exit(1);
|
|
9142
|
+
}
|
|
9143
|
+
if (error instanceof ProjectMismatchError) {
|
|
9144
|
+
console.error("\x1B[31mError: Unity Editor for this project is not running.\x1B[0m");
|
|
9145
|
+
console.error("");
|
|
9146
|
+
console.error(` Project: ${error.expectedProjectRoot}`);
|
|
9147
|
+
console.error(` Connected to: ${error.connectedProjectRoot}`);
|
|
9148
|
+
console.error("");
|
|
9149
|
+
console.error("Another Unity instance was found, but it belongs to a different project.");
|
|
9150
|
+
console.error(
|
|
9151
|
+
"Start the Unity Editor for this project, or use --port to specify the target."
|
|
9152
|
+
);
|
|
9153
|
+
process.exit(1);
|
|
9154
|
+
}
|
|
9059
9155
|
const message = error instanceof Error ? error.message : String(error);
|
|
9060
9156
|
if (message === "UNITY_COMPILING") {
|
|
9061
9157
|
console.error("\x1B[33m\u23F3 Unity is compiling scripts.\x1B[0m");
|
|
@@ -9100,7 +9196,7 @@ async function runWithErrorHandling(fn) {
|
|
|
9100
9196
|
}
|
|
9101
9197
|
function detectShell() {
|
|
9102
9198
|
const shell = process.env["SHELL"] || "";
|
|
9103
|
-
const shellName = (0,
|
|
9199
|
+
const shellName = (0, import_path10.basename)(shell).replace(/\.exe$/i, "");
|
|
9104
9200
|
if (shellName === "zsh") {
|
|
9105
9201
|
return "zsh";
|
|
9106
9202
|
}
|
|
@@ -9115,12 +9211,12 @@ function detectShell() {
|
|
|
9115
9211
|
function getShellConfigPath(shell) {
|
|
9116
9212
|
const home = (0, import_os2.homedir)();
|
|
9117
9213
|
if (shell === "zsh") {
|
|
9118
|
-
return (0,
|
|
9214
|
+
return (0, import_path10.join)(home, ".zshrc");
|
|
9119
9215
|
}
|
|
9120
9216
|
if (shell === "powershell") {
|
|
9121
|
-
return (0,
|
|
9217
|
+
return (0, import_path10.join)(home, "Documents", "WindowsPowerShell", "Microsoft.PowerShell_profile.ps1");
|
|
9122
9218
|
}
|
|
9123
|
-
return (0,
|
|
9219
|
+
return (0, import_path10.join)(home, ".bashrc");
|
|
9124
9220
|
}
|
|
9125
9221
|
function getCompletionScript(shell) {
|
|
9126
9222
|
if (shell === "bash") {
|
|
@@ -9257,10 +9353,10 @@ function cleanupLockFiles(projectPath) {
|
|
|
9257
9353
|
console.error("Could not find Unity project root.");
|
|
9258
9354
|
process.exit(1);
|
|
9259
9355
|
}
|
|
9260
|
-
const tempDir = (0,
|
|
9356
|
+
const tempDir = (0, import_path10.join)(projectRoot, "Temp");
|
|
9261
9357
|
let cleaned = 0;
|
|
9262
9358
|
for (const lockFile of LOCK_FILES) {
|
|
9263
|
-
const lockPath = (0,
|
|
9359
|
+
const lockPath = (0, import_path10.join)(tempDir, lockFile);
|
|
9264
9360
|
if ((0, import_fs8.existsSync)(lockPath)) {
|
|
9265
9361
|
(0, import_fs8.unlinkSync)(lockPath);
|
|
9266
9362
|
console.log(`Removed: ${lockFile}`);
|
|
@@ -9297,7 +9393,7 @@ function handleCompletion(install, shellOverride) {
|
|
|
9297
9393
|
return;
|
|
9298
9394
|
}
|
|
9299
9395
|
const configPath = getShellConfigPath(shell);
|
|
9300
|
-
const configDir = (0,
|
|
9396
|
+
const configDir = (0, import_path10.dirname)(configPath);
|
|
9301
9397
|
if (!(0, import_fs8.existsSync)(configDir)) {
|
|
9302
9398
|
(0, import_fs8.mkdirSync)(configDir, { recursive: true });
|
|
9303
9399
|
}
|