makea-cli 0.2.22__py3-none-any.whl → 0.2.23__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- makea_cli/__init__.py +1 -1
- makea_cli/api_client.py +21 -0
- makea_cli/commands/metrics/cmd.py +148 -0
- {makea_cli-0.2.22.dist-info → makea_cli-0.2.23.dist-info}/METADATA +4 -1
- {makea_cli-0.2.22.dist-info → makea_cli-0.2.23.dist-info}/RECORD +7 -7
- {makea_cli-0.2.22.dist-info → makea_cli-0.2.23.dist-info}/WHEEL +0 -0
- {makea_cli-0.2.22.dist-info → makea_cli-0.2.23.dist-info}/entry_points.txt +0 -0
makea_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.23"
|
makea_cli/api_client.py
CHANGED
|
@@ -933,6 +933,27 @@ def get_cumulative_payment_and_platform_revenue(
|
|
|
933
933
|
)
|
|
934
934
|
|
|
935
935
|
|
|
936
|
+
def list_growth_snapshots() -> Any:
|
|
937
|
+
"""GET /admin/growth/snapshots — published Growth Analysis snapshots, newest first."""
|
|
938
|
+
return get_json("/admin/growth/snapshots")
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
def get_growth_snapshot(snapshot_id: str = "latest") -> Any:
|
|
942
|
+
"""GET /admin/growth/snapshots/{id|latest} — one snapshot, every block of it."""
|
|
943
|
+
return get_json(f"/admin/growth/snapshots/{quote(snapshot_id, safe='')}", timeout=120.0)
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
def import_growth_snapshot(sources_path: Path, *, check_only: bool = False) -> Any:
|
|
947
|
+
"""POST /admin/growth/snapshots — gate and publish one reconciled snapshot.
|
|
948
|
+
|
|
949
|
+
Sent as a file part, not a JSON body: the server caps an in-memory body at
|
|
950
|
+
2.5MB and a snapshot with a long forecast passes that. ``check_only`` runs
|
|
951
|
+
the gates without publishing (``?dry_run=1``).
|
|
952
|
+
"""
|
|
953
|
+
path = "/admin/growth/snapshots" + ("?dry_run=1" if check_only else "")
|
|
954
|
+
return post_multipart_with_file(path, file_path=sources_path, timeout=300.0)
|
|
955
|
+
|
|
956
|
+
|
|
936
957
|
def get_fx_rates(*, to: str, sources: list[str], amount: float | None = None) -> Any:
|
|
937
958
|
"""
|
|
938
959
|
GET /admin/fx/rates — the platform's own exchange rates (rounded up to its
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import json
|
|
4
|
+
import tempfile
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
3
7
|
import typer
|
|
4
8
|
from rich.console import Console
|
|
5
9
|
|
|
@@ -165,3 +169,147 @@ def register(app: typer.Typer) -> None:
|
|
|
165
169
|
return out
|
|
166
170
|
|
|
167
171
|
print_json_or_exit(console, _do)
|
|
172
|
+
|
|
173
|
+
@command(
|
|
174
|
+
app,
|
|
175
|
+
"admin",
|
|
176
|
+
"list",
|
|
177
|
+
"growth-snapshot",
|
|
178
|
+
api="GET /admin/growth/snapshots",
|
|
179
|
+
help=(
|
|
180
|
+
"GET /admin/growth/snapshots — published Growth Analysis snapshots "
|
|
181
|
+
"(Metrics page), newest first, with cut-off, rule version, audit "
|
|
182
|
+
"status and headline GMV/revenue."
|
|
183
|
+
),
|
|
184
|
+
)
|
|
185
|
+
def list_growth_snapshots() -> None:
|
|
186
|
+
"""Every published snapshot's index entry. Snapshots are immutable; a
|
|
187
|
+
correction is a new id, so this list is also the change log."""
|
|
188
|
+
print_json_or_exit(console, api_client.list_growth_snapshots)
|
|
189
|
+
|
|
190
|
+
@command(
|
|
191
|
+
app,
|
|
192
|
+
"admin",
|
|
193
|
+
"get",
|
|
194
|
+
"growth-snapshot",
|
|
195
|
+
api="GET /admin/growth/snapshots/{id}",
|
|
196
|
+
help=(
|
|
197
|
+
"GET /admin/growth/snapshots/{id|latest} — one reconciled snapshot: "
|
|
198
|
+
"headline, economics, monthly, customers, ledger, suppliers, forecast, "
|
|
199
|
+
"gates and review items."
|
|
200
|
+
),
|
|
201
|
+
)
|
|
202
|
+
def get_growth_snapshot(
|
|
203
|
+
snapshot_id: str = typer.Argument("latest", help="Snapshot id, or latest."),
|
|
204
|
+
block: str = typer.Option(
|
|
205
|
+
None,
|
|
206
|
+
"--block",
|
|
207
|
+
"-b",
|
|
208
|
+
help="Print only one block, e.g. headline, gates, review_items, economics.",
|
|
209
|
+
),
|
|
210
|
+
) -> None:
|
|
211
|
+
"""Audited actuals and Booked GMV live in separate blocks (``ledger`` vs
|
|
212
|
+
``forecast``); never add one to the other."""
|
|
213
|
+
|
|
214
|
+
def _do():
|
|
215
|
+
snapshot = (api_client.get_growth_snapshot(snapshot_id) or {}).get("snapshot") or {}
|
|
216
|
+
if block:
|
|
217
|
+
if block not in snapshot:
|
|
218
|
+
raise RuntimeError(f"No block {block!r}. Blocks: {', '.join(sorted(snapshot))}")
|
|
219
|
+
return snapshot[block]
|
|
220
|
+
return snapshot
|
|
221
|
+
|
|
222
|
+
print_json_or_exit(console, _do)
|
|
223
|
+
|
|
224
|
+
@command(
|
|
225
|
+
app,
|
|
226
|
+
"admin",
|
|
227
|
+
"upload",
|
|
228
|
+
"growth-snapshot",
|
|
229
|
+
api="POST /admin/growth/snapshots",
|
|
230
|
+
side_effects=[],
|
|
231
|
+
approval="ask",
|
|
232
|
+
reversible=False,
|
|
233
|
+
help=(
|
|
234
|
+
"POST /admin/growth/snapshots — publish a reconciled Growth Analysis "
|
|
235
|
+
"snapshot to the Metrics page. The server runs the ten publication "
|
|
236
|
+
"gates and refuses anything that fails; --check runs them without "
|
|
237
|
+
"publishing."
|
|
238
|
+
),
|
|
239
|
+
)
|
|
240
|
+
def upload_growth_snapshot(
|
|
241
|
+
analysis: Path = typer.Option(
|
|
242
|
+
None,
|
|
243
|
+
"--analysis",
|
|
244
|
+
help="analysis_data.json (headline, fx, monthly, customers, orders, ...).",
|
|
245
|
+
),
|
|
246
|
+
derived: Path = typer.Option(
|
|
247
|
+
None, "--derived", help="derived_metrics.json (AOV, supplier populations)."
|
|
248
|
+
),
|
|
249
|
+
audit: Path = typer.Option(
|
|
250
|
+
None, "--audit", help="audit_checks.json (source pipeline assertions)."
|
|
251
|
+
),
|
|
252
|
+
forecast: Path = typer.Option(
|
|
253
|
+
None, "--forecast", help="projection_data.json (Booked GMV)."
|
|
254
|
+
),
|
|
255
|
+
review: Path = typer.Option(
|
|
256
|
+
None,
|
|
257
|
+
"--review",
|
|
258
|
+
help="JSON list of review items; an open item needs accepted_open: true to pass.",
|
|
259
|
+
),
|
|
260
|
+
rule_version: str = typer.Option(
|
|
261
|
+
None, "--rule-version", help="The rule set these numbers follow."
|
|
262
|
+
),
|
|
263
|
+
snapshot_id: str = typer.Option(
|
|
264
|
+
None,
|
|
265
|
+
"--snapshot-id",
|
|
266
|
+
help="Defaults to the cut-off date; suffix a correction, e.g. 2026-10-26.b.",
|
|
267
|
+
),
|
|
268
|
+
fx_basis: str = typer.Option(None, "--fx-basis", help="e.g. 'ECB reference, 31 Jul 2026'."),
|
|
269
|
+
note: str = typer.Option(None, "--note", help="What changed since the previous snapshot."),
|
|
270
|
+
sources: Path = typer.Option(
|
|
271
|
+
None,
|
|
272
|
+
"--sources",
|
|
273
|
+
help="One prebuilt JSON holding every block; replaces the file options.",
|
|
274
|
+
),
|
|
275
|
+
check: bool = typer.Option(False, "--check", help="Run the gates only; publish nothing."),
|
|
276
|
+
) -> None:
|
|
277
|
+
"""Publish once per refresh. An id is written once: a correction is a new
|
|
278
|
+
snapshot, and the previous one stays readable for comparison.
|
|
279
|
+
|
|
280
|
+
Output: {"published", "entry", "gates"}. A failed gate exits 4 with every
|
|
281
|
+
gate and its detail, and nothing is stored.
|
|
282
|
+
"""
|
|
283
|
+
|
|
284
|
+
def _load(path: Path | None):
|
|
285
|
+
if path is None:
|
|
286
|
+
return None
|
|
287
|
+
return json.loads(path.read_text(encoding="utf-8"))
|
|
288
|
+
|
|
289
|
+
def _do():
|
|
290
|
+
if sources is not None:
|
|
291
|
+
body = _load(sources)
|
|
292
|
+
else:
|
|
293
|
+
if analysis is None or not rule_version:
|
|
294
|
+
raise RuntimeError("Pass --sources, or --analysis with --rule-version.")
|
|
295
|
+
body = {
|
|
296
|
+
"analysis": _load(analysis),
|
|
297
|
+
"derived": _load(derived) or {},
|
|
298
|
+
"audit": _load(audit) or {},
|
|
299
|
+
"forecast": _load(forecast) or {},
|
|
300
|
+
"review_items": _load(review) or [],
|
|
301
|
+
}
|
|
302
|
+
for key, value in (
|
|
303
|
+
("rule_version", rule_version),
|
|
304
|
+
("snapshot_id", snapshot_id),
|
|
305
|
+
("fx_basis", fx_basis),
|
|
306
|
+
("note", note),
|
|
307
|
+
):
|
|
308
|
+
if value:
|
|
309
|
+
body[key] = value
|
|
310
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
311
|
+
path = Path(tmp) / "growth_snapshot.json"
|
|
312
|
+
path.write_text(json.dumps(body, ensure_ascii=False), encoding="utf-8")
|
|
313
|
+
return api_client.import_growth_snapshot(path, check_only=check)
|
|
314
|
+
|
|
315
|
+
print_json_or_exit(console, _do)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: makea-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.23
|
|
4
4
|
Summary: Makea admin CLI (browser login + Makea admin HTTP API)
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: click<9,>=8.1
|
|
@@ -114,6 +114,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
114
114
|
| `makea-cli admin get analytics-query` | read | `POST /admin/analytics/query` | Run an arbitrary HogQL query (escape hatch). Example: analytics-query "SELECT count() FROM events" | `analytics-query` |
|
|
115
115
|
| `makea-cli admin get currency-conversion` | read | `GET /admin/fx/rates` | the platform's own exchange rates and rounding (rate table for several --from; one --from with --amount converts it). | `convert-currency` |
|
|
116
116
|
| `makea-cli admin get feature-usage` | read | `POST /admin/analytics/query` | How many distinct users used a feature recently, plus event volume. Matches $pageview path and feature_time_spent eve… | `analytics-feature-usage` |
|
|
117
|
+
| `makea-cli admin get growth-snapshot` | read | `GET /admin/growth/snapshots/{id}` | one reconciled Growth Analysis snapshot (default `latest`); `--block` prints one block (headline, gates, review_items, …). | — |
|
|
117
118
|
| `makea-cli admin get library-schema` | read | `GET /admin/library_components/schema` | the tech-pack library taxonomy: sections and their library-role field keys (run this before create/update). | `library-schema` |
|
|
118
119
|
| `makea-cli admin get playbook-preview` | read | `GET /admin/playbook/preview` | the playbook block one AI surface would get for a person or factory, and every rule left out with its reason; --product previews a conversation about one product, --rule answers for one rule. | — |
|
|
119
120
|
| `makea-cli admin get production-pricing` | read | `GET /admin/production_orders/{id}/details` | show a production order's price tiers, MOQ, sizes/colours, pricing groups and cart coverage. | `production-pricing-show` |
|
|
@@ -128,6 +129,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
128
129
|
| `makea-cli admin get top-clicks` | read | `POST /admin/analytics/query` | which buttons/elements get clicked most. | `analytics-top-clicks` |
|
|
129
130
|
| `makea-cli admin get top-features` | read | `POST /admin/analytics/query` | a quick map of which features get used most. | `analytics-top-features` |
|
|
130
131
|
| `makea-cli admin list library-element` | read | `GET /admin/designer/{user_id}/library_components` | list a designer's tech-pack library (org-fanned). Optional --section scopes to one type. | `library-list` |
|
|
132
|
+
| `makea-cli admin list growth-snapshot` | read | `GET /admin/growth/snapshots` | published Growth Analysis snapshots, newest first (the change log). | — |
|
|
131
133
|
| `makea-cli admin list misc-payment` | read | `GET /admin/products/{id}/misc-payments` | misc payments for one product (admin). | `list-misc-payments-by-product` |
|
|
132
134
|
| `makea-cli admin list product-order` | read | `GET /admin/designer/get_all_product_orders` | designer product (SKU) list. For 大货 use admin list production-order or admin list production-order --product. | `list-product-orders` |
|
|
133
135
|
| `makea-cli admin list production-order` | read | `GET /admin/production_orders?type=PRODUCTION` | 大货 (production) orders only. For restock use admin list restock-order; for shipping use admin list shipping-order. | `list-all-production-orders` |
|
|
@@ -158,6 +160,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
158
160
|
| `makea-cli admin update tracking-status` | write(ask) | `POST /admin/tracking/carrier_status` | apply a carrier status looked up by hand (tracking-sweep skill) to one order: status, fan-out, delivered emails (--silent: state only). | — |
|
|
159
161
|
| `makea-cli admin update user` | write(ask) | `PUT /admin/user-profiles/{user_id}/update` | admin updates DynamoDB user profile fields and/or Cognito custom:userType. Allowed --user-type values: "Fashion brand… | `update-user-profile` |
|
|
160
162
|
| `makea-cli admin upload financial-document` | write(auto) | `POST /admin/products/{product_id}/financial_documents` | upload one or more files to AWS S3 and return financial document metadata. | `upload-financial-documents` |
|
|
163
|
+
| `makea-cli admin upload growth-snapshot` | write(ask) | `POST /admin/growth/snapshots` | publish a reconciled snapshot to admin Metrics; the server runs the ten gates and refuses a failure; `--check` gates only. | — |
|
|
161
164
|
| `makea-cli admin upload link-document` | write(auto) | `POST /admin/upload_link_document` | upload a file to AWS S3 and return document domain metadata for reuse as input in other commands. | `upload-link-document` |
|
|
162
165
|
| `makea-cli admin upload product-document` | write(auto) | `POST /admin/designer/upload_document` | upload a file to AWS S3 under a product and return document domain metadata for reuse by other commands. | `upload-product-document` |
|
|
163
166
|
| `makea-cli admin upload production-order-document` | write(auto) | `POST /admin/production_orders/{production_order_id}/documents` | upload a file to AWS S3 for a production order and return document domain metadata. | `upload-production-order-document` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
makea_cli/__init__.py,sha256=
|
|
1
|
+
makea_cli/__init__.py,sha256=drfF0qMRjoB2RacyqP-NkNmDOIBrys6RWHvqSTpZLuc,23
|
|
2
2
|
makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
|
|
3
|
-
makea_cli/api_client.py,sha256=
|
|
3
|
+
makea_cli/api_client.py,sha256=SQWPYQzIrm9BqWrraHkhAQeFZjljLHZm_ioSnlcz9ss,75766
|
|
4
4
|
makea_cli/auth_pkce.py,sha256=iXSyJ7DM3qVuj-3FwPiqM25CxXz9ebFs9FNthZdw3ws,7315
|
|
5
5
|
makea_cli/broker.py,sha256=5O650nAdRuF-u9E1MuVM2jVv796iBdxJGIaJasxHij0,3019
|
|
6
6
|
makea_cli/config.py,sha256=hz8MnJSkhxcIEZkcpHR005JrDceo1Xmi8qwIUq50cMU,3003
|
|
@@ -33,7 +33,7 @@ makea_cli/commands/factory/cmd.py,sha256=k_UGkqpzxxZhN9WjKt1rb95KOTGHMpMJRpfNHTG
|
|
|
33
33
|
makea_cli/commands/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
34
|
makea_cli/commands/library/cmd.py,sha256=eXZa6iLyPaoEWtRd-UmhRT6Ox-zlfs89gJqGn-IPuSU,11187
|
|
35
35
|
makea_cli/commands/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
makea_cli/commands/metrics/cmd.py,sha256=
|
|
36
|
+
makea_cli/commands/metrics/cmd.py,sha256=GvJe83vQu8XSCEulsfDvA60eKnvpIA5ItyMbvxjHQss,12069
|
|
37
37
|
makea_cli/commands/orders/__init__.py,sha256=6WKPqX02e0RRPmItPIBJ0TA4_yDI2PVvBDkAiMQu9rU,75
|
|
38
38
|
makea_cli/commands/orders/cmd.py,sha256=Nh5lGv5k4SIwsr_hg-ndah8eTorZCYIMpTAz4CCi6oY,13352
|
|
39
39
|
makea_cli/commands/playbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -49,7 +49,7 @@ makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNL
|
|
|
49
49
|
makea_cli/commands/supplier/cmd.py,sha256=crRCy9WfhkryHMIL3iufoiT90_SG3-mKChAtdhd06uc,58076
|
|
50
50
|
makea_cli/commands/tasks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
51
51
|
makea_cli/commands/tasks/cmd.py,sha256=SRvv4Ovtcf5-me-8AdKcZ_z_gSrdgC0pbswYbMz7oY4,6539
|
|
52
|
-
makea_cli-0.2.
|
|
53
|
-
makea_cli-0.2.
|
|
54
|
-
makea_cli-0.2.
|
|
55
|
-
makea_cli-0.2.
|
|
52
|
+
makea_cli-0.2.23.dist-info/METADATA,sha256=R8vXTZWjsjKrw0eGacTTpI3gCFT3xv8uV41cJ5wqau4,38087
|
|
53
|
+
makea_cli-0.2.23.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
54
|
+
makea_cli-0.2.23.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
|
|
55
|
+
makea_cli-0.2.23.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|