verulla-cli 0.0.6__tar.gz → 0.0.7__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.
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/CHANGELOG.md +4 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/PKG-INFO +1 -1
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/pyproject.toml +1 -1
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_apps_client.py +19 -2
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_cli_import.py +1 -1
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_main.py +105 -3
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/__init__.py +1 -1
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/apps_client.py +17 -3
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/main.py +98 -21
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/.gitignore +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_admin_cmd.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_auth.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_buildkit.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_buildkit_real.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_deploy_client.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_dev_check.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_emulate.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_owner_commands.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_packaging.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_secrets_client.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/tests/test_sketch_status.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/auth.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/buildkit.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/config.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/deploy_client.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/emulate.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/packaging.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.7}/verulla_cli/secrets_client.py +0 -0
|
@@ -100,10 +100,27 @@ def test_sketch_events_passes_cursor_and_limit_without_changing_contract():
|
|
|
100
100
|
|
|
101
101
|
def test_sketch_events_rejects_invalid_response_payload():
|
|
102
102
|
client = FakeClient(response(200, {"events": [{"type": "sketch.retention_ended"}], "next_cursor": None, "has_more": False}))
|
|
103
|
-
with pytest.raises(AppsError, match="invalid
|
|
103
|
+
with pytest.raises(AppsError, match="invalid free-trial event response"):
|
|
104
104
|
get_sketch_events("http://api.test", "token", "demo", client=client)
|
|
105
105
|
|
|
106
106
|
|
|
107
|
+
@pytest.mark.parametrize(
|
|
108
|
+
("code", "message"),
|
|
109
|
+
[
|
|
110
|
+
( "spend_cap_required", "Set a monthly spending limit in the account console, then retry `verulla pro APP`."),
|
|
111
|
+
(
|
|
112
|
+
"live_activation_disabled",
|
|
113
|
+
"Pro upgrades are not available right now. Your app's data is kept for 14 days after the free trial ends.",
|
|
114
|
+
),
|
|
115
|
+
],
|
|
116
|
+
)
|
|
117
|
+
def test_activation_errors_have_actionable_non_support_only_copy(code, message):
|
|
118
|
+
client = FakeClient(response(409, {"detail": {"code": code, "message": "backend detail"}}))
|
|
119
|
+
|
|
120
|
+
with pytest.raises(AppsError, match=message.replace("'", "\\'")):
|
|
121
|
+
activate_app("http://api.test", "token", "demo", "idempotency-key", client)
|
|
122
|
+
|
|
123
|
+
|
|
107
124
|
|
|
108
125
|
def test_currency_client_calls_preserve_legacy_cent_fields_and_send_topup_currency():
|
|
109
126
|
client = FakeClient(response(201, {"topup_id": "top-1", "amount_cents": 1500, "currency": "CAD"}))
|
|
@@ -251,7 +268,7 @@ def test_activation_402_has_actionable_spending_limit_guidance():
|
|
|
251
268
|
|
|
252
269
|
def test_activation_402_explains_required_spending_limit():
|
|
253
270
|
client = FakeClient(response(402, {"detail": {"code": "spend_cap_required"}}))
|
|
254
|
-
with pytest.raises(AppsError, match="Set a monthly spending limit
|
|
271
|
+
with pytest.raises(AppsError, match="Set a monthly spending limit in the account console"):
|
|
255
272
|
activate_app("http://api.test", "token", "demo", "request-3", client)
|
|
256
273
|
|
|
257
274
|
|
|
@@ -14,7 +14,7 @@ def test_cli_reports_installed_version() -> None:
|
|
|
14
14
|
result = runner.invoke(app, ["--version"])
|
|
15
15
|
|
|
16
16
|
assert result.exit_code == 0
|
|
17
|
-
assert result.output.strip() == "verulla 0.0.
|
|
17
|
+
assert result.output.strip() == "verulla 0.0.7"
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def test_auth_and_customer_commands_are_registered() -> None:
|
|
@@ -22,12 +22,57 @@ def test_auth_and_customer_commands_are_registered() -> None:
|
|
|
22
22
|
assert result.exit_code == 0
|
|
23
23
|
assert "auth" in result.output and "customers" in result.output
|
|
24
24
|
assert "signup" in result.output
|
|
25
|
+
assert "trial" in result.output
|
|
26
|
+
assert "sketch" not in result.output
|
|
27
|
+
assert "live" not in result.output.lower()
|
|
25
28
|
for command in ("wallet", "spend", "usage", "pricing", "topup"):
|
|
26
29
|
assert command in result.output
|
|
27
30
|
for command in ("show", "set"):
|
|
28
31
|
assert command in runner.invoke(app, ["auth", "--help"]).output
|
|
29
32
|
for command in ("list", "lock", "unlock", "delete", "export", "invite"):
|
|
30
33
|
assert command in runner.invoke(app, ["customers", "--help"]).output
|
|
34
|
+
domains_help = runner.invoke(app, ["domains", "--help"])
|
|
35
|
+
assert domains_help.exit_code == 0
|
|
36
|
+
for command in ("add", "status", "verify"):
|
|
37
|
+
assert command in domains_help.output
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_trial_status_and_legacy_sketch_alias_share_the_lifecycle_receipt(monkeypatch) -> None:
|
|
41
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "token")
|
|
42
|
+
monkeypatch.setattr("verulla_cli.main.get_sketch_status", lambda *args: {
|
|
43
|
+
"app": "demo", "status": "deployed", "url": "https://demo.verulla.app",
|
|
44
|
+
})
|
|
45
|
+
trial = runner.invoke(app, ["trial", "status", "demo"])
|
|
46
|
+
legacy = runner.invoke(app, ["sketch", "status", "demo"])
|
|
47
|
+
assert trial.exit_code == 0, trial.output
|
|
48
|
+
assert legacy.exit_code == 0, legacy.output
|
|
49
|
+
assert "app: demo" in trial.output
|
|
50
|
+
assert "app: demo" in legacy.output
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_domains_add_prints_both_customer_dns_records(monkeypatch) -> None:
|
|
54
|
+
monkeypatch.setattr("verulla_cli.main._agent_token", lambda: "agent-token")
|
|
55
|
+
monkeypatch.setattr("verulla_cli.main.api_add_domain", lambda *args: {
|
|
56
|
+
"id": "domain-id", "status": "pending_dns",
|
|
57
|
+
"dns_instructions": [
|
|
58
|
+
{"type": "CNAME", "name": "shop.example.com", "target": "domains.verulla.app",
|
|
59
|
+
"purpose": "Routes this hostname to Verulla."},
|
|
60
|
+
{"type": "CNAME", "name": "_acme-challenge.shop.example.com",
|
|
61
|
+
"target": "deadbeef.acme.verulla.app",
|
|
62
|
+
"purpose": "Delegates certificate validation; leave this record in place."},
|
|
63
|
+
{"type": "ALIAS/ANAME", "name": "example.com", "target": "domains.verulla.app",
|
|
64
|
+
"purpose": "At a zone apex, use provider flattening."},
|
|
65
|
+
{"type": "CNAME", "name": "_acme-challenge.example.com",
|
|
66
|
+
"target": "deadbeef.acme.verulla.app",
|
|
67
|
+
"purpose": "Delegates certificate validation; leave this record in place."},
|
|
68
|
+
],
|
|
69
|
+
})
|
|
70
|
+
result = runner.invoke(app, ["domains", "add", "demo", "shop.example.com"])
|
|
71
|
+
assert result.exit_code == 0, result.output
|
|
72
|
+
assert "Add a CNAME record named shop.example.com pointing to domains.verulla.app." in result.output
|
|
73
|
+
assert "Add a CNAME record named _acme-challenge.shop.example.com pointing to deadbeef.acme.verulla.app." in result.output
|
|
74
|
+
assert "At the zone apex, add a provider-flattened ALIAS/ANAME (or CNAME-flattening) record named example.com pointing to domains.verulla.app." in result.output
|
|
75
|
+
assert "Add a CNAME record named _acme-challenge.example.com pointing to deadbeef.acme.verulla.app." in result.output
|
|
31
76
|
|
|
32
77
|
|
|
33
78
|
def test_signup_stores_key_privately_and_redacts_output(tmp_path, monkeypatch) -> None:
|
|
@@ -181,7 +226,7 @@ def test_help_lists_all_commands() -> None:
|
|
|
181
226
|
result = runner.invoke(app, ["--help"])
|
|
182
227
|
assert result.exit_code == 0
|
|
183
228
|
assert "https://api.verulla.app" in result.output
|
|
184
|
-
for name in ("login", "dev", "deploy", "secrets", "logs", "apps", "status", "delete", "rollback", "
|
|
229
|
+
for name in ("login", "dev", "deploy", "secrets", "logs", "apps", "status", "delete", "rollback", "pro"):
|
|
185
230
|
assert name in result.output
|
|
186
231
|
|
|
187
232
|
|
|
@@ -407,7 +452,7 @@ def test_deploy_wait_success_prints_sketch_handoff(tmp_path, monkeypatch) -> Non
|
|
|
407
452
|
assert "2026-11-06T12:00:00Z" in result.output
|
|
408
453
|
assert "72 hours" in result.output
|
|
409
454
|
assert "custom domain" in result.output.lower()
|
|
410
|
-
assert "verulla
|
|
455
|
+
assert "verulla trial status demo-app" in result.output
|
|
411
456
|
assert "owner claim status: pending" in result.output.lower()
|
|
412
457
|
|
|
413
458
|
|
|
@@ -641,6 +686,63 @@ def test_live_confirmation_decline_does_not_activate(monkeypatch) -> None:
|
|
|
641
686
|
assert calls == []
|
|
642
687
|
|
|
643
688
|
|
|
689
|
+
def test_live_when_disabled_explains_data_retention_and_current_unavailability(monkeypatch) -> None:
|
|
690
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
691
|
+
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"live_activation_available": False})
|
|
692
|
+
|
|
693
|
+
result = runner.invoke(app, ["live", "demo", "--api-url", "https://api.test"])
|
|
694
|
+
|
|
695
|
+
assert result.exit_code == 1
|
|
696
|
+
assert "Pro upgrades are not available right now. Your app's data is kept for 14 days after the free trial ends." in result.output
|
|
697
|
+
assert "contact" not in result.output.lower()
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
def test_live_help_explains_free_trial_to_paid_live() -> None:
|
|
701
|
+
result = runner.invoke(app, ["live", "--help"])
|
|
702
|
+
|
|
703
|
+
assert result.exit_code == 0
|
|
704
|
+
assert "free 72-hour trial" in result.output
|
|
705
|
+
assert "paid Pro" in result.output
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
def test_pro_is_documented_command_and_live_remains_compatible_alias() -> None:
|
|
709
|
+
help_result = runner.invoke(app, ["--help"])
|
|
710
|
+
assert "pro" in help_result.output
|
|
711
|
+
assert "live" not in help_result.output
|
|
712
|
+
pro_help = runner.invoke(app, ["pro", "--help"])
|
|
713
|
+
live_help = runner.invoke(app, ["live", "--help"])
|
|
714
|
+
assert pro_help.exit_code == 0
|
|
715
|
+
assert live_help.exit_code == 0
|
|
716
|
+
assert "Pro" in pro_help.output
|
|
717
|
+
assert "Pro" in live_help.output
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
def test_live_when_already_live_does_not_claim_upgrades_are_opening_soon(monkeypatch) -> None:
|
|
721
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
722
|
+
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"live_activation_available": False, "tier_id": "live"})
|
|
723
|
+
|
|
724
|
+
result = runner.invoke(app, ["live", "demo", "--api-url", "https://api.test"])
|
|
725
|
+
|
|
726
|
+
assert result.exit_code == 0
|
|
727
|
+
assert "already on Pro" in result.output
|
|
728
|
+
assert "opening soon" not in result.output
|
|
729
|
+
assert "14 days" not in result.output
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def test_status_prints_machine_readable_next_step(monkeypatch) -> None:
|
|
733
|
+
step = {
|
|
734
|
+
"action": "upgrade_to_live", "command": "verulla live <app>",
|
|
735
|
+
"docs_url": "https://verulla.com/docs/agent-guide.md#keep-your-app-online", "available": False,
|
|
736
|
+
}
|
|
737
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
738
|
+
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"app": "demo", "status": "suspended", "next_step": step})
|
|
739
|
+
|
|
740
|
+
result = runner.invoke(app, ["status", "demo", "--api-url", "https://api.test"])
|
|
741
|
+
|
|
742
|
+
assert result.exit_code == 0, result.output
|
|
743
|
+
assert 'next_step: {"action":"upgrade_to_live","command":"verulla live <app>","docs_url":"https://verulla.com/docs/agent-guide.md#keep-your-app-online","available":false}' in result.output
|
|
744
|
+
|
|
745
|
+
|
|
644
746
|
def test_live_uses_wallet_currency_for_price_and_headroom(monkeypatch) -> None:
|
|
645
747
|
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
646
748
|
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"live_activation_available": True})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from typing import Any
|
|
4
|
+
from urllib.parse import quote
|
|
4
5
|
|
|
5
6
|
import httpx
|
|
6
7
|
from verulla_manifest.sketch_events import validate_sketch_event_page
|
|
@@ -37,8 +38,8 @@ def _request(api_url: str, token: str, method: str, path: str, client=None, *, e
|
|
|
37
38
|
message = {
|
|
38
39
|
"insufficient_wallet_funds": "Not enough wallet funds. Top up your wallet, then run this command again.",
|
|
39
40
|
"spend_cap_exceeded": "This would exceed your spending limit. Ask the account owner to raise the limit, then try again.",
|
|
40
|
-
"spend_cap_required": "Set a monthly spending limit
|
|
41
|
-
"live_activation_disabled": "
|
|
41
|
+
"spend_cap_required": "Set a monthly spending limit in the account console, then retry `verulla pro APP`.",
|
|
42
|
+
"live_activation_disabled": "Pro upgrades are not available right now. Your app's data is kept for 14 days after the free trial ends.",
|
|
42
43
|
}.get(code_text, detail.get("message") or str(detail))
|
|
43
44
|
detail = f"{message} (code: {code_text})" if code_text else message
|
|
44
45
|
else:
|
|
@@ -112,7 +113,7 @@ def get_sketch_events(api_url: str, token: str, name: str, *, cursor: str | None
|
|
|
112
113
|
try:
|
|
113
114
|
return validate_sketch_event_page(response)
|
|
114
115
|
except ValueError as exc:
|
|
115
|
-
raise AppsError(f"invalid
|
|
116
|
+
raise AppsError(f"invalid free-trial event response: {exc}") from exc
|
|
116
117
|
|
|
117
118
|
def get_sketch_status(api_url: str, token: str, name: str, client=None) -> dict:
|
|
118
119
|
from urllib.parse import quote
|
|
@@ -221,3 +222,16 @@ def rollback_app(api_url: str, token: str, name: str, client=None) -> dict:
|
|
|
221
222
|
def export_customers(api_url: str, token: str, app: str, client=None) -> str:
|
|
222
223
|
from urllib.parse import quote
|
|
223
224
|
return _request(api_url, token, "GET", f"/v1/apps/{quote(app, safe='')}/customers/export", client, raw=True)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def add_domain(api_url: str, token: str, app: str, host: str, client=None) -> dict:
|
|
228
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains", client,
|
|
229
|
+
json_body={"host": host})
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def list_domains(api_url: str, token: str, app: str, client=None) -> dict:
|
|
233
|
+
return _request(api_url, token, "GET", f"/v1/apps/{quote(app, safe='')}/domains", client)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def verify_domain(api_url: str, token: str, app: str, host: str, client=None) -> dict:
|
|
237
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}/verify", client)
|
|
@@ -17,6 +17,9 @@ from verulla_cli.auth import CREDENTIALS_PATH, DeviceLoginError, get_token, run_
|
|
|
17
17
|
from verulla_manifest import load_manifest, translate
|
|
18
18
|
from verulla_cli.apps_client import (
|
|
19
19
|
AppsError,
|
|
20
|
+
add_domain as api_add_domain,
|
|
21
|
+
list_domains as api_list_domains,
|
|
22
|
+
verify_domain as api_verify_domain,
|
|
20
23
|
create_signup,
|
|
21
24
|
activate_app,
|
|
22
25
|
delete_app as api_delete_app,
|
|
@@ -72,10 +75,15 @@ def _main(
|
|
|
72
75
|
raise typer.Exit()
|
|
73
76
|
|
|
74
77
|
|
|
75
|
-
sketch_app = typer.Typer(name="sketch", help="Inspect
|
|
76
|
-
|
|
78
|
+
sketch_app = typer.Typer(name="sketch", help="Inspect free-trial lifecycle status.", no_args_is_help=True)
|
|
79
|
+
trial_app = typer.Typer(name="trial", help="Inspect free-trial lifecycle status.", no_args_is_help=True)
|
|
80
|
+
app.add_typer(trial_app, name="trial")
|
|
81
|
+
# Keep the pre-rename command group working for existing scripts.
|
|
82
|
+
app.add_typer(sketch_app, name="sketch", hidden=True)
|
|
77
83
|
owner_app = typer.Typer(name="owner", help="Manage the verified owner hand-off.", no_args_is_help=True)
|
|
78
84
|
app.add_typer(owner_app, name="owner")
|
|
85
|
+
domains_app = typer.Typer(name="domains", help="Manage custom domains and DNS records.", no_args_is_help=True)
|
|
86
|
+
app.add_typer(domains_app, name="domains")
|
|
79
87
|
|
|
80
88
|
_SKETCH_RECEIPT_FIELDS = {
|
|
81
89
|
"app", "tier", "slug", "status", "lifecycle_state", "trial_started_at",
|
|
@@ -272,7 +280,7 @@ def dev(
|
|
|
272
280
|
if output.strip():
|
|
273
281
|
typer.echo(output.rstrip())
|
|
274
282
|
if not check:
|
|
275
|
-
typer.echo("Interactive local preview requires Docker; use verulla deploy to a
|
|
283
|
+
typer.echo("Interactive local preview requires Docker; use verulla deploy to a free-trial app for the remote runtime.")
|
|
276
284
|
return
|
|
277
285
|
return
|
|
278
286
|
runner = docker_runner
|
|
@@ -449,16 +457,16 @@ def deploy(
|
|
|
449
457
|
try:
|
|
450
458
|
receipt = _safe_sketch_receipt(get_sketch_status(api_url.rstrip("/"), token, deployment["app"]))
|
|
451
459
|
except AppsError as exc:
|
|
452
|
-
typer.echo(f"Deployment succeeded, but the
|
|
460
|
+
typer.echo(f"Deployment succeeded, but the free-trial receipt could not be loaded: {exc}", err=True)
|
|
453
461
|
raise typer.Exit(code=1) from exc
|
|
454
|
-
typer.echo("
|
|
462
|
+
typer.echo("Free-trial hand-off")
|
|
455
463
|
typer.echo(f"Public URL: {receipt.get('url') or deployment.get('url') or '(not provided)'}")
|
|
456
464
|
typer.echo(f"Expires at: {receipt.get('expires_at') or '(expiry not provided by API)'}")
|
|
457
465
|
typer.echo(f"Owner claim status: {receipt.get('claim_status') or '(not provided)'}")
|
|
458
466
|
typer.echo("Trial: free for 72 hours from first successful deployment; no custom domain.")
|
|
459
467
|
if receipt.get("limits_url"):
|
|
460
468
|
typer.echo(f"Limits: {receipt['limits_url']}")
|
|
461
|
-
typer.echo(f"Next: share the public URL with the verified owner, then run `verulla
|
|
469
|
+
typer.echo(f"Next: share the public URL with the verified owner, then run `verulla trial status {deployment['app']}` before the free trial expires.")
|
|
462
470
|
|
|
463
471
|
|
|
464
472
|
secrets_app = typer.Typer(help="Manage per-tenant secrets and environment variables.")
|
|
@@ -625,6 +633,8 @@ def apps(
|
|
|
625
633
|
f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
|
|
626
634
|
f"{row.get('url') or '-'}"
|
|
627
635
|
)
|
|
636
|
+
if row.get("next_step") is not None:
|
|
637
|
+
typer.echo(f" next_step: {json.dumps(row['next_step'], separators=(',', ':'))}")
|
|
628
638
|
if row.get("runtime_health_reason"):
|
|
629
639
|
typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
|
|
630
640
|
|
|
@@ -643,11 +653,11 @@ def wallet(
|
|
|
643
653
|
|
|
644
654
|
@app.command()
|
|
645
655
|
def usage(
|
|
646
|
-
app_name: str | None = typer.Argument(None, help="Optional
|
|
656
|
+
app_name: str | None = typer.Argument(None, help="Optional Pro app name; omit to show all Pro apps."),
|
|
647
657
|
month: str | None = typer.Option(None, "--month", help="Calendar usage month in YYYY-MM format (legacy view)."),
|
|
648
658
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True, help="Verulla control plane base URL."),
|
|
649
659
|
) -> None:
|
|
650
|
-
"""Show
|
|
660
|
+
"""Show Pro term allowances, usage, projected costs and spending headroom."""
|
|
651
661
|
try:
|
|
652
662
|
if month is not None:
|
|
653
663
|
result = get_usage_summary(api_url.rstrip("/"), get_token(), month=month)
|
|
@@ -702,12 +712,12 @@ def topup(
|
|
|
702
712
|
|
|
703
713
|
|
|
704
714
|
@app.command()
|
|
705
|
-
def
|
|
706
|
-
app_name: str = typer.Argument(..., metavar="APP", help="App to
|
|
715
|
+
def pro(
|
|
716
|
+
app_name: str = typer.Argument(..., metavar="APP", help="App to move from its free trial to paid Pro."),
|
|
707
717
|
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
|
|
708
718
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True, help="Verulla control plane base URL."),
|
|
709
719
|
) -> None:
|
|
710
|
-
"""
|
|
720
|
+
"""Move an app from its free 72-hour trial to paid Pro at the published price."""
|
|
711
721
|
try:
|
|
712
722
|
token = get_token()
|
|
713
723
|
except DeviceLoginError:
|
|
@@ -715,14 +725,20 @@ def live(
|
|
|
715
725
|
raise typer.Exit(code=1)
|
|
716
726
|
try:
|
|
717
727
|
app_status = get_app(api_url.rstrip("/"), token, app_name)
|
|
728
|
+
if app_status.get("tier_id", app_status.get("tier")) == "live":
|
|
729
|
+
typer.echo("This app is already on Pro.")
|
|
730
|
+
raise typer.Exit(code=0)
|
|
718
731
|
if app_status.get("live_activation_available") is not True:
|
|
719
|
-
typer.echo(
|
|
732
|
+
typer.echo(
|
|
733
|
+
"Pro upgrades are not available right now. Your app's data is kept for 14 days after the free trial ends.",
|
|
734
|
+
err=True,
|
|
735
|
+
)
|
|
720
736
|
raise typer.Exit(code=1)
|
|
721
737
|
spend = get_spend_summary(api_url.rstrip("/"), token)
|
|
722
738
|
currency = spend.get("currency", "USD")
|
|
723
739
|
contract = get_pricing(api_url.rstrip("/"), token)
|
|
724
740
|
except AppsError as exc:
|
|
725
|
-
typer.echo(f"Error checking
|
|
741
|
+
typer.echo(f"Error checking Pro availability or spending-limit headroom: {exc}", err=True)
|
|
726
742
|
raise typer.Exit(code=1) from exc
|
|
727
743
|
live_tier = next((tier for tier in contract.get("tiers", []) if tier.get("id") == "live"), {})
|
|
728
744
|
prices = live_tier.get("prices_cents", {})
|
|
@@ -730,7 +746,7 @@ def live(
|
|
|
730
746
|
if price_cents is None:
|
|
731
747
|
price_cents = live_tier.get("price_usd_cents") if currency == "USD" else live_tier.get("price_cad_cents")
|
|
732
748
|
if currency not in {"USD", "CAD"} or not isinstance(price_cents, int):
|
|
733
|
-
typer.echo(f"Unsupported wallet currency {currency!r} for
|
|
749
|
+
typer.echo(f"Unsupported wallet currency {currency!r} for Pro pricing.", err=True)
|
|
734
750
|
raise typer.Exit(code=1)
|
|
735
751
|
symbol = "C$" if currency == "CAD" else "US$"
|
|
736
752
|
price_text = f"{symbol}{price_cents // 100:,}.{price_cents % 100:02d}"
|
|
@@ -739,16 +755,20 @@ def live(
|
|
|
739
755
|
headroom = f"{symbol}{remaining // 100:,}.{remaining % 100:02d}"
|
|
740
756
|
else:
|
|
741
757
|
headroom = "no spending limit set"
|
|
742
|
-
typer.echo(f"
|
|
758
|
+
typer.echo(f"Pro costs {price_text} per 30 days ({currency}).")
|
|
743
759
|
typer.echo(f"Spending-limit headroom: {headroom}.")
|
|
744
760
|
if not yes:
|
|
745
|
-
typer.confirm(f"
|
|
761
|
+
typer.confirm(f"Move {app_name!r} to Pro for {price_text} per 30 days?", abort=True)
|
|
746
762
|
try:
|
|
747
763
|
result = activate_app(api_url.rstrip("/"), token, app_name, str(uuid.uuid4()))
|
|
748
764
|
except AppsError as exc:
|
|
749
765
|
typer.echo(f"Error: {exc}", err=True)
|
|
750
766
|
raise typer.Exit(code=1) from exc
|
|
751
|
-
typer.echo(f"{app_name} is
|
|
767
|
+
typer.echo(f"{app_name} is Pro through {result.get('paid_through')} (price {result.get('pricing_version')}).")
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
# Deprecated command name retained for existing scripts and agents.
|
|
771
|
+
app.command("live", hidden=True)(pro)
|
|
752
772
|
|
|
753
773
|
|
|
754
774
|
@app.command()
|
|
@@ -770,13 +790,16 @@ def status(
|
|
|
770
790
|
f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
|
|
771
791
|
f"{row.get('url') or '-'}"
|
|
772
792
|
)
|
|
793
|
+
if row.get("next_step") is not None:
|
|
794
|
+
typer.echo(f" next_step: {json.dumps(row['next_step'], separators=(',', ':'))}")
|
|
773
795
|
if row.get("runtime_health_reason"):
|
|
774
796
|
typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
|
|
775
797
|
else:
|
|
776
798
|
row = get_app(api_url.rstrip("/"), token, app_name)
|
|
777
|
-
for key in ("app", "tier_id", "pricing_version", "paid_through", "renewal_date", "status", "runtime_health", "runtime_health_reason", "latest_deployment_id", "source_sha", "function_count", "url", "updated_at", "error", "functions"):
|
|
799
|
+
for key in ("app", "tier_id", "pricing_version", "paid_through", "renewal_date", "status", "next_step", "runtime_health", "runtime_health_reason", "latest_deployment_id", "source_sha", "function_count", "url", "updated_at", "error", "functions"):
|
|
778
800
|
if key in row:
|
|
779
|
-
|
|
801
|
+
value = json.dumps(row[key], separators=(',', ':')) if key == "next_step" else row[key]
|
|
802
|
+
typer.echo(f"{key}: {value}")
|
|
780
803
|
except AppsError as exc:
|
|
781
804
|
typer.echo(f"Error: {exc}", err=True)
|
|
782
805
|
raise typer.Exit(code=1) from exc
|
|
@@ -790,7 +813,7 @@ def sketch_events(
|
|
|
790
813
|
json_output: bool = typer.Option(False, "--json", help="Print the shared API event envelope as JSON."),
|
|
791
814
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
792
815
|
) -> None:
|
|
793
|
-
"""Poll durable
|
|
816
|
+
"""Poll durable free-trial countdown events after the supplied cursor."""
|
|
794
817
|
result = _auth_api_call(
|
|
795
818
|
get_sketch_events, api_url.rstrip("/"), _agent_token(), app_name,
|
|
796
819
|
cursor=cursor, limit=limit,
|
|
@@ -809,7 +832,7 @@ def sketch_status(
|
|
|
809
832
|
json_output: bool = typer.Option(False, "--json", help="Print the receipt as JSON."),
|
|
810
833
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True, help="Verulla control plane base URL."),
|
|
811
834
|
) -> None:
|
|
812
|
-
"""Show the shared
|
|
835
|
+
"""Show the shared free-trial lifecycle receipt for APP."""
|
|
813
836
|
try:
|
|
814
837
|
token = get_token()
|
|
815
838
|
except DeviceLoginError:
|
|
@@ -828,6 +851,10 @@ def sketch_status(
|
|
|
828
851
|
typer.echo(f"{key}: {receipt[key]}")
|
|
829
852
|
|
|
830
853
|
|
|
854
|
+
trial_app.command("events")(sketch_events)
|
|
855
|
+
trial_app.command("status")(sketch_status)
|
|
856
|
+
|
|
857
|
+
|
|
831
858
|
@owner_app.command("claim")
|
|
832
859
|
def owner_claim(
|
|
833
860
|
app_name: str = typer.Argument(..., metavar="APP"),
|
|
@@ -1069,6 +1096,56 @@ def _auth_api_call(fn, *args, **kwargs):
|
|
|
1069
1096
|
raise typer.Exit(code=1) from exc
|
|
1070
1097
|
|
|
1071
1098
|
|
|
1099
|
+
def _print_dns_instructions(records: list[dict]) -> None:
|
|
1100
|
+
for record in records:
|
|
1101
|
+
destination = record.get("target", record.get("value", ""))
|
|
1102
|
+
if record["type"] == "ALIAS/ANAME":
|
|
1103
|
+
typer.echo(
|
|
1104
|
+
f"At the zone apex, add a provider-flattened ALIAS/ANAME (or CNAME-flattening) "
|
|
1105
|
+
f"record named {record['name']} pointing to {destination}."
|
|
1106
|
+
)
|
|
1107
|
+
else:
|
|
1108
|
+
typer.echo(f"Add a {record['type']} record named {record['name']} pointing to {destination}.")
|
|
1109
|
+
typer.echo(f" {record.get('purpose', '')}")
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
@domains_app.command("add")
|
|
1113
|
+
def domains_add(
|
|
1114
|
+
app_name: str = typer.Argument(..., metavar="APP"),
|
|
1115
|
+
host: str = typer.Argument(..., metavar="HOST"),
|
|
1116
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
1117
|
+
) -> None:
|
|
1118
|
+
"""Claim a custom hostname and print its required DNS records."""
|
|
1119
|
+
result = _auth_api_call(api_add_domain, api_url.rstrip("/"), _agent_token(), app_name, host)
|
|
1120
|
+
_print_dns_instructions(result.get("dns_instructions", []))
|
|
1121
|
+
typer.echo(json.dumps({key: value for key, value in result.items() if key != "dns_instructions"}, indent=2))
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
@domains_app.command("status")
|
|
1125
|
+
def domains_status(
|
|
1126
|
+
app_name: str = typer.Argument(..., metavar="APP"),
|
|
1127
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
1128
|
+
) -> None:
|
|
1129
|
+
"""List custom domains and restate their persistent DNS records."""
|
|
1130
|
+
result = _auth_api_call(api_list_domains, api_url.rstrip("/"), _agent_token(), app_name)
|
|
1131
|
+
for domain in result.get("domains", []):
|
|
1132
|
+
typer.echo(f"{domain['host']}: {domain['status']}")
|
|
1133
|
+
_print_dns_instructions(domain.get("dns_records", []))
|
|
1134
|
+
typer.echo(json.dumps(result, indent=2))
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
@domains_app.command("verify")
|
|
1138
|
+
def domains_verify(
|
|
1139
|
+
app_name: str = typer.Argument(..., metavar="APP"),
|
|
1140
|
+
host: str = typer.Argument(..., metavar="HOST"),
|
|
1141
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
1142
|
+
) -> None:
|
|
1143
|
+
"""Request DNS verification and print any rotated DNS instructions."""
|
|
1144
|
+
result = _auth_api_call(api_verify_domain, api_url.rstrip("/"), _agent_token(), app_name, host)
|
|
1145
|
+
_print_dns_instructions(result.get("dns_instructions", []))
|
|
1146
|
+
typer.echo(json.dumps({key: value for key, value in result.items() if key != "dns_instructions"}, indent=2))
|
|
1147
|
+
|
|
1148
|
+
|
|
1072
1149
|
@auth_app.command("show")
|
|
1073
1150
|
def auth_show(app_name: str = typer.Argument(..., metavar="APP"), api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True)) -> None:
|
|
1074
1151
|
"""Show the app's AuthPolicy and version."""
|
|
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
|