avr-cli 0.4.1__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. {avr_cli-0.4.1 → avr_cli-0.6.0}/PKG-INFO +154 -11
  2. avr_cli-0.6.0/README.md +450 -0
  3. {avr_cli-0.4.1 → avr_cli-0.6.0}/avr_cli.egg-info/PKG-INFO +154 -11
  4. {avr_cli-0.4.1 → avr_cli-0.6.0}/avr_cli.egg-info/SOURCES.txt +28 -0
  5. {avr_cli-0.4.1 → avr_cli-0.6.0}/avr_cli.egg-info/requires.txt +4 -1
  6. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/_build_info.py +1 -1
  7. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/api_client.py +50 -4
  8. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/auth.py +7 -0
  9. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/billing.py +2 -2
  10. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/click_ext.py +21 -0
  11. avr_cli-0.6.0/avrea_cli/commands/artifact.py +272 -0
  12. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/auth_cmd.py +136 -10
  13. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/config_cmd.py +20 -2
  14. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/job.py +143 -99
  15. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/org.py +597 -24
  16. avr_cli-0.6.0/avrea_cli/commands/org_install_runner.py +404 -0
  17. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/repo.py +332 -54
  18. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/run.py +213 -116
  19. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/sbom.py +164 -39
  20. avr_cli-0.6.0/avrea_cli/commands/tests.py +352 -0
  21. avr_cli-0.6.0/avrea_cli/commands/token.py +553 -0
  22. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/workflow.py +86 -17
  23. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/config.py +11 -5
  24. avr_cli-0.6.0/avrea_cli/device_auth.py +247 -0
  25. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/display.py +27 -4
  26. avr_cli-0.6.0/avrea_cli/git_mirror.py +236 -0
  27. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/helpers.py +175 -23
  28. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/json_output.py +51 -14
  29. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/log_display.py +24 -6
  30. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/main.py +14 -4
  31. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/metrics_display.py +88 -3
  32. avr_cli-0.6.0/avrea_cli/metrics_stream.py +121 -0
  33. avr_cli-0.6.0/avrea_cli/native_dispatch.py +276 -0
  34. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/output.py +3 -3
  35. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/repo_context.py +144 -70
  36. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/run_diagnostics.py +1 -1
  37. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/run_refs.py +136 -21
  38. avr_cli-0.6.0/avrea_cli/spawn_script.py +89 -0
  39. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/transport.py +9 -2
  40. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/vm.py +664 -230
  41. avr_cli-0.6.0/avrea_cli/vm_state_stream.py +80 -0
  42. {avr_cli-0.4.1 → avr_cli-0.6.0}/pyproject.toml +6 -2
  43. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_api_client.py +21 -0
  44. avr_cli-0.6.0/tests/test_artifact.py +164 -0
  45. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_auth_sso.py +6 -0
  46. avr_cli-0.6.0/tests/test_billing.py +62 -0
  47. avr_cli-0.6.0/tests/test_compatible_lazy_imports.py +47 -0
  48. avr_cli-0.6.0/tests/test_device_auth.py +690 -0
  49. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_display.py +2 -3
  50. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_env_conventions.py +57 -0
  51. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_helpers.py +61 -1
  52. avr_cli-0.6.0/tests/test_job_gitlab.py +37 -0
  53. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_job_list.py +11 -0
  54. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_job_metrics_cmd.py +131 -73
  55. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_log_display.py +34 -0
  56. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_metrics_display.py +22 -0
  57. avr_cli-0.6.0/tests/test_metrics_stream.py +265 -0
  58. avr_cli-0.6.0/tests/test_native_ci.py +263 -0
  59. avr_cli-0.6.0/tests/test_native_workflow_dispatch.py +417 -0
  60. avr_cli-0.6.0/tests/test_org_install_runners.py +307 -0
  61. avr_cli-0.6.0/tests/test_org_installations.py +720 -0
  62. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_piped_output.py +5 -0
  63. avr_cli-0.6.0/tests/test_repo_clone.py +993 -0
  64. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_repo_context.py +49 -15
  65. avr_cli-0.6.0/tests/test_repo_mirror.py +623 -0
  66. avr_cli-0.6.0/tests/test_run_attempts.py +666 -0
  67. avr_cli-0.6.0/tests/test_run_command_refs.py +249 -0
  68. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_run_diagnose.py +20 -18
  69. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_run_logs.py +11 -11
  70. avr_cli-0.6.0/tests/test_run_refs.py +350 -0
  71. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_run_view.py +133 -28
  72. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_sbom.py +365 -5
  73. avr_cli-0.6.0/tests/test_scoped_token.py +519 -0
  74. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_settings.py +12 -19
  75. avr_cli-0.6.0/tests/test_tests.py +576 -0
  76. avr_cli-0.6.0/tests/test_token.py +774 -0
  77. avr_cli-0.6.0/tests/test_token_output.py +534 -0
  78. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_transport.py +5 -3
  79. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_vm.py +52 -110
  80. avr_cli-0.6.0/tests/test_vm_alignment.py +358 -0
  81. avr_cli-0.6.0/tests/test_vm_spawn_script.py +190 -0
  82. avr_cli-0.6.0/tests/test_vm_state_stream.py +66 -0
  83. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_web_flag.py +10 -8
  84. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_workflow_actions.py +34 -10
  85. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_workflow_run.py +37 -5
  86. avr_cli-0.4.1/README.md +0 -311
  87. avr_cli-0.4.1/tests/test_repo_mirror.py +0 -310
  88. avr_cli-0.4.1/tests/test_run_attempts.py +0 -357
  89. avr_cli-0.4.1/tests/test_run_command_refs.py +0 -122
  90. avr_cli-0.4.1/tests/test_run_refs.py +0 -174
  91. {avr_cli-0.4.1 → avr_cli-0.6.0}/LICENSE +0 -0
  92. {avr_cli-0.4.1 → avr_cli-0.6.0}/avr_cli.egg-info/dependency_links.txt +0 -0
  93. {avr_cli-0.4.1 → avr_cli-0.6.0}/avr_cli.egg-info/entry_points.txt +0 -0
  94. {avr_cli-0.4.1 → avr_cli-0.6.0}/avr_cli.egg-info/top_level.txt +0 -0
  95. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/__init__.py +0 -0
  96. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/assets/logo_mark.svg +0 -0
  97. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/audit.py +0 -0
  98. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/__init__.py +0 -0
  99. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/cache.py +0 -0
  100. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/health.py +0 -0
  101. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/internal.py +0 -0
  102. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/log.py +0 -0
  103. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/pr.py +0 -0
  104. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/settings.py +0 -0
  105. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/commands/status.py +0 -0
  106. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/docs_gen.py +0 -0
  107. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/firewall.py +0 -0
  108. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/paths.py +0 -0
  109. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/run_diagnostics_display.py +0 -0
  110. {avr_cli-0.4.1 → avr_cli-0.6.0}/avrea_cli/version.py +0 -0
  111. {avr_cli-0.4.1 → avr_cli-0.6.0}/setup.cfg +0 -0
  112. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_auth.py +0 -0
  113. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_auth_login.py +0 -0
  114. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_cache.py +0 -0
  115. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_config.py +0 -0
  116. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_config_cmd.py +0 -0
  117. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_docs_gen.py +0 -0
  118. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_firewall.py +0 -0
  119. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_global_flags.py +0 -0
  120. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_job_view_logs.py +0 -0
  121. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_json_output.py +0 -0
  122. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_lazy_registry.py +0 -0
  123. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_org_email_domain.py +0 -0
  124. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_org_saml.py +0 -0
  125. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_output.py +0 -0
  126. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_pr_list.py +0 -0
  127. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_public_mirrors.py +0 -0
  128. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_run_list_flags.py +0 -0
  129. {avr_cli-0.4.1 → avr_cli-0.6.0}/tests/test_workflow_view.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: avr-cli
