@getmonoceros/workbench 1.5.1 → 1.5.3

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
@@ -1694,6 +1694,11 @@ import { parseDocument as parseDocument2 } from "yaml";
1694
1694
  var SCHEMA_VERSION = 1;
1695
1695
  var MonocerosConfigSchema = z2.object({
1696
1696
  schemaVersion: z2.literal(SCHEMA_VERSION),
1697
+ // .nullish() (= .optional().nullable()) on defaults so the shipped
1698
+ // sample yml — where `defaults:` is uncommented but every sub-block
1699
+ // is commented out — parses cleanly. YAML produces `defaults: null`
1700
+ // in that case; without .nullish() the schema would reject it and
1701
+ // we'd be back to forcing builders to comment-juggle three lines.
1697
1702
  defaults: z2.object({
1698
1703
  git: z2.object({
1699
1704
  user: GitUserSchema.optional()
@@ -1705,7 +1710,7 @@ var MonocerosConfigSchema = z2.object({
1705
1710
  ),
1706
1711
  z2.record(z2.string(), FeatureOptionValueSchema)
1707
1712
  ).optional()
1708
- }).optional()
1713
+ }).nullish()
1709
1714
  });
1710
1715
  async function readMonocerosConfig(opts = {}) {
1711
1716
  const home = opts.monocerosHome ?? monocerosHome();
@@ -3489,13 +3494,21 @@ async function runRemove(opts) {
3489
3494
  const script = [
3490
3495
  `set -u`,
3491
3496
  `echo "[remove] tearing down docker project ${projectName}\u2026"`,
3492
- // Compose-mode containers, identified by the project label
3497
+ // Compose-mode containers, identified by the compose project label.
3493
3498
  `by_label=$(docker ps -aq --filter "label=com.docker.compose.project=${projectName}" 2>/dev/null || true)`,
3494
- // Container-name prefix fallback (catches half-broken state)
3499
+ // Devcontainer-cli containers (image-mode workspace + feature-
3500
+ // build intermediates) all carry this label, value = the absolute
3501
+ // container-dir path. Most reliable anchor we have, because
3502
+ // @devcontainers/cli lets Docker assign random names like
3503
+ // 'kind_cerf' — neither the project-name nor the vsc-<name>-
3504
+ // prefix filters below catch those.
3505
+ `by_dc_label=$(docker ps -aq --filter "label=devcontainer.local_folder=${containerPath}" 2>/dev/null || true)`,
3506
+ // Container-name prefix fallback (catches half-broken state).
3495
3507
  `by_compose_name=$(docker ps -aq --filter "name=^${projectName}-" 2>/dev/null || true)`,
3496
- // Image-mode devcontainer-cli container
3508
+ // Image-mode devcontainer-cli name fallback (only kicks in when
3509
+ // the cli used a deterministic name — modern versions don't).
3497
3510
  `by_image_name=$(docker ps -aq --filter "name=^vsc-${opts.name}-" 2>/dev/null || true)`,
3498
- `to_remove=$(printf "%s\\n%s\\n%s\\n" "$by_label" "$by_compose_name" "$by_image_name" | sort -u | grep -v "^$" || true)`,
3511
+ `to_remove=$(printf "%s\\n%s\\n%s\\n%s\\n" "$by_label" "$by_dc_label" "$by_compose_name" "$by_image_name" | sort -u | grep -v "^$" || true)`,
3499
3512
  `if [ -n "$to_remove" ]; then echo "[remove] removing containers: $(echo $to_remove | tr "\\n" " ")"; docker rm -f $to_remove >/dev/null || true; else echo "[remove] no containers found"; fi`,
3500
3513
  `docker network rm ${projectName}_default 2>/dev/null && echo "[remove] network ${projectName}_default removed" || true`,
3501
3514
  `echo "[remove] docker cleanup done"`