homeconsole-cli 0.0.1__py3-none-any.whl

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 (50) hide show
  1. hc/__init__.py +6 -0
  2. hc/api.py +59 -0
  3. hc/capabilities.py +41 -0
  4. hc/client.py +631 -0
  5. hc/commands/__init__.py +2 -0
  6. hc/commands/_client_helpers.py +74 -0
  7. hc/commands/_compose_helpers.py +95 -0
  8. hc/commands/auth.py +381 -0
  9. hc/commands/connect.py +55 -0
  10. hc/commands/core.py +277 -0
  11. hc/commands/deploy.py +1466 -0
  12. hc/commands/install.py +74 -0
  13. hc/commands/logs.py +58 -0
  14. hc/commands/marketplace.py +113 -0
  15. hc/commands/module.py +103 -0
  16. hc/commands/ping.py +41 -0
  17. hc/commands/plugin.py +453 -0
  18. hc/commands/recovery/__init__.py +222 -0
  19. hc/commands/recovery/compose.py +385 -0
  20. hc/commands/recovery/config.py +60 -0
  21. hc/commands/recovery/core.py +155 -0
  22. hc/commands/recovery/db.py +222 -0
  23. hc/commands/recovery/mode.py +36 -0
  24. hc/commands/recovery/redis.py +60 -0
  25. hc/commands/recovery/ui.py +63 -0
  26. hc/commands/remove.py +55 -0
  27. hc/commands/reset.py +88 -0
  28. hc/commands/search.py +42 -0
  29. hc/commands/secrets.py +457 -0
  30. hc/commands/setup.py +75 -0
  31. hc/commands/setup_wizard.py +153 -0
  32. hc/commands/status.py +64 -0
  33. hc/commands/update.py +377 -0
  34. hc/config.py +127 -0
  35. hc/constants.py +33 -0
  36. hc/core_ops.py +138 -0
  37. hc/core_source.py +126 -0
  38. hc/env_bootstrap.py +43 -0
  39. hc/errors.py +85 -0
  40. hc/main.py +105 -0
  41. hc/marketplace_operation.py +140 -0
  42. hc/native_core.py +369 -0
  43. hc/repl.py +406 -0
  44. hc/setup_runner.py +72 -0
  45. hc/shell.py +9 -0
  46. homeconsole_cli-0.0.1.dist-info/METADATA +155 -0
  47. homeconsole_cli-0.0.1.dist-info/RECORD +50 -0
  48. homeconsole_cli-0.0.1.dist-info/WHEEL +5 -0
  49. homeconsole_cli-0.0.1.dist-info/entry_points.txt +2 -0
  50. homeconsole_cli-0.0.1.dist-info/top_level.txt +1 -0
