mystack-rig 1.5.0__tar.gz → 1.6.1__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.
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/GLOSSARY.md +8 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/PKG-INFO +19 -1
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/README.md +18 -0
- mystack_rig-1.6.1/docs/adr/0005-docker-in-configure-for-devcontainers.md +16 -0
- mystack_rig-1.6.1/src/cli/devcontainers.py +191 -0
- mystack_rig-1.6.1/src/cli/last_target.py +52 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/main.py +58 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/remote_dev.py +45 -1
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/snapshots.py +1 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/PKG-INFO +19 -1
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/SOURCES.txt +5 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/scm_file_list.json +5 -0
- mystack_rig-1.6.1/src/mystack_rig.egg-info/scm_version.json +8 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_dev_command.py +145 -0
- mystack_rig-1.6.1/tests/test_devcontainers.py +241 -0
- mystack_rig-1.6.1/tests/test_last_target.py +52 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_remote_dev_coverage_extensions.py +1 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_setup_provision.py +25 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_snapshots.py +56 -0
- mystack_rig-1.5.0/src/mystack_rig.egg-info/scm_version.json +0 -8
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.coveragerc +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.git-blame-ignore-revs +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.github/workflows/release.yml +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.github/workflows/tests.yml +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.gitignore +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.rig/playbooks/README.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/.rig/playbooks/vpn-gateway.yml +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/CLI_STORAGE_SUMMARY.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/Dockerfile +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/GIT_CLONE_FEATURE.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/HETZNER_STORAGE_GUIDE.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/LICENSE +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/Makefile +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/README_REAL_E2E.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/STORAGE_CLI_GUIDE.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/architecture.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/architecture.png +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/docs/architecture.svg +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/forged-idea.md +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/pyproject.toml +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/pytest.ini +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/requirements.txt +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/sample.env +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/scripts/coverage_badge.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/scripts/pypi_version.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/setup.cfg +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/__init__.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/__init__.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/__main__.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/agents.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/ansible_filters/__init__.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/ansible_filters/rig_live.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/ansible_filters/rig_mcp.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/assets/rig-agent-queue +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/assets/rig-agent-state +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/assets/tmux.conf +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/config.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/encrypt.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/git.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/git_author.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/last_env.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/last_session.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/live_agent.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/log.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/mcp.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/outputs.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/requirements.txt +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/state_bucket.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/storage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/vault_keys.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/cli/vpn.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/entry_points.txt +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/requires.txt +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/src/mystack_rig.egg-info/top_level.txt +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/test_hetzner_integration.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/conftest.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_agents.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_ansible_galaxy.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_attach_command.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_credential_security.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_destroy_command.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_encrypt_command.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_encrypt_coverage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_firewall_client_ip.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_git_clone_unit.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_git_credentials_and_author.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_git_manager.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_gitignore_init.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_hetzner_storage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_init_command.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_inspect_describe.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_last_env.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_last_session.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_live_agent.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_live_agent_cli.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_log.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_main_coverage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_mcp_command.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_mcp_render.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_outputs.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_outputs_storage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_pypi_version.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_python_floor.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_r2_storage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_real_e2e_integration.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_real_e2e_storage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_real_e2e_vpn.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_real_e2e_vpn_tunnel.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_remote_dev.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_rig_ansible_vars.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_rig_config.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_secret_prompt_hidden.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_simulation_storage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_small_module_coverage.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_state_bucket.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_storage_basic.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_vault_keys.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_vpn_optional.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_vpn_unit.py +0 -0
- {mystack_rig-1.5.0 → mystack_rig-1.6.1}/tests/test_workspace_git_clone.py +0 -0
|
@@ -55,3 +55,11 @@ _Avoid_: Plugin, tool, integration
|
|
|
55
55
|
**MCP variable**:
|
|
56
56
|
A named value an MCP server needs at runtime, resolved from the vaulted variable whose name matches it ignoring case.
|
|
57
57
|
_Avoid_: MCP secret, MCP env
|
|
58
|
+
|
|
59
|
+
**Dev Container**:
|
|
60
|
+
One `devcontainer.json` definition found in a Repo, describing the container its code is developed in.
|
|
61
|
+
_Avoid_: Project, devbox
|
|
62
|
+
|
|
63
|
+
**Dev target**:
|
|
64
|
+
The Repo and Dev Container pair that `rig dev` opens on an Environment.
|
|
65
|
+
_Avoid_: Project, selection
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: Ephemeral remotes with full local parity for coding agents
|
|
5
5
|
Author: mystack-cloud
|
|
6
6
|
License-Expression: MIT
|
|
@@ -164,6 +164,23 @@ The prompt reaches the VM on stdin and a private temporary file that is deleted
|
|
|
164
164
|
|
|
165
165
|
Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git projects: numbers, names, or `all`). When more than one is selected, init asks which is the default for `rig dev` (`editor.default`). Pass `--editor` to open another enabled one. These are local clients: nothing extra is installed on the VM, and each IDE downloads its own remote server the first time it connects. Browser login: `rig vars decrypt vscode_browser_password`.
|
|
166
166
|
|
|
167
|
+
### Dev Containers
|
|
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.
|
|
170
|
+
|
|
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
|
+
- Not supported with `--browser`. Agents still run on the VM, not in the container.
|
|
173
|
+
- Docker is installed in the configure Stage and cached in the snapshot, so turning the flag on rebuilds the Workspace's snapshot once. New Workspaces get the task in `.rig/configure.yml`. **Existing Workspaces** must add it themselves, and existing Environments must be re-created:
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
- name: Install Docker for Dev Containers
|
|
177
|
+
include_role:
|
|
178
|
+
name: geerlingguy.docker
|
|
179
|
+
when: install_docker | default(false)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
See [ADR 0005](docs/adr/0005-docker-in-configure-for-devcontainers.md).
|
|
183
|
+
|
|
167
184
|
## Layout
|
|
168
185
|
|
|
169
186
|
`rig init` writes commit-friendly files into the current directory (including a subdirectory of a git repo):
|
|
@@ -210,6 +227,7 @@ agent:
|
|
|
210
227
|
editor:
|
|
211
228
|
default: code # default for `rig dev`
|
|
212
229
|
enabled: [code] # local IDEs `rig dev --editor` may open
|
|
230
|
+
devcontainers: false # true: `rig dev` opens a Dev Container (see below)
|
|
213
231
|
playbooks:
|
|
214
232
|
provision: .rig/provision.yml
|
|
215
233
|
configure: .rig/configure.yml
|
|
@@ -142,6 +142,23 @@ The prompt reaches the VM on stdin and a private temporary file that is deleted
|
|
|
142
142
|
|
|
143
143
|
Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git projects: numbers, names, or `all`). When more than one is selected, init asks which is the default for `rig dev` (`editor.default`). Pass `--editor` to open another enabled one. These are local clients: nothing extra is installed on the VM, and each IDE downloads its own remote server the first time it connects. Browser login: `rig vars decrypt vscode_browser_password`.
|
|
144
144
|
|
|
145
|
+
### Dev Containers
|
|
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.
|
|
148
|
+
|
|
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
|
+
- Not supported with `--browser`. Agents still run on the VM, not in the container.
|
|
151
|
+
- Docker is installed in the configure Stage and cached in the snapshot, so turning the flag on rebuilds the Workspace's snapshot once. New Workspaces get the task in `.rig/configure.yml`. **Existing Workspaces** must add it themselves, and existing Environments must be re-created:
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
- name: Install Docker for Dev Containers
|
|
155
|
+
include_role:
|
|
156
|
+
name: geerlingguy.docker
|
|
157
|
+
when: install_docker | default(false)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
See [ADR 0005](docs/adr/0005-docker-in-configure-for-devcontainers.md).
|
|
161
|
+
|
|
145
162
|
## Layout
|
|
146
163
|
|
|
147
164
|
`rig init` writes commit-friendly files into the current directory (including a subdirectory of a git repo):
|
|
@@ -188,6 +205,7 @@ agent:
|
|
|
188
205
|
editor:
|
|
189
206
|
default: code # default for `rig dev`
|
|
190
207
|
enabled: [code] # local IDEs `rig dev --editor` may open
|
|
208
|
+
devcontainers: false # true: `rig dev` opens a Dev Container (see below)
|
|
191
209
|
playbooks:
|
|
192
210
|
provision: .rig/provision.yml
|
|
193
211
|
configure: .rig/configure.yml
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Docker for Dev Containers is installed in configure, behind an opt-in
|
|
2
|
+
|
|
3
|
+
When `editor.devcontainers` is true in `rig.yml`, the configure Stage installs Docker (the `geerlingguy.docker` role already in the default requirements), so it is baked into the snapshot and new Environments start with it ready. The flag is off by default and adds nothing to configure when false, so Workspaces that do not use Dev Containers keep their snapshots and pay nothing.
|
|
4
|
+
|
|
5
|
+
## Considered Options
|
|
6
|
+
|
|
7
|
+
- **Install Docker at materialize**: rejected. Materialize is not snapshot-cached, so it would reach already-running Environments, but every create would pay the Docker install time again. Dev Containers are used on every Environment of a Workspace that enables them, which is what the snapshot cache is for.
|
|
8
|
+
- **Install Docker unconditionally in configure**: rejected. It would change the system hash and invalidate every Workspace's snapshot, including those that never use Dev Containers.
|
|
9
|
+
|
|
10
|
+
## Consequences
|
|
11
|
+
|
|
12
|
+
- Enabling `editor.devcontainers` changes the system hash, so the Workspace's snapshot is rebuilt once.
|
|
13
|
+
- Environments created before the flag was enabled have no Docker. `rig dev` warns, names the cause, says to re-create the Environment, and falls back to a plain Remote-SSH open. An explicit `--target` fails instead.
|
|
14
|
+
- `.rig/configure.yml` is the Workspace's own file, so rig cannot add the Docker task to an existing one. New Workspaces get it from the default playbook, and existing ones add it by hand (see the README).
|
|
15
|
+
- Disabling the flag later does not remove Docker from existing Environments or snapshots.
|
|
16
|
+
- Dev Container support is editor-only. Agents still run on the host (ADR 0004), not in the container.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"""Dev Containers: discovery and selection of the Dev target `rig dev` opens."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import posixpath
|
|
8
|
+
import re
|
|
9
|
+
import shlex
|
|
10
|
+
from collections.abc import Callable, Sequence
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class DevTarget:
|
|
16
|
+
"""A Repo plus one Dev Container in it.
|
|
17
|
+
|
|
18
|
+
``config`` is the ``devcontainer.json`` path relative to the Repo root.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
repo: str
|
|
22
|
+
config: str
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def name(self) -> str:
|
|
26
|
+
"""The container's name within its Repo ('' for the default one).
|
|
27
|
+
|
|
28
|
+
A subfolder prefixes the name: ``svc/x`` is ``svc/.devcontainer/x/``.
|
|
29
|
+
"""
|
|
30
|
+
parts = self.config.split("/")
|
|
31
|
+
sub = parts[0] if len(parts) > 1 and not parts[0].startswith(".devcontainer") else ""
|
|
32
|
+
rest = parts[1:] if sub else parts
|
|
33
|
+
named = rest[1] if len(rest) == 3 else "" # .devcontainer/<name>/devcontainer.json
|
|
34
|
+
return "/".join(p for p in (sub, named) if p)
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def label(self) -> str:
|
|
38
|
+
return f"{self.repo}:{self.name}" if self.name else self.repo
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class DevContainerError(Exception):
|
|
42
|
+
"""A Dev target could not be chosen."""
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# `<repo>/[<subfolder>/]` then one of the three locations the Dev Containers spec defines.
|
|
46
|
+
_CONFIG_RE = re.compile(
|
|
47
|
+
r"^(?:(?P<sub>[^/]+)/)?"
|
|
48
|
+
r"(?:\.devcontainer/(?:[^/]+/)?devcontainer\.json|\.devcontainer\.json)$"
|
|
49
|
+
)
|
|
50
|
+
_SKIPPED_DIRS = ("node_modules", ".git")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _scan_command(dest: str) -> str:
|
|
54
|
+
skipped = " -o ".join(f"-name {d}" for d in _SKIPPED_DIRS)
|
|
55
|
+
return (
|
|
56
|
+
f"find {shlex.quote(dest)} -maxdepth 4 \\( {skipped} \\) -prune -o "
|
|
57
|
+
r"-type f \( -name devcontainer.json -o -name .devcontainer.json \) -print"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def find_devcontainers(
|
|
62
|
+
run_remote: Callable[[str], str],
|
|
63
|
+
repos: Sequence[tuple[str, str]],
|
|
64
|
+
) -> list[DevTarget]:
|
|
65
|
+
"""List the Dev Containers in each ``(repo name, remote path)``.
|
|
66
|
+
|
|
67
|
+
Looks in the Repo root and its immediate subfolders only.
|
|
68
|
+
"""
|
|
69
|
+
found: list[DevTarget] = []
|
|
70
|
+
for name, dest in repos:
|
|
71
|
+
for line in run_remote(_scan_command(dest)).splitlines():
|
|
72
|
+
line = line.strip()
|
|
73
|
+
if not line.startswith(dest.rstrip("/") + "/"):
|
|
74
|
+
continue
|
|
75
|
+
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))
|
|
80
|
+
return sorted(found, key=lambda t: (t.repo, t.config))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _listing(candidates: Sequence[DevTarget]) -> str:
|
|
84
|
+
return ", ".join(t.label for t in candidates)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def choose_target(
|
|
88
|
+
candidates: Sequence[DevTarget],
|
|
89
|
+
remembered: DevTarget | None,
|
|
90
|
+
requested: str | None,
|
|
91
|
+
select: bool,
|
|
92
|
+
interactive: bool,
|
|
93
|
+
input_fn: Callable[[str], str] = input,
|
|
94
|
+
) -> DevTarget | None:
|
|
95
|
+
"""Pick the Dev target to open, or None when there is no Dev Container.
|
|
96
|
+
|
|
97
|
+
``requested`` is ``--target repo[:name]``. ``select`` forces the prompt.
|
|
98
|
+
"""
|
|
99
|
+
if requested:
|
|
100
|
+
exact = [t for t in candidates if t.label == requested] if ":" in requested else []
|
|
101
|
+
in_repo = [t for t in candidates if t.repo == requested]
|
|
102
|
+
if exact:
|
|
103
|
+
return exact[0]
|
|
104
|
+
if len(in_repo) == 1:
|
|
105
|
+
return in_repo[0]
|
|
106
|
+
if not in_repo:
|
|
107
|
+
raise DevContainerError(f"No Dev Container matches '{requested}' (found: {_listing(candidates) or 'none'})")
|
|
108
|
+
candidates = in_repo
|
|
109
|
+
elif not candidates:
|
|
110
|
+
return None
|
|
111
|
+
elif len(candidates) == 1 and not select:
|
|
112
|
+
return candidates[0]
|
|
113
|
+
|
|
114
|
+
if not interactive:
|
|
115
|
+
raise DevContainerError(
|
|
116
|
+
f"Several Dev Containers found: {_listing(candidates)}. Pick one with --target <repo>[:<name>]"
|
|
117
|
+
)
|
|
118
|
+
default = candidates[0]
|
|
119
|
+
if remembered is not None and remembered in candidates:
|
|
120
|
+
default = remembered
|
|
121
|
+
for index, target in enumerate(candidates, 1):
|
|
122
|
+
print(f" {index}) {target.label}")
|
|
123
|
+
while True:
|
|
124
|
+
answer = input_fn(f"Open which Dev Container? [{default.label}] ").strip()
|
|
125
|
+
if not answer:
|
|
126
|
+
return default
|
|
127
|
+
if answer.isdigit() and 1 <= int(answer) <= len(candidates):
|
|
128
|
+
return candidates[int(answer) - 1]
|
|
129
|
+
named = [t for t in candidates if t.label == answer]
|
|
130
|
+
if named:
|
|
131
|
+
return named[0]
|
|
132
|
+
print(f"Not a choice: {answer}")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def devcontainer_folder_uri(alias: str, repo_dest: str, target: DevTarget) -> str:
|
|
136
|
+
"""``--folder-uri`` that opens *target* in its container over Remote-SSH.
|
|
137
|
+
|
|
138
|
+
The folder holding the ``.devcontainer`` definition is the container's host
|
|
139
|
+
path, and the editor mounts it at ``/workspaces/<folder name>``.
|
|
140
|
+
"""
|
|
141
|
+
config = posixpath.join(repo_dest, target.config)
|
|
142
|
+
# "" for the repo root, "sub/" for a subfolder
|
|
143
|
+
prefix = target.config.split(".devcontainer")[0]
|
|
144
|
+
host_path = posixpath.join(repo_dest, prefix).rstrip("/")
|
|
145
|
+
payload = {
|
|
146
|
+
"hostPath": host_path,
|
|
147
|
+
"configFile": {
|
|
148
|
+
"$mid": 1,
|
|
149
|
+
"path": config,
|
|
150
|
+
"scheme": "vscode-remote",
|
|
151
|
+
"authority": f"ssh-remote+{alias}",
|
|
152
|
+
},
|
|
153
|
+
}
|
|
154
|
+
encoded = json.dumps(payload, separators=(",", ":")).encode().hex()
|
|
155
|
+
return f"vscode-remote://dev-container+{encoded}@ssh-remote+{alias}/workspaces/{posixpath.basename(host_path)}"
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class DevContainerScanError(DevContainerError):
|
|
159
|
+
"""The Environment could not be searched for Dev Containers."""
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def devcontainers_enabled(config: dict | None) -> bool:
|
|
163
|
+
"""``editor.devcontainers`` in rig.yml (off by default)."""
|
|
164
|
+
editor = (config or {}).get("editor")
|
|
165
|
+
return isinstance(editor, dict) and editor.get("devcontainers") is True
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def repo_destinations(config: dict | None, root: str) -> list[tuple[str, str]]:
|
|
169
|
+
"""``(name, remote path)`` of every Repo in rig.yml."""
|
|
170
|
+
found = []
|
|
171
|
+
for item in (config or {}).get("repos") or []:
|
|
172
|
+
if isinstance(item, dict) and item.get("name"):
|
|
173
|
+
name = str(item["name"])
|
|
174
|
+
found.append((name, str(item.get("dest") or posixpath.join(root, name))))
|
|
175
|
+
return found
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def scan_environment(env, repos: Sequence[tuple[str, str]]) -> list[DevTarget]:
|
|
179
|
+
"""Find the Dev Containers in *repos* on *env*'s VM over SSH."""
|
|
180
|
+
|
|
181
|
+
def run_remote(command: str) -> str:
|
|
182
|
+
try:
|
|
183
|
+
result = env.run_remote(command)
|
|
184
|
+
except Exception as exc: # ssh missing, timeout, ...
|
|
185
|
+
raise DevContainerScanError(f"could not reach the Environment: {exc}") from exc
|
|
186
|
+
if result.returncode != 0:
|
|
187
|
+
detail = (result.stderr or "").strip() or f"exit {result.returncode}"
|
|
188
|
+
raise DevContainerScanError(f"scan failed: {detail}")
|
|
189
|
+
return result.stdout
|
|
190
|
+
|
|
191
|
+
return find_devcontainers(run_remote, repos)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Remember the last Dev target per environment under /tmp (cleared on reboot)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
|
|
8
|
+
from cli.devcontainers import DevTarget
|
|
9
|
+
|
|
10
|
+
DEFAULT_TARGET_DIR = "/tmp/.rig/targets"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _safe_env_name(name: str) -> str:
|
|
14
|
+
cleaned = re.sub(r"[^A-Za-z0-9._-]+", "-", (name or "").strip())
|
|
15
|
+
return cleaned.strip("-._") or "env"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def target_path(env_name: str, directory: str = DEFAULT_TARGET_DIR) -> str:
|
|
19
|
+
return os.path.join(directory, _safe_env_name(env_name))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def remember_target(
|
|
23
|
+
env_name: str,
|
|
24
|
+
target: DevTarget,
|
|
25
|
+
directory: str = DEFAULT_TARGET_DIR,
|
|
26
|
+
) -> None:
|
|
27
|
+
"""Persist *target* as the last Dev target for *env_name*."""
|
|
28
|
+
os.makedirs(directory, mode=0o700, exist_ok=True)
|
|
29
|
+
path = target_path(env_name, directory=directory)
|
|
30
|
+
with open(path, "w", encoding="utf-8") as handle:
|
|
31
|
+
handle.write(f"repo={target.repo}\nconfig={target.config}\n")
|
|
32
|
+
try:
|
|
33
|
+
os.chmod(path, 0o600)
|
|
34
|
+
except OSError:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def read_target(
|
|
39
|
+
env_name: str,
|
|
40
|
+
directory: str = DEFAULT_TARGET_DIR,
|
|
41
|
+
) -> DevTarget | None:
|
|
42
|
+
"""Return the remembered Dev target for *env_name*, or None."""
|
|
43
|
+
try:
|
|
44
|
+
with open(target_path(env_name, directory=directory), encoding="utf-8") as handle:
|
|
45
|
+
lines = handle.read().splitlines()
|
|
46
|
+
except OSError:
|
|
47
|
+
return None
|
|
48
|
+
values = dict(line.split("=", 1) for line in lines if "=" in line)
|
|
49
|
+
repo, config = values.get("repo"), values.get("config")
|
|
50
|
+
if not repo or not config:
|
|
51
|
+
return None
|
|
52
|
+
return DevTarget(repo=repo, config=config)
|
|
@@ -16,6 +16,14 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/..")
|
|
|
16
16
|
from cli import DISTRIBUTION_NAME
|
|
17
17
|
from cli import log as log
|
|
18
18
|
from cli.config import RigConfig
|
|
19
|
+
from cli.devcontainers import (
|
|
20
|
+
DevContainerError,
|
|
21
|
+
DevContainerScanError,
|
|
22
|
+
choose_target,
|
|
23
|
+
devcontainers_enabled,
|
|
24
|
+
repo_destinations,
|
|
25
|
+
scan_environment,
|
|
26
|
+
)
|
|
19
27
|
from cli.encrypt import interactive_decrypt, interactive_encrypt
|
|
20
28
|
from cli.last_env import clear_last_env, remember_last_env, resolve_env_name
|
|
21
29
|
from cli.last_session import (
|
|
@@ -25,6 +33,7 @@ from cli.last_session import (
|
|
|
25
33
|
remember_last_session,
|
|
26
34
|
resume_args_for_agent,
|
|
27
35
|
)
|
|
36
|
+
from cli.last_target import read_target, remember_target
|
|
28
37
|
from cli.live_agent import QUEUE_REFUSALS, running_agents
|
|
29
38
|
from cli.remote_dev import (
|
|
30
39
|
IMPLEMENTED_CLOUD_PROVIDERS,
|
|
@@ -676,6 +685,33 @@ def _cmd_apply(args: argparse.Namespace) -> int:
|
|
|
676
685
|
return 1
|
|
677
686
|
|
|
678
687
|
|
|
688
|
+
def _pick_dev_target(env, project, args: argparse.Namespace):
|
|
689
|
+
"""Scan the Environment and choose a Dev target: ``(target, repo remote path)``.
|
|
690
|
+
|
|
691
|
+
A scan that cannot run falls back to the plain open, unless ``--target`` was given.
|
|
692
|
+
"""
|
|
693
|
+
requested = getattr(args, "target", None)
|
|
694
|
+
repos = repo_destinations(project.config, REMOTE_WORKSPACE_ROOT)
|
|
695
|
+
try:
|
|
696
|
+
candidates = scan_environment(env, repos)
|
|
697
|
+
except DevContainerScanError as exc:
|
|
698
|
+
if requested:
|
|
699
|
+
raise
|
|
700
|
+
log.warning("Could not look for Dev Containers (%s); opening the plain folder", exc)
|
|
701
|
+
return None, None
|
|
702
|
+
target = choose_target(
|
|
703
|
+
candidates,
|
|
704
|
+
read_target(env.name),
|
|
705
|
+
requested,
|
|
706
|
+
bool(getattr(args, "select", False)),
|
|
707
|
+
sys.stdin.isatty(),
|
|
708
|
+
)
|
|
709
|
+
if target is None:
|
|
710
|
+
return None, None
|
|
711
|
+
remember_target(env.name, target)
|
|
712
|
+
return target, dict(repos)[target.repo]
|
|
713
|
+
|
|
714
|
+
|
|
679
715
|
def _cmd_dev(args: argparse.Namespace) -> int:
|
|
680
716
|
_load_credentials()
|
|
681
717
|
hetzner_token = os.getenv("HETZNER_CLOUD_API_TOKEN")
|
|
@@ -737,12 +773,24 @@ def _cmd_dev(args: argparse.Namespace) -> int:
|
|
|
737
773
|
", ".join(enabled),
|
|
738
774
|
editor,
|
|
739
775
|
)
|
|
776
|
+
dev_target, repo_dest = None, None
|
|
777
|
+
if devcontainers_enabled(project.config):
|
|
778
|
+
if getattr(args, "browser", False):
|
|
779
|
+
log.warning("Dev Containers are not supported with --browser; opening the plain folder")
|
|
780
|
+
else:
|
|
781
|
+
try:
|
|
782
|
+
dev_target, repo_dest = _pick_dev_target(env, project, args)
|
|
783
|
+
except DevContainerError as exc:
|
|
784
|
+
log.error("%s", exc)
|
|
785
|
+
return 1
|
|
740
786
|
return env.open_vscode(
|
|
741
787
|
remote_path=getattr(args, "path", None) or REMOTE_WORKSPACE_ROOT,
|
|
742
788
|
project_dir=os.getcwd(),
|
|
743
789
|
browser=bool(getattr(args, "browser", False)),
|
|
744
790
|
editor=editor,
|
|
745
791
|
editor_fallbacks=editor_fallbacks,
|
|
792
|
+
dev_target=dev_target,
|
|
793
|
+
repo_dest=repo_dest,
|
|
746
794
|
)
|
|
747
795
|
except Exception as e:
|
|
748
796
|
log.error("Error opening VS Code: %s", e)
|
|
@@ -1403,6 +1451,16 @@ def main(argv=None):
|
|
|
1403
1451
|
action="store_true",
|
|
1404
1452
|
help="Open code-server in the browser instead of local VS Code/Cursor",
|
|
1405
1453
|
)
|
|
1454
|
+
dev_parser.add_argument(
|
|
1455
|
+
"--target",
|
|
1456
|
+
metavar="REPO[:NAME]",
|
|
1457
|
+
help="Dev Container to open (needs editor.devcontainers in rig.yml); skips the prompt",
|
|
1458
|
+
)
|
|
1459
|
+
dev_parser.add_argument(
|
|
1460
|
+
"--select",
|
|
1461
|
+
action="store_true",
|
|
1462
|
+
help="Always ask which Dev Container to open",
|
|
1463
|
+
)
|
|
1406
1464
|
dev_parser.add_argument(
|
|
1407
1465
|
"--editor",
|
|
1408
1466
|
help=(
|
|
@@ -612,6 +612,11 @@ def derive_config_vars(config: dict[str, Any] | None) -> dict[str, Any]:
|
|
|
612
612
|
types, default = resolve_configured_agents(agent_cfg)
|
|
613
613
|
out["coding_agent_type"] = default
|
|
614
614
|
out["coding_agent_types"] = list(types)
|
|
615
|
+
|
|
616
|
+
from cli.devcontainers import devcontainers_enabled
|
|
617
|
+
|
|
618
|
+
if devcontainers_enabled(cfg):
|
|
619
|
+
out["install_docker"] = True # Dev Containers need Docker (ADR 0005)
|
|
615
620
|
return out
|
|
616
621
|
|
|
617
622
|
|
|
@@ -2523,6 +2528,10 @@ class RemoteDevEnvironment:
|
|
|
2523
2528
|
agent_type=inputs.get("agent_type"),
|
|
2524
2529
|
)
|
|
2525
2530
|
|
|
2531
|
+
if not self.flush_disk():
|
|
2532
|
+
log.warning("Skipping snapshot %s: could not flush the disk first", description)
|
|
2533
|
+
return False
|
|
2534
|
+
|
|
2526
2535
|
try:
|
|
2527
2536
|
image = self.manager.create_snapshot(
|
|
2528
2537
|
str(self.vm_id),
|
|
@@ -3252,6 +3261,24 @@ echo "Agent installation complete!"
|
|
|
3252
3261
|
timeout=timeout,
|
|
3253
3262
|
)
|
|
3254
3263
|
|
|
3264
|
+
def flush_disk(self, *, timeout: int = 120) -> bool:
|
|
3265
|
+
"""Flush the VM's dirty pages to disk, so a snapshot of it is consistent.
|
|
3266
|
+
|
|
3267
|
+
Hetzner snapshots a running server's disk as it is, and ext4 can hold
|
|
3268
|
+
a new file's contents in memory for ~30s after journaling that it exists.
|
|
3269
|
+
"""
|
|
3270
|
+
if not self.vm_ip:
|
|
3271
|
+
return False
|
|
3272
|
+
try:
|
|
3273
|
+
result = self.run_remote("sync && sync", timeout=timeout, connect_timeout=15)
|
|
3274
|
+
except (OSError, subprocess.SubprocessError) as exc:
|
|
3275
|
+
log.warning("Could not flush the disk of %s: %s", self.name, exc)
|
|
3276
|
+
return False
|
|
3277
|
+
if result.returncode != 0:
|
|
3278
|
+
log.warning("Could not flush the disk of %s: %s", self.name, (result.stderr or "").strip())
|
|
3279
|
+
return False
|
|
3280
|
+
return True
|
|
3281
|
+
|
|
3255
3282
|
# --- live agents -------------------------------------------------------
|
|
3256
3283
|
|
|
3257
3284
|
def live_agents(self, *, connect_timeout: int = 10) -> list[LiveAgent] | None:
|
|
@@ -3505,10 +3532,15 @@ echo "Agent installation complete!"
|
|
|
3505
3532
|
editor: str | None = None,
|
|
3506
3533
|
editor_fallbacks: Sequence[str] | None = None,
|
|
3507
3534
|
ssh_config_path: str | None = None,
|
|
3535
|
+
dev_target: Any = None,
|
|
3536
|
+
repo_dest: str | None = None,
|
|
3508
3537
|
) -> int:
|
|
3509
3538
|
"""
|
|
3510
3539
|
Open VS Code (or Cursor) against the remote VM via Remote-SSH.
|
|
3511
3540
|
|
|
3541
|
+
With a ``dev_target`` (a Repo's Dev Container, cloned at ``repo_dest``)
|
|
3542
|
+
the editor opens that container instead of the plain folder.
|
|
3543
|
+
|
|
3512
3544
|
Editor is the default. Pass ``browser=True`` to open code-server in a
|
|
3513
3545
|
browser instead.
|
|
3514
3546
|
"""
|
|
@@ -3581,6 +3613,11 @@ echo "Agent installation complete!"
|
|
|
3581
3613
|
|
|
3582
3614
|
alias = self.ensure_ssh_config_host(ssh_config_path=ssh_config_path)
|
|
3583
3615
|
folder_uri = f"vscode-remote://ssh-remote+{alias}{remote_path}"
|
|
3616
|
+
if dev_target is not None and repo_dest:
|
|
3617
|
+
from cli.devcontainers import devcontainer_folder_uri
|
|
3618
|
+
|
|
3619
|
+
folder_uri = devcontainer_folder_uri(alias, repo_dest, dev_target)
|
|
3620
|
+
remote_path = f"{dev_target.label} Dev Container"
|
|
3584
3621
|
cmd = [editor_bin, "--folder-uri", folder_uri]
|
|
3585
3622
|
log.info("Opening %s on %s (%s)", editor_bin, self.vm_ip, remote_path)
|
|
3586
3623
|
log.debug("SSH host alias=%s folder_uri=%s", alias, folder_uri)
|
|
@@ -4023,6 +4060,11 @@ CONFIGURE_PLAYBOOK = """---
|
|
|
4023
4060
|
become: true
|
|
4024
4061
|
gather_facts: false
|
|
4025
4062
|
tasks:
|
|
4063
|
+
- name: Install Docker for Dev Containers (editor.devcontainers in rig.yml)
|
|
4064
|
+
include_role:
|
|
4065
|
+
name: geerlingguy.docker
|
|
4066
|
+
when: install_docker | default(false)
|
|
4067
|
+
|
|
4026
4068
|
- name: Configure placeholder (customize this playbook)
|
|
4027
4069
|
debug:
|
|
4028
4070
|
msg: >-
|
|
@@ -4121,6 +4163,7 @@ AUTHORIZE_PLAYBOOK = r"""---
|
|
|
4121
4163
|
# --- Skip first-run prompts (theme picker, login wizard, folder trust) ---
|
|
4122
4164
|
# Runs on every create (authorize is never snapshotted) and merges into any
|
|
4123
4165
|
# existing file: the installer can create ~/.claude.json before we get here.
|
|
4166
|
+
# A file can be empty (a snapshot taken before its contents reached disk): read it as {}.
|
|
4124
4167
|
- name: Ensure Claude config directory exists for seeding
|
|
4125
4168
|
file:
|
|
4126
4169
|
path: /root/.claude
|
|
@@ -4151,7 +4194,8 @@ AUTHORIZE_PLAYBOOK = r"""---
|
|
|
4151
4194
|
| map(attribute='item.item') | zip(
|
|
4152
4195
|
_claude_state_contents.results | default([])
|
|
4153
4196
|
| map(attribute='content')
|
|
4154
|
-
| map('b64decode') | map('
|
|
4197
|
+
| map('b64decode') | map('trim') | map('default', '{}', true)
|
|
4198
|
+
| map('from_json')) ) }}
|
|
4155
4199
|
_ws: "{{ workspace_root | default('/workspace') }}"
|
|
4156
4200
|
_state_seed:
|
|
4157
4201
|
hasCompletedOnboarding: true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: Ephemeral remotes with full local parity for coding agents
|
|
5
5
|
Author: mystack-cloud
|
|
6
6
|
License-Expression: MIT
|
|
@@ -164,6 +164,23 @@ The prompt reaches the VM on stdin and a private temporary file that is deleted
|
|
|
164
164
|
|
|
165
165
|
Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git projects: numbers, names, or `all`). When more than one is selected, init asks which is the default for `rig dev` (`editor.default`). Pass `--editor` to open another enabled one. These are local clients: nothing extra is installed on the VM, and each IDE downloads its own remote server the first time it connects. Browser login: `rig vars decrypt vscode_browser_password`.
|
|
166
166
|
|
|
167
|
+
### Dev Containers
|
|
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.
|
|
170
|
+
|
|
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
|
+
- Not supported with `--browser`. Agents still run on the VM, not in the container.
|
|
173
|
+
- Docker is installed in the configure Stage and cached in the snapshot, so turning the flag on rebuilds the Workspace's snapshot once. New Workspaces get the task in `.rig/configure.yml`. **Existing Workspaces** must add it themselves, and existing Environments must be re-created:
|
|
174
|
+
|
|
175
|
+
```yaml
|
|
176
|
+
- name: Install Docker for Dev Containers
|
|
177
|
+
include_role:
|
|
178
|
+
name: geerlingguy.docker
|
|
179
|
+
when: install_docker | default(false)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
See [ADR 0005](docs/adr/0005-docker-in-configure-for-devcontainers.md).
|
|
183
|
+
|
|
167
184
|
## Layout
|
|
168
185
|
|
|
169
186
|
`rig init` writes commit-friendly files into the current directory (including a subdirectory of a git repo):
|
|
@@ -210,6 +227,7 @@ agent:
|
|
|
210
227
|
editor:
|
|
211
228
|
default: code # default for `rig dev`
|
|
212
229
|
enabled: [code] # local IDEs `rig dev --editor` may open
|
|
230
|
+
devcontainers: false # true: `rig dev` opens a Dev Container (see below)
|
|
213
231
|
playbooks:
|
|
214
232
|
provision: .rig/provision.yml
|
|
215
233
|
configure: .rig/configure.yml
|
|
@@ -29,6 +29,7 @@ docs/adr/0001-per-profile-generated-state-bucket.md
|
|
|
29
29
|
docs/adr/0002-outputs-as-separate-object-via-file-handoff.md
|
|
30
30
|
docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md
|
|
31
31
|
docs/adr/0004-agents-run-as-live-agents-in-tmux.md
|
|
32
|
+
docs/adr/0005-docker-in-configure-for-devcontainers.md
|
|
32
33
|
scripts/coverage_badge.py
|
|
33
34
|
scripts/pypi_version.py
|
|
34
35
|
src/__init__.py
|
|
@@ -36,11 +37,13 @@ src/cli/__init__.py
|
|
|
36
37
|
src/cli/__main__.py
|
|
37
38
|
src/cli/agents.py
|
|
38
39
|
src/cli/config.py
|
|
40
|
+
src/cli/devcontainers.py
|
|
39
41
|
src/cli/encrypt.py
|
|
40
42
|
src/cli/git.py
|
|
41
43
|
src/cli/git_author.py
|
|
42
44
|
src/cli/last_env.py
|
|
43
45
|
src/cli/last_session.py
|
|
46
|
+
src/cli/last_target.py
|
|
44
47
|
src/cli/live_agent.py
|
|
45
48
|
src/cli/log.py
|
|
46
49
|
src/cli/main.py
|
|
@@ -74,6 +77,7 @@ tests/test_attach_command.py
|
|
|
74
77
|
tests/test_credential_security.py
|
|
75
78
|
tests/test_destroy_command.py
|
|
76
79
|
tests/test_dev_command.py
|
|
80
|
+
tests/test_devcontainers.py
|
|
77
81
|
tests/test_encrypt_command.py
|
|
78
82
|
tests/test_encrypt_coverage.py
|
|
79
83
|
tests/test_firewall_client_ip.py
|
|
@@ -86,6 +90,7 @@ tests/test_init_command.py
|
|
|
86
90
|
tests/test_inspect_describe.py
|
|
87
91
|
tests/test_last_env.py
|
|
88
92
|
tests/test_last_session.py
|
|
93
|
+
tests/test_last_target.py
|
|
89
94
|
tests/test_live_agent.py
|
|
90
95
|
tests/test_live_agent_cli.py
|
|
91
96
|
tests/test_log.py
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"docs/adr/0002-outputs-as-separate-object-via-file-handoff.md",
|
|
23
23
|
"docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md",
|
|
24
24
|
"docs/adr/0004-agents-run-as-live-agents-in-tmux.md",
|
|
25
|
+
"docs/adr/0005-docker-in-configure-for-devcontainers.md",
|
|
25
26
|
"docs/architecture.md",
|
|
26
27
|
"docs/architecture.png",
|
|
27
28
|
"docs/architecture.svg",
|
|
@@ -43,11 +44,13 @@
|
|
|
43
44
|
"src/cli/assets/rig-agent-state",
|
|
44
45
|
"src/cli/assets/tmux.conf",
|
|
45
46
|
"src/cli/config.py",
|
|
47
|
+
"src/cli/devcontainers.py",
|
|
46
48
|
"src/cli/encrypt.py",
|
|
47
49
|
"src/cli/git.py",
|
|
48
50
|
"src/cli/git_author.py",
|
|
49
51
|
"src/cli/last_env.py",
|
|
50
52
|
"src/cli/last_session.py",
|
|
53
|
+
"src/cli/last_target.py",
|
|
51
54
|
"src/cli/live_agent.py",
|
|
52
55
|
"src/cli/log.py",
|
|
53
56
|
"src/cli/main.py",
|
|
@@ -68,6 +71,7 @@
|
|
|
68
71
|
"tests/test_credential_security.py",
|
|
69
72
|
"tests/test_destroy_command.py",
|
|
70
73
|
"tests/test_dev_command.py",
|
|
74
|
+
"tests/test_devcontainers.py",
|
|
71
75
|
"tests/test_encrypt_command.py",
|
|
72
76
|
"tests/test_encrypt_coverage.py",
|
|
73
77
|
"tests/test_firewall_client_ip.py",
|
|
@@ -80,6 +84,7 @@
|
|
|
80
84
|
"tests/test_inspect_describe.py",
|
|
81
85
|
"tests/test_last_env.py",
|
|
82
86
|
"tests/test_last_session.py",
|
|
87
|
+
"tests/test_last_target.py",
|
|
83
88
|
"tests/test_live_agent.py",
|
|
84
89
|
"tests/test_live_agent_cli.py",
|
|
85
90
|
"tests/test_log.py",
|