container-superposition 0.1.6 → 0.1.7

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.
Files changed (143) hide show
  1. package/dist/scripts/init.js +7 -4
  2. package/dist/scripts/init.js.map +1 -1
  3. package/dist/tool/commands/adopt.d.ts.map +1 -1
  4. package/dist/tool/commands/adopt.js +1 -27
  5. package/dist/tool/commands/adopt.js.map +1 -1
  6. package/dist/tool/commands/doctor.d.ts +3 -0
  7. package/dist/tool/commands/doctor.d.ts.map +1 -1
  8. package/dist/tool/commands/doctor.js +932 -69
  9. package/dist/tool/commands/doctor.js.map +1 -1
  10. package/dist/tool/commands/explain.d.ts.map +1 -1
  11. package/dist/tool/commands/explain.js +9 -0
  12. package/dist/tool/commands/explain.js.map +1 -1
  13. package/dist/tool/questionnaire/composer.d.ts.map +1 -1
  14. package/dist/tool/questionnaire/composer.js +212 -11
  15. package/dist/tool/questionnaire/composer.js.map +1 -1
  16. package/dist/tool/schema/overlay-loader.d.ts.map +1 -1
  17. package/dist/tool/schema/overlay-loader.js +1 -0
  18. package/dist/tool/schema/overlay-loader.js.map +1 -1
  19. package/dist/tool/schema/project-config.d.ts +1 -1
  20. package/dist/tool/schema/project-config.d.ts.map +1 -1
  21. package/dist/tool/schema/project-config.js +94 -25
  22. package/dist/tool/schema/project-config.js.map +1 -1
  23. package/dist/tool/schema/types.d.ts +85 -11
  24. package/dist/tool/schema/types.d.ts.map +1 -1
  25. package/dist/tool/utils/merge.d.ts.map +1 -1
  26. package/dist/tool/utils/merge.js +9 -0
  27. package/dist/tool/utils/merge.js.map +1 -1
  28. package/docs/creating-overlays.md +151 -2
  29. package/docs/overlay-imports.md +125 -102
  30. package/docs/overlays.md +49 -6
  31. package/docs/quick-reference.md +99 -0
  32. package/docs/specs/003-mkdocs2-overlay/spec.md +114 -0
  33. package/docs/specs/004-doctor-fix/spec.md +70 -0
  34. package/docs/specs/005-cuda-overlay/spec.md +101 -0
  35. package/docs/specs/006-rocm-overlay/spec.md +109 -0
  36. package/overlays/.shared/README.md +80 -21
  37. package/overlays/.shared/compose/common-healthchecks.md +60 -0
  38. package/overlays/.shared/vscode/recommended-extensions.json +15 -11
  39. package/overlays/alertmanager/setup.sh +4 -19
  40. package/overlays/alertmanager/verify.sh +8 -9
  41. package/overlays/all/README.md +43 -0
  42. package/overlays/all/devcontainer.patch.json +6 -0
  43. package/overlays/all/overlay.yml +14 -0
  44. package/overlays/amp/setup.sh +5 -0
  45. package/overlays/bun/setup.sh +10 -1
  46. package/overlays/bun/verify.sh +6 -1
  47. package/overlays/claude-code/setup.sh +5 -0
  48. package/overlays/cloudflared/setup.sh +9 -12
  49. package/overlays/codex/README.md +9 -6
  50. package/overlays/codex/devcontainer.patch.json +7 -1
  51. package/overlays/codex/setup.sh +5 -0
  52. package/overlays/codex/verify.sh +8 -0
  53. package/overlays/commitlint/setup.sh +5 -0
  54. package/overlays/cuda/README.md +179 -0
  55. package/overlays/cuda/devcontainer.patch.json +7 -0
  56. package/overlays/cuda/overlay.yml +17 -0
  57. package/overlays/cuda/setup.sh +32 -0
  58. package/overlays/cuda/verify.sh +38 -0
  59. package/overlays/devcontainer-cli/README.md +50 -0
  60. package/overlays/devcontainer-cli/devcontainer.patch.json +13 -0
  61. package/overlays/devcontainer-cli/overlay.yml +16 -0
  62. package/overlays/devcontainer-cli/setup.sh +14 -0
  63. package/overlays/direnv/devcontainer.patch.json +6 -0
  64. package/overlays/direnv/setup.sh +7 -6
  65. package/overlays/dotnet/setup.sh +14 -7
  66. package/overlays/duckdb/devcontainer.patch.json +1 -2
  67. package/overlays/gcloud/devcontainer.patch.json +0 -6
  68. package/overlays/gcloud/setup.sh +51 -0
  69. package/overlays/gemini-cli/setup.sh +5 -0
  70. package/overlays/git-helpers/devcontainer.patch.json +2 -1
  71. package/overlays/go/setup.sh +15 -14
  72. package/overlays/jaeger/overlay.yml +2 -0
  73. package/overlays/just/setup.sh +5 -17
  74. package/overlays/keycloak/docker-compose.yml +6 -4
  75. package/overlays/keycloak/verify.sh +4 -3
  76. package/overlays/kind/devcontainer.patch.json +1 -2
  77. package/overlays/kind/setup.sh +8 -17
  78. package/overlays/minio/setup.sh +10 -18
  79. package/overlays/mkdocs/overlay.yml +2 -1
  80. package/overlays/mkdocs2/README.md +135 -0
  81. package/overlays/mkdocs2/devcontainer.patch.json +19 -0
  82. package/overlays/mkdocs2/overlay.yml +17 -0
  83. package/overlays/mkdocs2/setup.sh +67 -0
  84. package/overlays/mkdocs2/verify.sh +35 -0
  85. package/overlays/modern-cli-tools/devcontainer.patch.json +7 -1
  86. package/overlays/modern-cli-tools/setup.sh +21 -71
  87. package/overlays/mongodb/devcontainer.patch.json +0 -6
  88. package/overlays/mongodb/setup.sh +59 -0
  89. package/overlays/mysql/verify.sh +4 -3
  90. package/overlays/nats/.env.example +1 -1
  91. package/overlays/nats/README.md +1 -1
  92. package/overlays/nats/docker-compose.yml +1 -1
  93. package/overlays/ngrok/setup.sh +9 -6
  94. package/overlays/nodejs/setup.sh +5 -0
  95. package/overlays/openapi-tools/devcontainer.patch.json +1 -2
  96. package/overlays/openapi-tools/setup.sh +9 -8
  97. package/overlays/opencode/setup.sh +5 -0
  98. package/overlays/otel-collector/overlay.yml +2 -0
  99. package/overlays/otel-collector/setup.sh +3 -16
  100. package/overlays/otel-demo-nodejs/verify.sh +8 -9
  101. package/overlays/otel-demo-python/verify.sh +16 -10
  102. package/overlays/pandoc/README.md +22 -15
  103. package/overlays/pandoc/devcontainer.patch.json +6 -2
  104. package/overlays/pandoc/setup.sh +217 -18
  105. package/overlays/pandoc/verify.sh +16 -4
  106. package/overlays/playwright/devcontainer.patch.json +3 -1
  107. package/overlays/playwright/setup.sh +37 -0
  108. package/overlays/postgres/docker-compose.yml +6 -0
  109. package/overlays/powershell/setup.sh +49 -13
  110. package/overlays/pre-commit/setup.sh +12 -3
  111. package/overlays/prometheus/overlay.yml +2 -0
  112. package/overlays/promtail/verify.sh +16 -10
  113. package/overlays/pulumi/devcontainer.patch.json +1 -1
  114. package/overlays/python/setup.sh +28 -9
  115. package/overlays/python/verify.sh +4 -2
  116. package/overlays/redpanda/docker-compose.yml +3 -5
  117. package/overlays/rocm/README.md +227 -0
  118. package/overlays/rocm/devcontainer.patch.json +4 -0
  119. package/overlays/rocm/overlay.yml +17 -0
  120. package/overlays/rocm/setup.sh +45 -0
  121. package/overlays/rocm/verify.sh +47 -0
  122. package/overlays/rust/setup.sh +11 -18
  123. package/overlays/spec-kit/setup.sh +7 -3
  124. package/overlays/sqlite/setup.sh +14 -14
  125. package/overlays/sqlserver/docker-compose.yml +3 -3
  126. package/overlays/sqlserver/verify.sh +22 -5
  127. package/overlays/tempo/verify.sh +16 -10
  128. package/overlays/tilt/devcontainer.patch.json +1 -2
  129. package/overlays/tilt/setup.sh +14 -4
  130. package/overlays/windsurf-cli/setup.sh +27 -4
  131. package/overlays/windsurf-cli/verify.sh +13 -3
  132. package/package.json +2 -1
  133. package/templates/scripts/setup-utils.sh +228 -0
  134. package/tool/schema/config.schema.json +110 -8
  135. package/tool/schema/overlay-manifest.schema.json +5 -0
  136. package/overlays/.shared/compose/common-healthchecks.yml +0 -38
  137. /package/overlays/otel-demo-nodejs/{Dockerfile-otel-demo-nodejs → Dockerfile} +0 -0
  138. /package/overlays/otel-demo-nodejs/{package-otel-demo-nodejs.json → package.json} +0 -0
  139. /package/overlays/otel-demo-nodejs/{server-otel-demo-nodejs.js → server.js} +0 -0
  140. /package/overlays/otel-demo-nodejs/{tracing-otel-demo-nodejs.js → tracing.js} +0 -0
  141. /package/overlays/otel-demo-python/{Dockerfile-otel-demo-python → Dockerfile} +0 -0
  142. /package/overlays/otel-demo-python/{app-otel-demo-python.py → app.py} +0 -0
  143. /package/overlays/otel-demo-python/{requirements-otel-demo-python.txt → requirements.txt} +0 -0
@@ -0,0 +1,70 @@
1
+ # Feature Specification: `doctor --fix` — Interactive Auto-Repair
2
+
3
+ **Feature Branch**: `004-doctor-fix`
4
+ **Created**: 2026-03-19
5
+ **Status**: Final
6
+ **Input**: GitHub issue: Implement `doctor --fix` — interactive auto-repair for environment issues
7
+
8
+ ## Review & Approval _(mandatory before implementation)_
9
+
10
+ - **Spec Path**: `docs/specs/004-doctor-fix/spec.md`
11
+ - **Commit Status**: Committed
12
+ - **Review Status**: APPROVED
13
+ - **Implementation Gate**: No implementation code may begin until this spec is committed and reviewed.
14
+
15
+ ## Summary
16
+
17
+ The `doctor` command validates the environment. The `--fix` path was a placeholder. This spec
18
+ describes the full implementation of an interactive, safe, deterministic auto-repair flow for
19
+ common environment issues.
20
+
21
+ ## Initial Auto-Fix Scope
22
+
23
+ | # | Issue class | Automation condition |
24
+ | --- | ------------------------------------------------------------- | ----------------------------------------------------------------- |
25
+ | 1 | Stale or legacy `superposition.json` metadata | Always supported (manifest migration) |
26
+ | 2 | Derived `.devcontainer/` drift or missing generated artifacts | Supported when a valid manifest is present (regeneration) |
27
+ | 3 | Unsupported Node runtime | Supported only when `nvm`, `fnm`, or `volta` is already available |
28
+ | 4 | Docker / Compose tooling drift | Supported only when a known safe host repair command is available |
29
+
30
+ ## Outcome Vocabulary
31
+
32
+ Every finding evaluated by the fix flow resolves to exactly one of:
33
+
34
+ - **`fixed`** — tool changed the environment and targeted re-check now passes
35
+ - **`already compliant`** — fix path found no change was needed
36
+ - **`skipped`** — not attempted because an earlier failure or prerequisite blocked it
37
+ - **`requires manual action`** — issue remains; automation is unsafe or unavailable
38
+
39
+ ## Data Model
40
+
41
+ ### `DiagnosticFinding`
42
+
43
+ Fields: `id`, `category`, `name`, `status`, `message`, `details?`, `fixEligibility`, `remediationKey?`, `recheckScope`
44
+
45
+ ### `RemediationAction`
46
+
47
+ Fields: `key`, `findingId`, `safetyClass`, `executionKind`, `preconditions`, `plannedChanges`, `manualFallback`
48
+
49
+ ### `FixExecution`
50
+
51
+ Fields: `findingId`, `remediationKey`, `attempted`, `outcome`, `reason`, `commands?`, `changedFiles?`, `backupPath?`, `rechecked`
52
+
53
+ ### `FixRun`
54
+
55
+ Fields: `outputPath`, `requestedJson`, `initialFindings`, `executions`, `finalFindings`, `summary`, `exitDisposition`
56
+
57
+ ## CLI Contract
58
+
59
+ - `doctor` without `--fix` — no change to current diagnostics behavior
60
+ - `doctor --fix` — diagnose → remediate in stable order → re-check → print summary
61
+ - `doctor --fix --json` — same flow, machine-readable JSON output
62
+
63
+ ## Remediation Ordering
64
+
65
+ Prerequisites before dependents:
66
+
67
+ 1. Stale manifest migration (must complete before regeneration)
68
+ 2. Missing artifacts / devcontainer drift (regeneration from manifest)
69
+ 3. Node version fix (only if version manager available)
70
+ 4. Docker tooling fix (only if repair command available)
@@ -0,0 +1,101 @@
1
+ # Feature Specification: CUDA (NVIDIA GPU) Overlay
2
+
3
+ **Feature Branch**: `copilot/add-cuda-overlay-for-gpu`
4
+ **Created**: 2026-03-22
5
+ **Status**: Final
6
+ **Input**: Add a `cuda` overlay to enable NVIDIA GPU-accelerated workloads inside a dev container.
7
+
8
+ ## Review & Approval _(mandatory before implementation)_
9
+
10
+ - **Spec Path**: `docs/specs/005-cuda-overlay/spec.md`
11
+ - **Commit Status**: Committed
12
+ - **Review Status**: Approved
13
+ - **Implementation Gate**: No implementation code may begin until this spec is committed and reviewed.
14
+
15
+ ## User Scenarios & Testing _(mandatory)_
16
+
17
+ ### User Story 1 - GPU passthrough for ML/inference workloads (Priority: P1)
18
+
19
+ A developer wants to run NVIDIA GPU-accelerated workloads (ML training, inference, CUDA compute) inside a dev container without manually configuring Docker runtime flags.
20
+
21
+ **Why this priority**: GPU-accelerated dev containers require specific Docker runtime flags (`--gpus=all`) and VS Code devcontainer host requirements (`gpu: true`) that must be set correctly for the container to access the GPU. Without the overlay, users must add these manually and correctly every time.
22
+
23
+ **Independent Test**: Select the `cuda` overlay, rebuild the container, and confirm that `nvidia-smi` exits 0 and reports the GPU correctly.
24
+
25
+ **Acceptance Scenarios**:
26
+
27
+ 1. **Given** a user selects the `cuda` overlay, **When** the devcontainer is built, **Then** `devcontainer.json` includes `"runArgs": ["--gpus=all"]` and `"hostRequirements": {"gpu": true}`.
28
+ 2. **Given** the NVIDIA Container Toolkit is installed on the host, **When** the devcontainer starts, **Then** `nvidia-smi` is accessible inside the container.
29
+ 3. **Given** the container is running, **When** `setup.sh` executes, **Then** it reports whether `nvidia-smi` is available and prints a helpful message if it is not.
30
+
31
+ ---
32
+
33
+ ### User Story 2 - Conflict enforcement between cuda and rocm (Priority: P1)
34
+
35
+ A user selects both `cuda` and `rocm` and expects the tool to report a conflict, because only one GPU compute framework can be active at a time.
36
+
37
+ **Why this priority**: CUDA (NVIDIA) and ROCm (AMD) are mutually exclusive GPU compute frameworks. Allowing both would produce an incoherent configuration.
38
+
39
+ **Independent Test**: Attempt to generate a devcontainer with both `cuda` and `rocm` selected and confirm the tool surfaces a conflict and blocks generation.
40
+
41
+ **Acceptance Scenarios**:
42
+
43
+ 1. **Given** a user selects both `cuda` and `rocm`, **When** they run `container-superposition init`, **Then** the tool reports a conflict and prevents generation.
44
+ 2. **Given** `cuda` lists `rocm` in `conflicts`, **When** `rocm` is added in the future, **Then** `rocm` must also list `cuda` in its `conflicts` (bidirectional enforcement). Note: `rocm` does not exist yet; when it is added the reciprocal conflict must be declared in `overlays/rocm/overlay.yml`.
45
+
46
+ ---
47
+
48
+ ## Design
49
+
50
+ ### overlay.yml
51
+
52
+ ```yaml
53
+ id: cuda
54
+ name: CUDA (NVIDIA GPU)
55
+ description: NVIDIA CUDA libraries and GPU passthrough for containerized ML/inference workloads
56
+ category: dev
57
+ supports: []
58
+ requires: []
59
+ suggests: []
60
+ conflicts:
61
+ - rocm
62
+ tags:
63
+ - gpu
64
+ - cuda
65
+ - nvidia
66
+ - ml
67
+ - inference
68
+ ports: []
69
+ ```
70
+
71
+ ### devcontainer.patch.json
72
+
73
+ Set `runArgs` for GPU passthrough and `hostRequirements` to signal GPU need:
74
+
75
+ ```json
76
+ {
77
+ "runArgs": ["--gpus=all"],
78
+ "hostRequirements": { "gpu": true }
79
+ }
80
+ ```
81
+
82
+ ### setup.sh
83
+
84
+ - Check whether `nvidia-smi` is reachable inside the container.
85
+ - Print a helpful message if it is not (host driver / toolkit not configured).
86
+
87
+ ### verify.sh
88
+
89
+ - Assert `nvidia-smi` exits 0 (used by the `doctor` command).
90
+
91
+ ### README.md
92
+
93
+ - Clear prerequisites section (host drivers, NVIDIA Container Toolkit).
94
+ - Troubleshooting tips for common failure modes.
95
+ - Note that the overlay does not replace or install host drivers.
96
+
97
+ ## Out of Scope
98
+
99
+ - Installing or replacing host NVIDIA drivers.
100
+ - Guaranteeing version alignment between CUDA user-space libraries and the host kernel module.
101
+ - ROCm (AMD GPU) support — tracked separately.
@@ -0,0 +1,109 @@
1
+ # Feature Specification: ROCm (AMD GPU) Overlay
2
+
3
+ **Feature Branch**: `copilot/add-rocm-overlay`
4
+ **Created**: 2026-03-22
5
+ **Status**: Accepted
6
+ **Input**: Add a `rocm` overlay to enable AMD GPU-accelerated workloads inside a dev container.
7
+
8
+ ## Review & Approval _(mandatory before implementation)_
9
+
10
+ - **Spec Path**: `docs/specs/006-rocm-overlay/spec.md`
11
+ - **Commit Status**: Committed
12
+ - **Review Status**: Approved
13
+ - **Implementation Gate**: No implementation code may begin until this spec is committed and reviewed.
14
+
15
+ ## Overview
16
+
17
+ Add a `rocm` overlay to enable AMD GPU-accelerated workloads inside a dev container using the ROCm open software platform.
18
+
19
+ > **Note:** ROCm-in-container is a supported but more fragile path than CUDA. It depends heavily on the host kernel version, AMD driver stack, specific device support, and container runtime configuration. Treat this as a separate supported profile — not a drop-in equivalent of CUDA.
20
+
21
+ ## User Scenarios & Testing _(mandatory)_
22
+
23
+ ### User Story 1 - AMD GPU passthrough for ML/inference workloads (Priority: P1)
24
+
25
+ 1. **Given** a user selects the `rocm` overlay, **When** the devcontainer is built, **Then** `devcontainer.json` includes `"runArgs": ["--device=/dev/kfd", "--device=/dev/dri", "--group-add=video", "--group-add=render"]`.
26
+ 2. **Given** the AMD GPU drivers and ROCm runtime are installed on the host, **When** the devcontainer starts, **Then** `rocm-smi` is accessible inside the container.
27
+ 3. **Given** the container is running, **When** `setup.sh` executes, **Then** it reports whether `rocm-smi` is available and prints a helpful message if it is not.
28
+ 4. **Given** `rocm-smi` is not available, **When** `verify.sh` executes, **Then** it exits 1 for the `doctor` command.
29
+
30
+ ---
31
+
32
+ ## Prerequisites (host-side — out of scope for this overlay)
33
+
34
+ 1. Supported AMD GPU hardware (RDNA 2+, most CDNA — check [ROCm hardware support matrix](https://rocm.docs.amd.com/en/latest/compatibility/compatibility-matrix.html))
35
+ 2. AMD GPU drivers (`amdgpu`) installed on the host
36
+ 3. ROCm runtime installed on the host (or the container image bundles it)
37
+ 4. User added to the `render` and `video` groups, or appropriate device permissions set
38
+ 5. `/dev/kfd` and `/dev/dri` devices accessible in the container
39
+
40
+ ## Design
41
+
42
+ ### overlay.yml
43
+
44
+ ```yaml
45
+ id: rocm
46
+ name: ROCm (AMD GPU)
47
+ description: AMD ROCm libraries and GPU passthrough for containerized ML/inference workloads
48
+ category: dev
49
+ supports: []
50
+ requires: []
51
+ suggests: []
52
+ conflicts:
53
+ - cuda
54
+ tags:
55
+ - dev
56
+ - gpu
57
+ - rocm
58
+ - amd
59
+ - ml
60
+ - inference
61
+ ports: []
62
+ ```
63
+
64
+ ### devcontainer.patch.json
65
+
66
+ Set `runArgs` for AMD GPU device passthrough:
67
+
68
+ ```json
69
+ {
70
+ "runArgs": ["--device=/dev/kfd", "--device=/dev/dri", "--group-add=video", "--group-add=render"]
71
+ }
72
+ ```
73
+
74
+ - `/dev/kfd` — AMD Kernel Fusion Driver; required for ROCm compute
75
+ - `/dev/dri` — Direct Rendering Infrastructure; gives access to GPU render nodes
76
+ - `--group-add=video` and `--group-add=render` — add the container user to the groups that own the GPU device nodes
77
+
78
+ ### setup.sh
79
+
80
+ - Check whether `rocm-smi` or `rocminfo` is reachable inside the container.
81
+ - Print a helpful message if neither is found (host driver / ROCm not configured).
82
+
83
+ ### verify.sh
84
+
85
+ - Assert `rocm-smi` exits 0 (used by the `doctor` command).
86
+
87
+ ### README.md
88
+
89
+ Must include:
90
+
91
+ - Prominent prerequisites section
92
+ - Known limitations (kernel version coupling, device node names may vary)
93
+ - ROCm framework wheels (PyTorch ROCm, TensorFlow ROCm)
94
+ - Troubleshooting section
95
+ - Link to ROCm compatibility matrix
96
+ - Clear note that this overlay does not replace host drivers
97
+
98
+ ## Relationship to CUDA Overlay
99
+
100
+ - `cuda` and `rocm` must list each other in `conflicts` (bidirectional, per project rules)
101
+ - The `cuda` overlay already declares `rocm` in its `conflicts`
102
+ - CUDA is considered the primary GPU path; ROCm is a supported secondary path
103
+
104
+ ## Known Constraints and Caveats
105
+
106
+ - ROCm version support is tightly coupled to kernel and driver versions
107
+ - Device node names (`/dev/dri/renderD128`) may differ per host
108
+ - Some frameworks publish separate ROCm wheels
109
+ - Less forgiving than CUDA during setup — detailed troubleshooting is essential
@@ -1,43 +1,102 @@
1
- # Shared Overlay Configurations
1
+ # Shared Overlay Fragments
2
2
 
3
- This directory contains shared configuration fragments that can be imported by multiple overlays to reduce duplication and ensure consistency.
3
+ This directory contains reusable configuration fragments that can be imported by multiple overlays to reduce duplication and ensure consistency.
4
4
 
5
5
  ## Structure
6
6
 
7
7
  ```
8
8
  .shared/
9
- ├── otel/ # OpenTelemetry configurations
10
- ├── compose/ # Docker Compose patterns (healthchecks, etc.)
11
- └── vscode/ # VS Code extension sets
9
+ ├── otel/ # OpenTelemetry configurations
10
+ ├── instrumentation.env # OTEL SDK env vars for instrumentation
11
+ └── otel-base-config.yaml # Base OTEL collector pipeline config
12
+ ├── compose/ # Docker Compose patterns
13
+ │ └── common-healthchecks.md # Standard healthcheck patterns (reference — not importable)
14
+ └── vscode/ # VS Code extension sets
15
+ └── recommended-extensions.json # Commonly recommended extensions (devcontainer patch)
12
16
  ```
13
17
 
18
+ ## Fragment Catalogue
19
+
20
+ ### `otel/instrumentation.env`
21
+
22
+ **Purpose:** Common OpenTelemetry SDK environment variables for services that send telemetry to an OTEL collector.
23
+
24
+ **Provides:**
25
+
26
+ - `OTEL_SERVICE_NAME` — service identifier
27
+ - `OTEL_EXPORTER_OTLP_ENDPOINT` — OTLP collector endpoint
28
+ - `OTEL_EXPORTER_OTLP_PROTOCOL` — transport protocol (grpc)
29
+ - `OTEL_RESOURCE_ATTRIBUTES` — deployment metadata
30
+ - `OTEL_TRACES_SAMPLER`, `OTEL_TRACES_EXPORTER` — trace configuration
31
+ - `OTEL_METRICS_EXPORTER`, `OTEL_LOGS_EXPORTER` — metrics and log exporters
32
+
33
+ **Imported by:** `otel-collector`, `prometheus`, `jaeger`
34
+
35
+ **Merge type:** `.env` — appended to `.env.example` with a `# from .shared/otel/instrumentation.env` comment
36
+
37
+ ---
38
+
39
+ ### `otel/otel-base-config.yaml`
40
+
41
+ **Purpose:** Base OpenTelemetry Collector receiver and pipeline configuration — OTLP receivers, batch processor, and logging exporter.
42
+
43
+ **Merge type:** `.yaml` — deep-merged into `devcontainer.json` patch
44
+
45
+ ---
46
+
47
+ ### `compose/common-healthchecks.md`
48
+
49
+ **Purpose:** Reference library of standard Docker Compose healthcheck patterns for common services (HTTP, PostgreSQL, Redis, MongoDB, MySQL).
50
+
51
+ **Note:** This is a `.md` file (documentation only) — it cannot be imported via `overlay.yml` `imports:`. Copy the relevant pattern directly into your overlay's `docker-compose.yml`.
52
+
53
+ ---
54
+
55
+ ### `vscode/recommended-extensions.json`
56
+
57
+ **Purpose:** A curated set of VS Code extensions commonly useful across many overlays (spell checking, error lens, GitLens, EditorConfig, Prettier, Docker, YAML, Markdown).
58
+
59
+ **Format:** Valid devcontainer patch — `customizations.vscode.extensions` array.
60
+
61
+ **Merge type:** `.json` — deep-merged into `devcontainer.json` patch
62
+
63
+ ---
64
+
14
65
  ## Usage
15
66
 
16
- Overlays can import shared files by adding them to the `imports` field in `overlay.yml`:
67
+ Reference shared fragments in `overlay.yml` via the `imports` field:
17
68
 
18
69
  ```yaml
19
- id: prometheus
70
+ id: my-overlay
20
71
  imports:
21
- - .shared/otel/otel-base-config.yaml
22
- - .shared/compose/common-healthchecks.yml
72
+ - .shared/otel/instrumentation.env
73
+ - .shared/vscode/recommended-extensions.json
23
74
  ```
24
75
 
25
- ## Benefits
76
+ **Rules:**
77
+
78
+ - All paths must begin with `.shared/`
79
+ - Paths are relative to `overlays/`
80
+ - Imports are applied in declaration order, then the overlay's own `devcontainer.patch.json` (overlay wins on conflict)
81
+
82
+ ## Creating New Fragments
83
+
84
+ 1. Choose the right subdirectory (`otel/`, `compose/`, `vscode/`, or create a new one with a clear name)
85
+ 2. Use a descriptive file name — one concern per file
86
+ 3. For `.json` and `.yaml` fragments, ensure the content is valid devcontainer patch format
87
+ 4. Add a comment at the top explaining what the fragment does
88
+ 5. Update this README with the new fragment's details and which overlays import it
26
89
 
27
- - **DRY (Don't Repeat Yourself)**: Common patterns defined once
28
- - **Consistency**: All overlays using the same shared config stay in sync
29
- - **Maintainability**: Update shared config once, all overlays benefit
30
- - **Best Practices**: Shared configs embody proven patterns
90
+ ## Downstream Impact
31
91
 
32
- ## Creating Shared Configs
92
+ Any change to a shared fragment affects every overlay that imports it. Before editing:
33
93
 
34
- 1. Identify common patterns across overlays
35
- 2. Extract to appropriate `.shared/` subdirectory
36
- 3. Update overlays to import the shared file
37
- 4. Test that imports work correctly
94
+ - Check the "Imported by" section above for the fragment you're modifying
95
+ - Run `npm test` and `container-superposition doctor` after changes
96
+ - Consider whether the change should apply to all importers, or whether specific overlays need to be updated
38
97
 
39
98
  ## Import Resolution
40
99
 
41
100
  - Imports are resolved relative to the `overlays/` directory
42
- - Shared files are merged into the overlay during composition
43
- - Files are applied in the order they are listed
101
+ - Path traversal (`../`, absolute paths, non-`.shared/` prefixes) is rejected at composition time
102
+ - Missing or unsupported file types cause generation to fail with a message naming the overlay and the bad reference
@@ -0,0 +1,60 @@
1
+ # Common Docker Compose Healthcheck Patterns
2
+
3
+ Reference library of standard healthcheck patterns for common services. This is a **documentation file only** — it cannot be imported via `overlay.yml` `imports:` because it is not a devcontainer patch.
4
+
5
+ Copy the relevant pattern directly into your overlay's `docker-compose.yml`.
6
+
7
+ ## HTTP
8
+
9
+ ```yaml
10
+ healthcheck:
11
+ test: ['CMD-SHELL', 'curl -f http://localhost:${PORT}/health || exit 1']
12
+ interval: 30s
13
+ timeout: 10s
14
+ retries: 3
15
+ start_period: 40s
16
+ ```
17
+
18
+ ## PostgreSQL
19
+
20
+ ```yaml
21
+ healthcheck:
22
+ test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-postgres}']
23
+ interval: 10s
24
+ timeout: 5s
25
+ retries: 5
26
+ start_period: 10s
27
+ ```
28
+
29
+ ## Redis
30
+
31
+ ```yaml
32
+ healthcheck:
33
+ test: ['CMD', 'redis-cli', 'ping']
34
+ interval: 10s
35
+ timeout: 5s
36
+ retries: 5
37
+ start_period: 10s
38
+ ```
39
+
40
+ ## MongoDB
41
+
42
+ ```yaml
43
+ healthcheck:
44
+ test: ['CMD', 'mongosh', '--eval', "db.adminCommand('ping')"]
45
+ interval: 10s
46
+ timeout: 5s
47
+ retries: 5
48
+ start_period: 10s
49
+ ```
50
+
51
+ ## MySQL
52
+
53
+ ```yaml
54
+ healthcheck:
55
+ test: ['CMD', 'mysqladmin', 'ping', '-h', 'localhost']
56
+ interval: 10s
57
+ timeout: 5s
58
+ retries: 5
59
+ start_period: 10s
60
+ ```
@@ -1,14 +1,18 @@
1
1
  {
2
- "description": "Commonly recommended VS Code extensions across overlays",
3
- "extensions": {
4
- "productivity": [
5
- "streetsidesoftware.code-spell-checker",
6
- "usernamehw.errorlens",
7
- "eamodio.gitlens"
8
- ],
9
- "formatting": ["editorconfig.editorconfig", "esbenp.prettier-vscode"],
10
- "docker": ["ms-azuretools.vscode-docker"],
11
- "yaml": ["redhat.vscode-yaml"],
12
- "markdown": ["yzhang.markdown-all-in-one", "davidanson.vscode-markdownlint"]
2
+ "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json",
3
+ "customizations": {
4
+ "vscode": {
5
+ "extensions": [
6
+ "streetsidesoftware.code-spell-checker",
7
+ "usernamehw.errorlens",
8
+ "eamodio.gitlens",
9
+ "editorconfig.editorconfig",
10
+ "esbenp.prettier-vscode",
11
+ "ms-azuretools.vscode-docker",
12
+ "redhat.vscode-yaml",
13
+ "yzhang.markdown-all-in-one",
14
+ "davidanson.vscode-markdownlint"
15
+ ]
16
+ }
13
17
  }
14
18
  }
@@ -5,26 +5,11 @@ set -e
5
5
 
6
6
  echo "🔧 Setting up Alertmanager integration..."
7
7
 
8
- # Determine workspace root dynamically to support both /workspaces/* and /workspace layouts
9
- WORKSPACE_ROOT="${LOCAL_WORKSPACE_FOLDER:-$PWD}"
8
+ # Resolve the .devcontainer directory relative to this script.
9
+ # Scripts live at .devcontainer/scripts/, so .. is always .devcontainer/.
10
+ DEVCONTAINER_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. && pwd)"
10
11
 
11
- # If the current root does not contain a .devcontainer, try common devcontainer locations
12
- if [ ! -d "$WORKSPACE_ROOT/.devcontainer" ]; then
13
- # Try to detect a workspace under /workspaces (compose templates)
14
- if [ -d "/workspaces" ]; then
15
- FIRST_WORKSPACE_DIR="$(find /workspaces -maxdepth 1 -mindepth 1 -type d 2>/dev/null | head -n 1)"
16
- if [ -n "$FIRST_WORKSPACE_DIR" ] && [ -d "$FIRST_WORKSPACE_DIR/.devcontainer" ]; then
17
- WORKSPACE_ROOT="$FIRST_WORKSPACE_DIR"
18
- fi
19
- fi
20
- fi
21
-
22
- # Fallback to /workspace if it exists and contains a .devcontainer (non-compose setups)
23
- if [ ! -d "$WORKSPACE_ROOT/.devcontainer" ] && [ -d "/workspace/.devcontainer" ]; then
24
- WORKSPACE_ROOT="/workspace"
25
- fi
26
-
27
- PROMETHEUS_CONFIG="$WORKSPACE_ROOT/.devcontainer/prometheus-prometheus.yml"
12
+ PROMETHEUS_CONFIG="$DEVCONTAINER_DIR/prometheus-prometheus.yml"
28
13
 
29
14
  # Check if Prometheus config exists
30
15
  if [ -f "$PROMETHEUS_CONFIG" ]; then
@@ -6,19 +6,18 @@ echo "🔍 Verifying Alertmanager installation..."
6
6
  # Track overall success
7
7
  ALL_CHECKS_PASSED=true
8
8
 
9
- # Check if Alertmanager service is running
10
- if docker ps --format '{{.Names}}' | grep -q alertmanager; then
11
- echo " Alertmanager service is running"
9
+ # Check if Alertmanager API is accessible (primary health signal).
10
+ # docker ps is used for info only it may not be accessible in all setups.
11
+ if curl -s -o /dev/null -w "%{http_code}" http://alertmanager:9093/-/healthy 2>/dev/null | grep -q "200"; then
12
+ echo "✓ Alertmanager API is accessible"
12
13
  else
13
- echo "✗ Alertmanager service is not running"
14
+ echo "✗ Alertmanager API not responding (http://alertmanager:9093/-/healthy)"
14
15
  ALL_CHECKS_PASSED=false
15
16
  fi
16
17
 
17
- # Check if Alertmanager API is accessible
18
- if curl -s -o /dev/null -w "%{http_code}" http://alertmanager:9093/-/healthy 2>/dev/null | grep -q "200"; then
19
- echo "✓ Alertmanager API is accessible"
20
- else
21
- echo "⚠️ Alertmanager API not responding yet (may still be starting)"
18
+ # Informational: check via docker ps if available.
19
+ if docker ps --format '{{.Names}}' 2>/dev/null | grep -q alertmanager; then
20
+ echo "✓ Alertmanager container visible in docker ps"
22
21
  fi
23
22
 
24
23
  # Final result
@@ -0,0 +1,43 @@
1
+ # Meta Overlay
2
+
3
+ Internal testing overlay that activates **all available overlays** at once. Used to verify that the full overlay catalogue can be composed without errors.
4
+
5
+ > **Not shown in the interactive questionnaire.** Use it directly in a `superposition.yml` or test script.
6
+
7
+ ## Purpose
8
+
9
+ The `all` overlay exists to make CI/integration testing straightforward: selecting it expands to every non-preset, non-hidden overlay in the live registry, exercising the full composition pipeline in one pass.
10
+
11
+ ```yaml
12
+ # superposition.yml
13
+ stack: compose
14
+ containerName: meta-test
15
+ overlays:
16
+ - all
17
+ outputPath: .devcontainer
18
+ ```
19
+
20
+ ## How expansion works
21
+
22
+ There is no `requires` list in `overlays/all/overlay.yml`. Instead, the dependency resolver in
23
+ `resolveDependencies()` detects the special `all` overlay ID and replaces it with the full live
24
+ overlay registry (excluding hidden and preset overlays) at resolution time. This means:
25
+
26
+ - New overlays are automatically included the moment they are added to the catalogue — no manual
27
+ update to this file is needed.
28
+ - The expansion is driven by the live registry, not a hard-coded list.
29
+
30
+ ## Conflicts
31
+
32
+ Some overlays expanded from `all` are mutually exclusive at runtime:
33
+
34
+ | Conflict | Details |
35
+ | ---------------------------------- | ------------------------------------------------------- |
36
+ | `docker-in-docker` ↔ `docker-sock` | Two different Docker access strategies — cannot coexist |
37
+
38
+ The composer will emit warnings for these conflicts. They are expected and do not block the build. The intent is to test patch composition, not to produce a runnable container.
39
+
40
+ ## References
41
+
42
+ - [Overlay authoring guide](../../docs/creating-overlays.md)
43
+ - [All overlays](../../docs/overlays.md)
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json",
3
+ "features": {},
4
+ "customizations": {},
5
+ "forwardPorts": []
6
+ }
@@ -0,0 +1,14 @@
1
+ id: all
2
+ name: All Overlays
3
+ description: Internal testing overlay that activates all available overlays to verify the full build
4
+ category: dev
5
+ hidden: true
6
+ supports: []
7
+ requires: []
8
+ suggests: []
9
+ conflicts: []
10
+ tags:
11
+ - internal
12
+ - testing
13
+ - all
14
+ ports: []
@@ -3,6 +3,11 @@
3
3
 
4
4
  set -e
5
5
 
6
+ # Source shared setup utilities (provides load_nvm)
7
+ # shellcheck source=setup-utils.sh
8
+ source "$(dirname "${BASH_SOURCE[0]}")/setup-utils.sh"
9
+ load_nvm
10
+
6
11
  echo "📦 Installing Sourcegraph Amp CLI..."
7
12
 
8
13
  # Install @sourcegraph/amp globally
@@ -34,7 +34,7 @@ if ! command -v bun &> /dev/null; then
34
34
  BUN_URL="https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-${BUN_ARCH}.zip"
35
35
 
36
36
  echo " Downloading Bun version ${BUN_VERSION} for ${ARCH}..."
37
- if ! wget "${BUN_URL}" -O /tmp/bun.zip 2>&1; then
37
+ if ! wget -q "${BUN_URL}" -O /tmp/bun.zip; then
38
38
  echo " ❌ Failed to download Bun from ${BUN_URL}"
39
39
  exit 1
40
40
  fi
@@ -61,6 +61,15 @@ fi
61
61
  export BUN_INSTALL="$HOME/.bun"
62
62
  export PATH="$BUN_INSTALL/bin:$PATH"
63
63
 
64
+ # Persist PATH so verify script (and interactive shells) can find bun
65
+ for _shell_rc in "$HOME/.bashrc" "$HOME/.profile"; do
66
+ if [ -f "$_shell_rc" ] && ! grep -q 'BUN_INSTALL' "$_shell_rc" 2>/dev/null; then
67
+ echo 'export BUN_INSTALL="$HOME/.bun"' >> "$_shell_rc"
68
+ echo 'export PATH="$BUN_INSTALL/bin:$PATH"' >> "$_shell_rc"
69
+ fi
70
+ done
71
+ unset _shell_rc
72
+
64
73
  # Verify installation
65
74
  if command -v bun &> /dev/null; then
66
75
  INSTALLED_VERSION=$(bun --version)