makea-cli 0.2.17__py3-none-any.whl → 0.2.18__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 CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.17"
1
+ __version__ = "0.2.18"
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
 
@@ -172,6 +172,71 @@ def register(app: typer.Typer) -> None:
172
172
  """Show one playbook rule with its evidence."""
173
173
  print_json_or_exit(console, lambda: api_client.admin_get_user_rule(user, rule_id))
174
174
 
175
+ @command(
176
+ app,
177
+ "admin",
178
+ "get",
179
+ "rule-history",
180
+ api="GET /admin/playbook/rules/{rule_id}/history",
181
+ help=(
182
+ "GET /admin/playbook/rules/{rule_id}/history — every revision of one rule: "
183
+ "its words, who changed it and why; superseded_chain leads to the rule "
184
+ "that holds now when this one was replaced."
185
+ ),
186
+ )
187
+ def get_rule_history(
188
+ rule_id: str = typer.Argument(..., help="Rule id (rul_…)."),
189
+ ) -> None:
190
+ """Show what a playbook rule said at each point, and what replaced it."""
191
+ print_json_or_exit(console, lambda: api_client.admin_get_rule_history(rule_id))
192
+
193
+ @command(
194
+ app,
195
+ "admin",
196
+ "get",
197
+ "playbook-preview",
198
+ api="GET /admin/playbook/preview",
199
+ help=(
200
+ "GET /admin/playbook/preview — the playbook block one AI surface would get "
201
+ "for a person (or a factory), and in excluded[] every rule read that stays "
202
+ "out with its reason (waiting for confirmation, paused, only for knitwear, "
203
+ "over budget…). --product previews a conversation about one product."
204
+ ),
205
+ )
206
+ def playbook_preview(
207
+ user: str | None = typer.Option(None, "--user", "-u", help="Brand user_id."),
208
+ supplier: str | None = typer.Option(None, "--supplier", help="Supplier id."),
209
+ surface: str = typer.Option(
210
+ "chat_default", "--surface", help="AI surface, e.g. chat_default."
211
+ ),
212
+ product: str | None = typer.Option(None, "--product", "-p", help="Product id."),
213
+ rule: str | None = typer.Option(
214
+ None, "--rule", help="Only say whether this rule is in, and if not why."
215
+ ),
216
+ ) -> None:
217
+ """Preview a playbook block and why the other rules stay out."""
218
+ if not user and not supplier:
219
+ raise typer.BadParameter("pass --user or --supplier")
220
+
221
+ def fetch() -> Any:
222
+ out = api_client.admin_playbook_preview(
223
+ surface, user_id=user, supplier_id=supplier, product_id=product
224
+ )
225
+ if not rule:
226
+ return out
227
+ if rule in (out.get("rule_ids") or []):
228
+ return {"rule_id": rule, "in_prompt": True}
229
+ for ex in out.get("excluded") or []:
230
+ if ex.get("rule_id") == rule:
231
+ return {"rule_id": rule, "in_prompt": False, **ex}
232
+ return {
233
+ "rule_id": rule,
234
+ "in_prompt": False,
235
+ "reason": "not read: archived, or not on a scope this surface reads",
236
+ }
237
+
238
+ print_json_or_exit(console, fetch)
239
+
175
240
  @command(
176
241
  app,
177
242
  "admin",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.17
3
+ Version: 0.2.18
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` |
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=Qi17SZ8BBtfJyUgJ1-dmlKGJmEwoMRO4CvqGYPFRAhw,23
1
+ makea_cli/__init__.py,sha256=3RGPra41WobAbWeoPRqR_JXeysqFvK3H3AP1g9gjj3g,23
2
2
  makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
3
- makea_cli/api_client.py,sha256=sPJ_YmfzlpyOi8HL95pDEnQin_eZIN00Yc9LD4fj4XE,70913
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=ktSn3Fx1i6GN4eGeqp4nW0OJ85oduIa3J10mDNRPRMo,12548
38
+ makea_cli/commands/playbook/cmd.py,sha256=lXKY6PQ6oLkHFHwghsPUKXtdT2bDLTtLl7Wgg8vhXtE,15237
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.17.dist-info/METADATA,sha256=aubC1OdePkFzgJBiKYJPPEk1-wtjC7jwfckx2JA4OgU,34938
49
- makea_cli-0.2.17.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
50
- makea_cli-0.2.17.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
51
- makea_cli-0.2.17.dist-info/RECORD,,
48
+ makea_cli-0.2.18.dist-info/METADATA,sha256=OagrYvbHIf9KWYTBUIPm0TXVlhJA4-WeBrIhY9WueCw,35416
49
+ makea_cli-0.2.18.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
50
+ makea_cli-0.2.18.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
51
+ makea_cli-0.2.18.dist-info/RECORD,,