mystack-rig 1.3.0__tar.gz → 1.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. mystack_rig-1.3.2/.git-blame-ignore-revs +7 -0
  2. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/.github/workflows/tests.yml +7 -6
  3. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/CLI_STORAGE_SUMMARY.md +1 -1
  4. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/HETZNER_STORAGE_GUIDE.md +1 -1
  5. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/Makefile +11 -2
  6. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/PKG-INFO +51 -3
  7. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/README.md +49 -0
  8. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/README_REAL_E2E.md +4 -2
  9. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/STORAGE_CLI_GUIDE.md +1 -1
  10. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/pyproject.toml +23 -2
  11. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/requirements.txt +1 -2
  12. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/scripts/coverage_badge.py +1 -3
  13. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/scripts/pypi_version.py +6 -16
  14. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/agents.py +39 -58
  15. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/ansible_filters/rig_mcp.py +32 -44
  16. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/config.py +16 -26
  17. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/encrypt.py +155 -168
  18. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/git.py +131 -123
  19. mystack_rig-1.3.2/src/cli/git_author.py +66 -0
  20. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/last_env.py +4 -4
  21. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/last_session.py +12 -12
  22. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/log.py +3 -3
  23. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/main.py +57 -93
  24. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/mcp.py +46 -38
  25. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/outputs.py +14 -13
  26. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/remote_dev.py +914 -813
  27. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/snapshots.py +75 -107
  28. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/state_bucket.py +8 -10
  29. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/storage.py +26 -27
  30. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/vault_keys.py +28 -32
  31. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/vpn.py +84 -135
  32. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/PKG-INFO +51 -3
  33. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/SOURCES.txt +5 -1
  34. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/requires.txt +0 -3
  35. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/scm_file_list.json +5 -1
  36. mystack_rig-1.3.2/src/mystack_rig.egg-info/scm_version.json +8 -0
  37. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/test_hetzner_integration.py +98 -113
  38. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/conftest.py +29 -34
  39. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_agents.py +8 -24
  40. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_attach_command.py +141 -118
  41. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_credential_security.py +14 -13
  42. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_destroy_command.py +42 -34
  43. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_dev_command.py +61 -70
  44. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_encrypt_command.py +32 -26
  45. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_encrypt_coverage.py +42 -31
  46. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_firewall_client_ip.py +10 -21
  47. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_git_clone_unit.py +128 -128
  48. mystack_rig-1.3.2/tests/test_git_credentials_and_author.py +295 -0
  49. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_git_manager.py +1 -3
  50. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_gitignore_init.py +1 -3
  51. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_hetzner_storage.py +31 -37
  52. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_init_command.py +40 -61
  53. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_inspect_describe.py +30 -12
  54. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_main_coverage.py +165 -147
  55. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_mcp_command.py +33 -21
  56. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_mcp_render.py +10 -9
  57. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_outputs.py +5 -8
  58. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_outputs_storage.py +3 -3
  59. mystack_rig-1.3.2/tests/test_python_floor.py +38 -0
  60. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_real_e2e_integration.py +33 -47
  61. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_real_e2e_storage.py +38 -39
  62. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_real_e2e_vpn.py +27 -23
  63. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_real_e2e_vpn_tunnel.py +45 -39
  64. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_remote_dev.py +145 -163
  65. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_remote_dev_coverage_extensions.py +143 -120
  66. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_rig_ansible_vars.py +37 -2
  67. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_rig_config.py +30 -22
  68. mystack_rig-1.3.2/tests/test_secret_prompt_hidden.py +272 -0
  69. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_setup_provision.py +127 -77
  70. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_simulation_storage.py +69 -76
  71. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_snapshots.py +81 -73
  72. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_state_bucket.py +9 -16
  73. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_storage_basic.py +97 -109
  74. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_vault_keys.py +1 -4
  75. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_vpn_optional.py +13 -9
  76. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_vpn_unit.py +5 -10
  77. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_workspace_git_clone.py +91 -102
  78. mystack_rig-1.3.0/.flake8 +0 -5
  79. mystack_rig-1.3.0/src/mystack_rig.egg-info/scm_version.json +0 -8
  80. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/.coveragerc +0 -0
  81. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/.github/workflows/release.yml +0 -0
  82. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/.gitignore +0 -0
  83. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/.rig/playbooks/README.md +0 -0
  84. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/.rig/playbooks/vpn-gateway.yml +0 -0
  85. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/Dockerfile +0 -0
  86. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/GIT_CLONE_FEATURE.md +0 -0
  87. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/GLOSSARY.md +0 -0
  88. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
  89. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/LICENSE +0 -0
  90. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
  91. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
  92. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
  93. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/docs/architecture.md +0 -0
  94. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/docs/architecture.png +0 -0
  95. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/docs/architecture.svg +0 -0
  96. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/forged-idea.md +0 -0
  97. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/pytest.ini +0 -0
  98. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/sample.env +0 -0
  99. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/setup.cfg +0 -0
  100. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/__init__.py +0 -0
  101. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/__init__.py +0 -0
  102. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/__main__.py +0 -0
  103. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/ansible_filters/__init__.py +0 -0
  104. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/cli/requirements.txt +0 -0
  105. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
  106. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/entry_points.txt +0 -0
  107. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/top_level.txt +0 -0
  108. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_ansible_galaxy.py +0 -0
  109. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_last_env.py +0 -0
  110. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_last_session.py +0 -0
  111. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_log.py +0 -0
  112. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_pypi_version.py +0 -0
  113. {mystack_rig-1.3.0 → mystack_rig-1.3.2}/tests/test_small_module_coverage.py +0 -0
