mystack-rig 1.3.1__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 (112) hide show
  1. mystack_rig-1.3.2/.git-blame-ignore-revs +7 -0
  2. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/.github/workflows/tests.yml +7 -6
  3. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/CLI_STORAGE_SUMMARY.md +1 -1
  4. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/HETZNER_STORAGE_GUIDE.md +1 -1
  5. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/Makefile +11 -2
  6. {mystack_rig-1.3.1/src/mystack_rig.egg-info → mystack_rig-1.3.2}/PKG-INFO +15 -3
  7. mystack_rig-1.3.1/PKG-INFO → mystack_rig-1.3.2/README.md +13 -23
  8. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/README_REAL_E2E.md +4 -2
  9. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/STORAGE_CLI_GUIDE.md +1 -1
  10. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/pyproject.toml +23 -2
  11. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/requirements.txt +1 -2
  12. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/scripts/coverage_badge.py +1 -3
  13. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/scripts/pypi_version.py +6 -16
  14. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/agents.py +39 -58
  15. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/ansible_filters/rig_mcp.py +32 -44
  16. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/config.py +16 -26
  17. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/encrypt.py +106 -160
  18. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/git.py +131 -123
  19. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/git_author.py +5 -4
  20. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/last_env.py +4 -4
  21. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/last_session.py +12 -12
  22. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/log.py +3 -3
  23. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/main.py +57 -93
  24. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/mcp.py +46 -38
  25. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/outputs.py +14 -13
  26. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/remote_dev.py +780 -815
  27. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/snapshots.py +75 -107
  28. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/state_bucket.py +8 -10
  29. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/storage.py +26 -27
  30. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/vault_keys.py +28 -32
  31. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/vpn.py +84 -135
  32. mystack_rig-1.3.1/README.md → mystack_rig-1.3.2/src/mystack_rig.egg-info/PKG-INFO +35 -0
  33. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/SOURCES.txt +2 -1
  34. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/requires.txt +0 -3
  35. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/scm_file_list.json +2 -1
  36. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/scm_version.json +2 -2
  37. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/test_hetzner_integration.py +98 -113
  38. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/conftest.py +29 -34
  39. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_agents.py +8 -24
  40. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_attach_command.py +141 -118
  41. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_credential_security.py +14 -13
  42. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_destroy_command.py +42 -34
  43. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_dev_command.py +61 -70
  44. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_encrypt_command.py +32 -26
  45. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_encrypt_coverage.py +42 -31
  46. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_firewall_client_ip.py +10 -21
  47. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_git_clone_unit.py +128 -128
  48. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_git_credentials_and_author.py +7 -6
  49. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_git_manager.py +1 -3
  50. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_gitignore_init.py +1 -3
  51. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_hetzner_storage.py +31 -37
  52. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_init_command.py +40 -61
  53. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_inspect_describe.py +30 -12
  54. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_main_coverage.py +165 -147
  55. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_mcp_command.py +33 -21
  56. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_mcp_render.py +10 -9
  57. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_outputs.py +5 -8
  58. {mystack_rig-1.3.1 → 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.1 → mystack_rig-1.3.2}/tests/test_real_e2e_integration.py +33 -47
  61. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_real_e2e_storage.py +38 -39
  62. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_real_e2e_vpn.py +27 -23
  63. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_real_e2e_vpn_tunnel.py +45 -39
  64. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_remote_dev.py +145 -163
  65. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_remote_dev_coverage_extensions.py +143 -120
  66. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_rig_ansible_vars.py +4 -5
  67. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_rig_config.py +30 -22
  68. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_secret_prompt_hidden.py +6 -3
  69. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_setup_provision.py +127 -77
  70. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_simulation_storage.py +69 -76
  71. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_snapshots.py +81 -73
  72. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_state_bucket.py +9 -16
  73. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_storage_basic.py +97 -109
  74. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_vault_keys.py +1 -4
  75. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_vpn_optional.py +13 -9
  76. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_vpn_unit.py +5 -10
  77. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_workspace_git_clone.py +91 -102
  78. mystack_rig-1.3.1/.flake8 +0 -5
  79. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/.coveragerc +0 -0
  80. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/.github/workflows/release.yml +0 -0
  81. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/.gitignore +0 -0
  82. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/.rig/playbooks/README.md +0 -0
  83. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/.rig/playbooks/vpn-gateway.yml +0 -0
  84. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/Dockerfile +0 -0
  85. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/GIT_CLONE_FEATURE.md +0 -0
  86. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/GLOSSARY.md +0 -0
  87. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/HETZNER_STORAGE_SECURITY_GUIDE.md +0 -0
  88. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/LICENSE +0 -0
  89. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/docs/adr/0001-per-profile-generated-state-bucket.md +0 -0
  90. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/docs/adr/0002-outputs-as-separate-object-via-file-handoff.md +0 -0
  91. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/docs/adr/0003-mcp-servers-declared-once-rendered-at-authorize.md +0 -0
  92. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/docs/architecture.md +0 -0
  93. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/docs/architecture.png +0 -0
  94. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/docs/architecture.svg +0 -0
  95. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/forged-idea.md +0 -0
  96. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/pytest.ini +0 -0
  97. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/sample.env +0 -0
  98. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/setup.cfg +0 -0
  99. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/__init__.py +0 -0
  100. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/__init__.py +0 -0
  101. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/__main__.py +0 -0
  102. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/ansible_filters/__init__.py +0 -0
  103. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/cli/requirements.txt +0 -0
  104. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/dependency_links.txt +0 -0
  105. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/entry_points.txt +0 -0
  106. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/src/mystack_rig.egg-info/top_level.txt +0 -0
  107. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_ansible_galaxy.py +0 -0
  108. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_last_env.py +0 -0
  109. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_last_session.py +0 -0
  110. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_log.py +0 -0
  111. {mystack_rig-1.3.1 → mystack_rig-1.3.2}/tests/test_pypi_version.py +0 -0
  112. {mystack_rig-1.3.1 → 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.1
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
 
@@ -356,6 +357,17 @@ pip install -e .
356
357
  rig --version
357
358
  ```
358
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
+
359
371
  ## Tests
360
372
 
361
373
  ```bash
@@ -1,29 +1,8 @@
1
- Metadata-Version: 2.4
2
- Name: mystack-rig
3
- Version: 1.3.1
4
- Summary: Ephemeral remotes with full local parity for coding agents
5
- Author: mystack-cloud
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/mystack-cloud/rig
8
- Project-URL: Source, https://github.com/mystack-cloud/rig
9
- Project-URL: Issues, https://github.com/mystack-cloud/rig/issues
10
- Keywords: remote-development,coding-agents,hetzner
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.7
14
- Description-Content-Type: text/markdown
15
- License-File: LICENSE
16
- Requires-Dist: requests>=2.25.0
17
- Requires-Dist: ansible>=4.0.0
18
- Requires-Dist: boto3>=1.26.0
19
- Requires-Dist: PyYAML>=6.0
20
- Requires-Dist: cryptography>=41.0.0
21
- Requires-Dist: importlib-metadata>=4.0; python_version < "3.8"
22
- Dynamic: license-file
23
-
24
1
  [![PyPI](https://img.shields.io/pypi/v/mystack-rig)](https://pypi.org/project/mystack-rig/)
25
2
  [![Tests](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml/badge.svg)](https://github.com/mystack-cloud/rig/actions/workflows/tests.yml)
26
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)
27
6
 
28
7
  # rig
29
8
 
@@ -356,6 +335,17 @@ pip install -e .
356
335
  rig --version
357
336
  ```
358
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
+
359
349
  ## Tests
360
350
 
361
351
  ```bash
@@ -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:
@@ -16,7 +16,8 @@ from __future__ import annotations
16
16
 
17
17
  import json
18
18
  import os
19
- from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
19
+ from collections.abc import Callable, Sequence
20
+ from typing import Any, Optional
20
21
 
21
22
  SUPPORTED_AGENTS = ("opencode", "claude", "cursor")
22
23
 
@@ -94,19 +95,18 @@ OPENCODE_CONFIG_WITH_API_KEY = {
94
95
  OPENCODE_CONFIG = OPENCODE_CONFIG_FREE
95
96
 
96
97
 
97
- def opencode_config(has_api_key: bool = False) -> Dict[str, Any]:
98
+ def opencode_config(has_api_key: bool = False) -> dict[str, Any]:
98
99
  """Return OpenCode config for free models or a keyed Anthropic provider."""
99
100
  import copy
100
- return copy.deepcopy(
101
- OPENCODE_CONFIG_WITH_API_KEY if has_api_key else OPENCODE_CONFIG_FREE
102
- )
101
+
102
+ return copy.deepcopy(OPENCODE_CONFIG_WITH_API_KEY if has_api_key else OPENCODE_CONFIG_FREE)
103
103
 
104
104
 
105
105
  def sync_opencode_config(
106
106
  rig_dir: str,
107
107
  has_api_key: bool = False,
108
108
  force: bool = False,
109
- ) -> Optional[str]:
109
+ ) -> str | None:
110
110
  """
111
111
  Write ``.rig/.opencode/opencode.json`` for free or keyed usage.
112
112
 
@@ -120,6 +120,7 @@ def sync_opencode_config(
120
120
  _write_json(config_path, opencode_config(has_api_key=has_api_key))
121
121
  return ".rig/.opencode/opencode.json"
122
122
 
123
+
123
124
  CLAUDE_SETTINGS = {
124
125
  # Bare tool names allow every path; "Tool(*)" warns on recent Claude Code.
125
126
  "permissions": {
@@ -139,7 +140,7 @@ CLAUDE_SETTINGS = {
139
140
  }
140
141
 
141
142
  # Cursor CLI (~/.cursor/cli-config.json). API key via CURSOR_API_KEY on the VM.
142
- CURSOR_CLI_CONFIG: Dict[str, Any] = {
143
+ CURSOR_CLI_CONFIG: dict[str, Any] = {
143
144
  "permissions": {
144
145
  "allow": [
145
146
  "Shell(*)",
@@ -149,7 +150,8 @@ CURSOR_CLI_CONFIG: Dict[str, Any] = {
149
150
  },
150
151
  }
151
152
 
152
- def normalize_agent_type(value: Optional[str]) -> str:
153
+
154
+ def normalize_agent_type(value: str | None) -> str:
153
155
  raw = (value or "").strip().lower().replace(" ", "-").replace("_", "-")
154
156
  aliases = {
155
157
  "opencode": "opencode",
@@ -163,10 +165,7 @@ def normalize_agent_type(value: Optional[str]) -> str:
163
165
  }
164
166
  agent = aliases.get(raw, raw)
165
167
  if agent not in SUPPORTED_AGENTS:
166
- raise ValueError(
167
- f"Unsupported coding agent {value!r}. "
168
- f"Choose one of: {', '.join(SUPPORTED_AGENTS)}"
169
- )
168
+ raise ValueError(f"Unsupported coding agent {value!r}. Choose one of: {', '.join(SUPPORTED_AGENTS)}")
170
169
  return agent
171
170
 
172
171
 
@@ -179,7 +178,7 @@ def agent_config_dir_name(agent_type: str) -> str:
179
178
  return ".claude"
180
179
 
181
180
 
182
- def agent_remote_paths(agent_type: str) -> Dict[str, str]:
181
+ def agent_remote_paths(agent_type: str) -> dict[str, str]:
183
182
  """Where scaffolded files land on the remote VM (as root)."""
184
183
  agent = normalize_agent_type(agent_type)
185
184
  if agent == "opencode":
@@ -207,7 +206,7 @@ def agent_remote_paths(agent_type: str) -> Dict[str, str]:
207
206
  }
208
207
 
209
208
 
210
- def _write_json(path: str, data: Dict[str, Any]) -> None:
209
+ def _write_json(path: str, data: dict[str, Any]) -> None:
211
210
  os.makedirs(os.path.dirname(path), exist_ok=True)
212
211
  with open(path, "w", encoding="utf-8") as handle:
213
212
  json.dump(data, handle, indent=2)
@@ -225,7 +224,7 @@ def ensure_agent_scaffold(
225
224
  agent_type: str = "opencode",
226
225
  force: bool = False,
227
226
  has_api_key: bool = False,
228
- ) -> List[str]:
227
+ ) -> list[str]:
229
228
  """
230
229
  Create missing agent config / MCP / AGENTS.md under ``rig_dir``.
231
230
 
@@ -234,7 +233,7 @@ def ensure_agent_scaffold(
234
233
  Returns the list of paths that were created (relative to rig_dir parent).
235
234
  """
236
235
  agent = normalize_agent_type(agent_type)
237
- created: List[str] = []
236
+ created: list[str] = []
238
237
  rig_dir = os.path.abspath(rig_dir)
239
238
 
240
239
  agents_md = os.path.join(rig_dir, "AGENTS.md")
@@ -243,9 +242,7 @@ def ensure_agent_scaffold(
243
242
  created.append(os.path.join(".rig", "AGENTS.md"))
244
243
 
245
244
  if agent == "opencode":
246
- written = sync_opencode_config(
247
- rig_dir, has_api_key=has_api_key, force=force
248
- )
245
+ written = sync_opencode_config(rig_dir, has_api_key=has_api_key, force=force)
249
246
  if written:
250
247
  created.append(written)
251
248
  elif agent == "cursor":
@@ -266,7 +263,7 @@ def ensure_agent_scaffold(
266
263
 
267
264
  def prompt_coding_agent(
268
265
  default: str = "opencode",
269
- input_fn: Optional[Callable[..., str]] = None,
266
+ input_fn: Callable[..., str] | None = None,
270
267
  ) -> str:
271
268
  """Ask which coding agent to use (single choice)."""
272
269
  ask = input_fn or input
@@ -281,7 +278,7 @@ def prompt_coding_agent(
281
278
  return normalize_agent_type(answer)
282
279
 
283
280
 
284
- def coerce_agent_types(value: Any) -> List[str]:
281
+ def coerce_agent_types(value: Any) -> list[str]:
285
282
  """
286
283
  Normalize a string, comma-separated string, or list into agent ids.
287
284
 
@@ -306,7 +303,7 @@ def coerce_agent_types(value: Any) -> List[str]:
306
303
  text = str(value).strip()
307
304
  parts = [text] if text else []
308
305
 
309
- selected: List[str] = []
306
+ selected: list[str] = []
310
307
  seen = set()
311
308
  for part in parts:
312
309
  agent = normalize_agent_type(part)
@@ -316,7 +313,7 @@ def coerce_agent_types(value: Any) -> List[str]:
316
313
  return selected
317
314
 
318
315
 
319
- def agent_default_field(agent_cfg: Optional[Dict[str, Any]] = None) -> Any:
316
+ def agent_default_field(agent_cfg: dict[str, Any] | None = None) -> Any:
320
317
  """``agent.default``, or the legacy ``agent.type`` string."""
321
318
  agent_cfg = agent_cfg or {}
322
319
  raw = agent_cfg.get("default")
@@ -325,7 +322,7 @@ def agent_default_field(agent_cfg: Optional[Dict[str, Any]] = None) -> Any:
325
322
  return agent_cfg.get("type")
326
323
 
327
324
 
328
- def agent_enabled_field(agent_cfg: Optional[Dict[str, Any]] = None) -> Any:
325
+ def agent_enabled_field(agent_cfg: dict[str, Any] | None = None) -> Any:
329
326
  """``agent.enabled``, or the legacy ``agent.types`` list."""
330
327
  agent_cfg = agent_cfg or {}
331
328
  if agent_cfg.get("enabled"):
@@ -334,11 +331,11 @@ def agent_enabled_field(agent_cfg: Optional[Dict[str, Any]] = None) -> Any:
334
331
 
335
332
 
336
333
  def resolve_configured_agents(
337
- agent_cfg: Optional[Dict[str, Any]] = None,
334
+ agent_cfg: dict[str, Any] | None = None,
338
335
  *,
339
336
  coding_agent_type: Any = None,
340
337
  coding_agent_types: Any = None,
341
- ) -> Tuple[List[str], str]:
338
+ ) -> tuple[list[str], str]:
342
339
  """
343
340
  Return ``(installed_agents, default_attach_agent)``.
344
341
 
@@ -347,7 +344,7 @@ def resolve_configured_agents(
347
344
  Legacy ``agent.types`` and ``agent.type`` are still accepted.
348
345
  """
349
346
  agent_cfg = agent_cfg or {}
350
- types: List[str] = []
347
+ types: list[str] = []
351
348
  for candidate in (agent_enabled_field(agent_cfg), coding_agent_types):
352
349
  if not candidate:
353
350
  continue
@@ -372,7 +369,7 @@ def resolve_configured_agents(
372
369
  if not types:
373
370
  types = ["opencode"]
374
371
 
375
- primary: Optional[str] = None
372
+ primary: str | None = None
376
373
  raw_primary = agent_default_field(agent_cfg)
377
374
  if isinstance(raw_primary, str) and raw_primary.strip():
378
375
  try:
@@ -385,10 +382,10 @@ def resolve_configured_agents(
385
382
 
386
383
 
387
384
  def apply_agent_selection(
388
- agent_cfg: Dict[str, Any],
385
+ agent_cfg: dict[str, Any],
389
386
  agent_types: Sequence[str],
390
387
  default: Any = None,
391
- ) -> List[str]:
388
+ ) -> list[str]:
392
389
  """
393
390
  Write ``default``, ``enabled``, and credential var names onto an agent config dict.
394
391
 
@@ -398,7 +395,7 @@ def apply_agent_selection(
398
395
  Several agents each get their own vault var under ``credentials``.
399
396
  """
400
397
  selected = coerce_agent_types(agent_types) or ["opencode"]
401
- primary: Optional[str] = None
398
+ primary: str | None = None
402
399
  if isinstance(default, str) and default.strip():
403
400
  try:
404
401
  primary = normalize_agent_type(default)
@@ -414,9 +411,7 @@ def apply_agent_selection(
414
411
  agent_cfg["credentials_var"] = LEGACY_CODING_AGENT_API_KEY
415
412
  agent_cfg.pop("credentials", None)
416
413
  else:
417
- agent_cfg["credentials"] = {
418
- agent: AGENT_API_KEY_VARS[agent] for agent in selected
419
- }
414
+ agent_cfg["credentials"] = {agent: AGENT_API_KEY_VARS[agent] for agent in selected}
420
415
  agent_cfg["credentials_var"] = AGENT_API_KEY_VARS[primary]
421
416
  return selected
422
417
 
@@ -425,7 +420,7 @@ def parse_agent_selection(
425
420
  answer: str,
426
421
  *,
427
422
  default: Sequence[str],
428
- ) -> List[str]:
423
+ ) -> list[str]:
429
424
  """Parse 'all', indexes, or names the same way git project selection works."""
430
425
  try:
431
426
  defaults = coerce_agent_types(list(default)) or ["opencode"]
@@ -437,7 +432,7 @@ def parse_agent_selection(
437
432
  if raw.lower() in ("all", "*"):
438
433
  return list(SUPPORTED_AGENTS)
439
434
 
440
- selected: List[str] = []
435
+ selected: list[str] = []
441
436
  seen = set()
442
437
  tokens = [token.strip() for token in raw.replace(" ", ",").split(",") if token.strip()]
443
438
  if not tokens:
@@ -447,8 +442,7 @@ def parse_agent_selection(
447
442
  index = int(token) - 1
448
443
  if not 0 <= index < len(SUPPORTED_AGENTS):
449
444
  raise ValueError(
450
- f"Coding agent number {token} is out of range. "
451
- f"Choose 1-{len(SUPPORTED_AGENTS)}, names, or all."
445
+ f"Coding agent number {token} is out of range. Choose 1-{len(SUPPORTED_AGENTS)}, names, or all."
452
446
  )
453
447
  agent = SUPPORTED_AGENTS[index]
454
448
  else:
@@ -461,8 +455,8 @@ def parse_agent_selection(
461
455
 
462
456
  def prompt_coding_agents(
463
457
  default: Any = "opencode",
464
- input_fn: Optional[Callable[..., str]] = None,
465
- ) -> List[str]:
458
+ input_fn: Callable[..., str] | None = None,
459
+ ) -> list[str]:
466
460
  """
467
461
  Ask which coding agents to install.
468
462
 
@@ -478,17 +472,14 @@ def prompt_coding_agents(
478
472
  for index, agent in enumerate(SUPPORTED_AGENTS, start=1):
479
473
  print(f" {index}. {agent} ({AGENT_LABELS[agent]})")
480
474
  default_label = ",".join(defaults)
481
- answer = ask(
482
- "Coding agents to include (numbers, names, or all) "
483
- f"[{default_label}]: "
484
- )
475
+ answer = ask(f"Coding agents to include (numbers, names, or all) [{default_label}]: ")
485
476
  return parse_agent_selection(answer, default=defaults)
486
477
 
487
478
 
488
479
  def prompt_default_agent(
489
480
  selected: Sequence[str],
490
481
  default: Any = None,
491
- input_fn: Optional[Callable[..., str]] = None,
482
+ input_fn: Callable[..., str] | None = None,
492
483
  ) -> str:
493
484
  """
494
485
  Ask which selected agent ``rig attach`` should open.
@@ -507,11 +498,7 @@ def prompt_default_agent(
507
498
  candidate = None
508
499
  if candidate in agents:
509
500
  preferred = candidate
510
- by_number = {
511
- str(index): agent
512
- for index, agent in enumerate(SUPPORTED_AGENTS, start=1)
513
- if agent in agents
514
- }
501
+ by_number = {str(index): agent for index, agent in enumerate(SUPPORTED_AGENTS, start=1) if agent in agents}
515
502
  print("Default agent for rig attach:")
516
503
  for number, agent in by_number.items():
517
504
  print(f" {number}. {agent} ({AGENT_LABELS[agent]})")
@@ -522,15 +509,9 @@ def prompt_default_agent(
522
509
  if answer.isdigit():
523
510
  numbered = by_number.get(answer)
524
511
  if not numbered:
525
- raise ValueError(
526
- f"Default agent number {answer} is not one of the selected agents "
527
- f"({', '.join(agents)})"
528
- )
512
+ raise ValueError(f"Default agent number {answer} is not one of the selected agents ({', '.join(agents)})")
529
513
  return numbered
530
514
  chosen = normalize_agent_type(answer)
531
515
  if chosen not in agents:
532
- raise ValueError(
533
- f"Default agent {chosen!r} was not selected. "
534
- f"Choose one of: {', '.join(agents)}"
535
- )
516
+ raise ValueError(f"Default agent {chosen!r} was not selected. Choose one of: {', '.join(agents)}")
536
517
  return chosen