container-superposition 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +365 -9
  2. package/dist/scripts/init.js +220 -94
  3. package/dist/scripts/init.js.map +1 -1
  4. package/dist/tool/commands/doctor.js +2 -2
  5. package/dist/tool/commands/explain.d.ts.map +1 -1
  6. package/dist/tool/commands/explain.js +88 -0
  7. package/dist/tool/commands/explain.js.map +1 -1
  8. package/dist/tool/commands/plan.d.ts +51 -0
  9. package/dist/tool/commands/plan.d.ts.map +1 -1
  10. package/dist/tool/commands/plan.js +523 -1
  11. package/dist/tool/commands/plan.js.map +1 -1
  12. package/dist/tool/questionnaire/composer.d.ts +12 -3
  13. package/dist/tool/questionnaire/composer.d.ts.map +1 -1
  14. package/dist/tool/questionnaire/composer.js +133 -20
  15. package/dist/tool/questionnaire/composer.js.map +1 -1
  16. package/dist/tool/schema/types.d.ts +18 -0
  17. package/dist/tool/schema/types.d.ts.map +1 -1
  18. package/dist/tool/utils/gitignore.d.ts +15 -0
  19. package/dist/tool/utils/gitignore.d.ts.map +1 -0
  20. package/dist/tool/utils/gitignore.js +41 -0
  21. package/dist/tool/utils/gitignore.js.map +1 -0
  22. package/dist/tool/utils/services-export.d.ts +14 -0
  23. package/dist/tool/utils/services-export.d.ts.map +1 -0
  24. package/dist/tool/utils/services-export.js +478 -0
  25. package/dist/tool/utils/services-export.js.map +1 -0
  26. package/dist/tool/utils/summary.d.ts +69 -0
  27. package/dist/tool/utils/summary.d.ts.map +1 -0
  28. package/dist/tool/utils/summary.js +260 -0
  29. package/dist/tool/utils/summary.js.map +1 -0
  30. package/docs/overlays.md +48 -5
  31. package/overlays/.presets/microservice.yml +32 -6
  32. package/overlays/.presets/web-api.yml +76 -56
  33. package/overlays/cloudflared/README.md +190 -0
  34. package/overlays/cloudflared/devcontainer.patch.json +3 -0
  35. package/overlays/cloudflared/overlay.yml +15 -0
  36. package/overlays/cloudflared/setup.sh +49 -0
  37. package/overlays/cloudflared/verify.sh +21 -0
  38. package/overlays/direnv/README.md +6 -4
  39. package/overlays/direnv/setup.sh +0 -12
  40. package/overlays/grpc-tools/README.md +242 -0
  41. package/overlays/grpc-tools/devcontainer.patch.json +14 -0
  42. package/overlays/grpc-tools/overlay.yml +14 -0
  43. package/overlays/grpc-tools/setup.sh +57 -0
  44. package/overlays/grpc-tools/verify.sh +47 -0
  45. package/overlays/keycloak/.env.example +5 -0
  46. package/overlays/keycloak/README.md +238 -0
  47. package/overlays/keycloak/devcontainer.patch.json +17 -0
  48. package/overlays/keycloak/docker-compose.yml +32 -0
  49. package/overlays/keycloak/overlay.yml +23 -0
  50. package/overlays/keycloak/verify.sh +54 -0
  51. package/overlays/mailpit/.env.example +4 -0
  52. package/overlays/mailpit/README.md +191 -0
  53. package/overlays/mailpit/devcontainer.patch.json +20 -0
  54. package/overlays/mailpit/docker-compose.yml +17 -0
  55. package/overlays/mailpit/overlay.yml +26 -0
  56. package/overlays/mailpit/verify.sh +52 -0
  57. package/overlays/ngrok/overlay.yml +2 -1
  58. package/overlays/python/README.md +51 -35
  59. package/overlays/python/devcontainer.patch.json +7 -4
  60. package/overlays/python/setup.sh +50 -23
  61. package/overlays/python/verify.sh +29 -1
  62. package/package.json +1 -1