3
- Version: 0.4.1
3
+ Version: 0.6.0
4
4
  Summary: Avrea command-line client
5
5
  Author-email: Avrea <support@avrea.com>
6
6
  License-Expression: Apache-2.0
@@ -11,22 +11,26 @@ Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: Topic :: Software Development :: Libraries
13
13
  Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: Python :: 3.15
14
15
  Requires-Python: >=3.14
15
16
  Description-Content-Type: text/markdown
16
17
  License-File: LICENSE
17
18
  Requires-Dist: anyio>=4.14.2
19
+ Requires-Dist: certifi>=2026.10.19
18
20
  Requires-Dist: click>=8.3.1
19
21
  Requires-Dist: httpx>=0.28.1
20
22
  Requires-Dist: platformdirs>=4.0
21
23
  Requires-Dist: prettytable>=3.17.0
24
+ Requires-Dist: segno>=1.6.6
22
25
  Requires-Dist: pydantic>=2.12.4
23
26
  Requires-Dist: typing-extensions>=4.15.0
24
27
  Requires-Dist: idna>=3.15
28
+ Requires-Dist: websockets>=15
25
29
  Provides-Extra: dev
26
30
  Requires-Dist: pytest>=9.0.3; extra == "dev"
27
31
  Requires-Dist: pytest-asyncio>=1.3.0; extra == "dev"
