makea-cli 0.2.17__tar.gz → 0.2.18__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.17 → makea_cli-0.2.18}/CHANGELOG.md +13 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/PKG-INFO +3 -1
- {makea_cli-0.2.17 → makea_cli-0.2.18}/README.md +2 -0
- makea_cli-0.2.18/makea_cli/__init__.py +1 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/api_client.py +25 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/playbook/cmd.py +65 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/pyproject.toml +1 -1
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/golden_manifest.json +112 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_persona_commands.py +29 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/uv.lock +1 -1
- makea_cli-0.2.17/makea_cli/__init__.py +0 -1
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.claude/skills/create-supplier-profile/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.claude/skills/lark-cli-setup/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.claude/skills/link-supplier-user/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.claude/skills/makea-cli-setup/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.claude/skills/payment-revenue-report/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.claude/skills/supplier-user-id-migration/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/.gitignore +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea-collection-upload/SKILL.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea-collection-upload/scripts/create_products.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/__main__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/auth_pkce.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/broker.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/_util.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/analytics/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/analytics/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/auth/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/auth/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/brand/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/brand/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/designer/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/designer/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/directory/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/directory/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/document/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/document/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/email/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/email/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/factory/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/factory/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/library/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/library/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/metrics/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/metrics/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/orders/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/orders/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/playbook/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/product/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/product/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/production/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/production/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/production/pricing_spec.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/shipping/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/shipping/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/supplier/__init__.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/commands/supplier/cmd.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/config.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/errors.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/identity.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/main.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/output.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/posthog_client.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/makea_cli/registry.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/npm/makea-cli/README.md +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/npm/makea-cli/makea-cli.mjs +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/npm/makea-cli/package.json +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_broker.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_currency_conversion.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_output_contract.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_pm_reads.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_registry.py +0 -0
- {makea_cli-0.2.17 → makea_cli-0.2.18}/tests/test_supplier_scorecard.py +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.18
|
|
4
|
+
|
|
5
|
+
New: see why a playbook rule did not reach Beeboo, and what a rule said
|
|
6
|
+
before. Both need the backend's playbook trace and revisions (ca0469d1).
|
|
7
|
+
|
|
8
|
+
- `admin get playbook-preview -u <user> [--product <id>] [--surface …]`: the
|
|
9
|
+
block one AI surface would get, and in `excluded[]` every rule read that
|
|
10
|
+
stays out with its reason (waiting for the brand, paused, only for other
|
|
11
|
+
product types, narrowed to another factory, over budget…). `--rule <id>`
|
|
12
|
+
answers for one rule only; `--supplier` previews a factory's playbook.
|
|
13
|
+
- `admin get rule-history <rule_id>`: every revision of one rule, with who
|
|
14
|
+
changed it and why, and `superseded_chain` to the rule that replaced it.
|
|
15
|
+
|
|
3
16
|
## 0.2.17
|
|
4
17
|
|
|
5
18
|
New: an admin can make and run shipping orders from the CLI. `create
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: makea-cli
|
|
3
|
-
Version: 0.2.
|
|
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` |
|
|
@@ -100,10 +100,12 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
|
|
|
100
100
|
| `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` |
|
|
101
101
|
| `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` |
|
|
102
102
|
| `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` |
|
|
103
|
+
| `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. | — |
|
|
103
104
|
| `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` |
|
|
104
105
|
| `makea-cli admin get quote-request` | read | `GET /admin/quote_requests/{quote_request_id}` | one quote request in full. | — |
|
|
105
106
|
| `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` |
|
|
106
107
|
| `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. | — |
|
|
108
|
+
| `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. | — |
|
|
107
109
|
| `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. | — |
|
|
108
110
|
| `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` |
|
|
109
111
|
| `makea-cli admin get tech-spec-extraction` | read | `GET /admin/products/{id}/extract-tech-specifications` | AI-generate specs (not saved). | `extract-ai-tech-spec` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.18"
|
|
@@ -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",
|
|
@@ -1858,6 +1858,87 @@
|
|
|
1858
1858
|
}
|
|
1859
1859
|
]
|
|
1860
1860
|
},
|
|
1861
|
+
{
|
|
1862
|
+
"name": "admin get playbook-preview",
|
|
1863
|
+
"persona": "admin",
|
|
1864
|
+
"verb": "get",
|
|
1865
|
+
"noun": "playbook-preview",
|
|
1866
|
+
"access": "read",
|
|
1867
|
+
"api": "GET /admin/playbook/preview",
|
|
1868
|
+
"external": null,
|
|
1869
|
+
"side_effects": [],
|
|
1870
|
+
"approval": "auto",
|
|
1871
|
+
"reversible": null,
|
|
1872
|
+
"idempotent": null,
|
|
1873
|
+
"limit": null,
|
|
1874
|
+
"legacy": [],
|
|
1875
|
+
"help": "GET /admin/playbook/preview — the playbook block one AI surface would get for a person (or a factory), and in excluded[] every rule read that stays out with its reason (waiting for confirmation, paused, only for knitwear, over budget…). --product previews a conversation about one product.",
|
|
1876
|
+
"function": "makea_cli.commands.playbook.cmd.register.<locals>.playbook_preview",
|
|
1877
|
+
"flags": [
|
|
1878
|
+
{
|
|
1879
|
+
"name": "user",
|
|
1880
|
+
"kind": "option",
|
|
1881
|
+
"opts": [
|
|
1882
|
+
"--user",
|
|
1883
|
+
"-u"
|
|
1884
|
+
],
|
|
1885
|
+
"type": "text",
|
|
1886
|
+
"required": false,
|
|
1887
|
+
"multiple": false,
|
|
1888
|
+
"default": null,
|
|
1889
|
+
"help": "Brand user_id."
|
|
1890
|
+
},
|
|
1891
|
+
{
|
|
1892
|
+
"name": "supplier",
|
|
1893
|
+
"kind": "option",
|
|
1894
|
+
"opts": [
|
|
1895
|
+
"--supplier"
|
|
1896
|
+
],
|
|
1897
|
+
"type": "text",
|
|
1898
|
+
"required": false,
|
|
1899
|
+
"multiple": false,
|
|
1900
|
+
"default": null,
|
|
1901
|
+
"help": "Supplier id."
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
"name": "surface",
|
|
1905
|
+
"kind": "option",
|
|
1906
|
+
"opts": [
|
|
1907
|
+
"--surface"
|
|
1908
|
+
],
|
|
1909
|
+
"type": "text",
|
|
1910
|
+
"required": false,
|
|
1911
|
+
"multiple": false,
|
|
1912
|
+
"default": "chat_default",
|
|
1913
|
+
"help": "AI surface, e.g. chat_default."
|
|
1914
|
+
},
|
|
1915
|
+
{
|
|
1916
|
+
"name": "product",
|
|
1917
|
+
"kind": "option",
|
|
1918
|
+
"opts": [
|
|
1919
|
+
"--product",
|
|
1920
|
+
"-p"
|
|
1921
|
+
],
|
|
1922
|
+
"type": "text",
|
|
1923
|
+
"required": false,
|
|
1924
|
+
"multiple": false,
|
|
1925
|
+
"default": null,
|
|
1926
|
+
"help": "Product id."
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
"name": "rule",
|
|
1930
|
+
"kind": "option",
|
|
1931
|
+
"opts": [
|
|
1932
|
+
"--rule"
|
|
1933
|
+
],
|
|
1934
|
+
"type": "text",
|
|
1935
|
+
"required": false,
|
|
1936
|
+
"multiple": false,
|
|
1937
|
+
"default": null,
|
|
1938
|
+
"help": "Only say whether this rule is in, and if not why."
|
|
1939
|
+
}
|
|
1940
|
+
]
|
|
1941
|
+
},
|
|
1861
1942
|
{
|
|
1862
1943
|
"name": "admin get production-pricing",
|
|
1863
1944
|
"persona": "admin",
|
|
@@ -2062,6 +2143,37 @@
|
|
|
2062
2143
|
}
|
|
2063
2144
|
]
|
|
2064
2145
|
},
|
|
2146
|
+
{
|
|
2147
|
+
"name": "admin get rule-history",
|
|
2148
|
+
"persona": "admin",
|
|
2149
|
+
"verb": "get",
|
|
2150
|
+
"noun": "rule-history",
|
|
2151
|
+
"access": "read",
|
|
2152
|
+
"api": "GET /admin/playbook/rules/{rule_id}/history",
|
|
2153
|
+
"external": null,
|
|
2154
|
+
"side_effects": [],
|
|
2155
|
+
"approval": "auto",
|
|
2156
|
+
"reversible": null,
|
|
2157
|
+
"idempotent": null,
|
|
2158
|
+
"limit": null,
|
|
2159
|
+
"legacy": [],
|
|
2160
|
+
"help": "GET /admin/playbook/rules/{rule_id}/history — every revision of one rule: its words, who changed it and why; superseded_chain leads to the rule that holds now when this one was replaced.",
|
|
2161
|
+
"function": "makea_cli.commands.playbook.cmd.register.<locals>.get_rule_history",
|
|
2162
|
+
"flags": [
|
|
2163
|
+
{
|
|
2164
|
+
"name": "rule_id",
|
|
2165
|
+
"kind": "argument",
|
|
2166
|
+
"opts": [
|
|
2167
|
+
"rule_id"
|
|
2168
|
+
],
|
|
2169
|
+
"type": "text",
|
|
2170
|
+
"required": true,
|
|
2171
|
+
"multiple": false,
|
|
2172
|
+
"default": null,
|
|
2173
|
+
"help": "Rule id (rul_…)."
|
|
2174
|
+
}
|
|
2175
|
+
]
|
|
2176
|
+
},
|
|
2065
2177
|
{
|
|
2066
2178
|
"name": "admin get shipping-order",
|
|
2067
2179
|
"persona": "admin",
|
|
@@ -429,6 +429,35 @@ class PlaybookRuleCommandTests(_PersonaCase):
|
|
|
429
429
|
("GET", "/admin/playbook/users/u1/rules/rul_1"),
|
|
430
430
|
)
|
|
431
431
|
|
|
432
|
+
def test_history_reads_one_rule_by_id(self):
|
|
433
|
+
self.run_cli("admin", "get", "rule-history", "rul_1")
|
|
434
|
+
self.assertEqual(
|
|
435
|
+
(self.rec.last["method"], self.rec.last["path"]),
|
|
436
|
+
("GET", "/admin/playbook/rules/rul_1/history"),
|
|
437
|
+
)
|
|
438
|
+
|
|
439
|
+
def test_preview_passes_the_conversation(self):
|
|
440
|
+
self.run_cli(
|
|
441
|
+
"admin", "get", "playbook-preview", "-u", "u1", "--product", "p1",
|
|
442
|
+
"--surface", "chat_tech_pack_builder",
|
|
443
|
+
) # fmt: skip
|
|
444
|
+
self.assertEqual(self.rec.last["path"], "/admin/playbook/preview")
|
|
445
|
+
self.assertEqual(
|
|
446
|
+
self.rec.last["params"],
|
|
447
|
+
{"surface": "chat_tech_pack_builder", "user_id": "u1", "product_id": "p1"},
|
|
448
|
+
)
|
|
449
|
+
self.run_cli("admin", "get", "playbook-preview", expect=2)
|
|
450
|
+
|
|
451
|
+
def test_preview_answers_for_one_rule(self):
|
|
452
|
+
self.rec.payload = {
|
|
453
|
+
"success": True,
|
|
454
|
+
"rule_ids": ["rul_in"],
|
|
455
|
+
"excluded": [{"rule_id": "rul_out", "reason": "pending", "label": "Waiting"}],
|
|
456
|
+
}
|
|
457
|
+
out = self.run_cli("admin", "get", "playbook-preview", "-u", "u1", "--rule", "rul_out")
|
|
458
|
+
self.assertIn('"in_prompt": false', out.output)
|
|
459
|
+
self.assertIn('"reason": "pending"', out.output)
|
|
460
|
+
|
|
432
461
|
def test_create_builds_the_body(self):
|
|
433
462
|
self.run_cli(
|
|
434
463
|
"admin", "create", "rule", "--user", "u1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.17"
|
|
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
|