@@ -0,0 +1,52 @@
1
+ #!/bin/bash
2
+ # Verification script for Mailpit overlay
3
+ # Confirms Mailpit is running and accessible
4
+
5
+ set -e
6
+
7
+ echo "🔍 Verifying Mailpit overlay..."
8
+ echo ""
9
+
10
+ # Check if curl is available
11
+ echo "1ī¸âƒŖ Checking curl availability..."
12
+ if ! command -v curl &> /dev/null; then
13
+ echo " ❌ curl not found"
14
+ exit 1
15
+ fi
16
+ echo " ✅ curl found"
17
+
18
+ # Check Mailpit web UI
19
+ echo ""
20
+ echo "2ī¸âƒŖ Checking Mailpit service..."
21
+ MAILPIT_HOST="${MAILPIT_HOST:-mailpit}"
22
+ MAILPIT_UI_PORT="${MAILPIT_UI_PORT:-8025}"
23
+ MAILPIT_READY=false
24
+
25
+ for i in {1..20}; do
26
+ if curl -sf "http://${MAILPIT_HOST}:${MAILPIT_UI_PORT}/api/v1/info" &> /dev/null; then
27
+ echo " ✅ Mailpit service is ready"
28
+ MAILPIT_READY=true
29
+ break
30
+ fi
31
+ sleep 2
32
+ done
33
+
34
+ if [ "$MAILPIT_READY" = false ]; then
35
+ echo " ❌ Mailpit service not ready after 40 seconds"
36
+ exit 1
37
+ fi
38
+
39
+ # Check Mailpit API
40
+ echo ""
41
+ echo "3ī¸âƒŖ Checking Mailpit API..."
42
+ if curl -sf "http://${MAILPIT_HOST}:${MAILPIT_UI_PORT}/api/v1/messages" &> /dev/null; then
43
+ echo " ✅ Mailpit API is accessible"
44
+ else
45
+ echo " ❌ Mailpit API not accessible"
46
+ exit 1
47
+ fi
48
+
49
+ echo ""
50
+ echo "✅ Mailpit overlay verification complete"
51
+ echo " Web UI: http://localhost:${MAILPIT_UI_PORT}"
52
+ echo " SMTP server: mailpit:1025 (from inside container)"
@@ -5,7 +5,8 @@ category: dev
5
5
  supports: []
6
6
  requires: []
7
7
  suggests: []
8
- conflicts: []
8
+ conflicts:
9
+ - cloudflared
9
10
  tags:
10
11
  - dev
11
12
  - tunneling
@@ -5,67 +5,84 @@ Adds Python 3.12 with development tools, linting, and formatting.
5
5
  ## Features
6
6
 
7
7
  - **Python 3.12** with pip, setuptools, and wheel
8
+ - **Virtual environment** (`.venv`) created automatically in the workspace root
8
9
  - **VS Code Extensions:**
9
10
  - Python (ms-python.python)
10
11
  - Pylance (ms-python.vscode-pylance)
11
12
  - Black Formatter (ms-python.black-formatter)
12
13
  - Ruff (charliermarsh.ruff)
13
- - **Automatic dependency installation** from:
14
- - `requirements.txt`
15
- - `requirements-dev.txt`
14
+ - **Automatic dependency installation** into `.venv` from:
15
+ - `requirements.txt` (project production dependencies)
16
+ - `requirements-dev.txt` (project development dependencies)
16
17
  - `pyproject.toml` (editable install)
17
18
  - `setup.py` (legacy support)
18
19
  - **Pre-configured settings:**
20
+ - VS Code interpreter pointed at `.venv/bin/python`
19
21
  - Black as default formatter
20
22
  - Format on save enabled
21
23
  - Auto-organize imports
22
- - PYTHONPATH set to workspace root
24
+ - `PYTHONPATH`, `VIRTUAL_ENV`, and `PATH` set for the venv
25
+ - **`.gitignore`** — `.venv/`, `__pycache__/`, `*.pyc`, `.pytest_cache/`, and build artefacts added to the project root `.gitignore` automatically
23
26
 
24
- ## Virtual Environment Philosophy
27
+ ## Virtual Environment
25
28
 
26
- This overlay uses **user-level pip installations** (`pip install --user`) instead of virtual environments inside the container for these reasons:
29
+ This overlay automatically creates a `.venv` virtual environment in the workspace root on container creation and installs all dependencies into it.
27
30
 
28
- ### Why Not venv in Container?
31
+ ### Why venv?
29
32
 
30
- 1. **Container IS the environment** - The devcontainer already provides isolation
31
- 2. **Simpler workflow** - No need to activate/deactivate venv
32
- 3. **Better VS Code integration** - Python extension finds packages automatically
33
- 4. **Fewer moving parts** - Less to go wrong
33
+ 1. **Clean isolation** — Dependencies are scoped to the project, not the system Python
34
+ 2. **Production parity** — Matches how the app runs in CI/CD and production
35
+ 3. **Tool compatibility** — Works seamlessly with pytest, mypy, ruff, and other dev tools
36
+ 4. **VS Code integration** — The Python extension is pre-configured to use `.venv/bin/python`
34
37
 