28
32
  Requires-Dist: pytest-timeout>=2.4.0; extra == "dev"
29
- Requires-Dist: ruff==0.15.13; extra == "dev"
33
+ Requires-Dist: ruff==0.17.3; extra == "dev"
30
34
  Requires-Dist: ty==0.0.15; extra == "dev"
31
35
  Dynamic: license-file
32
36
 
@@ -88,6 +92,19 @@ Browser-based login (recommended):
88
92
  avr auth login
89
93
  ```
90
94
 
95
+ On a remote machine, VM, or terminal without a browser:
96
+
97
+ ```sh
98
+ avr auth device-login
99
+ ```
100
+
101
+ Open the displayed link on your laptop or phone, or scan the terminal QR code.
102
+ Confirm the code and approve the request. The CLI waits for approval and saves
103
+ the credential on the machine where you ran the command. Use `--no-qr` to hide
104
+ the QR code; the sign-in link is always displayed. QR output is omitted when
105
+ piped or when the terminal cannot display it. Device login requires support
106
+ on your Avrea server; `avr auth login` keeps its existing browser flow.
107
+
91
108
  Show who you are and where you're pointing:
92
109
 
93
110
  ```sh
@@ -117,6 +134,62 @@ Auto-detection means most commands "just work" without `--repo`. Outside a git t
117
134
 
118
135
  ## Common workflows
119
136
 
