makea-cli 0.2.22__tar.gz → 0.2.23__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.
- {makea_cli-0.2.22 → makea_cli-0.2.23}/CHANGELOG.md +16 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/PKG-INFO +4 -1
- {makea_cli-0.2.22 → makea_cli-0.2.23}/README.md +3 -0
- makea_cli-0.2.23/makea_cli/__init__.py +1 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/api_client.py +21 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/metrics/cmd.py +148 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/pyproject.toml +1 -1
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/golden_manifest.json +213 -0
- makea_cli-0.2.22/makea_cli/__init__.py +0 -1
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.claude/skills/create-supplier-profile/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.claude/skills/lark-cli-setup/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.claude/skills/link-supplier-user/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.claude/skills/makea-cli-setup/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.claude/skills/payment-revenue-report/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.claude/skills/supplier-user-id-migration/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/.gitignore +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea-collection-upload/SKILL.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea-collection-upload/scripts/create_products.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/__main__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/auth_pkce.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/broker.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/_util.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/about/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/about/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/analytics/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/analytics/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/auth/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/auth/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/brand/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/brand/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/designer/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/designer/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/directory/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/directory/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/document/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/document/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/email/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/email/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/factory/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/factory/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/library/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/library/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/metrics/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/orders/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/orders/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/playbook/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/playbook/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/product/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/product/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/production/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/production/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/production/pricing_spec.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/shipping/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/shipping/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/supplier/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/supplier/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/tasks/__init__.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/commands/tasks/cmd.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/config.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/errors.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/identity.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/main.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/output.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/posthog_client.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/makea_cli/registry.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/npm/makea-cli/README.md +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/npm/makea-cli/makea-cli.mjs +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/npm/makea-cli/package.json +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_broker.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_currency_conversion.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_output_contract.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_persona_commands.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_pm_reads.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_registry.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/tests/test_supplier_scorecard.py +0 -0
- {makea_cli-0.2.22 → makea_cli-0.2.23}/uv.lock +0 -0
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.23
|
|
4
|
+
|
|
5
|
+
New: Growth Analysis snapshots, the numbers on admin Metrics. Needs the
|
|
6
|
+
backend from the same day (`/admin/growth/snapshots`).
|
|
7
|
+
|
|
8
|
+
- `admin upload growth-snapshot --analysis … --derived … --audit … --forecast …
|
|
9
|
+
--review … --rule-version …` (or `--sources one.json`): publish a reconciled
|
|
10
|
+
snapshot. The server runs the ten publication gates (Stripe allocations
|
|
11
|
+
checked against live Stripe) and refuses a snapshot that fails any of them.
|
|
12
|
+
`--check` runs the gates without publishing. A snapshot id is written once;
|
|
13
|
+
publish a correction under a new id such as `2026-10-26.b`.
|
|
14
|
+
- `admin list growth-snapshot`: every published snapshot, newest first.
|
|
15
|
+
- `admin get growth-snapshot [ID|latest] [--block NAME]`: one snapshot, or one
|
|
16
|
+
block of it. Audited actuals (`ledger`) and Booked GMV (`forecast`) are
|
|
17
|
+
separate blocks; never add one to the other.
|
|
18
|
+
|
|
3
19
|
## 0.2.22
|
|
4
20
|
|
|
5
21
|
New: what the brand reads under a rule, and its card name. Needs the backend
|
|
@@ -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` |
|
|
@@ -102,6 +102,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
102
102
|
| `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` |
|
|
103
103
|
| `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` |
|
|
104
104
|
| `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` |
|
|
105
|
+
| `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, …). | — |
|
|
105
106
|
| `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` |
|
|
106
107
|
| `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. | — |
|
|
107
108
|
| `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` |
|
|
@@ -116,6 +117,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
116
117
|
| `makea-cli admin get top-clicks` | read | `POST /admin/analytics/query` | which buttons/elements get clicked most. | `analytics-top-clicks` |
|
|
117
118
|
| `makea-cli admin get top-features` | read | `POST /admin/analytics/query` | a quick map of which features get used most. | `analytics-top-features` |
|
|
118
119
|
| `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` |
|
|
120
|
+
| `makea-cli admin list growth-snapshot` | read | `GET /admin/growth/snapshots` | published Growth Analysis snapshots, newest first (the change log). | — |
|
|
119
121
|
| `makea-cli admin list misc-payment` | read | `GET /admin/products/{id}/misc-payments` | misc payments for one product (admin). | `list-misc-payments-by-product` |
|
|
120
122
|
| `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` |
|
|
121
123
|
| `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` |
|
|
@@ -146,6 +148,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
146
148
|
| `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). | — |
|
|
147
149
|
| `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` |
|
|
148
150
|
| `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` |
|
|
151
|
+
| `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. | — |
|
|
149
152
|
| `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` |
|
|
150
153
|
| `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` |
|
|
151
154
|
| `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` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.23"
|
|
@@ -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)
|
|
@@ -2107,6 +2107,50 @@
|
|
|
2107
2107
|
}
|
|
2108
2108
|
]
|
|
2109
2109
|
},
|
|
2110
|
+
{
|
|
2111
|
+
"name": "admin get growth-snapshot",
|
|
2112
|
+
"persona": "admin",
|
|
2113
|
+
"verb": "get",
|
|
2114
|
+
"noun": "growth-snapshot",
|
|
2115
|
+
"access": "read",
|
|
2116
|
+
"api": "GET /admin/growth/snapshots/{id}",
|
|
2117
|
+
"external": null,
|
|
2118
|
+
"side_effects": [],
|
|
2119
|
+
"approval": "auto",
|
|
2120
|
+
"reversible": null,
|
|
2121
|
+
"idempotent": null,
|
|
2122
|
+
"limit": null,
|
|
2123
|
+
"legacy": [],
|
|
2124
|
+
"help": "GET /admin/growth/snapshots/{id|latest} — one reconciled snapshot: headline, economics, monthly, customers, ledger, suppliers, forecast, gates and review items.",
|
|
2125
|
+
"function": "makea_cli.commands.metrics.cmd.register.<locals>.get_growth_snapshot",
|
|
2126
|
+
"flags": [
|
|
2127
|
+
{
|
|
2128
|
+
"name": "snapshot_id",
|
|
2129
|
+
"kind": "argument",
|
|
2130
|
+
"opts": [
|
|
2131
|
+
"snapshot_id"
|
|
2132
|
+
],
|
|
2133
|
+
"type": "text",
|
|
2134
|
+
"required": false,
|
|
2135
|
+
"multiple": false,
|
|
2136
|
+
"default": "latest",
|
|
2137
|
+
"help": "Snapshot id, or latest."
|
|
2138
|
+
},
|
|
2139
|
+
{
|
|
2140
|
+
"name": "block",
|
|
2141
|
+
"kind": "option",
|
|
2142
|
+
"opts": [
|
|
2143
|
+
"--block",
|
|
2144
|
+
"-b"
|
|
2145
|
+
],
|
|
2146
|
+
"type": "text",
|
|
2147
|
+
"required": false,
|
|
2148
|
+
"multiple": false,
|
|
2149
|
+
"default": null,
|
|
2150
|
+
"help": "Print only one block, e.g. headline, gates, review_items, economics."
|
|
2151
|
+
}
|
|
2152
|
+
]
|
|
2153
|
+
},
|
|
2110
2154
|
{
|
|
2111
2155
|
"name": "admin get library-schema",
|
|
2112
2156
|
"persona": "admin",
|
|
@@ -2703,6 +2747,24 @@
|
|
|
2703
2747
|
}
|
|
2704
2748
|
]
|
|
2705
2749
|
},
|
|
2750
|
+
{
|
|
2751
|
+
"name": "admin list growth-snapshot",
|
|
2752
|
+
"persona": "admin",
|
|
2753
|
+
"verb": "list",
|
|
2754
|
+
"noun": "growth-snapshot",
|
|
2755
|
+
"access": "read",
|
|
2756
|
+
"api": "GET /admin/growth/snapshots",
|
|
2757
|
+
"external": null,
|
|
2758
|
+
"side_effects": [],
|
|
2759
|
+
"approval": "auto",
|
|
2760
|
+
"reversible": null,
|
|
2761
|
+
"idempotent": null,
|
|
2762
|
+
"limit": "client",
|
|
2763
|
+
"legacy": [],
|
|
2764
|
+
"help": "GET /admin/growth/snapshots — published Growth Analysis snapshots (Metrics page), newest first, with cut-off, rule version, audit status and headline GMV/revenue.",
|
|
2765
|
+
"function": "makea_cli.commands.metrics.cmd.register.<locals>.list_growth_snapshots",
|
|
2766
|
+
"flags": []
|
|
2767
|
+
},
|
|
2706
2768
|
{
|
|
2707
2769
|
"name": "admin list library-element",
|
|
2708
2770
|
"persona": "admin",
|
|
@@ -6079,6 +6141,157 @@
|
|
|
6079
6141
|
}
|
|
6080
6142
|
]
|
|
6081
6143
|
},
|
|
6144
|
+
{
|
|
6145
|
+
"name": "admin upload growth-snapshot",
|
|
6146
|
+
"persona": "admin",
|
|
6147
|
+
"verb": "upload",
|
|
6148
|
+
"noun": "growth-snapshot",
|
|
6149
|
+
"access": "write",
|
|
6150
|
+
"api": "POST /admin/growth/snapshots",
|
|
6151
|
+
"external": null,
|
|
6152
|
+
"side_effects": [],
|
|
6153
|
+
"approval": "ask",
|
|
6154
|
+
"reversible": false,
|
|
6155
|
+
"idempotent": null,
|
|
6156
|
+
"limit": null,
|
|
6157
|
+
"legacy": [],
|
|
6158
|
+
"help": "POST /admin/growth/snapshots — publish a reconciled Growth Analysis snapshot to the Metrics page. The server runs the ten publication gates and refuses anything that fails; --check runs them without publishing.",
|
|
6159
|
+
"function": "makea_cli.commands.metrics.cmd.register.<locals>.upload_growth_snapshot",
|
|
6160
|
+
"flags": [
|
|
6161
|
+
{
|
|
6162
|
+
"name": "analysis",
|
|
6163
|
+
"kind": "option",
|
|
6164
|
+
"opts": [
|
|
6165
|
+
"--analysis"
|
|
6166
|
+
],
|
|
6167
|
+
"type": "path",
|
|
6168
|
+
"required": false,
|
|
6169
|
+
"multiple": false,
|
|
6170
|
+
"default": null,
|
|
6171
|
+
"help": "analysis_data.json (headline, fx, monthly, customers, orders, ...)."
|
|
6172
|
+
},
|
|
6173
|
+
{
|
|
6174
|
+
"name": "derived",
|
|
6175
|
+
"kind": "option",
|
|
6176
|
+
"opts": [
|
|
6177
|
+
"--derived"
|
|
6178
|
+
],
|
|
6179
|
+
"type": "path",
|
|
6180
|
+
"required": false,
|
|
6181
|
+
"multiple": false,
|
|
6182
|
+
"default": null,
|
|
6183
|
+
"help": "derived_metrics.json (AOV, supplier populations)."
|
|
6184
|
+
},
|
|
6185
|
+
{
|
|
6186
|
+
"name": "audit",
|
|
6187
|
+
"kind": "option",
|
|
6188
|
+
"opts": [
|
|
6189
|
+
"--audit"
|
|
6190
|
+
],
|
|
6191
|
+
"type": "path",
|
|
6192
|
+
"required": false,
|
|
6193
|
+
"multiple": false,
|
|
6194
|
+
"default": null,
|
|
6195
|
+
"help": "audit_checks.json (source pipeline assertions)."
|
|
6196
|
+
},
|
|
6197
|
+
{
|
|
6198
|
+
"name": "forecast",
|
|
6199
|
+
"kind": "option",
|
|
6200
|
+
"opts": [
|
|
6201
|
+
"--forecast"
|
|
6202
|
+
],
|
|
6203
|
+
"type": "path",
|
|
6204
|
+
"required": false,
|
|
6205
|
+
"multiple": false,
|
|
6206
|
+
"default": null,
|
|
6207
|
+
"help": "projection_data.json (Booked GMV)."
|
|
6208
|
+
},
|
|
6209
|
+
{
|
|
6210
|
+
"name": "review",
|
|
6211
|
+
"kind": "option",
|
|
6212
|
+
"opts": [
|
|
6213
|
+
"--review"
|
|
6214
|
+
],
|
|
6215
|
+
"type": "path",
|
|
6216
|
+
"required": false,
|
|
6217
|
+
"multiple": false,
|
|
6218
|
+
"default": null,
|
|
6219
|
+
"help": "JSON list of review items; an open item needs accepted_open: true to pass."
|
|
6220
|
+
},
|
|
6221
|
+
{
|
|
6222
|
+
"name": "rule_version",
|
|
6223
|
+
"kind": "option",
|
|
6224
|
+
"opts": [
|
|
6225
|
+
"--rule-version"
|
|
6226
|
+
],
|
|
6227
|
+
"type": "text",
|
|
6228
|
+
"required": false,
|
|
6229
|
+
"multiple": false,
|
|
6230
|
+
"default": null,
|
|
6231
|
+
"help": "The rule set these numbers follow."
|
|
6232
|
+
},
|
|
6233
|
+
{
|
|
6234
|
+
"name": "snapshot_id",
|
|
6235
|
+
"kind": "option",
|
|
6236
|
+
"opts": [
|
|
6237
|
+
"--snapshot-id"
|
|
6238
|
+
],
|
|
6239
|
+
"type": "text",
|
|
6240
|
+
"required": false,
|
|
6241
|
+
"multiple": false,
|
|
6242
|
+
"default": null,
|
|
6243
|
+
"help": "Defaults to the cut-off date; suffix a correction, e.g. 2026-10-26.b."
|
|
6244
|
+
},
|
|
6245
|
+
{
|
|
6246
|
+
"name": "fx_basis",
|
|
6247
|
+
"kind": "option",
|
|
6248
|
+
"opts": [
|
|
6249
|
+
"--fx-basis"
|
|
6250
|
+
],
|
|
6251
|
+
"type": "text",
|
|
6252
|
+
"required": false,
|
|
6253
|
+
"multiple": false,
|
|
6254
|
+
"default": null,
|
|
6255
|
+
"help": "e.g. 'ECB reference, 31 Jul 2026'."
|
|
6256
|
+
},
|
|
6257
|
+
{
|
|
6258
|
+
"name": "note",
|
|
6259
|
+
"kind": "option",
|
|
6260
|
+
"opts": [
|
|
6261
|
+
"--note"
|
|
6262
|
+
],
|
|
6263
|
+
"type": "text",
|
|
6264
|
+
"required": false,
|
|
6265
|
+
"multiple": false,
|
|
6266
|
+
"default": null,
|
|
6267
|
+
"help": "What changed since the previous snapshot."
|
|
6268
|
+
},
|
|
6269
|
+
{
|
|
6270
|
+
"name": "sources",
|
|
6271
|
+
"kind": "option",
|
|
6272
|
+
"opts": [
|
|
6273
|
+
"--sources"
|
|
6274
|
+
],
|
|
6275
|
+
"type": "path",
|
|
6276
|
+
"required": false,
|
|
6277
|
+
"multiple": false,
|
|
6278
|
+
"default": null,
|
|
6279
|
+
"help": "One prebuilt JSON holding every block; replaces the file options."
|
|
6280
|
+
},
|
|
6281
|
+
{
|
|
6282
|
+
"name": "check",
|
|
6283
|
+
"kind": "option",
|
|
6284
|
+
"opts": [
|
|
6285
|
+
"--check"
|
|
6286
|
+
],
|
|
6287
|
+
"type": "flag",
|
|
6288
|
+
"required": false,
|
|
6289
|
+
"multiple": false,
|
|
6290
|
+
"default": false,
|
|
6291
|
+
"help": "Run the gates only; publish nothing."
|
|
6292
|
+
}
|
|
6293
|
+
]
|
|
6294
|
+
},
|
|
6082
6295
|
{
|
|
6083
6296
|
"name": "admin upload link-document",
|
|
6084
6297
|
"persona": "admin",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.22"
|
|
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
|