mystack-rig 1.9.0__tar.gz → 1.9.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.
Files changed (160) hide show
  1. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/PKG-INFO +2 -2
  2. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/README.md +1 -1
  3. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/roles.md +15 -12
  4. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/remote_dev.py +50 -477
  5. mystack_rig-1.9.1/src/cli/roles/rig_claude_code/tasks/authorize.yml +111 -0
  6. mystack_rig-1.9.1/src/cli/roles/rig_code_server/tasks/authorize.yml +28 -0
  7. mystack_rig-1.9.1/src/cli/roles/rig_cursor_cli/tasks/authorize.yml +61 -0
  8. mystack_rig-1.9.1/src/cli/roles/rig_git/tasks/authorize.yml +109 -0
  9. mystack_rig-1.9.1/src/cli/roles/rig_home_ownership/tasks/authorize.yml +7 -0
  10. mystack_rig-1.9.1/src/cli/roles/rig_live_agent/tasks/authorize.yml +95 -0
  11. mystack_rig-1.9.1/src/cli/roles/rig_mcp/defaults/main.yml +2 -0
  12. mystack_rig-1.9.1/src/cli/roles/rig_mcp/tasks/authorize.yml +63 -0
  13. mystack_rig-1.9.1/src/cli/roles/rig_opencode/tasks/authorize.yml +36 -0
  14. mystack_rig-1.9.1/src/cli/roles/rig_workspace_user/tasks/authorize.yml +30 -0
  15. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/PKG-INFO +2 -2
  16. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/SOURCES.txt +10 -0
  17. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/scm_file_list.json +10 -0
  18. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/scm_version.json +2 -2
  19. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/_roles.py +26 -0
  20. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_bundled_roles.py +43 -3
  21. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_encrypt_command.py +4 -4
  22. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_git_credentials_and_author.py +5 -2
  23. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_init_command.py +2 -2
  24. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_live_agent.py +12 -13
  25. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_remote_dev.py +3 -3
  26. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_setup_provision.py +11 -14
  27. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.coveragerc +0 -0
  28. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.git-blame-ignore-revs +0 -0
  29. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.github/workflows/release.yml +0 -0
  30. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.github/workflows/tests.yml +0 -0
  31. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.gitignore +0 -0
  32. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.rig/playbooks/README.md +0 -0
  33. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/.rig/playbooks/vpn-gateway.yml +0 -0
  34. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/CLAUDE.md +0 -0
  35. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/CLI_STORAGE_SUMMARY.md +0 -0
  36. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/Dockerfile +0 -0
  37. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/GIT_CLONE_FEATURE.md +0 -0
  38. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/GLOSSARY.md +0 -0
  39. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/HETZNER_STORAGE_GUIDE.md +0 -0
  40. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
  41. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/LICENSE +0 -0
  42. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/Makefile +0 -0
  43. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/README_REAL_E2E.md +0 -0
  44. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/STORAGE_CLI_GUIDE.md +0 -0
  45. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
  46. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
  47. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
  48. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
  49. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0005-docker-in-configure-for-devcontainers.md +0 -0
  50. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0006-workspace-user-instead-of-root.md +0 -0
  51. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md +0 -0
  52. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/architecture.md +0 -0
  53. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/architecture.png +0 -0
  54. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/docs/architecture.svg +0 -0
  55. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/forged-idea.md +0 -0
  56. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/pyproject.toml +0 -0
  57. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/pytest.ini +0 -0
  58. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/requirements.txt +0 -0
  59. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/sample.env +0 -0
  60. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/scripts/coverage_badge.py +0 -0
  61. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/scripts/pypi_version.py +0 -0
  62. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/setup.cfg +0 -0
  63. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/__init__.py +0 -0
  64. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/__init__.py +0 -0
  65. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/__main__.py +0 -0
  66. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/agents.py +0 -0
  67. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/ansible_filters/__init__.py +0 -0
  68. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/ansible_filters/rig_live.py +0 -0
  69. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/ansible_filters/rig_mcp.py +0 -0
  70. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/assets/rig-agent-queue +0 -0
  71. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/assets/rig-agent-state +0 -0
  72. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/assets/tmux.conf +0 -0
  73. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/config.py +0 -0
  74. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/devcontainers.py +0 -0
  75. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/encrypt.py +0 -0
  76. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/git.py +0 -0
  77. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/git_author.py +0 -0
  78. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/last_env.py +0 -0
  79. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/last_session.py +0 -0
  80. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/last_target.py +0 -0
  81. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/live_agent.py +0 -0
  82. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/log.py +0 -0
  83. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/main.py +0 -0
  84. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/mcp.py +0 -0
  85. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/outputs.py +0 -0
  86. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/requirements.txt +0 -0
  87. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_base/defaults/main.yml +0 -0
  88. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_base/tasks/install.yml +0 -0
  89. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_claude_code/defaults/main.yml +0 -0
  90. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_claude_code/tasks/install.yml +0 -0
  91. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_code_server/defaults/main.yml +0 -0
  92. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_code_server/tasks/install.yml +0 -0
  93. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_cursor_cli/defaults/main.yml +0 -0
  94. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_cursor_cli/tasks/install.yml +0 -0
  95. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_git/defaults/main.yml +0 -0
  96. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_git/tasks/install.yml +0 -0
  97. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_home_ownership/defaults/main.yml +0 -0
  98. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_home_ownership/tasks/install.yml +0 -0
  99. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_live_agent/defaults/main.yml +0 -0
  100. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_live_agent/tasks/install.yml +0 -0
  101. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_opencode/defaults/main.yml +0 -0
  102. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_opencode/tasks/install.yml +0 -0
  103. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_workspace_user/defaults/main.yml +0 -0
  104. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/roles/rig_workspace_user/tasks/install.yml +0 -0
  105. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/snapshots.py +0 -0
  106. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/state_bucket.py +0 -0
  107. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/storage.py +0 -0
  108. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/vault_keys.py +0 -0
  109. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/vpn.py +0 -0
  110. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/cli/workspace_user.py +0 -0
  111. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
  112. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/entry_points.txt +0 -0
  113. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/requires.txt +0 -0
  114. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/src/mystack_rig.egg-info/top_level.txt +0 -0
  115. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/test_hetzner_integration.py +0 -0
  116. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/conftest.py +0 -0
  117. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_agents.py +0 -0
  118. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_ansible_galaxy.py +0 -0
  119. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_attach_command.py +0 -0
  120. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_credential_security.py +0 -0
  121. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_destroy_command.py +0 -0
  122. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_dev_command.py +0 -0
  123. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_devcontainers.py +0 -0
  124. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_encrypt_coverage.py +0 -0
  125. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_firewall_client_ip.py +0 -0
  126. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_git_clone_unit.py +0 -0
  127. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_git_manager.py +0 -0
  128. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_gitignore_init.py +0 -0
  129. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_hetzner_storage.py +0 -0
  130. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_inspect_describe.py +0 -0
  131. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_last_env.py +0 -0
  132. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_last_session.py +0 -0
  133. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_last_target.py +0 -0
  134. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_live_agent_cli.py +0 -0
  135. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_log.py +0 -0
  136. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_main_coverage.py +0 -0
  137. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_mcp_command.py +0 -0
  138. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_mcp_render.py +0 -0
  139. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_outputs.py +0 -0
  140. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_outputs_storage.py +0 -0
  141. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_pypi_version.py +0 -0
  142. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_python_floor.py +0 -0
  143. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_r2_storage.py +0 -0
  144. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_real_e2e_integration.py +0 -0
  145. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_real_e2e_storage.py +0 -0
  146. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_real_e2e_vpn.py +0 -0
  147. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_real_e2e_vpn_tunnel.py +0 -0
  148. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_remote_dev_coverage_extensions.py +0 -0
  149. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_rig_ansible_vars.py +0 -0
  150. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_rig_config.py +0 -0
  151. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_secret_prompt_hidden.py +0 -0
  152. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_simulation_storage.py +0 -0
  153. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_small_module_coverage.py +0 -0
  154. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_snapshots.py +0 -0
  155. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_state_bucket.py +0 -0
  156. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_storage_basic.py +0 -0
  157. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_vault_keys.py +0 -0
  158. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_vpn_optional.py +0 -0
  159. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_vpn_unit.py +0 -0
  160. {mystack_rig-1.9.0 → mystack_rig-1.9.1}/tests/test_workspace_git_clone.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mystack-rig
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: Ephemeral remotes with full local parity for coding agents
5
5
  Author: mystack-cloud
