@getmonoceros/workbench 1.38.13 → 1.38.14

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
  }
@@ -8073,6 +8079,30 @@ var init_docker_mode = __esm({
8073
8079
  }
8074
8080
  });
8075
8081
 
8082
+ // src/devcontainer/daemon-ready.ts
8083
+ async function waitForDockerDaemon(options = {}) {
8084
+ const exec = options.exec ?? defaultDockerExec;
8085
+ const attempts = options.attempts ?? 12;
8086
+ const delayMs = options.delayMs ?? 500;
8087
+ const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
8088
+ for (let attempt = 0; attempt < attempts; attempt++) {
8089
+ try {
8090
+ const result = await exec(["ps", "-q"]);
8091
+ if (result.exitCode === 0) return true;
8092
+ } catch {
8093
+ }
8094
+ if (attempt === 0) options.onWait?.();
8095
+ if (attempt < attempts - 1) await sleep(delayMs);
8096
+ }
8097
+ return false;
8098
+ }
8099
+ var init_daemon_ready = __esm({
8100
+ "src/devcontainer/daemon-ready.ts"() {
8101
+ "use strict";
8102
+ init_proxy();
8103
+ }
8104
+ });
8105
+
8076
8106
  // src/devcontainer/identity.ts
8077
8107
  import { spawn as spawn9 } from "child_process";
8078
8108
  import { promises as fs14 } from "fs";
@@ -8438,6 +8468,17 @@ Fix the value in the env file (or the yml).`
8438
8468
  }
8439
8469
  }
8440
8470
  section("Scaffold");
8471
+ const daemonReady = await waitForDockerDaemon({
8472
+ exec: opts.dockerExec ?? defaultDockerExec,
8473
+ onWait: () => (logger.warn ?? logger.info)(
8474
+ "Waiting for the Docker daemon to become ready\u2026"
8475
+ )
8476
+ });
8477
+ if (!daemonReady) {
8478
+ (logger.warn ?? logger.info)(
8479
+ "Docker daemon still not responding \u2014 continuing; the next docker step will report the error."
8480
+ );
8481
+ }
8441
8482
  const dockerMode = await detectDockerMode({
8442
8483
  ...opts.dockerInfoSpawn ? { spawn: opts.dockerInfoSpawn } : {}
8443
8484
  });
@@ -8811,6 +8852,7 @@ var init_apply = __esm({
8811
8852
  init_credentials();
8812
8853
  init_docker_mode();
8813
8854
  init_cli();
8855
+ init_daemon_ready();
8814
8856
  init_proxy();
8815
8857
  init_dynamic();
8816
8858
  init_port_check();
@@ -9010,7 +9052,7 @@ var CLI_VERSION;
9010
9052
  var init_version = __esm({
9011
9053
  "src/version.ts"() {
9012
9054
  "use strict";
9013
- CLI_VERSION = true ? "1.38.13" : "dev";
9055
+ CLI_VERSION = true ? "1.38.14" : "dev";
9014
9056
  }
9015
9057
  });
9016
9058