akashcli 4.3.0__tar.gz → 4.3.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 (31) hide show
  1. {akashcli-4.3.0 → akashcli-4.3.1}/PKG-INFO +1 -1
  2. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/cli.py +49 -16
  3. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli.egg-info/PKG-INFO +1 -1
  4. {akashcli-4.3.0 → akashcli-4.3.1}/pyproject.toml +1 -1
  5. {akashcli-4.3.0 → akashcli-4.3.1}/README.md +0 -0
  6. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/__init__.py +0 -0
  7. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/auth.py +0 -0
  8. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/client.py +0 -0
  9. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/config.py +0 -0
  10. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/crypto.py +0 -0
  11. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/env_manager.py +0 -0
  12. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/exceptions.py +0 -0
  13. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/exec.py +0 -0
  14. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/integrity.py +0 -0
  15. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/logger.py +0 -0
  16. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/models.py +0 -0
  17. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/p2p.py +0 -0
  18. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/packages.py +0 -0
  19. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/relay.py +0 -0
  20. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/restore.py +0 -0
  21. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/snapshot_crypto.py +0 -0
  22. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/storage.py +0 -0
  23. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/terminal.py +0 -0
  24. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/uploader.py +0 -0
  25. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli/utils.py +0 -0
  26. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli.egg-info/SOURCES.txt +0 -0
  27. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli.egg-info/dependency_links.txt +0 -0
  28. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli.egg-info/entry_points.txt +0 -0
  29. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli.egg-info/requires.txt +0 -0
  30. {akashcli-4.3.0 → akashcli-4.3.1}/akashcli.egg-info/top_level.txt +0 -0
  31. {akashcli-4.3.0 → akashcli-4.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akashcli
3
- Version: 4.3.0
3
+ Version: 4.3.1
4
4
  Summary: Akash CLI — secure remote shell relay, file vault, and device management
5
5
  License: MIT
6
6
  Keywords: akash,cli,relay,remote-shell,vault
@@ -74,6 +74,36 @@ class _Spin:
74
74
  sys.stdout.flush()
75
75
 
76
76
 
77
+ def _resolve_client(url_override: str = None):
78
+ """
79
+ Return (api_key, base_url).
80
+ If no API key is configured, prompt the user interactively rather than
81
+ crashing — so commands work on a fresh machine without `akash login`.
82
+ """
83
+ import os as _os
84
+ config = ConfigManager.load()
85
+ base = (
86
+ url_override
87
+ or _os.getenv("AKASH_API_URL")
88
+ or config.get("api_url", "https://jstore.2bd.net")
89
+ ).rstrip("/")
90
+
91
+ api_key = _os.getenv("AKASH_API_KEY") or config.get("api_key")
92
+ if not api_key:
93
+ print(f" {_Y}!{_RS} No API key found.")
94
+ print(f" {_DM}Set AKASH_API_KEY env var, or run {_C}akash login{_RS}{_DM} to save credentials.{_RS}")
95
+ try:
96
+ api_key = typer.prompt(" API key", hide_input=True).strip()
97
+ except (EOFError, KeyboardInterrupt):
98
+ print()
99
+ raise typer.Exit(1)
100
+ if not api_key:
101
+ _err("API key required.")
102
+ raise typer.Exit(1)
103
+
104
+ return api_key, base
105
+
106
+
77
107
  def _progress_bar(done: int, total: int, width: int = 28) -> str:
78
108
  """Return a plain ASCII progress bar string."""
79
109
  if not total:
@@ -904,8 +934,7 @@ def run(
904
934
  from .exec import acquire_exec_token, run_command, _clear_cached_token
905
935
 
906
936
  try:
907
- client = AkashClient()
908
- base = (url or client.base_url).rstrip("/")
937
+ api_key, base = _resolve_client(url)
909
938
 
910
939
  # ── Device relay path ─────────────────────────────────────────────
911
940
  if device is not None:
@@ -914,7 +943,7 @@ def run(
914
943
  _p()
915
944
  with _Spin("connecting to relay…"):
916
945
  pass
917
- exit_code = connect_run(client.api_key, base, command, target=device or None)
946
+ exit_code = connect_run(api_key, base, command, target=device or None)
918
947
  _p()
919
948
  if exit_code == 0:
920
949
  _info("exited 0")
@@ -928,7 +957,7 @@ def run(
928
957
  _info("cleared cached token — re-authenticating…")
929
958
 
930
959
  with _Spin("authenticating…"):
931
- token = acquire_exec_token(client.api_key, base)
960
+ token = acquire_exec_token(api_key, base)
932
961
 
933
962
  _info(f"running: {command}")
934
963
  _p()
@@ -1048,8 +1077,7 @@ def shell(
1048
1077
  from .exec import acquire_exec_token, run_shell, _clear_cached_token
1049
1078
 
1050
1079
  try:
1051
- client = AkashClient()
1052
- base = (url or client.base_url).rstrip("/")
1080
+ api_key, base = _resolve_client(url)
1053
1081
 
1054
1082
  # ── Device relay path ─────────────────────────────────────────────
1055
1083
  if device is not None:
@@ -1057,7 +1085,7 @@ def shell(
1057
1085
  label = device.strip() if device.strip() else None
1058
1086
  _info(f"connecting to device {_cy(label or 'auto')}…")
1059
1087
  try:
1060
- exit_code = connect_shell(client.api_key, base, target=label)
1088
+ exit_code = connect_shell(api_key, base, target=label)
1061
1089
  except RuntimeError as e:
1062
1090
  _err(str(e))
1063
1091
  raise typer.Exit(1)
@@ -1072,7 +1100,7 @@ def shell(
1072
1100
  _info("cleared cached token — re-authenticating…")
1073
1101
 
1074
1102
  with _Spin("authenticating…"):
1075
- token = acquire_exec_token(client.api_key, base)
1103
+ token = acquire_exec_token(api_key, base)
1076
1104
 
1077
1105
  exit_code = run_shell(token, base)
1078
1106
 
@@ -1108,17 +1136,21 @@ def devices(
1108
1136
  akash devices --revoke laptop remove a device
1109
1137
  """
1110
1138
  try:
1111
- client = AkashClient()
1139
+ api_key, base = _resolve_client()
1140
+ except typer.Exit:
1141
+ raise
1112
1142
  except Exception as e:
1113
1143
  _err(str(e))
1114
1144
  raise typer.Exit(1)
1115
1145
 
1146
+ _hdrs = {"x-api-key": api_key, "Origin": "https://akash.cli"}
1147
+
1116
1148
  if revoke:
1117
1149
  try:
1118
1150
  import httpx as _hx
1119
1151
  resp = _hx.delete(
1120
- f"{client.base_url}/api/exec/devices/{revoke}",
1121
- headers=client._get_headers(), timeout=10,
1152
+ f"{base}/api/exec/devices/{revoke}",
1153
+ headers=_hdrs, timeout=10,
1122
1154
  )
1123
1155
  resp.raise_for_status()
1124
1156
  _ok(f"revoked {_ye(revoke)}")
@@ -1130,8 +1162,8 @@ def devices(
1130
1162
  try:
1131
1163
  import httpx as _hx
1132
1164
  resp = _hx.get(
1133
- f"{client.base_url}/api/exec/devices",
1134
- headers=client._get_headers(), timeout=10,
1165
+ f"{base}/api/exec/devices",
1166
+ headers=_hdrs, timeout=10,
1135
1167
  )
1136
1168
  resp.raise_for_status()
1137
1169
  data = resp.json()
@@ -1210,8 +1242,9 @@ def serve(
1210
1242
  return
1211
1243
 
1212
1244
  try:
1213
- client = AkashClient()
1214
- base = (url or client.base_url).rstrip("/")
1245
+ api_key, base = _resolve_client(url)
1246
+ except typer.Exit:
1247
+ raise
1215
1248
  except Exception as e:
1216
1249
  _err(str(e))
1217
1250
  raise typer.Exit(1)
@@ -1221,7 +1254,7 @@ def serve(
1221
1254
  resolved_label = (label or _cfg_label() or "default").strip()
1222
1255
 
1223
1256
  try:
1224
- _serve(client.api_key, base, resolved_label, daemon=daemon)
1257
+ _serve(api_key, base, resolved_label, daemon=daemon)
1225
1258
  except Exception as e:
1226
1259
  _err(f"serve failed: {e}")
1227
1260
  raise typer.Exit(1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akashcli
3
- Version: 4.3.0
3
+ Version: 4.3.1
4
4
  Summary: Akash CLI — secure remote shell relay, file vault, and device management
5
5
  License: MIT
6
6
  Keywords: akash,cli,relay,remote-shell,vault
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "akashcli"
3
- version = "4.3.0"
3
+ version = "4.3.1"
4
4
  description = "Akash CLI — secure remote shell relay, file vault, and device management"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.9"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes