makea-cli 0.2.40__tar.gz → 0.2.41__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.
Files changed (92) hide show
  1. {makea_cli-0.2.40 → makea_cli-0.2.41}/CHANGELOG.md +14 -0
  2. {makea_cli-0.2.40 → makea_cli-0.2.41}/PKG-INFO +3 -2
  3. {makea_cli-0.2.40 → makea_cli-0.2.41}/README.md +2 -1
  4. makea_cli-0.2.41/makea_cli/__init__.py +1 -0
  5. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/api_client.py +5 -0
  6. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/brand/cmd.py +94 -2
  7. {makea_cli-0.2.40 → makea_cli-0.2.41}/pyproject.toml +1 -1
  8. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/golden_manifest.json +43 -1
  9. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_persona_commands.py +72 -0
  10. makea_cli-0.2.40/makea_cli/__init__.py +0 -1
  11. {makea_cli-0.2.40 → makea_cli-0.2.41}/.claude/skills/create-supplier-profile/SKILL.md +0 -0
  12. {makea_cli-0.2.40 → makea_cli-0.2.41}/.claude/skills/lark-cli-setup/SKILL.md +0 -0
  13. {makea_cli-0.2.40 → makea_cli-0.2.41}/.claude/skills/link-supplier-user/SKILL.md +0 -0
  14. {makea_cli-0.2.40 → makea_cli-0.2.41}/.claude/skills/makea-cli-setup/SKILL.md +0 -0
  15. {makea_cli-0.2.40 → makea_cli-0.2.41}/.claude/skills/payment-revenue-report/SKILL.md +0 -0
  16. {makea_cli-0.2.40 → makea_cli-0.2.41}/.claude/skills/supplier-user-id-migration/SKILL.md +0 -0
  17. {makea_cli-0.2.40 → makea_cli-0.2.41}/.gitignore +0 -0
  18. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea-collection-upload/SKILL.md +0 -0
  19. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea-collection-upload/scripts/create_products.py +0 -0
  20. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/__main__.py +0 -0
  21. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/auth_pkce.py +0 -0
  22. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/broker.py +0 -0
  23. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/__init__.py +0 -0
  24. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/_util.py +0 -0
  25. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/about/__init__.py +0 -0
  26. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/about/cmd.py +0 -0
  27. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/analytics/__init__.py +0 -0
  28. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/analytics/cmd.py +0 -0
  29. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/auth/__init__.py +0 -0
  30. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/auth/cmd.py +0 -0
  31. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/brand/__init__.py +0 -0
  32. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/closures/__init__.py +0 -0
  33. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/closures/cmd.py +0 -0
  34. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/designer/__init__.py +0 -0
  35. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/designer/cmd.py +0 -0
  36. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/directory/__init__.py +0 -0
  37. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/directory/cmd.py +0 -0
  38. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/document/__init__.py +0 -0
  39. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/document/cmd.py +0 -0
  40. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/email/__init__.py +0 -0
  41. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/email/cmd.py +0 -0
  42. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/factory/__init__.py +0 -0
  43. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/factory/cmd.py +0 -0
  44. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/files/__init__.py +0 -0
  45. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/files/cmd.py +0 -0
  46. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/flags/__init__.py +0 -0
  47. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/flags/cmd.py +0 -0
  48. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/library/__init__.py +0 -0
  49. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/library/cmd.py +0 -0
  50. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/metrics/__init__.py +0 -0
  51. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/metrics/cmd.py +0 -0
  52. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/order_flow/__init__.py +0 -0
  53. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/order_flow/cmd.py +0 -0
  54. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/orders/__init__.py +0 -0
  55. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/orders/cmd.py +0 -0
  56. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/playbook/__init__.py +0 -0
  57. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/playbook/cmd.py +0 -0
  58. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/product/__init__.py +0 -0
  59. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/product/cmd.py +0 -0
  60. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/production/__init__.py +0 -0
  61. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/production/cmd.py +0 -0
  62. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/production/pricing_spec.py +0 -0
  63. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/shiplog/__init__.py +0 -0
  64. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/shiplog/cmd.py +0 -0
  65. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/shipping/__init__.py +0 -0
  66. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/shipping/cmd.py +0 -0
  67. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/supplier/__init__.py +0 -0
  68. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/supplier/cmd.py +0 -0
  69. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/tasks/__init__.py +0 -0
  70. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/commands/tasks/cmd.py +0 -0
  71. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/companion.py +0 -0
  72. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/config.py +0 -0
  73. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/errors.py +0 -0
  74. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/file_reader.py +0 -0
  75. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/identity.py +0 -0
  76. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/main.py +0 -0
  77. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/output.py +0 -0
  78. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/posthog_client.py +0 -0
  79. {makea_cli-0.2.40 → makea_cli-0.2.41}/makea_cli/registry.py +0 -0
  80. {makea_cli-0.2.40 → makea_cli-0.2.41}/npm/makea-cli/README.md +0 -0
  81. {makea_cli-0.2.40 → makea_cli-0.2.41}/npm/makea-cli/makea-cli.mjs +0 -0
  82. {makea_cli-0.2.40 → makea_cli-0.2.41}/npm/makea-cli/package.json +0 -0
  83. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_broker.py +0 -0
  84. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_closures.py +0 -0
  85. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_companion.py +0 -0
  86. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_currency_conversion.py +0 -0
  87. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_file_reader.py +0 -0
  88. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_output_contract.py +0 -0
  89. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_pm_reads.py +0 -0
  90. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_registry.py +0 -0
  91. {makea_cli-0.2.40 → makea_cli-0.2.41}/tests/test_supplier_scorecard.py +0 -0
  92. {makea_cli-0.2.40 → makea_cli-0.2.41}/uv.lock +0 -0
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.41
4
+
5
+ A request carries where bulk ships to and the physical sample. Needs the
6
+ backend that takes `ships_to` / `physical_sample` on `/designer/product/send_rfq`.
7
+
8
+ - `designer create rfq --ships-to <address_id>`: where bulk ships to, a saved
9
+ address (or the address as JSON: street, city, postal_code, country).
10
+ `--physical-sample yes|no`: whether the brand sends the factory one. A first
11
+ send without them, when the product has neither, is refused.
12
+ - A refused send names every answer still owed, with the flag that answers it
13
+ (exit 4, `detail.missing`); the others are answered on the order's request card.
14
+ - `designer list address`: the brand's saved addresses, with the ids
15
+ `--ships-to` takes.
16
+
3
17
  ## 0.2.40
