makea-cli 0.2.17__py3-none-any.whl → 0.2.19__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 +25 -0
- makea_cli/commands/playbook/cmd.py +91 -1
- {makea_cli-0.2.17.dist-info → makea_cli-0.2.19.dist-info}/METADATA +4 -2
- {makea_cli-0.2.17.dist-info → makea_cli-0.2.19.dist-info}/RECORD +7 -7
- {makea_cli-0.2.17.dist-info → makea_cli-0.2.19.dist-info}/WHEEL +0 -0
- {makea_cli-0.2.17.dist-info → makea_cli-0.2.19.dist-info}/entry_points.txt +0 -0
makea_cli/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.2.
|
|
1
|
+
__version__ = "0.2.19"
|
makea_cli/api_client.py
CHANGED
|
@@ -1181,6 +1181,31 @@ def admin_delete_user_rule(user: str, rule_id: str, reason: str) -> Any:
|
|
|
1181
1181
|
return delete_json(_user_rules_path(user, rule_id), body={"reason": reason})
|
|
1182
1182
|
|
|
1183
1183
|
|
|
1184
|
+
def admin_get_rule_history(rule_id: str) -> Any:
|
|
1185
|
+
"""GET /admin/playbook/rules/{rule_id}/history — every revision of one rule
|
|
1186
|
+
(words, who, why), what replaced it and what it replaced."""
|
|
1187
|
+
return get_json(f"/admin/playbook/rules/{quote(rule_id, safe='')}/history")
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
def admin_playbook_preview(
|
|
1191
|
+
surface: str,
|
|
1192
|
+
*,
|
|
1193
|
+
user_id: str | None = None,
|
|
1194
|
+
supplier_id: str | None = None,
|
|
1195
|
+
product_id: str | None = None,
|
|
1196
|
+
) -> Any:
|
|
1197
|
+
"""GET /admin/playbook/preview — the block a surface would inject, plus every
|
|
1198
|
+
rule left out and why (``excluded``)."""
|
|
1199
|
+
params: dict[str, Any] = {"surface": surface}
|
|
1200
|
+
if user_id:
|
|
1201
|
+
params["user_id"] = user_id
|
|
1202
|
+
if supplier_id:
|
|
1203
|
+
params["supplier_id"] = supplier_id
|
|
1204
|
+
if product_id:
|
|
1205
|
+
params["product_id"] = product_id
|
|
1206
|
+
return get_json("/admin/playbook/preview", params=params)
|
|
1207
|
+
|
|
1208
|
+
|
|
1184
1209
|
# --- supplier persona: a factory acting on its own RFQs, quotes and orders --------
|
|
1185
1210
|
|
|
1186
1211
|
|
|
@@ -17,6 +17,7 @@ the row stays as the record, and ``update --status active`` brings it back.
|
|
|
17
17
|
from __future__ import annotations
|
|
18
18
|
|
|
19
19
|
import json
|
|
20
|
+
from datetime import date
|
|
20
21
|
from typing import Any
|
|
21
22
|
|
|
22
23
|
import typer
|
|
@@ -107,6 +108,13 @@ def _when(raw: str) -> dict[str, Any]:
|
|
|
107
108
|
return data
|
|
108
109
|
|
|
109
110
|
|
|
111
|
+
def _date(raw: str) -> str:
|
|
112
|
+
try:
|
|
113
|
+
return date.fromisoformat(raw.strip()).isoformat()
|
|
114
|
+
except ValueError as e:
|
|
115
|
+
raise typer.BadParameter("--valid-until: expected YYYY-MM-DD") from e
|
|
116
|
+
|
|
117
|
+
|
|
110
118
|
def _choice(value: str | None, allowed: tuple[str, ...], flag: str) -> str | None:
|
|
111
119
|
if value is None:
|
|
112
120
|
return None
|
|
@@ -172,6 +180,71 @@ def register(app: typer.Typer) -> None:
|
|
|
172
180
|
"""Show one playbook rule with its evidence."""
|
|
173
181
|
print_json_or_exit(console, lambda: api_client.admin_get_user_rule(user, rule_id))
|
|
174
182
|
|
|
183
|
+
@command(
|
|
184
|
+
app,
|
|
185
|
+
"admin",
|
|
186
|
+
"get",
|
|
187
|
+
"rule-history",
|
|
188
|
+
api="GET /admin/playbook/rules/{rule_id}/history",
|
|
189
|
+
help=(
|
|
190
|
+
"GET /admin/playbook/rules/{rule_id}/history — every revision of one rule: "
|
|
191
|
+
"its words, who changed it and why; superseded_chain leads to the rule "
|
|
192
|
+
"that holds now when this one was replaced."
|
|
193
|
+
),
|
|
194
|
+
)
|
|
195
|
+
def get_rule_history(
|
|
196
|
+
rule_id: str = typer.Argument(..., help="Rule id (rul_…)."),
|
|
197
|
+
) -> None:
|
|
198
|
+
"""Show what a playbook rule said at each point, and what replaced it."""
|
|
199
|
+
print_json_or_exit(console, lambda: api_client.admin_get_rule_history(rule_id))
|
|
200
|
+
|
|
201
|
+
@command(
|
|
202
|
+
app,
|
|
203
|
+
"admin",
|
|
204
|
+
"get",
|
|
205
|
+
"playbook-preview",
|
|
206
|
+
api="GET /admin/playbook/preview",
|
|
207
|
+
help=(
|
|
208
|
+
"GET /admin/playbook/preview — the playbook block one AI surface would get "
|
|
209
|
+
"for a person (or a factory), and in excluded[] every rule read that stays "
|
|
210
|
+
"out with its reason (waiting for confirmation, paused, only for knitwear, "
|
|
211
|
+
"over budget…). --product previews a conversation about one product."
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
def playbook_preview(
|
|
215
|
+
user: str | None = typer.Option(None, "--user", "-u", help="Brand user_id."),
|
|
216
|
+
supplier: str | None = typer.Option(None, "--supplier", help="Supplier id."),
|
|
217
|
+
surface: str = typer.Option(
|
|
218
|
+
"chat_default", "--surface", help="AI surface, e.g. chat_default."
|
|
219
|
+
),
|
|
220
|
+
product: str | None = typer.Option(None, "--product", "-p", help="Product id."),
|
|
221
|
+
rule: str | None = typer.Option(
|
|
222
|
+
None, "--rule", help="Only say whether this rule is in, and if not why."
|
|
223
|
+
),
|
|
224
|
+
) -> None:
|
|
225
|
+
"""Preview a playbook block and why the other rules stay out."""
|
|
226
|
+
if not user and not supplier:
|
|
227
|
+
raise typer.BadParameter("pass --user or --supplier")
|
|
228
|
+
|
|
229
|
+
def fetch() -> Any:
|
|
230
|
+
out = api_client.admin_playbook_preview(
|
|
231
|
+
surface, user_id=user, supplier_id=supplier, product_id=product
|
|
232
|
+
)
|
|
233
|
+
if not rule:
|
|
234
|
+
return out
|
|
235
|
+
if rule in (out.get("rule_ids") or []):
|
|
236
|
+
return {"rule_id": rule, "in_prompt": True}
|
|
237
|
+
for ex in out.get("excluded") or []:
|
|
238
|
+
if ex.get("rule_id") == rule:
|
|
239
|
+
return {"rule_id": rule, "in_prompt": False, **ex}
|
|
240
|
+
return {
|
|
241
|
+
"rule_id": rule,
|
|
242
|
+
"in_prompt": False,
|
|
243
|
+
"reason": "not read: archived, or not on a scope this surface reads",
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
print_json_or_exit(console, fetch)
|
|
247
|
+
|
|
175
248
|
@command(
|
|
176
249
|
app,
|
|
177
250
|
"admin",
|
|
@@ -225,6 +298,11 @@ def register(app: typer.Typer) -> None:
|
|
|
225
298
|
force: bool = typer.Option(
|
|
226
299
|
False, "--force", help="Add even if it repeats or disagrees with an existing rule."
|
|
227
300
|
),
|
|
301
|
+
valid_until: str | None = typer.Option(
|
|
302
|
+
None,
|
|
303
|
+
"--valid-until",
|
|
304
|
+
help="YYYY-MM-DD the rule ends on (a closure, a temporary arrangement).",
|
|
305
|
+
),
|
|
228
306
|
) -> None:
|
|
229
307
|
"""Add a playbook rule for a person."""
|
|
230
308
|
body: dict[str, Any] = {"text": text, "reason": _reason(reason)}
|
|
@@ -246,6 +324,8 @@ def register(app: typer.Typer) -> None:
|
|
|
246
324
|
body["status"] = _choice(status, ("pending", "active", "muted"), "--status")
|
|
247
325
|
if force:
|
|
248
326
|
body["force"] = True
|
|
327
|
+
if valid_until is not None:
|
|
328
|
+
body["valid_until"] = _date(valid_until)
|
|
249
329
|
print_json_or_exit(console, lambda: api_client.admin_create_user_rule(user, body))
|
|
250
330
|
|
|
251
331
|
@command(
|
|
@@ -280,6 +360,11 @@ def register(app: typer.Typer) -> None:
|
|
|
280
360
|
None, "--when", help="Which products, JSON ({} for every product)."
|
|
281
361
|
),
|
|
282
362
|
mode: str | None = typer.Option(None, "--mode", help="remind or act."),
|
|
363
|
+
valid_until: str | None = typer.Option(
|
|
364
|
+
None,
|
|
365
|
+
"--valid-until",
|
|
366
|
+
help='YYYY-MM-DD the rule ends on; "none" removes the end date.',
|
|
367
|
+
),
|
|
283
368
|
) -> None:
|
|
284
369
|
"""Edit a person's playbook rule."""
|
|
285
370
|
body: dict[str, Any] = {}
|
|
@@ -293,9 +378,14 @@ def register(app: typer.Typer) -> None:
|
|
|
293
378
|
body["when"] = _when(when)
|
|
294
379
|
if mode is not None:
|
|
295
380
|
body["mode"] = _choice(mode, _MODES, "--mode")
|
|
381
|
+
if valid_until is not None:
|
|
382
|
+
body["valid_until"] = (
|
|
383
|
+
"" if valid_until.strip().lower() == "none" else _date(valid_until)
|
|
384
|
+
)
|
|
296
385
|
if not body:
|
|
297
386
|
raise typer.BadParameter(
|
|
298
|
-
"nothing to change: pass --text, --status, --applies-to, --when
|
|
387
|
+
"nothing to change: pass --text, --status, --applies-to, --when, --mode "
|
|
388
|
+
"or --valid-until"
|
|
299
389
|
)
|
|
300
390
|
body["reason"] = _reason(reason)
|
|
301
391
|
print_json_or_exit(console, lambda: api_client.admin_update_user_rule(user, rule_id, body))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: makea-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.19
|
|
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
|
|
@@ -112,10 +112,12 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
112
112
|
| `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` |
|
|
113
113
|
| `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` |
|
|
114
114
|
| `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` |
|
|
115
|
+
| `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. | — |
|
|
115
116
|
| `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
117
|
| `makea-cli admin get quote-request` | read | `GET /admin/quote_requests/{quote_request_id}` | one quote request in full. | — |
|
|
117
118
|
| `makea-cli admin get revenue-metrics` | read | `GET /admin/business-metrics/cumulative-payment-and-platform-revenue` | platform-wide payment received and platform revenue (service fee + transaction fee) bucketed over a date range. | `get-cumulative-payment-and-platform-revenue` |
|
|
118
119
|
| `makea-cli admin get rule` | read | `GET /admin/playbook/users/{user}/rules/{rule_id}` | one rule in full, with its evidence: where it came from, who changed it and why. | — |
|
|
120
|
+
| `makea-cli admin get rule-history` | read | `GET /admin/playbook/rules/{rule_id}/history` | every revision of one rule: its words, who changed it and why, and the rule that replaced it. | — |
|
|
119
121
|
| `makea-cli admin get shipping-order` | read | `GET /admin/shipping_orders/{shipping_order_id}/details` | one shipment with its production and sampling orders, freight quotes, fees, tracking and address. | — |
|
|
120
122
|
| `makea-cli admin get supplier-profile-schema` | read | `GET /admin/supplier/profile/schema` | supplier profile v2 schema (section/field taxonomy: sections, fields, options, required rules). | `get-supplier-profile-schema` |
|
|
121
123
|
| `makea-cli admin get tech-spec-extraction` | read | `GET /admin/products/{id}/extract-tech-specifications` | AI-generate specs (not saved). | `extract-ai-tech-spec` |
|
|
@@ -141,7 +143,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
141
143
|
| `makea-cli admin update library-element` | write(auto) | `PATCH /admin/designer/{user_id}/library_components/{component_id}` | update a component's name and/or values (empty value clears a field). | `library-update` |
|
|
142
144
|
| `makea-cli admin update quote` | write(ask) | `POST /admin/product/edit_supplier_link_override_info` | admin updates an existing quote (supplier link) in place. Only the options you pass are sent, and the backend leaves … | `update-supplier-quote` |
|
|
143
145
|
| `makea-cli admin update quote-request` | write(ask) | `PATCH /admin/quote_requests/{quote_request_id}/update` | set a quote request's stage, status and/or due date. Only what you pass is changed. This is the door that unblocks a … | `update-quote-request` |
|
|
144
|
-
| `makea-cli admin update rule` | write(ask) | `PATCH /admin/playbook/users/{user}/rules/{rule_id}` | change a rule's text, status, applies_to, when or
|
|
146
|
+
| `makea-cli admin update rule` | write(ask) | `PATCH /admin/playbook/users/{user}/rules/{rule_id}` | change a rule's text, status, applies_to, when, mode or end date (--valid-until). --reason required; the rule keeps what it was before. | — |
|
|
145
147
|
| `makea-cli admin update shipping-order` | write(ask) | `PUT /admin/shipping_orders/{shipping_order_id}/status` | Change a shipment: --status (PUT .../status), tracking flags (POST .../tracking), --address (PUT .../shipping-address… | — |
|
|
146
148
|
| `makea-cli admin update supplier` | write(ask) | `PUT /admin/supplier/update_supplier` | update an existing supplier from a JSON file (admin). Run `makea-cli get-supplier-profile-schema` FIRST to get the fi… | `update-supplier` |
|
|
147
149
|
| `makea-cli admin update tech-spec` | write(ask) | `POST /admin/products/{id}/technical-specifications` | persist specs from a JSON file. | `save-product-tech-spec` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
makea_cli/__init__.py,sha256=
|
|
1
|
+
makea_cli/__init__.py,sha256=VZ7jBWhGCupQczZf5QIzaN_QnESJ96jWOGwTAhYaIwY,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=yrHxKDQUov6iuXJZaMq33tyKfuoPhVg6wYLLIwt-88A,71777
|
|
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
|
|
@@ -35,7 +35,7 @@ makea_cli/commands/metrics/cmd.py,sha256=ox5OD7Bk3QJcdHQv5u4t6G-OlC6eSbQG5BEH1yB
|
|
|
35
35
|
makea_cli/commands/orders/__init__.py,sha256=6WKPqX02e0RRPmItPIBJ0TA4_yDI2PVvBDkAiMQu9rU,75
|
|
36
36
|
makea_cli/commands/orders/cmd.py,sha256=Nh5lGv5k4SIwsr_hg-ndah8eTorZCYIMpTAz4CCi6oY,13352
|
|
37
37
|
makea_cli/commands/playbook/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
-
makea_cli/commands/playbook/cmd.py,sha256=
|
|
38
|
+
makea_cli/commands/playbook/cmd.py,sha256=FMGlweV1k9XreA_p-DgMPk1br01HW1Z_sjlbn_PfDxY,16136
|
|
39
39
|
makea_cli/commands/product/__init__.py,sha256=mfdonFmpbddDSlJq6JWNWgNpM6aOpKtZr-3FJ6scrwg,76
|
|
40
40
|
makea_cli/commands/product/cmd.py,sha256=W0oVTZvsK1QWZWv2x6NC26_JQMXrO16O8gYuKYPWC08,7101
|
|
41
41
|
makea_cli/commands/production/__init__.py,sha256=Whn5ziwVMt4jzcokiFWLhWIpRLYC-ldnjZgAzeQ3We4,79
|
|
@@ -45,7 +45,7 @@ makea_cli/commands/shipping/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
45
45
|
makea_cli/commands/shipping/cmd.py,sha256=ozt73pj3onlOv0NhEwiJlslyG9WOycE0QN4tmzwFlT0,17280
|
|
46
46
|
makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNLu3ipsZ7dfs,77
|
|
47
47
|
makea_cli/commands/supplier/cmd.py,sha256=crRCy9WfhkryHMIL3iufoiT90_SG3-mKChAtdhd06uc,58076
|
|
48
|
-
makea_cli-0.2.
|
|
49
|
-
makea_cli-0.2.
|
|
50
|
-
makea_cli-0.2.
|
|
51
|
-
makea_cli-0.2.
|
|
48
|
+
makea_cli-0.2.19.dist-info/METADATA,sha256=JK9FSmxnZqtdQcCZHGH7KMrIXKZ-66Go_pGORmF4QT0,35442
|
|
49
|
+
makea_cli-0.2.19.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
50
|
+
makea_cli-0.2.19.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
|
|
51
|
+
makea_cli-0.2.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|