@@ -0,0 +1,7 @@
1
+ # Commits that only reformat or mechanically rewrite code. GitHub's blame view honours
2
+ # this file automatically. Locally: git config blame.ignoreRevsFile .git-blame-ignore-revs
3
+
4
+ # style: ruff format
5
+ f42c9851ff199fa27c6515764108f7224f81fc2b
6
+ # style: ruff check --fix (import sorting and pyupgrade for py310)
7
+ e1dd627b910a96078d0d8f5559efc0acabd574ab
@@ -29,15 +29,16 @@ jobs:
29
29
  with:
30
30
  python-version: '3.11'
31
31
 
32
- - name: Install dependencies
32
+ - name: Install ruff
33
33
  run: |
34
34
  python -m pip install --upgrade pip
35
- pip install flake8 pytest
36
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
35
+ pip install "ruff==0.17.5"
37
36
 
38
- - name: Lint with flake8
39
- run: |
40
- flake8 src/ tests/ --count --show-source --statistics
37
+ - name: Lint with ruff
38
+ run: ruff check .
39
+
40
+ - name: Check formatting with ruff
41
+ run: ruff format --check .
41
42
 
42
43
  type-check:
43
44
  name: Type Check
@@ -162,7 +162,7 @@ pip install -r requirements.txt
162
162
  python -m pytest tests/
163
163
 
164
164
  # Run linter
165
- pylint src/
165
+ ruff check . && ruff format --check .
166
166
  ```
167
167
 
168
168
  ## License
@@ -155,7 +155,7 @@ python -m pytest tests/
155
155
 
156
156
  ### Linting
157
157
  ```bash
