@getmonoceros/workbench 1.6.8 → 1.6.10

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
@@ -2697,6 +2697,34 @@ async function detectDockerMode(options = {}) {
2697
2697
  return "rootful";
2698
2698
  }
2699
2699
  }
2700
+ function formatRootlessNotSupportedError() {
2701
+ return [
2702
+ `Monoceros requires Docker in "rootful" mode.`,
2703
+ ``,
2704
+ `You're running Docker in "rootless" mode right now. That setup`,
2705
+ `runs the daemon without root privileges \u2014 sounds safer, but it`,
2706
+ `doesn't play well with the way Monoceros shares files between`,
2707
+ `your host and the container. Specifically: files created inside`,
2708
+ `the container (cloned repos, new commits, build output) end up`,
2709
+ `with ownership that your normal host user can't edit without`,
2710
+ `sudo. That breaks the "edit on host, run in container" loop the`,
2711
+ `entire workflow is built around.`,
2712
+ ``,
2713
+ `To fix, switch back to standard rootful Docker:`,
2714
+ ``,
2715
+ cyan2(` systemctl --user disable --now docker.service docker.socket`),
2716
+ cyan2(` dockerd-rootless-setuptool.sh uninstall`),
2717
+ cyan2(` rm -rf ~/.local/share/docker`),
2718
+ cyan2(` unset DOCKER_HOST`),
2719
+ cyan2(` sudo systemctl enable --now docker`),
2720
+ cyan2(` sudo usermod -aG docker $USER`),
2721
+ ``,
2722
+ `Verify with ${cyan2("docker info | grep -i rootless")} \u2014 it should`,
2723
+ `produce no output. Then re-run.`,
2724
+ ``,
2725
+ `Background: see ${cyan2("docs/docker-on-linux.md")} in the workbench repo.`
2726
+ ].join("\n");
2727
+ }
2700
2728
 
2701
2729
  // src/devcontainer/identity.ts
2702
2730
  import { spawn as spawn6 } from "child_process";
@@ -2852,17 +2880,22 @@ ${sectionLine(label)}
2852
2880
  );
2853
2881
  validateOptions(createOpts);
2854
2882
  logger.success(`yml validated ${dim(`(${prettyPath(ymlPath)})`)}`);
2883
+ const hasRepos = (createOpts.repos ?? []).length > 0;
2884
+ const hasContainerGitUser = parsed.config.git?.user !== void 0;
2885
+ const hasDefaultGitUser = globalConfig?.defaults?.git?.user !== void 0;
2855
2886
  const idLogger = {
2856
2887
  info: logger.info,
2857
2888
  warn: logger.warn ?? logger.info
2858
2889
  };
2859
- await collectGitIdentity(targetDir, {
2860
- ...opts.identitySpawn ? { spawn: opts.identitySpawn } : {},
2861
- ...opts.identityPrompt ? { prompt: opts.identityPrompt } : {},
2862
- ...parsed.config.git?.user ? { containerOverride: parsed.config.git.user } : {},
2863
- ...globalConfig?.defaults?.git?.user ? { defaults: globalConfig.defaults.git.user } : {},
2864
- logger: idLogger
2865
- });
2890
+ if (hasRepos || hasContainerGitUser || hasDefaultGitUser) {
2891
+ await collectGitIdentity(targetDir, {
2892
+ ...opts.identitySpawn ? { spawn: opts.identitySpawn } : {},
2893
+ ...opts.identityPrompt ? { prompt: opts.identityPrompt } : {},
2894
+ ...parsed.config.git?.user ? { containerOverride: parsed.config.git.user } : {},
2895
+ ...globalConfig?.defaults?.git?.user ? { defaults: globalConfig.defaults.git.user } : {},
2896
+ logger: idLogger
2897
+ });
2898
+ }
2866
2899
  const hostsToFetch = uniqueHttpsHosts(createOpts.repos ?? []);
2867
2900
  const unknownProviderHosts = hostsToFetch.filter((h) => h.provider === "unknown").map((h) => h.host);
2868
2901
  if (unknownProviderHosts.length > 0) {
@@ -2892,6 +2925,9 @@ ${sectionLine(label)}
2892
2925
  const dockerMode = await detectDockerMode({
2893
2926
  ...opts.dockerInfoSpawn ? { spawn: opts.dockerInfoSpawn } : {}
2894
2927
  });
2928
+ if (dockerMode === "rootless") {
2929
+ throw new Error(formatRootlessNotSupportedError());
2930
+ }
2895
2931
  await fs8.mkdir(targetDir, { recursive: true });
2896
2932
  await writeScaffold(createOpts, targetDir, { dockerMode });
2897
2933
  await writeStateFile(
@@ -2969,7 +3005,7 @@ function warnOnDeprecatedFeatureRefs(containerFeatures, globalConfig, logger) {
2969
3005
  }
2970
3006
 
2971
3007
  // src/version.ts
2972
- var CLI_VERSION = true ? "1.6.8" : "dev";
3008
+ var CLI_VERSION = true ? "1.6.10" : "dev";
2973
3009
 
2974
3010
  // src/commands/_dispatch.ts
2975
3011
  import { consola as consola11 } from "consola";