@getmonoceros/workbench 1.24.0 → 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
@@ -2518,7 +2518,13 @@ async function writeOpencodeConfig(targetDir, containerName2, features) {
2518
2518
  if (typeof config.permission !== "string") {
2519
2519
  const permission = typeof config.permission === "object" && config.permission !== null ? config.permission : {};
2520
2520
  const ext = typeof permission.external_directory === "object" && permission.external_directory !== null ? permission.external_directory : {};
2521
- ext[`${workspaceRoot}/projects/*`] = "allow";
2521
+ for (const p of [
2522
+ `${workspaceRoot}/projects/*`,
2523
+ `${workspaceRoot}/${containerName2}.code-workspace`,
2524
+ `${workspaceRoot}/logs/*`
2525
+ ]) {
2526
+ ext[p] = "allow";
2527
+ }
2522
2528
  permission.external_directory = ext;
2523
2529
  config.permission = permission;
2524
2530
  }
@@ -7227,7 +7233,7 @@ var CLI_VERSION;
7227
7233
  var init_version = __esm({
7228
7234
  "src/version.ts"() {
7229
7235
  "use strict";
7230
- CLI_VERSION = true ? "1.24.0" : "dev";
7236
+ CLI_VERSION = true ? "1.24.2" : "dev";
7231
7237
  }
7232
7238
  });
7233
7239
 
@@ -9604,6 +9610,24 @@ function nextRelayUrl(content, lastOpened) {
9604
9610
  const url = content.trim();
9605
9611
  return url && url !== lastOpened ? url : null;
9606
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
+ }
9607
9631
  function openInBrowser(url) {
9608
9632
  const platform = process.platform;
9609
9633
  const [cmd, args] = platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
@@ -9749,17 +9773,28 @@ async function runShell(opts) {
9749
9773
  { quiet: true }
9750
9774
  );
9751
9775
  if (upCode !== 0) return upCode;
9752
- return spawnFn(
9753
- [
9754
- "exec",
9755
- "--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
+ ],
9756
9792
  opts.root,
9757
- "--mount-workspace-git-root=false",
9758
- "bash"
9759
- ],
9760
- opts.root,
9761
- { interactive: true }
9762
- );
9793
+ { interactive: true }
9794
+ );
9795
+ } finally {
9796
+ if (bridge) await bridge.dispose();
9797
+ }
9763
9798
  }
9764
9799
  function assertContainerExists(root) {
9765
9800
  if (!existsSync17(path26.join(root, ".devcontainer"))) {
@@ -9771,29 +9806,12 @@ function assertContainerExists(root) {
9771
9806
  var init_shell = __esm({
9772
9807
  "src/devcontainer/shell.ts"() {
9773
9808
  "use strict";
9809
+ init_browser_bridge();
9774
9810
  init_cli();
9775
9811
  }
9776
9812
  });
9777
9813
 
9778
9814
  // src/devcontainer/run.ts
9779
- function wrapExec(command, opts) {
9780
- const leading = [];
9781
- const stmts = [];
9782
- if (opts.pathPrepend) {
9783
- leading.push(opts.pathPrepend);
9784
- const i = leading.length;
9785
- stmts.push(`export PATH="$${i}:$PATH"`);
9786
- stmts.push(`export BROWSER="$${i}/xdg-open"`);
9787
- }
9788
- if (opts.cwd) {
9789
- leading.push(opts.cwd);
9790
- stmts.push(`cd -- "$${leading.length}"`);
9791
- }
9792
- if (leading.length === 0) return command;
9793
- const shift = leading.length === 1 ? "shift" : `shift ${leading.length}`;
9794
- const script = `${stmts.join(" && ")} && ${shift} && exec "$@"`;
9795
- return ["bash", "-lc", script, "bash", ...leading, ...command];
9796
- }
9797
9815
  async function runInContainer(opts) {
9798
9816
  if (opts.command.length === 0) {
9799
9817
  throw new Error(
@@ -9926,7 +9944,10 @@ var init_shell2 = __esm({
9926
9944
  },
9927
9945
  async run({ args }) {
9928
9946
  try {
9929
- const exitCode = await runShell({ root: containerDir(args.name) });
9947
+ const exitCode = await runShell({
9948
+ root: containerDir(args.name),
9949
+ name: args.name
9950
+ });
9930
9951
  process.exit(exitCode);
9931
9952
  } catch (err) {
9932
9953
  consola30.error(err instanceof Error ? err.message : String(err));