137
+ **Clone from a nearby Git mirror**
138
+
139
+ ```sh
140
+ avr repo clone foo/faa
141
+ avr repo clone foo/faa my-checkout --depth 1 --branch main
142
+ avr repo clone foo/faa --placement https://git.fi.a.avrea.io
143
+ ```
144
+
145
+ Avrea uses a single available placement directly. With multiple placements,
146
+ it picks the first mirror that responds successfully from your machine.
147
+ `--placement` accepts an advertised mirror URL or hostname to select one
148
+ explicitly. Give the `owner/repository` name or an Avrea repository ID (`rep-...`).
149
+ Requires Git 2.31 or newer. The repository must already have Git mirroring
150
+ enabled and a usable placement.
151
+
152
+ `origin` stays on the selected read-only mirror. The clone installs a
153
+ repository-local credential helper so ordinary `git fetch` and `git pull`
154
+ obtain fresh Git tokens through your Avrea login. Push changes to the source
155
+ repository using a separate remote, for example:
156
+
157
+ ```sh
158
+ git remote add upstream git@github.com:foo/faa.git
159
+ git push upstream HEAD
160
+ ```
161
+
162
+ Tokens normally last one hour; scoped API keys are limited to ten minutes or
163
+ their remaining lifetime. Git tokens are never saved in the remote URL or
164
+ repository configuration. Keep `avr` installed and logged in for later Git
165
+ operations; the helper continues to use the API host used for the clone.
166
+
167
+ **Create a mirror at a location**
168
+
169
+ ```sh
170
+ avr repo mirror locations
171
+ avr repo mirror create foo/faa --location gsc-fi
172
+ avr repo mirror create group/subgroup/project --source gitlab --location gsc-fi
173
+ avr repo mirror status --repo group/subgroup/project --source gitlab
174
+ ```
175
+
176
+ `--source` defaults to `github`; `gitlab` supports nested group names. The
177
+ repository must already be connected to your Avrea organization. Use `--org`
178
+ to select an organization. Mirror management requires the organization's
179
+ Git-mirror feature and an admin role.
180
+
181
+ `--location` accepts a cluster ID, datacenter ID, or unique name from `locations`.
182
+ The command enables mirroring and adds the placement, preserving existing
183
+ placements. Sync runs asynchronously; use `status` to check it. Repeating
184
+ `create` is safe, including when enabling succeeded but placement failed.
185
+ `locations` and `create` also support `--json` and `--jq`.
186
+
187
+ GitLab repositories cannot be mirrored until GitLab mirroring is enabled
188
+ for your organization. `--source gitlab` is available for deployments that
189
+ support it, including repositories in nested groups. If a GitLab repository
190
+ returns “not found,” check its connection to Avrea, your access, and whether
191
+ GitLab mirroring is enabled.
192
+
120
193
  **Watch a run live**
121
194
 
122
195
  ```sh
@@ -133,6 +206,48 @@ avr run logs <run-id> # full log dump, paginated
133
206
  avr job logs <job-id> --follow # tail one job in real time
134
207
  ```
135
208
 
209
+ **Read recorded tests from a run or job**
210
+
211
+ ```sh
212
+ avr tests <run-id> --job unit # select one job by name
213
+ avr tests <github-run-id> # a single-job run needs no selector
214
+ avr tests <job-id> # names, outcomes, timings and failures
215
+ avr tests <job-id> --status failed
216
+ avr tests <job-id> --test test_login
217
+ avr tests <job-id> --suite Authentication --class TestLogin
218
+ avr tests <job-id> --json '*' # reporting state and pagination
219
+ avr tests <job-id> --limit 500 # maximum matching occurrences to return
220
+ avr tests <job-id> --cursor '<cursor>' # resume with the same filters
221
+ ```
222
+
223
+ Accepts Avrea run IDs (`run-` or `awr-`), GitHub numeric run IDs, GitHub
224
+ Actions run URLs, Avrea console run URLs, and Avrea job IDs (`job-` or
225
+ `awj-`). `avr tests list <run-or-job>` is equivalent. A run selects one job,
226
+ not all jobs together. `--job NAME` matches a case-insensitive substring and
227
+ must identify one job; ambiguous names show the available jobs and IDs.
228
+ A run containing one job selects it automatically. The job's repository is
229
+ resolved automatically, or use `--repo owner/name`.
230
+
231
+ The listing reads the job's latest confirmed execution, without substituting
232
+ an older report. GitHub run URLs with `/attempts/N` select that run attempt;
233
+ there is no separate test-execution selector. Test names match exactly and
234
+ case-sensitively; test filters combine with AND. Outcomes are `passed`,
235
+ `failed`, `skipped` and `errored`. Repeated matches stay separate, with their
236
+ recorded failure messages shown directly. `--json FIELDS` and `--jq` also work.
237
+
238
+ Each invocation returns at most 1,000 occurrences and reads at most 20 result
239
+ pages. Filtering can produce empty pages with a continuation. If the search
240
+ stops before the report ends, the command says so; resume with the same job,
241
+ filters and `--cursor`. The retained count covers all tests, before filtering.
242
+ Missing or expired reports are distinct from zero matches or a retained
243
+ report containing zero tests. Complete describes collected reports, not
244
+ whether every expected test ran.
245
+
246
+ These commands require an API deployment supporting the corresponding reads.
247
+ Filtering fails explicitly if the server does not acknowledge the selectors.
248
+ File filters and test splitting are not supported. The commands do not rerun
249
+ tests or change collection.
250
+
136
251
  **Trigger a workflow_dispatch**