6
6
  License-Expression: MIT
@@ -308,7 +308,7 @@ destroy playbooks:
308
308
  | **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
309
309
  | **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` and `--skip-tags` are passed to both playbooks. |
310
310
 
311
- The managed playbooks only call [bundled roles](docs/roles.md); skip any part with `--skip-tags` (or `ansible.skip_tags` in `rig.yml`). See [ADR 0007](docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md).
311
+ `provision.yml` and `authorize.yml` only call [bundled roles](docs/roles.md); skip any part with `--skip-tags` (or `ansible.skip_tags` in `rig.yml`). See [ADR 0007](docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md). **Existing Environments** created before tmux entered provision (before live agents) lack it: authorize no longer installs it, so run `rig apply --provision` or re-create them.
312
312
 
313
313
  Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
314
314
 
@@ -286,7 +286,7 @@ destroy playbooks:
286
286
  | **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
287
287
  | **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` and `--skip-tags` are passed to both playbooks. |
288
288
 
289
- The managed playbooks only call [bundled roles](docs/roles.md); skip any part with `--skip-tags` (or `ansible.skip_tags` in `rig.yml`). See [ADR 0007](docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md).
289
+ `provision.yml` and `authorize.yml` only call [bundled roles](docs/roles.md); skip any part with `--skip-tags` (or `ansible.skip_tags` in `rig.yml`). See [ADR 0007](docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md). **Existing Environments** created before tmux entered provision (before live agents) lack it: authorize no longer installs it, so run `rig apply --provision` or re-create them.
290
290
 
291
291
  Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
292
292
 
@@ -1,22 +1,25 @@
1
1
  # Bundled roles
2
2
 
