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