137
252
 
138
253
  ```sh
@@ -154,7 +269,7 @@ avr job ssh <job-id> --print-command # just print the ssh string
154
269
  **Live VM metrics while a job runs**
155
270
 
156
271
  ```sh
157
- avr job metrics <job-id> --watch # CPU/memory/IO gauges, refreshed every few seconds
272
+ avr job metrics <job-id> --watch # CPU/memory/IO gauges, streamed live
158
273
  avr job metrics <job-id> # static post-mortem after the job ended
159
274
  ```
160
275
 
@@ -164,8 +279,8 @@ Durable, org-scoped VMs reachable over SSH (plus RDP/VNC for a desktop), separat
164
279
 
165
280
  ```sh
166
281
  avr vm create --name dev --os linux --size 2-vcpu \
167
- --ssh-key @~/.ssh/id_ed25519.pub --ephemeral --wait # boot, wait for SSH, print connect
168
- avr vm create --name ci --os linux --size 8-vcpu --ephemeral \
282
+ --ssh-key @~/.ssh/id_ed25519.pub --wait # boot, wait for SSH, print connect
283
+ avr vm create --name ci --os linux --size 8-vcpu \
169
284
  --repo org/project --disable-cache gha,packages # attach a repo, narrow which caches it uses
170
285
  avr vm bootstrap <vm-id> --setup-github --install claude,codex \
171
286
  --repo https://github.com/org/project --env AWS_REGION=eu-north-1
@@ -173,10 +288,17 @@ avr vm ssh <vm-id> # SSH session, host
173
288
  avr vm ssh <vm-id> --login -- claude -p 'summarize the repo' # one-off command in a login shell (sees forwarded env)
174
289
  avr vm ssh <vm-id> --session dev # persistent tmux session, survives a dropped connection
175
290
  avr vm ssh-config <vm-id> --append # add `ssh <alias>` (scp/rsync, VS Code Remote-SSH) to ~/.ssh/config
