mystack-rig 1.9.2__tar.gz → 1.10.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/GLOSSARY.md +1 -1
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/PKG-INFO +11 -1
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/README.md +10 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/main.py +41 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/remote_dev.py +2 -0
- mystack_rig-1.10.1/src/cli/repos.py +152 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/PKG-INFO +11 -1
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/SOURCES.txt +3 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/scm_file_list.json +3 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/scm_version.json +2 -2
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_init_command.py +1 -1
- mystack_rig-1.10.1/tests/test_repo_command.py +197 -0
- mystack_rig-1.10.1/tests/test_run_remote_decoding.py +33 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.coveragerc +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.git-blame-ignore-revs +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.github/workflows/release.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.github/workflows/tests.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.gitignore +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.rig/playbooks/README.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/.rig/playbooks/vpn-gateway.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/CLAUDE.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/CLI_STORAGE_SUMMARY.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/Dockerfile +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/GIT_CLONE_FEATURE.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/HETZNER_STORAGE_GUIDE.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/LICENSE +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/Makefile +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/README_REAL_E2E.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/STORAGE_CLI_GUIDE.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0004-agents-run-as-live-agents-in-tmux.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0005-docker-in-configure-for-devcontainers.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0006-workspace-user-instead-of-root.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/adr/0007-managed-playbook-content-ships-as-bundled-roles.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/architecture.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/architecture.png +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/architecture.svg +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/docs/roles.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/forged-idea.md +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/pyproject.toml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/pytest.ini +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/requirements.txt +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/sample.env +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/scripts/coverage_badge.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/scripts/pypi_version.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/setup.cfg +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/__init__.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/__init__.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/__main__.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/agents.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/ansible_filters/__init__.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/ansible_filters/rig_live.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/ansible_filters/rig_mcp.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/assets/rig-agent-queue +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/assets/rig-agent-state +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/assets/tmux.conf +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/config.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/devcontainers.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/encrypt.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/git.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/git_author.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/last_env.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/last_session.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/last_target.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/live_agent.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/log.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/mcp.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/outputs.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/requirements.txt +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_base/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_base/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_claude_code/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_claude_code/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_claude_code/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_code_server/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_code_server/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_code_server/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_cursor_cli/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_cursor_cli/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_cursor_cli/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_destroy/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_destroy/tasks/destroy.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_git/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_git/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_git/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_home_ownership/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_home_ownership/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_home_ownership/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_live_agent/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_live_agent/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_live_agent/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_mcp/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_mcp/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_opencode/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_opencode/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_opencode/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_workspace_repos/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_workspace_repos/tasks/materialize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_workspace_user/defaults/main.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_workspace_user/tasks/authorize.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/roles/rig_workspace_user/tasks/install.yml +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/snapshots.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/state_bucket.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/storage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/vault_keys.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/vpn.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/cli/workspace_user.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/entry_points.txt +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/requires.txt +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/src/mystack_rig.egg-info/top_level.txt +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/test_hetzner_integration.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/_roles.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/conftest.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_agents.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_ansible_galaxy.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_attach_command.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_bundled_roles.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_credential_security.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_destroy_command.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_dev_command.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_devcontainers.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_encrypt_command.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_encrypt_coverage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_firewall_client_ip.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_git_clone_unit.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_git_credentials_and_author.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_git_manager.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_gitignore_init.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_hetzner_storage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_inspect_describe.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_last_env.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_last_session.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_last_target.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_live_agent.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_live_agent_cli.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_log.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_main_coverage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_mcp_command.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_mcp_render.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_outputs.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_outputs_storage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_pypi_version.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_python_floor.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_r2_storage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_real_e2e_integration.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_real_e2e_storage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_real_e2e_vpn.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_real_e2e_vpn_tunnel.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_remote_dev.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_remote_dev_coverage_extensions.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_rig_ansible_vars.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_rig_config.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_secret_prompt_hidden.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_setup_provision.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_simulation_storage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_small_module_coverage.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_snapshots.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_state_bucket.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_storage_basic.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_vault_keys.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_vpn_optional.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/tests/test_vpn_unit.py +0 -0
- {mystack_rig-1.9.2 → mystack_rig-1.10.1}/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.1
|
|
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,6 +309,15 @@ 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
|
|
|
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
|
+
|
|
311
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`.
|
|
@@ -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,6 +287,15 @@ 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
|
|
|
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
|
+
|
|
289
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`.
|
|
@@ -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()
|
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mystack-rig
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.1
|
|
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,6 +309,15 @@ 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
|
|
|
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
|
+
|
|
311
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`.
|
|
@@ -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
|
|
@@ -147,8 +148,10 @@ tests/test_real_e2e_vpn.py
|
|
|
147
148
|
tests/test_real_e2e_vpn_tunnel.py
|
|
148
149
|
tests/test_remote_dev.py
|
|
149
150
|
tests/test_remote_dev_coverage_extensions.py
|
|
151
|
+
tests/test_repo_command.py
|
|
150
152
|
tests/test_rig_ansible_vars.py
|
|
151
153
|
tests/test_rig_config.py
|
|
154
|
+
tests/test_run_remote_decoding.py
|
|
152
155
|
tests/test_secret_prompt_hidden.py
|
|
153
156
|
tests/test_setup_provision.py
|
|
154
157
|
tests/test_simulation_storage.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",
|
|
@@ -141,8 +142,10 @@
|
|
|
141
142
|
"tests/test_real_e2e_vpn_tunnel.py",
|
|
142
143
|
"tests/test_remote_dev.py",
|
|
143
144
|
"tests/test_remote_dev_coverage_extensions.py",
|
|
145
|
+
"tests/test_repo_command.py",
|
|
144
146
|
"tests/test_rig_ansible_vars.py",
|
|
145
147
|
"tests/test_rig_config.py",
|
|
148
|
+
"tests/test_run_remote_decoding.py",
|
|
146
149
|
"tests/test_secret_prompt_hidden.py",
|
|
147
150
|
"tests/test_setup_provision.py",
|
|
148
151
|
"tests/test_simulation_storage.py",
|
|
@@ -850,7 +850,7 @@ def test_help_lists_top_level_commands_and_hides_internals(capsys):
|
|
|
850
850
|
main(["--help"])
|
|
851
851
|
assert caught.value.code == 0
|
|
852
852
|
output = capsys.readouterr().out
|
|
853
|
-
assert "{init,create,apply,attach,exec,ssh,dev,list,inspect,describe,cache,delete,vars,mcp}" in output
|
|
853
|
+
assert "{init,create,apply,attach,exec,ssh,dev,list,inspect,describe,cache,delete,vars,mcp,repo}" in output
|
|
854
854
|
assert "vpn" not in output
|
|
855
855
|
assert "storage" not in output
|
|
856
856
|
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"""`rig repo`: add / remove / list the Repos in rig.yml."""
|
|
2
|
+
|
|
3
|
+
from types import SimpleNamespace
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
import yaml
|
|
7
|
+
|
|
8
|
+
from cli import main as main_mod
|
|
9
|
+
from cli import repos
|
|
10
|
+
from cli.main import main
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@pytest.fixture
|
|
14
|
+
def project(tmp_path, monkeypatch):
|
|
15
|
+
(tmp_path / "rig.yml").write_text("name: t\nrepos:\n- name: a\n url: https://github.com/o/a.git\n")
|
|
16
|
+
(tmp_path / ".rig").mkdir()
|
|
17
|
+
monkeypatch.chdir(tmp_path)
|
|
18
|
+
monkeypatch.setattr("sys.stdin", SimpleNamespace(isatty=lambda: False))
|
|
19
|
+
for var in ("RIG_GITHUB_PAT", "RIG_GITLAB_PAT"):
|
|
20
|
+
monkeypatch.delenv(var, raising=False)
|
|
21
|
+
monkeypatch.setattr(repos, "_vault_names", lambda _d: set())
|
|
22
|
+
return tmp_path
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def read_repos(project):
|
|
26
|
+
return yaml.safe_load((project / "rig.yml").read_text())["repos"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@pytest.mark.parametrize(
|
|
30
|
+
"url, name",
|
|
31
|
+
[
|
|
32
|
+
("https://github.com/o/app.git", "app"),
|
|
33
|
+
("https://github.com/o/app/", "app"),
|
|
34
|
+
("git@gitlab.com:o/tool.git", "tool"),
|
|
35
|
+
("https://example.com/o/plain", "plain"),
|
|
36
|
+
],
|
|
37
|
+
)
|
|
38
|
+
def test_repo_name_from_url(url, name):
|
|
39
|
+
assert repos.repo_name_from_url(url) == name
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_add_writes_only_repos_and_converts_ssh(project, capsys):
|
|
43
|
+
assert main(["repo", "add", "git@github.com:o/b.git", "--no-pat"]) == 0
|
|
44
|
+
assert read_repos(project)[-1] == {"name": "b", "url": "https://github.com/o/b.git"}
|
|
45
|
+
assert "Converted remote to HTTPS" in capsys.readouterr().out
|
|
46
|
+
assert not (project / ".rig" / "vars.yml").exists()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_add_name_and_dest(project):
|
|
50
|
+
assert main(["repo", "add", "https://example.com/o/x.git", "--name", "xx", "--dest", "/srv/x"]) == 0
|
|
51
|
+
assert read_repos(project)[-1] == {"name": "xx", "url": "https://example.com/o/x.git", "dest": "/srv/x"}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@pytest.mark.parametrize(
|
|
55
|
+
"args", [["https://github.com/o/a.git", "--name", "other"], ["https://github.com/o/z.git", "--name", "a"]]
|
|
56
|
+
)
|
|
57
|
+
def test_add_rejects_duplicates(project, args, capsys):
|
|
58
|
+
assert main(["repo", "add", *args, "--no-pat"]) == 1
|
|
59
|
+
assert "already in rig.yml" in capsys.readouterr().err
|
|
60
|
+
assert len(read_repos(project)) == 1
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@pytest.mark.parametrize("name", ["..", ".hidden", "a/b"])
|
|
64
|
+
def test_add_rejects_invalid_name(project, name, capsys):
|
|
65
|
+
assert main(["repo", "add", "https://github.com/o/z.git", "--name", name, "--no-pat"]) == 1
|
|
66
|
+
assert "invalid repo name" in capsys.readouterr().err
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_add_noninteractive_pat_from_env_is_stored(project, monkeypatch, capsys):
|
|
70
|
+
monkeypatch.setenv("RIG_GITHUB_PAT", "tok")
|
|
71
|
+
stored = {}
|
|
72
|
+
monkeypatch.setattr(repos, "store_repo_pats", lambda to_store, **kw: stored.update(to_store) or True)
|
|
73
|
+
assert main(["repo", "add", "https://github.com/o/b.git"]) == 0
|
|
74
|
+
assert stored == {"github_pat": "tok"}
|
|
75
|
+
assert "password_var" not in read_repos(project)[-1] # provider default covers it
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_add_without_pat_available_still_adds(project, capsys):
|
|
79
|
+
assert main(["repo", "add", "https://github.com/o/b.git"]) == 0
|
|
80
|
+
assert "No PAT stored" in capsys.readouterr().out
|
|
81
|
+
assert read_repos(project)[-1]["name"] == "b"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_add_skips_pat_when_provider_default_exists(project, monkeypatch):
|
|
85
|
+
monkeypatch.setattr(repos, "_vault_names", lambda _d: {"github_pat"})
|
|
86
|
+
monkeypatch.setattr(repos, "store_repo_pats", lambda *a, **k: pytest.fail("must not store"))
|
|
87
|
+
assert main(["repo", "add", "https://github.com/o/b.git"]) == 0
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def test_add_unsupported_host_skips_pat(project, capsys):
|
|
91
|
+
assert main(["repo", "add", "https://example.com/o/b.git"]) == 0
|
|
92
|
+
assert "unsupported git host" in capsys.readouterr().out
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_add_interactive_repo_specific_pat_sets_password_var(project, monkeypatch):
|
|
96
|
+
monkeypatch.setattr("sys.stdin", SimpleNamespace(isatty=lambda: True))
|
|
97
|
+
monkeypatch.setattr(repos, "collect_repo_pats", lambda r: ({"b": "tok"}, {}))
|
|
98
|
+
monkeypatch.setattr(repos, "store_repo_pats", lambda *a, **k: True)
|
|
99
|
+
assert main(["repo", "add", "https://github.com/o/b.git"]) == 0
|
|
100
|
+
assert read_repos(project)[-1]["password_var"] == "b_git_pat"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_add_pat_storage_failure_warns_but_adds(project, monkeypatch, capsys):
|
|
104
|
+
monkeypatch.setenv("RIG_GITHUB_PAT", "tok")
|
|
105
|
+
|
|
106
|
+
def boom(*a, **k):
|
|
107
|
+
raise RuntimeError("locked")
|
|
108
|
+
|
|
109
|
+
monkeypatch.setattr(repos, "store_repo_pats", boom)
|
|
110
|
+
assert main(["repo", "add", "https://github.com/o/b.git"]) == 0
|
|
111
|
+
assert "PAT not stored: locked" in capsys.readouterr().err
|
|
112
|
+
assert read_repos(project)[-1]["name"] == "b"
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def test_remove(project, capsys):
|
|
116
|
+
assert main(["repo", "remove", "a"]) == 0
|
|
117
|
+
assert read_repos(project) == []
|
|
118
|
+
assert "keep their clone" in capsys.readouterr().out
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def test_remove_unknown_lists_known(project, capsys):
|
|
122
|
+
assert main(["repo", "remove", "nope"]) == 1
|
|
123
|
+
err = capsys.readouterr().err
|
|
124
|
+
assert "no Repo named 'nope'" in err and "a" in err
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_list(project, monkeypatch, capsys):
|
|
128
|
+
assert main(["repo", "list"]) == 0
|
|
129
|
+
assert capsys.readouterr().out.strip() == "a\thttps://github.com/o/a.git\t-\t-"
|
|
130
|
+
monkeypatch.setattr(repos, "_vault_names", lambda _d: {"github_pat"})
|
|
131
|
+
main(["repo", "list"])
|
|
132
|
+
assert capsys.readouterr().out.strip().endswith("github_pat")
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_list_shows_password_var_and_empty(project, capsys):
|
|
136
|
+
(project / "rig.yml").write_text(
|
|
137
|
+
"name: t\nrepos:\n- {name: a, url: 'https://github.com/o/a.git', dest: /d, password_var: a_git_pat}\n"
|
|
138
|
+
)
|
|
139
|
+
main(["repo", "list"])
|
|
140
|
+
assert capsys.readouterr().out.strip() == "a\thttps://github.com/o/a.git\t/d\ta_git_pat"
|
|
141
|
+
(project / "rig.yml").write_text("name: t\n")
|
|
142
|
+
main(["repo", "list"])
|
|
143
|
+
assert "No Repos" in capsys.readouterr().out
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def test_vault_names_swallows_missing_vars(tmp_path, monkeypatch):
|
|
147
|
+
monkeypatch.undo()
|
|
148
|
+
monkeypatch.setattr(repos, "list_all_vault_vars", lambda d: (_ for _ in ()).throw(OSError("x")))
|
|
149
|
+
assert repos._vault_names(str(tmp_path)) == set()
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def test_missing_subcommand_prints_help(project):
|
|
153
|
+
assert main(["repo"]) == 1
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@pytest.mark.parametrize("flag, expected", [(["--apply"], None), (["--apply", "dev1"], "dev1")])
|
|
157
|
+
def test_apply_flag_runs_apply(project, monkeypatch, flag, expected):
|
|
158
|
+
seen = []
|
|
159
|
+
monkeypatch.setattr(main_mod, "_cmd_apply", lambda a: seen.append(a.name) or 0)
|
|
160
|
+
assert main(["repo", "remove", "a", *flag]) == 0
|
|
161
|
+
assert seen == [expected]
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def test_apply_flag_skipped_on_failure(project, monkeypatch):
|
|
165
|
+
monkeypatch.setattr(main_mod, "_cmd_apply", lambda a: pytest.fail("must not apply"))
|
|
166
|
+
assert main(["repo", "remove", "nope", "--apply"]) == 1
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def test_no_apply_flag_does_not_apply(project, monkeypatch):
|
|
170
|
+
monkeypatch.setattr(main_mod, "_cmd_apply", lambda a: pytest.fail("must not apply"))
|
|
171
|
+
assert main(["repo", "remove", "a"]) == 0
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def test_save_failure_reports(project, monkeypatch, capsys):
|
|
175
|
+
from cli.remote_dev import ProjectConfig
|
|
176
|
+
|
|
177
|
+
monkeypatch.setattr(ProjectConfig, "save", lambda self, write_vars=True: False)
|
|
178
|
+
assert main(["repo", "add", "https://example.com/o/q.git", "--no-pat"]) == 1
|
|
179
|
+
assert main(["repo", "remove", "a"]) == 1
|
|
180
|
+
assert capsys.readouterr().err.count("could not write rig.yml") == 2
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_added_repo_reaches_derived_clone_list(project):
|
|
184
|
+
"""The playbooks read git.clone_repos, derived from rig.yml: add needs no vars.yml write."""
|
|
185
|
+
from cli.remote_dev import derive_config_vars
|
|
186
|
+
|
|
187
|
+
main(["repo", "add", "https://github.com/o/b.git", "--no-pat"])
|
|
188
|
+
cfg = yaml.safe_load((project / "rig.yml").read_text())
|
|
189
|
+
derived = derive_config_vars(cfg)
|
|
190
|
+
assert [r["repo"] for r in derived["git"]["clone_repos"]] == [
|
|
191
|
+
"https://github.com/o/a.git",
|
|
192
|
+
"https://github.com/o/b.git",
|
|
193
|
+
]
|
|
194
|
+
assert derived["git_providers"] == ["github"]
|
|
195
|
+
main(["repo", "remove", "a"])
|
|
196
|
+
cfg = yaml.safe_load((project / "rig.yml").read_text())
|
|
197
|
+
assert [r["repo"] for r in derive_config_vars(cfg)["git"]["clone_repos"]] == ["https://github.com/o/b.git"]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""run_remote must survive remote output that is not valid UTF-8 (e.g. a truncated agent log)."""
|
|
2
|
+
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from cli.remote_dev import RemoteDevEnvironment
|
|
8
|
+
|
|
9
|
+
BAD = b"session id: 0b6f3c1e-1111-2222-3333-444455556666 \x9c tail"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@pytest.fixture
|
|
13
|
+
def env(monkeypatch):
|
|
14
|
+
env = RemoteDevEnvironment(name="demo")
|
|
15
|
+
# Stand in for ssh with a local process that prints the invalid byte.
|
|
16
|
+
monkeypatch.setattr(
|
|
17
|
+
env,
|
|
18
|
+
"_ssh_command",
|
|
19
|
+
lambda *a, **k: [sys.executable, "-c", f"import sys; sys.stdout.buffer.write({BAD!r})"],
|
|
20
|
+
)
|
|
21
|
+
return env
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_run_remote_replaces_undecodable_bytes(env):
|
|
25
|
+
result = env.run_remote("cat log")
|
|
26
|
+
assert result.returncode == 0
|
|
27
|
+
assert "�" in result.stdout
|
|
28
|
+
assert result.stdout.startswith("session id: 0b6f3c1e")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_recover_session_id_survives_undecodable_log(env, monkeypatch):
|
|
32
|
+
monkeypatch.setattr("cli.last_session.parse_session_id", lambda text: text.split()[2])
|
|
33
|
+
assert env.recover_session_id("claude") == "0b6f3c1e-1111-2222-3333-444455556666"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|