@getmonoceros/workbench 1.38.13 → 1.38.15

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
@@ -4080,7 +4080,11 @@ function buildPostCreateScript(opts) {
4080
4080
  lines.push(
4081
4081
  `if [ ! -d "projects/${repo.path}" ]; then`,
4082
4082
  ` echo "\u2192 Cloning ${repo.path} from ${url}\u2026"`,
4083
- ` git clone "${url}" "projects/${repo.path}"`,
4083
+ ` if ! git clone "${url}" "projects/${repo.path}"; then`,
4084
+ ` echo "\u26A0 Could not clone ${repo.path} from ${url} \u2014 skipping." >&2`,
4085
+ ` echo " If it is private, set a token and re-apply (see the repo-access notice)." >&2`,
4086
+ ` rm -rf "projects/${repo.path}"`,
4087
+ ` fi`,
4084
4088
  `else`,
4085
4089
  ` echo "\u2192 projects/${repo.path} already exists, skipping clone"`,
4086
4090
  `fi`
@@ -4089,8 +4093,10 @@ function buildPostCreateScript(opts) {
4089
4093
  const safeName = repo.gitUser.name.replace(/"/g, '\\"');
4090
4094
  const safeEmail = repo.gitUser.email.replace(/"/g, '\\"');
4091
4095
  lines.push(
4092
- `git -C "projects/${repo.path}" config user.name "${safeName}"`,
4093
- `git -C "projects/${repo.path}" config user.email "${safeEmail}"`
4096
+ `if [ -d "projects/${repo.path}/.git" ]; then`,
4097
+ ` git -C "projects/${repo.path}" config user.name "${safeName}"`,
4098
+ ` git -C "projects/${repo.path}" config user.email "${safeEmail}"`,
4099
+ `fi`
4094
4100
  );
4095
4101
  }
4096
4102
  }
@@ -7234,6 +7240,7 @@ function buildSpawnOptions(opts) {
7234
7240
  if (opts.logSink) out.logSink = opts.logSink;
7235
7241
  if (opts.progressSink) out.progressSink = opts.progressSink;
7236
7242
  if (opts.silent) out.silent = true;
7243
+ if (opts.quiet) out.quiet = true;
7237
7244
  return Object.keys(out).length > 0 ? out : void 0;
7238
7245
  }
7239
7246
  async function runUpWithBindRetry(attempt, baseSink, logger, opts = {}) {
@@ -8073,6 +8080,30 @@ var init_docker_mode = __esm({
8073
8080
  }
8074
8081
  });
8075
8082
 
8083
+ // src/devcontainer/daemon-ready.ts
8084
+ async function waitForDockerDaemon(options = {}) {
8085
+ const exec = options.exec ?? defaultDockerExec;
8086
+ const attempts = options.attempts ?? 12;
8087
+ const delayMs = options.delayMs ?? 500;
8088
+ const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
8089
+ for (let attempt = 0; attempt < attempts; attempt++) {
8090
+ try {
8091
+ const result = await exec(["ps", "-q"]);
8092
+ if (result.exitCode === 0) return true;
8093
+ } catch {
8094
+ }
8095
+ if (attempt === 0) options.onWait?.();
8096
+ if (attempt < attempts - 1) await sleep(delayMs);
8097
+ }
8098
+ return false;
8099
+ }
8100
+ var init_daemon_ready = __esm({
8101
+ "src/devcontainer/daemon-ready.ts"() {
8102
+ "use strict";
8103
+ init_proxy();
8104
+ }
8105
+ });
8106
+
8076
8107
  // src/devcontainer/identity.ts
8077
8108
  import { spawn as spawn9 } from "child_process";
8078
8109
  import { promises as fs14 } from "fs";
@@ -8438,6 +8469,17 @@ Fix the value in the env file (or the yml).`
8438
8469
  }
8439
8470
  }
8440
8471
  section("Scaffold");
8472
+ const daemonReady = await waitForDockerDaemon({
8473
+ exec: opts.dockerExec ?? defaultDockerExec,
8474
+ onWait: () => (logger.warn ?? logger.info)(
8475
+ "Waiting for the Docker daemon to become ready\u2026"
8476
+ )
8477
+ });
8478
+ if (!daemonReady) {
8479
+ (logger.warn ?? logger.info)(
8480
+ "Docker daemon still not responding \u2014 continuing; the next docker step will report the error."
8481
+ );
8482
+ }
8441
8483
  const dockerMode = await detectDockerMode({
8442
8484
  ...opts.dockerInfoSpawn ? { spawn: opts.dockerInfoSpawn } : {}
8443
8485
  });
@@ -8811,6 +8853,7 @@ var init_apply = __esm({
8811
8853
  init_credentials();
8812
8854
  init_docker_mode();
8813
8855
  init_cli();
8856
+ init_daemon_ready();
8814
8857
  init_proxy();
8815
8858
  init_dynamic();
8816
8859
  init_port_check();
@@ -9010,7 +9053,7 @@ var CLI_VERSION;
9010
9053
  var init_version = __esm({
9011
9054
  "src/version.ts"() {
9012
9055
  "use strict";
9013
- CLI_VERSION = true ? "1.38.13" : "dev";
9056
+ CLI_VERSION = true ? "1.38.15" : "dev";
9014
9057
  }
9015
9058
  });
9016
9059
 
@@ -12918,7 +12961,7 @@ async function bringContainerUp(name, openTool) {
12918
12961
  }
12919
12962
  const exitCode = await runStart({
12920
12963
  root: containerDir(args.name),
12921
- silent: true,
12964
+ quiet: true,
12922
12965
  logger: { info: () => {
12923
12966
  } }
12924
12967
  });
@@ -12945,6 +12988,10 @@ async function bringContainerUp(name, openTool) {
12945
12988
  }
12946
12989
  if (exitCode === 0) {
12947
12990
  consola38.success(`Container '${args.name}' is up.`);
12991
+ } else {
12992
+ consola38.error(
12993
+ `Container '${args.name}' failed to start (devcontainer up exited ${exitCode}).`
12994
+ );
12948
12995
  }
12949
12996
  if (args.open && exitCode === 0) {
12950
12997
  try {