mystack-rig 1.6.1__tar.gz → 1.6.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 (125) hide show
  1. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/PKG-INFO +2 -2
  2. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/README.md +1 -1
  3. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/devcontainers.py +51 -4
  4. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/remote_dev.py +20 -1
  5. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/PKG-INFO +2 -2
  6. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/scm_version.json +2 -2
  7. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_devcontainers.py +56 -0
  8. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_init_command.py +70 -0
  9. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.coveragerc +0 -0
  10. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.git-blame-ignore-revs +0 -0
  11. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.github/workflows/release.yml +0 -0
  12. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.github/workflows/tests.yml +0 -0
  13. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.gitignore +0 -0
  14. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.rig/playbooks/README.md +0 -0
  15. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/.rig/playbooks/vpn-gateway.yml +0 -0
  16. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/CLI_STORAGE_SUMMARY.md +0 -0
  17. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/Dockerfile +0 -0
  18. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/GIT_CLONE_FEATURE.md +0 -0
  19. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/GLOSSARY.md +0 -0
  20. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/HETZNER_STORAGE_GUIDE.md +0 -0
  21. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
  22. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/LICENSE +0 -0
  23. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/Makefile +0 -0
  24. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/README_REAL_E2E.md +0 -0
  25. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/STORAGE_CLI_GUIDE.md +0 -0
  26. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
  27. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
  28. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
  29. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
  30. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/adr/0005-docker-in-configure-for-devcontainers.md +0 -0
  31. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/architecture.md +0 -0
  32. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/architecture.png +0 -0
  33. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/docs/architecture.svg +0 -0
  34. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/forged-idea.md +0 -0
  35. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/pyproject.toml +0 -0
  36. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/pytest.ini +0 -0
  37. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/requirements.txt +0 -0
  38. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/sample.env +0 -0
  39. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/scripts/coverage_badge.py +0 -0
  40. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/scripts/pypi_version.py +0 -0
  41. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/setup.cfg +0 -0
  42. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/__init__.py +0 -0
  43. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/__init__.py +0 -0
  44. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/__main__.py +0 -0
  45. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/agents.py +0 -0
  46. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/ansible_filters/__init__.py +0 -0
  47. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/ansible_filters/rig_live.py +0 -0
  48. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/ansible_filters/rig_mcp.py +0 -0
  49. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/assets/rig-agent-queue +0 -0
  50. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/assets/rig-agent-state +0 -0
  51. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/assets/tmux.conf +0 -0
  52. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/config.py +0 -0
  53. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/encrypt.py +0 -0
  54. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/git.py +0 -0
  55. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/git_author.py +0 -0
  56. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/last_env.py +0 -0
  57. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/last_session.py +0 -0
  58. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/last_target.py +0 -0
  59. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/live_agent.py +0 -0
  60. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/log.py +0 -0
  61. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/main.py +0 -0
  62. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/mcp.py +0 -0
  63. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/outputs.py +0 -0
  64. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/requirements.txt +0 -0
  65. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/snapshots.py +0 -0
  66. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/state_bucket.py +0 -0
  67. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/storage.py +0 -0
  68. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/vault_keys.py +0 -0
  69. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/cli/vpn.py +0 -0
  70. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/SOURCES.txt +0 -0
  71. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
  72. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/entry_points.txt +0 -0
  73. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/requires.txt +0 -0
  74. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/scm_file_list.json +0 -0
  75. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/src/mystack_rig.egg-info/top_level.txt +0 -0
  76. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/test_hetzner_integration.py +0 -0
  77. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/conftest.py +0 -0
  78. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_agents.py +0 -0
  79. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_ansible_galaxy.py +0 -0
  80. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_attach_command.py +0 -0
  81. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_credential_security.py +0 -0
  82. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_destroy_command.py +0 -0
  83. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_dev_command.py +0 -0
  84. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_encrypt_command.py +0 -0
  85. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_encrypt_coverage.py +0 -0
  86. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_firewall_client_ip.py +0 -0
  87. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_git_clone_unit.py +0 -0
  88. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_git_credentials_and_author.py +0 -0
  89. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_git_manager.py +0 -0
  90. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_gitignore_init.py +0 -0
  91. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_hetzner_storage.py +0 -0
  92. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_inspect_describe.py +0 -0
  93. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_last_env.py +0 -0
  94. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_last_session.py +0 -0
  95. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_last_target.py +0 -0
  96. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_live_agent.py +0 -0
  97. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_live_agent_cli.py +0 -0
  98. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_log.py +0 -0
  99. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_main_coverage.py +0 -0
  100. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_mcp_command.py +0 -0
  101. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_mcp_render.py +0 -0
  102. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_outputs.py +0 -0
  103. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_outputs_storage.py +0 -0
  104. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_pypi_version.py +0 -0
  105. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_python_floor.py +0 -0
  106. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_r2_storage.py +0 -0
  107. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_real_e2e_integration.py +0 -0
  108. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_real_e2e_storage.py +0 -0
  109. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_real_e2e_vpn.py +0 -0
  110. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_real_e2e_vpn_tunnel.py +0 -0
  111. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_remote_dev.py +0 -0
  112. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_remote_dev_coverage_extensions.py +0 -0
  113. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_rig_ansible_vars.py +0 -0
  114. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_rig_config.py +0 -0
  115. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_secret_prompt_hidden.py +0 -0
  116. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_setup_provision.py +0 -0
  117. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_simulation_storage.py +0 -0
  118. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_small_module_coverage.py +0 -0
  119. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_snapshots.py +0 -0
  120. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_state_bucket.py +0 -0
  121. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_storage_basic.py +0 -0
  122. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_vault_keys.py +0 -0
  123. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_vpn_optional.py +0 -0
  124. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_vpn_unit.py +0 -0
  125. {mystack_rig-1.6.1 → mystack_rig-1.6.2}/tests/test_workspace_git_clone.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mystack-rig
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: Ephemeral remotes with full local parity for coding agents
5
5
  Author: mystack-cloud