3
- The playbooks rig generates (`provision.yml`, and later `authorize.yml`) are short: they call **bundled roles** that ship inside the rig package (`src/cli/roles/`). The roles do the work, so rig can change what an Environment gets without rewriting your `.rig/` files, and you can skip any part of it.
3
+ The playbooks rig generates (`provision.yml` and `authorize.yml`) are short: they call **bundled roles** that ship inside the rig package (`src/cli/roles/`). The roles do the work, so rig can change what an Environment gets without rewriting your `.rig/` files, and you can skip any part of it.
4
4
 
5
5
  The playbooks are regenerated on every run. Do not edit them; skip or override through tags, variables or your own roles (below).
6
6
 
7
7
  ## Roles
8
8
 
9
- One role per concern. A role has a *Stage entry point* for each Stage it takes part in: `tasks/install.yml` runs in **provision**. The provision Stage is cached in a snapshot; later Stages are not.
9
+ One role per concern. A role has a *Stage entry point* for each Stage it takes part in: `tasks/install.yml` runs in **provision** (cached in a snapshot) and `tasks/authorize.yml` runs in **authorize** (every create and apply, never cached).
10
10
 
11
- | Role | Provision (`install`) |
12
- | --- | --- |
13
- | `rig_base` | wait for cloud-init, apt cache, base packages |
14
- | `rig_workspace_user` | the [Workspace user](../GLOSSARY.md), its sudo rule, `/workspace`, `AGENTS.md` |
15
- | `rig_git` | GitHub CLI and GitLab CLI, for the providers the Workspace's repos use |
16
- | `rig_live_agent` | tmux |
17
- | `rig_code_server` | code-server and its config directory |
18
- | `rig_opencode`, `rig_claude_code`, `rig_cursor_cli` | the Agent's CLI and config; only the enabled Agents run |
19
- | `rig_home_ownership` | hands `/home/<user>` to the Workspace user; always runs, last |
11
+ | Role | Provision (`install`) | Authorize |
12
+ | --- | --- | --- |
13
+ | `rig_base` | wait for cloud-init, apt cache, base packages | |
14
+ | `rig_workspace_user` | the [Workspace user](../GLOSSARY.md), its sudo rule, `/workspace`, `AGENTS.md` | SSH key copied from root, docker group |
15
+ | `rig_git` | GitHub CLI and GitLab CLI, for the providers the Workspace's repos use | git author, provider tokens, git credential helper |
16
+ | `rig_live_agent` | tmux | tmux config, helper scripts, Claude's state hooks, the default Agent's env exports |
17
+ | `rig_code_server` | code-server and its config directory | browser password, systemd unit |
18
+ | `rig_opencode`, `rig_claude_code`, `rig_cursor_cli` | the Agent's CLI and config; only the enabled Agents run | API key and credentials file; Claude's onboarding seed; Cursor's workspace trust |
19
+ | `rig_mcp` | | render `.rig/mcp.json` into each enabled Agent's config |
20
+ | `rig_home_ownership` | hands `/home/<user>` to the Workspace user; always runs, last | same, after everything that wrote into it |
21
+
22
+ Authorize runs the roles in dependency order: the Agent roles seed `~/.claude.json` and `settings.json`, then `rig_mcp` merges into them and `rig_live_agent` adds its hooks. Each Agent role resolves only its own API key, so skipping a role also skips its key.
20
23
 
21
24
  ## Tags
22
25
 
@@ -26,7 +29,7 @@ Every task has three kinds of tag:
26
29
  2. **Group tag**: `<role>_<group>`, e.g. `rig_claude_code_install`, `rig_claude_code_config`, `rig_git_gh`, `rig_git_glab`, `rig_workspace_user_sudo`. Skips or selects one meaningful group of tasks.
27
30
  3. **Cross-cutting tags**: `packages`, `credentials`, `agents`, `mcp`, `git`. Select a kind of work across roles.
28
31
 
29
- `rig_home_ownership` is also tagged `always`, so it still runs when you use `--tags`. `--skip-tags always` skips it, and also skips every role (they are all included under `always`; the tags above only act inside them).
32
+ `rig_mcp` has one group (`rig_mcp_servers`) because its steps share facts. `rig_home_ownership` is also tagged `always`, so it still runs when you use `--tags`. `--skip-tags always` skips it, and also skips every role (they are all included under `always`; the tags above only act inside them).
30
33
 
31
34
  List the exact tags with `grep -rn "tags:" src/cli/roles/<role>/` or in the installed package; a test keeps them consistent.
32
35
 
@@ -3937,6 +3937,10 @@ CONFIGURE_PLAYBOOK = """---
3937
3937
  # Secrets / auth material (.rig/authorize.yml). Always runs; never snapshotted.
3938
3938
  AUTHORIZE_PLAYBOOK = r"""---
3939
3939
  # Authorize playbook: inject credentials after provision/configure (not snapshotted).
3940
+ # The work is done by rig's bundled roles; skip any of it with --skip-tags
3941
+ # (role tags: rig_workspace_user, rig_code_server, rig_<agent>, rig_mcp, rig_live_agent, rig_git, ...).
3942
+ # Order matters: the Agent roles seed ~/.claude.json and settings.json before rig_mcp merges into
3943
+ # them and rig_live_agent adds its hooks; rig_home_ownership runs last.
3940
3944
  - name: Authorize remote access