hc/__init__.py ADDED
@@ -0,0 +1,6 @@
1
+ from __future__ import annotations
2
+
3
+ __all__ = ["__version__"]
4
+
5
+ __version__ = "0.0.1"
6
+
hc/api.py ADDED
@@ -0,0 +1,59 @@
1
+ from __future__ import annotations
2
+
3
+ # Здесь живут все “контрактные” пути, чтобы не размазывать строки по коду.
4
+ # Если Core переедет на /api/v1 — клиент должен пережить это без правок команд.
5
+
6
+ API_PREFIX_CANDIDATES: tuple[str, ...] = ("/api", "/api/v1")
7
+
8
+ # Core
9
+ HEALTH = "/health"
10
+ # Current health endpoint in core-runtime-service (mounted under /api/v1/monitor).
11
+ MONITOR_HEALTH = "/api/v1/monitor/health"
12
+ # Legacy/compat (older builds).
13
+ MONITOR_HEALTH_LEGACY = "/monitor/health"
14
+
15
+ # Admin (core API contract)
16
+ ADMIN_STATUS = "/api/v1/admin/inspector/runtime"
17
+ ADMIN_INSPECTOR_PLUGINS = "/api/v1/admin/inspector/plugins"
18
+ ADMIN_AUTH_API_KEYS = "/api/v1/admin/auth/api-keys"
19
+ ADMIN_AUTH_API_KEYS_REVOKE = "/api/v1/admin/auth/api-keys/revoke"
20
+ ADMIN_AUTH_API_KEYS_ROTATE = "/api/v1/admin/auth/api-keys/rotate"
21
+ ADMIN_AUTH_USERS = "/api/v1/admin/auth/users"
22
+ ADMIN_AUTH_SESSIONS = "/api/v1/admin/auth/sessions"
23
+ ADMIN_AUTH_SESSIONS_REVOKE = "/api/v1/admin/auth/sessions/revoke"
24
+ ADMIN_AUTH_SESSIONS_REVOKE_ALL = "/api/v1/admin/auth/sessions/revoke-all"
25
+
26
+ # Marketplace admin — archive_path должен быть доступен процессу Core на сервере
27
+ ADMIN_MARKETPLACE_INSTALL = "/api/v1/admin/marketplace/install"
28
+ ADMIN_MARKETPLACE_INSTALL_UPLOAD = "/api/v1/admin/marketplace/install-upload"
29
+
30
+ # Auth v1
31
+ AUTH_BOOTSTRAP = "/api/v1/auth/bootstrap"
32
+ AUTH_INITIALIZE = "/api/v1/auth/initialize"
33
+ AUTH_LOGIN = "/api/v1/auth/login"
34
+ AUTH_LOGOUT = "/api/v1/auth/logout"
35
+ AUTH_REFRESH = "/api/v1/auth/refresh"
36
+ AUTH_ME = "/api/v1/auth/me"
37
+
38
+ # Plugins (пути относительно префикса из API_PREFIX_CANDIDATES: /api или /api/v1)
39
+ PLUGINS = "/plugins"
40
+ PLUGIN = "/plugins/{name}"
41
+ PLUGIN_INSTALL = "/plugins/{name}/install"
42
+ PLUGIN_START = "/plugins/{name}/start"
43
+ PLUGIN_STOP = "/plugins/{name}/stop"
44
+ PLUGIN_RELOAD = "/api/v1/admin/plugins/{name}/reload"
45
+ PLUGIN_RESTART_CONTAINER = "/api/v1/admin/plugins/{name}/restart-container"
46
+
47
+ # Modules (так же относительно префикса)
48
+ MODULES = "/modules"
49
+ MODULE_START = "/modules/{name}/start"
50
+ MODULE_STOP = "/modules/{name}/stop"
51
+ MODULE_RESTART = "/modules/{name}/restart"
52
+
53
+ # Logs
54
+ LOGS = "/logs"
55
+
56
+ # Marketplace
57
+ MARKETPLACE_INDEX = "/marketplace/index"
58
+ MARKETPLACE_SEARCH = "/marketplace/search"
59
+
hc/capabilities.py ADDED
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+
5
+ import anyio
6
+
7
+ from hc.config import Config
8
+ from hc.commands._client_helpers import client_from_config
9
+
10
+
11
+ @dataclass(slots=True)
12
+ class Capabilities:
13
+ monitor_health: bool
14
+ auth_bootstrap: bool
15
+ auth_me: bool
16
+ admin_status: bool
17
+ inspector_plugins: bool
18
+ api_keys: bool
19
+
20
+
21
+ def probe(cfg: Config) -> Capabilities:
22
+ silent = client_from_config(cfg, silent=True)
23
+
24
+ async def _run() -> Capabilities:
25
+ mh = await silent.health()
26
+ ab = await silent.auth_bootstrap()
27
+ am = await silent.auth_me()
28
+ st = await silent.admin_status()
29
+ ip = await silent.inspector_plugins()
30
+ ak = await silent.api_keys_list()
31
+ return Capabilities(
32
+ monitor_health=bool(mh),
33
+ auth_bootstrap=bool(ab),
34
+ auth_me=bool(am),
35
+ admin_status=bool(st),
36
+ inspector_plugins=bool(ip),
37
+ api_keys=bool(ak),
38
+ )
39
+
40
+ return anyio.run(_run)
41
+