doover-cli 0.6.9__tar.gz → 0.7.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.
Files changed (101) hide show
  1. {doover_cli-0.6.9 → doover_cli-0.7.1}/PKG-INFO +2 -1
  2. {doover_cli-0.6.9 → doover_cli-0.7.1}/pyproject.toml +2 -1
  3. doover_cli-0.7.1/src/doover_cli/__init__.py +16 -0
  4. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/apps.py +30 -0
  5. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/tunnel.py +70 -176
  6. doover_cli-0.6.9/src/doover_cli/__init__.py → doover_cli-0.7.1/src/doover_cli/cli.py +9 -4
  7. doover_cli-0.7.1/src/doover_cli/entry.py +13 -0
  8. doover_cli-0.7.1/src/doover_cli/tunnel_exec.py +62 -0
  9. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/apps.py +30 -0
  10. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_apps.py +2 -0
  11. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_sentry.py +20 -21
  12. doover_cli-0.7.1/tests/test_tunnel_exec.py +28 -0
  13. {doover_cli-0.6.9 → doover_cli-0.7.1}/uv.lock +13 -0
  14. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/CONTRIBUTING.md +0 -0
  15. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/ISSUE_TEMPLATE/bug-report.yaml +0 -0
  16. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  17. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/ISSUE_TEMPLATE/feature-request.yml +0 -0
  18. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  19. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/workflows/lint-test.yml +0 -0
  20. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/workflows/release-brew.yml +0 -0
  21. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/workflows/release-pypi.yml +0 -0
  22. {doover_cli-0.6.9 → doover_cli-0.7.1}/.github/workflows/release.yml +0 -0
  23. {doover_cli-0.6.9 → doover_cli-0.7.1}/.gitignore +0 -0
  24. {doover_cli-0.6.9 → doover_cli-0.7.1}/.pre-commit-config.yaml +0 -0
  25. {doover_cli-0.6.9 → doover_cli-0.7.1}/AGENT.md +0 -0
  26. {doover_cli-0.6.9 → doover_cli-0.7.1}/LICENSE +0 -0
  27. {doover_cli-0.6.9 → doover_cli-0.7.1}/README.md +0 -0
  28. {doover_cli-0.6.9 → doover_cli-0.7.1}/debian/changelog +0 -0
  29. {doover_cli-0.6.9 → doover_cli-0.7.1}/debian/control +0 -0
  30. {doover_cli-0.6.9 → doover_cli-0.7.1}/debian/rules +0 -0
  31. {doover_cli-0.6.9 → doover_cli-0.7.1}/docs/user_stories.md +0 -0
  32. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/agent.py +0 -0
  33. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/api/__init__.py +0 -0
  34. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/api/auth.py +0 -0
  35. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/api/errors.py +0 -0
  36. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/api/session.py +0 -0
  37. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/app_install.py +0 -0
  38. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/device.py +0 -0
  39. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/device_type.py +0 -0
  40. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/migrate.py +0 -0
  41. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/apps/widget_plugin.py +0 -0
  42. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/channel.py +0 -0
  43. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/colours.py +0 -0
  44. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/config_schema.py +0 -0
  45. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/dda_logs.py +0 -0
  46. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/doover_config.py +0 -0
  47. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/grpc.py +0 -0
  48. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/login.py +0 -0
  49. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/notification_schema.py +0 -0
  50. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/registry.py +0 -0
  51. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/renderer/__init__.py +0 -0
  52. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/renderer/_base.py +0 -0
  53. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/renderer/_basic.py +0 -0
  54. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/renderer/_default.py +0 -0
  55. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/renderer/_json.py +0 -0
  56. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/report.py +0 -0
  57. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/simulator.py +0 -0
  58. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/ui_schema.py +0 -0
  59. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/user.py +0 -0
  60. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/__init__.py +0 -0
  61. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/api.py +0 -0
  62. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/context.py +0 -0
  63. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/crud/__init__.py +0 -0
  64. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/crud/commands.py +0 -0
  65. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/crud/lookup.py +0 -0
  66. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/crud/prompting.py +0 -0
  67. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/crud/schema.py +0 -0
  68. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/crud/values.py +0 -0
  69. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/errors.py +0 -0
  70. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/formatters.py +0 -0
  71. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/misc.py +0 -0
  72. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/parsers.py +0 -0
  73. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/prompt.py +0 -0
  74. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/sentry.py +0 -0
  75. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/shell_commands.py +0 -0
  76. {doover_cli-0.6.9 → doover_cli-0.7.1}/src/doover_cli/utils/state.py +0 -0
  77. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/__init__.py +0 -0
  78. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/conftest.py +0 -0
  79. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_agent.py +0 -0
  80. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_app_install.py +0 -0
  81. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_auth_integration.py +0 -0
  82. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_auth_unit.py +0 -0
  83. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_basic.py +0 -0
  84. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_crud_commands.py +0 -0
  85. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_crud_lookup.py +0 -0
  86. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_crud_prompting.py +0 -0
  87. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_crud_schema.py +0 -0
  88. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_crud_values.py +0 -0
  89. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_default_renderer.py +0 -0
  90. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_device.py +0 -0
  91. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_device_cli_integration.py +0 -0
  92. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_device_type.py +0 -0
  93. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_device_type_cli_integration.py +0 -0
  94. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_discover.py +0 -0
  95. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_migrate.py +0 -0
  96. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_prompt.py +0 -0
  97. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_registry.py +0 -0
  98. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_schema_export.py +0 -0
  99. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_user.py +0 -0
  100. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_utils_apps.py +0 -0
  101. {doover_cli-0.6.9 → doover_cli-0.7.1}/tests/test_widget_plugin.py +0 -0
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: doover-cli
3
- Version: 0.6.9
3
+ Version: 0.7.1
4
4
  Summary: CLI for Doover
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.11
7
7
  Requires-Dist: click-prompt>=0.6.3