6
6
  License-Expression: MIT
@@ -166,7 +166,7 @@ Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git pr
166
166
 
167
167
  ### Dev Containers
168
168
 
169
- Set `editor.devcontainers: true` and `rig dev` looks for Dev Containers in your Repos on the VM (each Repo's root and its immediate subfolders: `.devcontainer/devcontainer.json`, `.devcontainer.json`, `.devcontainer/<name>/devcontainer.json`). One match opens straight away, several give a numbered prompt, none opens the plain folder.
169
+ `rig init` looks for Dev Containers in the Repos you select and, when it finds any, asks whether to enable support (default yes). It records the answer in `rig.yml` and doesn't ask again. To enable it by hand, set `editor.devcontainers: true`; then `rig dev` looks for Dev Containers in your Repos on the VM (each Repo's root and its immediate subfolders: `.devcontainer/devcontainer.json`, `.devcontainer.json`, `.devcontainer/<name>/devcontainer.json`). One match opens straight away, several give a numbered prompt, none opens the plain folder.
170
170
 
171
171
  - `rig dev --target api` or `--target api:backend` skips the prompt; `--select` forces it. The last choice per Environment is remembered in `/tmp/.rig/targets/`.
172
172
  - Not supported with `--browser`. Agents still run on the VM, not in the container.
@@ -144,7 +144,7 @@ Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git pr
144
144
 
145
145
  ### Dev Containers
146
146
 
147
- Set `editor.devcontainers: true` and `rig dev` looks for Dev Containers in your Repos on the VM (each Repo's root and its immediate subfolders: `.devcontainer/devcontainer.json`, `.devcontainer.json`, `.devcontainer/<name>/devcontainer.json`). One match opens straight away, several give a numbered prompt, none opens the plain folder.
147
+ `rig init` looks for Dev Containers in the Repos you select and, when it finds any, asks whether to enable support (default yes). It records the answer in `rig.yml` and doesn't ask again. To enable it by hand, set `editor.devcontainers: true`; then `rig dev` looks for Dev Containers in your Repos on the VM (each Repo's root and its immediate subfolders: `.devcontainer/devcontainer.json`, `.devcontainer.json`, `.devcontainer/<name>/devcontainer.json`). One match opens straight away, several give a numbered prompt, none opens the plain folder.
148
148
 