158
- pylint src/
158
+ ruff check . && ruff format --check .
159
159
  ```
160
160
 
161
161
  ### Building Distribution
@@ -1,7 +1,7 @@
1
1
  VENV := .venv
2
2
  PY := $(VENV)/bin/python3
3
3
 
4
- .PHONY: venv install test test-e2e test-remote-dev test-remote-dev-e2e coverage run lint clean
4
+ .PHONY: venv install test test-e2e test-remote-dev test-remote-dev-e2e coverage run lint format clean
5
5
 
6
6
  # Create local venv (avoids PEP 668 on Homebrew/system Python)
7
7
  venv: $(PY)
@@ -46,8 +46,17 @@ test-remote-dev-e2e: venv
46
46
  $(PY) -m pytest tests/test_workspace_git_clone.py -v -m e2e
47
47
 
48
48
  # Run linting
49
+ # Same checks as CI (ruff version pinned there)
49
50
  lint: venv
50
- $(PY) -m pylint src/
51
+ $(PY) -m pip install -q "ruff==0.17.5"
52
+ $(PY) -m ruff check .
53
+ $(PY) -m ruff format --check .
54
+
55
+ # Apply ruff's formatting and safe lint fixes
56
+ format: venv
57
+ $(PY) -m pip install -q "ruff==0.17.5"
58
+ $(PY) -m ruff check --fix .
59
+ $(PY) -m ruff format .
51
60
 
52
61
  # Clean build artifacts
53
62
  clean:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mystack-rig
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: Ephemeral remotes with full local parity for coding agents
5
5
  Author: mystack-cloud
6
6
  License-Expression: MIT
@@ -10,7 +10,7 @@ Project-URL: Issues, https://github.com/mystack-cloud/rig/issues
10
10
  Keywords: remote-development,coding-agents,hetzner
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.7
13
+ Requires-Python: >=3.10
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: requests>=2.25.0
@@ -18,12 +18,13 @@ Requires-Dist: ansible>=4.0.0
18
18
  Requires-Dist: boto3>=1.26.0
19
19
  Requires-Dist: PyYAML>=6.0
20
20
  Requires-Dist: cryptography>=41.0.0
21
- Requires-Dist: importlib-metadata>=4.0; python_version < "3.8"
22
21
  Dynamic: license-file
23
22
 
24
23
  [![PyPI](https://img.shields.io/pypi/v/mystack-rig)](https://pypi.org/project/mystack-rig/)
25
24
  [![Tests](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml/badge.svg)](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml)
26
25
  [![codecov](https://codecov.io/gh/mystack-cloud/rig/graph/badge.svg)](https://codecov.io/gh/mystack-cloud/rig)
26
+ [![License: MIT](https://img.shields.io/github/license/mystack-cloud/rig)](https://github.com/mystack-cloud/rig/blob/master/LICENSE)
27
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
27
28
 
28
29
  # rig
29
30
 
@@ -301,6 +302,8 @@ Playbooks load `.rig/vars.yml` then `.rig/vars.{identity}.yml` (personal wins),
301
302
  | `rig_firewall_name` | Firewall resource name |
302
303
  | `rig_repos` | `[{name, url, path}, …]` (no secrets) |
303
304
  | `rig_git_providers` | e.g. `github`, `gitlab` |
305
+ | `rig_identity` | Developer identity (the `.rig/vars.{identity}.yml` handle) |
306
+ | `rig_git_author_name` / `rig_git_author_email` | Git author set on the VM (see [Git credentials and author](#git-credentials-and-author)) |
304
307
 
305
308
  Also available from vars files (defaults): `workspace_root`, `coding_agent_type`, `coding_agent_types`, `git.clone_repos`. On `rig init`, git PATs and each coding agent API key default to **personal** storage in `vars.{identity}.yml` (you are asked to confirm once); shared secrets such as `vscode_browser_password` live in `vars.yml`.
306
309
 
@@ -354,6 +357,17 @@ pip install -e .
354
357
  rig --version
355
358
  ```
356
359
 