4
18
 
5
19
  Factory holidays. Needs the backend with `/admin/suppliers/{id}/closures`.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.40
3
+ Version: 0.2.41
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
@@ -223,7 +223,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
223
223
  | `makea-cli designer create pack-file` | write(auto) | `POST /designer/products/{product_id}/tech_spec/files` | put an uploaded file on a tech pack section; a pattern file (DXF, RUL, PLT) goes on Patterns when no section is named. | — |
224
224
  | `makea-cli designer create product` | write(ask) | `POST /designer/product/create_or_update_product` | payload must match manufacture/specifications (all frontend fields; categories/subcategories + collection_id in --hel… | `designer-upsert-product` |
225
225
  | `makea-cli designer create quote-award` | write(ask) | `POST /designer/quotes/group_pay_prepare` | choose the supplier quote to sample with. --quote is the supplier link id from `designer list supplier-link`; repeat … | — |
226
- | `makea-cli designer create rfq` | write(ask) | `POST /designer/product/send_rfq` | ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. | — |
226
+ | `makea-cli designer create rfq` | write(ask) | `POST /designer/product/send_rfq` | ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. A first send needs --ships-to (a saved address_id, or the address as JSON) and --physical-sample yes\|no unless the product has them; anything still owed is refused (exit 4) with each answer named. | — |
227
227
  | `makea-cli designer create sampling-order` | write(ask) | `POST /designer/sampling_orders` | order samples. --file is the full order payload (product_order_id, items, fees …); run --dry-run first and read the b… | — |
228
228
  | `makea-cli designer delete sampling-order` | write(never) | `DELETE /designer/sampling_orders/{sampling_order_id}` | delete a DRAFT sample order. The backend refuses any other status. Graded `never`. | — |
229
229
  | `makea-cli designer delete shipping-order` | write(never) | `POST /designer/shipping_orders/{shipping_order_id}/cancel` | the endpoint is called cancel but it unlinks every production order and removes the shipment, so it is a delete here.… | — |
@@ -239,6 +239,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
239
239
  | `makea-cli designer get tech-pack-history` | read | `GET /designer/products/{product_id}/specification-change-history` | who changed which spec field, when, and from what. | — |
240
240
  | `makea-cli designer list action` | read | `GET /designer/actions` | the pending actions on you, optionally for one product. An action is closed by the fact it asks for, not by acknowled… | — |
241
241
  | `makea-cli designer list channel` | read | `GET /designer/products/{product_id}/channels` | the product's conversation channels. | — |
242
+ | `makea-cli designer list address` | read | `GET /designer/address-book` | the brand's saved addresses; each shipping address_id is what `designer create rfq --ships-to` takes. | — |
242
243
  | `makea-cli designer list collection` | read | `GET /designer/collections` | the brand's collections. | — |
243
244
  | `makea-cli designer list library-element` | read | `GET /designer/library_components` | the brand's own shelf (fabrics, trims, colours, artwork); --section narrows to one kind. | — |
244
245
  | `makea-cli designer list payment` | read | `GET /designer/payments` | your charges and whether they are paid. | — |
@@ -207,7 +207,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
207
207
  | `makea-cli designer create pack-file` | write(auto) | `POST /designer/products/{product_id}/tech_spec/files` | put an uploaded file on a tech pack section; a pattern file (DXF, RUL, PLT) goes on Patterns when no section is named. | — |
208
208
  | `makea-cli designer create product` | write(ask) | `POST /designer/product/create_or_update_product` | payload must match manufacture/specifications (all frontend fields; categories/subcategories + collection_id in --hel… | `designer-upsert-product` |
209
209
  | `makea-cli designer create quote-award` | write(ask) | `POST /designer/quotes/group_pay_prepare` | choose the supplier quote to sample with. --quote is the supplier link id from `designer list supplier-link`; repeat … | — |
210
- | `makea-cli designer create rfq` | write(ask) | `POST /designer/product/send_rfq` | ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. | — |
210
+ | `makea-cli designer create rfq` | write(ask) | `POST /designer/product/send_rfq` | ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. A first send needs --ships-to (a saved address_id, or the address as JSON) and --physical-sample yes\|no unless the product has them; anything still owed is refused (exit 4) with each answer named. | — |
211
211
  | `makea-cli designer create sampling-order` | write(ask) | `POST /designer/sampling_orders` | order samples. --file is the full order payload (product_order_id, items, fees …); run --dry-run first and read the b… | — |
212
212
  | `makea-cli designer delete sampling-order` | write(never) | `DELETE /designer/sampling_orders/{sampling_order_id}` | delete a DRAFT sample order. The backend refuses any other status. Graded `never`. | — |
213
213
  | `makea-cli designer delete shipping-order` | write(never) | `POST /designer/shipping_orders/{shipping_order_id}/cancel` | the endpoint is called cancel but it unlinks every production order and removes the shipment, so it is a delete here.… | — |
@@ -223,6 +223,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
223
223
  | `makea-cli designer get tech-pack-history` | read | `GET /designer/products/{product_id}/specification-change-history` | who changed which spec field, when, and from what. | — |
224
224
  | `makea-cli designer list action` | read | `GET /designer/actions` | the pending actions on you, optionally for one product. An action is closed by the fact it asks for, not by acknowled… | — |
225
225
  | `makea-cli designer list channel` | read | `GET /designer/products/{product_id}/channels` | the product's conversation channels. | — |
226
+ | `makea-cli designer list address` | read | `GET /designer/address-book` | the brand's saved addresses; each shipping address_id is what `designer create rfq --ships-to` takes. | — |
226
227
  | `makea-cli designer list collection` | read | `GET /designer/collections` | the brand's collections. | — |
227
228
  | `makea-cli designer list library-element` | read | `GET /designer/library_components` | the brand's own shelf (fabrics, trims, colours, artwork); --section narrows to one kind. | — |
228
229
  | `makea-cli designer list payment` | read | `GET /designer/payments` | your charges and whether they are paid. | — |
@@ -0,0 +1 @@
1
+ __version__ = "0.2.41"
@@ -1960,6 +1960,11 @@ def designer_list_tasks() -> Any:
1960
1960
  return get_json("/designer/tasks")
1961
1961
 
1962
1962
 
1963
+ def designer_get_address_book() -> Any:
1964
+ """GET /designer/address-book — the brand's saved addresses (ids for --ships-to)."""
1965
+ return get_json("/designer/address-book")
1966
+
1967
+
1963
1968
  def designer_list_payments() -> Any:
1964
1969
  """GET /designer/payments — the brand's charges and their state."""
1965
1970
  return get_json("/designer/payments")
@@ -21,8 +21,56 @@ from rich.console import Console
21
21
 
22
22
  from makea_cli import api_client
23
23
  from makea_cli.commands._util import print_json_or_exit
24
+ from makea_cli.errors import ApiError
24
25
  from makea_cli.registry import command
25
26
 
27
+ # What `designer create rfq` can answer itself when the server says the
28
+ # request still owes it (TECH-232); the rest is answered on the order page.
29
+ RFQ_FLAGS = {
30
+ "Ships to": "--ships-to",
31
+ "Physical sample": "--physical-sample",
32
+ }
33
+
34
+
35
+ def _ships_to_value(raw: str) -> Any:
36
+ """A saved address id, or the address as a JSON object."""
37
+ text = raw.strip()
38
+ if not text.startswith("{"):
39
+ return text
40
+ try:
41
+ value = json.loads(text)
42
+ except json.JSONDecodeError as e:
43
+ raise typer.BadParameter(f"--ships-to is not valid JSON: {e}") from e
44
+ if not isinstance(value, dict):
45
+ raise typer.BadParameter("--ships-to JSON must be an object")
46
+ return value
47
+
48
+
49
+ def _yes_no(raw: str, flag: str) -> bool:
50
+ word = raw.strip().lower()
51
+ if word in ("yes", "y", "true"):
52
+ return True
53
+ if word in ("no", "n", "false"):
54
+ return False
55
+ raise typer.BadParameter(f"{flag} is yes or no")
56
+
57
+
58
+ def _owed_error(e: ApiError) -> ApiError:
59
+ """The server's RFQ_INCOMPLETE, said as what to answer and how."""
60
+ detail = e.detail if isinstance(e.detail, dict) else {}
61
+ if detail.get("code") != "RFQ_INCOMPLETE":
62
+ return e
63
+ missing = [str(m) for m in detail.get("missing") or []]
64
+ named = [f"{m} ({RFQ_FLAGS[m]})" if m in RFQ_FLAGS else m for m in missing]
65
+ message = "The request can't go yet. Still to answer: " + ", ".join(named) + "."
66
+ if any(m not in RFQ_FLAGS for m in missing):
67
+ message += " The others are answered on the order's request card."
68
+ out = ApiError(e.status, {**detail, "missing": missing}, method=e.method, path=e.path)
69
+ out.message = message
70
+ out.args = (message,)
71
+ return out
72
+
73
+
26
74
  console = Console()
27
75
 
28
76
 
@@ -458,6 +506,21 @@ def register(app: typer.Typer) -> None:
458
506
  """List the brand's payments."""
459
507
  print_json_or_exit(console, lambda: api_client.designer_list_payments())
460
508
 
509
+ @command(
510
+ app,
511
+ "designer",
512
+ "list",
513
+ "address",
514
+ api="GET /designer/address-book",
515
+ help=(
516
+ "GET /designer/address-book — the brand's saved addresses. Each shipping "
517
+ "address_id is what `designer create rfq --ships-to` takes."
518
+ ),
519
+ )
520
+ def list_addresses() -> None:
521
+ """List the brand's saved addresses."""
522
+ print_json_or_exit(console, lambda: api_client.designer_get_address_book())
523
+
461
524
  @command(
462
525
  app,
463
526
  "designer",
@@ -1149,7 +1212,12 @@ def register(app: typer.Typer) -> None:
1149
1212
  approval="ask",
1150
1213
  help=(
1151
1214
  "POST /designer/product/send_rfq — ask the chosen suppliers to quote on a product. "
1152
- "--supplier repeats; --makea-sourcing also asks Makea to source."
1215
+ "--supplier repeats; --makea-sourcing also asks Makea to source. A first send "
1216
+ "needs where bulk ships to and whether a physical sample comes: pass "
1217
+ "--ships-to (a saved address_id from `designer list address`, or the address as "
1218
+ 'JSON: \'{"street": "...", "city": "...", "postal_code": "...", "country": "..."}\') '
1219
+ "and --physical-sample yes|no, unless the product already has them. Anything "
1220
+ "still owed is refused (exit 4) with each answer named."
1153
1221
  ),
1154
1222
  )
1155
1223
  def create_rfq(
@@ -1163,6 +1231,19 @@ def register(app: typer.Typer) -> None:
1163
1231
  makea_sourcing: bool = typer.Option(
1164
1232
  False, "--makea-sourcing", help="Also ask Makea to source suppliers."
1165
1233
  ),
1234
+ ships_to: str | None = typer.Option(
1235
+ None,
1236
+ "--ships-to",
1237
+ help=(
1238
+ "Where bulk ships to: a saved address_id (`designer list address`), or "
1239
+ "the address as a JSON object with street, city, postal_code, country."
1240
+ ),
1241
+ ),
1242
+ physical_sample: str | None = typer.Option(
1243
+ None,
1244
+ "--physical-sample",
1245
+ help="yes: the brand sends the factory a physical sample; no: the tech pack is enough.",
1246
+ ),
1166
1247
  ) -> None:
1167
1248
  """Send an RFQ."""
1168
1249
  if not supplier and not makea_sourcing:
@@ -1172,7 +1253,18 @@ def register(app: typer.Typer) -> None:
1172
1253
  body["production_types"] = list(production_type)
1173
1254
  if makea_sourcing:
1174
1255
  body["makea_sourcing"] = True
1175
- print_json_or_exit(console, lambda: api_client.designer_send_rfq(body))
1256
+ if ships_to:
1257
+ body["ships_to"] = _ships_to_value(ships_to)
1258
+ if physical_sample is not None:
1259
+ body["physical_sample"] = _yes_no(physical_sample, "--physical-sample")
1260
+
1261
+ def send() -> Any:
1262
+ try:
1263
+ return api_client.designer_send_rfq(body)
1264
+ except ApiError as e:
1265
+ raise _owed_error(e) from e
1266
+
1267
+ print_json_or_exit(console, send)
1176
1268
 
1177
1269
  # --- the sampling journey: confirm the pack, award a quote, pay -------------
1178
1270
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "makea-cli"
7
- version = "0.2.40"
7
+ version = "0.2.41"
8
8
  description = "Makea admin CLI (browser login + Makea admin HTTP API)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -10775,7 +10775,7 @@
10775
10775
  "idempotent": null,
10776
10776
  "limit": null,
10777
10777
  "legacy": [],
10778
- "help": "POST /designer/product/send_rfq — ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source.",
10778
+ "help": "POST /designer/product/send_rfq — ask the chosen suppliers to quote on a product. --supplier repeats; --makea-sourcing also asks Makea to source. A first send needs where bulk ships to and whether a physical sample comes: pass --ships-to (a saved address_id from `designer list address`, or the address as JSON: '{\"street\": \"...\", \"city\": \"...\", \"postal_code\": \"...\", \"country\": \"...\"}') and --physical-sample yes|no, unless the product already has them. Anything still owed is refused (exit 4) with each answer named.",
10779
10779
  "function": "makea_cli.commands.brand.cmd.register.<locals>.create_rfq",
10780
10780
  "flags": [
10781
10781
  {
@@ -10826,6 +10826,30 @@
10826
10826
  "multiple": false,
10827
10827
  "default": false,
10828
10828
  "help": "Also ask Makea to source suppliers."
10829
+ },
10830
+ {
10831
+ "name": "ships_to",
10832
+ "kind": "option",
10833
+ "opts": [
10834
+ "--ships-to"
10835
+ ],
10836
+ "type": "text",
10837
+ "required": false,
10838
+ "multiple": false,
10839
+ "default": null,
10840
+ "help": "Where bulk ships to: a saved address_id (`designer list address`), or the address as a JSON object with street, city, postal_code, country."
10841
+ },
10842
+ {
10843
+ "name": "physical_sample",
10844
+ "kind": "option",
10845
+ "opts": [
10846
+ "--physical-sample"
10847
+ ],
10848
+ "type": "text",
10849
+ "required": false,
10850
+ "multiple": false,
10851
+ "default": null,
10852
+ "help": "yes: the brand sends the factory a physical sample; no: the tech pack is enough."
10829
10853
  }
10830
10854
  ]
10831
10855
  },
@@ -11586,6 +11610,24 @@
11586
11610
  }