176
- avr vm list ; avr vm stop <vm-id> # lifecycle
291
+ avr vm list ; avr vm pause <vm-id> # lifecycle
292
+ avr vm resume <vm-id> --wait
293
+ avr vm fork <paused-vm-id> --name experiment --wait
294
+ avr vm capabilities
295
+ avr vm create --os linux --arch arm64 --size 2-vcpu --https-port 3000 --https-port 8080
296
+ avr vm metrics <vm-id> --watch
177
297
  ```
178
298
 
179
- `bootstrap` runs each step over SSH and streams it live, feeding secrets (GitHub token, env values, agent credentials) on stdin rather than argv. `--forward-agent-creds` carries your local `ANTHROPIC_API_KEY` / `OPENAI_API_KEY`, or a Claude subscription token — if none is set it offers to run `claude setup-token` and forwards the pasted `CLAUDE_CODE_OAUTH_TOKEN`. Disks are ephemeral, so re-run it after every `avr vm start`. `avr vm ssh` pins the VM's host key when its endpoint publishes one; if it doesn't, `avr` warns and falls back to trust-on-first-use — pass `--session <name>` to attach to (or create) a persistent tmux session that survives a dropped connection. A one-off `avr vm ssh -- <cmd>` runs in a non-login shell that sources no startup files, so pass `--login` when the command needs bootstrap-forwarded env (e.g. `claude`'s subscription token). `avr vm ssh-config` emits a host-key-pinned SSH config block so plain `ssh`, scp/rsync, and VS Code / Cursor Remote-SSH reach the VM without wrapping each tool — `--append` writes it into `~/.ssh/config` for you (idempotent: re-run after a restart to refresh the endpoint in place). For a desktop, `avr vm rdp` / `avr vm vnc` tunnel over the same SSH endpoint, and `avr vm port-forward` is the generic primitive (repeat `--port` to forward several ports over one connection). A VM created with `--repo` inherits that repository's build/CI caches; `--disable-cache <name>` narrows them per VM (it can turn an inherited cache off, never on).
299
+ `bootstrap` runs each step over SSH and streams it live, feeding secrets (GitHub token, env values, agent credentials) on stdin rather than argv. `--forward-agent-creds` carries your local `ANTHROPIC_API_KEY` / `OPENAI_API_KEY`, or a Claude subscription token — if none is set it offers to run `claude setup-token` and forwards the pasted `CLAUDE_CODE_OAUTH_TOKEN`. Bootstrap changes survive pause and resume. `avr vm ssh` pins the VM's host key when its endpoint publishes one; if it doesn't, `avr` warns and falls back to trust-on-first-use — pass `--session <name>` to attach to (or create) a persistent tmux session that survives a dropped connection. A one-off `avr vm ssh -- <cmd>` runs in a non-login shell that sources no startup files, so pass `--login` when the command needs bootstrap-forwarded env (e.g. `claude`'s subscription token). `avr vm ssh-config` emits a host-key-pinned SSH config block so plain `ssh`, scp/rsync, and VS Code / Cursor Remote-SSH reach the VM without wrapping each tool — `--append` writes it into `~/.ssh/config` for you (idempotent: re-run after a resume to refresh the endpoint in place). For a desktop, `avr vm rdp` / `avr vm vnc` tunnel over the same SSH endpoint, and `avr vm port-forward` is the generic primitive (repeat `--port` to forward several ports over one connection). A VM created with `--repo` inherits that repository's build/CI caches; `--disable-cache <name>` narrows them per VM (it can turn an inherited cache off, never on).
300
+
301
+ VM references accept IDs or display names. Names are generated when omitted. TTL expiry pauses the VM, or deletes it when pausing is unavailable. Agent sandboxes boot once and cannot be paused or resumed. HTTPS URLs are public to anyone who has them; the first configured port is the default. Port updates apply live on a running VM, otherwise at the next start or resume; `avr vm rotate-https-label` replaces leaked URLs. Metrics watch uses a WebSocket stream for both VM and job metrics; explicit `--start`/`--end` windows require single-shot mode.
180
302
 
181
303
  **Cancel or rerun a run**
182
304
 
@@ -239,11 +361,32 @@ case $? in
239
361
  esac
240
362
  ```
241
363
 