3941
3945
  hosts: remote_vm
3942
3946
  become: true
@@ -3945,484 +3949,53 @@ AUTHORIZE_PLAYBOOK = r"""---
3945
3949
  coding_agent_type: "{{ coding_agent_type | default('opencode') }}"
3946
3950
  _rig_agent_types: "{{ coding_agent_types | default([coding_agent_type]) }}"
3947
3951
  code_server_port: "{{ code_server_port | default(8080) }}"
3952
+ _rig_agent_roles:
3953
+ opencode: rig_opencode
3954
+ claude: rig_claude_code
3955
+ cursor: rig_cursor_cli
3948
3956
  tasks:
3949
- # Ansible connects as root; the workspace user is who you SSH in as. Copy the
3950
- # key here (not in provision) because a snapshot carries the old VM's key.
3951
- - name: Let the workspace user log in with the same SSH key as root
3952
- shell: |
3953
- set -eu
3954
- install -d -m 0700 -o {{ rig_user }} -g {{ rig_user }} /home/{{ rig_user }}/.ssh
3955
- install -m 0600 -o {{ rig_user }} -g {{ rig_user }} /root/.ssh/authorized_keys /home/{{ rig_user }}/.ssh/authorized_keys
3956
- changed_when: false
3957
-
3958
- # Docker is installed in configure (editor.devcontainers); its group exists only then.
3959
- - name: Check for the docker group
3960
- command: getent group docker
3961
- register: _rig_docker_group
3962
- changed_when: false
3963
- failed_when: false
3964
-
3965
- - name: Add the workspace user to the docker group (Dev Containers)
3966
- user:
3967
- name: "{{ rig_user }}"
3968
- groups: docker
3969
- append: true
3970
- when: _rig_docker_group.rc == 0
3971
-
3972
- - name: Configure code-server with vaulted browser password
3973
- copy:
3974
- dest: "/home/{{ rig_user }}/.config/code-server/config.yaml"
3975
- owner: "{{ rig_user }}"
3976
- group: "{{ rig_user }}"
3977
- mode: "0600"
3978
- content: |
3979
- bind-addr: 0.0.0.0:{{ code_server_port }}
3980
- auth: password
3981
- password: "{{ vscode_browser_password }}"
3982
- cert: false
3983
- no_log: true
3984
- when: vscode_browser_password is defined and vscode_browser_password | length > 0
3985
-
3986
- - name: Enable and start code-server for user
3987
- systemd:
3988
- name: "code-server@{{ rig_user }}"
3989
- enabled: true
3990
- state: started
3991
- daemon_reload: true
3992
- when: vscode_browser_password is defined and vscode_browser_password | length > 0
3993
-
3994
- - name: Resolve per-agent API keys
3995
- set_fact:
3996
- rig_opencode_api_key: "{{ opencode_api_key | default('') }}"
3997
- rig_claude_api_key: "{{ claude_api_key | default('') }}"
3998
- rig_cursor_api_key: "{{ cursor_api_key | default('') }}"
3999
- no_log: true
4000
-
4001
- - name: Use legacy coding_agent_api_key for a single OpenCode install
4002
- set_fact:
4003
- rig_opencode_api_key: "{{ coding_agent_api_key }}"
4004
- no_log: true
4005
- when:
4006
- - _rig_agent_types | length == 1
4007
- - (_rig_agent_types[0] | string) == "opencode"
4008
- - rig_opencode_api_key | length == 0
4009
- - coding_agent_api_key is defined
4010
- - coding_agent_api_key | length > 0
4011
-
4012
- - name: Use legacy coding_agent_api_key for a single Claude Code install
4013
- set_fact:
4014
- rig_claude_api_key: "{{ coding_agent_api_key }}"
4015
- no_log: true
4016
- when:
4017
- - _rig_agent_types | length == 1
4018
- - (_rig_agent_types[0] | string) == "claude"
4019
- - rig_claude_api_key | length == 0
4020
- - coding_agent_api_key is defined
4021
- - coding_agent_api_key | length > 0
4022
-
4023
- - name: Use legacy coding_agent_api_key for a single Cursor CLI install
4024
- set_fact:
4025
- rig_cursor_api_key: "{{ coding_agent_api_key }}"
4026
- no_log: true
4027
- when:
4028
- - _rig_agent_types | length == 1
4029
- - (_rig_agent_types[0] | string) == "cursor"
4030
- - rig_cursor_api_key | length == 0
4031
- - coding_agent_api_key is defined
4032
- - coding_agent_api_key | length > 0
4033
-
4034
- - name: Write OpenCode credentials env file
4035
- copy:
4036
- dest: /home/{{ rig_user }}/.config/opencode/credentials.env
4037
- mode: "0600"
4038
- content: |
4039
- CODING_AGENT_API_KEY={{ rig_opencode_api_key }}
4040
- ANTHROPIC_API_KEY={{ rig_opencode_api_key }}
4041
- OPENCODE_API_KEY={{ rig_opencode_api_key }}
4042
- no_log: true
4043
- when:
4044
- - "'opencode' in _rig_agent_types"
4045
- - rig_opencode_api_key | length > 0
4046
-
4047
- # --- Skip first-run prompts (theme picker, login wizard, folder trust) ---
4048
- # Runs on every create (authorize is never snapshotted) and merges into any
4049
- # existing file: the installer can create ~/.claude.json before we get here.
4050
- # A file can be empty (a snapshot taken before its contents reached disk): read it as {}.
4051
- - name: Ensure Claude config directory exists for seeding
4052
- file:
4053
- path: /home/{{ rig_user }}/.claude
4054
- state: directory
4055
- mode: "0700"
4056
- when: "'claude' in _rig_agent_types"
4057
-
4058
- - name: Check for existing Claude state files
4059
- stat:
4060
- path: "{{ item }}"
4061
- loop:
4062
- - /home/{{ rig_user }}/.claude.json
4063
- - /home/{{ rig_user }}/.claude/settings.json
4064
- register: _claude_state_files
4065
- when: "'claude' in _rig_agent_types"
4066
-
4067
- - name: Read existing Claude state files
4068
- slurp:
4069
- src: "{{ item.item }}"
4070
- loop: "{{ _claude_state_files.results | default([]) | selectattr('stat.exists', 'defined') | selectattr('stat.exists') | list }}"
4071
- register: _claude_state_contents
4072
- when: "'claude' in _rig_agent_types"
4073
-
4074
- - name: Seed Claude Code onboarding, theme and workspace trust
4075
- vars:
4076
- _existing: >-
4077
- {{ dict(_claude_state_contents.results | default([])
4078
- | map(attribute='item.item') | zip(
4079
- _claude_state_contents.results | default([])
4080
- | map(attribute='content')
4081
- | map('b64decode') | map('trim') | map('default', '{}', true)
4082
- | map('from_json')) ) }}
4083
- _ws: "{{ workspace_root | default('/workspace') }}"
4084
- _state_seed:
4085
- hasCompletedOnboarding: true
4086
- shiftEnterKeyBindingInstalled: true
4087
- projects: "{{ {_ws: {'hasTrustDialogAccepted': true, 'hasCompletedProjectOnboarding': true}} }}"
4088
- _settings_seed:
4089
- theme: dark
4090
- # `rig exec` runs Claude in bypass mode; without this it stops at a first-use
4091
- # warning dialog (default answer: exit) that nobody is there to answer.
4092
- skipDangerousModePermissionPrompt: true
4093
- _merged: "{{ (_existing[item.path] | default({})) | combine(item.seed, recursive=True) }}"
4094
- # "Tool(*)" allow rules warn on current Claude Code; bare "Tool" is equivalent.
4095
- _final: >-
4096
- {{ _merged | combine({'permissions': {'allow':
4097
- _merged.permissions.allow | map('regex_replace', '[(][*][)]$', '') | unique | list}},
4098
- recursive=True)
4099
- if (_merged.permissions | default({})).allow is defined else _merged }}
4100
- copy:
4101
- dest: "{{ item.path }}"
4102
- mode: "0600"
4103
- content: "{{ _final | to_nice_json }}"
4104
- loop:
4105
- - path: /home/{{ rig_user }}/.claude.json
4106
- seed: "{{ _state_seed }}"
4107
- - path: /home/{{ rig_user }}/.claude/settings.json
4108
- seed: "{{ _settings_seed }}"
4109
- loop_control:
4110
- label: "{{ item.path }}"
4111
- when: "'claude' in _rig_agent_types"
4112
-
4113
- # Cursor keeps its trust marker at ~/.cursor/projects/<path slug>/.workspace-trusted.
4114
- - name: Create Cursor workspace trust directory
4115
- file:
4116
- path: "/home/{{ rig_user }}/.cursor/projects/{{ _cursor_slug }}"
4117
- state: directory
4118
- mode: "0700"
4119
- vars:
4120
- _cursor_slug: "{{ (workspace_root | default('/workspace')) | regex_replace('[^a-zA-Z0-9]', '-') | regex_replace('-+', '-') | regex_replace('^-|-$', '') }}"
4121
- when: "'cursor' in _rig_agent_types"
4122
-
4123
- - name: Trust the workspace for Cursor CLI
4124
- copy:
4125
- dest: "/home/{{ rig_user }}/.cursor/projects/{{ _cursor_slug }}/.workspace-trusted"
4126
- mode: "0600"
4127
- force: false
4128
- content: "{{ _cursor_trust | to_nice_json }}"
4129
- vars:
4130
- _cursor_slug: "{{ (workspace_root | default('/workspace')) | regex_replace('[^a-zA-Z0-9]', '-') | regex_replace('-+', '-') | regex_replace('^-|-$', '') }}"
4131
- _cursor_trust:
4132
- trustedAt: "{{ now(utc=True).strftime('%Y-%m-%dT%H:%M:%S.000Z') }}"
4133
- workspacePath: "{{ workspace_root | default('/workspace') }}"
4134
- trustMethod: rig
4135
- when: "'cursor' in _rig_agent_types"
4136
-
4137
- # --- MCP servers: render .rig/mcp.json into each enabled Agent's own config ---
4138
- # Runs here (not in provision) because it needs vaulted values and because
4139
- # mcp.json is not part of the snapshot hash. Same-name servers are replaced;
4140
- # servers added by hand on the Environment are kept.
4141
- - name: Render MCP servers for each Agent
4142
- set_fact:
4143
- _rig_mcp: "{{ lookup('ansible.builtin.file', playbook_dir ~ '/mcp.json', errors='ignore') | default('', true) | rig_mcp_render(_rig_agent_types, hostvars[inventory_hostname]) }}"
4144
- _rig_mcp_targets:
4145
- - {agent: claude, path: "/home/{{ rig_user }}/.claude.json", key: mcpServers, dir: "/home/{{ rig_user }}"}
4146
- - {agent: cursor, path: "/home/{{ rig_user }}/.cursor/mcp.json", key: mcpServers, dir: "/home/{{ rig_user }}/.cursor"}
4147
- - {agent: opencode, path: "/home/{{ rig_user }}/.config/opencode/opencode.json", key: mcp, dir: "/home/{{ rig_user }}/.config/opencode"}
4148
- no_log: true
4149
-
4150
- - name: Select Agents that have MCP servers to install
4151
- set_fact:
4152
- _rig_mcp_active: >-
4153
- {{ _rig_mcp_targets
4154
- | selectattr('agent', 'in', _rig_mcp | dict2items | selectattr('value') | map(attribute='key') | list)
4155
- | list }}
4156
- no_log: true
4157
-
4158
- - name: Ensure MCP config directories exist
4159
- file:
4160
- path: "{{ item.dir }}"
4161
- state: directory
4162
- mode: "0700"
4163
- loop: "{{ _rig_mcp_active }}"
4164
- loop_control:
4165
- label: "{{ item.agent }}"
4166
-
4167
- - name: Read existing Agent MCP configs
4168
- slurp:
4169
- src: "{{ item.path }}"
4170
- register: _rig_mcp_current
4171
- failed_when: false
4172
- no_log: true
4173
- loop: "{{ _rig_mcp_active }}"
4174
- loop_control:
4175
- label: "{{ item.agent }}"
4176
-
4177
- - name: Merge MCP servers into Agent configs
4178
- copy:
4179
- dest: "{{ item.path }}"
4180
- mode: "0600"
4181
- content: "{{ _existing | rig_mcp_merge(item.key, _rig_mcp[item.agent]) | to_nice_json }}\n"
4182
- vars:
4183
- _existing: "{{ (_rig_mcp_current.results[ansible_loop.index0].content | default('', true) | b64decode or '{}') | from_json }}"
4184
- no_log: true
4185
- loop: "{{ _rig_mcp_active }}"
4186
- loop_control:
4187
- label: "{{ item.agent }}"
4188
- extended: true
4189
-
4190
- # --- Live agents: tmux, its config, helper scripts and Claude's state hooks ---
4191
- # Agents run in a tmux session of their own (`tmux -L rig`) so they keep working
4192
- # when the terminal goes away. tmux is also in provision; this covers Environments
4193
- # created before that. Everything here is secret-free but lives in authorize so
4194
- # editing it never discards the cached image.
4195
- - name: Ensure tmux is installed
4196
- apt:
4197
- name: tmux
4198
- state: present
4199
- cache_valid_time: 3600
4200
-
4201
- - name: Create the live-agent directories
4202
- file:
4203
- path: "{{ item }}"
4204
- state: directory
4205
- mode: "0755"
4206
- loop:
4207
- - /etc/rig
4208
- - /run/rig/agents
4209
- - /var/log/rig
4210
-
4211
- # The agent runs as the workspace user: its hooks write state here and the
4212
- # attach script writes the log. /run is a tmpfs, so this runs on every authorize.
4213
- - name: Let the workspace user write live-agent state and logs
4214
- file:
4215
- path: "{{ item }}"
4216
- state: directory
4217
- owner: "{{ rig_user }}"
4218
- group: "{{ rig_user }}"
4219
- mode: "0755"
4220
- loop:
4221
- - /run/rig/agents
4222
- - /var/log/rig
4223
-
4224
- - name: Install the live-agent tmux configuration
4225
- copy:
4226
- src: "{{ rig_assets_dir }}/tmux.conf"
4227
- dest: /etc/rig/tmux.conf
4228
- mode: "0644"
4229
-
4230
- - name: Install the live-agent helper scripts
4231
- copy:
4232
- src: "{{ rig_assets_dir }}/{{ item }}"
4233
- dest: "/usr/local/bin/{{ item }}"
4234
- mode: "0755"
4235
- loop:
4236
- - rig-agent-state
4237
- - rig-agent-queue
4238
-
4239
- - name: Read Claude settings for the live-agent hooks
4240
- slurp:
4241
- src: /home/{{ rig_user }}/.claude/settings.json
4242
- register: _rig_claude_settings
4243
- failed_when: false
4244
- when: "'claude' in _rig_agent_types"
4245
-
4246
- - name: Record Claude's state for live agents (hooks)
4247
- copy:
4248
- dest: /home/{{ rig_user }}/.claude/settings.json
4249
- mode: "0600"
4250
- content: "{{ (_rig_claude_settings.content | default('', true) | b64decode or '{}') | from_json | rig_claude_hooks | to_nice_json }}\n"
4251
- when: "'claude' in _rig_agent_types"
4252
-
4253
- - name: Write Claude credentials env file
4254
- copy:
4255
- dest: /home/{{ rig_user }}/.claude/credentials.env
4256
- mode: "0600"
4257
- content: |
4258
- CODING_AGENT_API_KEY={{ rig_claude_api_key }}
4259
- {# Only one of the two may be set. An explicit claude_auth_type (asked at setup) wins; else the key prefix decides. #}
4260
- {% set _kind = claude_auth_type | default('') %}
4261
- {% if _kind == 'oauth' or (_kind != 'api_key' and rig_claude_api_key.startswith('sk-ant-oat')) %}
4262
- CLAUDE_CODE_OAUTH_TOKEN={{ rig_claude_api_key }}
4263
- {% else %}
4264
- ANTHROPIC_API_KEY={{ rig_claude_api_key }}
4265
- {% endif %}
4266
- no_log: true
4267
- when:
4268
- - "'claude' in _rig_agent_types"
4269
- - rig_claude_api_key | length > 0
4270
-
4271
- - name: Write Cursor credentials env file
4272
- copy:
4273
- dest: /home/{{ rig_user }}/.cursor/credentials.env
4274
- mode: "0600"
4275
- content: |
4276
- CODING_AGENT_API_KEY={{ rig_cursor_api_key }}
4277
- CURSOR_API_KEY={{ rig_cursor_api_key }}
4278
- no_log: true
4279
- when:
4280
- - "'cursor' in _rig_agent_types"
4281
- - rig_cursor_api_key | length > 0
4282
-
4283
- - name: Install coding-agent profile.d env exports
4284
- copy:
4285
- dest: /etc/profile.d/rig-coding-agent.sh
4286
- mode: "0644"
4287
- content: |
4288
- # Managed by rig authorize.yml — load the default agent's key only.
4289
- # `rig attach --agent` sources that agent's credentials.env itself so
4290
- # several installed agents do not overwrite one shared variable.
4291
- _rig_default="{{ coding_agent_type | default('opencode') }}"
4292
- if [ "$_rig_default" = "claude" ] && [ -f /home/{{ rig_user }}/.claude/credentials.env ]; then
4293
- set -a
4294
- # shellcheck disable=SC1091
4295
- . /home/{{ rig_user }}/.claude/credentials.env
4296
- set +a
4297
- elif [ "$_rig_default" = "cursor" ] && [ -f /home/{{ rig_user }}/.cursor/credentials.env ]; then
4298
- set -a
4299
- # shellcheck disable=SC1091
4300
- . /home/{{ rig_user }}/.cursor/credentials.env
4301
- set +a
4302
- elif [ -f /home/{{ rig_user }}/.config/opencode/credentials.env ]; then
4303
- set -a
4304
- # shellcheck disable=SC1091
4305
- . /home/{{ rig_user }}/.config/opencode/credentials.env
4306
- set +a
4307
- fi
4308
- when: >-
4309
- (rig_opencode_api_key | default('') | length > 0)
4310
- or (rig_claude_api_key | default('') | length > 0)
4311
- or (rig_cursor_api_key | default('') | length > 0)
4312
-
4313
- # Git author: a fresh VM has none, so the first commit fails with
4314
- # "Author identity unknown". Derived from the rig identity (see
4315
- # cli/git_author.py); override with git_author_name / git_author_email.
4316
- - name: Set the git author for commits made on the VM
4317
- command:
4318
- argv: ["git", "config", "--file", "/home/{{ rig_user }}/.gitconfig", "{{ item.key }}", "{{ item.value }}"]
4319
- loop:
4320
- - { key: user.name, value: "{{ rig_git_author_name | default('') }}" }
4321
- - { key: user.email, value: "{{ rig_git_author_email | default('') }}" }
4322
- loop_control:
4323
- label: "{{ item.key }}"
4324
- changed_when: false
4325
- when: item.value | length > 0
4326
-
4327
- # Provider tokens: kept in one owner-only file instead of being embedded in
4328
- # repo URLs (where they would sit in every clone's .git/config and show up
4329
- # in `git remote -v`). gh / glab read GH_TOKEN / GITLAB_TOKEN out of the box.
4330
- - name: Provider tokens for git, gh and glab
4331
- vars:
4332
- _rig_gh_token: "{{ github_pat | default('') }}"
4333
- _rig_gl_token: "{{ gitlab_pat | default('') }}"
4334
- when: (_rig_gh_token | length > 0) or (_rig_gl_token | length > 0) or (rig_git_repo_tokens | default([]) | length > 0)
4335
- block:
4336
- - name: Ensure the rig config directory exists
4337
- file:
4338
- path: /home/{{ rig_user }}/.config/rig
4339
- state: directory
4340
- mode: "0700"
4341
-
4342
- - name: Write the provider token file (workspace user only)
4343
- copy:
4344
- dest: /home/{{ rig_user }}/.config/rig/git-provider.env
4345
- mode: "0600"
4346
- content: |
4347
- {% if _rig_gh_token | length > 0 %}
4348
- GH_TOKEN={{ _rig_gh_token }}
4349
- {% endif %}
4350
- {% if _rig_gl_token | length > 0 %}
4351
- GITLAB_TOKEN={{ _rig_gl_token }}
4352
- {% endif %}
4353
- no_log: true
4354
-
4355
- # PATs stored per Repo (password_var, e.g. <project>_git_pat): one
4356
- # "host user token" line each, for the credential helper below.
4357
- - name: Write the per-repo token file (workspace user only)
4358
- copy:
4359
- dest: /home/{{ rig_user }}/.config/rig/git-hosts
4360
- mode: "0600"
4361
- content: |
4362
- {% for t in rig_git_repo_tokens | default([]) %}
4363
- {% set _tok = lookup('vars', t.var, default='') %}
4364
- {% if _tok | length > 0 %}
4365
- {{ t.host }} {{ t.user }} {{ _tok }}
4366
- {% endif %}
4367
- {% endfor %}
4368
- no_log: true
4369
-
4370
- - name: Export the tokens in login shells (gh and glab work out of the box)
4371
- copy:
4372
- dest: /etc/profile.d/rig-git-provider.sh
4373
- mode: "0644"
4374
- content: |
4375
- if [ -r /home/{{ rig_user }}/.config/rig/git-provider.env ]; then
4376
- set -a
4377
- . /home/{{ rig_user }}/.config/rig/git-provider.env
4378
- set +a
4379
- fi
4380
-
4381
- - name: Install the git credential helper (answers from the owner-only file)
4382
- copy:
4383
- dest: /usr/local/bin/rig-git-credential
4384
- mode: "0755"
4385
- content: |
4386
- #!/bin/sh
4387
- # git credential helper: serves GitHub/GitLab HTTPS credentials from
4388
- # /home/{{ rig_user }}/.config/rig/git-provider.env so repo URLs stay plain. Only
4389
- # the workspace user (and root) can read it; anyone else gets no answer.
4390
- [ "$1" = get ] || exit 0
4391
- host=""
4392
- while IFS='=' read -r key value; do
4393
- [ -z "$key" ] && break
4394
- [ "$key" = host ] && host="$value"
4395
- done
4396
- # A token stored for this exact host (per-Repo password_var) wins.
4397
- hosts=/home/{{ rig_user }}/.config/rig/git-hosts
4398
- if [ -r "$hosts" ]; then
4399
- while read -r h u p; do
4400
- if [ "$h" = "$host" ] && [ -n "$p" ]; then
4401
- printf 'username=%s\npassword=%s\n' "$u" "$p"
4402
- exit 0
4403
- fi
4404
- done < "$hosts"
4405
- fi
4406
- [ -r /home/{{ rig_user }}/.config/rig/git-provider.env ] || exit 0
4407
- . /home/{{ rig_user }}/.config/rig/git-provider.env
4408
- case "$host" in
4409
- github.com) user=x-access-token; pass="${GH_TOKEN:-}" ;;
4410
- gitlab.com|*gitlab*) user=oauth2; pass="${GITLAB_TOKEN:-}" ;;
4411
- *) exit 0 ;;
4412
- esac
4413
- [ -n "$pass" ] || exit 0
4414
- printf 'username=%s\npassword=%s\n' "$user" "$pass"
4415
-
4416
- - name: Use the helper for every git HTTPS operation
4417
- command:
4418
- argv: ["git", "config", "--system", "credential.helper", "/usr/local/bin/rig-git-credential"]
4419
- changed_when: false
4420
-
4421
- # Everything above runs as root, so hand what it wrote in the home directory
4422
- # (agent config, credentials, tokens) to the workspace user.
4423
- - name: Give the workspace user its home directory
4424
- command: "chown -R {{ rig_user }}:{{ rig_user }} /home/{{ rig_user }}"
4425
- changed_when: false
3957
+ - name: Workspace user access
3958
+ include_role:
3959
+ name: rig_workspace_user
3960
+ tasks_from: authorize
3961
+ tags: [always]
3962
+
3963
+ - name: code-server credentials
3964
+ include_role:
3965
+ name: rig_code_server
3966
+ tasks_from: authorize
3967
+ tags: [always]
3968
+
3969
+ - name: Coding agent credentials and first-run state
3970
+ include_role:
3971
+ name: "{{ _rig_agent_roles[item] }}"
3972
+ tasks_from: authorize
3973
+ loop: "{{ _rig_agent_types | select('in', _rig_agent_roles) | list }}"
3974
+ tags: [always]
3975
+
3976
+ - name: MCP servers
3977
+ include_role:
3978
+ name: rig_mcp
3979
+ tasks_from: authorize
3980
+ tags: [always]
3981
+
3982
+ - name: Live agent files and hooks
3983
+ include_role:
3984
+ name: rig_live_agent
3985
+ tasks_from: authorize
3986
+ tags: [always]
3987
+
3988
+ - name: Git author and provider tokens
3989
+ include_role:
3990
+ name: rig_git
3991
+ tasks_from: authorize
3992
+ tags: [always]
3993
+
3994
+ - name: Home directory ownership
3995
+ include_role:
3996
+ name: rig_home_ownership
3997
+ tasks_from: authorize
3998
+ tags: [always]
4426
3999
  """
4427
4000
 
4428
4001
  # Materialize playbook (.rig/materialize.yml). Project content after authorize.