11587
11611
  ]
11588
11612
  },
11613
+ {
11614
+ "name": "designer list address",
11615
+ "persona": "designer",
11616
+ "verb": "list",
11617
+ "noun": "address",
11618
+ "access": "read",
11619
+ "api": "GET /designer/address-book",
11620
+ "external": null,
11621
+ "side_effects": [],
11622
+ "approval": "auto",
11623
+ "reversible": null,
11624
+ "idempotent": null,
11625
+ "limit": "client",
11626
+ "legacy": [],
11627
+ "help": "GET /designer/address-book — the brand's saved addresses. Each shipping address_id is what `designer create rfq --ships-to` takes.",
11628
+ "function": "makea_cli.commands.brand.cmd.register.<locals>.list_addresses",
11629
+ "flags": []
11630
+ },
11589
11631
  {
11590
11632
  "name": "designer list channel",
11591
11633
  "persona": "designer",
@@ -159,6 +159,78 @@ class DesignerCommandTests(_PersonaCase):
159
159
  self.run_cli("designer", "create", "rfq", "p-1", "-s", "a", "-s", "b")
160
160
  self.assertEqual(self.rec.last["body"]["supplier_ids"], ["a", "b"])
161
161
 
162
+ def test_rfq_carries_ships_to_and_physical_sample(self):
163
+ self.run_cli(
164
+ "designer",
165
+ "create",
166
+ "rfq",
167
+ "p-1",
168
+ "-s",
169
+ "a",
170
+ "--ships-to",
171
+ "addr1",
172
+ "--physical-sample",
173
+ "no",
174
+ )
175
+ body = self.rec.last["body"]
176
+ self.assertEqual((body["ships_to"], body["physical_sample"]), ("addr1", False))
177
+ self.run_cli(
178
+ "designer",
179
+ "create",
180
+ "rfq",
181
+ "p-1",
182
+ "-s",
183
+ "a",
184
+ "--ships-to",
185
+ '{"street": "8 Dock Lane", "city": "Leeds", "country": "UK"}',
186
+ )
187
+ self.assertEqual(self.rec.last["body"]["ships_to"]["city"], "Leeds")
188
+ self.assertNotIn("physical_sample", self.rec.last["body"])
189
+
190
+ def test_rfq_bad_answers_are_usage_errors(self):
191
+ result = self.runner.invoke(
192
+ self.cli, ["designer", "create", "rfq", "p-1", "-s", "a", "--physical-sample", "maybe"]
193
+ )
194
+ self.assertEqual(result.exit_code, 2)
195
+ result = self.runner.invoke(
196
+ self.cli, ["designer", "create", "rfq", "p-1", "-s", "a", "--ships-to", "{nope"]
197
+ )
198
+ self.assertEqual(result.exit_code, 2)
199
+ self.assertEqual(self.rec.calls, [])
200
+
201
+ def test_rfq_owed_answers_are_named_with_their_flags(self):
202
+ from makea_cli.errors import ApiError
203
+
204
+ def refuse(method, path, **kw):
205
+ raise ApiError(
206
+ 400,
207
+ {
208
+ "success": False,
209
+ "code": "RFQ_INCOMPLETE",
210
+ "error": "The request can't go yet. Still to answer: Sizes, Ships to.",
211
+ "missing": ["Sizes", "Ships to"],
212
+ },
213
+ method=method,
214
+ path=path,
215
+ )
216
+
217
+ with mock.patch.object(api_client, "_request", refuse):
218
+ result = self.runner.invoke(
219
+ self.cli, ["designer", "create", "rfq", "p-1", "-s", "a", "--json"]
220
+ )
221
+ self.assertEqual(result.exit_code, 4)
222
+ err = json.loads(
223
+ result.stderr if hasattr(result, "stderr") and result.stderr else result.output
224
+ )
225
+ self.assertIn("Ships to (--ships-to)", err["message"])
226
+ self.assertIn("Sizes", err["message"])
227
+ self.assertIn("order's request card", err["message"])
228
+ self.assertEqual(err["detail"]["missing"], ["Sizes", "Ships to"])
229
+
230
+ def test_list_address_reads_the_address_book(self):
231
+ self.run_cli("designer", "list", "address")
232
+ self.assertEqual(self.rec.last["path"], "/designer/address-book")
233
+
162
234
  def test_search_note_sends_the_query_and_optional_channel(self):
163
235
  self.run_cli("designer", "search", "note", "zipper", "--product", "p-1", "-c", "supplier")
164
236
  self.assertEqual(self.rec.last["path"], "/designer/products/p-1/channel_search")
@@ -1 +0,0 @@
1
- __version__ = "0.2.40"
File without changes
File without changes
File without changes