35
- ### When to Use venv
38
+ ### How It Works
36
39
 
37
- Use a virtual environment if you need:
40
+ On container creation, the setup script:
38
41
 
39
- - Multiple Python versions in the same container
40
- - Strict dependency isolation for testing
41
- - Exact production parity (though containers already provide this)
42
+ 1. Creates `.venv` at `${workspaceFolder}/.venv` using `python -m venv`
43
+ 2. Upgrades `pip`, `setuptools`, and `wheel` inside the venv
44
+ 3. Installs overlay default packages from `.devcontainer/requirements-overlay-python.txt`
45
+ 4. Installs project dependencies from `requirements.txt` (if present)
46
+ 5. Installs dev dependencies from `requirements-dev.txt` (if present)
47
+ 6. Installs project in editable mode if `pyproject.toml` or `setup.py` is present
42
48
 
43
- To create a venv manually:
49
+ ### Activating the Virtual Environment
50
+
51
+ The `.venv/bin` directory is prepended to `PATH` automatically in the devcontainer, so tools like `python`, `pip`, `pytest`, and `ruff` resolve to the venv by default. You can also activate explicitly:
44
52
 
45
53
  ```bash
46
- python -m venv .venv
47
54
  source .venv/bin/activate
48
- pip install -r requirements.txt
49
55
  ```
50
56
 
51
- Then update VS Code settings:
57
+ ### Gitignore
52
58
 
53
- ```json
54
- {
55
- "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
56
- }
59
+ When the Python overlay is selected, the composer automatically adds Python-specific entries to the **project root** `.gitignore` (creating the file if it doesn’t exist, and never duplicating existing entries):
60
+
61
+ ```gitignore
62
+ # python (container-superposition)
63
+ .venv/
64
+ __pycache__/
65
+ *.pyc
66
+ *.pyo
67
+ .pytest_cache/
68
+ *.egg-info/
69
+ dist/
70
+ build/
57
71
  ```
58
72
 
73
+ This happens at generation time — no container startup required.
74
+
59
75
  ## Automatic Setup
60
76
 
61
77
  The overlay automatically runs on container creation:
62
78
 
63
- 1. ✅ Installs overlay packages from `.devcontainer/requirements-overlay.txt`
64
- 2. ✅ Checks for `requirements.txt` → installs with pip
65
- 3. ✅ Checks for `requirements-dev.txt` → installs dev dependencies
66
- 4. ✅ Checks for `pyproject.toml` → installs project in editable mode
67
- 5. ✅ Checks for `setup.py` → installs legacy projects
68
- 6. ✅ Upgrades pip, setuptools, and wheel to latest
79
+ 1. ✅ Creates `.venv` virtual environment in the workspace root
80
+ 2. ✅ Upgrades pip, setuptools, and wheel inside the venv
81
+ 3. ✅ Installs overlay packages from `.devcontainer/requirements-overlay-python.txt`
82
+ 4. ✅ Checks for `requirements.txt` → installs into venv
83
+ 5. ✅ Checks for `requirements-dev.txt` → installs dev dependencies into venv
84
+ 6. ✅ Checks for `pyproject.toml` → installs project in editable mode
85
+ 7. ✅ Checks for `setup.py` → installs legacy projects in editable mode
69
86
 
70
87
  ## Customizing Overlay Packages
71
88
 
@@ -176,7 +193,7 @@ mytool = "mytool.cli:main"
176
193
  1. **Pin versions** in requirements.txt for reproducibility
177
194
  2. **Separate dev dependencies** in requirements-dev.txt
178
195
  3. **Use pyproject.toml** for modern Python projects
179
- 4. **Add `.gitignore`** for `__pycache__`, `.pytest_cache`, etc.
196
+ 4. **Add `.gitignore`** — handled automatically by the overlay
180
197
 
181
198
  ## Troubleshooting
182
199
 
@@ -200,17 +217,16 @@ Update `devcontainer.patch.json`:
200
217
  }
201
218
  ```
202
219
 
203
- ### Want to use venv anyway?
220
+ ### Customizing the Interpreter Path
204
221
 
