uloop-cli 0.62.3 → 0.63.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.
@@ -5783,7 +5783,7 @@ var import_path3 = require("path");
5783
5783
 
5784
5784
  // src/default-tools.json
5785
5785
  var default_tools_default = {
5786
- version: "0.62.3",
5786
+ version: "0.63.0",
5787
5787
  tools: [
5788
5788
  {
5789
5789
  name: "compile",
@@ -6227,7 +6227,7 @@ function getCachedServerVersion() {
6227
6227
  }
6228
6228
 
6229
6229
  // src/version.ts
6230
- var VERSION = "0.62.3";
6230
+ var VERSION = "0.63.0";
6231
6231
 
6232
6232
  // src/spinner.ts
6233
6233
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -7545,7 +7545,7 @@ var getProjectCliArgs = async (projectPath) => {
7545
7545
  var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
7546
7546
  var UNITY_EXECUTABLE_PATTERN_MAC = /Unity\.app\/Contents\/MacOS\/Unity/i;
7547
7547
  var UNITY_EXECUTABLE_PATTERN_WINDOWS = /Unity\.exe/i;
7548
- var PROJECT_PATH_PATTERN = /-(?:projectPath|projectpath)(?:=|\s+)("[^"]+"|'[^']+'|[^\s"']+)/i;
7548
+ var PROJECT_PATH_PATTERN = /-(?:projectPath|projectpath)(?:=|\s+)("[^"]+"|'[^']+'|.+?)(?=\s+-[a-zA-Z]|$)/i;
7549
7549
  var PROCESS_LIST_COMMAND_MAC = "ps";
7550
7550
  var PROCESS_LIST_ARGS_MAC = ["-axo", "pid=,command=", "-ww"];
7551
7551
  var WINDOWS_POWERSHELL = "powershell";
@@ -7785,12 +7785,53 @@ async function focusUnityProcessWindows(pid) {
7785
7785
  console.warn(`Failed to bring Unity to front on Windows: ${message}`);
7786
7786
  }
7787
7787
  }
7788
+ async function isLockfileHeldMac(lockfilePath) {
7789
+ try {
7790
+ const result = await execFileAsync("lsof", [lockfilePath]);
7791
+ const lines = result.stdout.split("\n").filter((line) => line.length > 0);
7792
+ return lines.length > 1;
7793
+ } catch {
7794
+ return false;
7795
+ }
7796
+ }
7797
+ async function isLockfileHeldWindows(lockfilePath) {
7798
+ const escapedPath = lockfilePath.replace(/'/g, "''");
7799
+ const scriptLines = [
7800
+ "try {",
7801
+ ` $f = [System.IO.File]::Open('${escapedPath}', [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None)`,
7802
+ " $f.Close()",
7803
+ " Write-Output 'UNLOCKED'",
7804
+ "} catch [System.IO.IOException] {",
7805
+ " Write-Output 'LOCKED'",
7806
+ "} catch {",
7807
+ " Write-Output 'UNLOCKED'",
7808
+ "}"
7809
+ ];
7810
+ try {
7811
+ const result = await execFileAsync(WINDOWS_POWERSHELL, ["-NoProfile", "-Command", scriptLines.join("\n")]);
7812
+ return result.stdout.trim() === "LOCKED";
7813
+ } catch {
7814
+ return false;
7815
+ }
7816
+ }
7817
+ async function isLockfileHeld(lockfilePath) {
7818
+ if (process.platform === "darwin") {
7819
+ return await isLockfileHeldMac(lockfilePath);
7820
+ }
7821
+ if (process.platform === "win32") {
7822
+ return await isLockfileHeldWindows(lockfilePath);
7823
+ }
7824
+ return false;
7825
+ }
7788
7826
  async function handleStaleLockfile(projectPath) {
7789
7827
  const tempDirectoryPath = (0, import_node_path2.join)(projectPath, TEMP_DIRECTORY_NAME);
7790
7828
  const lockfilePath = (0, import_node_path2.join)(tempDirectoryPath, UNITY_LOCKFILE_NAME);
7791
7829
  if (!(0, import_node_fs2.existsSync)(lockfilePath)) {
7792
7830
  return;
7793
7831
  }
7832
+ if (await isLockfileHeld(lockfilePath)) {
7833
+ throw new Error(`Unity appears to be running for this project (lockfile is held: ${lockfilePath}). Use -r to restart or -q to quit the running instance.`);
7834
+ }
7794
7835
  console.log(`UnityLockfile found without active Unity process: ${lockfilePath}`);
7795
7836
  console.log("Assuming previous crash. Cleaning Temp directory and continuing launch.");
7796
7837
  try {
@@ -7809,6 +7850,8 @@ async function handleStaleLockfile(projectPath) {
7809
7850
  }
7810
7851
  console.log();
7811
7852
  }
7853
+ var LOCKFILE_POLL_INTERVAL_MS = 100;
7854
+ var LOCKFILE_WAIT_TIMEOUT_MS = 5e3;
7812
7855
  var KILL_POLL_INTERVAL_MS = 100;
7813
7856
  var KILL_TIMEOUT_MS = 1e4;
7814
7857
  var GRACEFUL_QUIT_TIMEOUT_MS = 1e4;
@@ -7994,6 +8037,17 @@ function findUnityProjectBfs(rootDir, maxDepth) {
7994
8037
  }
7995
8038
  return void 0;
7996
8039
  }
8040
+ async function waitForLockfile(projectPath) {
8041
+ const lockfilePath = (0, import_node_path2.join)(projectPath, TEMP_DIRECTORY_NAME, UNITY_LOCKFILE_NAME);
8042
+ const start = Date.now();
8043
+ while (Date.now() - start < LOCKFILE_WAIT_TIMEOUT_MS) {
8044
+ if ((0, import_node_fs2.existsSync)(lockfilePath)) {
8045
+ return;
8046
+ }
8047
+ await new Promise((resolve5) => setTimeout(resolve5, LOCKFILE_POLL_INTERVAL_MS));
8048
+ }
8049
+ console.warn("Unity launched, but UnityLockfile was not detected within 5s.");
8050
+ }
7997
8051
  async function launch(opts) {
7998
8052
  const { projectPath, platform, unityArgs, unityVersion } = opts;
7999
8053
  const unityPath = getUnityPath(unityVersion);
@@ -8094,6 +8148,7 @@ async function orchestrateLaunch(options) {
8094
8148
  unityVersion
8095
8149
  };
8096
8150
  await launch(resolved);
8151
+ await waitForLockfile(resolvedProjectPath);
8097
8152
  const now = /* @__PURE__ */ new Date();
8098
8153
  try {
8099
8154
  await updateLastModifiedIfExists(resolvedProjectPath, now);
@@ -8184,11 +8239,13 @@ function registerFocusWindowCommand(program3) {
8184
8239
 
8185
8240
  // src/cli.ts
8186
8241
  var LAUNCH_COMMAND = "launch";
8242
+ var UPDATE_COMMAND = "update";
8243
+ var NO_SYNC_FLAGS = ["-v", "--version", "-h", "--help"];
8187
8244
  var BUILTIN_COMMANDS = [
8188
8245
  "list",
8189
8246
  "sync",
8190
8247
  "completion",
8191
- "update",
8248
+ UPDATE_COMMAND,
8192
8249
  "fix",
8193
8250
  "skills",
8194
8251
  LAUNCH_COMMAND,
@@ -8697,13 +8754,19 @@ function commandExists(cmdName) {
8697
8754
  const tools = loadToolsCache();
8698
8755
  return tools.tools.some((t) => t.name === cmdName);
8699
8756
  }
8757
+ function shouldSkipAutoSync(cmdName, args) {
8758
+ if (cmdName === LAUNCH_COMMAND || cmdName === UPDATE_COMMAND) {
8759
+ return true;
8760
+ }
8761
+ return args.some((arg) => NO_SYNC_FLAGS.includes(arg));
8762
+ }
8700
8763
  async function main() {
8701
8764
  if (handleCompletionOptions()) {
8702
8765
  return;
8703
8766
  }
8704
8767
  const args = process.argv.slice(2);
8705
8768
  const cmdName = args.find((arg) => !arg.startsWith("-"));
8706
- if (cmdName !== LAUNCH_COMMAND) {
8769
+ if (!shouldSkipAutoSync(cmdName, args)) {
8707
8770
  const cachedVersion = loadToolsCache().version;
8708
8771
  if (hasCacheFile() && cachedVersion !== VERSION) {
8709
8772
  console.log(