mystack-rig 1.6.1__tar.gz → 1.7.0__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.6.1 → mystack_rig-1.7.0}/GLOSSARY.md +4 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/PKG-INFO +21 -8
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/README.md +20 -7
- mystack_rig-1.7.0/docs/adr/0006-workspace-user-instead-of-root.md +21 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/agents.py +17 -17
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/devcontainers.py +51 -4
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/git.py +2 -2
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/remote_dev.py +183 -99
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/snapshots.py +7 -1
- mystack_rig-1.7.0/src/cli/workspace_user.py +38 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/PKG-INFO +21 -8
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/SOURCES.txt +2 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/scm_file_list.json +2 -0
- mystack_rig-1.7.0/src/mystack_rig.egg-info/scm_version.json +8 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_devcontainers.py +56 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_git_credentials_and_author.py +7 -5
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_init_command.py +70 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_inspect_describe.py +1 -1
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_live_agent.py +1 -1
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_live_agent_cli.py +1 -1
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_setup_provision.py +32 -13
- mystack_rig-1.6.1/src/mystack_rig.egg-info/scm_version.json +0 -8
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.coveragerc +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.git-blame-ignore-revs +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.github/workflows/release.yml +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.github/workflows/tests.yml +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.gitignore +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.rig/playbooks/README.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/.rig/playbooks/vpn-gateway.yml +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/CLI_STORAGE_SUMMARY.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/Dockerfile +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/GIT_CLONE_FEATURE.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/HETZNER_STORAGE_GUIDE.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/LICENSE +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/Makefile +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/README_REAL_E2E.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/STORAGE_CLI_GUIDE.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/adr/0005-docker-in-configure-for-devcontainers.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/architecture.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/architecture.png +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/docs/architecture.svg +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/forged-idea.md +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/pyproject.toml +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/pytest.ini +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/requirements.txt +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/sample.env +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/scripts/coverage_badge.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/scripts/pypi_version.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/setup.cfg +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/__init__.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/__init__.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/__main__.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/ansible_filters/__init__.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/ansible_filters/rig_live.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/ansible_filters/rig_mcp.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/assets/rig-agent-queue +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/assets/rig-agent-state +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/assets/tmux.conf +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/config.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/encrypt.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/git_author.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/last_env.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/last_session.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/last_target.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/live_agent.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/log.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/main.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/mcp.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/outputs.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/requirements.txt +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/state_bucket.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/storage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/vault_keys.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/cli/vpn.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/entry_points.txt +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/requires.txt +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/src/mystack_rig.egg-info/top_level.txt +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/test_hetzner_integration.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/conftest.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_agents.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_ansible_galaxy.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_attach_command.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_credential_security.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_destroy_command.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_dev_command.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_encrypt_command.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_encrypt_coverage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_firewall_client_ip.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_git_clone_unit.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_git_manager.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_gitignore_init.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_hetzner_storage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_last_env.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_last_session.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_last_target.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_log.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_main_coverage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_mcp_command.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_mcp_render.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_outputs.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_outputs_storage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_pypi_version.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_python_floor.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_r2_storage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_real_e2e_integration.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_real_e2e_storage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_real_e2e_vpn.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_real_e2e_vpn_tunnel.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_remote_dev.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_remote_dev_coverage_extensions.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_rig_ansible_vars.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_rig_config.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_secret_prompt_hidden.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_simulation_storage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_small_module_coverage.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_snapshots.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_state_bucket.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_storage_basic.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_vault_keys.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_vpn_optional.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_vpn_unit.py +0 -0
- {mystack_rig-1.6.1 → mystack_rig-1.7.0}/tests/test_workspace_git_clone.py +0 -0
|
@@ -48,6 +48,10 @@ _Avoid_: Background agent, daemon, detached session
|
|
|
48
48
|
One of the playbook steps rig runs in order when creating an Environment: provision, configure, authorize, materialize, finalize. Only provision and configure are cached in a snapshot.
|
|
49
49
|
_Avoid_: Phase, step
|
|
50
50
|
|
|
51
|
+
**Workspace user**:
|
|
52
|
+
The one non-root account on an Environment that you SSH in as and that agents, the editor and Dev Containers run as (`dev` by default, `host.user` in `rig.yml`). Ansible still connects as root.
|
|
53
|
+
_Avoid_: Login user, coder
|
|
54
|
+
|
|
51
55
|
**MCP server**:
|
|
52
56
|
A tool server declared once in the Workspace and installed into every Agent on its Environments.
|
|
53
57
|
_Avoid_: Plugin, tool, integration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Ephemeral remotes with full local parity for coding agents
|
|
5
5
|
Author: mystack-cloud
|
|
6
6
|
License-Expression: MIT
|
|
@@ -82,7 +82,7 @@ Declare an MCP server once in `.rig/mcp.json` and every enabled agent gets it. T
|
|
|
82
82
|
"mcpServers": {
|
|
83
83
|
"awx": {
|
|
84
84
|
"command": "python3",
|
|
85
|
-
"args": ["-u", "/
|
|
85
|
+
"args": ["-u", "/home/dev/awx-mcp-stdio.py"],
|
|
86
86
|
"env": { "AWX_MCP_API_KEY": "${AWX_MCP_API_KEY}" }
|
|
87
87
|
},
|
|
88
88
|
"context7": {
|
|
@@ -94,7 +94,7 @@ Declare an MCP server once in `.rig/mcp.json` and every enabled agent gets it. T
|
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
```bash
|
|
97
|
-
rig mcp add awx --env AWX_MCP_API_KEY -- python3 -u /
|
|
97
|
+
rig mcp add awx --env AWX_MCP_API_KEY -- python3 -u /home/dev/awx-mcp-stdio.py
|
|
98
98
|
rig mcp add context7 --url https://mcp.context7.com/mcp --header 'CONTEXT7_API_KEY=${CONTEXT7_API_KEY}'
|
|
99
99
|
rig mcp list # servers, and whether each variable resolves
|
|
100
100
|
rig mcp check # same, exit 1 on any problem (also lists ignored legacy files)
|
|
@@ -140,7 +140,7 @@ rig exec --name dev-ab12cd34 --agent claude "..."
|
|
|
140
140
|
|
|
141
141
|
`rig exec` starts the live agent with the prompt, prints how to attach, and returns. It never creates an Environment and never waits.
|
|
142
142
|
|
|
143
|
-
- **Approvals are skipped by default** (`--permission-mode bypassPermissions` for Claude Code, `--force` for Cursor, `--auto` for OpenCode), because an unattended agent that stops at a prompt just sits there. Claude Code refuses bypass mode as root unless it is told it runs in a sandbox, so rig sets `IS_SANDBOX=1` for that run, and authorize pre-accepts Claude's first-use warning dialog (`skipDangerousModePermissionPrompt`), whose default answer is "exit". The Environment has internet access, your tokens and root, so an agent reading untrusted text could be talked into acting on it. Use `--no-auto-approve` to supervise the run; it then pauses at each approval until you attach.
|
|
143
|
+
- **Approvals are skipped by default** (`--permission-mode bypassPermissions` for Claude Code, `--force` for Cursor, `--auto` for OpenCode), because an unattended agent that stops at a prompt just sits there. Claude Code refuses bypass mode as root unless it is told it runs in a sandbox, so rig sets `IS_SANDBOX=1` for that run (harmless for the non-root workspace user), and authorize pre-accepts Claude's first-use warning dialog (`skipDangerousModePermissionPrompt`), whose default answer is "exit". The Environment has internet access, your tokens and root, so an agent reading untrusted text could be talked into acting on it. Use `--no-auto-approve` to supervise the run; it then pauses at each approval until you attach.
|
|
144
144
|
- **If a live agent is already running**, `rig exec` queues the prompt into it for Claude Code, which runs it after the current turn. rig does this only when Claude's hooks report it idle or working, never while it waits at an approval dialog (typing there would answer the dialog). If it is waiting, the state is unknown, or the agent is OpenCode or Cursor (queue behaviour not yet verified), `rig exec` refuses with the reason; `--restart` replaces the live agent instead. A queued prompt runs under the existing agent's permission mode.
|
|
145
145
|
- The agent's startup is checked: if it exits within a couple of seconds (for example no credentials), `rig exec` prints its output and fails.
|
|
146
146
|
|
|
@@ -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
|
-
|
|
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.
|
|
@@ -181,6 +181,19 @@ Set `editor.devcontainers: true` and `rig dev` looks for Dev Containers in your
|
|
|
181
181
|
|
|
182
182
|
See [ADR 0005](docs/adr/0005-docker-in-configure-for-devcontainers.md).
|
|
183
183
|
|
|
184
|
+
### Workspace user
|
|
185
|
+
|
|
186
|
+
Rig doesn't make you work as root. Provision creates one non-root account, `dev` by default, with passwordless `sudo` and (once Docker is installed) the `docker` group. It is the account `rig attach`, `rig exec`, `rig dev`, the SSH alias, agents, code-server and Dev Containers all use, so VS Code remaps the container user's uid to match it and `/workspace` is writable from the container. Ansible still connects as root. Authorize copies root's `authorized_keys` to the user on every create.
|
|
187
|
+
|
|
188
|
+
Change the name in `rig.yml` (not `root`; a valid Linux user name):
|
|
189
|
+
|
|
190
|
+
```yaml
|
|
191
|
+
host:
|
|
192
|
+
user: dev
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Agent config (`~/.claude`, `~/.cursor`, `~/.config/opencode`), the git token file and the git author live in that user's home. `code_server_user` is no longer used. Playbooks get `rig_user` and `rig_home`. **Existing Workspaces:** `provision.yml` and `authorize.yml` are regenerated, but your `materialize.yml` is not: add `become_user: "{{ rig_user }}"` to its clone task and `owner`/`group: "{{ rig_user }}"` to the `/workspace` task. Existing Environments predate the user and must be re-created. See [ADR 0006](docs/adr/0006-workspace-user-instead-of-root.md).
|
|
196
|
+
|
|
184
197
|
## Layout
|
|
185
198
|
|
|
186
199
|
`rig init` writes commit-friendly files into the current directory (including a subdirectory of a git repo):
|
|
@@ -260,7 +273,7 @@ ports:
|
|
|
260
273
|
allowed_ips: ["198.51.100.10/32"]
|
|
261
274
|
```
|
|
262
275
|
|
|
263
|
-
Remote project files live under `/workspace
|
|
276
|
+
Remote project files live under `/workspace`, owned by the workspace user (not in its home).
|
|
264
277
|
|
|
265
278
|
## Lifecycle
|
|
266
279
|
|
|
@@ -461,7 +474,7 @@ MIT
|
|
|
461
474
|
|
|
462
475
|
**Provider tokens never go into repo URLs.** `authorize.yml` (managed) takes
|
|
463
476
|
`github_pat` / `gitlab_pat` from the vars files and writes them to
|
|
464
|
-
|
|
477
|
+
`~/.config/rig/git-provider.env` of the workspace user (mode `0600`). From there:
|
|
465
478
|
|
|
466
479
|
- login shells get `GH_TOKEN` / `GITLAB_TOKEN` via `/etc/profile.d`, and `rig attach`
|
|
467
480
|
exports them to the agent process itself (it starts the agent in a non-login
|
|
@@ -471,7 +484,7 @@ MIT
|
|
|
471
484
|
answers `github.com` / `gitlab.com` HTTPS requests from that same file, so
|
|
472
485
|
`git clone`, `git push` and the `materialize.yml` clone task all use plain
|
|
473
486
|
URLs (`https://github.com/org/repo.git`) and nothing sits in `.git/config`
|
|
474
|
-
or `git remote -v`. Other users on the VM can't read the file and get no
|
|
487
|
+
or `git remote -v`. Other users on the VM (besides root) can't read the file and get no
|
|
475
488
|
credentials.
|
|
476
489
|
|
|
477
490
|
The `materialize.yml` clone task passes the token to git through an inline
|
|
@@ -60,7 +60,7 @@ Declare an MCP server once in `.rig/mcp.json` and every enabled agent gets it. T
|
|
|
60
60
|
"mcpServers": {
|
|
61
61
|
"awx": {
|
|
62
62
|
"command": "python3",
|
|
63
|
-
"args": ["-u", "/
|
|
63
|
+
"args": ["-u", "/home/dev/awx-mcp-stdio.py"],
|
|
64
64
|
"env": { "AWX_MCP_API_KEY": "${AWX_MCP_API_KEY}" }
|
|
65
65
|
},
|
|
66
66
|
"context7": {
|
|
@@ -72,7 +72,7 @@ Declare an MCP server once in `.rig/mcp.json` and every enabled agent gets it. T
|
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
rig mcp add awx --env AWX_MCP_API_KEY -- python3 -u /
|
|
75
|
+
rig mcp add awx --env AWX_MCP_API_KEY -- python3 -u /home/dev/awx-mcp-stdio.py
|
|
76
76
|
rig mcp add context7 --url https://mcp.context7.com/mcp --header 'CONTEXT7_API_KEY=${CONTEXT7_API_KEY}'
|
|
77
77
|
rig mcp list # servers, and whether each variable resolves
|
|
78
78
|
rig mcp check # same, exit 1 on any problem (also lists ignored legacy files)
|
|
@@ -118,7 +118,7 @@ rig exec --name dev-ab12cd34 --agent claude "..."
|
|
|
118
118
|
|
|
119
119
|
`rig exec` starts the live agent with the prompt, prints how to attach, and returns. It never creates an Environment and never waits.
|
|
120
120
|
|
|
121
|
-
- **Approvals are skipped by default** (`--permission-mode bypassPermissions` for Claude Code, `--force` for Cursor, `--auto` for OpenCode), because an unattended agent that stops at a prompt just sits there. Claude Code refuses bypass mode as root unless it is told it runs in a sandbox, so rig sets `IS_SANDBOX=1` for that run, and authorize pre-accepts Claude's first-use warning dialog (`skipDangerousModePermissionPrompt`), whose default answer is "exit". The Environment has internet access, your tokens and root, so an agent reading untrusted text could be talked into acting on it. Use `--no-auto-approve` to supervise the run; it then pauses at each approval until you attach.
|
|
121
|
+
- **Approvals are skipped by default** (`--permission-mode bypassPermissions` for Claude Code, `--force` for Cursor, `--auto` for OpenCode), because an unattended agent that stops at a prompt just sits there. Claude Code refuses bypass mode as root unless it is told it runs in a sandbox, so rig sets `IS_SANDBOX=1` for that run (harmless for the non-root workspace user), and authorize pre-accepts Claude's first-use warning dialog (`skipDangerousModePermissionPrompt`), whose default answer is "exit". The Environment has internet access, your tokens and root, so an agent reading untrusted text could be talked into acting on it. Use `--no-auto-approve` to supervise the run; it then pauses at each approval until you attach.
|
|
122
122
|
- **If a live agent is already running**, `rig exec` queues the prompt into it for Claude Code, which runs it after the current turn. rig does this only when Claude's hooks report it idle or working, never while it waits at an approval dialog (typing there would answer the dialog). If it is waiting, the state is unknown, or the agent is OpenCode or Cursor (queue behaviour not yet verified), `rig exec` refuses with the reason; `--restart` replaces the live agent instead. A queued prompt runs under the existing agent's permission mode.
|
|
123
123
|
- The agent's startup is checked: if it exits within a couple of seconds (for example no credentials), `rig exec` prints its output and fails.
|
|
124
124
|
|
|
@@ -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
|
-
|
|
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.
|
|
@@ -159,6 +159,19 @@ Set `editor.devcontainers: true` and `rig dev` looks for Dev Containers in your
|
|
|
159
159
|
|
|
160
160
|
See [ADR 0005](docs/adr/0005-docker-in-configure-for-devcontainers.md).
|
|
161
161
|
|
|
162
|
+
### Workspace user
|
|
163
|
+
|
|
164
|
+
Rig doesn't make you work as root. Provision creates one non-root account, `dev` by default, with passwordless `sudo` and (once Docker is installed) the `docker` group. It is the account `rig attach`, `rig exec`, `rig dev`, the SSH alias, agents, code-server and Dev Containers all use, so VS Code remaps the container user's uid to match it and `/workspace` is writable from the container. Ansible still connects as root. Authorize copies root's `authorized_keys` to the user on every create.
|
|
165
|
+
|
|
166
|
+
Change the name in `rig.yml` (not `root`; a valid Linux user name):
|
|
167
|
+
|
|
168
|
+
```yaml
|
|
169
|
+
host:
|
|
170
|
+
user: dev
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Agent config (`~/.claude`, `~/.cursor`, `~/.config/opencode`), the git token file and the git author live in that user's home. `code_server_user` is no longer used. Playbooks get `rig_user` and `rig_home`. **Existing Workspaces:** `provision.yml` and `authorize.yml` are regenerated, but your `materialize.yml` is not: add `become_user: "{{ rig_user }}"` to its clone task and `owner`/`group: "{{ rig_user }}"` to the `/workspace` task. Existing Environments predate the user and must be re-created. See [ADR 0006](docs/adr/0006-workspace-user-instead-of-root.md).
|
|
174
|
+
|
|
162
175
|
## Layout
|
|
163
176
|
|
|
164
177
|
`rig init` writes commit-friendly files into the current directory (including a subdirectory of a git repo):
|
|
@@ -238,7 +251,7 @@ ports:
|
|
|
238
251
|
allowed_ips: ["198.51.100.10/32"]
|
|
239
252
|
```
|
|
240
253
|
|
|
241
|
-
Remote project files live under `/workspace
|
|
254
|
+
Remote project files live under `/workspace`, owned by the workspace user (not in its home).
|
|
242
255
|
|
|
243
256
|
## Lifecycle
|
|
244
257
|
|
|
@@ -439,7 +452,7 @@ MIT
|
|
|
439
452
|
|
|
440
453
|
**Provider tokens never go into repo URLs.** `authorize.yml` (managed) takes
|
|
441
454
|
`github_pat` / `gitlab_pat` from the vars files and writes them to
|
|
442
|
-
|
|
455
|
+
`~/.config/rig/git-provider.env` of the workspace user (mode `0600`). From there:
|
|
443
456
|
|
|
444
457
|
- login shells get `GH_TOKEN` / `GITLAB_TOKEN` via `/etc/profile.d`, and `rig attach`
|
|
445
458
|
exports them to the agent process itself (it starts the agent in a non-login
|
|
@@ -449,7 +462,7 @@ MIT
|
|
|
449
462
|
answers `github.com` / `gitlab.com` HTTPS requests from that same file, so
|
|
450
463
|
`git clone`, `git push` and the `materialize.yml` clone task all use plain
|
|
451
464
|
URLs (`https://github.com/org/repo.git`) and nothing sits in `.git/config`
|
|
452
|
-
or `git remote -v`. Other users on the VM can't read the file and get no
|
|
465
|
+
or `git remote -v`. Other users on the VM (besides root) can't read the file and get no
|
|
453
466
|
credentials.
|
|
454
467
|
|
|
455
468
|
The `materialize.yml` clone task passes the token to git through an inline
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Environments are worked on as a workspace user, not root
|
|
2
|
+
|
|
3
|
+
Provision creates one non-root account (`dev`, or `host.user` in `rig.yml`) with passwordless sudo. SSH, `rig attach`/`exec`/`dev`, agents, code-server and Dev Containers all use it, and it replaces code-server's separate `coder` user. Ansible keeps connecting as root, since the cloud image only has root and the key; tasks that write into the home directory finish with a `chown`, and the repo clones run `become_user` the workspace user.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
VS Code remaps a Dev Container user's uid to the host user's, but skips it when the host user is root. Working as root left `/workspace` and `~/.ssh` owned by uid 0, so the container user could not write to them (pre-commit and saving files failed), and every project had to work around it.
|
|
8
|
+
|
|
9
|
+
## Considered Options
|
|
10
|
+
|
|
11
|
+
- **Phase 1: editor user only**: rejected. Agents, tokens and files would live under two accounts.
|
|
12
|
+
- **Keep `coder` plus a second user**: rejected. Two accounts is what makes uid 1000 belong to someone else.
|
|
13
|
+
- **Connect Ansible as the user**: rejected. The image has only root, and provisioning needs it anyway.
|
|
14
|
+
|
|
15
|
+
## Consequences
|
|
16
|
+
|
|
17
|
+
- `authorize.yml` copies root's `authorized_keys` to the user on every create (a snapshot would carry the old VM's key) and adds the user to the `docker` group when it exists.
|
|
18
|
+
- Playbooks use `rig_user` / `rig_home`, injected by rig. `provision.yml` and `authorize.yml` are regenerated; user-owned `materialize.yml` must be updated by hand (see the README).
|
|
19
|
+
- Environments created before this change have no such user and must be re-created. Changing `host.user` changes the system hash.
|
|
20
|
+
- docker-group membership is root-equivalent, so passwordless sudo adds little risk.
|
|
21
|
+
- Copying local `~/.ssh` into the user is not done; private keys on a cloud VM stay opt-in and out of scope.
|
|
@@ -58,7 +58,7 @@ These rules apply to coding agents provisioned by rig for this workspace.
|
|
|
58
58
|
|
|
59
59
|
## Remote environment
|
|
60
60
|
- This workspace runs on a rig-managed remote VM.
|
|
61
|
-
- Project files live under `/workspace` (not
|
|
61
|
+
- Project files live under `/workspace` (not your home directory); home is for tooling/dotfiles only.
|
|
62
62
|
- Git remotes use HTTPS with provider PATs from the environment / Ansible vars.
|
|
63
63
|
- Prefer `gh` (GitHub) or `glab` (GitLab) for MRs, reviews, and issue workflows.
|
|
64
64
|
|
|
@@ -178,31 +178,31 @@ def agent_config_dir_name(agent_type: str) -> str:
|
|
|
178
178
|
return ".claude"
|
|
179
179
|
|
|
180
180
|
|
|
181
|
-
def agent_remote_paths(agent_type: str) -> dict[str, str]:
|
|
182
|
-
"""Where scaffolded files land on the remote VM
|
|
181
|
+
def agent_remote_paths(agent_type: str, home: str = "/home/dev") -> dict[str, str]:
|
|
182
|
+
"""Where scaffolded files land on the remote VM, under the workspace user's *home*."""
|
|
183
183
|
agent = normalize_agent_type(agent_type)
|
|
184
184
|
if agent == "opencode":
|
|
185
185
|
return {
|
|
186
|
-
"config_dir": "
|
|
187
|
-
"config_file": "
|
|
188
|
-
"mcp_file": "
|
|
189
|
-
"rules_file": "
|
|
190
|
-
"env_file": "
|
|
186
|
+
"config_dir": f"{home}/.config/opencode",
|
|
187
|
+
"config_file": f"{home}/.config/opencode/opencode.json",
|
|
188
|
+
"mcp_file": f"{home}/.config/opencode/opencode.json", # `mcp` key, merged at authorize
|
|
189
|
+
"rules_file": f"{home}/.config/opencode/AGENTS.md",
|
|
190
|
+
"env_file": f"{home}/.config/opencode/credentials.env",
|
|
191
191
|
}
|
|
192
192
|
if agent == "cursor":
|
|
193
193
|
return {
|
|
194
|
-
"config_dir": "
|
|
195
|
-
"config_file": "
|
|
196
|
-
"mcp_file": "
|
|
194
|
+
"config_dir": f"{home}/.cursor",
|
|
195
|
+
"config_file": f"{home}/.cursor/cli-config.json",
|
|
196
|
+
"mcp_file": f"{home}/.cursor/mcp.json",
|
|
197
197
|
"rules_file": "/workspace/AGENTS.md",
|
|
198
|
-
"env_file": "
|
|
198
|
+
"env_file": f"{home}/.cursor/credentials.env",
|
|
199
199
|
}
|
|
200
200
|
return {
|
|
201
|
-
"config_dir": "
|
|
202
|
-
"config_file": "
|
|
203
|
-
"mcp_file": "
|
|
204
|
-
"rules_file": "
|
|
205
|
-
"env_file": "
|
|
201
|
+
"config_dir": f"{home}/.claude",
|
|
202
|
+
"config_file": f"{home}/.claude/settings.json",
|
|
203
|
+
"mcp_file": f"{home}/.claude.json", # `mcpServers` key, merged at authorize
|
|
204
|
+
"rules_file": f"{home}/.claude/CLAUDE.md",
|
|
205
|
+
"env_file": f"{home}/.claude/credentials.env",
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
|
|
@@ -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
|
-
|
|
77
|
-
|
|
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")
|
|
@@ -94,7 +94,7 @@ class GitManager:
|
|
|
94
94
|
"accept_hostkey": repo.get("accept_hostkey", True),
|
|
95
95
|
"force": repo.get("force", False),
|
|
96
96
|
"version": repo.get("version", "main"),
|
|
97
|
-
"ssh_key": repo.get("ssh_key", "
|
|
97
|
+
"ssh_key": repo.get("ssh_key", "~/.ssh/id_rsa"),
|
|
98
98
|
},
|
|
99
99
|
}
|
|
100
100
|
)
|
|
@@ -173,7 +173,7 @@ class GitManager:
|
|
|
173
173
|
repo_config["password_var"] = password_var
|
|
174
174
|
|
|
175
175
|
if is_ssh:
|
|
176
|
-
repo_config["ssh_key"] = "
|
|
176
|
+
repo_config["ssh_key"] = "~/.ssh/id_rsa"
|
|
177
177
|
ssh_repos.append(repo_config)
|
|
178
178
|
else:
|
|
179
179
|
clone_repos.append(repo_config)
|