@getmonoceros/workbench 1.29.0 → 1.29.2

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
  }
@@ -5400,7 +5400,9 @@ async function setupWindowsBridge(name, hostAlias, privateKey, deps, logger) {
5400
5400
  }
5401
5401
  const monoDir = path13.join(profile.homeWsl, ".ssh", "monoceros");
5402
5402
  await fs10.mkdir(monoDir, { recursive: true });
5403
- await fs10.copyFile(privateKey, path13.join(monoDir, name));
5403
+ const keyDst = path13.join(monoDir, name);
5404
+ await fs10.rm(keyDst, { force: true });
5405
+ await fs10.copyFile(privateKey, keyDst);
5404
5406
  const keyWin = `${profile.homeWin}\\.ssh\\monoceros\\${name}`;
5405
5407
  await upsertMarkedBlock(
5406
5408
  path13.join(profile.homeWsl, ".ssh", "config"),
@@ -7978,11 +7980,23 @@ function resolveOnPath(bin) {
7978
7980
  }
7979
7981
  return null;
7980
7982
  }
7981
- function resolveEditorBinary(tool) {
7983
+ async function resolveEditorBinary(tool) {
7982
7984
  if (resolveOnPath(tool.bin)) return tool.bin;
7983
7985
  if (process.platform === "darwin" && existsSync13(tool.macAppBin)) {
7984
7986
  return tool.macAppBin;
7985
7987
  }
7988
+ if (isWsl()) {
7989
+ const candidates = [`/mnt/c/Program Files/${tool.winInstallSubpath}`];
7990
+ const profile = await resolveWindowsProfile();
7991
+ if (profile) {
7992
+ candidates.push(
7993
+ `${profile.homeWsl}/AppData/Local/Programs/${tool.winInstallSubpath}`
7994
+ );
7995
+ }
7996
+ for (const candidate of candidates) {
7997
+ if (existsSync13(candidate)) return candidate;
7998
+ }
7999
+ }
7986
8000
  return null;
7987
8001
  }
7988
8002
  function realLaunch(bin, args) {
@@ -8024,7 +8038,7 @@ async function runOpen(opts) {
8024
8038
  );
8025
8039
  }
8026
8040
  const resolve = opts.binResolver ?? resolveEditorBinary;
8027
- const bin = resolve(editor);
8041
+ const bin = await resolve(editor);
8028
8042
  if (!bin) {
8029
8043
  const where = process.platform === "darwin" ? " on PATH or in /Applications" : " on PATH";
8030
8044
  throw new Error(
@@ -8050,12 +8064,14 @@ var init_open = __esm({
8050
8064
  label: "VS Code",
8051
8065
  bin: "code",
8052
8066
  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"`
8067
+ winInstallSubpath: "Microsoft VS Code/bin/code",
8068
+ setupHint: `install the Remote-SSH extension; on macOS also run "Shell Command: Install 'code' command in PATH"`
8054
8069
  },
8055
8070
  codium: {
8056
8071
  label: "VS Codium",
8057
8072
  bin: "codium",
8058
8073
  macAppBin: "/Applications/VSCodium.app/Contents/Resources/app/bin/codium",
8074
+ winInstallSubpath: "VSCodium/bin/codium",
8059
8075
  setupHint: 'install the "Open Remote - SSH" extension (the codium CLI ships with the app)'
8060
8076
  }
8061
8077
  };
@@ -8068,7 +8084,7 @@ var CLI_VERSION;
8068
8084
  var init_version = __esm({
8069
8085
  "src/version.ts"() {
8070
8086
  "use strict";
8071
- CLI_VERSION = true ? "1.29.0" : "dev";
8087
+ CLI_VERSION = true ? "1.29.2" : "dev";
8072
8088
  }
8073
8089
  });
8074
8090