devs-common 5.0.0__tar.gz → 5.0.2__tar.gz

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 (58) hide show
  1. {devs_common-5.0.0 → devs_common-5.0.2}/PKG-INFO +1 -1
  2. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/core/container.py +31 -2
  3. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/Dockerfile +6 -4
  4. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/README-vscode-settings.md +4 -0
  5. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/extensions/devs-bridge-drop.vsix +0 -0
  6. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/machine-settings.json +1 -2
  7. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/post-create-wrapper.sh +10 -0
  8. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/post-start.sh +7 -0
  9. devs_common-5.0.2/devs_common/templates/scripts/run-autoexec.sh +30 -0
  10. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/docker_client.py +36 -6
  11. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common.egg-info/PKG-INFO +1 -1
  12. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common.egg-info/SOURCES.txt +1 -0
  13. {devs_common-5.0.0 → devs_common-5.0.2}/pyproject.toml +1 -1
  14. {devs_common-5.0.0 → devs_common-5.0.2}/LICENSE +0 -0
  15. {devs_common-5.0.0 → devs_common-5.0.2}/README.md +0 -0
  16. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/__init__.py +0 -0
  17. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/config.py +0 -0
  18. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/core/__init__.py +0 -0
  19. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/core/project.py +0 -0
  20. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/core/workspace.py +0 -0
  21. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/devs_config.py +0 -0
  22. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/exceptions.py +0 -0
  23. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/devcontainer.json +0 -0
  24. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/extensions/README.md +0 -0
  25. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/extensions/install.sh +0 -0
  26. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/machine-settings.tmux.json +0 -0
  27. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/register-vscode-extensions.js +0 -0
  28. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/copy-ssh.sh +0 -0
  29. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/install-bridge-drop.sh +0 -0
  30. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/python-venv-integration.sh +0 -0
  31. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/screenshot-webapp.sh +0 -0
  32. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/setup-vscode-settings.sh +0 -0
  33. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/setup-workspace.sh +0 -0
  34. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/start-tailscale.sh +0 -0
  35. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/start-tunnel.sh +0 -0
  36. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/ts.sh +0 -0
  37. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/tunnel-status.sh +0 -0
  38. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/scripts/webapp-screenshot.py +0 -0
  39. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/init-firewall.sh +0 -0
  40. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/setup-devs-env.sh +0 -0
  41. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/setup-magicdns.sh +0 -0
  42. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/setup-vscode-cache.sh +0 -0
  43. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/start-services.sh +0 -0
  44. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/start-tailscaled.sh +0 -0
  45. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/sudo-scripts/ts-cli.sh +0 -0
  46. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/templates/vscode-settings-reference.md +0 -0
  47. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/__init__.py +0 -0
  48. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/config_hash.py +0 -0
  49. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/console.py +0 -0
  50. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/devcontainer.py +0 -0
  51. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/devcontainer_template.py +0 -0
  52. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/file_utils.py +0 -0
  53. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/git_utils.py +0 -0
  54. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common/utils/repo_cache.py +0 -0
  55. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common.egg-info/dependency_links.txt +0 -0
  56. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common.egg-info/requires.txt +0 -0
  57. {devs_common-5.0.0 → devs_common-5.0.2}/devs_common.egg-info/top_level.txt +0 -0
  58. {devs_common-5.0.0 → devs_common-5.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devs-common
3
- Version: 5.0.0
3
+ Version: 5.0.2
4
4
  Summary: Shared utilities for devs package ecosystem
5
5
  Author: Dan Lester
6
6
  License-Expression: MIT
@@ -433,9 +433,34 @@ class ContainerManager:
433
433
  tailscaled and the tailnet node stay down, and VS Code settings aren't
434
434
  re-deployed. The script is idempotent, so running it again is harmless. Never
435
435
  raises: a container without the devs template simply has no such script.
436
+
437
+ The hook's identity env (``DEVS_PROJECT_NAME``/``DEVCONTAINER_NAME``) comes from
438
+ devcontainer.json ``remoteEnv``, which only the devcontainer CLI injects — a raw
439
+ exec sees neither. Without them start-tailscale.sh falls through to its
440
+ ``devcontainer`` default and the node rejoins the tailnet as ``devs-devcontainer``
441
+ (then clash-suffixed ``-1``, ``-2``…) instead of ``devs-<project>-<dev>`` — so
442
+ every name anyone SSHes to breaks on each host reboot. Re-derive them from the
443
+ labels set at creation, which are the container's own record of that identity.
436
444
  """
445
+ environment = {}
446
+ try:
447
+ labels = self.docker.get_container_labels(container_name)
448
+ project = labels.get("devs.project", "")
449
+ dev = labels.get("devs.dev", "")
450
+ if project and dev:
451
+ environment = {
452
+ "DEVS_PROJECT_NAME": project,
453
+ "DEVCONTAINER_NAME": dev,
454
+ }
455
+ except Exception:
456
+ pass # fall back to the hook's own defaults
457
+
437
458
  try:
438
- self.docker.exec_command(container_name, "/usr/local/bin/post-start.sh")
459
+ self.docker.exec_command(
460
+ container_name,
461
+ "/usr/local/bin/post-start.sh",
462
+ environment=environment or None,
463
+ )
439
464
  except Exception:
440
465
  pass # not a devs-template container / exec unavailable
441
466
 
@@ -942,7 +967,11 @@ class ContainerManager:
942
967
  return self.exec_command(
943
968
  dev_name=dev_name,
944
969
  workspace_dir=workspace_dir,
945
- command="codex --full-auto",
970
+ # `--full-auto` was removed from the Codex CLI (passing it now aborts with
971
+ # "unexpected argument"). This is the flag Codex intends for externally
972
+ # sandboxed environments, which a devcontainer is — and it matches the
973
+ # `claude --dangerously-skip-permissions` alias sitting beside it.
974
+ command="codex --dangerously-bypass-approvals-and-sandbox",
946
975
  stdin_input=prompt,
947
976
  debug=debug,
948
977
  stream=stream,
@@ -145,8 +145,10 @@ RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/
145
145
  # Install Claude CLI via native installer
146
146
  RUN curl -fsSL https://claude.ai/install.sh | bash
147
147
 
148
- # Install OpenAI Codex CLI
149
- RUN npm install -g @openai/codex
148
+ # Install OpenAI Codex CLI. Pinned: an unpinned install silently followed upstream
149
+ # flag changes, which is how the old `--full-auto` alias below ended up broken.
150
+ ARG CODEX_CLI_VERSION=0.144.6
151
+ RUN npm install -g "@openai/codex@${CODEX_CLI_VERSION}"
150
152
 
151
153
  # Install cloudflared for tunnel support (proxies all HTTP methods correctly)
152
154
  # Install VS Code CLI for tunnel support (needs root for /usr/local/bin)
@@ -184,7 +186,8 @@ RUN for shell_rc in /home/node/.zshrc /home/node/.bashrc; do \
184
186
  echo "export CODEX_CONFIG_HOME=\"/home/node/codexconfig\"" >> "$shell_rc" && \
185
187
  echo "export PATH=\"/home/node/.local/bin:\$PATH\"" >> "$shell_rc" && \
186
188
  echo "alias claude=\"claude --dangerously-skip-permissions\"" >> "$shell_rc" && \
187
- echo "alias codex=\"/usr/local/share/npm-global/bin/codex --full-auto\"" >> "$shell_rc" && \
189
+ echo "alias codex=\"/usr/local/share/npm-global/bin/codex -c check_for_update_on_startup=false --dangerously-bypass-approvals-and-sandbox\"" >> "$shell_rc" && \
190
+ echo "alias codex-normal=\"/usr/local/share/npm-global/bin/codex -c check_for_update_on_startup=false\"" >> "$shell_rc" && \
188
191
  echo "" >> "$shell_rc" && \
189
192
  echo "# Auto-activate Python venv if it exists" >> "$shell_rc" && \
190
193
  echo "if [ -f /home/node/.devs-venv/workspace-venv/bin/activate ]; then" >> "$shell_rc" && \
@@ -231,4 +234,3 @@ RUN echo "DEBUG: Files that need sudo:" && ls -la /tmp/sudo-scripts-list/ && \
231
234
  rm -rf /tmp/sudo-scripts-list
232
235
 
233
236
  USER node
234
-
@@ -30,6 +30,10 @@ unset; the profile is always defined.
30
30
 
31
31
  ### Notes on the tmux settings
32
32
 
33
+ - The profile's args are a bare `new-session` — deliberately **not** `new-session -A -s
34
+ <name>`. The `-A` form attaches to the named session if it exists, so every "New
35
+ Terminal" lands you back in the *same* session instead of opening a new one. Reattaching
36
+ to existing sessions is the auto-reattach extension's job, not the profile's.
33
37
  - `~/.tmux.conf` (written in the Dockerfile) sets `mouse on`, 50k scrollback, and
34
38
  `set-titles` so tab titles show the running command. Existing sessions keep their old
35
39
  config — `tmux source-file ~/.tmux.conf` then start a new session, or `tmux kill-server`.
@@ -45,8 +45,7 @@
45
45
  },
46
46
  "tmux": {
47
47
  "path": "tmux",
48
- "args": ["new-session", "-A", "-s", "main"],
49
- "icon": "terminal-tmux"
48
+ "args": ["new-session"]
50
49
  }
51
50
  },
52
51
  "terminal.integrated.macOptionClickForcesSelection": true,
@@ -40,6 +40,16 @@ run_step "start-services.sh" "sudo /usr/local/bin/start-services.sh"
40
40
  # Optional: join the tailnet + serve a port. Non-fatal — no auth key => no-op.
41
41
  run_step "start-tailscale.sh" "/usr/local/bin/start-tailscale.sh" || true
42
42
 
43
+ # setup-devs-env.sh runs through run_step in a subshell, so variables it exports
44
+ # do not reach this wrapper. Load the mounted environment here as well so GH_TOKEN
45
+ # is available while gh configures git's credential helper.
46
+ if [ -f /home/node/.devs-env/.env ]; then
47
+ set -a
48
+ # shellcheck disable=SC1091 -- this file is supplied by the devs bind mount
49
+ source /home/node/.devs-env/.env
50
+ set +a
51
+ fi
52
+
43
53
  # GitHub auth setup is optional, so handle it separately
44
54
  echo "📋 Running gh auth setup-git..."
45
55
  if output=$(gh auth setup-git 2>&1); then
@@ -21,6 +21,13 @@ fi
21
21
  # before the TS_ENABLE gate below, which exits when Tailscale is off.
22
22
  /usr/local/bin/setup-vscode-settings.sh || true
23
23
 
24
+ # Optional per-user/per-project startup hooks. The mounted env directory is
25
+ # project-specific when ~/.devs/envs/<project>/ exists, otherwise it is the
26
+ # shared ~/.devs/envs/default profile. Hooks are executable files in autoexec/
27
+ # and run in lexical order. Keep failures non-fatal so a broken convenience
28
+ # hook cannot make the devcontainer unusable.
29
+ /usr/local/bin/run-autoexec.sh || true
30
+
24
31
  # Gate on the same master switch as the rest of the Tailscale wiring.
25
32
  case "${TS_ENABLE:-}" in
26
33
  1|true|yes) ;;
@@ -0,0 +1,30 @@
1
+ #!/bin/bash
2
+ # Run optional, user-supplied startup hooks from the mounted devs environment.
3
+ # The directory's presence is the opt-in; hooks run in lexical filename order.
4
+ set -uo pipefail
5
+
6
+ hooks_dir="${DEVS_AUTOEXEC_DIR:-/home/node/.devs-env/autoexec}"
7
+ [ -d "$hooks_dir" ] || exit 0
8
+
9
+ status=0
10
+ found=0
11
+ for hook in "$hooks_dir"/*; do
12
+ [ -f "$hook" ] || continue
13
+ [ -x "$hook" ] || {
14
+ echo "ℹ️ Skipping non-executable autoexec hook: $(basename "$hook")"
15
+ continue
16
+ }
17
+
18
+ found=1
19
+ echo "📋 Running autoexec hook: $(basename "$hook")"
20
+ if "$hook"; then
21
+ echo "✅ Autoexec hook completed: $(basename "$hook")"
22
+ else
23
+ hook_status=$?
24
+ echo "⚠️ Autoexec hook failed ($hook_status): $(basename "$hook")"
25
+ status=1
26
+ fi
27
+ done
28
+
29
+ [ "$found" -eq 0 ] || echo "🏁 Autoexec hooks finished"
30
+ exit "$status"
@@ -170,6 +170,25 @@ class DockerClient:
170
170
  except DockerException as e:
171
171
  raise DockerError(f"Error finding containers by labels: {e}")
172
172
 
173
+ def get_container_labels(self, name: str) -> Dict[str, str]:
174
+ """Get a single container's labels.
175
+
176
+ Args:
177
+ name: Container name or id
178
+
179
+ Returns:
180
+ The container's label dictionary
181
+
182
+ Raises:
183
+ DockerError: If the container is missing or inspection fails
184
+ """
185
+ try:
186
+ return self.client.containers.get(name).labels or {}
187
+ except NotFound:
188
+ raise DockerError(f"Container {name} not found")
189
+ except DockerException as e:
190
+ raise DockerError(f"Error inspecting container {name}: {e}")
191
+
173
192
  def rename_container(self, old_name: str, new_name: str) -> None:
174
193
  """Rename a container.
175
194
 
@@ -188,26 +207,37 @@ class DockerClient:
188
207
  except DockerException as e:
189
208
  raise DockerError(f"Error renaming container {old_name} to {new_name}: {e}")
190
209
 
191
- def exec_command(self, container_name: str, command: str, workdir: Optional[str] = None) -> bool:
210
+ def exec_command(
211
+ self,
212
+ container_name: str,
213
+ command: str,
214
+ workdir: Optional[str] = None,
215
+ environment: Optional[Dict[str, str]] = None,
216
+ ) -> bool:
192
217
  """Execute a command in a container.
193
-
218
+
194
219
  Args:
195
220
  container_name: Container name
196
221
  command: Command to execute
197
222
  workdir: Working directory for command
198
-
223
+ environment: Extra env vars for this exec only. A raw exec inherits the
224
+ image's baked-in env but NOT devcontainer.json ``remoteEnv``, which the
225
+ devcontainer CLI injects per-exec — pass anything the command needs from
226
+ there explicitly.
227
+
199
228
  Returns:
200
229
  True if command succeeded
201
-
230
+
202
231
  Raises:
203
232
  DockerError: If execution fails
204
233
  """
205
234
  try:
206
235
  container = self.client.containers.get(container_name)
207
-
236
+
208
237
  exec_result = container.exec_run(
209
- command,
238
+ command,
210
239
  workdir=workdir,
240
+ environment=environment,
211
241
  tty=False,
212
242
  stream=False
213
243
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devs-common
3
- Version: 5.0.0
3
+ Version: 5.0.2
4
4
  Summary: Shared utilities for devs package ecosystem
5
5
  Author: Dan Lester
6
6
  License-Expression: MIT
@@ -29,6 +29,7 @@ devs_common/templates/scripts/install-bridge-drop.sh
29
29
  devs_common/templates/scripts/post-create-wrapper.sh
30
30
  devs_common/templates/scripts/post-start.sh
31
31
  devs_common/templates/scripts/python-venv-integration.sh
32
+ devs_common/templates/scripts/run-autoexec.sh
32
33
  devs_common/templates/scripts/screenshot-webapp.sh
33
34
  devs_common/templates/scripts/setup-vscode-settings.sh
34
35
  devs_common/templates/scripts/setup-workspace.sh
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devs-common"
7
- version = "5.0.0"
7
+ version = "5.0.2"
8
8
  description = "Shared utilities for devs package ecosystem"
9
9
  authors = [
10
10
  {name = "Dan Lester"},
File without changes
File without changes
File without changes