8
8
  Requires-Dist: click>=8.3.1
9
9
  Requires-Dist: docker>=7.1.0
10
+ Requires-Dist: doover-tunnel<0.2,>=0.1.2
10
11
  Requires-Dist: jsf>=0.11.2
11
12
  Requires-Dist: paramiko>=3.5.1
12
13
  Requires-Dist: prompt-toolkit>=3.0.52
@@ -11,6 +11,7 @@ dependencies = [
11
11
  "jsf>=0.11.2",
12
12
  "paramiko>=3.5.1",
13
13
  "pydoover>=1.17.1",
14
+ "doover-tunnel>=0.1.2,<0.2",
14
15
  "pytz>=2025.2",
15
16
  "questionary>=1.10.0",
16
17
  "requests>=2.32.3",
@@ -30,7 +31,7 @@ build-backend = "hatchling.build"
30
31
  path = "src/doover_cli/__init__.py"
31
32
 
32
33
  [project.scripts]
33
- doover = "doover_cli:main"
34
+ doover = "doover_cli.entry:main"
34
35
  docker-credential-doover = "doover_cli.registry:credential_helper"
35
36
 
36
37
  [dependency-groups]
@@ -0,0 +1,16 @@
1
+ """Doover CLI.
2
+
3
+ Importing the package is deliberately cheap: `entry.main` hands `doover ssh`
4
+ and `doover tunnel` to the doover-tunnel binary before `cli` (typer, pydoover,
5
+ docker, ...) loads. `app` and `main` are still reachable here, lazily.
6
+ """
7
+
8
+ __version__ = "0.7.1"
9
+
10
+
11
+ def __getattr__(name: str):
12
+ if name in ("app", "main", "sentry_utils"):
13
+ from . import cli
14
+
15
+ return getattr(cli, name)
16
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -1286,6 +1286,13 @@ def publish(
1286
1286
  help="Upload the widget when publishing. Disable with --no-put-widget.",
1287
1287
  ),
1288
1288
  ] = True,
1289
+ put_artwork: Annotated[
1290
+ bool,
1291
+ typer.Option(
1292
+ help="Upload the icon and banner when publishing. "
1293
+ "Disable with --no-put-artwork.",
1294
+ ),
1295
+ ] = True,
1289
1296
  build_package: Annotated[
1290
1297
  bool,
1291
1298
  typer.Option(
@@ -1492,6 +1499,29 @@ def publish(
1492
1499
  )
1493
1500
  rich.print("[green]Widget uploaded.[/green]")
1494
1501
 
1502
+ artwork = {
1503
+ kind: path
1504
+ for kind, path in (
1505
+ ("icon", app_config.icon_path),
1506
+ ("banner", app_config.banner_path),
1507
+ )
1508
+ if path is not None
1509
+ }
1510
+ if artwork and put_artwork:
1511
+ for kind, path in artwork.items():
1512
+ if not path.exists():
1513
+ rich.print(f"[red]{kind.title()} file not found at {path}.[/red]")
1514
+ raise typer.Exit(1)
1515
+
1516
+ with renderer.loading("Uploading artwork..."):
1517
+ client.upload_application_artwork(
1518
+ str(application_id),
1519
+ **artwork,
1520
+ )
1521
+ rich.print(
1522
+ f"[green]{', '.join(sorted(artwork)).capitalize()} uploaded.[/green]"
1523
+ )
1524
+
1495
1525
  if app_config.type in PACKAGE_APP_TYPES:
1496
1526
  image_uri = _image_package_uri(app_config)
1497
1527
  if image_uri:
@@ -10,10 +10,7 @@ from ..utils.api import (
10
10
  )
11
11
  from ..utils.crud import (
12
12
  LookupChoice,
13
- build_create_command,
14
- build_update_command,
15
13
  prompt_resource,
16
- resource_autocomplete,
17
14
  )
18
15
  from ..utils.crud.lookup import resolve_resource_lookup
19
16
  from ..utils.crud.prompting import (
@@ -27,6 +24,7 @@ from ..utils.crud.values import (
27
24
  extract_model_values,
28
25
  normalize_model_values,
29
26
  )
27
+ from ..tunnel_exec import INSTALL_HINT, exec_binary, find_binary
30
28
  from ..utils.state import state
31
29
 
32
30
  if TYPE_CHECKING:
@@ -34,7 +32,6 @@ if TYPE_CHECKING:
34
32
  from ..renderer import RendererBase
35
33
 
36
34
 
37
- app = typer.Typer(no_args_is_help=True)
38
35
  device_app = typer.Typer(no_args_is_help=True)
39
36
 
40
37
  _TUNNEL_LABEL_ATTRS = ("name",)
@@ -46,36 +43,6 @@ def get_state() -> tuple["ControlClient", "RendererBase"]:
46
43
  return session.get_control_client(), state.renderer
47
44
 
48
45
 
49
- def _tunnel_autocomplete() -> object:
50
- return resource_autocomplete(
51
- Tunnel,
52
- archived=None,
53
- ordering="name",
54
- label_attrs=_TUNNEL_LABEL_ATTRS,
55
- searchable_attrs=_TUNNEL_LABEL_ATTRS,
56
- )
57
-
58
-
59
- def _resolve_tunnel_id(
60
- client: "ControlClient",
61
- renderer: "RendererBase",
62
- *,
63
- action: str,
64
- lookup: str | None,
65
- ) -> int:
66
- return prompt_resource(
67
- Tunnel,
68
- client,
69
- renderer,
70
- action=action,
71
- lookup=lookup,
72
- archived=None,
73
- ordering="name",
74
- label_attrs=_TUNNEL_LABEL_ATTRS,
75
- searchable_attrs=_TUNNEL_LABEL_ATTRS,
76
- )
77
-
78
-
79
46
  def _resolve_device_context_id(
80
47
  client: "ControlClient",
81
48
  renderer: "RendererBase",
@@ -230,174 +197,101 @@ def _resolve_device_tunnel_id(
230
197
 
231
198
 
232
199
  # ---------------------------------------------------------------------------
233
- # Top-level: doover tunnel ...
200
+ # Top-level: doover tunnel <device> [tunnel]
201
+ #
202
+ # With a device argument these never run: the console entry point execs the
203
+ # binary before the CLI loads (tunnel_exec). They remain for the bare form,
204
+ # which prompts for the device, and for global options before the verb.
234
205
  # ---------------------------------------------------------------------------
235
206
 
236
207
 
237
- @app.command(name="list")
238
- def list_(
239
- ordering: Annotated[
240
- str | None,
241
- typer.Option(
242
- help="Sort expression passed directly to the API, for example name or -name.",
243
- ),
244
- ] = None,
245
- page: Annotated[int | None, typer.Option(help="Page number to request.")] = None,
246
- per_page: Annotated[
247
- int | None, typer.Option("--per-page", help="Number of records per page.")
248
- ] = None,
249
- search: Annotated[str | None, typer.Option(help="Full-text search term.")] = None,
250
- _profile: ProfileAnnotation = None,
251
- ):
252
- """List tunnels across all devices you can access."""
253
- _ = _profile
254
- client, renderer = get_state()
208
+ def _doover_tunnel_binary() -> str:
209
+ found = find_binary()
210
+ if found is None:
211
+ raise typer.BadParameter(INSTALL_HINT)
212
+ return found
255
213
 
256
- with renderer.loading("Loading tunnels..."):
257
- response = client.tunnels.list(
258
- ordering=ordering,
259
- page=page,
260
- per_page=per_page,
261
- search=search,
262
- )
263
214
 
264
- renderer.render_list(response)
265
-
266
-
267
- @app.command()
268
- def get(
269
- tunnel: Annotated[
215
+ def connect(
216
+ ctx: typer.Context,
217
+ device: Annotated[
270
218
  str | None,
271
- typer.Argument(
272
- help="Tunnel ID or exact name to retrieve.",
273
- autocompletion=_tunnel_autocomplete(),
274
- ),
219
+ typer.Argument(help="Device ID or exact display name/name."),
275
220
  ] = None,
276
- _profile: ProfileAnnotation = None,
277
- ):
278
- """Get a tunnel by ID or name."""
279
- _ = _profile
280
- client, renderer = get_state()
281
-
282
- resolved_id = _resolve_tunnel_id(
283
- client,
284
- renderer,
285
- action="get",
286
- lookup=tunnel,
287
- )
288
-
289
- with renderer.loading("Loading tunnel..."):
290
- response = client.tunnels.retrieve(str(resolved_id))
291
-
292
- renderer.render(response)
293
-
294
-
295
- create = build_create_command(
296
- model_cls=Tunnel,
297
- command_help="Create a tunnel.",
298
- get_state=lambda: get_state(),
299
- )
300
- app.command()(create)
301
-
302
-
303
- update = build_update_command(
304
- model_cls=Tunnel,
305
- command_help="Update a tunnel.",
306
- get_state=lambda: get_state(),
307
- resource_id_param_name="tunnel",
308
- resource_id_help="Tunnel ID or exact name to update.",
309
- )
310
- app.command()(update)
311
-
312
-
313
- @app.command()
314
- def delete(
315
221
  tunnel: Annotated[
316
222
  str | None,
317
223
  typer.Argument(
318
- help="Tunnel ID or exact name to delete.",
319
- autocompletion=_tunnel_autocomplete(),
224
+ help="Tunnel name or ID on the device. Optional when it has one TCP tunnel."
320
225
  ),
321
226
  ] = None,
322
- yes: Annotated[
323
- bool, typer.Option("--yes", help="Delete without confirmation.")
227
+ port: Annotated[
228
+ int | None,
229
+ typer.Option(
230
+ "--port", "-p", help="Local port to listen on. Default: a free one."
231
+ ),
232
+ ] = None,
233
+ ssh: Annotated[
234
+ bool,
235
+ typer.Option(
236
+ "--ssh",
237
+ help="Start ssh through the tunnel and close it when ssh exits. "
238
+ "Arguments after `--` go to ssh.",
239
+ ),
324
240
  ] = False,
325
- _profile: ProfileAnnotation = None,
326
- ):
327
- """Permanently delete a tunnel."""
328
- _ = _profile
329
- client, renderer = get_state()
330
-
331
- resolved_id = _resolve_tunnel_id(
332
- client,
333
- renderer,
334
- action="delete",
335
- lookup=tunnel,
336
- )
337
-
338
- if not yes:
339
- typer.confirm(f"Permanently delete tunnel {resolved_id}?", abort=True)
340
-
341
- with renderer.loading("Deleting tunnel..."):
342
- client.tunnels.delete(str(resolved_id))
343
-
344
- print(f"Deleted tunnel {resolved_id}.")
345
-
346
-
347
- @app.command()
348
- def activate(
349
- tunnel: Annotated[
350
- str | None,
351
- typer.Argument(
352
- help="Tunnel ID or exact name to activate.",
353
- autocompletion=_tunnel_autocomplete(),
241
+ ttl: Annotated[
242
+ int | None,
243
+ typer.Option(
244
+ help="Session lifetime in minutes. Default: the tunnel's timeout."
354
245
  ),
355
246
  ] = None,
356
247
  _profile: ProfileAnnotation = None,
357
248
  ):
358
- """Activate a tunnel (open the underlying connection on the device)."""
249
+ """Open a private tunnel to a device and forward it to localhost until Ctrl-C.
250
+
251
+ Nothing is exposed publicly: your laptop and the device both connect out
252
+ to the Doover relay, which bridges them. Point any TCP tool at the local
253
+ address it prints (ssh, Modbus, Foxglove, ...).
254
+ """
359
255
  _ = _profile
360
256
  client, renderer = get_state()
361
-
362
- resolved_id = _resolve_tunnel_id(
363
- client,
364
- renderer,
365
- action="activate",
366
- lookup=tunnel,
367
- )
368
-
369
- with renderer.loading("Activating tunnel..."):
370
- response = client.tunnels.activate(str(resolved_id), body={})
371
-
372
- renderer.render(response)
373
-
374
-
375
- @app.command()
376
- def deactivate(
257
+ device_id = _resolve_device_context_id(client, renderer, device, action="tunnel to")
258
+ args = [_doover_tunnel_binary(), "ssh" if ssh else "open", str(device_id)]
259
+ if tunnel:
260
+ args.append(tunnel)
261
+ args += ["--profile", state.profile_name]
262
+ if port is not None:
263
+ args += ["--port", str(port)]
264
+ if ttl is not None:
265
+ args += ["--ttl", str(ttl)]
266
+ if ctx.args:
267
+ args += ["--", *ctx.args]
268
+ exec_binary(args)
269
+
270
+
271
+ def ssh(
272
+ ctx: typer.Context,
273
+ device: Annotated[
274
+ str | None,
275
+ typer.Argument(help="Device ID or exact display name/name."),
276
+ ] = None,
377
277
  tunnel: Annotated[
378
278
  str | None,
379
- typer.Argument(
380
- help="Tunnel ID or exact name to deactivate.",
381
- autocompletion=_tunnel_autocomplete(),
279
+ typer.Argument(help="Tunnel name or ID. Optional when the device has one."),
280
+ ] = None,
281
+ ttl: Annotated[
282
+ int | None,
283
+ typer.Option(
284
+ help="Session lifetime in minutes. Default: the tunnel's timeout."
382
285
  ),
383
286
  ] = None,
384
287
  _profile: ProfileAnnotation = None,
385
288
  ):
386
- """Deactivate a tunnel (close the underlying connection on the device)."""
387
- _ = _profile
388
- client, renderer = get_state()
389
-
390
- resolved_id = _resolve_tunnel_id(
391
- client,
392
- renderer,
393
- action="deactivate",
394
- lookup=tunnel,
395
- )
289
+ """SSH to a device through a private tunnel.
396
290
 
397
- with renderer.loading("Deactivating tunnel..."):
398
- response = client.tunnels.deactivate(str(resolved_id), body={})
399
-
400
- renderer.render(response)
291
+ Uses the device's SSH tunnel, creating one (localhost:22, the device
292
+ type's ssh user) if it has none. Arguments after `--` go to ssh.
293
+ """
294
+ connect(ctx, device, tunnel, None, True, ttl, _profile)
401
295
 
402
296
 
403
297
  # ---------------------------------------------------------------------------
@@ -1,8 +1,6 @@
1
1
  from doover_cli.renderer import Renderer
2
2
  from typing import Annotated, Optional
3
3
 
4
- __version__ = "0.6.9"
5
-
6
4
  import click
7
5
  import typer
8
6
 
@@ -23,7 +21,7 @@ from .apps.device_type import app as device_type_app
23
21
  from .grpc import app as grpc_app
24
22
  from .login import app as login_app
25
23
  from .report import app as reports_app
26
- from .apps.tunnel import app as tunnels_app
24
+ from .apps import tunnel as tunnel_cmd
27
25
  from .user import org_app, users_app
28
26
  from .utils import sentry as sentry_utils
29
27
  from .utils.state import state
@@ -58,7 +56,14 @@ app.add_typer(
58
56
  )
59
57
  app.add_typer(login_app)
60
58
  app.add_typer(reports_app, name="report", help="Generate and manage reports.")
61
- app.add_typer(tunnels_app, name="tunnel", help="Manage tunnels for remote access.")
59
+ app.command(
60
+ name="tunnel",
61
+ context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
62
+ )(tunnel_cmd.connect)
63
+ app.command(
64
+ name="ssh",
65
+ context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
66
+ )(tunnel_cmd.ssh)
62
67
  app.add_typer(grpc_app, name="grpc", help="Interact with running gRPC servers.")
63
68
  app.add_typer(dda_logs_app, name="dda-logs", help="Convert DDA message logs to JSON.")
64
69
  app.add_typer(device_app, name="device", help="Manipulate devices in Doover 2.0")
@@ -0,0 +1,13 @@
1
+ """Console entry point for `doover`."""
2
+
3
+ import sys
4
+
5
+
6
+ def main() -> None:
7
+ from .tunnel_exec import maybe_exec
8
+
9
+ maybe_exec(sys.argv[1:])
10
+
11
+ from .cli import main as cli_main
12
+
13
+ cli_main()
@@ -0,0 +1,62 @@
1
+ """Hand `doover ssh` / `doover tunnel` to the `doover-tunnel` binary.
2
+
3
+ The binary does the whole job itself (device lookup, session, forwarding),
4
+ so the console entry point calls `maybe_exec` before importing the rest of
5
+ the CLI: that import is most of a second, the binary starts in milliseconds.
6
+ This module must stay free of heavy imports for the same reason.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import os
12
+ import shutil
13
+ import subprocess
14
+ import sys
15
+ import sysconfig
16
+ from pathlib import Path
17
+
18
+ INSTALL_HINT = (
19
+ "doover-tunnel is not installed alongside doover-cli. Reinstall with "
20
+ "`pip install -U doover-cli` (or `uv tool install -U doover-cli`)."
21
+ )
22
+
23
+ # doover verb -> doover-tunnel subcommand. Both sides take the same flags.
24
+ FAST_COMMANDS = {"ssh": "ssh", "tunnel": "open"}
25
+
26
+
27
+ def find_binary() -> str | None:
28
+ """The `doover-tunnel` binary the `doover-tunnel` wheel installs next to us."""
29
+ name = "doover-tunnel.exe" if os.name == "nt" else "doover-tunnel"
30
+ candidates = [
31
+ Path(sys.argv[0]).resolve().parent / name,
32
+ Path(sysconfig.get_path("scripts")) / name,
33
+ ]
34
+ for candidate in candidates:
35
+ if candidate.is_file():
36
+ return str(candidate)
37
+ return shutil.which("doover-tunnel")
38
+
39
+
40
+ def exec_binary(args: list[str]) -> None:
41
+ if os.name == "nt":
42
+ sys.exit(subprocess.call(args))
43
+ os.execv(args[0], args)
44
+
45
+
46
+ def fast_args(argv: list[str]) -> list[str] | None:
47
+ """Binary arguments for `argv` (everything after `doover`), or None when
48
+ the Python CLI should handle it: another command, or a bare `doover ssh`
49
+ / `doover tunnel`, which prompts for the device interactively."""
50
+ if len(argv) < 2 or argv[0] not in FAST_COMMANDS:
51
+ return None
52
+ return [FAST_COMMANDS[argv[0]], *argv[1:]]
53
+
54
+
55
+ def maybe_exec(argv: list[str]) -> None:
56
+ args = fast_args(argv)
57
+ if args is None:
58
+ return
59
+ binary = find_binary()
60
+ if binary is None:
61
+ return
62
+ exec_binary([binary, *args])
@@ -152,6 +152,18 @@ def preserve_file(path: Path):
152
152
  path.unlink()
153
153
 
154
154
 
155
+ def _resolve_local_path(
156
+ value: str | Path | None, base_path: Path | None
157
+ ) -> Path | None:
158
+ """A path from doover_config.json, resolved against the app directory."""
159
+ if not value:
160
+ return None
161
+ path = Path(value)
162
+ if not path.is_absolute() and base_path is not None:
163
+ path = base_path / path
164
+ return path
165
+
166
+
155
167
  class LocalApplication(ControlApplication):
156
168
  _model_name = None
157
169
 
@@ -183,6 +195,8 @@ class LocalApplication(ControlApplication):
183
195
  repository_url: str | None = None,
184
196
  key: str | None = None,
185
197
  build_args: str | None = None,
198
+ icon: str | Path | None = None,
199
+ banner: str | Path | None = None,
186
200
  widget: str | Path | None = None,
187
201
  build_widget_command: str | None = None,
188
202
  export_config_command: str | None = None,
@@ -239,6 +253,14 @@ class LocalApplication(ControlApplication):
239
253
  else:
240
254
  self.widget_path = None
241
255
 
256
+ # Artwork is uploaded, not linked: these are paths in the repo, and they
257
+ # are deliberately not request fields. `icon_url`/`banner_url` still
258
+ # publish an externally hosted image for apps that have one.
259
+ self._icon_raw = str(icon) if icon else None
260
+ self._banner_raw = str(banner) if banner else None
261
+ self.icon_path = _resolve_local_path(icon, base_path)
262
+ self.banner_path = _resolve_local_path(banner, base_path)
263
+
242
264
  self.build_widget_command = build_widget_command
243
265
  self.key = key
244
266
  self.build_args = build_args
@@ -366,6 +388,8 @@ class LocalApplication(ControlApplication):
366
388
  data, "container_registry_profile_id"
367
389
  ),
368
390
  lambda_config=data.get("lambda_config"),
391
+ icon=data.get("icon"),
392
+ banner=data.get("banner"),
369
393
  widget=data.get("widget"),
370
394
  build_widget_command=data.get("build_widget_command"),
371
395
  export_config_command=data.get("export_config_command"),
@@ -475,6 +499,12 @@ class LocalApplication(ControlApplication):
475
499
  }
476
500
  )
477
501
 
502
+ if self._icon_raw is not None:
503
+ data["icon"] = self._icon_raw
504
+
505
+ if self._banner_raw is not None:
506
+ data["banner"] = self._banner_raw
507
+
478
508
  if self._widget_raw is not None:
479
509
  data["widget"] = self._widget_raw
480
510
 
@@ -72,6 +72,8 @@ class FakeAppConfig:
72
72
  self.type = "DEV"
73
73
  self.staging_config = {}
74
74
  self.widget_path = None
75
+ self.icon_path = None
76
+ self.banner_path = None
75
77
  self.build_widget_command = None
76
78
  self.save_calls = 0
77
79
  self._payload = {
@@ -6,8 +6,7 @@ import click
6
6
  import pytest
7
7
  from typer.testing import CliRunner
8
8
 
9
- import doover_cli
10
- from doover_cli import app
9
+ from doover_cli import app, cli
11
10
  from doover_cli.api import DooverCLISession
12
11
  from doover_cli.utils import sentry as sentry_utils
13
12
  from doover_cli.utils.shell_commands import run as shell_run
@@ -133,20 +132,20 @@ def test_main_captures_unhandled_exception_and_flushes(monkeypatch):
133
132
  flush_calls = []
134
133
 
135
134
  monkeypatch.setattr(
136
- doover_cli.sentry_utils, "init_sentry", lambda: init_calls.append(True)
135
+ cli.sentry_utils, "init_sentry", lambda: init_calls.append(True)
137
136
  )
138
137
  monkeypatch.setattr(
139
- doover_cli.sentry_utils,
138
+ cli.sentry_utils,
140
139
  "current_command_path",
141
140
  lambda: "app publish",
142
141
  )
143
142
  monkeypatch.setattr(
144
- doover_cli.sentry_utils,
143
+ cli.sentry_utils,
145
144
  "_capture_exception",
146
145
  lambda exc, **kwargs: capture_calls.append((exc, kwargs)),
147
146
  )
148
147
  monkeypatch.setattr(
149
- doover_cli.sentry_utils,
148
+ cli.sentry_utils,
150
149
  "flush_sentry",
151
150
  lambda: flush_calls.append(True),
152
151
  )
@@ -154,10 +153,10 @@ def test_main_captures_unhandled_exception_and_flushes(monkeypatch):
154
153
  def raise_error():
155
154
  raise RuntimeError("boom")
156
155
 
157
- monkeypatch.setattr(doover_cli, "app", raise_error)
156
+ monkeypatch.setattr(cli, "app", raise_error)
158
157
 
159
158
  with pytest.raises(RuntimeError):
160
- doover_cli.main()
159
+ cli.main()
161
160
 
162
161
  assert init_calls == [True]
163
162
  assert len(capture_calls) == 1
@@ -171,25 +170,25 @@ def test_main_does_not_capture_click_exit(monkeypatch):
171
170
  capture_calls = []
172
171
  flush_calls = []
173
172
 
174
- monkeypatch.setattr(doover_cli.sentry_utils, "init_sentry", lambda: None)
173
+ monkeypatch.setattr(cli.sentry_utils, "init_sentry", lambda: None)
175
174
  monkeypatch.setattr(
176
- doover_cli.sentry_utils,
175
+ cli.sentry_utils,
177
176
  "_capture_exception",
178
177
  lambda exc, **kwargs: capture_calls.append((exc, kwargs)),
179
178
  )
180
179
  monkeypatch.setattr(
181
- doover_cli.sentry_utils,
180
+ cli.sentry_utils,
182
181
  "flush_sentry",
183
182
  lambda: flush_calls.append(True),
184
183
  )
185
184
  monkeypatch.setattr(
186
- doover_cli,
185
+ cli,
187
186
  "app",
188
187
  lambda: (_ for _ in ()).throw(click.exceptions.Exit(0)),
189
188
  )
190
189
 
191
190
  with pytest.raises(click.exceptions.Exit):
192
- doover_cli.main()
191
+ cli.main()
193
192
 
194
193
  assert capture_calls == []
195
194
  assert flush_calls == [True]
@@ -199,25 +198,25 @@ def test_main_does_not_capture_click_abort(monkeypatch):
199
198
  capture_calls = []
200
199
  flush_calls = []
201
200
 
202
- monkeypatch.setattr(doover_cli.sentry_utils, "init_sentry", lambda: None)
201
+ monkeypatch.setattr(cli.sentry_utils, "init_sentry", lambda: None)
203
202
  monkeypatch.setattr(
204
- doover_cli.sentry_utils,
203
+ cli.sentry_utils,
205
204
  "_capture_exception",
206
205
  lambda exc, **kwargs: capture_calls.append((exc, kwargs)),
207
206
  )
208
207
  monkeypatch.setattr(
209
- doover_cli.sentry_utils,
208
+ cli.sentry_utils,
210
209
  "flush_sentry",
211
210
  lambda: flush_calls.append(True),
212
211
  )
213
212
  monkeypatch.setattr(
214
- doover_cli,
213
+ cli,
215
214
  "app",
216
215
  lambda: (_ for _ in ()).throw(click.Abort()),
217
216
  )
218
217
 
219
218
  with pytest.raises(click.Abort):
220
- doover_cli.main()
219
+ cli.main()
221
220
 
222
221
  assert capture_calls == []
223
222
  assert flush_calls == [True]
@@ -226,7 +225,7 @@ def test_main_does_not_capture_click_abort(monkeypatch):
226
225
  def test_login_reports_handled_exception(monkeypatch):
227
226
  capture_calls = []
228
227
 
229
- monkeypatch.setattr(doover_cli, "ConfigManager", FakeConfigManager)
228
+ monkeypatch.setattr(cli, "ConfigManager", FakeConfigManager)
230
229
  monkeypatch.setattr(
231
230
  "doover_cli.login.DooverCLIAuthClient.device_login",
232
231
  lambda *args, **kwargs: (_ for _ in ()).throw(RuntimeError("nope")),
@@ -253,7 +252,7 @@ def test_login_persists_selected_profile(monkeypatch):
253
252
 
254
253
  fake_auth = FakeAuth()
255
254
 
256
- monkeypatch.setattr(doover_cli, "ConfigManager", FakeConfigManager)
255
+ monkeypatch.setattr(cli, "ConfigManager", FakeConfigManager)
257
256
  monkeypatch.setattr(
258
257
  "doover_cli.login.DooverCLIAuthClient.device_login",
259
258
  lambda *args, **kwargs: fake_auth,
@@ -306,7 +305,7 @@ def test_report_compose_reports_handled_exception(monkeypatch):
306
305
  def generate(self):
307
306
  raise RuntimeError("generation failed")
308
307
 
309
- monkeypatch.setattr(doover_cli, "ConfigManager", FakeConfigManager)
308
+ monkeypatch.setattr(cli, "ConfigManager", FakeConfigManager)
310
309
  monkeypatch.setattr(
311
310
  "doover_cli.report.importlib",
312
311
  SimpleNamespace(
@@ -0,0 +1,28 @@
1
+ from doover_cli.tunnel_exec import fast_args
2
+
3
+
4
+ def test_ssh_and_tunnel_with_a_device_go_to_the_binary():
5
+ assert fast_args(["ssh", "dev", "--", "-l", "root", "uptime"]) == [
6
+ "ssh",
7
+ "dev",
8
+ "--",
9
+ "-l",
10
+ "root",
11
+ "uptime",
12
+ ]
13
+ assert fast_args(["tunnel", "dev", "SSH", "-p", "2222"]) == [
14
+ "open",
15
+ "dev",
16
+ "SSH",
17
+ "-p",
18
+ "2222",
19
+ ]
20
+ assert fast_args(["ssh", "--help"]) == ["ssh", "--help"]
21
+
22
+
23
+ def test_bare_verbs_and_other_commands_stay_in_python():
24
+ assert fast_args(["ssh"]) is None
25
+ assert fast_args(["tunnel"]) is None
26
+ assert fast_args(["device", "list"]) is None
27
+ assert fast_args(["--debug", "ssh", "dev"]) is None
28
+ assert fast_args([]) is None
@@ -562,6 +562,7 @@ dependencies = [
562
562
  { name = "click" },
563
563
  { name = "click-prompt" },
564
564
  { name = "docker" },
565
+ { name = "doover-tunnel" },
565
566
  { name = "jsf" },
566
567
  { name = "paramiko" },
567
568
  { name = "prompt-toolkit" },
@@ -588,6 +589,7 @@ requires-dist = [
588
589
  { name = "click", specifier = ">=8.3.1" },
589
590
  { name = "click-prompt", specifier = ">=0.6.3" },
590
591
  { name = "docker", specifier = ">=7.1.0" },
592
+ { name = "doover-tunnel", specifier = ">=0.1.2,<0.2" },
591
593
  { name = "jsf", specifier = ">=0.11.2" },
592
594
  { name = "paramiko", specifier = ">=3.5.1" },
593
595
  { name = "prompt-toolkit", specifier = ">=3.0.52" },
@@ -609,6 +611,17 @@ dev = [
609
611
  { name = "pytest", specifier = ">=8.3.5" },
610
612
  ]
611
613
 
614
+ [[package]]
615
+ name = "doover-tunnel"
616
+ version = "0.1.2"
617
+ source = { registry = "https://pypi.org/simple" }
618
+ wheels = [
619
+ { url = "https://files.pythonhosted.org/packages/dc/95/ede872a4172517a073997af9dc6adb183aa977d85e75947fb6cf1864c9bc/doover_tunnel-0.1.2-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:4858ae8d89b1dcc4d7c81d03f50fc733c92c34435b0c0dce84583579d190d57e", size = 4715447, upload-time = "2026-09-22T23:02:59.402Z" },
620
+ { url = "https://files.pythonhosted.org/packages/fb/b6/61ae8969acd06ae90291abedfa115d2a407a9eb32c288b4223a41b21eb46/doover_tunnel-0.1.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4885d8572d119245e4cb4bc0ad4e0f6aedf4393a198a89fae42b09df379d1214", size = 2435578, upload-time = "2026-09-22T23:03:01.303Z" },
621
+ { url = "https://files.pythonhosted.org/packages/42/81/b77c7c86d2037c03489d9fa88ea4fe4b258ebf6d096e8aa7fa2e4846c401/doover_tunnel-0.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1b434d6224911558caca4ec859df0c0831e4a297b21b90dc5f2b7a0d620030fb", size = 2548024, upload-time = "2026-09-22T23:03:02.997Z" },
622
+ { url = "https://files.pythonhosted.org/packages/f5/92/68ff8ced55a69fa8918d76fc3b6e09139fc370bee11636b0dde8cd5cec08/doover_tunnel-0.1.2-py3-none-win_amd64.whl", hash = "sha256:549c127c29efe7f89afbdd0cbe9f18aab16c9ca974f02bd2bab889bcfca53abb", size = 2589098, upload-time = "2026-09-22T23:03:04.869Z" },
623
+ ]
624
+
612
625
  [[package]]
613
626
  name = "faker"
614
627
  version = "40.36.0"
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