mystack-rig 1.6.2__tar.gz → 1.7.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.7.1/CLAUDE.md +31 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/GLOSSARY.md +4 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/PKG-INFO +20 -7
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/README.md +19 -6
- mystack_rig-1.7.1/docs/adr/0006-workspace-user-instead-of-root.md +21 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/agents.py +17 -17
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/git.py +2 -2
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/remote_dev.py +188 -102
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/snapshots.py +7 -1
- mystack_rig-1.7.1/src/cli/workspace_user.py +38 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/PKG-INFO +20 -7
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/SOURCES.txt +3 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/scm_file_list.json +3 -0
- mystack_rig-1.7.1/src/mystack_rig.egg-info/scm_version.json +8 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_git_credentials_and_author.py +7 -5
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_inspect_describe.py +1 -1
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_live_agent.py +10 -1
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_live_agent_cli.py +1 -1
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_setup_provision.py +45 -13
- mystack_rig-1.6.2/src/mystack_rig.egg-info/scm_version.json +0 -8
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.coveragerc +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.git-blame-ignore-revs +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.github/workflows/release.yml +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.github/workflows/tests.yml +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.gitignore +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.rig/playbooks/README.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/.rig/playbooks/vpn-gateway.yml +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/CLI_STORAGE_SUMMARY.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/Dockerfile +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/GIT_CLONE_FEATURE.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/HETZNER_STORAGE_GUIDE.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/LICENSE +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/Makefile +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/README_REAL_E2E.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/STORAGE_CLI_GUIDE.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/adr/0005-docker-in-configure-for-devcontainers.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/architecture.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/architecture.png +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/docs/architecture.svg +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/forged-idea.md +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/pyproject.toml +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/pytest.ini +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/requirements.txt +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/sample.env +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/scripts/coverage_badge.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/scripts/pypi_version.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/setup.cfg +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/__init__.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/__init__.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/__main__.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/ansible_filters/__init__.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/ansible_filters/rig_live.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/ansible_filters/rig_mcp.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/assets/rig-agent-queue +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/assets/rig-agent-state +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/assets/tmux.conf +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/config.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/devcontainers.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/encrypt.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/git_author.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/last_env.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/last_session.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/last_target.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/live_agent.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/log.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/main.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/mcp.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/outputs.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/requirements.txt +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/state_bucket.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/storage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/vault_keys.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/cli/vpn.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/entry_points.txt +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/requires.txt +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/src/mystack_rig.egg-info/top_level.txt +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/test_hetzner_integration.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/conftest.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_agents.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_ansible_galaxy.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_attach_command.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_credential_security.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_destroy_command.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_dev_command.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_devcontainers.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_encrypt_command.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_encrypt_coverage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_firewall_client_ip.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_git_clone_unit.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_git_manager.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_gitignore_init.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_hetzner_storage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_init_command.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_last_env.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_last_session.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_last_target.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_log.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_main_coverage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_mcp_command.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_mcp_render.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_outputs.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_outputs_storage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_pypi_version.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_python_floor.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_r2_storage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_real_e2e_integration.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_real_e2e_storage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_real_e2e_vpn.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_real_e2e_vpn_tunnel.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_remote_dev.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_remote_dev_coverage_extensions.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_rig_ansible_vars.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_rig_config.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_secret_prompt_hidden.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_simulation_storage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_small_module_coverage.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_snapshots.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_state_bucket.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_storage_basic.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_vault_keys.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_vpn_optional.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_vpn_unit.py +0 -0
- {mystack_rig-1.6.2 → mystack_rig-1.7.1}/tests/test_workspace_git_clone.py +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Rig: rules for agents
|
|
2
|
+
|
|
3
|
+
Vocabulary is in `GLOSSARY.md`; decisions are in `docs/adr/`.
|
|
4
|
+
|
|
5
|
+
## Fixing a bug or shipping a change
|
|
6
|
+
|
|
7
|
+
Do every step, in order. Don't stop after the PR.
|
|
8
|
+
|
|
9
|
+
1. **Branch** off `master`: `fix/<what>` or `feat/<what>`. Never commit to `master`.
|
|
10
|
+
2. **Test first.** Add a test that fails without the fix. Keep the diff to what the bug needs.
|
|
11
|
+
3. **Run the CI gates locally** (same versions as CI):
|
|
12
|
+
- `uvx ruff@0.17.5 check .` and `uvx ruff@0.17.5 format --check .` (run `format .` to fix)
|
|
13
|
+
- `uvx mypy src/ --ignore-missing-imports`
|
|
14
|
+
- `uv run pytest tests/ -m "not e2e" --cov=src --cov-fail-under=90` with the same `--ignore` flags as the Unit Tests job in `.github/workflows/tests.yml`
|
|
15
|
+
4. **Commit and push**, then open a PR against `master` (use the `pr` skill for the body). Commit messages are conventional (`fix:`, `feat:`).
|
|
16
|
+
5. **Wait for every CI job to pass**: Lint, Type Check, Unit Tests, Integration Tests, E2E Tests and `codecov/patch`. Use `gh pr checks <n> --watch`. If one fails, fix it on the branch; never merge red.
|
|
17
|
+
6. **Coverage must not drop.** The floor is 90% (`.coveragerc`), but also don't lower the current total or leave new code untested. `codecov/patch` must pass.
|
|
18
|
+
7. **Merge** the PR with a merge commit (`gh pr merge <n> --merge`), then update `master`.
|
|
19
|
+
8. **Release.** Tag the merge commit and push the tag; the Release workflow publishes to PyPI.
|
|
20
|
+
- Bug fix: bump the patch (`v1.7.0` → `v1.7.1`). New feature: bump the minor. Breaking change: bump the major.
|
|
21
|
+
- `git tag -a vX.Y.Z -m "<summary>" && git push origin vX.Y.Z`, then `gh run watch` the Release run and confirm the version on PyPI.
|
|
22
|
+
9. **Tell the user** what was merged, the version, and anything existing Environments or workspaces must do (re-create, edit user-owned playbooks).
|
|
23
|
+
|
|
24
|
+
Ask before merging or releasing only if CI is red, coverage dropped, or the user hasn't asked for a release.
|
|
25
|
+
|
|
26
|
+
## Testing
|
|
27
|
+
|
|
28
|
+
- Unit tests mutate `HETZNER_CLOUD_API_TOKEN` in-process. Run the real-API tests (`tests/test_real_e2e_*.py`, `tests/test_hetzner_storage.py`, `tests/test_workspace_git_clone.py`) in their own pytest process, or they fail with 401.
|
|
29
|
+
- Real-API and real-VM tests cost money. Delete what you create (`rig delete`, then check no servers, SSH keys or firewalls are left with the Hetzner API).
|
|
30
|
+
- Anything that SSHes before `authorize.yml` has run must connect as `root`: the workspace user can't log in until authorize copies its key.
|
|
31
|
+
- `provision.yml` and `authorize.yml` are regenerated on every run; `configure.yml` and `materialize.yml` are user-owned and never overwritten, so changes to them need a README note for existing workspaces.
|
|
@@ -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.1
|
|
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
|
|
|
@@ -181,6 +181,19 @@ Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git pr
|
|
|
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
|
|
|
@@ -159,6 +159,19 @@ Chosen at `rig init` (`editor.enabled` in `rig.yml`, same multi-select as git pr
|
|
|
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
|
|
|
@@ -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)
|