ermes-cli 1.6.0__tar.gz → 1.6.1__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.
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/PKG-INFO +1 -1
- ermes_cli-1.6.1/ermes_cli/__init__.py +1 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/templates.py +1 -1
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/pyproject.toml +1 -1
- ermes_cli-1.6.1/scripts/gen_reference.py +90 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_templates.py +2 -0
- ermes_cli-1.6.1/tests/test_reference.py +42 -0
- ermes_cli-1.6.0/ermes_cli/__init__.py +0 -1
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/.gitignore +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/README.md +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/admin_api.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/auth0.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/client.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/__init__.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/auth_cmds.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/automation.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/body_stdin.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/campaigns.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/config_cmd.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/data_paths.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/export.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/ingest.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/journeys.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/keys.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/lists.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/metrics.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/projects.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/providers.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/skill.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/subscriptions.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/tags.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/users.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/commands/write_cmds.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/config.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/errors.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/export_utils.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/keyring_store.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/main.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/output.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/rules.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/skill/SKILL.md +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/update.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/ermes_cli/write_mode.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/scripts/install-cli.sh +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/__init__.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/conftest.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_admin_api.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_auth0.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_auth_cmds.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_automation.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_automation_create.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_client.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/__init__.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_campaigns.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_data_paths.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_export.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_ingest.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_journeys.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_keys.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_lists.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_metrics.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_projects.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_projects_list.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_providers.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_subscriptions.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_tags.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_commands/test_users.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_config.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_connection_errors.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_export_utils.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_keyring_store.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_output.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_projects_config.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_rules.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_skill_command.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_update.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_version.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_whoami.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_write_cmds.py +0 -0
- {ermes_cli-1.6.0 → ermes_cli-1.6.1}/tests/test_write_mode.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ermes-cli
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.1
|
|
4
4
|
Summary: CLI-first access to Ermes marketing automation with Auth0 multi-project auth.
|
|
5
5
|
Project-URL: Homepage, https://ermes.publinker.com
|
|
6
6
|
Project-URL: Repository, https://github.com/Martech-DM/ermes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.6.1"
|
|
@@ -141,7 +141,7 @@ def templates_proof(template_id: int = typer.Argument(...), to: str = typer.Opti
|
|
|
141
141
|
"""Send a test/proof of a template."""
|
|
142
142
|
client, st, _, _, render_message = _get_deps()
|
|
143
143
|
try:
|
|
144
|
-
client.post(f"/templates/{template_id}/proof", json={"to":
|
|
144
|
+
client.post(f"/templates/{template_id}/proof", json={"recipient": to, "variables": {}})
|
|
145
145
|
render_message(f"Proof sent to {to}.", use_json=st.use_json)
|
|
146
146
|
except ErmesAPIError as e:
|
|
147
147
|
typer.echo(str(e), err=True)
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ermes-cli"
|
|
7
7
|
# Keep in lockstep with ermes_cli/__init__.py::__version__ — tests/test_version.py fails if they drift.
|
|
8
|
-
version = "1.6.
|
|
8
|
+
version = "1.6.1"
|
|
9
9
|
description = "CLI-first access to Ermes marketing automation with Auth0 multi-project auth."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""Dump the CLI command tree for the Settings -> CLI -> Reference view.
|
|
2
|
+
|
|
3
|
+
uv run python scripts/gen_reference.py # rewrite commands.json
|
|
4
|
+
uv run python scripts/gen_reference.py --check # exit 1 on drift (CI)
|
|
5
|
+
|
|
6
|
+
`tests/test_reference.py` runs the --check, so a new command or option fails
|
|
7
|
+
the build until the JSON is regenerated. examples.json next to it is hand
|
|
8
|
+
harvested against a local stack (DEV-2263) and is NOT regenerated here.
|
|
9
|
+
"""
|
|
10
|
+
import json
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
import typer
|
|
15
|
+
|
|
16
|
+
# Older click spells these differently; normalise so pytest and the venv agree.
|
|
17
|
+
_TYPE_NAMES = {"text": "str", "integer": "int", "integer range": "int range", "boolean": "bool", "float": "float"}
|
|
18
|
+
|
|
19
|
+
from ermes_cli import __version__
|
|
20
|
+
from ermes_cli.main import app
|
|
21
|
+
|
|
22
|
+
OUT = Path(__file__).resolve().parents[2] / "apps/ui/src/views/settings/cli-reference/commands.json"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _type_name(p) -> str:
|
|
26
|
+
t = getattr(p, "type", None)
|
|
27
|
+
if t is None: # typer>=0.29 vendors click and drops Parameter.type
|
|
28
|
+
info = p.type_descriptor.parameter_info
|
|
29
|
+
ranged = getattr(info, "min", None) is not None or getattr(info, "max", None) is not None
|
|
30
|
+
return f"{p.bare_type()} range" if ranged else p.bare_type()
|
|
31
|
+
name = getattr(t, "name", str(t))
|
|
32
|
+
return _TYPE_NAMES.get(name, name)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _params(cmd) -> list[dict]:
|
|
36
|
+
out = []
|
|
37
|
+
for p in cmd.params:
|
|
38
|
+
if p.name in (None, "help"):
|
|
39
|
+
continue
|
|
40
|
+
d: dict = {
|
|
41
|
+
"name": p.name,
|
|
42
|
+
"kind": "arg" if p.param_type_name == "argument" else "opt",
|
|
43
|
+
"required": bool(p.required),
|
|
44
|
+
"type": _type_name(p),
|
|
45
|
+
}
|
|
46
|
+
if d["kind"] == "opt":
|
|
47
|
+
d["opts"] = [*p.opts, *p.secondary_opts]
|
|
48
|
+
d["help"] = (getattr(p, "help", "") or "").strip()
|
|
49
|
+
d["flag"] = bool(getattr(p, "is_flag", False))
|
|
50
|
+
default = p.default
|
|
51
|
+
if default not in (None, False, "") and not callable(default):
|
|
52
|
+
d["default"] = default
|
|
53
|
+
out.append(d)
|
|
54
|
+
return out
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _walk(group) -> list[dict]:
|
|
58
|
+
ctx = typer.Context(group)
|
|
59
|
+
res = []
|
|
60
|
+
for name in group.list_commands(ctx):
|
|
61
|
+
sub = group.get_command(ctx, name)
|
|
62
|
+
assert sub is not None
|
|
63
|
+
d: dict = {"name": name, "help": (sub.help or "").strip(), "params": _params(sub)}
|
|
64
|
+
if hasattr(sub, "list_commands"): # Typer vendors click, so isinstance(click.Group) is false
|
|
65
|
+
children = _walk(sub)
|
|
66
|
+
if children: # `metrics` is a sub-app with a callback and no subcommands: a leaf
|
|
67
|
+
d["commands"] = children
|
|
68
|
+
res.append(d)
|
|
69
|
+
return res
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def build() -> dict:
|
|
73
|
+
root = typer.main.get_command(app)
|
|
74
|
+
return {"version": __version__, "help": (root.help or "").strip(), "root_params": _params(root), "commands": _walk(root)}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main() -> int:
|
|
78
|
+
text = json.dumps(build(), indent=1, ensure_ascii=False) + "\n"
|
|
79
|
+
if "--check" in sys.argv:
|
|
80
|
+
if OUT.read_text() != text:
|
|
81
|
+
print(f"{OUT} is stale: run `uv run python scripts/gen_reference.py`", file=sys.stderr)
|
|
82
|
+
return 1
|
|
83
|
+
return 0
|
|
84
|
+
OUT.write_text(text)
|
|
85
|
+
print(f"wrote {OUT}")
|
|
86
|
+
return 0
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if __name__ == "__main__":
|
|
90
|
+
raise SystemExit(main())
|
|
@@ -69,6 +69,8 @@ class TestTemplatesProof:
|
|
|
69
69
|
httpx_mock.add_response(json={"success": True})
|
|
70
70
|
result = invoke(["--json", "templates", "proof", "1", "--to", "test@example.com"])
|
|
71
71
|
assert result.exit_code == 0
|
|
72
|
+
# The API schema requires `recipient` (TemplateController.ts templateProofParams); `to` was a 422, and sendProof reads `variables.event`, so a missing `variables` is a 400.
|
|
73
|
+
assert json.loads(httpx_mock.get_request().content) == {"recipient": "test@example.com", "variables": {}}
|
|
72
74
|
|
|
73
75
|
|
|
74
76
|
class TestTemplatesPreview:
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""The committed Settings -> CLI -> Reference tree must match the live CLI."""
|
|
2
|
+
import importlib.util
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
SCRIPT = Path(__file__).resolve().parents[1] / "scripts/gen_reference.py"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _load():
|
|
10
|
+
spec = importlib.util.spec_from_file_location("gen_reference", SCRIPT)
|
|
11
|
+
mod = importlib.util.module_from_spec(spec)
|
|
12
|
+
assert spec.loader is not None
|
|
13
|
+
spec.loader.exec_module(mod)
|
|
14
|
+
return mod
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_commands_json_matches_live_cli():
|
|
18
|
+
mod = _load()
|
|
19
|
+
committed = json.loads(mod.OUT.read_text())
|
|
20
|
+
assert committed == mod.build(), "run `uv run python scripts/gen_reference.py` and commit the result"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_every_example_points_at_a_real_command():
|
|
24
|
+
mod = _load()
|
|
25
|
+
tree = mod.build()
|
|
26
|
+
leaves = set()
|
|
27
|
+
|
|
28
|
+
def walk(cmds, prefix):
|
|
29
|
+
for c in cmds:
|
|
30
|
+
path = f"{prefix}{c['name']}"
|
|
31
|
+
if "commands" in c:
|
|
32
|
+
walk(c["commands"], f"{path}.")
|
|
33
|
+
else:
|
|
34
|
+
leaves.add(path)
|
|
35
|
+
|
|
36
|
+
walk(tree["commands"], "")
|
|
37
|
+
examples = json.loads((mod.OUT.parent / "examples.json").read_text())
|
|
38
|
+
for key in examples:
|
|
39
|
+
if key.startswith("err."):
|
|
40
|
+
continue
|
|
41
|
+
parts = key.split(".")
|
|
42
|
+
assert any(".".join(parts[:n]) in leaves for n in range(1, len(parts) + 1)), f"example {key} has no command"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.6.0"
|
|
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
|
|
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
|
|
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
|
|
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
|