hop3-cli 0.5.0.dev1__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 (55) hide show
  1. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/PKG-INFO +25 -13
  2. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/README.md +24 -12
  3. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/pyproject.toml +1 -1
  4. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/__init__.py +2 -0
  5. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/arguments.py +237 -132
  6. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/destructive.py +68 -30
  7. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/flags.py +78 -27
  8. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/help.py +125 -22
  9. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/__init__.py +34 -27
  10. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/aliases_cmd.py +2 -14
  11. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/auth_cmd.py +0 -1
  12. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/completion_cmd.py +2 -46
  13. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/context_cmd.py +143 -57
  14. hop3_cli-0.6.0/src/hop3_cli/commands/local/help_text.py +314 -0
  15. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/init_cmd.py +12 -2
  16. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/login_cmd.py +41 -70
  17. hop3_cli-0.6.0/src/hop3_cli/commands/local/project_context_cmd.py +776 -0
  18. hop3_cli-0.6.0/src/hop3_cli/commands/local/server_cmd.py +586 -0
  19. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/settings_cmd.py +16 -0
  20. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/ssh_ops.py +20 -1
  21. hop3_cli-0.6.0/src/hop3_cli/commands/local/tunnel_cmd.py +187 -0
  22. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/use_cmd.py +2 -8
  23. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/config.py +73 -53
  24. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/core/alias_registry.py +1 -0
  25. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/core/aliases.py +6 -15
  26. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/core/app_scope.py +53 -13
  27. hop3_cli-0.6.0/src/hop3_cli/core/cli_state.py +117 -0
  28. hop3_cli-0.6.0/src/hop3_cli/core/context_names.py +72 -0
  29. hop3_cli-0.6.0/src/hop3_cli/core/deploy_preview.py +404 -0
  30. hop3_cli-0.6.0/src/hop3_cli/core/hop3_toml.py +86 -0
  31. hop3_cli-0.6.0/src/hop3_cli/core/local_overlay.py +331 -0
  32. hop3_cli-0.6.0/src/hop3_cli/core/project_guard.py +171 -0
  33. hop3_cli-0.6.0/src/hop3_cli/core/resolution.py +930 -0
  34. hop3_cli-0.6.0/src/hop3_cli/core/server_registry.py +309 -0
  35. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/exit_codes.py +26 -45
  36. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/main.py +322 -62
  37. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/rpc/__init__.py +1 -2
  38. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/rpc/client.py +13 -20
  39. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/rpc/responses.py +73 -6
  40. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/rpc/streaming.py +72 -32
  41. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/tokens.py +6 -3
  42. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/types.py +0 -1
  43. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/ui/__init__.py +1 -2
  44. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/ui/console.py +0 -5
  45. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/ui/prompts.py +0 -11
  46. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/ui/rich_printer.py +35 -46
  47. hop3_cli-0.5.0.dev1/src/hop3_cli/commands/local/help_text.py +0 -166
  48. hop3_cli-0.5.0.dev1/src/hop3_cli/core/resolution.py +0 -186
  49. hop3_cli-0.5.0.dev1/src/hop3_cli/rpc/tunnel.py +0 -177
  50. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/__init__.py +0 -0
  51. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/commands/local/version_cmd.py +0 -0
  52. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/core/__init__.py +0 -0
  53. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/core/suggest.py +0 -0
  54. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/exceptions.py +0 -0
  55. {hop3_cli-0.5.0.dev1 → hop3_cli-0.6.0}/src/hop3_cli/ui/messages.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hop3-cli
3
- Version: 0.5.0.dev1
3
+ Version: 0.6.0
4
4
  Summary:
5
5
  Author: Stefane Fermigier
6
6
  Author-email: Stefane Fermigier <sf@abilian.com>
@@ -57,43 +57,55 @@ hop3 apps
57
57
  hop3 use myapp
58
58
 
59
59
  # From here on, app-scoped commands resolve myapp automatically:
60
- hop3 logs
60
+ hop3 app logs
61
61
  hop3 config set KEY=value
