container-superposition 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -1
- package/dist/scripts/init.js +235 -179
- package/dist/scripts/init.js.map +1 -1
- package/dist/tool/commands/doctor.d.ts +15 -0
- package/dist/tool/commands/doctor.d.ts.map +1 -0
- package/dist/tool/commands/doctor.js +862 -0
- package/dist/tool/commands/doctor.js.map +1 -0
- package/dist/tool/commands/explain.d.ts +13 -0
- package/dist/tool/commands/explain.d.ts.map +1 -0
- package/dist/tool/commands/explain.js +211 -0
- package/dist/tool/commands/explain.js.map +1 -0
- package/dist/tool/commands/list.d.ts +16 -0
- package/dist/tool/commands/list.d.ts.map +1 -0
- package/dist/tool/commands/list.js +121 -0
- package/dist/tool/commands/list.js.map +1 -0
- package/dist/tool/commands/plan.d.ts +16 -0
- package/dist/tool/commands/plan.d.ts.map +1 -0
- package/dist/tool/commands/plan.js +329 -0
- package/dist/tool/commands/plan.js.map +1 -0
- package/dist/tool/questionnaire/composer.d.ts +6 -1
- package/dist/tool/questionnaire/composer.d.ts.map +1 -1
- package/dist/tool/questionnaire/composer.js +300 -202
- package/dist/tool/questionnaire/composer.js.map +1 -1
- package/dist/tool/readme/markdown-parser.d.ts.map +1 -1
- package/dist/tool/readme/markdown-parser.js.map +1 -1
- package/dist/tool/readme/readme-generator.d.ts.map +1 -1
- package/dist/tool/readme/readme-generator.js +11 -6
- package/dist/tool/readme/readme-generator.js.map +1 -1
- package/dist/tool/schema/deployment-targets.d.ts +77 -0
- package/dist/tool/schema/deployment-targets.d.ts.map +1 -0
- package/dist/tool/schema/deployment-targets.js +91 -0
- package/dist/tool/schema/deployment-targets.js.map +1 -0
- package/dist/tool/schema/manifest-migrations.d.ts +51 -0
- package/dist/tool/schema/manifest-migrations.d.ts.map +1 -0
- package/dist/tool/schema/manifest-migrations.js +159 -0
- package/dist/tool/schema/manifest-migrations.js.map +1 -0
- package/dist/tool/schema/overlay-loader.d.ts +1 -1
- package/dist/tool/schema/overlay-loader.d.ts.map +1 -1
- package/dist/tool/schema/overlay-loader.js +42 -14
- package/dist/tool/schema/overlay-loader.js.map +1 -1
- package/dist/tool/schema/types.d.ts +44 -2
- package/dist/tool/schema/types.d.ts.map +1 -1
- package/dist/tool/utils/merge.d.ts +134 -0
- package/dist/tool/utils/merge.d.ts.map +1 -0
- package/dist/tool/utils/merge.js +277 -0
- package/dist/tool/utils/merge.js.map +1 -0
- package/dist/tool/utils/port-utils.d.ts +29 -0
- package/dist/tool/utils/port-utils.d.ts.map +1 -0
- package/dist/tool/utils/port-utils.js +128 -0
- package/dist/tool/utils/port-utils.js.map +1 -0
- package/dist/tool/utils/version.d.ts +9 -0
- package/dist/tool/utils/version.d.ts.map +1 -0
- package/dist/tool/utils/version.js +32 -0
- package/dist/tool/utils/version.js.map +1 -0
- package/docs/architecture.md +25 -21
- package/docs/deployment-targets.md +150 -0
- package/docs/discovery-commands.md +442 -0
- package/docs/merge-strategy.md +700 -0
- package/docs/minimal-and-editor.md +265 -0
- package/docs/overlay-imports.md +209 -0
- package/docs/overlay-manifest-refactoring.md +2 -2
- package/docs/overlay-metadata-archive.md +1 -1
- package/docs/overlays.md +91 -23
- package/docs/presets-architecture.md +3 -3
- package/docs/presets.md +1 -1
- package/docs/publishing.md +36 -35
- package/docs/team-workflow.md +540 -0
- package/overlays/.presets/data-engineering.yml +392 -0
- package/overlays/.presets/event-sourced-service.yml +262 -0
- package/overlays/.presets/frontend.yml +287 -0
- package/overlays/.presets/k8s-operator-dev.yml +462 -0
- package/overlays/.registry/README.md +1 -1
- package/overlays/.registry/deployment-targets.yml +54 -0
- package/overlays/.shared/README.md +43 -0
- package/overlays/.shared/compose/common-healthchecks.yml +38 -0
- package/overlays/.shared/otel/instrumentation.env +20 -0
- package/overlays/.shared/otel/otel-base-config.yaml +30 -0
- package/overlays/.shared/vscode/recommended-extensions.json +14 -0
- package/overlays/README.md +1 -1
- package/overlays/codex/overlay.yml +1 -0
- package/overlays/duckdb/README.md +274 -0
- package/overlays/duckdb/devcontainer.patch.json +10 -0
- package/overlays/duckdb/overlay.yml +17 -0
- package/overlays/duckdb/setup.sh +45 -0
- package/overlays/duckdb/verify.sh +32 -0
- package/overlays/git-helpers/overlay.yml +1 -0
- package/overlays/grafana/README.md +5 -5
- package/overlays/grafana/dashboard-provider.yml +1 -1
- package/overlays/grafana/docker-compose.yml +2 -2
- package/overlays/grafana/overlay.yml +6 -1
- package/overlays/jaeger/overlay.yml +16 -3
- package/overlays/jupyter/.env.example +6 -0
- package/overlays/jupyter/README.md +210 -0
- package/overlays/jupyter/devcontainer.patch.json +14 -0
- package/overlays/jupyter/docker-compose.yml +23 -0
- package/overlays/jupyter/overlay.yml +18 -0
- package/overlays/jupyter/verify.sh +35 -0
- package/overlays/kind/README.md +221 -0
- package/overlays/kind/devcontainer.patch.json +10 -0
- package/overlays/kind/overlay.yml +18 -0
- package/overlays/kind/setup.sh +43 -0
- package/overlays/kind/verify.sh +40 -0
- package/overlays/localstack/.env.example +6 -0
- package/overlays/localstack/README.md +188 -0
- package/overlays/localstack/devcontainer.patch.json +21 -0
- package/overlays/localstack/docker-compose.yml +25 -0
- package/overlays/localstack/overlay.yml +18 -0
- package/overlays/localstack/verify.sh +47 -0
- package/overlays/loki/overlay.yml +6 -1
- package/overlays/modern-cli-tools/overlay.yml +1 -0
- package/overlays/mongodb/overlay.yml +12 -2
- package/overlays/mysql/overlay.yml +12 -2
- package/overlays/nats/overlay.yml +12 -2
- package/overlays/openapi-tools/README.md +243 -0
- package/overlays/openapi-tools/devcontainer.patch.json +10 -0
- package/overlays/openapi-tools/overlay.yml +16 -0
- package/overlays/openapi-tools/setup.sh +45 -0
- package/overlays/openapi-tools/verify.sh +51 -0
- package/overlays/otel-collector/overlay.yml.example +26 -0
- package/overlays/postgres/overlay.yml +6 -1
- package/overlays/prometheus/overlay.yml +6 -1
- package/overlays/rabbitmq/overlay.yml +12 -2
- package/overlays/redis/overlay.yml +6 -1
- package/overlays/tilt/README.md +259 -0
- package/overlays/tilt/devcontainer.patch.json +17 -0
- package/overlays/tilt/overlay.yml +19 -0
- package/overlays/tilt/setup.sh +25 -0
- package/overlays/tilt/verify.sh +24 -0
- package/package.json +8 -6
- package/tool/README.md +12 -16
- package/tool/schema/overlay-manifest.schema.json +64 -4
- package/tool/schema/superposition-manifest.schema.json +104 -0
- /package/overlays/{presets → .presets}/docs-site.yml +0 -0
- /package/overlays/{presets → .presets}/fullstack.yml +0 -0
- /package/overlays/{presets → .presets}/microservice.yml +0 -0
- /package/overlays/{presets → .presets}/web-api.yml +0 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Deployment Target Support
|
|
2
|
+
|
|
3
|
+
Container Superposition validates overlay compatibility with different deployment environments using the `--target` flag.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Specify deployment target
|
|
9
|
+
npx container-superposition init --target codespaces
|
|
10
|
+
npx container-superposition init --target gitpod
|
|
11
|
+
npx container-superposition init --target local # default
|
|
12
|
+
|
|
13
|
+
# With specific configuration
|
|
14
|
+
npx container-superposition init \
|
|
15
|
+
--stack compose \
|
|
16
|
+
--language nodejs \
|
|
17
|
+
--database postgres \
|
|
18
|
+
--dev-tools docker-in-docker \
|
|
19
|
+
--target codespaces
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Supported Deployment Targets
|
|
23
|
+
|
|
24
|
+
| Target | Description | Docker Support | Auto Port Forward |
|
|
25
|
+
| -------------- | --------------------------------- | -------------- | ----------------- |
|
|
26
|
+
| **local** | Local machine with Docker Desktop | ✅ Host Docker | No |
|
|
27
|
+
| **codespaces** | GitHub Codespaces (cloud IDE) | ⚠️ DinD only | Yes |
|
|
28
|
+
| **gitpod** | Gitpod workspaces | ⚠️ DinD only | Yes |
|
|
29
|
+
| **devpod** | DevPod client-only environments | ✅ Host Docker | No |
|
|
30
|
+
|
|
31
|
+
## How It Works
|
|
32
|
+
|
|
33
|
+
### Interactive Mode
|
|
34
|
+
|
|
35
|
+
If you select incompatible overlays (e.g., `docker-sock` for Codespaces), the tool will:
|
|
36
|
+
|
|
37
|
+
- Show which overlays won't work in your target environment
|
|
38
|
+
- Suggest compatible alternatives
|
|
39
|
+
- Let you choose your deployment target with informed guidance
|
|
40
|
+
|
|
41
|
+
**Example interaction:**
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
⚠️ Deployment Target Compatibility Check:
|
|
45
|
+
|
|
46
|
+
Some selected overlays may not work in all environments.
|
|
47
|
+
|
|
48
|
+
• Docker (host socket)
|
|
49
|
+
Not compatible with: GitHub Codespaces, Gitpod
|
|
50
|
+
Alternatives: Docker-in-Docker
|
|
51
|
+
|
|
52
|
+
Which environment are you targeting?
|
|
53
|
+
❯ 🖥️ Local Development (Docker Desktop)
|
|
54
|
+
☁️ GitHub Codespaces
|
|
55
|
+
🌐 Gitpod
|
|
56
|
+
📦 DevPod
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### CLI Mode
|
|
60
|
+
|
|
61
|
+
The target validates your selection and generates the configuration:
|
|
62
|
+
|
|
63
|
+
- Incompatibilities are allowed (you know what you're doing)
|
|
64
|
+
- Generated documentation notes any compatibility issues
|
|
65
|
+
|
|
66
|
+
## Example Configurations
|
|
67
|
+
|
|
68
|
+
### Optimized for GitHub Codespaces
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx container-superposition init \
|
|
72
|
+
--stack compose \
|
|
73
|
+
--language nodejs \
|
|
74
|
+
--database postgres \
|
|
75
|
+
--dev-tools docker-in-docker \
|
|
76
|
+
--target codespaces
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Local Development
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npx container-superposition init \
|
|
83
|
+
--stack compose \
|
|
84
|
+
--language nodejs \
|
|
85
|
+
--database postgres \
|
|
86
|
+
--dev-tools docker-sock \
|
|
87
|
+
--target local
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Key Compatibility Rules
|
|
91
|
+
|
|
92
|
+
- ⚠️ **docker-sock** requires host Docker → Use in `local` or `devpod` only
|
|
93
|
+
- ✅ **docker-in-docker** works everywhere → Recommended for `codespaces` and `gitpod`
|
|
94
|
+
- 🔄 Cloud targets auto-forward ports → No manual forwarding needed
|
|
95
|
+
|
|
96
|
+
## Environment Differences
|
|
97
|
+
|
|
98
|
+
Different environments have different capabilities:
|
|
99
|
+
|
|
100
|
+
### Codespaces/Gitpod
|
|
101
|
+
|
|
102
|
+
- **No access to host Docker daemon** - Must use docker-in-docker
|
|
103
|
+
- **Auto-forward ports** - Ports are automatically accessible
|
|
104
|
+
- **Cloud-based** - Resources may be constrained
|
|
105
|
+
|
|
106
|
+
### Local
|
|
107
|
+
|
|
108
|
+
- **Full access to host Docker** - Can use docker-sock for better performance
|
|
109
|
+
- **Faster builds** - Shared cache with host
|
|
110
|
+
- **Manual port forwarding** - Need to expose ports explicitly
|
|
111
|
+
|
|
112
|
+
### DevPod
|
|
113
|
+
|
|
114
|
+
- **Client-managed** - Runs on your infrastructure
|
|
115
|
+
- **Can access host Docker** - Depending on setup
|
|
116
|
+
- **Flexible** - Configure based on your needs
|
|
117
|
+
|
|
118
|
+
## Why Deployment Targets?
|
|
119
|
+
|
|
120
|
+
The target system ensures you get warnings about incompatibilities before deploying. This prevents:
|
|
121
|
+
|
|
122
|
+
- Wasted time debugging environment-specific issues
|
|
123
|
+
- Confusion about why overlays don't work in cloud IDEs
|
|
124
|
+
- Having to manually research compatibility
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
Target configurations are stored in `overlays/.registry/deployment-targets.yml`. To add a new target, simply add an entry to this file:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
- id: new-target
|
|
132
|
+
name: New Target
|
|
133
|
+
description: Description of the target
|
|
134
|
+
incompatibleOverlays:
|
|
135
|
+
- docker-sock
|
|
136
|
+
recommendations:
|
|
137
|
+
docker-sock:
|
|
138
|
+
- docker-in-docker
|
|
139
|
+
portForwarding:
|
|
140
|
+
defaultBehavior: notify
|
|
141
|
+
autoForward: true
|
|
142
|
+
constraints:
|
|
143
|
+
hasHostDocker: false
|
|
144
|
+
supportsPrivileged: true
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## See Also
|
|
148
|
+
|
|
149
|
+
- [Discovery Commands](discovery-commands.md) - Explore overlays before generating
|
|
150
|
+
- [Overlays Documentation](overlays.md) - Complete overlay reference
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# Discovery and Planning Commands
|
|
2
|
+
|
|
3
|
+
Container Superposition provides powerful commands to explore available overlays and preview what will be generated before creating a devcontainer.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
- **`list`** - Discover available overlays with filtering
|
|
8
|
+
- **`explain`** - Deep dive into a specific overlay
|
|
9
|
+
- **`plan`** - Preview the generation plan before creating
|
|
10
|
+
|
|
11
|
+
All commands support `--json` output for scripting and automation.
|
|
12
|
+
|
|
13
|
+
## List Command
|
|
14
|
+
|
|
15
|
+
The `list` command displays all available overlays, optionally filtered by category, tags, or stack support.
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# List all overlays grouped by category
|
|
21
|
+
npx container-superposition list
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Output:**
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
╭─────────────────────╮
|
|
28
|
+
│ Available Overlays │
|
|
29
|
+
╰─────────────────────╯
|
|
30
|
+
|
|
31
|
+
📚 Language & Framework
|
|
32
|
+
dotnet .NET 10 SDK with C# DevKit
|
|
33
|
+
nodejs Node.js LTS with TypeScript and tooling
|
|
34
|
+
python Python 3.12 with linting and formatting
|
|
35
|
+
...
|
|
36
|
+
|
|
37
|
+
🗄️ Database & Messaging
|
|
38
|
+
postgres PostgreSQL 16 database
|
|
39
|
+
redis Redis 7 cache
|
|
40
|
+
mongodb MongoDB 8 with Mongo Express web UI
|
|
41
|
+
...
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Filtering Options
|
|
45
|
+
|
|
46
|
+
#### Filter by Category
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Show only language overlays
|
|
50
|
+
npx container-superposition list --category language
|
|
51
|
+
|
|
52
|
+
# Show only database overlays
|
|
53
|
+
npx container-superposition list --category database
|
|
54
|
+
|
|
55
|
+
# Available categories: language, database, observability, cloud, dev, preset
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Output format:** When filtering, output switches to table format showing ID, NAME, CATEGORY, PORTS, and REQUIRES columns.
|
|
59
|
+
|
|
60
|
+
#### Filter by Tags
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Show overlays tagged with 'observability'
|
|
64
|
+
npx container-superposition list --tags observability
|
|
65
|
+
|
|
66
|
+
# Multiple tags (OR logic - matches any)
|
|
67
|
+
npx container-superposition list --tags observability,tracing
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Filter by Stack Support
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Show overlays that work with compose stack
|
|
74
|
+
npx container-superposition list --supports compose
|
|
75
|
+
|
|
76
|
+
# Show overlays that work with plain stack
|
|
77
|
+
npx container-superposition list --supports plain
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Note:** Overlays with empty `supports` array work with all stacks and will be included in any stack filter.
|
|
81
|
+
|
|
82
|
+
### JSON Output
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Export as JSON for scripting
|
|
86
|
+
npx container-superposition list --json
|
|
87
|
+
|
|
88
|
+
# Combine with filters
|
|
89
|
+
npx container-superposition list --category database --json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Example output:**
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
"id": "postgres",
|
|
98
|
+
"name": "PostgreSQL",
|
|
99
|
+
"description": "PostgreSQL 16 database",
|
|
100
|
+
"category": "database",
|
|
101
|
+
"supports": ["compose"],
|
|
102
|
+
"requires": [],
|
|
103
|
+
"suggests": [],
|
|
104
|
+
"conflicts": [],
|
|
105
|
+
"tags": ["database", "sql", "postgres"],
|
|
106
|
+
"ports": [5432]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Explain Command
|
|
112
|
+
|
|
113
|
+
The `explain` command provides detailed information about a specific overlay, including files, patches, dependencies, and configuration.
|
|
114
|
+
|
|
115
|
+
### Basic Usage
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Explain the postgres overlay
|
|
119
|
+
npx container-superposition explain postgres
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Output:**
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
╭────────────────────────╮
|
|
126
|
+
│ PostgreSQL (postgres) │
|
|
127
|
+
╰────────────────────────╯
|
|
128
|
+
|
|
129
|
+
Description:
|
|
130
|
+
PostgreSQL 16 database
|
|
131
|
+
|
|
132
|
+
Category: database
|
|
133
|
+
Tags: database, sql, postgres
|
|
134
|
+
|
|
135
|
+
Stack Compatibility:
|
|
136
|
+
✓ compose
|
|
137
|
+
|
|
138
|
+
Dependencies:
|
|
139
|
+
No required dependencies
|
|
140
|
+
|
|
141
|
+
Ports Exposed:
|
|
142
|
+
5432
|
|
143
|
+
|
|
144
|
+
Files:
|
|
145
|
+
📄 .env.example
|
|
146
|
+
📄 README.md
|
|
147
|
+
📄 devcontainer.patch.json
|
|
148
|
+
📄 docker-compose.yml
|
|
149
|
+
📄 overlay.yml
|
|
150
|
+
📄 verify.sh
|
|
151
|
+
|
|
152
|
+
DevContainer Configuration:
|
|
153
|
+
Features:
|
|
154
|
+
• ghcr.io/robbert229/devcontainer-features/postgresql-client:1
|
|
155
|
+
Port Forwarding:
|
|
156
|
+
• 5432 (PostgreSQL)
|
|
157
|
+
Environment Variables:
|
|
158
|
+
• POSTGRES_HOST=postgres
|
|
159
|
+
• POSTGRES_PORT=5432
|
|
160
|
+
• POSTGRES_DB=devdb
|
|
161
|
+
|
|
162
|
+
Docker Compose Services:
|
|
163
|
+
🐳 postgres
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### What's Included
|
|
167
|
+
|
|
168
|
+
The `explain` command shows:
|
|
169
|
+
|
|
170
|
+
1. **Basic Information** - Name, description, category, tags
|
|
171
|
+
2. **Stack Compatibility** - Which base templates it works with
|
|
172
|
+
3. **Dependencies** - Required, suggested, and conflicting overlays
|
|
173
|
+
4. **Ports** - All exposed ports
|
|
174
|
+
5. **Files** - All files in the overlay directory
|
|
175
|
+
6. **DevContainer Patches** - Features, extensions, port forwarding, environment variables
|
|
176
|
+
7. **Docker Compose Services** - Services that will be added (for compose overlays)
|
|
177
|
+
|
|
178
|
+
### JSON Output
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Get overlay details as JSON
|
|
182
|
+
npx container-superposition explain nodejs --json
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Example output:**
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"id": "nodejs",
|
|
190
|
+
"name": "Node.js",
|
|
191
|
+
"description": "Node.js LTS with TypeScript and tooling",
|
|
192
|
+
"category": "language",
|
|
193
|
+
"supports": [],
|
|
194
|
+
"requires": [],
|
|
195
|
+
"suggests": [],
|
|
196
|
+
"conflicts": [],
|
|
197
|
+
"tags": ["language", "nodejs", "javascript", "typescript"],
|
|
198
|
+
"ports": [],
|
|
199
|
+
"files": [
|
|
200
|
+
"README.md",
|
|
201
|
+
"devcontainer.patch.json",
|
|
202
|
+
"global-packages.txt",
|
|
203
|
+
"overlay.yml",
|
|
204
|
+
"setup.sh",
|
|
205
|
+
"verify.sh"
|
|
206
|
+
],
|
|
207
|
+
"devcontainerPatch": {
|
|
208
|
+
"features": {
|
|
209
|
+
"ghcr.io/devcontainers/features/node:1": {
|
|
210
|
+
"version": "lts"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Plan Command
|
|
218
|
+
|
|
219
|
+
The `plan` command shows a dry-run preview of what will be generated, including dependency resolution, port mappings, and conflict detection.
|
|
220
|
+
|
|
221
|
+
### Basic Usage
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Preview generation for postgres and grafana
|
|
225
|
+
npx container-superposition plan --stack compose --overlays postgres,grafana
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Output:**
|
|
229
|
+
|
|
230
|
+
```
|
|
231
|
+
╭──────────────────╮
|
|
232
|
+
│ Generation Plan │
|
|
233
|
+
╰──────────────────╯
|
|
234
|
+
|
|
235
|
+
Stack: compose
|
|
236
|
+
|
|
237
|
+
Overlays Selected:
|
|
238
|
+
✓ postgres (PostgreSQL)
|
|
239
|
+
✓ grafana (Grafana)
|
|
240
|
+
|
|
241
|
+
Auto-Added Dependencies:
|
|
242
|
+
+ prometheus (Prometheus)
|
|
243
|
+
|
|
244
|
+
Port Mappings:
|
|
245
|
+
postgres: 5432
|
|
246
|
+
grafana: 3000
|
|
247
|
+
prometheus: 9090
|
|
248
|
+
|
|
249
|
+
Files to Create/Modify:
|
|
250
|
+
.devcontainer/
|
|
251
|
+
📄 .env.example
|
|
252
|
+
📄 README.md
|
|
253
|
+
📄 devcontainer.json
|
|
254
|
+
📄 docker-compose.yml
|
|
255
|
+
📄 superposition.json
|
|
256
|
+
.devcontainer/scripts/
|
|
257
|
+
📄 setup-postgres.sh
|
|
258
|
+
📄 verify-grafana.sh
|
|
259
|
+
📄 verify-postgres.sh
|
|
260
|
+
📄 verify-prometheus.sh
|
|
261
|
+
|
|
262
|
+
✓ No conflicts detected. Ready to generate!
|
|
263
|
+
Run: container-superposition init --stack compose --overlays postgres,grafana
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Required Options
|
|
267
|
+
|
|
268
|
+
- `--stack <type>` - Base template: `plain` or `compose`
|
|
269
|
+
- `--overlays <list>` - Comma-separated list of overlay IDs
|
|
270
|
+
|
|
271
|
+
### Optional Options
|
|
272
|
+
|
|
273
|
+
- `--port-offset <number>` - Add offset to all exposed ports
|
|
274
|
+
- `--json` - Output as JSON
|
|
275
|
+
|
|
276
|
+
### Port Offset Example
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Add 100 to all ports to avoid conflicts
|
|
280
|
+
npx container-superposition plan --stack compose --overlays postgres,redis --port-offset 100
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Output:**
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
Port Mappings:
|
|
287
|
+
(Offset: +100)
|
|
288
|
+
postgres: 5432 → 5532
|
|
289
|
+
redis: 6379 → 6479
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Dependency Resolution
|
|
293
|
+
|
|
294
|
+
The `plan` command automatically resolves dependencies:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Grafana requires Prometheus
|
|
298
|
+
npx container-superposition plan --stack compose --overlays grafana
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**Output:**
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
Overlays Selected:
|
|
305
|
+
✓ grafana (Grafana)
|
|
306
|
+
|
|
307
|
+
Auto-Added Dependencies:
|
|
308
|
+
+ prometheus (Prometheus)
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Conflict Detection
|
|
312
|
+
|
|
313
|
+
The `plan` command detects conflicts before generation:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# docker-in-docker and docker-sock conflict
|
|
317
|
+
npx container-superposition plan --stack compose --overlays docker-in-docker,docker-sock
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Output:**
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
⚠ Conflicts Detected:
|
|
324
|
+
✗ docker-in-docker conflicts with: docker-sock
|
|
325
|
+
✗ docker-sock conflicts with: docker-in-docker
|
|
326
|
+
|
|
327
|
+
These conflicts must be resolved before generation.
|
|
328
|
+
|
|
329
|
+
⚠ Cannot proceed with generation due to conflicts. Remove conflicting overlays.
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### JSON Output
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
# Get plan as JSON
|
|
336
|
+
npx container-superposition plan --stack compose --overlays postgres --json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Example output:**
|
|
340
|
+
|
|
341
|
+
```json
|
|
342
|
+
{
|
|
343
|
+
"stack": "compose",
|
|
344
|
+
"selectedOverlays": ["postgres"],
|
|
345
|
+
"autoAddedOverlays": [],
|
|
346
|
+
"conflicts": [],
|
|
347
|
+
"portMappings": [
|
|
348
|
+
{
|
|
349
|
+
"overlay": "postgres",
|
|
350
|
+
"ports": [5432],
|
|
351
|
+
"offsetPorts": [5432]
|
|
352
|
+
}
|
|
353
|
+
],
|
|
354
|
+
"files": [
|
|
355
|
+
".devcontainer/devcontainer.json",
|
|
356
|
+
".devcontainer/superposition.json",
|
|
357
|
+
".devcontainer/docker-compose.yml",
|
|
358
|
+
".devcontainer/.env.example",
|
|
359
|
+
".devcontainer/README.md"
|
|
360
|
+
],
|
|
361
|
+
"portOffset": 0
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Scripting Examples
|
|
366
|
+
|
|
367
|
+
### Export All Overlays to JSON
|
|
368
|
+
|
|
369
|
+
```bash
|
|
370
|
+
# Get all overlay metadata
|
|
371
|
+
npx container-superposition list --json > overlays.json
|
|
372
|
+
|
|
373
|
+
# Filter and process with jq
|
|
374
|
+
npx container-superposition list --category database --json | jq '.[].id'
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Validate Overlay Configuration
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
# Check if overlay exists and get its details
|
|
381
|
+
npx container-superposition explain postgres --json | jq '.id, .category, .ports'
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### Pre-validate Before Generation
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
#!/bin/bash
|
|
388
|
+
|
|
389
|
+
# Plan first, then generate only if no conflicts
|
|
390
|
+
PLAN=$(npx container-superposition plan --stack compose --overlays $OVERLAYS --json)
|
|
391
|
+
|
|
392
|
+
if echo "$PLAN" | jq -e '.conflicts | length == 0' > /dev/null; then
|
|
393
|
+
echo "✓ No conflicts, proceeding with generation..."
|
|
394
|
+
npx container-superposition init --stack compose --overlays $OVERLAYS
|
|
395
|
+
else
|
|
396
|
+
echo "✗ Conflicts detected, aborting"
|
|
397
|
+
exit 1
|
|
398
|
+
fi
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## Workflow Examples
|
|
402
|
+
|
|
403
|
+
### Discovering Observability Tools
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
# 1. Find all observability overlays
|
|
407
|
+
npx container-superposition list --tags observability
|
|
408
|
+
|
|
409
|
+
# 2. Explore Grafana in detail
|
|
410
|
+
npx container-superposition explain grafana
|
|
411
|
+
|
|
412
|
+
# 3. Plan the full observability stack
|
|
413
|
+
npx container-superposition plan --stack compose --overlays grafana,loki,tempo
|
|
414
|
+
|
|
415
|
+
# 4. Generate if plan looks good
|
|
416
|
+
npx container-superposition init --stack compose --overlays grafana,loki,tempo
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Building a Microservice Stack
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# 1. List available messaging options
|
|
423
|
+
npx container-superposition list --tags messaging
|
|
424
|
+
|
|
425
|
+
# 2. Compare RabbitMQ vs Redpanda
|
|
426
|
+
npx container-superposition explain rabbitmq
|
|
427
|
+
npx container-superposition explain redpanda
|
|
428
|
+
|
|
429
|
+
# 3. Plan the stack with dependencies
|
|
430
|
+
npx container-superposition plan --stack compose --overlays nodejs,rabbitmq,jaeger
|
|
431
|
+
|
|
432
|
+
# 4. Review auto-added dependencies and generate
|
|
433
|
+
npx container-superposition init --stack compose --overlays nodejs,rabbitmq,jaeger
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
## Benefits
|
|
437
|
+
|
|
438
|
+
- **Visibility** - Know what's available without reading docs
|
|
439
|
+
- **Predictability** - See exactly what will be created before generation
|
|
440
|
+
- **Confidence** - Catch conflicts and dependency issues early
|
|
441
|
+
- **Automation** - JSON output enables scripting and CI/CD integration
|
|
442
|
+
- **Learning** - Understand overlay structure and composition
|