242
- Exit code `4` is reserved for "auth required". `1` is general failure; `2` is a usage error.
364
+ Exit code `4` is reserved for "auth required". `1` is general failure; `2` is a usage error. `130` means Ctrl-C
365
+ ended the command, including a watch, a log follow or a tunnel that is stopped that way.
366
+
367
+ **Scoped tokens for scripts and agents**
368
+
369
+ ```sh
370
+ avr token create --name ci-read --org <org-id> --repo acme/api --ttl 8h # prints the credential once
371
+ avr token create --name agent --org <org-id> --vm <vm-id> --allow-vm-create --vm-create-limit 3
372
+ avr token list
373
+ avr token view <token-id>
374
+ avr token revoke <token-id>
375
+ ```
376
+
377
+ A scoped token is a short-lived credential (60 seconds to 7 days, 8 hours by default) bound to one organization. Repository grants are read-only and VM grants are admin: it reads only the repositories it names, has admin access to only the VMs it names, and cannot create further tokens. `create` prints the `export AVR_TOKEN=...` and `export AVR_ORG=...` lines for whatever will use the token. Scoped tokens require the `org-...` ID in `AVR_ORG` or `--org`; they ignore the login's stored organization and cannot resolve a slug. `avr auth status` reports this configuration without checking whether the token is still live. A 403 or 404 comes with a reminder that the token reaches only what it names.
378
+
379
+ `avr repo clone acme/api` uses the `owner/repository` name directly.
380
+
381
+ With a scoped token, a repository name (`--repo acme/api`, `AVR_REPO` or the checkout's remote) is matched against the repositories the token reaches; a `rep-...` ID works as well. For runs, use the run ID rather than an Avrea console URL, whose organization slug cannot be resolved with a scoped token. Token IDs for `view` and `revoke` are `key-` followed by 32 lowercase hexadecimal characters.
382
+
383
+ Creation returns the credential only once. If `--jq` fails or removes it, the command falls back to the requested JSON without filtering and exits nonzero. Save the credential from that JSON. Output failures also report a revoke command on stderr without exposing the credential there. If the creation request is interrupted, its response is lost, or the answer is a server error (5xx), a token may already exist: check `avr token list` before retrying. Only a 503 that carries the API's own reason means that no token was created.
384
+
385
+ If `avr token create` returns a 404, check the API's reason, the organization and the API host. If scoped-token access is unavailable, contact support@avrea.com to request it. VM grants and `--allow-vm-create` also require customer VMs to be enabled for the organization. `list`, `view` and `revoke` remain available when token creation is disabled.
243
386
 
244
387
  **Pipe-aware output**
245
388
 
246
- When stdout isn't a TTY, list commands switch to tab-separated rows (no color, no truncation, ISO timestamps), so `avr run list | awk` works without flags. `avr run watch | jq -c .` automatically switches to NDJSON event mode.
389
+ When stdout isn't a TTY, list commands switch to tab-separated rows (no color, no truncation, ISO timestamps), so `avr run list | awk` works without flags. Control characters, Unicode line separators and bidirectional controls inside cells are escaped (`\t`, `\x1b`, `\u2028`), keeping each item on one row with stable columns. The escaping is not reversible: a literal backslash is left as it is, so a cell that reads `a\tb` may hold either a tab or a backslash and a `t`. Use `--json` when the exact value matters; JSON retains the original values. `avr run watch | jq -c .` automatically switches to NDJSON event mode.
247
390
 
248
391
  ## Configuration
249
392
 
@@ -252,8 +395,8 @@ When stdout isn't a TTY, list commands switch to tab-separated rows (no color, n
252
395
  | Variable | Purpose |
253
396
  | ---------------- | ------------------------------------------------------------------------------------------------ |
254
397
  | `AVR_HOST` | Avrea API URL. Defaults to the active host in `hosts.json`, then `https://api.avrea.com`. |
255
- | `AVR_TOKEN` | API key. Overrides whatever's stored for the active host. |
256
- | `AVR_ORG` | Default organization ID. Overrides the stored default. |
398
+ | `AVR_TOKEN` | API key or scoped token. Overrides whatever's stored for the active host. |
399
+ | `AVR_ORG` | Default organization ID. Overrides the stored default. A scoped token needs it, or `--org`, except for `repo clone`. |
257
400
  | `AVR_REPO` | Default repository (`org/name` or `rep-xxx`). Overrides git auto-detect. |
258
401
  | `AVR_BROWSER` | Browser to launch for `--web` and OAuth login. Falls back to `BROWSER`, then system default. |
259
402
  | `AVR_PAGER` | Pager for long output. Overrides `PAGER`. Set to empty string to disable paging. |