62
- hop3 restart
62
+ hop3 app restart
63
63
  ```
64
64
 
65
65
  ## App Resolution
66
66
 
67
- Commands that act on a single app (`logs`, `restart`, `config set`, `run`, …) no longer take the app name as a positional argument. Instead the CLI resolves it from a layered chain, walking sources until one supplies a value (ADR 036 D7):
67
+ Commands that act on a single app (`logs`, `restart`, `config set`, `run`, …) no longer take the app name as a positional argument. Instead the CLI resolves it from a layered chain, walking sources until one supplies a value (ADR 042 §Resolution chains; supersedes ADR 036 §D7):
68
68
 
69
69
  1. `--app <name>` / `-a <name>` — explicit flag, wins over everything.
70
70
  2. `$HOP3_APP` — environment variable for the current shell.
71
71
  3. `.hop3-app` — one-line file in CWD or any ancestor up to `$HOME`. Drop it in a project repo and `hop3` from inside picks up the right app.
72
72
  4. `hop3.toml [cli].app` — same search path as `.hop3-app`, lower priority.
73
- 5. Active context's `default_app` — set via `hop3 use <app>`.
73
+ 5. `hop3.toml [contexts.<resolved-context>].app` — when a project context resolves (see below), its `app` field becomes the source. Lets one project map per-environment to different apps.
74
+ 6. `hop3.toml [metadata].id` — the project's canonical name. The "I'm physically standing in this project" source; outranks any server-level default so being inside a project always wins over a sticky binding from elsewhere.
75
+ 7. Git remote `hop3-<env>` parsed for an app name — supports `git push hop3-prod main` style deploys.
76
+ 8. Active server's `default_app` from `~/.config/hop3-cli/servers.toml` — set via `hop3 server use --default-app <app>`. Lowest-priority fallback for single-app users.
74
77
 
75
- Use `hop3 --why <command>` to print the full trace and see which source won.
78
+ Use `hop3 --why <command>` to print the full trace and see which source won. `--why` is diagnostic-only: the command itself is not executed (so `hop3 deploy --why` is safe to run).
76
79
 
77
80
  ```bash
78
81
  # Explicit (always works):
79
- hop3 logs --app myapp
82
+ hop3 app logs --app myapp
80
83
  hop3 config set --app myapp KEY=value
81
84
 
82
- # Sticky app for the context:
83
- hop3 use myapp
84
- hop3 logs
85
-
86
85
  # Per-shell:
87
86
  export HOP3_APP=myapp
88
87
 
89
- # Per-directory:
88
+ # Per-directory (legacy pin file):
90
89
  echo myapp > .hop3-app
91
90
 
91
+ # Per-project, declared in hop3.toml:
92
+ # [metadata]
93
+ # id = "myapp"
94
+ # [contexts.staging]
95
+ # app = "myapp-staging"
96
+
92
97
  # Debug:
93
98
  hop3 --why logs
94
99
  ```
95
100
 
96
- See [CLI Reference: App Resolution](../../docs/src/reference/cli.md#app-resolution) for the full specification.
101
+ The ADR 042 model splits the old "context" noun into two concepts:
102
+
103
+ - **Server records** — credentialed bindings to a Hop3 server. Live in `~/.config/hop3-cli/servers.toml`. Managed with `hop3 server` (`add` / `list` / `show` / `use` / `login` / `remove`).
104
+ - **Project contexts** — environment-shaped overlays on a single project. Declared as `[contexts.<name>]` blocks inside `hop3.toml`. Managed with `hop3 context` from inside a project tree (`init` / `use` / `list` / `show` / `add` / `remove`). The currently-selected one is recorded in `.hop3-local.toml` (gitignored automatically).
105
+
106
+ A `hop3 deploy` from a project tree resolves: server (which Hop3 to talk to) + context (which environment of this project) + app (which app on that server) — and shows a preview-and-confirm prompt with the plan before invoking the deploy RPC. `--dry-run` exits after printing the plan; `--force` bypasses the project-mismatch safety guard.
107
+
108
+ See [CLI Reference: App Resolution](../../docs/src/reference/cli.md#app-resolution) and [ADR 042](../../notes/adrs/042-cli-context-model.md) for the full specification.
97
109
 
98
110
  ## Configuration
99
111
 
@@ -37,43 +37,55 @@ hop3 apps
37
37
  hop3 use myapp
38
38
 
39
39
  # From here on, app-scoped commands resolve myapp automatically:
40
- hop3 logs
40
+ hop3 app logs
41
41
  hop3 config set KEY=value
42
- hop3 restart
42
+ hop3 app restart
43
43
  ```
44
44
 
45
45
  ## App Resolution
46
46
 
47
- Commands that act on a single app (`logs`, `restart`, `config set`, `run`, …) no longer take the app name as a positional argument. Instead the CLI resolves it from a layered chain, walking sources until one supplies a value (ADR 036 D7):
47
+ Commands that act on a single app (`logs`, `restart`, `config set`, `run`, …) no longer take the app name as a positional argument. Instead the CLI resolves it from a layered chain, walking sources until one supplies a value (ADR 042 §Resolution chains; supersedes ADR 036 §D7):
48
48
 
