@getmonoceros/workbench 1.29.0 → 1.29.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/bin.js CHANGED
@@ -5288,7 +5288,7 @@ function runCapture(cmd, args) {
5288
5288
  child.on("exit", (code) => resolve({ stdout, exitCode: code ?? 0 }));
5289
5289
  });
5290
5290
  }
5291
- function realIsWsl() {
5291
+ function isWsl() {
5292
5292
  try {
5293
5293
  if (process.env.WSL_DISTRO_NAME) return true;
5294
5294
  const rel = readFileSync4(
@@ -5300,7 +5300,7 @@ function realIsWsl() {
5300
5300
  return false;
5301
5301
  }
5302
5302
  }
5303
- async function realResolveWindowsProfile() {
5303
+ async function resolveWindowsProfile() {
5304
5304
  try {
5305
5305
  const r = await runCapture("cmd.exe", ["/c", "echo %USERPROFILE%"]);
5306
5306
  const homeWin = r.stdout.replace(/\r/g, "").trim();
@@ -5326,8 +5326,8 @@ async function realLockWindowsKey(winKeyPath, user) {
5326
5326
  }
5327
5327
  function resolveWindowsDeps(d) {
5328
5328
  return {
5329
- isWsl: d?.isWsl ?? realIsWsl,
5330
- resolveProfile: d?.resolveProfile ?? realResolveWindowsProfile,
5329
+ isWsl: d?.isWsl ?? isWsl,
5330
+ resolveProfile: d?.resolveProfile ?? resolveWindowsProfile,
5331
5331
  lockKey: d?.lockKey ?? realLockWindowsKey
5332
5332
  };
5333
5333
  }
@@ -7978,11 +7978,23 @@ function resolveOnPath(bin) {
7978
7978
  }
7979
7979
  return null;
7980
7980
  }
7981
- function resolveEditorBinary(tool) {
7981
+ async function resolveEditorBinary(tool) {
7982
7982
  if (resolveOnPath(tool.bin)) return tool.bin;
7983
7983
  if (process.platform === "darwin" && existsSync13(tool.macAppBin)) {
7984
7984
  return tool.macAppBin;
7985
7985
  }
7986
+ if (isWsl()) {
7987
+ const candidates = [`/mnt/c/Program Files/${tool.winInstallSubpath}`];
7988
+ const profile = await resolveWindowsProfile();
7989
+ if (profile) {
7990
+ candidates.push(
7991
+ `${profile.homeWsl}/AppData/Local/Programs/${tool.winInstallSubpath}`
7992
+ );
7993
+ }
7994
+ for (const candidate of candidates) {
7995
+ if (existsSync13(candidate)) return candidate;
7996
+ }
7997
+ }
7986
7998
  return null;
7987
7999
  }
7988
8000
  function realLaunch(bin, args) {
@@ -8024,7 +8036,7 @@ async function runOpen(opts) {
8024
8036
  );
8025
8037
  }
8026
8038
  const resolve = opts.binResolver ?? resolveEditorBinary;
8027
- const bin = resolve(editor);
8039
+ const bin = await resolve(editor);
8028
8040
  if (!bin) {
8029
8041
  const where = process.platform === "darwin" ? " on PATH or in /Applications" : " on PATH";
8030
8042
  throw new Error(
@@ -8050,12 +8062,14 @@ var init_open = __esm({
8050
8062
  label: "VS Code",
8051
8063
  bin: "code",
8052
8064
  macAppBin: "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code",
8053
- setupHint: `install the Remote-SSH extension and run "Shell Command: Install 'code' command in PATH"`
8065
+ winInstallSubpath: "Microsoft VS Code/bin/code",
8066
+ setupHint: `install the Remote-SSH extension; on macOS also run "Shell Command: Install 'code' command in PATH"`
8054
8067
  },
8055
8068
  codium: {
8056
8069
  label: "VS Codium",
8057
8070
  bin: "codium",
8058
8071
  macAppBin: "/Applications/VSCodium.app/Contents/Resources/app/bin/codium",
8072
+ winInstallSubpath: "VSCodium/bin/codium",
8059
8073
  setupHint: 'install the "Open Remote - SSH" extension (the codium CLI ships with the app)'
8060
8074
  }
8061
8075
  };
@@ -8068,7 +8082,7 @@ var CLI_VERSION;
8068
8082
  var init_version = __esm({
8069
8083
  "src/version.ts"() {
8070
8084
  "use strict";
8071
- CLI_VERSION = true ? "1.29.0" : "dev";
8085
+ CLI_VERSION = true ? "1.29.1" : "dev";
8072
8086
  }
8073
8087
  });
8074
8088