149
149
  - `rig dev --target api` or `--target api:backend` skips the prompt; `--select` forces it. The last choice per Environment is remembered in `/tmp/.rig/targets/`.
150
150
  - Not supported with `--browser`. Agents still run on the VM, not in the container.
@@ -9,6 +9,7 @@ import re
9
9
  import shlex
10
10
  from collections.abc import Callable, Sequence
11
11
  from dataclasses import dataclass
12
+ from pathlib import Path
12
13
 
13
14
 
14
15
  @dataclass(frozen=True)
@@ -50,6 +51,12 @@ _CONFIG_RE = re.compile(
50
51
  _SKIPPED_DIRS = ("node_modules", ".git")
51
52
 
52
53
 
54
+ def _is_dev_container_path(config: str) -> bool:
55
+ """Is *config* (relative to a Repo root) a Dev Container within the scan depth?"""
56
+ match = _CONFIG_RE.match(config)
57
+ return match is not None and match.group("sub") not in _SKIPPED_DIRS
58
+
59
+
53
60
  def _scan_command(dest: str) -> str:
54
61
  skipped = " -o ".join(f"-name {d}" for d in _SKIPPED_DIRS)
55
62
  return (
@@ -73,10 +80,8 @@ def find_devcontainers(
73
80
  if not line.startswith(dest.rstrip("/") + "/"):
74
81
  continue
75
82
  config = os.path.relpath(line, dest)
76
- match = _CONFIG_RE.match(config)
77
- if not match or match.group("sub") in _SKIPPED_DIRS:
78
- continue
79
- found.append(DevTarget(name, config))
83
+ if _is_dev_container_path(config):
84
+ found.append(DevTarget(name, config))
80
85
  return sorted(found, key=lambda t: (t.repo, t.config))
81
86
 
82
87
 
@@ -189,3 +194,45 @@ def scan_environment(env, repos: Sequence[tuple[str, str]]) -> list[DevTarget]:
189
194
  return result.stdout
190
195
 
191
196
  return find_devcontainers(run_remote, repos)
197
+
198
+
199
+ _LOCAL_PATTERNS = (".devcontainer.json", ".devcontainer/devcontainer.json", ".devcontainer/*/devcontainer.json")
200
+
201
+
202
+ def find_local_devcontainers(repos: Sequence[dict]) -> list[DevTarget]:
203
+ """Dev Containers in Repos checked out on this machine (each has ``name`` and ``path``)."""
204
+ found: list[DevTarget] = []
205
+ for repo in repos:
206
+ name, path = repo.get("name"), repo.get("path")
207
+ if not name or not path or not os.path.isdir(path):
208
+ continue
209
+ root = Path(path)
210
+ for prefix in ("", "*/"):
211
+ for pattern in _LOCAL_PATTERNS:
212
+ for match in root.glob(prefix + pattern):
213
+ config = match.relative_to(root).as_posix()
214
+ if match.is_file() and _is_dev_container_path(config):
215
+ found.append(DevTarget(str(name), config))
216
+ return sorted(set(found), key=lambda t: (t.repo, t.config))
217
+
218
+
219
+ def prompt_devcontainers(
220
+ found: Sequence[DevTarget],
221
+ current: bool | None,
222
+ input_fn: Callable[[str], str] = input,
223
+ ) -> bool | None:
224
+ """Whether to enable Dev Containers for the Workspace, asked by ``rig init``.
225
+
226
+ Asks only when some were found and ``editor.devcontainers`` was never set;
227
+ Enter means yes. An earlier answer is kept. None means leave the flag unset.
228
+ """
229
+ if current is not None:
230
+ return current
231
+ if not found:
232
+ return None
233
+ repos = ", ".join(sorted({t.repo for t in found}))
234
+ answer = input_fn(
235
+ f"Dev Containers found in {repos}. Enable Dev Container support "
236
+ "(installs Docker, rebuilds the snapshot once)? [Y/n]: "
237
+ )
238
+ return not answer.strip().lower().startswith("n")
@@ -5528,8 +5528,12 @@ class Workspace:
5528
5528
  agent_types: list[str] | None = None,
5529
5529
  editor: str | None = None,
5530
5530
  editors: list[str] | None = None,
5531
+ devcontainers: bool | None = None,
5531
5532
  ) -> bool:
5532
- """Idempotently initialize workspace config and register selected repos."""
5533
+ """Idempotently initialize workspace config and register selected repos.
5534
+
5535
+ ``devcontainers`` sets ``editor.devcontainers``; None leaves it as it is.
5536
+ """
5533
5537
  workspace_name = name or os.path.basename(self.path.rstrip(os.sep)) or "workspace"
5534
5538
  if not _valid_component_name(workspace_name):
5535
5539
  print(f"Error: invalid workspace name '{workspace_name}'")
@@ -5578,6 +5582,8 @@ class Workspace:
5578
5582
  project.config["name"] = workspace_name
5579
5583
  project._set_agent_selection(chosen_agents, default=chosen_agent)
5580
5584
  apply_editor_selection(project.config, chosen_editors, default=chosen_editor)
5585
+ if devcontainers is not None:
5586
+ project.config["editor"]["devcontainers"] = devcontainers
5581
5587
  project.set_vars("coding_agent_type", chosen_agent)
5582
5588
  project.set_vars("coding_agent_types", list(chosen_agents))
5583
5589
 
@@ -5684,6 +5690,8 @@ class Workspace:
5684
5690
  # Re-apply after add_repo/load cycles so agent/editor choice is not lost.
5685
5691
  project._set_agent_selection(chosen_agents, default=chosen_agent)
5686
5692
  apply_editor_selection(project.config, chosen_editors, default=chosen_editor)
5693
+ if devcontainers is not None:
5694
+ project.config["editor"]["devcontainers"] = devcontainers
5687
5695
  project.set_vars("coding_agent_type", chosen_agent)
5688
5696
  project.set_vars("coding_agent_types", list(chosen_agents))
5689
5697
 
@@ -5874,6 +5882,16 @@ def interactive_env_init(
5874
5882
  print(f"Error: {exc}")
5875
5883
  return False
5876
5884
 
5885
+ from cli.devcontainers import find_local_devcontainers, prompt_devcontainers
5886
+
5887
+ editor_block = existing.get("editor")
5888
+ earlier = editor_block.get("devcontainers") if isinstance(editor_block, dict) else None
5889
+ devcontainers = prompt_devcontainers(
5890
+ find_local_devcontainers(selected),
5891
+ earlier if isinstance(earlier, bool) else None,
5892
+ input_fn or input,
5893
+ )
5894
+
5877
5895
  # Collect PATs before writing config so password_var can be attached on add.
5878
5896
  pat_assignments, default_pats = collect_repo_pats(
5879
5897
  selected,
@@ -5894,6 +5912,7 @@ def interactive_env_init(
5894
5912
  agent_types=agent_types,
5895
5913
  editor=editor,
5896
5914
  editors=editors,
5915
+ devcontainers=devcontainers,
5897
5916
  ):
5898
5917
  return False
5899
5918
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mystack-rig
3
- Version: 1.6.1
3
+ Version: 1.6.2
4
4
  Summary: Ephemeral remotes with full local parity for coding agents
5
5
  Author: mystack-cloud
6
6
  License-Expression: MIT
@@ -166,7 +166,7 @@ Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git pr
166
166
 
167
167
  ### Dev Containers
168
168
 
169
- Set `editor.devcontainers: true` and `rig dev` looks for Dev Containers in your Repos on the VM (each Repo's root and its immediate subfolders: `.devcontainer/devcontainer.json`, `.devcontainer.json`, `.devcontainer/<name>/devcontainer.json`). One match opens straight away, several give a numbered prompt, none opens the plain folder.
169
+ `rig init` looks for Dev Containers in the Repos you select and, when it finds any, asks whether to enable support (default yes). It records the answer in `rig.yml` and doesn't ask again. To enable it by hand, set `editor.devcontainers: true`; then `rig dev` looks for Dev Containers in your Repos on the VM (each Repo's root and its immediate subfolders: `.devcontainer/devcontainer.json`, `.devcontainer.json`, `.devcontainer/<name>/devcontainer.json`). One match opens straight away, several give a numbered prompt, none opens the plain folder.
170
170
 
171
171
  - `rig dev --target api` or `--target api:backend` skips the prompt; `--select` forces it. The last choice per Environment is remembered in `/tmp/.rig/targets/`.
172
172
  - Not supported with `--browser`. Agents still run on the VM, not in the container.
@@ -1,7 +1,7 @@
1
1
  {
2
- "tag": "1.6.1",
2
+ "tag": "1.6.2",
3
3
  "distance": 0,
4
- "node": "g904a5baadb5e2a6cd12c0c3d881c2e01eff14120",
4
+ "node": "gba75e43ded7c08e65cbbf5ee2ef24cb98e0c027e",
5
5
  "dirty": false,
6
6
  "branch": "HEAD",
7
7
  "node_date": "2026-11-24"
@@ -239,3 +239,59 @@ def test_scan_reports_an_unreachable_environment():
239
239
  env.run_remote.side_effect = OSError("ssh not found")
240
240
  with pytest.raises(DevContainerScanError, match="could not reach"):
241
241
  scan_environment(env, [("api", "/workspace/api")])
242
+
243
+
244
+ # --- rig init ---------------------------------------------------------------
245
+
246
+
247
+ def _touch(root, rel):
248
+ path = root / rel
249
+ path.parent.mkdir(parents=True, exist_ok=True)
250
+ path.write_text("{}\n")
251
+
252
+
253
+ def test_local_scan_finds_dev_containers_in_selected_repos(tmp_path):
254
+ from cli.devcontainers import find_local_devcontainers
255
+
256
+ _touch(tmp_path / "api", ".devcontainer/devcontainer.json")
257
+ _touch(tmp_path / "mono", "svc/.devcontainer.json")
258
+ _touch(tmp_path / "mono", "a/b/.devcontainer.json") # too deep
259
+ _touch(tmp_path / "mono", "node_modules/x/.devcontainer.json")
260
+ _touch(tmp_path / "web", "README.md")
261
+ repos = [{"name": n, "path": str(tmp_path / n)} for n in ("api", "mono", "web")]
262
+ assert find_local_devcontainers(repos) == [
263
+ DevTarget("api", ".devcontainer/devcontainer.json"),
264
+ DevTarget("mono", "svc/.devcontainer.json"),
265
+ ]
266
+
267
+
268
+ def test_local_scan_skips_repos_without_a_local_path(tmp_path):
269
+ from cli.devcontainers import find_local_devcontainers
270
+
271
+ assert find_local_devcontainers([{"name": "x"}, {"name": "y", "path": str(tmp_path / "gone")}]) == []
272
+
273
+
274
+ def test_init_asks_to_enable_only_when_found_and_never_answered():
275
+ from cli.devcontainers import prompt_devcontainers
276
+
277
+ found = [API_DEFAULT, WEB_SUB]
278
+ asked = []
279
+
280
+ def ask(prompt):
281
+ asked.append(prompt)
282
+ return ""
283
+
284
+ assert prompt_devcontainers(found, None, ask) is True # Enter defaults to yes
285
+ assert "api" in asked[0] and "web" in asked[0]
286
+ assert prompt_devcontainers(found, None, lambda _p: "n") is False
287
+ assert prompt_devcontainers(found, None, lambda _p: "No") is False
288
+ assert prompt_devcontainers(found, None, lambda _p: "y") is True
289
+
290
+
291
+ def test_init_does_not_ask_when_nothing_found_or_already_decided():
292
+ from cli.devcontainers import prompt_devcontainers
293
+
294
+ assert prompt_devcontainers([], None, _no_input) is None
295
+ assert prompt_devcontainers([], True, _no_input) is True
296
+ assert prompt_devcontainers([API_DEFAULT], False, _no_input) is False
297
+ assert prompt_devcontainers([API_DEFAULT], True, _no_input) is True
@@ -1005,3 +1005,73 @@ def test_save_creates_shared_vars_when_missing_without_personal_keys(tmp_path, m
1005
1005
 
1006
1006
  shared = yaml.safe_load((rig / "vars.yml").read_text(encoding="utf-8"))
1007
1007
  assert "gitlab_pat" not in (shared or {})
1008
+
1009
+
1010
+ def _init_with_devcontainer(tmp_path, *extra_answers, existing_flag=None):
1011
+ root = tmp_path / "ws"
1012
+ api = root / "api"
1013
+ _git_init(api, "https://github.com/org/api.git")
1014
+ dc = api / ".devcontainer"
1015
+ dc.mkdir()
1016
+ (dc / "devcontainer.json").write_text("{}\n")
1017
+ if existing_flag is not None:
1018
+ (api / "rig.yml").write_text(yaml.safe_dump({"kind": "workspace", "editor": {"devcontainers": existing_flag}}))
1019
+ data_key = tmp_path / "data-key"
1020
+ data_key.write_text("vault-pass\n")
1021
+ asked = []
1022
+ answers = _answers("", "api", "", "", *extra_answers) # repo, name, agent, editor, ...
1023
+
1024
+ def ask(prompt):
1025
+ asked.append(prompt)
1026
+ return next(answers)
1027
+
1028
+ assert interactive_env_init(
1029
+ str(api),
1030
+ input_fn=ask,
1031
+ secret_fn=_secrets(),
1032
+ config_path=str(tmp_path / "rig-config"),
1033
+ data_key_path=str(data_key),
1034
+ )
1035
+ return yaml.safe_load((api / "rig.yml").read_text()), asked
1036
+
1037
+
1038
+ def test_init_enables_dev_containers_by_default_when_found(tmp_path):
1039
+ manifest, asked = _init_with_devcontainer(tmp_path, "")
1040
+ assert manifest["editor"]["devcontainers"] is True
1041
+ assert any("Dev Container" in prompt for prompt in asked)
1042
+
1043
+
1044
+ def test_init_records_a_no_answer(tmp_path):
1045
+ manifest, _ = _init_with_devcontainer(tmp_path, "n")
1046
+ assert manifest["editor"]["devcontainers"] is False
1047
+
1048
+
1049
+ def test_init_keeps_an_earlier_decision_without_asking(tmp_path):
1050
+ manifest, asked = _init_with_devcontainer(tmp_path, existing_flag=False)
1051
+ assert manifest["editor"]["devcontainers"] is False
1052
+ assert not any("Dev Container" in prompt for prompt in asked)
1053
+
1054
+
1055
+ def test_init_without_dev_containers_asks_nothing_and_leaves_the_flag_unset(tmp_path):
1056
+ root = tmp_path / "ws"
1057
+ api = root / "api"
1058
+ _git_init(api, "https://github.com/org/api.git")
1059
+ data_key = tmp_path / "data-key"
1060
+ data_key.write_text("vault-pass\n")
1061
+ answers = _answers("", "api", "", "")
1062
+ asked = []
1063
+
1064
+ def ask(prompt):
1065
+ asked.append(prompt)
1066
+ return next(answers)
1067
+
1068
+ assert interactive_env_init(
1069
+ str(api),
1070
+ input_fn=ask,
1071
+ secret_fn=_secrets(),
1072
+ config_path=str(tmp_path / "rig-config"),
1073
+ data_key_path=str(data_key),
1074
+ )
1075
+ manifest = yaml.safe_load((api / "rig.yml").read_text())
1076
+ assert "devcontainers" not in manifest["editor"]
1077
+ assert not any("Dev Container" in prompt for prompt in asked)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes