@getmonoceros/workbench 1.24.1 → 1.24.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
@@ -7233,7 +7233,7 @@ var CLI_VERSION;
7233
7233
  var init_version = __esm({
7234
7234
  "src/version.ts"() {
7235
7235
  "use strict";
7236
- CLI_VERSION = true ? "1.24.1" : "dev";
7236
+ CLI_VERSION = true ? "1.24.2" : "dev";
7237
7237
  }
7238
7238
  });
7239
7239
 
@@ -9610,6 +9610,24 @@ function nextRelayUrl(content, lastOpened) {
9610
9610
  const url = content.trim();
9611
9611
  return url && url !== lastOpened ? url : null;
9612
9612
  }
9613
+ function wrapExec(command, opts) {
9614
+ const leading = [];
9615
+ const stmts = [];
9616
+ if (opts.pathPrepend) {
9617
+ leading.push(opts.pathPrepend);
9618
+ const i = leading.length;
9619
+ stmts.push(`export PATH="$${i}:$PATH"`);
9620
+ stmts.push(`export BROWSER="$${i}/xdg-open"`);
9621
+ }
9622
+ if (opts.cwd) {
9623
+ leading.push(opts.cwd);
9624
+ stmts.push(`cd -- "$${leading.length}"`);
9625
+ }
9626
+ if (leading.length === 0) return command;
9627
+ const shift = leading.length === 1 ? "shift" : `shift ${leading.length}`;
9628
+ const script = `${stmts.join(" && ")} && ${shift} && exec "$@"`;
9629
+ return ["bash", "-lc", script, "bash", ...leading, ...command];
9630
+ }
9613
9631
  function openInBrowser(url) {
9614
9632
  const platform = process.platform;
9615
9633
  const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
@@ -9755,17 +9773,28 @@ async function runShell(opts) {
9755
9773
  { quiet: true }
9756
9774
  );
9757
9775
  if (upCode !== 0) return upCode;
9758
- return spawnFn(
9759
- [
9760
- "exec",
9761
- "--workspace-folder",
9776
+ const name = opts.name ?? path26.basename(opts.root);
9777
+ const isTty2 = opts.isTty ?? process.stdout.isTTY;
9778
+ const bridge = isTty2 ? await startBrowserBridge({ name, root: opts.root, spawn: spawnFn }) : null;
9779
+ try {
9780
+ const innerExec = wrapExec(
9781
+ ["bash"],
9782
+ bridge ? { pathPrepend: bridge.relayDirInContainer } : {}
9783
+ );
9784
+ return await spawnFn(
9785
+ [
9786
+ "exec",
9787
+ "--workspace-folder",
9788
+ opts.root,
9789
+ "--mount-workspace-git-root=false",
9790
+ ...innerExec
9791
+ ],
9762
9792
  opts.root,
9763
- "--mount-workspace-git-root=false",
9764
- "bash"
9765
- ],
9766
- opts.root,
9767
- { interactive: true }
9768
- );
9793
+ { interactive: true }
9794
+ );
9795
+ } finally {
9796
+ if (bridge) await bridge.dispose();
9797
+ }
9769
9798
  }
9770
9799
  function assertContainerExists(root) {
9771
9800
  if (!existsSync17(path26.join(root, ".devcontainer"))) {
@@ -9777,29 +9806,12 @@ function assertContainerExists(root) {
9777
9806
  var init_shell = __esm({
9778
9807
  "src/devcontainer/shell.ts"() {
9779
9808
  "use strict";
9809
+ init_browser_bridge();
9780
9810
  init_cli();
9781
9811
  }
9782
9812
  });
9783
9813
 
9784
9814
  // src/devcontainer/run.ts
9785
- function wrapExec(command, opts) {
9786
- const leading = [];
9787
- const stmts = [];
9788
- if (opts.pathPrepend) {
9789
- leading.push(opts.pathPrepend);
9790
- const i = leading.length;
9791
- stmts.push(`export PATH="$${i}:$PATH"`);
9792
- stmts.push(`export BROWSER="$${i}/xdg-open"`);
9793
- }
9794
- if (opts.cwd) {
9795
- leading.push(opts.cwd);
9796
- stmts.push(`cd -- "$${leading.length}"`);
9797
- }
9798
- if (leading.length === 0) return command;
9799
- const shift = leading.length === 1 ? "shift" : `shift ${leading.length}`;
9800
- const script = `${stmts.join(" && ")} && ${shift} && exec "$@"`;
9801
- return ["bash", "-lc", script, "bash", ...leading, ...command];
9802
- }
9803
9815
  async function runInContainer(opts) {
9804
9816
  if (opts.command.length === 0) {
9805
9817
  throw new Error(
@@ -9932,7 +9944,10 @@ var init_shell2 = __esm({
9932
9944
  },
9933
9945
  async run({ args }) {
9934
9946
  try {
9935
- const exitCode = await runShell({ root: containerDir(args.name) });
9947
+ const exitCode = await runShell({
9948
+ root: containerDir(args.name),
9949
+ name: args.name
9950
+ });
9936
9951
  process.exit(exitCode);
9937
9952
  } catch (err) {
9938
9953
  consola30.error(err instanceof Error ? err.message : String(err));