49
49
  1. `--app <name>` / `-a <name>` — explicit flag, wins over everything.
50
50
  2. `$HOP3_APP` — environment variable for the current shell.
51
51
  3. `.hop3-app` — one-line file in CWD or any ancestor up to `$HOME`. Drop it in a project repo and `hop3` from inside picks up the right app.
52
52
  4. `hop3.toml [cli].app` — same search path as `.hop3-app`, lower priority.
53
- 5. Active context's `default_app` — set via `hop3 use <app>`.
53
+ 5. `hop3.toml [contexts.<resolved-context>].app` — when a project context resolves (see below), its `app` field becomes the source. Lets one project map per-environment to different apps.
54
+ 6. `hop3.toml [metadata].id` — the project's canonical name. The "I'm physically standing in this project" source; outranks any server-level default so being inside a project always wins over a sticky binding from elsewhere.
55
+ 7. Git remote `hop3-<env>` parsed for an app name — supports `git push hop3-prod main` style deploys.
56
+ 8. Active server's `default_app` from `~/.config/hop3-cli/servers.toml` — set via `hop3 server use --default-app <app>`. Lowest-priority fallback for single-app users.
54
57
 
55
- Use `hop3 --why <command>` to print the full trace and see which source won.
58
+ Use `hop3 --why <command>` to print the full trace and see which source won. `--why` is diagnostic-only: the command itself is not executed (so `hop3 deploy --why` is safe to run).
56
59
 
57
60
  ```bash
58
61
  # Explicit (always works):
59
- hop3 logs --app myapp
62
+ hop3 app logs --app myapp
60
63
  hop3 config set --app myapp KEY=value
61
64
 
62
- # Sticky app for the context:
63
- hop3 use myapp
64
- hop3 logs
65
-
66
65
  # Per-shell:
67
66
  export HOP3_APP=myapp
68
67
 
69
- # Per-directory:
68
+ # Per-directory (legacy pin file):
70
69
  echo myapp > .hop3-app
71
70
 
71
+ # Per-project, declared in hop3.toml:
72
+ # [metadata]
73
+ # id = "myapp"
74
+ # [contexts.staging]
75
+ # app = "myapp-staging"
76
+
72
77
  # Debug:
73
78
  hop3 --why logs
74
79
  ```
75
80
 
76
- See [CLI Reference: App Resolution](../../docs/src/reference/cli.md#app-resolution) for the full specification.
81
+ The ADR 042 model splits the old "context" noun into two concepts:
82
+
83
+ - **Server records** — credentialed bindings to a Hop3 server. Live in `~/.config/hop3-cli/servers.toml`. Managed with `hop3 server` (`add` / `list` / `show` / `use` / `login` / `remove`).
84
+ - **Project contexts** — environment-shaped overlays on a single project. Declared as `[contexts.<name>]` blocks inside `hop3.toml`. Managed with `hop3 context` from inside a project tree (`init` / `use` / `list` / `show` / `add` / `remove`). The currently-selected one is recorded in `.hop3-local.toml` (gitignored automatically).
85
+
86
+ A `hop3 deploy` from a project tree resolves: server (which Hop3 to talk to) + context (which environment of this project) + app (which app on that server) — and shows a preview-and-confirm prompt with the plan before invoking the deploy RPC. `--dry-run` exits after printing the plan; `--force` bypasses the project-mismatch safety guard.
87
+
88
+ See [CLI Reference: App Resolution](../../docs/src/reference/cli.md#app-resolution) and [ADR 042](../../notes/adrs/042-cli-context-model.md) for the full specification.
77
89
 
78
90
  ## Configuration
79
91
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hop3-cli"
3
- version = "0.5.0.dev1"
3
+ version = "0.6.0"
4
4
  authors = [
5
5
  {name = "Stefane Fermigier", email = "sf@abilian.com"},
6
6
  ]
@@ -19,6 +19,7 @@ from .destructive import confirm_destructive_action, is_destructive_command
19
19
  from .flags import CliFlags, parse_flags
20
20
  from .help import (
21
21
  append_feedback_footer,
22
+ append_local_commands_full_help,
22
23
  emit_status_line,
23
24
  handle_help_flags,
24
25
  inject_local_commands_into_help,
@@ -36,6 +37,7 @@ __all__ = [
36
37
  "LOCAL_COMMANDS_INFO",
37
38
  "CliFlags",
38
39
  "append_feedback_footer",
40
+ "append_local_commands_full_help",
39
41
  "confirm_destructive_action",
40
42
  "emit_status_line",
41
43
  "generate_archive",