360
+ ### Code style
361
+
362
+ [Ruff](https://docs.astral.sh/ruff/) does linting and formatting (configured in `pyproject.toml`: line length 120, double quotes, Python 3.10 syntax). CI runs `ruff check .` and `ruff format --check .`.
363
+
364
+ ```bash
365
+ make format # apply ruff's formatting and safe lint fixes
366
+ make lint # the same checks as CI
367
+ ```
368
+
369
+ `mypy src/` also runs in CI. Commits that only reformat code are listed in `.git-blame-ignore-revs`; run `git config blame.ignoreRevsFile .git-blame-ignore-revs` to make local `git blame` skip them (GitHub does this automatically).
370
+
357
371
  ## Tests
358
372
 
359
373
  ```bash
@@ -367,3 +381,37 @@ Push a version tag to publish that version to PyPI. The package version is the t
367
381
  ## License
368
382
 
369
383
  MIT
384
+
385
+ ## Git credentials and author
386
+
387
+ **Provider tokens never go into repo URLs.** `authorize.yml` (managed) takes
388
+ `github_pat` / `gitlab_pat` from the vars files and writes them to
389
+ `/root/.config/rig/git-provider.env` (mode `0600`, root only). From there:
390
+
391
+ - login shells get `GH_TOKEN` / `GITLAB_TOKEN` via `/etc/profile.d`, and `rig attach`
392
+ exports them to the agent process itself (it starts the agent in a non-login
393
+ shell, which never reads `/etc/profile.d`), so `gh` and `glab` work out of the
394
+ box in both;
395
+ - a system-wide git credential helper (`/usr/local/bin/rig-git-credential`)
396
+ answers `github.com` / `gitlab.com` HTTPS requests from that same file, so
397
+ `git clone`, `git push` and the `materialize.yml` clone task all use plain
398
+ URLs (`https://github.com/org/repo.git`) and nothing sits in `.git/config`
399
+ or `git remote -v`. Other users on the VM can't read the file and get no
400
+ credentials.
401
+
402
+ The `materialize.yml` clone task passes the token to git through an inline
403
+ helper fed from the task's environment (a per-repo `password_var` still wins over
404
+ `github_pat` / `gitlab_pat`), so it never touches the URL or disk. Projects
405
+ scaffolded by an older rig still have the token-in-URL clone task in their
406
+ `materialize.yml` (user-owned, never overwritten): copy the `vars:` and
407
+ `environment:` blocks of the current template and set `repo: "{{ item.repo }}"`.
408
+
409
+ **Git author.** A fresh VM has no git identity, so the first commit would fail
410
+ with *Author identity unknown*. `authorize.yml` sets `user.name` / `user.email`
411
+ (global) from `rig_git_author_name` / `rig_git_author_email`, which rig derives
412
+ from your identity: the identity as the name and `<identity>@rig.local` as the
413
+ email. Set `git_author_name` / `git_author_email` in `.rig/vars.yml`, or in your
414
+ personal `.rig/vars.{identity}.yml`, to use a real name and a GitHub-linked
415
+ email (the derived `rig.local` address is deliberately not a
416
+ `users.noreply.github.com` one, which GitHub would attribute to whoever owns
417
+ that handle).
@@ -1,6 +1,8 @@
1
1
  [![PyPI](https://img.shields.io/pypi/v/mystack-rig)](https://pypi.org/project/mystack-rig/)
2
2
  [![Tests](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml/badge.svg)](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml)
3
3
  [![codecov](https://codecov.io/gh/mystack-cloud/rig/graph/badge.svg)](https://codecov.io/gh/mystack-cloud/rig)
4
+ [![License: MIT](https://img.shields.io/github/license/mystack-cloud/rig)](https://github.com/mystack-cloud/rig/blob/master/LICENSE)
5
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
4
6
 
5
7
  # rig
6
8
 
@@ -278,6 +280,8 @@ Playbooks load `.rig/vars.yml` then `.rig/vars.{identity}.yml` (personal wins),
278
280
  | `rig_firewall_name` | Firewall resource name |
279
281
  | `rig_repos` | `[{name, url, path}, …]` (no secrets) |
280
282
  | `rig_git_providers` | e.g. `github`, `gitlab` |
283
+ | `rig_identity` | Developer identity (the `.rig/vars.{identity}.yml` handle) |
284
+ | `rig_git_author_name` / `rig_git_author_email` | Git author set on the VM (see [Git credentials and author](#git-credentials-and-author)) |
281
285
 
282
286
  Also available from vars files (defaults): `workspace_root`, `coding_agent_type`, `coding_agent_types`, `git.clone_repos`. On `rig init`, git PATs and each coding agent API key default to **personal** storage in `vars.{identity}.yml` (you are asked to confirm once); shared secrets such as `vscode_browser_password` live in `vars.yml`.
283
287
 
@@ -331,6 +335,17 @@ pip install -e .
331
335
  rig --version
332
336
  ```
333
337
 
338
+ ### Code style
339
+
340
+ [Ruff](https://docs.astral.sh/ruff/) does linting and formatting (configured in `pyproject.toml`: line length 120, double quotes, Python 3.10 syntax). CI runs `ruff check .` and `ruff format --check .`.
341
+
342
+ ```bash
343
+ make format # apply ruff's formatting and safe lint fixes
344
+ make lint # the same checks as CI
345
+ ```
346
+
347
+ `mypy src/` also runs in CI. Commits that only reformat code are listed in `.git-blame-ignore-revs`; run `git config blame.ignoreRevsFile .git-blame-ignore-revs` to make local `git blame` skip them (GitHub does this automatically).
348
+
334
349
  ## Tests
335
350
 
336
351
  ```bash
@@ -344,3 +359,37 @@ Push a version tag to publish that version to PyPI. The package version is the t
344
359
  ## License
345
360
 
346
361
  MIT
362
+
363
+ ## Git credentials and author
364
+
365
+ **Provider tokens never go into repo URLs.** `authorize.yml` (managed) takes
366
+ `github_pat` / `gitlab_pat` from the vars files and writes them to
367
+ `/root/.config/rig/git-provider.env` (mode `0600`, root only). From there:
368
+
369
+ - login shells get `GH_TOKEN` / `GITLAB_TOKEN` via `/etc/profile.d`, and `rig attach`
370
+ exports them to the agent process itself (it starts the agent in a non-login
371
+ shell, which never reads `/etc/profile.d`), so `gh` and `glab` work out of the
372
+ box in both;
373
+ - a system-wide git credential helper (`/usr/local/bin/rig-git-credential`)
374
+ answers `github.com` / `gitlab.com` HTTPS requests from that same file, so
375
+ `git clone`, `git push` and the `materialize.yml` clone task all use plain
376
+ URLs (`https://github.com/org/repo.git`) and nothing sits in `.git/config`
377
+ or `git remote -v`. Other users on the VM can't read the file and get no
378
+ credentials.
379
+
380
+ The `materialize.yml` clone task passes the token to git through an inline
381
+ helper fed from the task's environment (a per-repo `password_var` still wins over
382
+ `github_pat` / `gitlab_pat`), so it never touches the URL or disk. Projects
383
+ scaffolded by an older rig still have the token-in-URL clone task in their
384
+ `materialize.yml` (user-owned, never overwritten): copy the `vars:` and
385
+ `environment:` blocks of the current template and set `repo: "{{ item.repo }}"`.
386
+
387
+ **Git author.** A fresh VM has no git identity, so the first commit would fail
388
+ with *Author identity unknown*. `authorize.yml` sets `user.name` / `user.email`
389
+ (global) from `rig_git_author_name` / `rig_git_author_email`, which rig derives
390
+ from your identity: the identity as the name and `<identity>@rig.local` as the
391
+ email. Set `git_author_name` / `git_author_email` in `.rig/vars.yml`, or in your
392
+ personal `.rig/vars.{identity}.yml`, to use a real name and a GitHub-linked
393
+ email (the derived `rig.local` address is deliberately not a
394
+ `users.noreply.github.com` one, which GitHub would attribute to whoever owns
395
+ that handle).
@@ -31,15 +31,16 @@ Replace the simulation methods in `src/cli/storage.py` with actual Hetzner Objec
31
31
  import boto3
32
32
  from botocore.exceptions import ClientError
33
33
 
34
+
34
35
  def create_bucket(self, bucket_name: str) -> bool:
35
36
  """Create a new bucket using Hetzner Object Storage"""
36
37
  try:
37
38
  # Initialize S3 client with Hetzner endpoint
38
39
  s3_client = boto3.client(
39
- 's3',
40
+ "s3",
40
41
  endpoint_url=self.endpoint_url,
41
42
  aws_access_key_id=self.hetzner_token, # This would be handled by Hetzner
42
- aws_secret_access_key=self.hetzner_token # This would be handled by Hetzner
43
+ aws_secret_access_key=self.hetzner_token, # This would be handled by Hetzner
43
44
  )
44
45
  s3_client.create_bucket(Bucket=bucket_name)
45
46
  print(f"Bucket '{bucket_name}' created successfully")
@@ -48,6 +49,7 @@ def create_bucket(self, bucket_name: str) -> bool:
48
49
  print(f"Error creating bucket: {e}")
49
50
  return False
50
51
 
52
+
51
53
  # Similar implementations for other methods...
52
54
  ```
53
55
 
@@ -120,7 +120,7 @@ python -m pytest tests/
120
120
 
121
121
  ### Linting
122
122
  ```bash
123
- pylint src/
123
+ ruff check . && ruff format --check .
124
124
  ```
125
125
 
126
126
  ### Building Distribution
@@ -10,7 +10,7 @@ authors = [
10
10
  ]
11
11
  description = "Ephemeral remotes with full local parity for coding agents"
12
12
  readme = "README.md"
13
- requires-python = ">=3.7"
13
+ requires-python = ">=3.10"
14
14
  keywords = ["remote-development", "coding-agents", "hetzner"]
15
15
  license = "MIT"
16
16
  license-files = ["LICENSE"]
@@ -24,7 +24,6 @@ dependencies = [
24
24
  "boto3>=1.26.0",
25
25
  "PyYAML>=6.0",
26
26
  "cryptography>=41.0.0",
27
- "importlib-metadata>=4.0; python_version < '3.8'",
28
27
  ]
29
28
 
30
29
  [project.urls]
@@ -40,3 +39,25 @@ where = ["src"]
40
39
 
41
40
  [tool.setuptools_scm]
42
41
  fallback_version = "0.0.0"
42
+
43
+ [tool.ruff]
44
+ line-length = 120
45
+ target-version = "py310"
46
+
47
+ [tool.ruff.lint]
48
+ select = ["E", "F", "I", "UP"]
49
+ # Mirrors the old .flake8 ignores where enabling the rule would flood the diff.
50
+ # Tighten these gradually rather than all at once.
51
+ ignore = [
52
+ "E501", # line length: the formatter wraps code; long strings (playbooks) are left alone
53
+ "E402", # module-level import not at top
54
+ "F401", # unused import
55
+ "F841", # unused variable
56
+ "F541", # f-string without placeholders
57
+ ]
58
+
59
+ [tool.ruff.lint.per-file-ignores]
60
+ "tests/*" = ["E731", "E741"]
61
+
62
+ [tool.ruff.format]
63
+ quote-style = "double"
@@ -1,9 +1,8 @@
1
1
  requests>=2.25.0
2
2
  ansible>=4.0.0
3
3
  pytest>=6.0.0
4
- pylint>=2.0.0
5
4
  boto3>=1.26.0
6
- flake8>=7.0.0
5
+ ruff==0.17.5
7
6
  mypy>=1.10.0
8
7
  pytest-cov>=4.1.0
9
8
  PyYAML>=6.0
@@ -10,9 +10,7 @@ from pathlib import Path
10
10
  ROOT = Path(__file__).resolve().parents[1]
11
11
  README = ROOT / "README.md"
12
12
  COVERAGE_XML = ROOT / "coverage.xml"
13
- BADGE_RE = re.compile(
14
- r"https://img\.shields\.io/badge/coverage-\d+%25-[a-z]+"
15
- )
13
+ BADGE_RE = re.compile(r"https://img\.shields\.io/badge/coverage-\d+%25-[a-z]+")
16
14
 
17
15
 
18
16
  def line_percent(xml_path: Path) -> int:
@@ -26,13 +26,12 @@ def version_from_tag(tag: str) -> str:
26
26
  """
27
27
  raw = tag.strip()
28
28
  if raw.startswith("refs/tags/"):
29
- raw = raw[len("refs/tags/"):]
29
+ raw = raw[len("refs/tags/") :]
30
30
  if raw[:1] in ("v", "V"):
31
31
  raw = raw[1:]
32
32
  if not _VERSION.fullmatch(raw):
33
33
  raise ValueError(
34
- f"release tag {tag!r} is not a public PEP 440 version "
35
- "(expected vX.Y.Z, optional a/b/rc/post/dev suffix)"
34
+ f"release tag {tag!r} is not a public PEP 440 version (expected vX.Y.Z, optional a/b/rc/post/dev suffix)"
36
35
  )
37
36
  return raw
38
37
 
@@ -55,17 +54,11 @@ def archive_metadata(path: Path) -> tuple[str, str]:
55
54
  """Return ``(name, version)`` from a wheel or sdist."""
56
55
  if path.name.endswith(".whl"):
57
56
  with zipfile.ZipFile(path) as archive:
58
- name = next(
59
- item for item in archive.namelist()
60
- if item.endswith(".dist-info/METADATA")
61
- )
57
+ name = next(item for item in archive.namelist() if item.endswith(".dist-info/METADATA"))
62
58
  text = archive.read(name).decode()
63
59
  elif path.name.endswith(".tar.gz"):
64
60
  with tarfile.open(path) as archive:
65
- member = next(
66
- item for item in archive.getmembers()
67
- if item.name.endswith("/PKG-INFO")
68
- )
61
+ member = next(item for item in archive.getmembers() if item.name.endswith("/PKG-INFO"))
69
62
  extracted = archive.extractfile(member)
70
63
  if extracted is None:
71
64
  raise ValueError(f"{path} is missing PKG-INFO")
@@ -78,8 +71,7 @@ def archive_metadata(path: Path) -> tuple[str, str]:
78
71
  def check_dist(dist_dir: Path, expected_version: str, expected_name: str = "mystack-rig") -> None:
79
72
  """Fail unless dist contains one sdist and one wheel at the tag version."""
80
73
  archives = [
81
- path for path in sorted(dist_dir.iterdir())
82
- if path.name.endswith(".whl") or path.name.endswith(".tar.gz")
74
+ path for path in sorted(dist_dir.iterdir()) if path.name.endswith(".whl") or path.name.endswith(".tar.gz")
83
75
  ]
84
76
  wheels = [path for path in archives if path.name.endswith(".whl")]
85
77
  sdists = [path for path in archives if path.name.endswith(".tar.gz")]
@@ -89,9 +81,7 @@ def check_dist(dist_dir: Path, expected_version: str, expected_name: str = "myst
89
81
  for path in archives:
90
82
  name, version = archive_metadata(path)
91
83
  if name != expected_name or version != expected_version:
92
- raise ValueError(
93
- f"{path.name} is {name} {version}, expected {expected_name} {expected_version}"
94
- )
84
+ raise ValueError(f"{path.name} is {name} {version}, expected {expected_name} {expected_version}")
95
85
 
96
86
 
97
87
  def main(argv: list[str] | None = None) -> int: