akashcli 4.3.1__tar.gz → 4.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 (31) hide show
  1. {akashcli-4.3.1 → akashcli-4.3.2}/PKG-INFO +1 -1
  2. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/cli.py +63 -17
  3. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli.egg-info/PKG-INFO +1 -1
  4. {akashcli-4.3.1 → akashcli-4.3.2}/pyproject.toml +1 -1
  5. {akashcli-4.3.1 → akashcli-4.3.2}/README.md +0 -0
  6. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/__init__.py +0 -0
  7. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/auth.py +0 -0
  8. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/client.py +0 -0
  9. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/config.py +0 -0
  10. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/crypto.py +0 -0
  11. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/env_manager.py +0 -0
  12. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/exceptions.py +0 -0
  13. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/exec.py +0 -0
  14. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/integrity.py +0 -0
  15. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/logger.py +0 -0
  16. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/models.py +0 -0
  17. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/p2p.py +0 -0
  18. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/packages.py +0 -0
  19. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/relay.py +0 -0
  20. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/restore.py +0 -0
  21. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/snapshot_crypto.py +0 -0
  22. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/storage.py +0 -0
  23. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/terminal.py +0 -0
  24. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/uploader.py +0 -0
  25. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli/utils.py +0 -0
  26. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli.egg-info/SOURCES.txt +0 -0
  27. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli.egg-info/dependency_links.txt +0 -0
  28. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli.egg-info/entry_points.txt +0 -0
  29. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli.egg-info/requires.txt +0 -0
  30. {akashcli-4.3.1 → akashcli-4.3.2}/akashcli.egg-info/top_level.txt +0 -0
  31. {akashcli-4.3.1 → akashcli-4.3.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akashcli
3
- Version: 4.3.1
3
+ Version: 4.3.2
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,11 +74,14 @@ class _Spin:
74
74
  sys.stdout.flush()
75
75
 
76
76
 
77
- def _resolve_client(url_override: str = None):
77
+ def _resolve_client(url_override: str = None, require_key: bool = False):
78
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`.
79
+ Return (api_key_or_None, base_url).
80
+
81
+ require_key=True — hard-fail with a clear message if no key found
82
+ (used by serve/devices which cannot work without server auth).
83
+ require_key=False — return None for api_key if missing; caller shows warning
84
+ and can offer a local/offline fallback.
82
85
  """
83
86
  import os as _os
84
87
  config = ConfigManager.load()
@@ -88,22 +91,23 @@ def _resolve_client(url_override: str = None):
88
91
  or config.get("api_url", "https://jstore.2bd.net")
89
92
  ).rstrip("/")
90
93
 
91
- api_key = _os.getenv("AKASH_API_KEY") or config.get("api_key")
92
- if not api_key:
94
+ api_key = _os.getenv("AKASH_API_KEY") or config.get("api_key") or None
95
+
96
+ if not api_key and require_key:
93
97
  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)
98
+ print(f" {_DM}Run {_C}akash login{_RS}{_DM} to save your key, or set {_C}AKASH_API_KEY{_RS}{_DM}.{_RS}")
99
+ raise typer.Exit(1)
103
100
 
104
101
  return api_key, base
105
102
 
106
103
 
104
+ _GUEST_WARNING = (
105
+ f" {_Y}⚠{_RS} {_Y}Running as guest{_RS} — not logged in.\n"
106
+ f" {_DM}Features are limited and your data won't be saved to the cloud.\n"
107
+ f" Run {_RS}{_C}akash login{_RS}{_DM} to unlock full access.{_RS}"
108
+ )
109
+
110
+
107
111
  def _progress_bar(done: int, total: int, width: int = 28) -> str:
108
112
  """Return a plain ASCII progress bar string."""
109
113
  if not total:
@@ -936,6 +940,12 @@ def run(
936
940
  try:
937
941
  api_key, base = _resolve_client(url)
938
942
 
943
+ # ── No key + device flag → relay needs auth ───────────────────────
944
+ if device is not None and not api_key:
945
+ print(_GUEST_WARNING)
946
+ _err("relay requires an API key. Run `akash login` first.")
947
+ raise typer.Exit(1)
948
+
939
949
  # ── Device relay path ─────────────────────────────────────────────
940
950
  if device is not None:
941
951
  from .relay import connect_run
@@ -952,6 +962,22 @@ def run(
952
962
  raise typer.Exit(exit_code)
953
963
  return
954
964
 
965
+ # ── No key → local execution fallback ────────────────────────────
966
+ if not api_key:
967
+ print(_GUEST_WARNING)
968
+ _p()
969
+ _info(f"running locally: {command}")
970
+ _p()
971
+ import subprocess as _sp
972
+ result = _sp.run(command, shell=True)
973
+ _p()
974
+ if result.returncode == 0:
975
+ _info("exited 0")
976
+ else:
977
+ _warn(f"exited {result.returncode}")
978
+ raise typer.Exit(result.returncode)
979
+ return
980
+
955
981
  if reauth:
956
982
  _clear_cached_token()
957
983
  _info("cleared cached token — re-authenticating…")
@@ -1079,6 +1105,12 @@ def shell(
1079
1105
  try:
1080
1106
  api_key, base = _resolve_client(url)
1081
1107
 
1108
+ # ── No key + device flag → relay needs auth ───────────────────────
1109
+ if device is not None and not api_key:
1110
+ print(_GUEST_WARNING)
1111
+ _err("relay requires an API key. Run `akash login` first.")
1112
+ raise typer.Exit(1)
1113
+
1082
1114
  # ── Device relay path ─────────────────────────────────────────────
1083
1115
  if device is not None:
1084
1116
  from .relay import connect_shell
@@ -1095,6 +1127,20 @@ def shell(
1095
1127
  raise typer.Exit(exit_code)
1096
1128
  return
1097
1129
 
1130
+ # ── No key → local PTY shell fallback ────────────────────────────
1131
+ if not api_key:
1132
+ import shutil as _sh
1133
+ print(_GUEST_WARNING)
1134
+ _p()
1135
+ shell_bin = os.environ.get("SHELL") or _sh.which("bash") or _sh.which("sh") or "/bin/sh"
1136
+ _info(f"opening local shell {_dim(shell_bin)}")
1137
+ _p()
1138
+ import subprocess as _sp
1139
+ result = _sp.run([shell_bin])
1140
+ _p()
1141
+ _info("session closed")
1142
+ raise typer.Exit(result.returncode)
1143
+
1098
1144
  if reauth:
1099
1145
  _clear_cached_token()
1100
1146
  _info("cleared cached token — re-authenticating…")
@@ -1136,7 +1182,7 @@ def devices(
1136
1182
  akash devices --revoke laptop remove a device
1137
1183
  """
1138
1184
  try:
1139
- api_key, base = _resolve_client()
1185
+ api_key, base = _resolve_client(require_key=True)
1140
1186
  except typer.Exit:
1141
1187
  raise
1142
1188
  except Exception as e:
@@ -1242,7 +1288,7 @@ def serve(
1242
1288
  return
1243
1289
 
1244
1290
  try:
1245
- api_key, base = _resolve_client(url)
1291
+ api_key, base = _resolve_client(url, require_key=True)
1246
1292
  except typer.Exit:
1247
1293
  raise
1248
1294
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: akashcli
3
- Version: 4.3.1
3
+ Version: 4.3.2
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.1"
3
+ version = "4.3.2"
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