container-superposition 0.1.4 → 0.1.6
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/README.md +74 -1370
- package/dist/scripts/init.js +350 -185
- package/dist/scripts/init.js.map +1 -1
- package/dist/tool/commands/adopt.d.ts +63 -0
- package/dist/tool/commands/adopt.d.ts.map +1 -0
- package/dist/tool/commands/adopt.js +1104 -0
- package/dist/tool/commands/adopt.js.map +1 -0
- package/dist/tool/commands/hash.d.ts +36 -0
- package/dist/tool/commands/hash.d.ts.map +1 -0
- package/dist/tool/commands/hash.js +242 -0
- package/dist/tool/commands/hash.js.map +1 -0
- package/dist/tool/commands/plan.d.ts +2 -0
- package/dist/tool/commands/plan.d.ts.map +1 -1
- package/dist/tool/commands/plan.js +262 -42
- package/dist/tool/commands/plan.js.map +1 -1
- package/dist/tool/schema/project-config.d.ts +17 -0
- package/dist/tool/schema/project-config.d.ts.map +1 -0
- package/dist/tool/schema/project-config.js +441 -0
- package/dist/tool/schema/project-config.js.map +1 -0
- package/dist/tool/schema/types.d.ts +39 -1
- package/dist/tool/schema/types.d.ts.map +1 -1
- package/dist/tool/utils/backup.d.ts +23 -0
- package/dist/tool/utils/backup.d.ts.map +1 -0
- package/dist/tool/utils/backup.js +123 -0
- package/dist/tool/utils/backup.js.map +1 -0
- package/docs/README.md +12 -2
- package/docs/adopt.md +202 -0
- package/docs/custom-patches.md +1 -1
- package/docs/discovery-commands.md +55 -3
- package/docs/examples.md +40 -6
- package/docs/filesystem-contract.md +58 -0
- package/docs/hash.md +183 -0
- package/docs/minimal-and-editor.md +1 -1
- package/docs/overlays.md +70 -0
- package/docs/presets-architecture.md +1 -1
- package/docs/presets.md +1 -1
- package/docs/publishing.md +36 -23
- package/docs/security.md +43 -0
- package/docs/specs/001-verbose-plan-graph/checklists/requirements.md +36 -0
- package/docs/specs/001-verbose-plan-graph/contracts/plan-verbose-output.md +96 -0
- package/docs/specs/001-verbose-plan-graph/data-model.md +111 -0
- package/docs/specs/001-verbose-plan-graph/plan.md +127 -0
- package/docs/specs/001-verbose-plan-graph/quickstart.md +106 -0
- package/docs/specs/001-verbose-plan-graph/research.md +100 -0
- package/docs/specs/001-verbose-plan-graph/spec.md +128 -0
- package/docs/specs/001-verbose-plan-graph/tasks.md +223 -0
- package/docs/specs/002-superposition-config-file/checklists/requirements.md +36 -0
- package/docs/specs/002-superposition-config-file/contracts/init-project-config.md +98 -0
- package/docs/specs/002-superposition-config-file/data-model.md +126 -0
- package/docs/specs/002-superposition-config-file/plan.md +213 -0
- package/docs/specs/002-superposition-config-file/quickstart.md +140 -0
- package/docs/specs/002-superposition-config-file/research.md +144 -0
- package/docs/specs/002-superposition-config-file/spec.md +136 -0
- package/docs/specs/002-superposition-config-file/tasks.md +215 -0
- package/docs/team-workflow.md +33 -1
- package/docs/workflows.md +139 -0
- package/features/cross-distro-packages/README.md +18 -0
- package/features/cross-distro-packages/devcontainer-feature.json +3 -3
- package/features/cross-distro-packages/install.sh +49 -7
- package/overlays/.presets/sdd.yml +84 -0
- package/overlays/README.md +7 -1
- package/overlays/amp/README.md +70 -0
- package/overlays/amp/devcontainer.patch.json +3 -0
- package/overlays/amp/overlay.yml +15 -0
- package/overlays/amp/setup.sh +21 -0
- package/overlays/amp/verify.sh +21 -0
- package/overlays/claude-code/README.md +83 -0
- package/overlays/claude-code/devcontainer.patch.json +3 -0
- package/overlays/claude-code/overlay.yml +15 -0
- package/overlays/claude-code/setup.sh +21 -0
- package/overlays/claude-code/verify.sh +21 -0
- package/overlays/gemini-cli/README.md +77 -0
- package/overlays/gemini-cli/devcontainer.patch.json +3 -0
- package/overlays/gemini-cli/overlay.yml +15 -0
- package/overlays/gemini-cli/setup.sh +21 -0
- package/overlays/gemini-cli/verify.sh +21 -0
- package/overlays/opencode/README.md +76 -0
- package/overlays/opencode/devcontainer.patch.json +3 -0
- package/overlays/opencode/overlay.yml +14 -0
- package/overlays/opencode/setup.sh +21 -0
- package/overlays/opencode/verify.sh +21 -0
- package/overlays/pandoc/README.md +279 -0
- package/overlays/pandoc/devcontainer.patch.json +14 -0
- package/overlays/pandoc/overlay.yml +19 -0
- package/overlays/pandoc/setup.sh +94 -0
- package/overlays/pandoc/verify.sh +13 -0
- package/overlays/spec-kit/README.md +181 -0
- package/overlays/spec-kit/devcontainer.patch.json +6 -0
- package/overlays/spec-kit/overlay.yml +19 -0
- package/overlays/spec-kit/setup.sh +45 -0
- package/overlays/spec-kit/verify.sh +33 -0
- package/overlays/windsurf-cli/README.md +69 -0
- package/overlays/windsurf-cli/devcontainer.patch.json +3 -0
- package/overlays/windsurf-cli/overlay.yml +15 -0
- package/overlays/windsurf-cli/setup.sh +21 -0
- package/overlays/windsurf-cli/verify.sh +21 -0
- package/package.json +1 -1
- package/tool/schema/config.schema.json +138 -9
package/README.md
CHANGED
|
@@ -4,1401 +4,105 @@
|
|
|
4
4
|
[](https://github.com/veggerby/container-superposition/actions/workflows/build-devcontainers.yml)
|
|
5
5
|
[](https://www.npmjs.com/package/container-superposition)
|
|
6
6
|
|
|
7
|
-
Composable devcontainer scaffolds that collapse into
|
|
7
|
+
Composable devcontainer scaffolds that collapse into normal, editable configs.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Development Policy
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This project follows spec-first development. Every feature MUST start with a
|
|
12
|
+
reviewed spec committed under `docs/specs/` before implementation code is
|
|
13
|
+
written.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
# Web API with database and observability (Node.js)
|
|
15
|
-
npx container-superposition init --preset web-api --language nodejs
|
|
16
|
-
# Creates: Node.js + PostgreSQL + Redis + Grafana + Prometheus + Loki
|
|
17
|
-
|
|
18
|
-
# Or compose + specific language
|
|
19
|
-
npx container-superposition init --stack compose --language nodejs --database postgres
|
|
20
|
-
# Creates: Node.js + PostgreSQL devcontainer
|
|
21
|
-
|
|
22
|
-
# Then open in VS Code
|
|
23
|
-
code .
|
|
24
|
-
# Click "Reopen in Container" when prompted
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**That's it!** Your devcontainer is ready. Jump to [Quick Start](#-quick-start) for more options or [Examples](#-examples) for real-world references.
|
|
28
|
-
|
|
29
|
-
### 👁️ Preview Before You Commit
|
|
30
|
-
|
|
31
|
-
Use the `plan` command to see exactly what will be created:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npx container-superposition plan --stack compose --overlays nodejs,postgres,grafana,prometheus
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
**Example output:**
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
╭──────────────────╮
|
|
41
|
-
│ Generation Plan │
|
|
42
|
-
╰──────────────────╯
|
|
43
|
-
|
|
44
|
-
Stack: compose
|
|
45
|
-
|
|
46
|
-
Overlays Selected:
|
|
47
|
-
✓ nodejs (Node.js)
|
|
48
|
-
✓ postgres (PostgreSQL)
|
|
49
|
-
✓ grafana (Grafana)
|
|
50
|
-
✓ prometheus (Prometheus)
|
|
51
|
-
|
|
52
|
-
Port Mappings:
|
|
53
|
-
postgres: 5432
|
|
54
|
-
grafana: 3000
|
|
55
|
-
prometheus: 9090
|
|
56
|
-
|
|
57
|
-
Files to Create/Modify:
|
|
58
|
-
.devcontainer/
|
|
59
|
-
📄 .env.example
|
|
60
|
-
📄 README.md
|
|
61
|
-
📄 devcontainer.json
|
|
62
|
-
📄 docker-compose.yml
|
|
63
|
-
📄 global-packages-nodejs.txt
|
|
64
|
-
📄 ports.json
|
|
65
|
-
📄 superposition.json
|
|
66
|
-
.devcontainer/scripts/
|
|
67
|
-
📄 setup-nodejs.sh
|
|
68
|
-
📄 verify-grafana.sh
|
|
69
|
-
📄 verify-nodejs.sh
|
|
70
|
-
📄 verify-postgres.sh
|
|
71
|
-
📄 verify-prometheus.sh
|
|
72
|
-
|
|
73
|
-
✓ No conflicts detected. Ready to generate!
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
This gives you full visibility into the configuration before any files are created.
|
|
77
|
-
|
|
78
|
-
## 🎯 Purpose
|
|
79
|
-
|
|
80
|
-
Container Superposition provides a **modular, overlay-based system** for building devcontainer configurations. Start with a minimal base template, then compose it with language frameworks, databases, observability tools, and cloud utilities to create your ideal development environment.
|
|
81
|
-
|
|
82
|
-
**Key Principles:**
|
|
83
|
-
|
|
84
|
-
- **Leverage, Don't Duplicate** - Use official images and features from containers.dev
|
|
85
|
-
- **Minimal Base + Composable Overlays** - Start simple, add what you need
|
|
86
|
-
- **Copy-Paste Ready** - Works immediately, customize as needed
|
|
87
|
-
- **Observability First-Class** - Full OpenTelemetry stack available as overlays
|
|
88
|
-
|
|
89
|
-
## 📋 Philosophy: Opinionated with Battle-Tested Defaults
|
|
90
|
-
|
|
91
|
-
This tool is **opinionated by design**, providing carefully curated configurations that have been tested in real-world development scenarios:
|
|
92
|
-
|
|
93
|
-
- **🎯 Battle-Tested Defaults** - Base images and configurations are chosen based on proven stability and broad compatibility
|
|
94
|
-
- **🔧 Customization Available** - While we provide sensible defaults, you can customize base images and configurations
|
|
95
|
-
- **⚠️ With Great Power...** - Custom images may introduce conflicts with overlays; test thoroughly
|
|
96
|
-
- **📝 Editable Output** - Generated configurations are plain JSON/YAML you can modify post-generation
|
|
97
|
-
|
|
98
|
-
**Default Base Image**: `mcr.microsoft.com/devcontainers/base:bookworm` (Debian Bookworm)
|
|
99
|
-
|
|
100
|
-
- Well-maintained by Microsoft
|
|
101
|
-
- Broad compatibility with devcontainer features
|
|
102
|
-
- Regular security updates
|
|
103
|
-
- Proven stability across diverse projects
|
|
104
|
-
|
|
105
|
-
**Alternative Base Images**:
|
|
106
|
-
|
|
107
|
-
- **Debian Trixie**: Newer packages, testing stability
|
|
108
|
-
- **Alpine Linux**: Minimal footprint (~5MB), ideal for resource-constrained environments
|
|
109
|
-
- **Ubuntu LTS**: Popular, familiar, extensive package ecosystem
|
|
110
|
-
- **Custom Images**: Specify your own, but be aware of potential overlay conflicts
|
|
111
|
-
|
|
112
|
-
All overlays are designed to work across Debian, Alpine, and Ubuntu bases with automatic package manager detection.
|
|
113
|
-
|
|
114
|
-
## 📁 Structure
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
container-superposition/
|
|
118
|
-
├── templates/ # Minimal base templates (plain, compose)
|
|
119
|
-
│ ├── plain/ # Simple image-based devcontainer
|
|
120
|
-
│ └── compose/ # Docker Compose-based devcontainer
|
|
121
|
-
├── overlays/ # Composable capability overlays
|
|
122
|
-
│ ├── index.yml # Overlay registry and metadata
|
|
123
|
-
│ ├── presets/ # Stack presets (meta-overlays)
|
|
124
|
-
│ │ ├── web-api.yml
|
|
125
|
-
│ │ ├── microservice.yml
|
|
126
|
-
│ │ ├── docs-site.yml
|
|
127
|
-
│ │ └── fullstack.yml
|
|
128
|
-
│ ├── dotnet/ # Language overlays
|
|
129
|
-
│ ├── nodejs/
|
|
130
|
-
│ ├── python/
|
|
131
|
-
│ ├── mkdocs/
|
|
132
|
-
│ ├── bun/
|
|
133
|
-
│ ├── go/
|
|
134
|
-
│ ├── java/
|
|
135
|
-
│ ├── rust/
|
|
136
|
-
│ ├── powershell/
|
|
137
|
-
│ ├── postgres/ # Database/messaging overlays
|
|
138
|
-
│ ├── redis/
|
|
139
|
-
│ ├── mongodb/
|
|
140
|
-
│ ├── mysql/
|
|
141
|
-
│ ├── sqlite/
|
|
142
|
-
│ ├── sqlserver/
|
|
143
|
-
│ ├── minio/
|
|
144
|
-
│ ├── rabbitmq/
|
|
145
|
-
│ ├── redpanda/
|
|
146
|
-
│ ├── nats/
|
|
147
|
-
│ ├── otel-collector/ # Observability overlays
|
|
148
|
-
│ ├── jaeger/
|
|
149
|
-
│ ├── prometheus/
|
|
150
|
-
│ ├── grafana/
|
|
151
|
-
│ ├── loki/
|
|
152
|
-
│ ├── tempo/
|
|
153
|
-
│ ├── alertmanager/
|
|
154
|
-
│ ├── promtail/
|
|
155
|
-
│ ├── otel-demo-nodejs/
|
|
156
|
-
│ ├── otel-demo-python/
|
|
157
|
-
│ ├── aws-cli/ # Cloud tool overlays
|
|
158
|
-
│ ├── azure-cli/
|
|
159
|
-
│ ├── gcloud/
|
|
160
|
-
│ ├── kubectl-helm/
|
|
161
|
-
│ ├── terraform/
|
|
162
|
-
│ ├── pulumi/
|
|
163
|
-
│ ├── docker-in-docker/ # Dev tool overlays
|
|
164
|
-
│ ├── docker-sock/
|
|
165
|
-
│ ├── playwright/
|
|
166
|
-
│ ├── codex/
|
|
167
|
-
│ ├── git-helpers/
|
|
168
|
-
│ ├── pre-commit/
|
|
169
|
-
│ ├── commitlint/
|
|
170
|
-
│ ├── just/
|
|
171
|
-
│ ├── direnv/
|
|
172
|
-
│ ├── modern-cli-tools/
|
|
173
|
-
│ └── ngrok/
|
|
174
|
-
├── features/ # Custom devcontainer features
|
|
175
|
-
├── tool/ # Composition logic and schema
|
|
176
|
-
│ ├── questionnaire/ # Composition engine
|
|
177
|
-
│ └── schema/ # TypeScript types and JSON schema
|
|
178
|
-
├── docs/ # Complete documentation
|
|
179
|
-
│ ├── presets.md # Stack presets guide
|
|
180
|
-
│ └── ...
|
|
181
|
-
└── scripts/ # CLI entry points
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### `/templates` - Minimal Base Templates
|
|
185
|
-
|
|
186
|
-
Two foundational templates that serve as starting points:
|
|
187
|
-
|
|
188
|
-
- **plain** - Simple image-based devcontainer with essential tools
|
|
189
|
-
- **compose** - Docker Compose-based for multi-service environments
|
|
190
|
-
|
|
191
|
-
Each template is minimal by design. Capabilities are added via overlays.
|
|
192
|
-
|
|
193
|
-
### `/overlays` - Composable Capabilities
|
|
194
|
-
|
|
195
|
-
Overlays are modular configuration fragments organized by category:
|
|
196
|
-
|
|
197
|
-
**Language & Framework:**
|
|
198
|
-
|
|
199
|
-
- **dotnet** - .NET SDK with C# development tools
|
|
200
|
-
- **nodejs** - Node.js LTS with npm and TypeScript support
|
|
201
|
-
- **python** - Python with pip and common data science tools
|
|
202
|
-
- **mkdocs** - MkDocs for documentation sites
|
|
203
|
-
- **bun** - Bun JavaScript runtime and toolkit
|
|
204
|
-
- **go** - Go programming language
|
|
205
|
-
- **java** - Java Development Kit
|
|
206
|
-
- **rust** - Rust programming language
|
|
207
|
-
- **powershell** - PowerShell Core
|
|
208
|
-
|
|
209
|
-
**Databases & Message Brokers:**
|
|
210
|
-
|
|
211
|
-
- **postgres** - PostgreSQL relational database
|
|
212
|
-
- **redis** - Redis in-memory data store
|
|
213
|
-
- **mongodb** - MongoDB document database
|
|
214
|
-
- **mysql** - MySQL relational database
|
|
215
|
-
- **sqlite** - SQLite embedded database
|
|
216
|
-
- **sqlserver** - Microsoft SQL Server
|
|
217
|
-
- **minio** - MinIO S3-compatible object storage
|
|
218
|
-
- **rabbitmq** - RabbitMQ message broker (AMQP)
|
|
219
|
-
- **redpanda** - Redpanda Kafka-compatible streaming
|
|
220
|
-
- **nats** - NATS messaging system
|
|
221
|
-
|
|
222
|
-
**Observability:**
|
|
223
|
-
|
|
224
|
-
- **otel-collector** - OpenTelemetry Collector (telemetry pipeline)
|
|
225
|
-
- **jaeger** - Jaeger distributed tracing
|
|
226
|
-
- **prometheus** - Prometheus metrics collection
|
|
227
|
-
- **grafana** - Grafana visualization and dashboards
|
|
228
|
-
- **loki** - Loki log aggregation
|
|
229
|
-
- **tempo** - Tempo distributed tracing backend
|
|
230
|
-
- **alertmanager** - Prometheus Alertmanager
|
|
231
|
-
- **promtail** - Promtail log collector for Loki
|
|
232
|
-
- **otel-demo-nodejs** - OpenTelemetry demo app (Node.js)
|
|
233
|
-
- **otel-demo-python** - OpenTelemetry demo app (Python)
|
|
234
|
-
|
|
235
|
-
**Cloud Tools:**
|
|
236
|
-
|
|
237
|
-
- **aws-cli** - AWS Command Line Interface
|
|
238
|
-
- **azure-cli** - Azure Command Line Interface
|
|
239
|
-
- **gcloud** - Google Cloud SDK
|
|
240
|
-
- **kubectl-helm** - Kubernetes CLI and Helm package manager
|
|
241
|
-
- **terraform** - Terraform infrastructure as code
|
|
242
|
-
- **pulumi** - Pulumi infrastructure as code
|
|
243
|
-
|
|
244
|
-
**Dev Tools:**
|
|
245
|
-
|
|
246
|
-
- **docker-in-docker** - Docker daemon in container
|
|
247
|
-
- **docker-sock** - Access to host Docker daemon
|
|
248
|
-
- **playwright** - Playwright browser automation
|
|
249
|
-
- **codex** - Codex AI coding assistant
|
|
250
|
-
- **git-helpers** - Git with LFS, GPG, GitHub CLI
|
|
251
|
-
- **pre-commit** - Pre-commit hook framework
|
|
252
|
-
- **commitlint** - Commit message linting
|
|
253
|
-
- **just** - Just command runner
|
|
254
|
-
- **direnv** - Directory-based environment variables
|
|
255
|
-
- **modern-cli-tools** - Modern alternatives (ripgrep, fd, bat, jq, yq)
|
|
256
|
-
- **ngrok** - Ngrok secure tunnels
|
|
257
|
-
|
|
258
|
-
Each overlay includes:
|
|
259
|
-
|
|
260
|
-
- `devcontainer.patch.json` - Configuration to merge
|
|
261
|
-
- `docker-compose.yml` (if needed) - Service definitions
|
|
262
|
-
- `.env.example` - Environment variables
|
|
263
|
-
- Configuration files (e.g., `otel-collector-config.yaml`)
|
|
264
|
-
- README with usage instructions
|
|
265
|
-
|
|
266
|
-
### `/features` - Custom Building Blocks
|
|
267
|
-
|
|
268
|
-
Custom devcontainer features that add value beyond containers.dev:
|
|
269
|
-
|
|
270
|
-
- **cross-distro-packages** - Cross-distribution package manager with automatic distro detection (apt/apk)
|
|
271
|
-
- **project-scaffolder** - Interactive project initialization
|
|
272
|
-
- **team-conventions** - Shared linting, formatting, commit standards
|
|
273
|
-
- **local-secrets-manager** - Safe local development secrets
|
|
274
|
-
|
|
275
|
-
## 🚀 Quick Start
|
|
276
|
-
|
|
277
|
-
### Via npx (Recommended)
|
|
278
|
-
|
|
279
|
-
No installation required! Use npx to run the tool directly:
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
# Interactive mode - guided questionnaire
|
|
283
|
-
npx container-superposition init
|
|
284
|
-
|
|
285
|
-
# With CLI flags - skip to your stack
|
|
286
|
-
npx container-superposition init --stack compose --language nodejs --database postgres
|
|
287
|
-
|
|
288
|
-
# List all available overlays
|
|
289
|
-
npx container-superposition list
|
|
290
|
-
|
|
291
|
-
# Check your environment
|
|
292
|
-
npx container-superposition doctor
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### Global Installation (Optional)
|
|
296
|
-
|
|
297
|
-
Install globally for faster repeated use:
|
|
298
|
-
|
|
299
|
-
```bash
|
|
300
|
-
# Install globally
|
|
301
|
-
npm install -g container-superposition
|
|
302
|
-
|
|
303
|
-
# Now use without npx
|
|
304
|
-
container-superposition init
|
|
305
|
-
container-superposition list
|
|
306
|
-
container-superposition doctor
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### From Source (Development)
|
|
310
|
-
|
|
311
|
-
For contributors or those who want to modify the tool:
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
# Clone the repository
|
|
315
|
-
git clone https://github.com/veggerby/container-superposition.git
|
|
316
|
-
cd container-superposition
|
|
317
|
-
|
|
318
|
-
# Install dependencies
|
|
319
|
-
npm install
|
|
320
|
-
|
|
321
|
-
# Run the interactive setup
|
|
322
|
-
npm run init
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
### Available Commands
|
|
326
|
-
|
|
327
|
-
- **`init`** - Initialize a new devcontainer configuration (default command)
|
|
328
|
-
- **`regen`** - Regenerate devcontainer from existing manifest
|
|
329
|
-
- **`list`** - List all available overlays and presets with filtering options
|
|
330
|
-
- **`explain`** - Show detailed information about a specific overlay
|
|
331
|
-
- **`plan`** - Preview what will be generated before creating devcontainer
|
|
332
|
-
- **`doctor`** - Check environment and validate configuration
|
|
333
|
-
|
|
334
|
-
#### Discovery Commands
|
|
335
|
-
|
|
336
|
-
**List available overlays:**
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
# List all overlays grouped by category
|
|
340
|
-
npx container-superposition list
|
|
341
|
-
|
|
342
|
-
# Filter by category
|
|
343
|
-
npx container-superposition list --category database
|
|
344
|
-
|
|
345
|
-
# Filter by tags
|
|
346
|
-
npx container-superposition list --tags observability
|
|
347
|
-
|
|
348
|
-
# Filter by stack support
|
|
349
|
-
npx container-superposition list --supports compose
|
|
350
|
-
|
|
351
|
-
# JSON output for scripting
|
|
352
|
-
npx container-superposition list --json
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
**Explain an overlay in detail:**
|
|
356
|
-
|
|
357
|
-
```bash
|
|
358
|
-
# Show detailed information about an overlay
|
|
359
|
-
npx container-superposition explain postgres
|
|
360
|
-
|
|
361
|
-
# JSON output
|
|
362
|
-
npx container-superposition explain nodejs --json
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
**Plan before generating:**
|
|
366
|
-
|
|
367
|
-
```bash
|
|
368
|
-
# Preview what will be created
|
|
369
|
-
npx container-superposition plan --stack compose --overlays postgres,grafana
|
|
370
|
-
|
|
371
|
-
# Include port offset
|
|
372
|
-
npx container-superposition plan --stack compose --overlays postgres,redis --port-offset 100
|
|
373
|
-
|
|
374
|
-
# JSON output
|
|
375
|
-
npx container-superposition plan --stack compose --overlays nodejs,postgres --json
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
The `plan` command shows:
|
|
379
|
-
|
|
380
|
-
- Selected overlays and auto-added dependencies
|
|
381
|
-
- Port mappings (with offset applied)
|
|
382
|
-
- Files that will be created/modified
|
|
383
|
-
- Conflict detection
|
|
384
|
-
|
|
385
|
-
#### Environment Validation
|
|
386
|
-
|
|
387
|
-
The `doctor` command provides comprehensive environment diagnostics:
|
|
388
|
-
|
|
389
|
-
```bash
|
|
390
|
-
# Check environment and configuration
|
|
391
|
-
npx container-superposition doctor
|
|
392
|
-
|
|
393
|
-
# Check specific devcontainer
|
|
394
|
-
npx container-superposition doctor --output /path/to/.devcontainer
|
|
395
|
-
|
|
396
|
-
# Get JSON output for CI/CD
|
|
397
|
-
npx container-superposition doctor --json
|
|
398
|
-
|
|
399
|
-
# Apply automatic fixes (where possible)
|
|
400
|
-
npx container-superposition doctor --fix
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
**Doctor checks:**
|
|
404
|
-
|
|
405
|
-
- ✅ Node.js version compatibility (>= 20)
|
|
406
|
-
- ✅ Docker daemon connectivity
|
|
407
|
-
- ✅ Docker Compose v2 availability (when using compose stack)
|
|
408
|
-
- ✅ Overlay integrity (valid manifests, required files)
|
|
409
|
-
- ✅ Manifest compatibility
|
|
410
|
-
- ⚠️ Port conflicts (best-effort detection)
|
|
411
|
-
|
|
412
|
-
**Example output:**
|
|
413
|
-
|
|
414
|
-
```
|
|
415
|
-
🔍 Running diagnostics...
|
|
416
|
-
|
|
417
|
-
Environment:
|
|
418
|
-
✓ Node.js version: v20.10.0 (>= 20.0.0 required)
|
|
419
|
-
✓ Docker daemon: Docker version 24.0.5
|
|
420
|
-
✓ Docker Compose: v2.23.0 (v2 required)
|
|
421
|
-
|
|
422
|
-
Overlays:
|
|
423
|
-
✓ All 46 overlays valid
|
|
424
|
-
|
|
425
|
-
Manifest:
|
|
426
|
-
✓ Manifest version: Format version 0.1.0
|
|
427
|
-
✓ DevContainer config: devcontainer.json valid
|
|
428
|
-
|
|
429
|
-
Summary:
|
|
430
|
-
✓ 51 passed
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
The questionnaire guides you through:
|
|
434
|
-
|
|
435
|
-
1. **Preset or Custom** - Start from a pre-configured stack or build custom?
|
|
436
|
-
2. **Base template** - plain or compose?
|
|
437
|
-
3. **Overlays** - All available overlays in one multi-select (language, databases, observability, cloud tools, dev tools)
|
|
438
|
-
4. **Output path** - Where to generate the configuration
|
|
439
|
-
|
|
440
|
-
#### Stack Presets (NEW!)
|
|
441
|
-
|
|
442
|
-
Quickly get started with common development scenarios:
|
|
443
|
-
|
|
444
|
-
**🌐 Web API Stack**
|
|
445
|
-
|
|
446
|
-
- Language choice (Node.js, .NET, Python, Go, Java)
|
|
447
|
-
- PostgreSQL + Redis
|
|
448
|
-
- Full observability (OTEL, Prometheus, Grafana, Loki)
|
|
449
|
-
- Pre-configured connection strings
|
|
450
|
-
|
|
451
|
-
**🔀 Microservice Stack**
|
|
452
|
-
|
|
453
|
-
- Language choice
|
|
454
|
-
- Message broker (RabbitMQ, Redpanda, NATS)
|
|
455
|
-
- Distributed tracing (Jaeger)
|
|
456
|
-
- Metrics & monitoring (Prometheus, Grafana)
|
|
457
|
-
|
|
458
|
-
**📚 Documentation Site**
|
|
459
|
-
|
|
460
|
-
- MkDocs + Python
|
|
461
|
-
- Pre-commit hooks
|
|
462
|
-
- Modern CLI tools
|
|
463
|
-
- GitHub Pages ready
|
|
464
|
-
|
|
465
|
-
**🎨 Full-Stack Application**
|
|
466
|
-
|
|
467
|
-
- Node.js frontend + Backend language choice
|
|
468
|
-
- PostgreSQL + Redis + MinIO
|
|
469
|
-
- Complete observability stack
|
|
470
|
-
|
|
471
|
-
See [docs/presets.md](docs/presets.md) for detailed preset documentation.
|
|
472
|
-
|
|
473
|
-
**Example compositions:**
|
|
15
|
+
## Quickstart
|
|
474
16
|
|
|
475
17
|
```bash
|
|
476
|
-
#
|
|
18
|
+
# Guided questionnaire
|
|
477
19
|
npx container-superposition init
|
|
478
|
-
# Select "Web API Stack" → Choose Node.js → Done!
|
|
479
|
-
|
|
480
|
-
# Node.js API with PostgreSQL and observability
|
|
481
|
-
npx container-superposition init --stack compose --language nodejs --database postgres --observability otel-collector,jaeger,prometheus,grafana
|
|
482
|
-
|
|
483
|
-
# .NET microservice with full observability stack
|
|
484
|
-
npx container-superposition init --stack compose --language dotnet --database postgres,redis --observability otel-collector,jaeger,prometheus,grafana,loki --cloud-tools aws-cli,kubectl-helm
|
|
485
|
-
|
|
486
|
-
# Go microservice with RabbitMQ messaging
|
|
487
|
-
npx container-superposition init --stack compose --language go --database rabbitmq,redis --observability jaeger,prometheus
|
|
488
|
-
|
|
489
|
-
# Rust development environment with modern CLI tools
|
|
490
|
-
npx container-superposition init --stack plain --language rust --dev-tools modern-cli-tools,git-helpers,pre-commit
|
|
491
|
-
|
|
492
|
-
# Java Spring Boot with MySQL
|
|
493
|
-
npx container-superposition init --stack compose --language java --database mysql,redis --cloud-tools kubectl-helm
|
|
494
|
-
|
|
495
|
-
# Python data science with MongoDB
|
|
496
|
-
npx container-superposition init --stack compose --language python --database mongodb
|
|
497
|
-
|
|
498
|
-
# Event-driven architecture with Redpanda
|
|
499
|
-
npx container-superposition init --stack compose --language nodejs --database redpanda,postgres --observability otel-collector,tempo,grafana
|
|
500
|
-
|
|
501
|
-
# Multi-cloud setup with Terraform
|
|
502
|
-
npx container-superposition init --stack plain --language python --cloud-tools aws-cli,azure-cli,gcloud,terraform,pulumi
|
|
503
|
-
|
|
504
|
-
# Full observability stack with demo apps
|
|
505
|
-
npx container-superposition init --stack compose --language nodejs --observability otel-collector,jaeger,prometheus,grafana,loki,tempo,otel-demo-nodejs
|
|
506
|
-
|
|
507
|
-
# Bun with MinIO object storage
|
|
508
|
-
npx container-superposition init --stack compose --language bun --database postgres,minio --dev-tools docker-sock
|
|
509
|
-
|
|
510
|
-
# Documentation site with MkDocs
|
|
511
|
-
npx container-superposition init --stack plain --language mkdocs --dev-tools pre-commit,modern-cli-tools
|
|
512
|
-
|
|
513
|
-
# PowerShell scripting environment
|
|
514
|
-
npx container-superposition init --stack plain --language powershell --cloud-tools aws-cli,azure-cli
|
|
515
|
-
```
|
|
516
|
-
|
|
517
|
-
**Port Offset for Multiple Instances:**
|
|
518
|
-
|
|
519
|
-
If you're running multiple devcontainer instances simultaneously (e.g., multiple microservices), use `--port-offset` to avoid port conflicts:
|
|
520
|
-
|
|
521
|
-
```bash
|
|
522
|
-
# Service 1 (default ports)
|
|
523
|
-
npm run init -- --stack compose --language nodejs --postgres --output ./service1
|
|
524
|
-
|
|
525
|
-
# Service 2 (ports shifted by 100)
|
|
526
|
-
npm run init -- --stack compose --language nodejs --postgres --port-offset 100 --output ./service2
|
|
527
|
-
|
|
528
|
-
# Service 3 (ports shifted by 200)
|
|
529
|
-
npm run init -- --stack compose --language nodejs --postgres --port-offset 200 --output ./service3
|
|
530
|
-
```
|
|
531
|
-
|
|
532
|
-
This automatically adjusts all exposed ports in docker-compose.yml and documents the offset in .env.example.
|
|
533
|
-
|
|
534
|
-
### Deployment Target Support
|
|
535
|
-
|
|
536
|
-
Container Superposition validates overlay compatibility with different deployment environments (local, Codespaces, Gitpod, DevPod) using the `--target` flag.
|
|
537
|
-
|
|
538
|
-
```bash
|
|
539
|
-
# Specify deployment target
|
|
540
|
-
npx container-superposition init --target codespaces
|
|
541
|
-
npx container-superposition init --target gitpod
|
|
542
|
-
npx container-superposition init --target local # default
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
The tool automatically validates overlay compatibility and warns you when selecting overlays that won't work in your target environment (e.g., `docker-sock` doesn't work in Codespaces).
|
|
546
|
-
|
|
547
|
-
**📖 See [Deployment Targets Documentation](docs/deployment-targets.md) for:**
|
|
548
|
-
|
|
549
|
-
- Complete target comparison table
|
|
550
|
-
- Interactive mode examples
|
|
551
|
-
- Environment-specific configuration
|
|
552
|
-
- Compatibility rules and best practices
|
|
553
|
-
|
|
554
|
-
### Overlay Compatibility Matrix
|
|
555
|
-
|
|
556
|
-
Common overlays and their compatibility with different deployment targets:
|
|
557
|
-
|
|
558
|
-
| Overlay | Local | Codespaces | Gitpod | Notes |
|
|
559
|
-
| -------------------- | ----- | ---------- | ------ | ---------------------------------------- |
|
|
560
|
-
| **docker-sock** | ✅ | ❌ | ❌ | Requires host Docker socket (local only) |
|
|
561
|
-
| **docker-in-docker** | ✅ | ✅ | ✅ | Slower but portable |
|
|
562
|
-
| **postgres** | ✅ | ✅ | ✅ | |
|
|
563
|
-
| **redis** | ✅ | ✅ | ✅ | |
|
|
564
|
-
| **mysql** | ✅ | ✅ | ✅ | |
|
|
565
|
-
| **mongodb** | ✅ | ✅ | ✅ | |
|
|
566
|
-
| **sqlserver** | ✅ | ✅ | ✅ | Needs memory (>2GB recommended) |
|
|
567
|
-
| **rabbitmq** | ✅ | ✅ | ✅ | |
|
|
568
|
-
| **grafana** | ✅ | ✅ | ✅ | |
|
|
569
|
-
| **prometheus** | ✅ | ✅ | ✅ | |
|
|
570
|
-
| **jaeger** | ✅ | ✅ | ✅ | |
|
|
571
|
-
| **playwright** | ✅ | ✅ | ✅ | Requires browser dependencies |
|
|
572
|
-
| **aws-cli** | ✅ | ✅ | ✅ | CLI tools work everywhere |
|
|
573
|
-
| **kubectl-helm** | ✅ | ✅ | ✅ | |
|
|
574
|
-
| **terraform** | ✅ | ✅ | ✅ | |
|
|
575
|
-
|
|
576
|
-
**Legend:**
|
|
577
|
-
|
|
578
|
-
- ✅ Fully supported
|
|
579
|
-
- ❌ Not supported (technical limitation)
|
|
580
|
-
|
|
581
|
-
The `--target` flag enables automatic validation during generation.
|
|
582
|
-
|
|
583
|
-
## ⚠️ Security Considerations
|
|
584
|
-
|
|
585
|
-
**Important:** Container Superposition is designed for **development environments only**. Be aware of these security implications:
|
|
586
|
-
|
|
587
|
-
### docker-sock Overlay
|
|
588
|
-
|
|
589
|
-
- **⚠️ Risk:** Provides **root-level access** to host Docker daemon
|
|
590
|
-
- **⚠️ Limitation:** Not supported in GitHub Codespaces (requires local Docker)
|
|
591
|
-
- **✅ Alternative:** Use `docker-in-docker` for isolation and portability
|
|
592
|
-
- **✅ When to use:** Local development only, trusted code only
|
|
593
|
-
|
|
594
|
-
**Why this matters:**
|
|
595
|
-
|
|
596
|
-
Mounting `/var/run/docker.sock` gives the container full control over the host's Docker daemon. A compromised container could:
|
|
597
|
-
|
|
598
|
-
- Access your entire filesystem via volume mounts
|
|
599
|
-
- Create privileged containers
|
|
600
|
-
- Effectively gain root access to your host machine
|
|
601
|
-
|
|
602
|
-
**Best practices:**
|
|
603
|
-
|
|
604
|
-
- ✅ Only use on your local development machine
|
|
605
|
-
- ✅ Never use in multi-tenant or production environments
|
|
606
|
-
- ✅ Audit containers created from within the devcontainer
|
|
607
|
-
- ❌ Don't use with untrusted code or dependencies
|
|
608
|
-
|
|
609
|
-
### Database Default Credentials
|
|
610
|
-
|
|
611
|
-
All database overlays (PostgreSQL, Redis, MySQL, etc.) use **development-only default credentials**:
|
|
612
|
-
|
|
613
|
-
- Default passwords like `postgres`, `redis`, `admin`
|
|
614
|
-
- No authentication enabled by default (where applicable)
|
|
615
|
-
- Designed for local development convenience
|
|
616
|
-
|
|
617
|
-
**Best practices:**
|
|
618
|
-
|
|
619
|
-
- ✅ Change default passwords for any networked testing
|
|
620
|
-
- ✅ Never expose database ports publicly
|
|
621
|
-
- ✅ Use `.env` (gitignored) for custom credentials
|
|
622
|
-
- ❌ Never commit real credentials to version control
|
|
623
|
-
|
|
624
|
-
### Environment Files
|
|
625
|
-
|
|
626
|
-
- **`.env.example`** - Committed to git, contains templates and defaults
|
|
627
|
-
- **`.env`** - Gitignored, contains your actual values (may include secrets)
|
|
628
|
-
|
|
629
|
-
**Best practices:**
|
|
630
|
-
|
|
631
|
-
- ✅ Copy `.env.example` to `.env` and customize
|
|
632
|
-
- ✅ Use placeholder values in `.env.example` (`CHANGEME`, `your-key-here`)
|
|
633
|
-
- ✅ Verify `.env` is in `.gitignore` before committing
|
|
634
|
-
- ❌ Never commit `.env` files with real credentials
|
|
635
|
-
|
|
636
|
-
### General Security Principles
|
|
637
|
-
|
|
638
|
-
- **Development only** - These configurations are optimized for developer productivity, not security
|
|
639
|
-
- **Local networks** - Keep devcontainer services on local networks, don't expose to internet
|
|
640
|
-
- **Update regularly** - Keep base images and overlays up to date
|
|
641
|
-
- **Audit dependencies** - Be aware of what's installed in your devcontainer
|
|
642
|
-
|
|
643
|
-
See individual overlay READMEs (especially [docker-sock](overlays/docker-sock/README.md)) for specific security considerations.
|
|
644
|
-
|
|
645
|
-
### Safe Upgrade and Regeneration
|
|
646
|
-
|
|
647
|
-
Every devcontainer generation creates a `superposition.json` manifest file that records your configuration choices. This manifest is the key to safe updates and iterations.
|
|
648
|
-
|
|
649
|
-
**Why the manifest exists:**
|
|
650
|
-
|
|
651
|
-
- **🔄 Reproducibility** - Recreate exact same configuration on any machine
|
|
652
|
-
- **⬆️ Upgrades** - Pull latest overlay improvements without starting from scratch
|
|
653
|
-
- **🧪 Experimentation** - Try different configurations with automatic backup
|
|
654
|
-
- **👥 Team Sharing** - Commit the manifest for consistent team environments
|
|
655
|
-
|
|
656
|
-
**When to regenerate (regen) vs manual edit:**
|
|
657
|
-
|
|
658
|
-
| Scenario | Use | Why |
|
|
659
|
-
| ---------------------------------- | ---------------------- | -------------------------------------------- |
|
|
660
|
-
| Update to latest overlay versions | `regen` | Get bug fixes and improvements automatically |
|
|
661
|
-
| Add/remove overlays | `init --from-manifest` | Let the tool handle merge complexity |
|
|
662
|
-
| Change port offset | `init --from-manifest` | Automatic port recalculation |
|
|
663
|
-
| Tweak VS Code settings | Manual edit | Simple JSON change, no regeneration needed |
|
|
664
|
-
| Add custom script | Manual edit | Direct file addition |
|
|
665
|
-
| Fix specific devcontainer bug | Manual edit | Quick fix without full regeneration |
|
|
666
|
-
| Switch base image | `init --from-manifest` | Template dependencies may change |
|
|
667
|
-
| Your project evolved significantly | `init` (fresh) | Clean slate with new requirements |
|
|
668
|
-
|
|
669
|
-
**Quick regeneration (recommended):**
|
|
670
|
-
|
|
671
|
-
```bash
|
|
672
|
-
# Simple regen command - automatically finds manifest in .devcontainer/ or project root
|
|
673
|
-
npx container-superposition regen
|
|
674
|
-
|
|
675
|
-
# Creates backup and regenerates with exact same settings from manifest
|
|
676
|
-
# Perfect for updating to latest overlay versions
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
**Update to latest version and regenerate:**
|
|
680
|
-
|
|
681
|
-
```bash
|
|
682
|
-
# Update the tool and regenerate in one go
|
|
683
|
-
npx container-superposition@latest regen
|
|
684
|
-
|
|
685
|
-
# Or update globally first
|
|
686
|
-
npm update -g container-superposition
|
|
687
|
-
container-superposition regen
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
**Interactive regeneration with changes:**
|
|
691
|
-
|
|
692
|
-
```bash
|
|
693
|
-
# Loads manifest, creates backup, shows questionnaire with pre-selected options
|
|
694
|
-
npx container-superposition init --from-manifest ./.devcontainer/superposition.json
|
|
695
|
-
|
|
696
|
-
# Or from a different location (regenerates in the manifest's directory)
|
|
697
|
-
npx container-superposition init --from-manifest /path/to/project/.devcontainer/superposition.json
|
|
698
|
-
```
|
|
699
|
-
|
|
700
|
-
> **Note:** When using `--from-manifest`, the devcontainer is generated relative to the manifest file's location, not your current working directory. This means you can run the command from anywhere and the output will go to the correct project directory.
|
|
701
|
-
|
|
702
|
-
**Non-interactive regeneration (CI/CD):**
|
|
703
|
-
|
|
704
|
-
```bash
|
|
705
|
-
# Truly non-interactive: use manifest values directly without questionnaire
|
|
706
|
-
npx container-superposition init --from-manifest ./.devcontainer/superposition.json --no-interactive --no-backup
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
> **Note:** The `--no-interactive` option skips the questionnaire entirely and uses all values from the manifest. This is perfect for CI/CD pipelines or when you want to ensure exact reproducibility.
|
|
710
|
-
|
|
711
|
-
**Workflow examples:**
|
|
712
|
-
|
|
713
|
-
```bash
|
|
714
|
-
# 1. Initial setup
|
|
715
|
-
npx container-superposition init --stack compose --language nodejs --database postgres
|
|
716
|
-
# Creates .devcontainer/ and superposition.json
|
|
717
|
-
|
|
718
|
-
# 2. Later: Add Redis and observability (interactive)
|
|
719
|
-
npx container-superposition init --from-manifest ./.devcontainer/superposition.json
|
|
720
|
-
# Questionnaire shows with nodejs and postgres pre-selected
|
|
721
|
-
# Add redis, otel-collector, grafana
|
|
722
|
-
# Original .devcontainer/ backed up automatically
|
|
723
|
-
|
|
724
|
-
# 3. Update to latest overlay versions (simple regen)
|
|
725
|
-
npx container-superposition regen
|
|
726
|
-
# Uses exact manifest values, creates backup
|
|
727
|
-
# Perfect for pulling latest overlay updates
|
|
728
|
-
|
|
729
|
-
# 4. Switch languages (e.g., Node.js → Python)
|
|
730
|
-
npx container-superposition init --from-manifest ./.devcontainer/superposition.json
|
|
731
|
-
# Change nodejs to python in questionnaire
|
|
732
|
-
# Regenerate with new language
|
|
733
|
-
```
|
|
734
|
-
|
|
735
|
-
**Backup behavior:**
|
|
736
|
-
|
|
737
|
-
- **Default**: Creates timestamped backup next to the devcontainer directory (e.g., `.devcontainer.backup-2026-02-08-143022/`)
|
|
738
|
-
- **`--no-backup`**: Skip backup (destructive, use with caution)
|
|
739
|
-
- **`--backup-dir <path>`**: Custom backup location
|
|
740
|
-
- **Automatic .gitignore**: Backup patterns added to project root `.gitignore`
|
|
741
|
-
|
|
742
|
-
**What's preserved from manifest:**
|
|
743
|
-
|
|
744
|
-
- Base template (plain/compose)
|
|
745
|
-
- Preset selection (if used)
|
|
746
|
-
- All overlay selections
|
|
747
|
-
- Port offset
|
|
748
|
-
- Output path
|
|
749
|
-
- Container name
|
|
750
|
-
|
|
751
|
-
See [tool/README.md](tool/README.md) for full documentation.
|
|
752
|
-
|
|
753
|
-
## 📂 Filesystem Contract
|
|
754
|
-
|
|
755
|
-
Understanding what Container Superposition writes and where helps you manage your devcontainer configuration effectively.
|
|
756
|
-
|
|
757
|
-
### What Gets Written Where
|
|
758
|
-
|
|
759
|
-
**Generated by the tool:**
|
|
760
|
-
|
|
761
|
-
```
|
|
762
|
-
your-project/
|
|
763
|
-
├── .devcontainer/ # Main devcontainer directory
|
|
764
|
-
│ ├── devcontainer.json # Container configuration
|
|
765
|
-
│ ├── docker-compose.yml # Services (if using compose stack)
|
|
766
|
-
│ ├── .env.example # Environment variable templates
|
|
767
|
-
│ ├── ports.json # Port documentation and connection strings
|
|
768
|
-
│ ├── scripts/ # Setup and verification scripts
|
|
769
|
-
│ │ ├── post-create.sh # Runs once when container is created
|
|
770
|
-
│ │ └── post-start.sh # Runs every time container starts
|
|
771
|
-
│ └── custom/ # Your customizations (preserved across regen)
|
|
772
|
-
│ ├── devcontainer.patch.json
|
|
773
|
-
│ └── docker-compose.patch.yml
|
|
774
|
-
├── superposition.json # Manifest file (enables regeneration)
|
|
775
|
-
└── .devcontainer.backup-*/ # Automatic backups (gitignored)
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
### Files You Should Customize
|
|
779
|
-
|
|
780
|
-
**After generation:**
|
|
781
|
-
|
|
782
|
-
- **`.env`** - Copy from `.env.example`, add your actual values
|
|
783
|
-
- **`.devcontainer/custom/`** - Add your project-specific patches here
|
|
784
|
-
|
|
785
|
-
**Direct edits (survive regeneration):**
|
|
786
|
-
|
|
787
|
-
- `.devcontainer/custom/devcontainer.patch.json` - Extra devcontainer settings
|
|
788
|
-
- `.devcontainer/custom/docker-compose.patch.yml` - Additional services
|
|
789
|
-
- `.devcontainer/custom/environment.env` - Extra environment variables
|
|
790
|
-
- `.devcontainer/custom/scripts/*` - Custom setup scripts
|
|
791
|
-
|
|
792
|
-
**Direct edits (lost on regeneration):**
|
|
793
|
-
|
|
794
|
-
- `.devcontainer/devcontainer.json` - Regenerated from overlays
|
|
795
|
-
- `.devcontainer/docker-compose.yml` - Regenerated from overlays
|
|
796
|
-
- `.devcontainer/scripts/` - Regenerated from overlays
|
|
797
|
-
|
|
798
|
-
### Files You Should Commit
|
|
799
|
-
|
|
800
|
-
**Essential for team collaboration:**
|
|
801
|
-
|
|
802
|
-
- ✅ `superposition.json` - Enables `regen` command
|
|
803
|
-
- ✅ `.devcontainer/` - The generated configuration (team shares setup)
|
|
804
|
-
- ✅ `.env.example` - Template for environment variables
|
|
805
|
-
- ✅ `.devcontainer/custom/` - Your project-specific customizations
|
|
806
|
-
|
|
807
|
-
**Only for certain workflows:**
|
|
808
|
-
|
|
809
|
-
- ⚠️ `superposition.json` only - See [Team Workflow](docs/team-workflow.md) for manifest-only pattern
|
|
810
|
-
|
|
811
|
-
### Files in .gitignore
|
|
812
|
-
|
|
813
|
-
**Automatically added to your `.gitignore`:**
|
|
814
|
-
|
|
815
|
-
```gitignore
|
|
816
|
-
# Environment secrets (never commit)
|
|
817
|
-
.env
|
|
818
|
-
.devcontainer/.env
|
|
819
|
-
|
|
820
|
-
# Regeneration backups (local only)
|
|
821
|
-
.devcontainer.backup-*
|
|
822
|
-
```
|
|
823
|
-
|
|
824
|
-
### Workflow Examples
|
|
825
|
-
|
|
826
|
-
**Individual developer:**
|
|
827
|
-
|
|
828
|
-
```bash
|
|
829
|
-
# 1. Generate devcontainer
|
|
830
|
-
npx container-superposition init --preset web-api --language nodejs
|
|
831
|
-
|
|
832
|
-
# 2. Customize .env from template
|
|
833
|
-
cp .devcontainer/.env.example .devcontainer/.env
|
|
834
|
-
# Edit .env with your values
|
|
835
|
-
|
|
836
|
-
# 3. Add project-specific customization
|
|
837
|
-
mkdir -p .devcontainer/custom
|
|
838
|
-
echo '{"customizations": {"vscode": {"extensions": ["eamodio.gitlens"]}}}' > .devcontainer/custom/devcontainer.patch.json
|
|
839
|
-
|
|
840
|
-
# 4. Commit everything except .env
|
|
841
|
-
git add .devcontainer/ superposition.json
|
|
842
|
-
git commit -m "Add devcontainer configuration"
|
|
843
|
-
```
|
|
844
|
-
|
|
845
|
-
**Team collaboration:**
|
|
846
|
-
|
|
847
|
-
```bash
|
|
848
|
-
# Developer 1: Create and commit
|
|
849
|
-
npx container-superposition init --preset web-api --language nodejs
|
|
850
|
-
git add superposition.json .devcontainer/
|
|
851
|
-
git commit -m "Add devcontainer"
|
|
852
|
-
|
|
853
|
-
# Developer 2: Clone and use
|
|
854
|
-
git clone repo
|
|
855
|
-
code .
|
|
856
|
-
# VS Code: "Reopen in Container"
|
|
857
|
-
cp .devcontainer/.env.example .devcontainer/.env
|
|
858
|
-
# Customize .env with your values
|
|
859
|
-
|
|
860
|
-
# Developer 1: Update to add Redis
|
|
861
|
-
npx container-superposition init --from-manifest superposition.json
|
|
862
|
-
# Add redis in questionnaire
|
|
863
|
-
git add superposition.json .devcontainer/
|
|
864
|
-
git commit -m "Add Redis to devcontainer"
|
|
865
|
-
|
|
866
|
-
# Developer 2: Pull and regenerate
|
|
867
|
-
git pull
|
|
868
|
-
npx container-superposition regen
|
|
869
|
-
# VS Code: "Rebuild Container"
|
|
870
|
-
```
|
|
871
|
-
|
|
872
|
-
See **[Team Workflow Guide](docs/team-workflow.md)** for manifest-only workflow and CI integration.
|
|
873
|
-
|
|
874
|
-
## 📚 Examples
|
|
875
|
-
|
|
876
|
-
Real-world reference configurations to help you get started quickly.
|
|
877
|
-
|
|
878
|
-
### [Web API (Node.js)](examples/web-api-node/)
|
|
879
|
-
|
|
880
|
-
Full-stack web API with complete observability:
|
|
881
|
-
|
|
882
|
-
- **Stack**: Node.js + PostgreSQL + Redis
|
|
883
|
-
- **Observability**: OpenTelemetry Collector + Prometheus + Grafana + Loki
|
|
884
|
-
- **Use case**: Production-ready web API development
|
|
885
|
-
|
|
886
|
-
Each example includes a `superposition.json` manifest. To use:
|
|
887
|
-
|
|
888
|
-
```bash
|
|
889
|
-
cd examples/web-api-node
|
|
890
|
-
npx container-superposition regen
|
|
891
|
-
code .
|
|
892
|
-
# Reopen in Container
|
|
893
|
-
```
|
|
894
|
-
|
|
895
|
-
### [.NET Microservice](examples/dotnet-service/)
|
|
896
|
-
|
|
897
|
-
Microservice with distributed tracing and monitoring:
|
|
898
20
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
21
|
+
# Declarative project config committed in the repo
|
|
22
|
+
cat > .superposition.yml <<'YAML'
|
|
23
|
+
stack: compose
|
|
24
|
+
language:
|
|
25
|
+
- nodejs
|
|
26
|
+
database:
|
|
27
|
+
- postgres
|
|
28
|
+
customizations:
|
|
29
|
+
environment:
|
|
30
|
+
APP_ENV: development
|
|
31
|
+
YAML
|
|
32
|
+
npx container-superposition init --no-interactive
|
|
33
|
+
|
|
34
|
+
# Regenerate from the repository project file
|
|
905
35
|
npx container-superposition regen
|
|
906
|
-
code .
|
|
907
|
-
# Reopen in Container
|
|
908
|
-
```
|
|
909
|
-
|
|
910
|
-
Each example includes:
|
|
911
36
|
|
|
912
|
-
|
|
913
|
-
-
|
|
914
|
-
- ✅ Instructions for extending and customizing
|
|
37
|
+
# Or select the project file explicitly
|
|
38
|
+
npx container-superposition regen --from-project
|
|
915
39
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
```bash
|
|
40
|
+
# Non-interactive example
|
|
919
41
|
npx container-superposition init --stack compose --language nodejs --database postgres
|
|
920
|
-
```
|
|
921
|
-
|
|
922
|
-
### Preserving Project-Specific Customizations
|
|
923
|
-
|
|
924
|
-
**Problem**: When you regenerate a devcontainer (to add overlays or update), manual customizations are lost.
|
|
925
|
-
|
|
926
|
-
**Solution**: Use the `.devcontainer/custom/` directory for customizations that persist across regenerations.
|
|
927
|
-
|
|
928
|
-
**Quick example:**
|
|
929
|
-
|
|
930
|
-
```bash
|
|
931
|
-
# 1. Generate initial devcontainer
|
|
932
|
-
npm run init -- --stack compose --language nodejs --database postgres
|
|
933
|
-
|
|
934
|
-
# 2. Add custom patches
|
|
935
|
-
mkdir -p .devcontainer/custom
|
|
936
|
-
|
|
937
|
-
# Add custom mounts, extensions, etc.
|
|
938
|
-
cat > .devcontainer/custom/devcontainer.patch.json << 'EOF'
|
|
939
|
-
{
|
|
940
|
-
"mounts": [
|
|
941
|
-
"source=${localWorkspaceFolder}/../shared-libs,target=/workspace/shared,type=bind"
|
|
942
|
-
],
|
|
943
|
-
"customizations": {
|
|
944
|
-
"vscode": {
|
|
945
|
-
"extensions": ["eamodio.gitlens"]
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
EOF
|
|
950
|
-
|
|
951
|
-
# 3. Regenerate (e.g., to add Redis)
|
|
952
|
-
npm run init -- --from-manifest .devcontainer/superposition.json
|
|
953
|
-
# Select redis in addition to existing overlays
|
|
954
|
-
|
|
955
|
-
# 4. Your custom patches are automatically preserved and merged! ✅
|
|
956
|
-
```
|
|
957
|
-
|
|
958
|
-
**Supported customization files:**
|
|
959
|
-
|
|
960
|
-
- `devcontainer.patch.json` - Merges into devcontainer.json
|
|
961
|
-
- `docker-compose.patch.yml` - Merges into docker-compose.yml
|
|
962
|
-
- `environment.env` - Additional environment variables
|
|
963
|
-
- `scripts/post-create.sh` - Custom one-time setup script
|
|
964
|
-
- `scripts/post-start.sh` - Custom startup script
|
|
965
|
-
- `files/` - Additional files to copy
|
|
966
|
-
|
|
967
|
-
See **[Custom Patches Guide](docs/custom-patches.md)** for complete documentation and examples.
|
|
968
|
-
|
|
969
|
-
### Team Collaboration Workflow
|
|
970
|
-
|
|
971
|
-
**Use Case:** Standardize dev environments across a team while allowing personal customizations.
|
|
972
|
-
|
|
973
|
-
Container Superposition supports a **manifest-first workflow** where:
|
|
974
|
-
|
|
975
|
-
- **Manifest** (`superposition.json`) is committed to version control
|
|
976
|
-
- **.devcontainer/** is generated locally and gitignored
|
|
977
|
-
- **Custom patches** (`.devcontainer/custom/`) can be committed for shared customizations
|
|
978
|
-
|
|
979
|
-
#### Quick Setup
|
|
980
|
-
|
|
981
|
-
**1. Team lead creates the manifest:**
|
|
982
|
-
|
|
983
|
-
```bash
|
|
984
|
-
# Generate manifest only (no .devcontainer/ files)
|
|
985
|
-
npx container-superposition init --write-manifest-only \
|
|
986
|
-
--stack compose \
|
|
987
|
-
--language nodejs \
|
|
988
|
-
--database postgres,redis
|
|
989
|
-
|
|
990
|
-
# Commit to repo
|
|
991
|
-
git add superposition.json .gitignore
|
|
992
|
-
git commit -m "Add team devcontainer manifest"
|
|
993
|
-
```
|
|
994
|
-
|
|
995
|
-
**2. Add to `.gitignore`:**
|
|
996
|
-
|
|
997
|
-
```gitignore
|
|
998
|
-
# DevContainer - generated locally
|
|
999
|
-
.devcontainer/
|
|
1000
|
-
|
|
1001
|
-
# Except custom directory (personal/shared customizations)
|
|
1002
|
-
!.devcontainer/custom/
|
|
1003
|
-
```
|
|
1004
|
-
|
|
1005
|
-
**3. Team members clone and generate:**
|
|
1006
|
-
|
|
1007
|
-
```bash
|
|
1008
|
-
git clone <repo>
|
|
1009
|
-
cd <repo>
|
|
1010
|
-
|
|
1011
|
-
# Generate .devcontainer/ from manifest
|
|
1012
|
-
npx container-superposition regen
|
|
1013
|
-
|
|
1014
|
-
# Open in VS Code and rebuild container
|
|
1015
|
-
code .
|
|
1016
|
-
```
|
|
1017
|
-
|
|
1018
|
-
**4. Personal customizations (optional):**
|
|
1019
|
-
|
|
1020
|
-
```bash
|
|
1021
|
-
# Add personal VS Code extensions, themes, etc.
|
|
1022
|
-
mkdir -p .devcontainer/custom
|
|
1023
|
-
cat > .devcontainer/custom/devcontainer.patch.json << 'EOF'
|
|
1024
|
-
{
|
|
1025
|
-
"customizations": {
|
|
1026
|
-
"vscode": {
|
|
1027
|
-
"extensions": ["eamodio.gitlens"],
|
|
1028
|
-
"settings": {
|
|
1029
|
-
"editor.fontSize": 14
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
EOF
|
|
1035
|
-
|
|
1036
|
-
# Regenerate to apply
|
|
1037
|
-
npx container-superposition regen
|
|
1038
|
-
```
|
|
1039
|
-
|
|
1040
|
-
**Benefits:**
|
|
1041
|
-
|
|
1042
|
-
- ✅ One command onboarding for new developers
|
|
1043
|
-
- ✅ No lock-in - generated files are plain JSON/YAML
|
|
1044
|
-
- ✅ Personal customizations don't conflict with team standard
|
|
1045
|
-
- ✅ CI can validate manifest without committing generated files
|
|
1046
|
-
|
|
1047
|
-
See **[Team Workflow Guide](docs/team-workflow.md)** for complete documentation, CI examples, and troubleshooting.
|
|
1048
|
-
|
|
1049
|
-
### Option 2: Manual Composition
|
|
1050
|
-
|
|
1051
|
-
1. **Copy a base template:**
|
|
1052
|
-
|
|
1053
|
-
```bash
|
|
1054
|
-
cp -r templates/compose/.devcontainer /path/to/your/project/
|
|
1055
|
-
```
|
|
1056
|
-
|
|
1057
|
-
2. **Add overlay configurations:**
|
|
1058
|
-
|
|
1059
|
-
```bash
|
|
1060
|
-
# Merge devcontainer.patch.json files
|
|
1061
|
-
# Copy docker-compose.yml files as docker-compose.{overlay}.yml
|
|
1062
|
-
# Merge .env.example files
|
|
1063
|
-
```
|
|
1064
|
-
|
|
1065
|
-
3. **Open in VS Code** and reopen in container
|
|
1066
|
-
|
|
1067
|
-
## 🔧 Architecture
|
|
1068
|
-
|
|
1069
|
-
- **Questionnaire**: 5–8 questions to understand your needs
|
|
1070
|
-
- **Composition**: Merges base templates with lightweight overlays
|
|
1071
|
-
- **Output**: Plain `.devcontainer/` folder — fully editable, no lock-in
|
|
1072
|
-
- **Overlays**: Add-ons for databases (Postgres, Redis), Playwright, cloud tools, etc.
|
|
1073
|
-
|
|
1074
|
-
**Key Design Decisions:**
|
|
1075
|
-
|
|
1076
|
-
- ✅ Generate once, edit forever (no "sync" or "update")
|
|
1077
|
-
- ✅ Output is standard JSON — no proprietary formats
|
|
1078
|
-
- ✅ Tool is optional — templates work standalone
|
|
1079
|
-
- ✅ Cross-platform via Node.js/TypeScript
|
|
1080
|
-
- ✅ Metadata-driven overlays (no hardcoded menus)
|
|
1081
|
-
|
|
1082
|
-
### Metadata-Driven Overlays
|
|
1083
|
-
|
|
1084
|
-
All overlays are defined in [overlays/index.yml](overlays/index.yml):
|
|
1085
|
-
|
|
1086
|
-
```yaml
|
|
1087
|
-
observability_overlays:
|
|
1088
|
-
- id: otel-collector
|
|
1089
|
-
name: OpenTelemetry Collector
|
|
1090
|
-
description: Telemetry collection pipeline
|
|
1091
|
-
category: observability
|
|
1092
|
-
order: 2 # Start after backends
|
|
1093
|
-
```
|
|
1094
|
-
|
|
1095
|
-
**Benefits:**
|
|
1096
|
-
|
|
1097
|
-
- Add new overlays without code changes
|
|
1098
|
-
- Consistent naming and descriptions
|
|
1099
|
-
- Control display order and categorization
|
|
1100
|
-
- Easy maintenance and documentation
|
|
1101
|
-
|
|
1102
|
-
**Overlay Categories:**
|
|
1103
|
-
|
|
1104
|
-
- `base_templates` - plain, compose
|
|
1105
|
-
- `base_images` - bookworm, trixie, alpine, ubuntu, custom
|
|
1106
|
-
- `language_overlays` - dotnet, nodejs, python, mkdocs, bun, go, java, rust, powershell
|
|
1107
|
-
- `database_overlays` - postgres, redis, mongodb, mysql, sqlite, sqlserver, minio, rabbitmq, redpanda, nats
|
|
1108
|
-
- `observability_overlays` - otel-collector, jaeger, prometheus, grafana, loki, tempo, alertmanager, promtail, otel-demo-nodejs, otel-demo-python
|
|
1109
|
-
- `cloud_tool_overlays` - aws-cli, azure-cli, gcloud, kubectl-helm, terraform, pulumi
|
|
1110
|
-
- `dev_tool_overlays` - docker-in-docker, docker-sock, playwright, codex, git-helpers, pre-commit, commitlint, just, direnv, modern-cli-tools, ngrok
|
|
1111
|
-
|
|
1112
|
-
See [tool/docs/questionnaire-updates.md](tool/docs/questionnaire-updates.md) for details.
|
|
1113
|
-
|
|
1114
|
-
### Dependency Management & Auto-Resolution
|
|
1115
|
-
|
|
1116
|
-
Container Superposition includes an intelligent dependency model that automatically resolves required dependencies:
|
|
1117
|
-
|
|
1118
|
-
**Dependency Types:**
|
|
1119
|
-
|
|
1120
|
-
- **`requires`** - Hard dependencies that are automatically added
|
|
1121
|
-
- **`suggests`** - Soft dependencies that work well together
|
|
1122
|
-
- **`conflicts`** - Mutually exclusive overlays
|
|
1123
|
-
|
|
1124
|
-
**Auto-Resolution Example:**
|
|
1125
|
-
|
|
1126
|
-
```bash
|
|
1127
|
-
# Select grafana, and prometheus is automatically added
|
|
1128
|
-
npm run init -- --stack compose --observability grafana
|
|
1129
|
-
|
|
1130
|
-
# Output includes both:
|
|
1131
|
-
# ✅ grafana
|
|
1132
|
-
# ✅ prometheus (auto-resolved, required by grafana)
|
|
1133
|
-
```
|
|
1134
|
-
|
|
1135
|
-
**Explicit Metadata in overlays/index.yml:**
|
|
1136
|
-
|
|
1137
|
-
```yaml
|
|
1138
|
-
observability_overlays:
|
|
1139
|
-
- id: grafana
|
|
1140
|
-
name: Grafana
|
|
1141
|
-
requires: [prometheus] # Auto-add prometheus
|
|
1142
|
-
suggests: [loki, jaeger] # Could work well together
|
|
1143
|
-
conflicts: []
|
|
1144
|
-
tags: [observability, ui]
|
|
1145
|
-
ports: [3000] # Explicit port declarations
|
|
1146
|
-
```
|
|
1147
|
-
|
|
1148
|
-
**Benefits:**
|
|
1149
|
-
|
|
1150
|
-
- ✅ Predictable behavior - no hidden "if overlay == ..." logic
|
|
1151
|
-
- ✅ Automatic dependency resolution
|
|
1152
|
-
- ✅ Clear conflict detection
|
|
1153
|
-
- ✅ Port-offset becomes data-driven
|
|
1154
|
-
|
|
1155
|
-
**Superposition Manifest:**
|
|
1156
|
-
|
|
1157
|
-
Every generated configuration includes a `superposition.json` manifest for debugging:
|
|
1158
|
-
|
|
1159
|
-
```json
|
|
1160
|
-
{
|
|
1161
|
-
"version": "0.1.0",
|
|
1162
|
-
"generated": "2026-02-04T10:30:00Z",
|
|
1163
|
-
"baseTemplate": "compose",
|
|
1164
|
-
"baseImage": "bookworm",
|
|
1165
|
-
"overlays": ["dotnet", "postgres", "prometheus", "grafana"],
|
|
1166
|
-
"portOffset": 100,
|
|
1167
|
-
"autoResolved": {
|
|
1168
|
-
"added": ["prometheus"],
|
|
1169
|
-
"reason": "prometheus (required by grafana)"
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
```
|
|
1173
|
-
|
|
1174
|
-
This manifest answers "why is this here?" without reading generated configs.
|
|
1175
|
-
|
|
1176
|
-
See [tool/docs/overlays.md](tool/docs/overlays.md) for complete overlay reference.
|
|
1177
|
-
|
|
1178
|
-
### Service Dependency Management
|
|
1179
|
-
|
|
1180
|
-
The composer intelligently manages docker-compose service dependencies:
|
|
1181
|
-
|
|
1182
|
-
1. **Filters docker-compose** - Removes `depends_on` references to unselected services
|
|
1183
|
-
2. **Orders services** - Uses `_serviceOrder` field (0=infra, 1=backends, 2=middleware, 3=UI)
|
|
1184
|
-
3. **Merges runServices** - Creates ordered startup sequence
|
|
1185
|
-
4. **Validates overlays** - Ensures compatible combinations
|
|
1186
|
-
|
|
1187
|
-
Example: If you select `grafana` without `prometheus`, the `depends_on: [prometheus]` is automatically removed.
|
|
1188
|
-
|
|
1189
|
-
See [tool/README.md](tool/README.md) for architecture details.
|
|
1190
|
-
|
|
1191
|
-
## 🔧 Customization
|
|
1192
42
|
|
|
1193
|
-
|
|
43
|
+
# Preview before writing files
|
|
44
|
+
npx container-superposition plan --stack compose --overlays nodejs,postgres,grafana
|
|
1194
45
|
|
|
1195
|
-
|
|
46
|
+
# Explain why dependencies were included
|
|
47
|
+
npx container-superposition plan --stack compose --overlays grafana --verbose
|
|
1196
48
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
"features": {
|
|
1200
|
-
"ghcr.io/devcontainers/features/node:1": {},
|
|
1201
|
-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
|
|
1202
|
-
"ghcr.io/devcontainers/features/github-cli:1": {}
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
49
|
+
# Explain an existing manifest without re-entering overlays
|
|
50
|
+
npx container-superposition plan --from-manifest .devcontainer/superposition.json --verbose
|
|
1205
51
|
```
|
|
1206
52
|
|
|
1207
|
-
|
|
53
|
+
## What It Does
|
|
1208
54
|
|
|
1209
|
-
|
|
55
|
+
- Base templates: `plain` (single image) and `compose` (multi-service).
|
|
56
|
+
- Overlays: add languages, databases, observability, cloud tools, dev tools.
|
|
57
|
+
- Composition: merges overlays into a standard `.devcontainer/` you can edit freely.
|
|
58
|
+
- Project config: commit `.superposition.yml` or `superposition.yml` to make team and CI generation declarative.
|
|
59
|
+
- `regen` uses that project file by default when present
|
|
60
|
+
- `--from-project` selects it explicitly
|
|
61
|
+
- conflicting source combinations fail early
|
|
62
|
+
- `init` stays the editable flow; `regen` is the deterministic replay flow
|
|
1210
63
|
|
|
1211
|
-
|
|
1212
|
-
{
|
|
1213
|
-
"features": {
|
|
1214
|
-
"./features/project-scaffolder": { "template": "express-api" },
|
|
1215
|
-
"./features/team-conventions": { "preset": "airbnb" }
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
```
|
|
1219
|
-
|
|
1220
|
-
### Mixing Templates
|
|
1221
|
-
|
|
1222
|
-
Start with one template and enhance it:
|
|
1223
|
-
|
|
1224
|
-
- Add features from containers.dev
|
|
1225
|
-
- Include custom features from this repo
|
|
1226
|
-
- Copy useful scripts from other templates
|
|
1227
|
-
|
|
1228
|
-
## 🧪 Testing & Verification
|
|
1229
|
-
|
|
1230
|
-
### Golden Tests
|
|
1231
|
-
|
|
1232
|
-
The project includes comprehensive test coverage for composition logic:
|
|
1233
|
-
|
|
1234
|
-
```bash
|
|
1235
|
-
# Run all tests
|
|
1236
|
-
npm test
|
|
1237
|
-
|
|
1238
|
-
# Run tests in watch mode
|
|
1239
|
-
npm run test:watch
|
|
1240
|
-
|
|
1241
|
-
# Run smoke tests
|
|
1242
|
-
npm run test:smoke
|
|
1243
|
-
```
|
|
1244
|
-
|
|
1245
|
-
**Test Coverage:**
|
|
1246
|
-
|
|
1247
|
-
- ✅ Dependency resolution logic
|
|
1248
|
-
- ✅ devcontainer.json merging
|
|
1249
|
-
- ✅ docker-compose.yml merging
|
|
1250
|
-
- ✅ Port offset application
|
|
1251
|
-
- ✅ Environment variable merging
|
|
1252
|
-
- ✅ Manifest generation
|
|
1253
|
-
|
|
1254
|
-
### Overlay Verification Scripts
|
|
1255
|
-
|
|
1256
|
-
Each overlay includes a `verify.sh` script for validation:
|
|
1257
|
-
|
|
1258
|
-
```bash
|
|
1259
|
-
# Inside a devcontainer, run verification scripts
|
|
1260
|
-
bash ./verify-postgres.sh
|
|
1261
|
-
bash ./verify-redis.sh
|
|
1262
|
-
bash ./verify-grafana.sh
|
|
1263
|
-
```
|
|
1264
|
-
|
|
1265
|
-
**Verification scripts check:**
|
|
1266
|
-
|
|
1267
|
-
- ✅ Tool/service is installed
|
|
1268
|
-
- ✅ Version information
|
|
1269
|
-
- ✅ Service connectivity (for compose overlays)
|
|
1270
|
-
- ✅ Port accessibility
|
|
1271
|
-
|
|
1272
|
-
Example output:
|
|
1273
|
-
|
|
1274
|
-
```
|
|
1275
|
-
🔍 Verifying PostgreSQL overlay...
|
|
1276
|
-
|
|
1277
|
-
1️⃣ Checking psql client...
|
|
1278
|
-
psql (PostgreSQL) 16.1
|
|
1279
|
-
✅ psql client found
|
|
1280
|
-
|
|
1281
|
-
2️⃣ Checking PostgreSQL service...
|
|
1282
|
-
✅ PostgreSQL service is ready
|
|
1283
|
-
postgres:5432 - accepting connections
|
|
1284
|
-
|
|
1285
|
-
✅ PostgreSQL overlay verification complete
|
|
1286
|
-
```
|
|
64
|
+
## Core Commands
|
|
1287
65
|
|
|
1288
|
-
|
|
66
|
+
- `init` — generate or modify a devcontainer, optionally starting from a project file or manifest
|
|
67
|
+
- Add `--project-root <path>` to resolve persisted input from a different repository root
|
|
68
|
+
- `regen` — deterministically replay the repository project file or a manifest
|
|
69
|
+
- Add `--project-root <path>` to resolve persisted input from a different repository root
|
|
70
|
+
- `adopt` — migrate an existing `.devcontainer/` to the overlay-based workflow, optionally emitting a repository-root project file
|
|
71
|
+
- `list` — browse overlays
|
|
72
|
+
- `explain` — overlay details
|
|
73
|
+
- `plan` — preview output
|
|
74
|
+
- Add `--verbose` to narrate dependency resolution and inclusion reasons
|
|
75
|
+
- Add `--from-manifest <path>` to preview an existing manifest with the same explanation model
|
|
76
|
+
- `hash` — deterministic environment fingerprint
|
|
77
|
+
- `doctor` — validate environment
|
|
1289
78
|
|
|
1290
|
-
|
|
1291
|
-
- **Fast Builds** - Optimized Dockerfiles with layer caching
|
|
1292
|
-
- **Composability** - Features can be mixed and matched
|
|
1293
|
-
- **Minimal Bloat** - Only include what's needed
|
|
1294
|
-
- **No Lock-In** - Standard devcontainer format, works anywhere
|
|
1295
|
-
- **Preserve Customizations** - Project-specific changes survive regeneration via `.devcontainer/custom/`
|
|
79
|
+
## Documentation
|
|
1296
80
|
|
|
1297
|
-
|
|
81
|
+
Start here:
|
|
1298
82
|
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
"name": "My Custom Template",
|
|
1313
|
-
"image": "mcr.microsoft.com/devcontainers/typescript-node:20",
|
|
1314
|
-
"features": {
|
|
1315
|
-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
|
|
1316
|
-
"./features/team-conventions": {}
|
|
1317
|
-
},
|
|
1318
|
-
"postCreateCommand": "npm install && npm run setup",
|
|
1319
|
-
"customizations": {
|
|
1320
|
-
"vscode": {
|
|
1321
|
-
"extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
```
|
|
1326
|
-
|
|
1327
|
-
## 📚 Documentation
|
|
1328
|
-
|
|
1329
|
-
Complete documentation is available in the [docs/](docs/) folder:
|
|
1330
|
-
|
|
1331
|
-
- **[Documentation Index](docs/README.md)** - Complete documentation overview
|
|
1332
|
-
- **[Custom Patches](docs/custom-patches.md)** - Preserve project-specific customizations across regenerations
|
|
1333
|
-
- **[Publishing Guide](docs/publishing.md)** - How to publish to npm
|
|
1334
|
-
- **[Quick Reference](docs/quick-reference.md)** - Templates, overlays, ports, commands
|
|
1335
|
-
- **[Architecture](docs/architecture.md)** - Design principles and composition logic
|
|
1336
|
-
- **[Creating Overlays](docs/creating-overlays.md)** - Guide for adding new overlays
|
|
1337
|
-
- [Overlay Manifest Schema](tool/schema/overlay-manifest.schema.json) - JSON schema for overlay.yml
|
|
1338
|
-
- [Overlay Index Guide](.github/instructions/overlay-index.instructions.md) - Comprehensive field documentation
|
|
1339
|
-
- **[Examples](docs/examples.md)** - Common usage patterns
|
|
1340
|
-
|
|
1341
|
-
Additional resources:
|
|
1342
|
-
|
|
1343
|
-
- [VS Code Dev Containers Documentation](https://code.visualstudio.com/docs/devcontainers/containers)
|
|
1344
|
-
- [Dev Container Specification](https://containers.dev/)
|
|
1345
|
-
- [Docker Best Practices](https://docs.docker.com/develop/dev-best-practices/)
|
|
1346
|
-
|
|
1347
|
-
## 💻 Development
|
|
1348
|
-
|
|
1349
|
-
### Working on Container Superposition
|
|
1350
|
-
|
|
1351
|
-
This repository dogfoods its own tooling! The development environment is set up using Container Superposition itself.
|
|
1352
|
-
|
|
1353
|
-
**Quick Start:**
|
|
1354
|
-
|
|
1355
|
-
```bash
|
|
1356
|
-
# Clone and open in VS Code
|
|
1357
|
-
git clone https://github.com/veggerby/container-superposition.git
|
|
1358
|
-
cd container-superposition
|
|
1359
|
-
code .
|
|
1360
|
-
|
|
1361
|
-
# When prompted, click "Reopen in Container"
|
|
1362
|
-
# The devcontainer includes:
|
|
1363
|
-
# - Node.js with TypeScript
|
|
1364
|
-
# - Docker access (via host socket)
|
|
1365
|
-
# - Git helpers and modern CLI tools
|
|
1366
|
-
# - Codex for AI assistance
|
|
1367
|
-
```
|
|
1368
|
-
|
|
1369
|
-
**Without Devcontainer:**
|
|
1370
|
-
|
|
1371
|
-
```bash
|
|
1372
|
-
npm install # Install dependencies
|
|
1373
|
-
npm run build # Compile TypeScript
|
|
1374
|
-
npm run init # Run the tool
|
|
1375
|
-
npm test # Run tests
|
|
1376
|
-
```
|
|
1377
|
-
|
|
1378
|
-
**Development Workflow:**
|
|
1379
|
-
|
|
1380
|
-
1. Make changes to TypeScript sources in `scripts/` or `tool/`
|
|
1381
|
-
2. Run `npm run build` to compile
|
|
1382
|
-
3. Test with `npm run init` or `npm test`
|
|
1383
|
-
4. Submit PR following [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
1384
|
-
|
|
1385
|
-
The `.devcontainer/` folder is generated using:
|
|
1386
|
-
|
|
1387
|
-
```bash
|
|
1388
|
-
npm run init -- --stack plain --language nodejs --dev-tools codex,docker-sock,git-helpers,modern-cli-tools
|
|
1389
|
-
```
|
|
83
|
+
- [Docs index](https://github.com/veggerby/container-superposition/blob/main/docs/README.md)
|
|
84
|
+
- [Quick reference](https://github.com/veggerby/container-superposition/blob/main/docs/quick-reference.md)
|
|
85
|
+
- [Adopt command](https://github.com/veggerby/container-superposition/blob/main/docs/adopt.md)
|
|
86
|
+
- [Hash command](https://github.com/veggerby/container-superposition/blob/main/docs/hash.md)
|
|
87
|
+
- [Examples](https://github.com/veggerby/container-superposition/blob/main/docs/examples.md)
|
|
88
|
+
- [Presets](https://github.com/veggerby/container-superposition/blob/main/docs/presets.md)
|
|
89
|
+
- [Architecture](https://github.com/veggerby/container-superposition/blob/main/docs/architecture.md)
|
|
90
|
+
- [Overlays](https://github.com/veggerby/container-superposition/blob/main/docs/overlays.md)
|
|
91
|
+
- [Custom patches](https://github.com/veggerby/container-superposition/blob/main/docs/custom-patches.md)
|
|
92
|
+
- [Workflows and regen](https://github.com/veggerby/container-superposition/blob/main/docs/workflows.md)
|
|
93
|
+
- [Filesystem contract](https://github.com/veggerby/container-superposition/blob/main/docs/filesystem-contract.md)
|
|
94
|
+
- [Security](https://github.com/veggerby/container-superposition/blob/main/docs/security.md)
|
|
95
|
+
- [Publishing](https://github.com/veggerby/container-superposition/blob/main/docs/publishing.md)
|
|
1390
96
|
|
|
1391
|
-
##
|
|
97
|
+
## Examples
|
|
1392
98
|
|
|
1393
|
-
|
|
99
|
+
- [Example projects](https://github.com/veggerby/container-superposition/tree/main/examples)
|
|
100
|
+
- [Examples guide](https://github.com/veggerby/container-superposition/blob/main/docs/examples.md)
|
|
1394
101
|
|
|
1395
|
-
|
|
102
|
+
## Contributing
|
|
1396
103
|
|
|
1397
|
-
-
|
|
1398
|
-
- Well-documented
|
|
1399
|
-
- Fast to build
|
|
1400
|
-
- Easy to understand
|
|
104
|
+
See [CONTRIBUTING.md](https://github.com/veggerby/container-superposition/blob/main/CONTRIBUTING.md)
|
|
1401
105
|
|
|
1402
|
-
##
|
|
106
|
+
## License
|
|
1403
107
|
|
|
1404
|
-
MIT
|
|
108
|
+
MIT. See [LICENSE](https://github.com/veggerby/container-superposition/blob/main/LICENSE)
|