verulla-cli 0.0.6__tar.gz → 0.0.8__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.8}/CHANGELOG.md +4 -0
- verulla_cli-0.0.8/PKG-INFO +32 -0
- verulla_cli-0.0.8/README.md +13 -0
- verulla_cli-0.0.8/pyproject.toml +35 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_apps_client.py +19 -2
- verulla_cli-0.0.8/tests/test_cli_import.py +6 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_main.py +153 -3
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/__init__.py +1 -1
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/apps_client.py +38 -3
- verulla_cli-0.0.8/verulla_cli/domains_client.py +40 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/main.py +219 -22
- verulla_cli-0.0.6/PKG-INFO +0 -8
- verulla_cli-0.0.6/pyproject.toml +0 -21
- verulla_cli-0.0.6/tests/test_cli_import.py +0 -6
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/.gitignore +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_admin_cmd.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_auth.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_buildkit.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_buildkit_real.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_deploy_client.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_dev_check.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_emulate.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_owner_commands.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_packaging.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_secrets_client.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/tests/test_sketch_status.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/auth.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/buildkit.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/config.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/deploy_client.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/emulate.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/packaging.py +0 -0
- {verulla_cli-0.0.6 → verulla_cli-0.0.8}/verulla_cli/secrets_client.py +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: verulla-cli
|
|
3
|
+
Version: 0.0.8
|
|
4
|
+
Summary: Verulla's CLI helps non-technical small-business owners using AI coding agents deploy apps while Verulla handles hosting and day-to-day operations.
|
|
5
|
+
Project-URL: Homepage, https://verulla.com
|
|
6
|
+
Project-URL: Documentation, https://verulla.com/install
|
|
7
|
+
Keywords: AI coding agents,deployment,small business
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
13
|
+
Requires-Python: >=3.12
|
|
14
|
+
Requires-Dist: docker>=7
|
|
15
|
+
Requires-Dist: httpx>=0.27
|
|
16
|
+
Requires-Dist: typer>=0.12
|
|
17
|
+
Requires-Dist: verulla-manifest==0.0.4
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
Verulla's CLI helps non-technical small-business owners using AI coding agents deploy apps while Verulla handles hosting and day-to-day operations.
|
|
21
|
+
|
|
22
|
+
[Verulla](https://verulla.com)
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
uvx --no-cache --isolated --from 'verulla-cli==0.0.8' verulla --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The CLI provides commands for checking and deploying apps to Verulla, with manifest validation supplied by the exact `verulla-manifest==0.0.4` dependency. Verulla handles hosting and day-to-day operations after deployment.
|
|
31
|
+
|
|
32
|
+
See the [install guide](https://verulla.com/install) for setup and the supported workflow.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Verulla's CLI helps non-technical small-business owners using AI coding agents deploy apps while Verulla handles hosting and day-to-day operations.
|
|
2
|
+
|
|
3
|
+
[Verulla](https://verulla.com)
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
uvx --no-cache --isolated --from 'verulla-cli==0.0.8' verulla --help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The CLI provides commands for checking and deploying apps to Verulla, with manifest validation supplied by the exact `verulla-manifest==0.0.4` dependency. Verulla handles hosting and day-to-day operations after deployment.
|
|
12
|
+
|
|
13
|
+
See the [install guide](https://verulla.com/install) for setup and the supported workflow.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "verulla-cli"
|
|
3
|
+
version = "0.0.8"
|
|
4
|
+
requires-python = ">=3.12"
|
|
5
|
+
description = "Verulla's CLI helps non-technical small-business owners using AI coding agents deploy apps while Verulla handles hosting and day-to-day operations."
|
|
6
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
7
|
+
keywords = ["deployment", "AI coding agents", "small business"]
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 3 - Alpha",
|
|
10
|
+
"Environment :: Console",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"verulla-manifest==0.0.4",
|
|
17
|
+
"typer>=0.12",
|
|
18
|
+
"httpx>=0.27",
|
|
19
|
+
"docker>=7",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://verulla.com"
|
|
24
|
+
Documentation = "https://verulla.com/install"
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
verulla = "verulla_cli.main:app"
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["hatchling"]
|
|
31
|
+
build-backend = "hatchling.build"
|
|
32
|
+
|
|
33
|
+
[tool.deptry]
|
|
34
|
+
known_first_party = ["verulla_cli"]
|
|
35
|
+
extend_exclude = ["tests"]
|
|
@@ -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
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
+
import httpx
|
|
4
5
|
|
|
5
6
|
from typer.testing import CliRunner
|
|
6
7
|
|
|
7
8
|
from verulla_cli.auth import DeviceLoginError
|
|
9
|
+
from verulla_cli.apps_client import AppsError, _request
|
|
8
10
|
from verulla_cli.main import _secret_scope, app
|
|
9
11
|
|
|
10
12
|
runner = CliRunner()
|
|
@@ -14,7 +16,7 @@ def test_cli_reports_installed_version() -> None:
|
|
|
14
16
|
result = runner.invoke(app, ["--version"])
|
|
15
17
|
|
|
16
18
|
assert result.exit_code == 0
|
|
17
|
-
assert result.output.strip() == "verulla 0.0.
|
|
19
|
+
assert result.output.strip() == "verulla 0.0.8"
|
|
18
20
|
|
|
19
21
|
|
|
20
22
|
def test_auth_and_customer_commands_are_registered() -> None:
|
|
@@ -22,12 +24,103 @@ def test_auth_and_customer_commands_are_registered() -> None:
|
|
|
22
24
|
assert result.exit_code == 0
|
|
23
25
|
assert "auth" in result.output and "customers" in result.output
|
|
24
26
|
assert "signup" in result.output
|
|
27
|
+
assert "trial" in result.output
|
|
28
|
+
assert "sketch" not in result.output
|
|
29
|
+
assert "live" not in result.output.lower()
|
|
25
30
|
for command in ("wallet", "spend", "usage", "pricing", "topup"):
|
|
26
31
|
assert command in result.output
|
|
32
|
+
for command in ("mandate", "pay"):
|
|
33
|
+
assert command in result.output
|
|
34
|
+
for command in ("status",):
|
|
35
|
+
assert command in runner.invoke(app, ["mandate", "--help"]).output
|
|
36
|
+
for command in ("quote", "status", "execute"):
|
|
37
|
+
assert command in runner.invoke(app, ["pay", "--help"]).output
|
|
27
38
|
for command in ("show", "set"):
|
|
28
39
|
assert command in runner.invoke(app, ["auth", "--help"]).output
|
|
29
40
|
for command in ("list", "lock", "unlock", "delete", "export", "invite"):
|
|
30
41
|
assert command in runner.invoke(app, ["customers", "--help"]).output
|
|
42
|
+
domains_help = runner.invoke(app, ["domains", "--help"])
|
|
43
|
+
assert domains_help.exit_code == 0
|
|
44
|
+
for command in ("add", "status", "verify"):
|
|
45
|
+
assert command in domains_help.output
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_pay_execute_requires_explicit_matching_price_confirmation(tmp_path, monkeypatch):
|
|
49
|
+
quote = {
|
|
50
|
+
"quote_id": "quote-123",
|
|
51
|
+
"price_confirmation": {"quote_hash": "hash", "gross_cents": 500, "currency": "USD",
|
|
52
|
+
"purchase_type": "wallet_topup", "target_id": "wallet-id",
|
|
53
|
+
"wallet_credit_cents": 500, "wallet_debit_cents": 0, "tax_cents": 0},
|
|
54
|
+
}
|
|
55
|
+
confirmation_file = tmp_path / "quote.json"
|
|
56
|
+
confirmation_file.write_text(json.dumps(quote))
|
|
57
|
+
calls = []
|
|
58
|
+
monkeypatch.setattr("verulla_cli.main._agent_token", lambda: "agent-token")
|
|
59
|
+
monkeypatch.setattr("verulla_cli.main.execute_agent_payment", lambda *args: calls.append(args) or {"status": "succeeded"})
|
|
60
|
+
|
|
61
|
+
mismatch = runner.invoke(app, ["pay", "execute", "quote-123", "--price-confirmation", str(confirmation_file),
|
|
62
|
+
"--confirm-price-cents", "500", "--currency", "CAD",
|
|
63
|
+
"--idempotency-key", "stable-key"])
|
|
64
|
+
assert mismatch.exit_code == 2
|
|
65
|
+
assert calls == []
|
|
66
|
+
result = runner.invoke(app, ["pay", "execute", "quote-123", "--price-confirmation", str(confirmation_file),
|
|
67
|
+
"--confirm-price-cents", "500", "--currency", "USD",
|
|
68
|
+
"--idempotency-key", "stable-key"])
|
|
69
|
+
assert result.exit_code == 0, result.output
|
|
70
|
+
assert calls[0][3]["gross_cents"] == 500
|
|
71
|
+
assert calls[0][4] == "stable-key"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_cli_payment_error_copy_preserves_cancelled_owner_code():
|
|
75
|
+
client = httpx.Client(transport=httpx.MockTransport(lambda _: httpx.Response(
|
|
76
|
+
403, json={"detail": {"code": "owner_account_cancelled"}},
|
|
77
|
+
)))
|
|
78
|
+
try:
|
|
79
|
+
_request("https://api.example", "token", "GET",
|
|
80
|
+
"/v1/agent-payment-mandates/current", client)
|
|
81
|
+
except AppsError as exc:
|
|
82
|
+
assert "owner cancelled payments" in str(exc)
|
|
83
|
+
assert "owner_account_cancelled" in str(exc)
|
|
84
|
+
else:
|
|
85
|
+
raise AssertionError("cancelled owner must stop agent payment access")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_trial_status_and_legacy_sketch_alias_share_the_lifecycle_receipt(monkeypatch) -> None:
|
|
89
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "token")
|
|
90
|
+
monkeypatch.setattr("verulla_cli.main.get_sketch_status", lambda *args: {
|
|
91
|
+
"app": "demo", "status": "deployed", "url": "https://demo.verulla.app",
|
|
92
|
+
})
|
|
93
|
+
trial = runner.invoke(app, ["trial", "status", "demo"])
|
|
94
|
+
legacy = runner.invoke(app, ["sketch", "status", "demo"])
|
|
95
|
+
assert trial.exit_code == 0, trial.output
|
|
96
|
+
assert legacy.exit_code == 0, legacy.output
|
|
97
|
+
assert "app: demo" in trial.output
|
|
98
|
+
assert "app: demo" in legacy.output
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_domains_add_prints_both_customer_dns_records(monkeypatch) -> None:
|
|
102
|
+
monkeypatch.setattr("verulla_cli.main._agent_token", lambda: "agent-token")
|
|
103
|
+
monkeypatch.setattr("verulla_cli.main.api_add_domain", lambda *args: {
|
|
104
|
+
"id": "domain-id", "status": "pending_dns",
|
|
105
|
+
"dns_instructions": [
|
|
106
|
+
{"type": "CNAME", "name": "shop.example.com", "target": "domains.verulla.app",
|
|
107
|
+
"purpose": "Routes this hostname to Verulla."},
|
|
108
|
+
{"type": "CNAME", "name": "_acme-challenge.shop.example.com",
|
|
109
|
+
"target": "deadbeef.acme.verulla.app",
|
|
110
|
+
"purpose": "Delegates certificate validation; leave this record in place."},
|
|
111
|
+
{"type": "ALIAS/ANAME", "name": "example.com", "target": "domains.verulla.app",
|
|
112
|
+
"purpose": "At a zone apex, use provider flattening."},
|
|
113
|
+
{"type": "CNAME", "name": "_acme-challenge.example.com",
|
|
114
|
+
"target": "deadbeef.acme.verulla.app",
|
|
115
|
+
"purpose": "Delegates certificate validation; leave this record in place."},
|
|
116
|
+
],
|
|
117
|
+
})
|
|
118
|
+
result = runner.invoke(app, ["domains", "add", "demo", "shop.example.com"])
|
|
119
|
+
assert result.exit_code == 0, result.output
|
|
120
|
+
assert "Add a CNAME record named shop.example.com pointing to domains.verulla.app." in result.output
|
|
121
|
+
assert "Add a CNAME record named _acme-challenge.shop.example.com pointing to deadbeef.acme.verulla.app." in result.output
|
|
122
|
+
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
|
|
123
|
+
assert "Add a CNAME record named _acme-challenge.example.com pointing to deadbeef.acme.verulla.app." in result.output
|
|
31
124
|
|
|
32
125
|
|
|
33
126
|
def test_signup_stores_key_privately_and_redacts_output(tmp_path, monkeypatch) -> None:
|
|
@@ -181,7 +274,7 @@ def test_help_lists_all_commands() -> None:
|
|
|
181
274
|
result = runner.invoke(app, ["--help"])
|
|
182
275
|
assert result.exit_code == 0
|
|
183
276
|
assert "https://api.verulla.app" in result.output
|
|
184
|
-
for name in ("login", "dev", "deploy", "secrets", "logs", "apps", "status", "delete", "rollback", "
|
|
277
|
+
for name in ("login", "dev", "deploy", "secrets", "logs", "apps", "status", "delete", "rollback", "pro"):
|
|
185
278
|
assert name in result.output
|
|
186
279
|
|
|
187
280
|
|
|
@@ -407,7 +500,7 @@ def test_deploy_wait_success_prints_sketch_handoff(tmp_path, monkeypatch) -> Non
|
|
|
407
500
|
assert "2026-11-06T12:00:00Z" in result.output
|
|
408
501
|
assert "72 hours" in result.output
|
|
409
502
|
assert "custom domain" in result.output.lower()
|
|
410
|
-
assert "verulla
|
|
503
|
+
assert "verulla trial status demo-app" in result.output
|
|
411
504
|
assert "owner claim status: pending" in result.output.lower()
|
|
412
505
|
|
|
413
506
|
|
|
@@ -641,6 +734,63 @@ def test_live_confirmation_decline_does_not_activate(monkeypatch) -> None:
|
|
|
641
734
|
assert calls == []
|
|
642
735
|
|
|
643
736
|
|
|
737
|
+
def test_live_when_disabled_explains_data_retention_and_current_unavailability(monkeypatch) -> None:
|
|
738
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
739
|
+
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"live_activation_available": False})
|
|
740
|
+
|
|
741
|
+
result = runner.invoke(app, ["live", "demo", "--api-url", "https://api.test"])
|
|
742
|
+
|
|
743
|
+
assert result.exit_code == 1
|
|
744
|
+
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
|
|
745
|
+
assert "contact" not in result.output.lower()
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
def test_live_help_explains_free_trial_to_paid_live() -> None:
|
|
749
|
+
result = runner.invoke(app, ["live", "--help"])
|
|
750
|
+
|
|
751
|
+
assert result.exit_code == 0
|
|
752
|
+
assert "free 72-hour trial" in result.output
|
|
753
|
+
assert "paid Pro" in result.output
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
def test_pro_is_documented_command_and_live_remains_compatible_alias() -> None:
|
|
757
|
+
help_result = runner.invoke(app, ["--help"])
|
|
758
|
+
assert "pro" in help_result.output
|
|
759
|
+
assert "live" not in help_result.output
|
|
760
|
+
pro_help = runner.invoke(app, ["pro", "--help"])
|
|
761
|
+
live_help = runner.invoke(app, ["live", "--help"])
|
|
762
|
+
assert pro_help.exit_code == 0
|
|
763
|
+
assert live_help.exit_code == 0
|
|
764
|
+
assert "Pro" in pro_help.output
|
|
765
|
+
assert "Pro" in live_help.output
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
def test_live_when_already_live_does_not_claim_upgrades_are_opening_soon(monkeypatch) -> None:
|
|
769
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
770
|
+
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"live_activation_available": False, "tier_id": "live"})
|
|
771
|
+
|
|
772
|
+
result = runner.invoke(app, ["live", "demo", "--api-url", "https://api.test"])
|
|
773
|
+
|
|
774
|
+
assert result.exit_code == 0
|
|
775
|
+
assert "already on Pro" in result.output
|
|
776
|
+
assert "opening soon" not in result.output
|
|
777
|
+
assert "14 days" not in result.output
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
def test_status_prints_machine_readable_next_step(monkeypatch) -> None:
|
|
781
|
+
step = {
|
|
782
|
+
"action": "upgrade_to_live", "command": "verulla live <app>",
|
|
783
|
+
"docs_url": "https://verulla.com/docs/agent-guide.md#keep-your-app-online", "available": False,
|
|
784
|
+
}
|
|
785
|
+
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
786
|
+
monkeypatch.setattr("verulla_cli.main.get_app", lambda *args: {"app": "demo", "status": "suspended", "next_step": step})
|
|
787
|
+
|
|
788
|
+
result = runner.invoke(app, ["status", "demo", "--api-url", "https://api.test"])
|
|
789
|
+
|
|
790
|
+
assert result.exit_code == 0, result.output
|
|
791
|
+
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
|
|
792
|
+
|
|
793
|
+
|
|
644
794
|
def test_live_uses_wallet_currency_for_price_and_headroom(monkeypatch) -> None:
|
|
645
795
|
monkeypatch.setattr("verulla_cli.main.get_token", lambda: "api-token")
|
|
646
796
|
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,10 @@ 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.",
|
|
43
|
+
"owner_account_cancelled": "The owner cancelled payments; the owner must reactivate this themselves.",
|
|
44
|
+
"live_reactivation_unsupported": "The owner must reactivate this themselves.",
|
|
42
45
|
}.get(code_text, detail.get("message") or str(detail))
|
|
43
46
|
detail = f"{message} (code: {code_text})" if code_text else message
|
|
44
47
|
else:
|
|
@@ -89,6 +92,25 @@ def create_signup(api_url: str, slug: str, display_name: str, owner_email: str,
|
|
|
89
92
|
http.close()
|
|
90
93
|
|
|
91
94
|
|
|
95
|
+
def get_mandate_status(api_url: str, token: str, client=None) -> dict:
|
|
96
|
+
return _request(api_url, token, "GET", "/v1/agent-payment-mandates/current", client)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def create_agent_payment_quote(api_url: str, token: str, quote: dict, client=None) -> dict:
|
|
100
|
+
return _request(api_url, token, "POST", "/v1/agent-payments/quotes", client, json_body=quote)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def get_agent_payment_status(api_url: str, token: str, attempt_id: str, client=None) -> dict:
|
|
104
|
+
return _request(api_url, token, "GET", f"/v1/agent-payments/attempts/{quote(attempt_id, safe='')}", client)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def execute_agent_payment(api_url: str, token: str, quote_id: str, price_confirmation: dict,
|
|
108
|
+
idempotency_key: str, client=None) -> dict:
|
|
109
|
+
return _request(api_url, token, "POST", "/v1/agent-payments/charges", client,
|
|
110
|
+
extra_headers={"Idempotency-Key": idempotency_key},
|
|
111
|
+
json_body={"quote_id": quote_id, "price_confirmation": price_confirmation})
|
|
112
|
+
|
|
113
|
+
|
|
92
114
|
def list_apps(api_url: str, token: str, client=None) -> list[dict]:
|
|
93
115
|
return _request(api_url, token, "GET", "/v1/apps", client)["apps"]
|
|
94
116
|
|
|
@@ -112,7 +134,7 @@ def get_sketch_events(api_url: str, token: str, name: str, *, cursor: str | None
|
|
|
112
134
|
try:
|
|
113
135
|
return validate_sketch_event_page(response)
|
|
114
136
|
except ValueError as exc:
|
|
115
|
-
raise AppsError(f"invalid
|
|
137
|
+
raise AppsError(f"invalid free-trial event response: {exc}") from exc
|
|
116
138
|
|
|
117
139
|
def get_sketch_status(api_url: str, token: str, name: str, client=None) -> dict:
|
|
118
140
|
from urllib.parse import quote
|
|
@@ -221,3 +243,16 @@ def rollback_app(api_url: str, token: str, name: str, client=None) -> dict:
|
|
|
221
243
|
def export_customers(api_url: str, token: str, app: str, client=None) -> str:
|
|
222
244
|
from urllib.parse import quote
|
|
223
245
|
return _request(api_url, token, "GET", f"/v1/apps/{quote(app, safe='')}/customers/export", client, raw=True)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def add_domain(api_url: str, token: str, app: str, host: str, client=None) -> dict:
|
|
249
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains", client,
|
|
250
|
+
json_body={"host": host})
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
def list_domains(api_url: str, token: str, app: str, client=None) -> dict:
|
|
254
|
+
return _request(api_url, token, "GET", f"/v1/apps/{quote(app, safe='')}/domains", client)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def verify_domain(api_url: str, token: str, app: str, host: str, client=None) -> dict:
|
|
258
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}/verify", client)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
from verulla_cli.apps_client import AppsError, _request
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def list_domains(api_url: str, token: str, app: str) -> dict:
|
|
9
|
+
return _request(api_url, token, "GET", f"/v1/apps/{quote(app, safe='')}/domains")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def add_domain(api_url: str, token: str, app: str, host: str) -> dict:
|
|
13
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains", json_body={"host": host})
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def verify_domain(api_url: str, token: str, app: str, host: str) -> dict:
|
|
17
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}/verify")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def remove_domain(api_url: str, token: str, app: str, host: str) -> None:
|
|
21
|
+
_request(api_url, token, "DELETE", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def quote_domain_enable(api_url: str, token: str, app: str, host: str) -> dict:
|
|
25
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}/enable-quote")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def enable_domain(api_url: str, token: str, app: str, host: str, quote_id: str, idempotency_key: str) -> dict:
|
|
29
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}/enable", extra_headers={"Idempotency-Key": idempotency_key}, json_body={"quote_id": quote_id})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def disable_domain(api_url: str, token: str, app: str, host: str) -> dict:
|
|
33
|
+
return _request(api_url, token, "POST", f"/v1/apps/{quote(app, safe='')}/domains/{quote(host, safe='')}/disable")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def domain_error_message(exc: AppsError) -> str:
|
|
37
|
+
message = str(exc)
|
|
38
|
+
if "custom_domains_disabled" in message:
|
|
39
|
+
return "Custom domains are not yet available."
|
|
40
|
+
return message
|
|
@@ -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,
|
|
@@ -37,6 +40,10 @@ from verulla_cli.apps_client import (
|
|
|
37
40
|
get_term_usage,
|
|
38
41
|
get_wallet_summary,
|
|
39
42
|
create_topup,
|
|
43
|
+
get_mandate_status,
|
|
44
|
+
create_agent_payment_quote,
|
|
45
|
+
get_agent_payment_status,
|
|
46
|
+
execute_agent_payment,
|
|
40
47
|
get_auth_policy,
|
|
41
48
|
invite_customer as api_invite_customer,
|
|
42
49
|
issue_owner_claim,
|
|
@@ -72,10 +79,15 @@ def _main(
|
|
|
72
79
|
raise typer.Exit()
|
|
73
80
|
|
|
74
81
|
|
|
75
|
-
sketch_app = typer.Typer(name="sketch", help="Inspect
|
|
76
|
-
|
|
82
|
+
sketch_app = typer.Typer(name="sketch", help="Inspect free-trial lifecycle status.", no_args_is_help=True)
|
|
83
|
+
trial_app = typer.Typer(name="trial", help="Inspect free-trial lifecycle status.", no_args_is_help=True)
|
|
84
|
+
app.add_typer(trial_app, name="trial")
|
|
85
|
+
# Keep the pre-rename command group working for existing scripts.
|
|
86
|
+
app.add_typer(sketch_app, name="sketch", hidden=True)
|
|
77
87
|
owner_app = typer.Typer(name="owner", help="Manage the verified owner hand-off.", no_args_is_help=True)
|
|
78
88
|
app.add_typer(owner_app, name="owner")
|
|
89
|
+
domains_app = typer.Typer(name="domains", help="Manage custom domains and DNS records.", no_args_is_help=True)
|
|
90
|
+
app.add_typer(domains_app, name="domains")
|
|
79
91
|
|
|
80
92
|
_SKETCH_RECEIPT_FIELDS = {
|
|
81
93
|
"app", "tier", "slug", "status", "lifecycle_state", "trial_started_at",
|
|
@@ -272,7 +284,7 @@ def dev(
|
|
|
272
284
|
if output.strip():
|
|
273
285
|
typer.echo(output.rstrip())
|
|
274
286
|
if not check:
|
|
275
|
-
typer.echo("Interactive local preview requires Docker; use verulla deploy to a
|
|
287
|
+
typer.echo("Interactive local preview requires Docker; use verulla deploy to a free-trial app for the remote runtime.")
|
|
276
288
|
return
|
|
277
289
|
return
|
|
278
290
|
runner = docker_runner
|
|
@@ -449,16 +461,16 @@ def deploy(
|
|
|
449
461
|
try:
|
|
450
462
|
receipt = _safe_sketch_receipt(get_sketch_status(api_url.rstrip("/"), token, deployment["app"]))
|
|
451
463
|
except AppsError as exc:
|
|
452
|
-
typer.echo(f"Deployment succeeded, but the
|
|
464
|
+
typer.echo(f"Deployment succeeded, but the free-trial receipt could not be loaded: {exc}", err=True)
|
|
453
465
|
raise typer.Exit(code=1) from exc
|
|
454
|
-
typer.echo("
|
|
466
|
+
typer.echo("Free-trial hand-off")
|
|
455
467
|
typer.echo(f"Public URL: {receipt.get('url') or deployment.get('url') or '(not provided)'}")
|
|
456
468
|
typer.echo(f"Expires at: {receipt.get('expires_at') or '(expiry not provided by API)'}")
|
|
457
469
|
typer.echo(f"Owner claim status: {receipt.get('claim_status') or '(not provided)'}")
|
|
458
470
|
typer.echo("Trial: free for 72 hours from first successful deployment; no custom domain.")
|
|
459
471
|
if receipt.get("limits_url"):
|
|
460
472
|
typer.echo(f"Limits: {receipt['limits_url']}")
|
|
461
|
-
typer.echo(f"Next: share the public URL with the verified owner, then run `verulla
|
|
473
|
+
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
474
|
|
|
463
475
|
|
|
464
476
|
secrets_app = typer.Typer(help="Manage per-tenant secrets and environment variables.")
|
|
@@ -625,6 +637,8 @@ def apps(
|
|
|
625
637
|
f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
|
|
626
638
|
f"{row.get('url') or '-'}"
|
|
627
639
|
)
|
|
640
|
+
if row.get("next_step") is not None:
|
|
641
|
+
typer.echo(f" next_step: {json.dumps(row['next_step'], separators=(',', ':'))}")
|
|
628
642
|
if row.get("runtime_health_reason"):
|
|
629
643
|
typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
|
|
630
644
|
|
|
@@ -643,11 +657,11 @@ def wallet(
|
|
|
643
657
|
|
|
644
658
|
@app.command()
|
|
645
659
|
def usage(
|
|
646
|
-
app_name: str | None = typer.Argument(None, help="Optional
|
|
660
|
+
app_name: str | None = typer.Argument(None, help="Optional Pro app name; omit to show all Pro apps."),
|
|
647
661
|
month: str | None = typer.Option(None, "--month", help="Calendar usage month in YYYY-MM format (legacy view)."),
|
|
648
662
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True, help="Verulla control plane base URL."),
|
|
649
663
|
) -> None:
|
|
650
|
-
"""Show
|
|
664
|
+
"""Show Pro term allowances, usage, projected costs and spending headroom."""
|
|
651
665
|
try:
|
|
652
666
|
if month is not None:
|
|
653
667
|
result = get_usage_summary(api_url.rstrip("/"), get_token(), month=month)
|
|
@@ -701,13 +715,88 @@ def topup(
|
|
|
701
715
|
typer.echo(json.dumps(result, indent=2))
|
|
702
716
|
|
|
703
717
|
|
|
718
|
+
mandate_app = typer.Typer(help="Inspect the agent payment mandate.", no_args_is_help=True)
|
|
719
|
+
pay_app = typer.Typer(help="Request and execute explicitly confirmed agent-payment quotes.", no_args_is_help=True)
|
|
720
|
+
app.add_typer(mandate_app, name="mandate")
|
|
721
|
+
app.add_typer(pay_app, name="pay")
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
@mandate_app.command("status")
|
|
725
|
+
def mandate_status(api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL")) -> None:
|
|
726
|
+
result = _auth_api_call(get_mandate_status, api_url.rstrip("/"), _agent_token())
|
|
727
|
+
typer.echo(json.dumps(result, indent=2))
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
@pay_app.command("quote")
|
|
731
|
+
def pay_quote(purchase_type: str = typer.Option("wallet_topup", "--purchase-type"),
|
|
732
|
+
requested_topup_cents: int | None = typer.Option(None, "--amount-cents", min=1),
|
|
733
|
+
currency: str | None = typer.Option(None, "--currency"),
|
|
734
|
+
target_id: str | None = typer.Option(None, "--target-id"),
|
|
735
|
+
product_quote_id: str | None = typer.Option(None, "--product-quote-id"),
|
|
736
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL")) -> None:
|
|
737
|
+
if purchase_type not in {"wallet_topup", "live_activation", "renewal", "domain_addon"}:
|
|
738
|
+
typer.echo("Unsupported purchase type.", err=True)
|
|
739
|
+
raise typer.Exit(code=2)
|
|
740
|
+
if currency is not None and currency not in {"USD", "CAD"}:
|
|
741
|
+
typer.echo("Currency must be USD or CAD.", err=True)
|
|
742
|
+
raise typer.Exit(code=2)
|
|
743
|
+
quote: dict[str, str | int] = {"purchase_type": purchase_type}
|
|
744
|
+
if requested_topup_cents is not None:
|
|
745
|
+
quote["requested_topup_cents"] = requested_topup_cents
|
|
746
|
+
if currency is not None:
|
|
747
|
+
quote["currency"] = currency
|
|
748
|
+
if target_id is not None:
|
|
749
|
+
quote["target_id"] = target_id
|
|
750
|
+
if product_quote_id is not None:
|
|
751
|
+
quote["product_quote_id"] = product_quote_id
|
|
752
|
+
result = _auth_api_call(create_agent_payment_quote, api_url.rstrip("/"), _agent_token(), quote)
|
|
753
|
+
typer.echo(json.dumps(result, indent=2))
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
@pay_app.command("status")
|
|
757
|
+
def pay_status(attempt_id: str = typer.Argument(...),
|
|
758
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL")) -> None:
|
|
759
|
+
result = _auth_api_call(get_agent_payment_status, api_url.rstrip("/"), _agent_token(), attempt_id)
|
|
760
|
+
typer.echo(json.dumps(result, indent=2))
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
@pay_app.command("execute")
|
|
764
|
+
def pay_execute(quote_id: str = typer.Argument(...),
|
|
765
|
+
price_confirmation_file: Path = typer.Option(..., "--price-confirmation", exists=True, readable=True),
|
|
766
|
+
confirm_price_cents: int = typer.Option(..., "--confirm-price-cents", min=1),
|
|
767
|
+
currency: str = typer.Option(..., "--currency"),
|
|
768
|
+
idempotency_key: str = typer.Option(..., "--idempotency-key"),
|
|
769
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL")) -> None:
|
|
770
|
+
try:
|
|
771
|
+
confirmation = json.loads(price_confirmation_file.read_text(encoding="utf-8"))
|
|
772
|
+
if (isinstance(confirmation, dict) and confirmation.get("quote_id") is not None
|
|
773
|
+
and confirmation["quote_id"] != quote_id):
|
|
774
|
+
typer.echo("QUOTE_ID does not match the saved quote response.", err=True)
|
|
775
|
+
raise typer.Exit(code=2)
|
|
776
|
+
if isinstance(confirmation, dict) and isinstance(confirmation.get("price_confirmation"), dict):
|
|
777
|
+
confirmation = confirmation["price_confirmation"]
|
|
778
|
+
except (OSError, ValueError) as exc:
|
|
779
|
+
typer.echo("Price confirmation must be a JSON object from the exact quote response.", err=True)
|
|
780
|
+
raise typer.Exit(code=2) from exc
|
|
781
|
+
if not 1 <= len(idempotency_key) <= 128:
|
|
782
|
+
typer.echo("--idempotency-key must contain 1 to 128 characters.", err=True)
|
|
783
|
+
raise typer.Exit(code=2)
|
|
784
|
+
if (not isinstance(confirmation, dict) or confirmation.get("gross_cents") != confirm_price_cents
|
|
785
|
+
or confirmation.get("currency") != currency or currency not in {"USD", "CAD"}):
|
|
786
|
+
typer.echo("Price confirmation differs from --confirm-price-cents or --currency.", err=True)
|
|
787
|
+
raise typer.Exit(code=2)
|
|
788
|
+
result = _auth_api_call(execute_agent_payment, api_url.rstrip("/"), _agent_token(), quote_id,
|
|
789
|
+
confirmation, idempotency_key)
|
|
790
|
+
typer.echo(json.dumps(result, indent=2))
|
|
791
|
+
|
|
792
|
+
|
|
704
793
|
@app.command()
|
|
705
|
-
def
|
|
706
|
-
app_name: str = typer.Argument(..., metavar="APP", help="App to
|
|
794
|
+
def pro(
|
|
795
|
+
app_name: str = typer.Argument(..., metavar="APP", help="App to move from its free trial to paid Pro."),
|
|
707
796
|
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation."),
|
|
708
797
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True, help="Verulla control plane base URL."),
|
|
709
798
|
) -> None:
|
|
710
|
-
"""
|
|
799
|
+
"""Move an app from its free 72-hour trial to paid Pro at the published price."""
|
|
711
800
|
try:
|
|
712
801
|
token = get_token()
|
|
713
802
|
except DeviceLoginError:
|
|
@@ -715,14 +804,20 @@ def live(
|
|
|
715
804
|
raise typer.Exit(code=1)
|
|
716
805
|
try:
|
|
717
806
|
app_status = get_app(api_url.rstrip("/"), token, app_name)
|
|
807
|
+
if app_status.get("tier_id", app_status.get("tier")) == "live":
|
|
808
|
+
typer.echo("This app is already on Pro.")
|
|
809
|
+
raise typer.Exit(code=0)
|
|
718
810
|
if app_status.get("live_activation_available") is not True:
|
|
719
|
-
typer.echo(
|
|
811
|
+
typer.echo(
|
|
812
|
+
"Pro upgrades are not available right now. Your app's data is kept for 14 days after the free trial ends.",
|
|
813
|
+
err=True,
|
|
814
|
+
)
|
|
720
815
|
raise typer.Exit(code=1)
|
|
721
816
|
spend = get_spend_summary(api_url.rstrip("/"), token)
|
|
722
817
|
currency = spend.get("currency", "USD")
|
|
723
818
|
contract = get_pricing(api_url.rstrip("/"), token)
|
|
724
819
|
except AppsError as exc:
|
|
725
|
-
typer.echo(f"Error checking
|
|
820
|
+
typer.echo(f"Error checking Pro availability or spending-limit headroom: {exc}", err=True)
|
|
726
821
|
raise typer.Exit(code=1) from exc
|
|
727
822
|
live_tier = next((tier for tier in contract.get("tiers", []) if tier.get("id") == "live"), {})
|
|
728
823
|
prices = live_tier.get("prices_cents", {})
|
|
@@ -730,7 +825,7 @@ def live(
|
|
|
730
825
|
if price_cents is None:
|
|
731
826
|
price_cents = live_tier.get("price_usd_cents") if currency == "USD" else live_tier.get("price_cad_cents")
|
|
732
827
|
if currency not in {"USD", "CAD"} or not isinstance(price_cents, int):
|
|
733
|
-
typer.echo(f"Unsupported wallet currency {currency!r} for
|
|
828
|
+
typer.echo(f"Unsupported wallet currency {currency!r} for Pro pricing.", err=True)
|
|
734
829
|
raise typer.Exit(code=1)
|
|
735
830
|
symbol = "C$" if currency == "CAD" else "US$"
|
|
736
831
|
price_text = f"{symbol}{price_cents // 100:,}.{price_cents % 100:02d}"
|
|
@@ -739,16 +834,20 @@ def live(
|
|
|
739
834
|
headroom = f"{symbol}{remaining // 100:,}.{remaining % 100:02d}"
|
|
740
835
|
else:
|
|
741
836
|
headroom = "no spending limit set"
|
|
742
|
-
typer.echo(f"
|
|
837
|
+
typer.echo(f"Pro costs {price_text} per 30 days ({currency}).")
|
|
743
838
|
typer.echo(f"Spending-limit headroom: {headroom}.")
|
|
744
839
|
if not yes:
|
|
745
|
-
typer.confirm(f"
|
|
840
|
+
typer.confirm(f"Move {app_name!r} to Pro for {price_text} per 30 days?", abort=True)
|
|
746
841
|
try:
|
|
747
842
|
result = activate_app(api_url.rstrip("/"), token, app_name, str(uuid.uuid4()))
|
|
748
843
|
except AppsError as exc:
|
|
749
844
|
typer.echo(f"Error: {exc}", err=True)
|
|
750
845
|
raise typer.Exit(code=1) from exc
|
|
751
|
-
typer.echo(f"{app_name} is
|
|
846
|
+
typer.echo(f"{app_name} is Pro through {result.get('paid_through')} (price {result.get('pricing_version')}).")
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
# Deprecated command name retained for existing scripts and agents.
|
|
850
|
+
app.command("live", hidden=True)(pro)
|
|
752
851
|
|
|
753
852
|
|
|
754
853
|
@app.command()
|
|
@@ -770,13 +869,16 @@ def status(
|
|
|
770
869
|
f"{row['app']} {row['status']} runtime={row.get('runtime_health', 'starting')} "
|
|
771
870
|
f"{row.get('url') or '-'}"
|
|
772
871
|
)
|
|
872
|
+
if row.get("next_step") is not None:
|
|
873
|
+
typer.echo(f" next_step: {json.dumps(row['next_step'], separators=(',', ':'))}")
|
|
773
874
|
if row.get("runtime_health_reason"):
|
|
774
875
|
typer.echo(f" runtime_health_reason: {row['runtime_health_reason']}")
|
|
775
876
|
else:
|
|
776
877
|
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"):
|
|
878
|
+
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
879
|
if key in row:
|
|
779
|
-
|
|
880
|
+
value = json.dumps(row[key], separators=(',', ':')) if key == "next_step" else row[key]
|
|
881
|
+
typer.echo(f"{key}: {value}")
|
|
780
882
|
except AppsError as exc:
|
|
781
883
|
typer.echo(f"Error: {exc}", err=True)
|
|
782
884
|
raise typer.Exit(code=1) from exc
|
|
@@ -790,7 +892,7 @@ def sketch_events(
|
|
|
790
892
|
json_output: bool = typer.Option(False, "--json", help="Print the shared API event envelope as JSON."),
|
|
791
893
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
792
894
|
) -> None:
|
|
793
|
-
"""Poll durable
|
|
895
|
+
"""Poll durable free-trial countdown events after the supplied cursor."""
|
|
794
896
|
result = _auth_api_call(
|
|
795
897
|
get_sketch_events, api_url.rstrip("/"), _agent_token(), app_name,
|
|
796
898
|
cursor=cursor, limit=limit,
|
|
@@ -809,7 +911,7 @@ def sketch_status(
|
|
|
809
911
|
json_output: bool = typer.Option(False, "--json", help="Print the receipt as JSON."),
|
|
810
912
|
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True, help="Verulla control plane base URL."),
|
|
811
913
|
) -> None:
|
|
812
|
-
"""Show the shared
|
|
914
|
+
"""Show the shared free-trial lifecycle receipt for APP."""
|
|
813
915
|
try:
|
|
814
916
|
token = get_token()
|
|
815
917
|
except DeviceLoginError:
|
|
@@ -828,6 +930,10 @@ def sketch_status(
|
|
|
828
930
|
typer.echo(f"{key}: {receipt[key]}")
|
|
829
931
|
|
|
830
932
|
|
|
933
|
+
trial_app.command("events")(sketch_events)
|
|
934
|
+
trial_app.command("status")(sketch_status)
|
|
935
|
+
|
|
936
|
+
|
|
831
937
|
@owner_app.command("claim")
|
|
832
938
|
def owner_claim(
|
|
833
939
|
app_name: str = typer.Argument(..., metavar="APP"),
|
|
@@ -1065,10 +1171,69 @@ def _auth_api_call(fn, *args, **kwargs):
|
|
|
1065
1171
|
try:
|
|
1066
1172
|
return fn(*args, **kwargs)
|
|
1067
1173
|
except AppsError as exc:
|
|
1068
|
-
typer.echo(f"Error: {exc}", err=True)
|
|
1174
|
+
typer.echo(f"Error: {domain_error_message(exc)}", err=True)
|
|
1069
1175
|
raise typer.Exit(code=1) from exc
|
|
1070
1176
|
|
|
1071
1177
|
|
|
1178
|
+
def _print_dns_instructions(records: list[dict]) -> None:
|
|
1179
|
+
for record in records:
|
|
1180
|
+
destination = record.get("target", record.get("value", ""))
|
|
1181
|
+
if record["type"] == "ALIAS/ANAME":
|
|
1182
|
+
typer.echo(
|
|
1183
|
+
f"At the zone apex, add a provider-flattened ALIAS/ANAME (or CNAME-flattening) "
|
|
1184
|
+
f"record named {record['name']} pointing to {destination}."
|
|
1185
|
+
)
|
|
1186
|
+
else:
|
|
1187
|
+
typer.echo(f"Add a {record['type']} record named {record['name']} pointing to {destination}.")
|
|
1188
|
+
typer.echo(f" {record.get('purpose', '')}")
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
from verulla_cli.domains_client import (
|
|
1192
|
+
domain_error_message,
|
|
1193
|
+
quote_domain_enable,
|
|
1194
|
+
enable_domain as api_enable_domain,
|
|
1195
|
+
disable_domain as api_disable_domain,
|
|
1196
|
+
remove_domain as api_remove_domain,
|
|
1197
|
+
)
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
@domains_app.command("add")
|
|
1201
|
+
def domains_add(
|
|
1202
|
+
app_name: str = typer.Argument(..., metavar="APP"),
|
|
1203
|
+
host: str = typer.Argument(..., metavar="HOST"),
|
|
1204
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
1205
|
+
) -> None:
|
|
1206
|
+
"""Claim a custom hostname and print its required DNS records."""
|
|
1207
|
+
result = _auth_api_call(api_add_domain, api_url.rstrip("/"), _agent_token(), app_name, host)
|
|
1208
|
+
_print_dns_instructions(result.get("dns_instructions", []))
|
|
1209
|
+
typer.echo(json.dumps({key: value for key, value in result.items() if key != "dns_instructions"}, indent=2))
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
@domains_app.command("status")
|
|
1213
|
+
def domains_status(
|
|
1214
|
+
app_name: str = typer.Argument(..., metavar="APP"),
|
|
1215
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
1216
|
+
) -> None:
|
|
1217
|
+
"""List custom domains and restate their persistent DNS records."""
|
|
1218
|
+
result = _auth_api_call(api_list_domains, api_url.rstrip("/"), _agent_token(), app_name)
|
|
1219
|
+
for domain in result.get("domains", []):
|
|
1220
|
+
typer.echo(f"{domain['host']}: {domain['status']}")
|
|
1221
|
+
_print_dns_instructions(domain.get("dns_records", []))
|
|
1222
|
+
typer.echo(json.dumps(result, indent=2))
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
@domains_app.command("verify")
|
|
1226
|
+
def domains_verify(
|
|
1227
|
+
app_name: str = typer.Argument(..., metavar="APP"),
|
|
1228
|
+
host: str = typer.Argument(..., metavar="HOST"),
|
|
1229
|
+
api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True),
|
|
1230
|
+
) -> None:
|
|
1231
|
+
"""Request DNS verification and print any rotated DNS instructions."""
|
|
1232
|
+
result = _auth_api_call(api_verify_domain, api_url.rstrip("/"), _agent_token(), app_name, host)
|
|
1233
|
+
_print_dns_instructions(result.get("dns_instructions", []))
|
|
1234
|
+
typer.echo(json.dumps({key: value for key, value in result.items() if key != "dns_instructions"}, indent=2))
|
|
1235
|
+
|
|
1236
|
+
|
|
1072
1237
|
@auth_app.command("show")
|
|
1073
1238
|
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
1239
|
"""Show the app's AuthPolicy and version."""
|
|
@@ -1194,6 +1359,38 @@ def admin_whoami(
|
|
|
1194
1359
|
typer.echo(f"scopes: {', '.join(data.get('scopes') or []) or '(none)'}")
|
|
1195
1360
|
|
|
1196
1361
|
|
|
1362
|
+
@domains_app.command("enable")
|
|
1363
|
+
def domains_enable(app_name: str, host: str, api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True)) -> None:
|
|
1364
|
+
"""Enable a verified custom domain after explicit price confirmation."""
|
|
1365
|
+
base_url, token = api_url.rstrip("/"), _agent_token()
|
|
1366
|
+
quoted = _auth_api_call(quote_domain_enable, base_url, token, app_name, host)
|
|
1367
|
+
amount, currency, quote_id = quoted.get("amount_cents"), quoted.get("currency"), quoted.get("quote_id")
|
|
1368
|
+
if (not isinstance(amount, int) or isinstance(amount, bool) or amount < 0
|
|
1369
|
+
or currency not in {"USD", "CAD"} or not isinstance(quote_id, str) or not quote_id):
|
|
1370
|
+
typer.echo("Error: invalid custom-domain enable quote; no change was made.", err=True)
|
|
1371
|
+
raise typer.Exit(code=1)
|
|
1372
|
+
symbol = "US$" if currency == "USD" else "C$"
|
|
1373
|
+
price_text = f"{symbol}{amount // 100:,}.{amount % 100:02d}"
|
|
1374
|
+
typer.echo(f"Custom domains cost US$12.00 per 30-day term. Current quote: {price_text} ({currency}).")
|
|
1375
|
+
typer.confirm(f"Enable {host!r} for the quoted {price_text}?", abort=True)
|
|
1376
|
+
result = _auth_api_call(api_enable_domain, base_url, token, app_name, host, quote_id, str(uuid.uuid4()))
|
|
1377
|
+
typer.echo(json.dumps(result, indent=2))
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
@domains_app.command("disable")
|
|
1381
|
+
def domains_disable(app_name: str, host: str, api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True)) -> None:
|
|
1382
|
+
"""Disable a paid custom domain without removing its claim."""
|
|
1383
|
+
result = _auth_api_call(api_disable_domain, api_url.rstrip("/"), _agent_token(), app_name, host)
|
|
1384
|
+
typer.echo(json.dumps(result, indent=2))
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
@domains_app.command("remove")
|
|
1388
|
+
def domains_remove(app_name: str, host: str, api_url: str = typer.Option(DEFAULT_API_URL, "--api-url", envvar="VERULLA_API_URL", show_default=True)) -> None:
|
|
1389
|
+
"""Remove a pending or verified custom-domain claim."""
|
|
1390
|
+
_auth_api_call(api_remove_domain, api_url.rstrip("/"), _agent_token(), app_name, host)
|
|
1391
|
+
typer.echo("Custom domain removed.")
|
|
1392
|
+
|
|
1393
|
+
|
|
1197
1394
|
def main() -> None:
|
|
1198
1395
|
app()
|
|
1199
1396
|
|
verulla_cli-0.0.6/PKG-INFO
DELETED
verulla_cli-0.0.6/pyproject.toml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "verulla-cli"
|
|
3
|
-
version = "0.0.6"
|
|
4
|
-
requires-python = ">=3.12"
|
|
5
|
-
dependencies = [
|
|
6
|
-
"verulla-manifest==0.0.3",
|
|
7
|
-
"typer>=0.12",
|
|
8
|
-
"httpx>=0.27",
|
|
9
|
-
"docker>=7",
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
[project.scripts]
|
|
13
|
-
verulla = "verulla_cli.main:app"
|
|
14
|
-
|
|
15
|
-
[build-system]
|
|
16
|
-
requires = ["hatchling"]
|
|
17
|
-
build-backend = "hatchling.build"
|
|
18
|
-
|
|
19
|
-
[tool.deptry]
|
|
20
|
-
known_first_party = ["verulla_cli"]
|
|
21
|
-
extend_exclude = ["tests"]
|
|
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
|