205
- Add to your project's `.devcontainer/devcontainer.json`:
222
+ The overlay pre-configures VS Code to use `${workspaceFolder}/.venv/bin/python`. If your venv is elsewhere, update `python.defaultInterpreterPath` in your workspace settings or `.devcontainer/custom/devcontainer.patch.json`:
206
223
 
207
224
  ```json
208
225
  {
209
- "postCreateCommand": "python -m venv .venv && .venv/bin/pip install -r requirements.txt",
210
226
  "customizations": {
211
227
  "vscode": {
212
228
  "settings": {
213
- "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
229
+ "python.defaultInterpreterPath": "${workspaceFolder}/my-custom-venv/bin/python"
214
230
  }
215
231
  }
216
232
  }
@@ -26,16 +26,19 @@
26
26
  "source.organizeImports": "explicit"
27
27
  }
28
28
  },
29
- "python.defaultInterpreterPath": "/usr/local/bin/python",
29
+ "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
30
+ "python.terminal.activateEnvironment": true,
30
31
  "files.exclude": {
31
32
  "**/__pycache__": true,
32
- "**/.pytest_cache": true
33
+ "**/.pytest_cache": true,
34
+ "**/.venv": true
33
35
  }
34
36
  }
35
37
  }
36
38
  },
37
39
  "remoteEnv": {
38
- "PATH": "${containerEnv:HOME}/.local/bin:${containerEnv:PATH}",
39
- "PYTHONPATH": "${containerWorkspaceFolder}"
40
+ "PATH": "${containerWorkspaceFolder}/.venv/bin:${containerEnv:HOME}/.local/bin:${containerEnv:PATH}",
41
+ "PYTHONPATH": "${containerWorkspaceFolder}",
42
+ "VIRTUAL_ENV": "${containerWorkspaceFolder}/.venv"
40
43
  }
41
44
  }
@@ -1,47 +1,74 @@
1
1
  #!/bin/bash
2
- # Python setup script - Install Python packages
2
+ # Python setup script - Create virtual environment and install dependencies
3
3
 
4
4
  set -e
5
5
 
6
6
  # Extract overlay name from script filename (setup-<overlay>.sh -> <overlay>)
7
7
  OVERLAY_NAME=$(basename "$0" | sed 's/setup-//;s/\.sh$//')
8
8
 
9
- echo "🐍 Setting up Python environment..."
9
+ echo "🐍 Setting up Python virtual environment..."
10
+
11
+ # Determine workspace root (script is run from workspace root via postCreateCommand)
12
+ WORKSPACE_ROOT="${PWD}"
13
+ VENV_DIR="${WORKSPACE_ROOT}/.venv"
14
+
15
+ # Create virtual environment if it doesn't exist
16
+ if [ ! -d "${VENV_DIR}" ]; then
17
+ echo "đŸ“Ļ Creating virtual environment at .venv..."
18
+ if ! command -v python3 >/dev/null 2>&1; then
19
+ echo "❌ python3 is not available on PATH. Please ensure python3 is installed."
20
+ exit 1
21
+ fi
22
+ python3 -m venv "${VENV_DIR}"
23
+ echo "✓ Virtual environment created"
24
+ else
25
+ echo "✓ Virtual environment already exists at .venv"
26
+ fi
27
+
28
+ # Activate virtual environment
29
+ # shellcheck source=/dev/null
30
+ source "${VENV_DIR}/bin/activate"
31
+
32
+ # Upgrade pip, setuptools, and wheel inside the venv
33
+ echo "âŦ†ī¸ Upgrading pip, setuptools, and wheel..."
34
+ pip install --upgrade pip setuptools wheel
35
+ echo "✓ pip, setuptools, and wheel upgraded"
10
36
 
11
37
  # Install overlay-specific packages (if requirements-overlay.txt exists)
12
38
  if [ -f ".devcontainer/requirements-overlay-${OVERLAY_NAME}.txt" ]; then
13
39
  echo "đŸ“Ļ Installing overlay packages from requirements-overlay-${OVERLAY_NAME}.txt..."
14
- pip install --user -r .devcontainer/requirements-overlay-${OVERLAY_NAME}.txt
40
+ pip install -r ".devcontainer/requirements-overlay-${OVERLAY_NAME}.txt"
15
41
  echo "✓ Overlay packages installed"
16
42
  fi
17
43
 
18
- # Check if requirements.txt exists (project dependencies)
44
+ # Install from root requirements.txt (project production dependencies)
19
45
  if [ -f "requirements.txt" ]; then
20
- echo "đŸ“Ļ Found requirements.txt, installing dependencies..."
21
- pip install --user -r requirements.txt
46
+ echo "đŸ“Ļ Installing dependencies from requirements.txt..."
47
+ pip install -r requirements.txt
22
48
  echo "✓ Dependencies installed from requirements.txt"
23
- elif [ -f "requirements-dev.txt" ]; then
24
- echo "đŸ“Ļ Found requirements-dev.txt, installing dev dependencies..."
25
- pip install --user -r requirements-dev.txt
49
+ fi
50
+
51
+ # Install from requirements-dev.txt (project development dependencies)
52
+ if [ -f "requirements-dev.txt" ]; then
53
+ echo "đŸ“Ļ Installing dev dependencies from requirements-dev.txt..."
54
+ pip install -r requirements-dev.txt
26
55
  echo "✓ Dev dependencies installed from requirements-dev.txt"
27
56
  fi
28
57
 
29
- # Check if pyproject.toml exists (modern Python projects)
58
+ # Install project in editable mode if pyproject.toml exists (modern Python projects)
30
59
  if [ -f "pyproject.toml" ]; then
31
- echo "đŸ“Ļ Found pyproject.toml, installing project..."
32
- pip install --user -e .
60
+ echo "đŸ“Ļ Found pyproject.toml, installing project in editable mode..."
61
+ pip install -e .
33
62
  echo "✓ Project installed in editable mode"
34
- fi
35
-
36
- # Check if setup.py exists (legacy Python projects)
37
- if [ -f "setup.py" ] && [ ! -f "pyproject.toml" ]; then
38
- echo "đŸ“Ļ Found setup.py, installing project..."
39
- pip install --user -e .
63
+ elif [ -f "setup.py" ]; then
64
+ # Fallback for legacy Python projects
65
+ echo "đŸ“Ļ Found setup.py, installing project in editable mode..."
66
+ pip install -e .
40
67
  echo "✓ Project installed in editable mode"
41
68
  fi
42
69
 
43
- # Upgrade pip, setuptools, and wheel
44
- echo "âŦ†ī¸ Upgrading pip, setuptools, and wheel..."
45
- pip install --user --upgrade pip setuptools wheel
46
-
47
- echo "✓ Python setup complete"
70
+ echo ""
71
+ echo "✓ Python virtual environment setup complete"
72
+ echo " Virtual environment: ${VENV_DIR}"
73
+ echo " Python interpreter: ${VENV_DIR}/bin/python"
74
+ echo " Activate manually: source .venv/bin/activate"
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
  # Verification script for Python overlay
3
- # Confirms Python and pip are installed
3
+ # Confirms Python, pip, and virtual environment are installed and functional
4
4
 
5
5
  set -e
6
6
 
@@ -28,5 +28,33 @@ else
28
28
  exit 1
29
29
  fi
30
30
 
31
+ # Check venv module is available
32
+ echo ""
33
+ echo "3ī¸âƒŖ Checking venv module..."
34
+ if python3 -m venv --help &> /dev/null; then
35
+ echo " ✅ venv module available"
36
+ else
37
+ echo " ❌ venv module not available"
38
+ exit 1
39
+ fi
40
+
41
+ # Check virtual environment was created (only if we are inside a devcontainer)
42
+ echo ""
43
+ echo "4ī¸âƒŖ Checking virtual environment..."
44
+ VENV_DIR="${PWD}/.venv"
45
+ if [ -d "${VENV_DIR}" ]; then
46
+ if [ -f "${VENV_DIR}/bin/python" ]; then
47
+ VENV_PYTHON_VERSION=$("${VENV_DIR}/bin/python" --version 2>&1)
48
+ echo " Virtual environment: ${VENV_DIR}"
49
+ echo " Python version: ${VENV_PYTHON_VERSION}"
50
+ echo " ✅ Virtual environment is functional"
51
+ else
52
+ echo " âš ī¸ Virtual environment directory exists but python not found"
53
+ echo " â„šī¸ Run setup script to create it: bash .devcontainer/scripts/setup-python.sh"
54
+ fi
55
+ else
56
+ echo " â„šī¸ No .venv found — will be created on container start by setup-python.sh"
57
+ fi
58
+
31
59
  echo ""
32
60
  echo "✅ Python overlay verification complete"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "container-superposition",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Solution-ready devcontainer templates and features with guided initialization",
5
5
  "type": "module",
6
6
  "main": "dist/scripts/init.js",