mystack-rig 1.9.1__tar.gz → 1.10.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.9.1 → mystack_rig-1.10.0}/GLOSSARY.md +1 -1
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/PKG-INFO +12 -2
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/README.md +11 -1
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/roles.md +29 -13
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/main.py +41 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/remote_dev.py +12 -59
- mystack_rig-1.10.0/src/cli/repos.py +152 -0
- mystack_rig-1.10.0/src/cli/roles/rig_destroy/defaults/main.yml +2 -0
- mystack_rig-1.10.0/src/cli/roles/rig_destroy/tasks/destroy.yml +10 -0
- mystack_rig-1.10.0/src/cli/roles/rig_workspace_repos/defaults/main.yml +3 -0
- mystack_rig-1.10.0/src/cli/roles/rig_workspace_repos/tasks/materialize.yml +64 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/PKG-INFO +12 -2
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/SOURCES.txt +6 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/scm_file_list.json +6 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/scm_version.json +2 -2
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_bundled_roles.py +36 -1
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_git_credentials_and_author.py +5 -4
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_init_command.py +1 -1
- mystack_rig-1.10.0/tests/test_repo_command.py +197 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_setup_provision.py +2 -3
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.coveragerc +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.git-blame-ignore-revs +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.github/workflows/release.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.github/workflows/tests.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.gitignore +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.rig/playbooks/README.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/.rig/playbooks/vpn-gateway.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/CLAUDE.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/CLI_STORAGE_SUMMARY.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/Dockerfile +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/GIT_CLONE_FEATURE.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/HETZNER_STORAGE_GUIDE.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/LICENSE +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/Makefile +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/README_REAL_E2E.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/STORAGE_CLI_GUIDE.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0005-docker-in-configure-for-devcontainers.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0006-workspace-user-instead-of-root.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/architecture.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/architecture.png +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/docs/architecture.svg +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/forged-idea.md +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/pyproject.toml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/pytest.ini +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/requirements.txt +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/sample.env +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/scripts/coverage_badge.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/scripts/pypi_version.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/setup.cfg +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/__init__.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/__init__.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/__main__.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/agents.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/ansible_filters/__init__.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/ansible_filters/rig_live.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/ansible_filters/rig_mcp.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/assets/rig-agent-queue +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/assets/rig-agent-state +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/assets/tmux.conf +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/config.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/devcontainers.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/encrypt.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/git.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/git_author.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/last_env.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/last_session.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/last_target.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/live_agent.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/log.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/mcp.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/outputs.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/requirements.txt +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_base/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_base/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_claude_code/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_claude_code/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_claude_code/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_code_server/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_code_server/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_code_server/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_cursor_cli/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_cursor_cli/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_cursor_cli/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_git/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_git/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_git/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_home_ownership/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_home_ownership/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_home_ownership/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_live_agent/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_live_agent/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_live_agent/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_mcp/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_mcp/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_opencode/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_opencode/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_opencode/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_workspace_user/defaults/main.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_workspace_user/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/roles/rig_workspace_user/tasks/install.yml +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/snapshots.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/state_bucket.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/storage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/vault_keys.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/vpn.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/cli/workspace_user.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/entry_points.txt +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/requires.txt +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/src/mystack_rig.egg-info/top_level.txt +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/test_hetzner_integration.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/_roles.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/conftest.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_agents.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_ansible_galaxy.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_attach_command.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_credential_security.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_destroy_command.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_dev_command.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_devcontainers.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_encrypt_command.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_encrypt_coverage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_firewall_client_ip.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_git_clone_unit.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_git_manager.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_gitignore_init.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_hetzner_storage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_inspect_describe.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_last_env.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_last_session.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_last_target.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_live_agent.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_live_agent_cli.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_log.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_main_coverage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_mcp_command.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_mcp_render.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_outputs.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_outputs_storage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_pypi_version.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_python_floor.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_r2_storage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_real_e2e_integration.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_real_e2e_storage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_real_e2e_vpn.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_real_e2e_vpn_tunnel.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_remote_dev.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_remote_dev_coverage_extensions.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_rig_ansible_vars.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_rig_config.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_secret_prompt_hidden.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_simulation_storage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_small_module_coverage.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_snapshots.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_state_bucket.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_storage_basic.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_vault_keys.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_vpn_optional.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_vpn_unit.py +0 -0
- {mystack_rig-1.9.1 → mystack_rig-1.10.0}/tests/test_workspace_git_clone.py +0 -0
|
@@ -17,7 +17,7 @@ A folder containing `rig.yml` and a `.rig/` directory, which groups zero or more
|
|
|
17
17
|
_Avoid_: Project (ambiguous with a Hetzner Cloud project)
|
|
18
18
|
|
|
19
19
|
**Repo**:
|
|
20
|
-
A git repository included in a Workspace and cloned onto its Environments.
|
|
20
|
+
A git repository included in a Workspace and cloned onto its Environments. `rig repo` adds and removes them.
|
|
21
21
|
_Avoid_: Project
|
|
22
22
|
|
|
23
23
|
**Environment**:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.0
|
|
4
4
|
Summary: Ephemeral remotes with full local parity for coding agents
|
|
5
5
|
Author: mystack-cloud
|
|
6
6
|
License-Expression: MIT
|
|
@@ -301,6 +301,7 @@ destroy playbooks:
|
|
|
301
301
|
| Command | What happens |
|
|
302
302
|
| --- | --- |
|
|
303
303
|
| **init** | Scaffold `rig.yml` + `.rig/`. Collect Hetzner creds, repo PATs, agent choices and a key per agent. |
|
|
304
|
+
| **repo** | `rig repo add <url> [--name] [--dest] [--no-pat] [--apply [NAME]]`, `rig repo remove <name> [--apply [NAME]]`, `rig repo list`. Edit the Workspace's Repos without `rig init`. See [Managing Repos](#managing-repos). |
|
|
304
305
|
| **create** | Boot VM (base/system snapshot). Run provision → configure → authorize → materialize. Snapshot after **configure** only. |
|
|
305
306
|
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize` / `--finalize` / `--destroy` (playbooks only; the VM stays). `--tags` and `--skip-tags` are passed to every playbook in the run. |
|
|
306
307
|
| **attach** | SSH TTY into the agent's [live agent](#live-agents) on `/workspace` (started if needed, joined if running). `--agent` picks among installed agents. |
|
|
@@ -308,7 +309,16 @@ destroy playbooks:
|
|
|
308
309
|
| **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
|
|
309
310
|
| **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` and `--skip-tags` are passed to both playbooks. |
|
|
310
311
|
|
|
311
|
-
|
|
312
|
+
### Managing Repos
|
|
313
|
+
|
|
314
|
+
`rig repo` edits the `repos:` list in `rig.yml` (the only thing it writes; the clone lists the playbooks read are derived from it on every run, so existing Workspaces and their `materialize.yml` need no change).
|
|
315
|
+
|
|
316
|
+
- `add <url>`: SSH URLs become HTTPS; the name defaults to the last URL segment; a duplicate name or URL is refused. For a GitHub or GitLab URL with no provider PAT yet it prompts for one (non-interactive: `RIG_GITHUB_PAT` / `RIG_GITLAB_PAT`; `--no-pat` skips). Without `--no-pat` a repo-specific PAT is stored as `<name>_git_pat` and referenced by `password_var`.
|
|
317
|
+
- `remove <name>`: removes the entry only. The clone on the Environment and any PAT variable stay; delete the clone on the VM yourself if unwanted.
|
|
318
|
+
- `list`: name, URL, dest and PAT variable, from config only.
|
|
319
|
+
- Neither `add` nor `remove` touches the VM. Run `rig apply` to clone (or pass `--apply [NAME]`, which runs the default apply on that Environment, or the last one). A changed `repos:` list means one snapshot cache miss. Saving rewrites `rig.yml`, so comments in it are lost (as with `rig init`).
|
|
320
|
+
|
|
321
|
+
`provision.yml`, `authorize.yml` and `destroy.yml` (and a new Workspace's `materialize.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. **Existing Workspaces** keep their long `materialize.yml` (it is yours and never overwritten); to adopt the clone role see [docs/roles.md](docs/roles.md#materialize-is-yours).
|
|
312
322
|
|
|
313
323
|
Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
|
|
314
324
|
|
|
@@ -279,6 +279,7 @@ destroy playbooks:
|
|
|
279
279
|
| Command | What happens |
|
|
280
280
|
| --- | --- |
|
|
281
281
|
| **init** | Scaffold `rig.yml` + `.rig/`. Collect Hetzner creds, repo PATs, agent choices and a key per agent. |
|
|
282
|
+
| **repo** | `rig repo add <url> [--name] [--dest] [--no-pat] [--apply [NAME]]`, `rig repo remove <name> [--apply [NAME]]`, `rig repo list`. Edit the Workspace's Repos without `rig init`. See [Managing Repos](#managing-repos). |
|
|
282
283
|
| **create** | Boot VM (base/system snapshot). Run provision → configure → authorize → materialize. Snapshot after **configure** only. |
|
|
283
284
|
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize` / `--finalize` / `--destroy` (playbooks only; the VM stays). `--tags` and `--skip-tags` are passed to every playbook in the run. |
|
|
284
285
|
| **attach** | SSH TTY into the agent's [live agent](#live-agents) on `/workspace` (started if needed, joined if running). `--agent` picks among installed agents. |
|
|
@@ -286,7 +287,16 @@ destroy playbooks:
|
|
|
286
287
|
| **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
|
|
287
288
|
| **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` and `--skip-tags` are passed to both playbooks. |
|
|
288
289
|
|
|
289
|
-
|
|
290
|
+
### Managing Repos
|
|
291
|
+
|
|
292
|
+
`rig repo` edits the `repos:` list in `rig.yml` (the only thing it writes; the clone lists the playbooks read are derived from it on every run, so existing Workspaces and their `materialize.yml` need no change).
|
|
293
|
+
|
|
294
|
+
- `add <url>`: SSH URLs become HTTPS; the name defaults to the last URL segment; a duplicate name or URL is refused. For a GitHub or GitLab URL with no provider PAT yet it prompts for one (non-interactive: `RIG_GITHUB_PAT` / `RIG_GITLAB_PAT`; `--no-pat` skips). Without `--no-pat` a repo-specific PAT is stored as `<name>_git_pat` and referenced by `password_var`.
|
|
295
|
+
- `remove <name>`: removes the entry only. The clone on the Environment and any PAT variable stay; delete the clone on the VM yourself if unwanted.
|
|
296
|
+
- `list`: name, URL, dest and PAT variable, from config only.
|
|
297
|
+
- Neither `add` nor `remove` touches the VM. Run `rig apply` to clone (or pass `--apply [NAME]`, which runs the default apply on that Environment, or the last one). A changed `repos:` list means one snapshot cache miss. Saving rewrites `rig.yml`, so comments in it are lost (as with `rig init`).
|
|
298
|
+
|
|
299
|
+
`provision.yml`, `authorize.yml` and `destroy.yml` (and a new Workspace's `materialize.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. **Existing Workspaces** keep their long `materialize.yml` (it is yours and never overwritten); to adopt the clone role see [docs/roles.md](docs/roles.md#materialize-is-yours).
|
|
290
300
|
|
|
291
301
|
Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
|
|
292
302
|
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
# Bundled roles
|
|
2
2
|
|
|
3
|
-
The playbooks rig generates (`provision.yml` and `
|
|
3
|
+
The playbooks rig generates (`provision.yml`, `authorize.yml`, `destroy.yml`, and the starting `materialize.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** (cached in a snapshot)
|
|
10
|
-
|
|
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
|
-
| `
|
|
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) `tasks/authorize.yml` runs in **authorize** (every create and apply, never cached), `tasks/materialize.yml` in **materialize** and `tasks/destroy.yml` in **destroy**.
|
|
10
|
+
|
|
11
|
+
| Role | Provision (`install`) | Authorize | Other Stage |
|
|
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_workspace_repos` | | | clone the Workspace's Repos (`git.clone_repos`) into `/workspace` (the **materialize** Stage) |
|
|
21
|
+
| `rig_destroy` | | | nothing yet: managed teardown goes here (the **destroy** Stage) |
|
|
22
|
+
| `rig_home_ownership` | hands `/home/<user>` to the Workspace user; always runs, last | same, after everything that wrote into it | |
|
|
21
23
|
|
|
22
24
|
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.
|
|
23
25
|
|
|
@@ -56,6 +58,20 @@ ansible:
|
|
|
56
58
|
- A run limited on the command line (`--skip-tags`, or `apply --tags`) is partial by definition: `rig create --skip-tags` boots from the base image, and no run limited that way saves a snapshot.
|
|
57
59
|
- Skipping a role whose output later Stages need (for example `rig_workspace_user`) breaks those Stages. Skip with care.
|
|
58
60
|
|
|
61
|
+
## Materialize is yours
|
|
62
|
+
|
|
63
|
+
`materialize.yml` and `configure.yml` are user-owned: rig writes them once and never overwrites them. New Workspaces get a `materialize.yml` that calls `rig_workspace_repos`; add your own tasks after it. **Existing Workspaces** keep the long form they were generated with, which works as before. To adopt the role, replace its two tasks (`Ensure project workspace directory exists` and `Clone configured git repositories`) with:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
- name: Workspace repos
|
|
67
|
+
include_role:
|
|
68
|
+
name: rig_workspace_repos
|
|
69
|
+
tasks_from: materialize
|
|
70
|
+
tags: [always]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`destroy.yml` is rig-owned and regenerated, like `provision.yml` and `authorize.yml`.
|
|
74
|
+
|
|
59
75
|
## Overriding a role
|
|
60
76
|
|
|
61
77
|
Bundled roles are searched last on the role path, after `.rig/local_roles` and `.rig/roles`. A role of the same name in `.rig/local_roles` replaces the bundled one. This is an escape hatch, not a stable interface: the role's variables and task layout may change between releases. A shadowing role in `local_roles` is part of the snapshot hash.
|
|
@@ -1163,6 +1163,25 @@ def _cmd_mcp(args: argparse.Namespace) -> int:
|
|
|
1163
1163
|
return 2
|
|
1164
1164
|
|
|
1165
1165
|
|
|
1166
|
+
def _cmd_repo(args: argparse.Namespace) -> int:
|
|
1167
|
+
from cli import repos as repo_cmd
|
|
1168
|
+
|
|
1169
|
+
action = args.repo_command
|
|
1170
|
+
if action == "add":
|
|
1171
|
+
code = repo_cmd.cmd_add(args.url, name=args.name, dest=args.dest, no_pat=args.no_pat)
|
|
1172
|
+
elif action == "remove":
|
|
1173
|
+
code = repo_cmd.cmd_remove(args.name)
|
|
1174
|
+
elif action == "list":
|
|
1175
|
+
return repo_cmd.cmd_list()
|
|
1176
|
+
else:
|
|
1177
|
+
return 2
|
|
1178
|
+
apply_target = getattr(args, "apply", None)
|
|
1179
|
+
if code == 0 and apply_target is not None:
|
|
1180
|
+
name = None if apply_target is True else apply_target
|
|
1181
|
+
return _cmd_apply(argparse.Namespace(name=name, name_flag=None))
|
|
1182
|
+
return code
|
|
1183
|
+
|
|
1184
|
+
|
|
1166
1185
|
def _cmd_vars_export_shared_key(args: argparse.Namespace) -> int:
|
|
1167
1186
|
from cli.encrypt import export_shared_data_key
|
|
1168
1187
|
|
|
@@ -1689,6 +1708,23 @@ def main(argv=None):
|
|
|
1689
1708
|
mcp_subparsers.add_parser("list", help="List MCP servers and whether their variables resolve")
|
|
1690
1709
|
mcp_subparsers.add_parser("check", help="Validate .rig/mcp.json; exit 1 on problems")
|
|
1691
1710
|
|
|
1711
|
+
repo_parser = subparsers.add_parser(
|
|
1712
|
+
"repo",
|
|
1713
|
+
help="Add, remove or list the Workspace's Repos in rig.yml (no full rig init)",
|
|
1714
|
+
)
|
|
1715
|
+
repo_subparsers = repo_parser.add_subparsers(dest="repo_command", help="Repo actions")
|
|
1716
|
+
apply_help = "Then run `rig apply` on NAME (default: the last Environment)"
|
|
1717
|
+
repo_add = repo_subparsers.add_parser("add", help="Add a Repo by git URL")
|
|
1718
|
+
repo_add.add_argument("url", help="Git URL (SSH URLs are converted to HTTPS)")
|
|
1719
|
+
repo_add.add_argument("--name", help="Repo name (default: last URL segment)")
|
|
1720
|
+
repo_add.add_argument("--dest", help="Clone path on the Environment (default: /workspace/<name>)")
|
|
1721
|
+
repo_add.add_argument("--no-pat", action="store_true", help="Don't prompt for or store a git PAT")
|
|
1722
|
+
repo_add.add_argument("--apply", nargs="?", const=True, default=None, metavar="NAME", help=apply_help)
|
|
1723
|
+
repo_remove = repo_subparsers.add_parser("remove", help="Remove a Repo from rig.yml (the VM clone stays)")
|
|
1724
|
+
repo_remove.add_argument("name", help="Repo name")
|
|
1725
|
+
repo_remove.add_argument("--apply", nargs="?", const=True, default=None, metavar="NAME", help=apply_help)
|
|
1726
|
+
repo_subparsers.add_parser("list", help="List Repos and their PAT variables")
|
|
1727
|
+
|
|
1692
1728
|
raw_argv = list(sys.argv[1:] if argv is None else argv)
|
|
1693
1729
|
server_command: list[str] = []
|
|
1694
1730
|
# `rig mcp add NAME [options] -- COMMAND ARGS...`: argparse would let a
|
|
@@ -1729,6 +1765,11 @@ def main(argv=None):
|
|
|
1729
1765
|
return _cmd_cache(args)
|
|
1730
1766
|
if args.command == "delete":
|
|
1731
1767
|
return _cmd_delete(args)
|
|
1768
|
+
if args.command == "repo":
|
|
1769
|
+
if not args.repo_command:
|
|
1770
|
+
repo_parser.print_help()
|
|
1771
|
+
return 1
|
|
1772
|
+
return _cmd_repo(args)
|
|
1732
1773
|
if args.command == "mcp":
|
|
1733
1774
|
if not args.mcp_command:
|
|
1734
1775
|
mcp_parser.print_help()
|
|
@@ -4002,6 +4002,8 @@ AUTHORIZE_PLAYBOOK = r"""---
|
|
|
4002
4002
|
MATERIALIZE_PLAYBOOK = """---
|
|
4003
4003
|
# Materialize playbook: clone configured repos and populate /workspace.
|
|
4004
4004
|
# Rig injects runtime vars prefixed with rig_ (e.g. rig_env_name, rig_vm_ip).
|
|
4005
|
+
# This file is yours: add tasks after the role call. The clone logic lives in rig's bundled
|
|
4006
|
+
# role rig_workspace_repos (docs/roles.md); skip it with --skip-tags rig_workspace_repos.
|
|
4005
4007
|
- name: Materialize workspace
|
|
4006
4008
|
hosts: remote_vm
|
|
4007
4009
|
become: true
|
|
@@ -4009,62 +4011,11 @@ MATERIALIZE_PLAYBOOK = """---
|
|
|
4009
4011
|
vars:
|
|
4010
4012
|
workspace_root: "{{ workspace_root | default('/workspace') }}"
|
|
4011
4013
|
tasks:
|
|
4012
|
-
- name:
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
group: "{{ rig_user }}"
|
|
4018
|
-
mode: "0755"
|
|
4019
|
-
|
|
4020
|
-
# Plain repo URLs: the token reaches git through an inline credential
|
|
4021
|
-
# helper fed from this task's environment, so it is never embedded in the
|
|
4022
|
-
# URL (where it would end up in every clone's .git/config and in
|
|
4023
|
-
# `git remote -v`) and never written to disk. Honours a per-repo
|
|
4024
|
-
# password_var, else github_pat / gitlab_pat. authorize.yml additionally
|
|
4025
|
-
# installs a system-wide helper so later `git pull/push` work too.
|
|
4026
|
-
- name: Clone configured git repositories
|
|
4027
|
-
vars:
|
|
4028
|
-
_pat_var: "{{ item.password_var | default('') }}"
|
|
4029
|
-
# Fall back to provider default vault vars when password_var was skipped at init.
|
|
4030
|
-
_provider_pat: >-
|
|
4031
|
-
{{ (gitlab_pat | default(''))
|
|
4032
|
-
if ((item.repo | default('')) is match('^(https?://)?([^/@]+@)?[^/]*gitlab'))
|
|
4033
|
-
else (github_pat | default('')) }}
|
|
4034
|
-
_pat: >-
|
|
4035
|
-
{{ (lookup('vars', _pat_var, default='') if _pat_var else '')
|
|
4036
|
-
or _provider_pat }}
|
|
4037
|
-
# GitHub expects x-access-token; GitLab expects oauth2.
|
|
4038
|
-
_auth_user: "{{ 'oauth2' if (item.repo is match('^(https?://)?([^/@]+@)?[^/]*gitlab')) else 'x-access-token' }}"
|
|
4039
|
-
environment:
|
|
4040
|
-
# Never hang on an interactive username/password prompt (missing PAT).
|
|
4041
|
-
GIT_TERMINAL_PROMPT: "0"
|
|
4042
|
-
RIG_GIT_USERNAME: "{{ _auth_user }}"
|
|
4043
|
-
RIG_GIT_PASSWORD: "{{ _pat }}"
|
|
4044
|
-
# Empty helper first: reset anything inherited, then answer from env.
|
|
4045
|
-
GIT_CONFIG_COUNT: "{{ 2 if (_pat | length > 0) else 0 }}"
|
|
4046
|
-
GIT_CONFIG_KEY_0: credential.helper
|
|
4047
|
-
GIT_CONFIG_VALUE_0: ""
|
|
4048
|
-
GIT_CONFIG_KEY_1: credential.helper
|
|
4049
|
-
GIT_CONFIG_VALUE_1: '!f() { test "$1" = get && { echo "username=$RIG_GIT_USERNAME"; echo "password=$RIG_GIT_PASSWORD"; }; }; f'
|
|
4050
|
-
become_user: "{{ rig_user }}"
|
|
4051
|
-
git:
|
|
4052
|
-
repo: "{{ item.repo }}"
|
|
4053
|
-
dest: "{{ item.dest }}"
|
|
4054
|
-
version: "{{ item.version | default(omit) }}"
|
|
4055
|
-
accept_hostkey: "{{ item.accept_hostkey | default(true) }}"
|
|
4056
|
-
force: "{{ item.force | default(false) }}"
|
|
4057
|
-
register: _git_clone
|
|
4058
|
-
# A fresh VM can hit transient network resets reaching the git host.
|
|
4059
|
-
# Retry those only; auth failures (bad PAT) still fail immediately.
|
|
4060
|
-
retries: 5
|
|
4061
|
-
delay: 5
|
|
4062
|
-
until: >-
|
|
4063
|
-
_git_clone is succeeded
|
|
4064
|
-
or not ((_git_clone.msg | default('')) is search(
|
|
4065
|
-
'Connection reset|Connection timed out|Could not resolve|Recv failure|early EOF|RPC failed|SSL_connect|GnuTLS|Failed to connect'))
|
|
4066
|
-
loop: "{{ git.clone_repos | default([]) }}"
|
|
4067
|
-
when: git is defined and git.clone_repos is defined
|
|
4014
|
+
- name: Workspace repos
|
|
4015
|
+
include_role:
|
|
4016
|
+
name: rig_workspace_repos
|
|
4017
|
+
tasks_from: materialize
|
|
4018
|
+
tags: [always]
|
|
4068
4019
|
"""
|
|
4069
4020
|
|
|
4070
4021
|
FINALIZE_PLAYBOOK = """---
|
|
@@ -4089,9 +4040,11 @@ DESTROY_PLAYBOOK = """---
|
|
|
4089
4040
|
become: true
|
|
4090
4041
|
gather_facts: false
|
|
4091
4042
|
tasks:
|
|
4092
|
-
- name: Managed destroy
|
|
4093
|
-
|
|
4094
|
-
|
|
4043
|
+
- name: Managed destroy
|
|
4044
|
+
include_role:
|
|
4045
|
+
name: rig_destroy
|
|
4046
|
+
tasks_from: destroy
|
|
4047
|
+
tags: [always]
|
|
4095
4048
|
"""
|
|
4096
4049
|
|
|
4097
4050
|
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"""``rig repo``: add, remove and list the Workspace's Repos in ``rig.yml``.
|
|
2
|
+
|
|
3
|
+
``rig.yml`` ``repos:`` is the source of truth. The clone lists the playbooks
|
|
4
|
+
read (``git.clone_repos``) and ``git_providers`` are derived from it on every
|
|
5
|
+
run, so this module writes nothing else, apart from an optional PAT var.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import sys
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from cli.encrypt import (
|
|
15
|
+
PROVIDER_ENV_VARS,
|
|
16
|
+
collect_repo_pats,
|
|
17
|
+
detect_git_provider,
|
|
18
|
+
list_all_vault_vars,
|
|
19
|
+
provider_pat_var_name,
|
|
20
|
+
resolve_project_dir,
|
|
21
|
+
resolve_repo_pat_var_names,
|
|
22
|
+
store_repo_pats,
|
|
23
|
+
to_https_git_url,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def repo_name_from_url(url: str) -> str:
|
|
28
|
+
"""Last path segment of *url*, without a ``.git`` suffix."""
|
|
29
|
+
tail = url.strip().rstrip("/").replace(":", "/").split("/")[-1]
|
|
30
|
+
return tail[:-4] if tail.endswith(".git") else tail
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _load(project_dir: str | None):
|
|
34
|
+
from cli.remote_dev import ProjectConfig
|
|
35
|
+
|
|
36
|
+
project = ProjectConfig(resolve_project_dir(project_dir))
|
|
37
|
+
project.load()
|
|
38
|
+
return project
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _repos(project) -> list[dict[str, Any]]:
|
|
42
|
+
return [r for r in (project.config.get("repos") or []) if isinstance(r, dict) and r.get("name")]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _vault_names(project_dir: str | None) -> set[str]:
|
|
46
|
+
try:
|
|
47
|
+
return {name for name, _scope in list_all_vault_vars(project_dir)}
|
|
48
|
+
except Exception: # no vars files yet
|
|
49
|
+
return set()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _store_pat(name: str, url: str, project_dir: str | None) -> str | None:
|
|
53
|
+
"""Make a PAT available for *url*; return a repo-specific ``password_var`` if one was needed."""
|
|
54
|
+
provider = detect_git_provider(url)
|
|
55
|
+
if not provider:
|
|
56
|
+
print(f"No PAT stored for '{name}' (unsupported git host; GitHub/GitLab only)")
|
|
57
|
+
return None
|
|
58
|
+
if provider_pat_var_name(provider) in _vault_names(project_dir):
|
|
59
|
+
return None # the provider default PAT already covers it
|
|
60
|
+
repo = {"name": name, "url": url}
|
|
61
|
+
try:
|
|
62
|
+
if sys.stdin.isatty():
|
|
63
|
+
assignments, defaults = collect_repo_pats([repo])
|
|
64
|
+
else:
|
|
65
|
+
value = os.getenv(PROVIDER_ENV_VARS[provider], "").strip()
|
|
66
|
+
assignments, defaults = ({name: value}, {provider: value}) if value else ({}, {})
|
|
67
|
+
if not assignments:
|
|
68
|
+
print(f"No PAT stored for '{name}'; private clones need one (rig vars encrypt)")
|
|
69
|
+
return None
|
|
70
|
+
password_vars, to_store = resolve_repo_pat_var_names(assignments, [repo], default_pats=defaults)
|
|
71
|
+
if not store_repo_pats(to_store, project_dir=project_dir):
|
|
72
|
+
return None
|
|
73
|
+
except (ValueError, RuntimeError) as exc:
|
|
74
|
+
print(f"Warning: PAT not stored: {exc}", file=sys.stderr)
|
|
75
|
+
return None
|
|
76
|
+
var = password_vars.get(name)
|
|
77
|
+
return None if var == provider_pat_var_name(provider) else var
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def cmd_add(
|
|
81
|
+
url: str,
|
|
82
|
+
*,
|
|
83
|
+
name: str | None = None,
|
|
84
|
+
dest: str | None = None,
|
|
85
|
+
no_pat: bool = False,
|
|
86
|
+
project_dir: str | None = None,
|
|
87
|
+
) -> int:
|
|
88
|
+
from cli.remote_dev import _valid_component_name
|
|
89
|
+
|
|
90
|
+
https_url = to_https_git_url(url.strip())
|
|
91
|
+
if https_url != url.strip():
|
|
92
|
+
print(f"Converted remote to HTTPS: {https_url}")
|
|
93
|
+
name = name or repo_name_from_url(https_url)
|
|
94
|
+
if not _valid_component_name(name):
|
|
95
|
+
print(f"Error: invalid repo name '{name}' (use --name)", file=sys.stderr)
|
|
96
|
+
return 1
|
|
97
|
+
project = _load(project_dir)
|
|
98
|
+
for repo in _repos(project):
|
|
99
|
+
if repo["name"] == name or repo.get("url") == https_url:
|
|
100
|
+
print(f"Error: Repo '{repo['name']}' ({repo.get('url')}) is already in rig.yml", file=sys.stderr)
|
|
101
|
+
return 1
|
|
102
|
+
entry: dict[str, Any] = {"name": name, "url": https_url}
|
|
103
|
+
if dest:
|
|
104
|
+
entry["dest"] = dest
|
|
105
|
+
if not no_pat:
|
|
106
|
+
password_var = _store_pat(name, https_url, project_dir)
|
|
107
|
+
if password_var:
|
|
108
|
+
entry["password_var"] = password_var
|
|
109
|
+
project.config["repos"] = [*(project.config.get("repos") or []), entry]
|
|
110
|
+
if not project.save(write_vars=False):
|
|
111
|
+
print("Error: could not write rig.yml", file=sys.stderr)
|
|
112
|
+
return 1
|
|
113
|
+
print(f"Added Repo '{name}' to rig.yml. Run `rig apply` to clone it (or pass --apply).")
|
|
114
|
+
return 0
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def cmd_remove(name: str, *, project_dir: str | None = None) -> int:
|
|
118
|
+
project = _load(project_dir)
|
|
119
|
+
known = [r["name"] for r in _repos(project)]
|
|
120
|
+
if name not in known:
|
|
121
|
+
print(f"Error: no Repo named '{name}' (known: {', '.join(known) or 'none'})", file=sys.stderr)
|
|
122
|
+
return 1
|
|
123
|
+
project.config["repos"] = [
|
|
124
|
+
r for r in (project.config.get("repos") or []) if not (isinstance(r, dict) and r.get("name") == name)
|
|
125
|
+
]
|
|
126
|
+
if not project.save(write_vars=False):
|
|
127
|
+
print("Error: could not write rig.yml", file=sys.stderr)
|
|
128
|
+
return 1
|
|
129
|
+
print(f"Removed Repo '{name}' from rig.yml.")
|
|
130
|
+
print("Running Environments keep their clone and any PAT var; delete the clone on the VM yourself if unwanted.")
|
|
131
|
+
return 0
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def cmd_list(*, project_dir: str | None = None) -> int:
|
|
135
|
+
project = _load(project_dir)
|
|
136
|
+
repos = _repos(project)
|
|
137
|
+
if not repos:
|
|
138
|
+
print("No Repos in rig.yml")
|
|
139
|
+
return 0
|
|
140
|
+
vault = _vault_names(project_dir)
|
|
141
|
+
for repo in repos:
|
|
142
|
+
url = str(repo.get("url") or "")
|
|
143
|
+
provider = detect_git_provider(url)
|
|
144
|
+
default_var = provider_pat_var_name(provider) if provider else None
|
|
145
|
+
if repo.get("password_var"):
|
|
146
|
+
pat = str(repo["password_var"])
|
|
147
|
+
elif default_var and default_var in vault:
|
|
148
|
+
pat = default_var
|
|
149
|
+
else:
|
|
150
|
+
pat = "-"
|
|
151
|
+
print(f"{repo['name']}\t{url}\t{repo.get('dest') or '-'}\t{pat}")
|
|
152
|
+
return 0
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Destroy: managed teardown before the VM is deleted. Nothing to tear down yet; a role so that
|
|
3
|
+
# future managed teardown has a place (and tags) to live. Project hooks belong in finalize.yml.
|
|
4
|
+
- name: Managed destroy
|
|
5
|
+
tags: [rig_destroy]
|
|
6
|
+
block:
|
|
7
|
+
- name: Managed destroy placeholder
|
|
8
|
+
debug:
|
|
9
|
+
msg: "No managed destroy tasks for {{ rig_env_name | default('env') }}"
|
|
10
|
+
tags: [rig_destroy_placeholder]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Materialize: clone the Workspace's Repos (git.clone_repos) into /workspace.
|
|
3
|
+
# Self-contained: it makes sure the directory exists, so `rig apply --materialize` works on its own.
|
|
4
|
+
- name: Workspace repos
|
|
5
|
+
tags: [rig_workspace_repos]
|
|
6
|
+
block:
|
|
7
|
+
- name: Ensure project workspace directory exists
|
|
8
|
+
file:
|
|
9
|
+
path: "{{ workspace_root }}"
|
|
10
|
+
state: directory
|
|
11
|
+
owner: "{{ rig_user }}"
|
|
12
|
+
group: "{{ rig_user }}"
|
|
13
|
+
mode: "0755"
|
|
14
|
+
tags: [rig_workspace_repos_directory]
|
|
15
|
+
|
|
16
|
+
# Plain repo URLs: the token reaches git through an inline credential
|
|
17
|
+
# helper fed from this task's environment, so it is never embedded in the
|
|
18
|
+
# URL (where it would end up in every clone's .git/config and in
|
|
19
|
+
# `git remote -v`) and never written to disk. Honours a per-repo
|
|
20
|
+
# password_var, else github_pat / gitlab_pat. authorize.yml additionally
|
|
21
|
+
# installs a system-wide helper so later `git pull/push` work too.
|
|
22
|
+
- name: Clone configured git repositories
|
|
23
|
+
vars:
|
|
24
|
+
_pat_var: "{{ item.password_var | default('') }}"
|
|
25
|
+
# Fall back to provider default vault vars when password_var was skipped at init.
|
|
26
|
+
_provider_pat: >-
|
|
27
|
+
{{ (gitlab_pat | default(''))
|
|
28
|
+
if ((item.repo | default('')) is match('^(https?://)?([^/@]+@)?[^/]*gitlab'))
|
|
29
|
+
else (github_pat | default('')) }}
|
|
30
|
+
_pat: >-
|
|
31
|
+
{{ (lookup('vars', _pat_var, default='') if _pat_var else '')
|
|
32
|
+
or _provider_pat }}
|
|
33
|
+
# GitHub expects x-access-token; GitLab expects oauth2.
|
|
34
|
+
_auth_user: "{{ 'oauth2' if (item.repo is match('^(https?://)?([^/@]+@)?[^/]*gitlab')) else 'x-access-token' }}"
|
|
35
|
+
environment:
|
|
36
|
+
# Never hang on an interactive username/password prompt (missing PAT).
|
|
37
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
38
|
+
RIG_GIT_USERNAME: "{{ _auth_user }}"
|
|
39
|
+
RIG_GIT_PASSWORD: "{{ _pat }}"
|
|
40
|
+
# Empty helper first: reset anything inherited, then answer from env.
|
|
41
|
+
GIT_CONFIG_COUNT: "{{ 2 if (_pat | length > 0) else 0 }}"
|
|
42
|
+
GIT_CONFIG_KEY_0: credential.helper
|
|
43
|
+
GIT_CONFIG_VALUE_0: ""
|
|
44
|
+
GIT_CONFIG_KEY_1: credential.helper
|
|
45
|
+
GIT_CONFIG_VALUE_1: '!f() { test "$1" = get && { echo "username=$RIG_GIT_USERNAME"; echo "password=$RIG_GIT_PASSWORD"; }; }; f'
|
|
46
|
+
become_user: "{{ rig_user }}"
|
|
47
|
+
git:
|
|
48
|
+
repo: "{{ item.repo }}"
|
|
49
|
+
dest: "{{ item.dest }}"
|
|
50
|
+
version: "{{ item.version | default(omit) }}"
|
|
51
|
+
accept_hostkey: "{{ item.accept_hostkey | default(true) }}"
|
|
52
|
+
force: "{{ item.force | default(false) }}"
|
|
53
|
+
register: _git_clone
|
|
54
|
+
# A fresh VM can hit transient network resets reaching the git host.
|
|
55
|
+
# Retry those only; auth failures (bad PAT) still fail immediately.
|
|
56
|
+
retries: 5
|
|
57
|
+
delay: 5
|
|
58
|
+
until: >-
|
|
59
|
+
_git_clone is succeeded
|
|
60
|
+
or not ((_git_clone.msg | default('')) is search(
|
|
61
|
+
'Connection reset|Connection timed out|Could not resolve|Recv failure|early EOF|RPC failed|SSL_connect|GnuTLS|Failed to connect'))
|
|
62
|
+
loop: "{{ git.clone_repos | default([]) }}"
|
|
63
|
+
when: git is defined and git.clone_repos is defined
|
|
64
|
+
tags: [rig_workspace_repos_clone, git]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.0
|
|
4
4
|
Summary: Ephemeral remotes with full local parity for coding agents
|
|
5
5
|
Author: mystack-cloud
|
|
6
6
|
License-Expression: MIT
|
|
@@ -301,6 +301,7 @@ destroy playbooks:
|
|
|
301
301
|
| Command | What happens |
|
|
302
302
|
| --- | --- |
|
|
303
303
|
| **init** | Scaffold `rig.yml` + `.rig/`. Collect Hetzner creds, repo PATs, agent choices and a key per agent. |
|
|
304
|
+
| **repo** | `rig repo add <url> [--name] [--dest] [--no-pat] [--apply [NAME]]`, `rig repo remove <name> [--apply [NAME]]`, `rig repo list`. Edit the Workspace's Repos without `rig init`. See [Managing Repos](#managing-repos). |
|
|
304
305
|
| **create** | Boot VM (base/system snapshot). Run provision → configure → authorize → materialize. Snapshot after **configure** only. |
|
|
305
306
|
| **apply** | Default: authorize → materialize. Flags: `--provision` / `--configure` / `--authorize` / `--materialize` / `--finalize` / `--destroy` (playbooks only; the VM stays). `--tags` and `--skip-tags` are passed to every playbook in the run. |
|
|
306
307
|
| **attach** | SSH TTY into the agent's [live agent](#live-agents) on `/workspace` (started if needed, joined if running). `--agent` picks among installed agents. |
|
|
@@ -308,7 +309,16 @@ destroy playbooks:
|
|
|
308
309
|
| **dev** | Open VS Code/Cursor via Remote-SSH on `/workspace` (or `--browser` for code-server). |
|
|
309
310
|
| **delete** | Run finalize → destroy playbooks, then delete VM / firewall / SSH key. `--tags` and `--skip-tags` are passed to both playbooks. |
|
|
310
311
|
|
|
311
|
-
|
|
312
|
+
### Managing Repos
|
|
313
|
+
|
|
314
|
+
`rig repo` edits the `repos:` list in `rig.yml` (the only thing it writes; the clone lists the playbooks read are derived from it on every run, so existing Workspaces and their `materialize.yml` need no change).
|
|
315
|
+
|
|
316
|
+
- `add <url>`: SSH URLs become HTTPS; the name defaults to the last URL segment; a duplicate name or URL is refused. For a GitHub or GitLab URL with no provider PAT yet it prompts for one (non-interactive: `RIG_GITHUB_PAT` / `RIG_GITLAB_PAT`; `--no-pat` skips). Without `--no-pat` a repo-specific PAT is stored as `<name>_git_pat` and referenced by `password_var`.
|
|
317
|
+
- `remove <name>`: removes the entry only. The clone on the Environment and any PAT variable stay; delete the clone on the VM yourself if unwanted.
|
|
318
|
+
- `list`: name, URL, dest and PAT variable, from config only.
|
|
319
|
+
- Neither `add` nor `remove` touches the VM. Run `rig apply` to clone (or pass `--apply [NAME]`, which runs the default apply on that Environment, or the last one). A changed `repos:` list means one snapshot cache miss. Saving rewrites `rig.yml`, so comments in it are lost (as with `rig init`).
|
|
320
|
+
|
|
321
|
+
`provision.yml`, `authorize.yml` and `destroy.yml` (and a new Workspace's `materialize.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. **Existing Workspaces** keep their long `materialize.yml` (it is yours and never overwritten); to adopt the clone role see [docs/roles.md](docs/roles.md#materialize-is-yours).
|
|
312
322
|
|
|
313
323
|
Put secret-free installs in `configure.yml` (cached). Put clone/setup that needs credentials in `materialize.yml`.
|
|
314
324
|
|
|
@@ -54,6 +54,7 @@ src/cli/main.py
|
|
|
54
54
|
src/cli/mcp.py
|
|
55
55
|
src/cli/outputs.py
|
|
56
56
|
src/cli/remote_dev.py
|
|
57
|
+
src/cli/repos.py
|
|
57
58
|
src/cli/requirements.txt
|
|
58
59
|
src/cli/snapshots.py
|
|
59
60
|
src/cli/state_bucket.py
|
|
@@ -78,6 +79,8 @@ src/cli/roles/rig_code_server/tasks/install.yml
|
|
|
78
79
|
src/cli/roles/rig_cursor_cli/defaults/main.yml
|
|
79
80
|
src/cli/roles/rig_cursor_cli/tasks/authorize.yml
|
|
80
81
|
src/cli/roles/rig_cursor_cli/tasks/install.yml
|
|
82
|
+
src/cli/roles/rig_destroy/defaults/main.yml
|
|
83
|
+
src/cli/roles/rig_destroy/tasks/destroy.yml
|
|
81
84
|
src/cli/roles/rig_git/defaults/main.yml
|
|
82
85
|
src/cli/roles/rig_git/tasks/authorize.yml
|
|
83
86
|
src/cli/roles/rig_git/tasks/install.yml
|
|
@@ -92,6 +95,8 @@ src/cli/roles/rig_mcp/tasks/authorize.yml
|
|
|
92
95
|
src/cli/roles/rig_opencode/defaults/main.yml
|
|
93
96
|
src/cli/roles/rig_opencode/tasks/authorize.yml
|
|
94
97
|
src/cli/roles/rig_opencode/tasks/install.yml
|
|
98
|
+
src/cli/roles/rig_workspace_repos/defaults/main.yml
|
|
99
|
+
src/cli/roles/rig_workspace_repos/tasks/materialize.yml
|
|
95
100
|
src/cli/roles/rig_workspace_user/defaults/main.yml
|
|
96
101
|
src/cli/roles/rig_workspace_user/tasks/authorize.yml
|
|
97
102
|
src/cli/roles/rig_workspace_user/tasks/install.yml
|
|
@@ -143,6 +148,7 @@ tests/test_real_e2e_vpn.py
|
|
|
143
148
|
tests/test_real_e2e_vpn_tunnel.py
|
|
144
149
|
tests/test_remote_dev.py
|
|
145
150
|
tests/test_remote_dev_coverage_extensions.py
|
|
151
|
+
tests/test_repo_command.py
|
|
146
152
|
tests/test_rig_ansible_vars.py
|
|
147
153
|
tests/test_rig_config.py
|
|
148
154
|
tests/test_secret_prompt_hidden.py
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"src/cli/mcp.py",
|
|
62
62
|
"src/cli/outputs.py",
|
|
63
63
|
"src/cli/remote_dev.py",
|
|
64
|
+
"src/cli/repos.py",
|
|
64
65
|
"src/cli/requirements.txt",
|
|
65
66
|
"src/cli/roles/rig_base/defaults/main.yml",
|
|
66
67
|
"src/cli/roles/rig_base/tasks/install.yml",
|
|
@@ -73,6 +74,8 @@
|
|
|
73
74
|
"src/cli/roles/rig_cursor_cli/defaults/main.yml",
|
|
74
75
|
"src/cli/roles/rig_cursor_cli/tasks/authorize.yml",
|
|
75
76
|
"src/cli/roles/rig_cursor_cli/tasks/install.yml",
|
|
77
|
+
"src/cli/roles/rig_destroy/defaults/main.yml",
|
|
78
|
+
"src/cli/roles/rig_destroy/tasks/destroy.yml",
|
|
76
79
|
"src/cli/roles/rig_git/defaults/main.yml",
|
|
77
80
|
"src/cli/roles/rig_git/tasks/authorize.yml",
|
|
78
81
|
"src/cli/roles/rig_git/tasks/install.yml",
|
|
@@ -87,6 +90,8 @@
|
|
|
87
90
|
"src/cli/roles/rig_opencode/defaults/main.yml",
|
|
88
91
|
"src/cli/roles/rig_opencode/tasks/authorize.yml",
|
|
89
92
|
"src/cli/roles/rig_opencode/tasks/install.yml",
|
|
93
|
+
"src/cli/roles/rig_workspace_repos/defaults/main.yml",
|
|
94
|
+
"src/cli/roles/rig_workspace_repos/tasks/materialize.yml",
|
|
90
95
|
"src/cli/roles/rig_workspace_user/defaults/main.yml",
|
|
91
96
|
"src/cli/roles/rig_workspace_user/tasks/authorize.yml",
|
|
92
97
|
"src/cli/roles/rig_workspace_user/tasks/install.yml",
|
|
@@ -137,6 +142,7 @@
|
|
|
137
142
|
"tests/test_real_e2e_vpn_tunnel.py",
|
|
138
143
|
"tests/test_remote_dev.py",
|
|
139
144
|
"tests/test_remote_dev_coverage_extensions.py",
|
|
145
|
+
"tests/test_repo_command.py",
|
|
140
146
|
"tests/test_rig_ansible_vars.py",
|
|
141
147
|
"tests/test_rig_config.py",
|
|
142
148
|
"tests/test_secret_prompt_hidden.py",
|