makea-cli 0.2.1__py3-none-any.whl → 0.2.2__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.1"
1
+ __version__ = "0.2.2"
makea_cli/api_client.py CHANGED
@@ -1312,3 +1312,49 @@ def designer_list_actions(*, product_id: str | None = None) -> Any:
1312
1312
  def supplier_list_tasks() -> Any:
1313
1313
  """GET /supplier/tasks — the factory's onboarding and per-order to-dos."""
1314
1314
  return get_json("/supplier/tasks")
1315
+
1316
+
1317
+ # --- order lifecycle (designer). Tiered on purpose: see the commands' approval
1318
+ # --- grades -- submit/confirm ask a person, cancel/delete are never automatic,
1319
+ # --- and nothing here moves money. Payments and subscriptions are deliberately
1320
+ # --- absent from the CLI: an agent should not have a path to a charge.
1321
+
1322
+
1323
+ def designer_confirm_sampling_order(sampling_order_id: str) -> Any:
1324
+ """POST /designer/sampling_orders/{id}/confirm — the brand confirms the sample order."""
1325
+ return post_json(f"/designer/sampling_orders/{sampling_order_id}/confirm", {})
1326
+
1327
+
1328
+ def designer_cancel_sampling_order(sampling_order_id: str) -> Any:
1329
+ """POST /designer/sampling_orders/{id}/cancel — cancel it."""
1330
+ return post_json(f"/designer/sampling_orders/{sampling_order_id}/cancel", {})
1331
+
1332
+
1333
+ def designer_delete_sampling_order(sampling_order_id: str) -> Any:
1334
+ """DELETE /designer/sampling_orders/{id} — DRAFT only; the backend refuses anything else."""
1335
+ return delete_json(f"/designer/sampling_orders/{sampling_order_id}")
1336
+
1337
+
1338
+ def designer_submit_production_order(production_order_id: str) -> Any:
1339
+ """POST /designer/production_orders/{id}/submit — hand the bulk order to the supplier."""
1340
+ return post_json(f"/designer/production_orders/{production_order_id}/submit", {})
1341
+
1342
+
1343
+ def designer_complete_production_order(production_order_id: str) -> Any:
1344
+ """POST /designer/production_orders/{id}/complete — the brand marks the bulk order done."""
1345
+ return post_json(f"/designer/production_orders/{production_order_id}/complete", {})
1346
+
1347
+
1348
+ def designer_update_production_order(production_order_id: str, body: dict[str, Any]) -> Any:
1349
+ """PUT /designer/production_orders/{id} — re-pick which supplier links the order covers."""
1350
+ return put_json(f"/designer/production_orders/{production_order_id}", body, timeout=120.0)
1351
+
1352
+
1353
+ def designer_confirm_receive_shipping_order(shipping_order_id: str) -> Any:
1354
+ """POST /designer/shipping_orders/{id}/confirm_receive — IN_TRANSIT only."""
1355
+ return post_json(f"/designer/shipping_orders/{shipping_order_id}/confirm_receive", {})
1356
+
1357
+
1358
+ def designer_cancel_shipping_order(shipping_order_id: str) -> Any:
1359
+ """POST /designer/shipping_orders/{id}/cancel — unlinks every production order, then deletes it."""
1360
+ return post_json(f"/designer/shipping_orders/{shipping_order_id}/cancel", {})
@@ -562,6 +562,197 @@ def register(app: typer.Typer) -> None:
562
562
  body["channel_key"] = channel
563
563
  print_json_or_exit(console, lambda: api_client.designer_add_product_note(product_id, body))
564
564
 
565
+ # --- order lifecycle ---------------------------------------------------------
566
+ #
567
+ # The `approval` grade on each of these is advice to a harness, not a gate in
568
+ # the CLI: a person in a terminal just runs the command. `ask` means an agent
569
+ # must put it in front of someone; `never` means an agent must not run it at
570
+ # all, which is why cancel and delete are their own commands rather than flags
571
+ # on an `ask` one -- the grade is per command, so mixing them would launder a
572
+ # destructive action through a milder grade.
573
+ #
574
+ # Payments and subscriptions are deliberately absent. They exist on the
575
+ # backend; giving them a CLI surface would put a charge one command away from
576
+ # an agent, and no approval grade makes that a good trade.
577
+
578
+ @command(
579
+ app,
580
+ "designer",
581
+ "submit",
582
+ "sampling-order",
583
+ api="POST /designer/sampling_orders/{sampling_order_id}/confirm",
584
+ side_effects=[
585
+ "confirms the sample order to the supplier",
586
+ "starts the supplier's clock on it",
587
+ ],
588
+ approval="ask",
589
+ help=(
590
+ "POST /designer/sampling_orders/{id}/confirm — confirm a sample order so the "
591
+ "supplier starts. Run --dry-run first and read it back to the user."
592
+ ),
593
+ )
594
+ def submit_sampling_order(
595
+ sampling_order_id: str = typer.Argument(..., help="Sampling order id."),
596
+ ) -> None:
597
+ """Confirm a sampling order."""
598
+ print_json_or_exit(
599
+ console, lambda: api_client.designer_confirm_sampling_order(sampling_order_id)
600
+ )
601
+
602
+ @command(
603
+ app,
604
+ "designer",
605
+ "update",
606
+ "sampling-order",
607
+ api="POST /designer/sampling_orders/{sampling_order_id}/cancel",
608
+ side_effects=["cancels the order", "tells the supplier to stop"],
609
+ approval="never",
610
+ help=(
611
+ "POST /designer/sampling_orders/{id}/cancel — cancel a sample order. Graded "
612
+ "`never`: an agent must not do this on its own, a person runs it."
613
+ ),
614
+ )
615
+ def update_sampling_order(
616
+ sampling_order_id: str = typer.Argument(..., help="Sampling order id."),
617
+ cancel: bool = typer.Option(
618
+ ..., "--cancel", help="The only operation here; explicit on purpose."
619
+ ),
620
+ ) -> None:
621
+ """Cancel a sampling order."""
622
+ if not cancel:
623
+ raise typer.BadParameter("--cancel is required")
624
+ print_json_or_exit(
625
+ console, lambda: api_client.designer_cancel_sampling_order(sampling_order_id)
626
+ )
627
+
628
+ @command(
629
+ app,
630
+ "designer",
631
+ "delete",
632
+ "sampling-order",
633
+ api="DELETE /designer/sampling_orders/{sampling_order_id}",
634
+ side_effects=["removes the order row; the backend allows this on DRAFT only"],
635
+ approval="never",
636
+ help=(
637
+ "DELETE /designer/sampling_orders/{id} — delete a DRAFT sample order. The backend "
638
+ "refuses any other status. Graded `never`."
639
+ ),
640
+ )
641
+ def delete_sampling_order(
642
+ sampling_order_id: str = typer.Argument(..., help="Sampling order id (DRAFT)."),
643
+ ) -> None:
644
+ """Delete a draft sampling order."""
645
+ print_json_or_exit(
646
+ console, lambda: api_client.designer_delete_sampling_order(sampling_order_id)
647
+ )
648
+
649
+ @command(
650
+ app,
651
+ "designer",
652
+ "submit",
653
+ "production-order",
654
+ api="POST /designer/production_orders/{production_order_id}/submit",
655
+ side_effects=["hands the bulk order to the supplier", "creates its charges"],
656
+ approval="ask",
657
+ help=(
658
+ "POST /designer/production_orders/{id}/submit — submit a 大货 order. This is the "
659
+ "commitment, so --dry-run and confirm with the user first."
660
+ ),
661
+ )
662
+ def submit_production_order(
663
+ production_order_id: str = typer.Argument(..., help="Production order id."),
664
+ ) -> None:
665
+ """Submit a production order."""
666
+ print_json_or_exit(
667
+ console, lambda: api_client.designer_submit_production_order(production_order_id)
668
+ )
669
+
670
+ @command(
671
+ app,
672
+ "designer",
673
+ "update",
674
+ "production-order",
675
+ api="POST /designer/production_orders/{production_order_id}/complete",
676
+ side_effects=["completing closes the order for both sides"],
677
+ approval="ask",
678
+ help=(
679
+ "POST /designer/production_orders/{id}/complete, or PUT the order to re-pick which "
680
+ "supplier links it covers (--links-file, same body shape as creating it)."
681
+ ),
682
+ )
683
+ def update_production_order(
684
+ production_order_id: str = typer.Argument(..., help="Production order id."),
685
+ complete: bool = typer.Option(False, "--complete", help="Mark the order finished."),
686
+ links_file: Path | None = typer.Option(
687
+ None,
688
+ "--links-file",
689
+ exists=True,
690
+ dir_okay=False,
691
+ help="JSON with selected_links, to change what the order covers.",
692
+ ),
693
+ ) -> None:
694
+ """Complete a production order, or change the links it covers."""
695
+ if complete == (links_file is not None):
696
+ raise typer.BadParameter("pass exactly one of --complete / --links-file")
697
+ if complete:
698
+ run = lambda: api_client.designer_complete_production_order(production_order_id) # noqa: E731
699
+ else:
700
+ body = _json_object(None, links_file, "links-file")
701
+ run = lambda: api_client.designer_update_production_order(production_order_id, body) # noqa: E731
702
+ print_json_or_exit(console, run)
703
+
704
+ @command(
705
+ app,
706
+ "designer",
707
+ "update",
708
+ "shipping-order",
709
+ api="POST /designer/shipping_orders/{shipping_order_id}/confirm_receive",
710
+ side_effects=["marks the shipment received, which closes it"],
711
+ approval="ask",
712
+ help=(
713
+ "POST /designer/shipping_orders/{id}/confirm_receive — say the goods arrived. The "
714
+ "backend accepts this only while the shipment is IN_TRANSIT."
715
+ ),
716
+ )
717
+ def update_shipping_order(
718
+ shipping_order_id: str = typer.Argument(..., help="Shipping order id."),
719
+ confirm_receive: bool = typer.Option(
720
+ ..., "--confirm-receive", help="The only operation here; explicit on purpose."
721
+ ),
722
+ ) -> None:
723
+ """Confirm receipt of a shipment."""
724
+ if not confirm_receive:
725
+ raise typer.BadParameter("--confirm-receive is required")
726
+ print_json_or_exit(
727
+ console,
728
+ lambda: api_client.designer_confirm_receive_shipping_order(shipping_order_id),
729
+ )
730
+
731
+ @command(
732
+ app,
733
+ "designer",
734
+ "delete",
735
+ "shipping-order",
736
+ api="POST /designer/shipping_orders/{shipping_order_id}/cancel",
737
+ side_effects=[
738
+ "unlinks every production order on the shipment",
739
+ "deletes the shipment itself",
740
+ ],
741
+ approval="never",
742
+ help=(
743
+ "POST /designer/shipping_orders/{id}/cancel — the endpoint is called cancel but it "
744
+ "unlinks every production order and removes the shipment, so it is a delete here. "
745
+ "Graded `never`."
746
+ ),
747
+ )
748
+ def delete_shipping_order(
749
+ shipping_order_id: str = typer.Argument(..., help="Shipping order id."),
750
+ ) -> None:
751
+ """Cancel (and remove) a shipping order."""
752
+ print_json_or_exit(
753
+ console, lambda: api_client.designer_cancel_shipping_order(shipping_order_id)
754
+ )
755
+
565
756
  @command(
566
757
  app,
567
758
  "designer",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
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
@@ -79,6 +79,8 @@ makea-cli auth --logout
79
79
 
80
80
  每条命令都有的开关:`--describe` 打印它的机器可读定义(flags、副作用、审批档位);`--json` 强制纯 JSON(stdout 不是终端时默认就是)。读命令还有 `--fields a,b,c` 只保留这些字段;`list` 命令还有 `--limit N`(后端自己分页的就透传,不分页的在本地截断并在结果里写明 `truncated` / `returned` / `omitted`);写命令还有 `--dry-run`(打印将要发出的请求,不发)和 `--idempotency-key <k>`。`makea-cli --describe --json` 打印全量 manifest。
81
81
 
82
+ 写命令的**审批档位**(manifest 的 `approval`)是给 harness 的建议,不是 CLI 的门:`auto` 可以自动跑;`ask` 必须先让人确认;`never` agent 不许自己决定(人在终端照常能跑)。动钱的端点(payments / bank transfer / subscription)**故意不进 CLI**。
83
+
82
84
  exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不匹配 · `4` 后端拒绝(4xx,错误 JSON 在 stderr)· `5` 没跑完(5xx / 网络 / 超时)——读命令直接重试即可;**写命令可能已经生效了,重试前先读一遍状态**。
83
85
 
84
86
  0.1 的平铺命令名(`list-users`、`submit-supplier-quote` …)仍可用,作为隐藏的过渡别名转发到新命令并在 stderr 打一行提示;**下一个 minor 版本删除**。完整的改名对照表在 [CHANGELOG.md](CHANGELOG.md)。
@@ -147,6 +149,8 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
147
149
  | `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` |
148
150
  | `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. | — |
149
151
  | `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… | — |
152
+ | `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`. | — |
153
+ | `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.… | — |
150
154
  | `makea-cli designer download document` | read | `GET /designer/document/download` | save bytes for user_id + document_id (designer-authenticated; same query contract as admin document download). | `designer-download-document` |
151
155
  | `makea-cli designer get collection` | read | `GET /designer/collections/{collection_id}/overview` | one collection with its products, orders and lifecycle in a single read. | — |
152
156
  | `makea-cli designer get lifecycle` | read | `GET /designer/product_orders/{product_order_id}/lifecycle` | which stage this product is in. | — |
@@ -167,10 +171,15 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
167
171
  | `makea-cli designer list task` | read | `GET /designer/tasks` | what the platform is waiting on you for. | — |
168
172
  | `makea-cli designer search note` | read | `GET /designer/products/{product_id}/channel_search` | full-text search across a product's conversation; --channel narrows to one channel key. | — |
169
173
  | `makea-cli designer set product-collection` | write(auto) | `POST /designer/products/{id}/link-to-collection` | assign product to a collection. | `designer-link-product-to-collection` |
174
+ | `makea-cli designer submit production-order` | write(ask) | `POST /designer/production_orders/{production_order_id}/submit` | submit a 大货 order. This is the commitment, so --dry-run and confirm with the user first. | — |
175
+ | `makea-cli designer submit sampling-order` | write(ask) | `POST /designer/sampling_orders/{sampling_order_id}/confirm` | confirm a sample order so the supplier starts. Run --dry-run first and read it back to the user. | — |
170
176
  | `makea-cli designer update action` | write(auto) | `POST /designer/actions/{action_id}/{acknowledge\|snooze\|dismiss}` | respond to one of the pending actions from `designer list action`. An action is closed by the fact it asks for, not b… | — |
171
177
  | `makea-cli designer update note` | write(ask) | `POST /designer/products/{product_id}/notes/{note_id}/{accept\|reject}` | decide on a task the assistant proposed on a product. | — |
172
178
  | `makea-cli designer update product` | write(auto) | `POST /designer/product/update_basic_info` | patch fields on a product. --cover-image / --back-image take a document id and are what the assistant's set_product_i… | — |
179
+ | `makea-cli designer update production-order` | write(ask) | `POST /designer/production_orders/{production_order_id}/complete` | POST /designer/production_orders/{id}/complete, or PUT the order to re-pick which supplier links it covers (--links-f… | — |
173
180
  | `makea-cli designer update proposal` | write(ask) | `POST /designer/beeboo_proposals/approve` | apply one spec change the assistant proposed. This edits the pack, so read the proposal first. | — |
181
+ | `makea-cli designer update sampling-order` | write(never) | `POST /designer/sampling_orders/{sampling_order_id}/cancel` | cancel a sample order. Graded `never`: an agent must not do this on its own, a person runs it. | — |
182
+ | `makea-cli designer update shipping-order` | write(ask) | `POST /designer/shipping_orders/{shipping_order_id}/confirm_receive` | say the goods arrived. The backend accepts this only while the shipment is IN_TRANSIT. | — |
174
183
  | `makea-cli designer update suggested-action` | write(ask) | `POST /designer/channels/{channel_id}/suggested_actions/bulk_accept` | accept several of a channel's suggested actions in one write. --action takes note_id:action_id and repeats. | — |
175
184
  | `makea-cli designer update task` | write(auto) | `POST /designer/tasks/{complete\|dismiss}` | close one of the tasks from `designer list task`. Complete means you did it; dismiss means it does not apply. | — |
176
185
  | `makea-cli designer upload document` | write(auto) | `POST /designer/document/upload` | upload a file for the current designer token; optional product_id (omit to start a new draft id server-side). | `designer-upload-document` |
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=HfjVOrpTnmZ-xVFCYSVmX50EXaBQeJteUHG-PD6iQs8,22
1
+ makea_cli/__init__.py,sha256=m6kyaNpwBcP1XYcqrelX2oS3PJuOnElOcRdBa9pEb8c,22
2
2
  makea_cli/__main__.py,sha256=AkQjxWfKE3w9iD1d6I-2Zqvv2t9cct0oYyFF0UiA-Z0,144
3
- makea_cli/api_client.py,sha256=tF_FMHFnuxhUSjvc_XkzozLhdcBUMlYuzoT8CJly8mI,46100
3
+ makea_cli/api_client.py,sha256=cvs7ntOqVb8mDGiCOmyHwPo2EvwDTYqlchm5pXbG15w,48435
4
4
  makea_cli/auth_pkce.py,sha256=iXSyJ7DM3qVuj-3FwPiqM25CxXz9ebFs9FNthZdw3ws,7315
5
5
  makea_cli/config.py,sha256=lVPsp-44V9pPyUNbcG-uQNV8srCrBVMZnb0HF38Paks,2906
6
6
  makea_cli/errors.py,sha256=_2qKjvkU8YWeBcUd04Yn62lKkZoqQY52kH8klNMyxhM,2780
@@ -16,7 +16,7 @@ makea_cli/commands/analytics/cmd.py,sha256=_I5fBlomTalAxRpB-jculS01AbjEC5cVG3lAN
16
16
  makea_cli/commands/auth/__init__.py,sha256=NXoKGfkY2X_hb8GnAyzhoI_qDXfpwKZPqt4HnOrXW3Y,73
17
17
  makea_cli/commands/auth/cmd.py,sha256=G9ZeiaJwzUUTptIyynr0V-82wI7eV0qVX0pD6rdPSXg,1321
18
18
  makea_cli/commands/brand/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- makea_cli/commands/brand/cmd.py,sha256=0GyF-kcuh6jpEeCn9bm-MsS_FDCl6yyAhiNk-UmX_CM,23447
19
+ makea_cli/commands/brand/cmd.py,sha256=9Gx2agSJP6LyDZYOGyYr3mAfqPFJRiuno41DmucKZqI,31040
20
20
  makea_cli/commands/designer/__init__.py,sha256=Tc3Ju4-BKX2euBljhlrEd-Ksirk6JSPNixq4x0IbQYI,77
21
21
  makea_cli/commands/designer/cmd.py,sha256=4oOJ5tWYojUs8FBj3QRmgpwbicpsU1XqswoNlJpLLS8,23615
22
22
  makea_cli/commands/directory/__init__.py,sha256=rQHBc0JOFXynlzrBm_YfqoRuNsS-JOl-OOvPjgDbnIA,78
@@ -40,7 +40,7 @@ makea_cli/commands/production/cmd.py,sha256=s6fVAGzOvokF6Va5WKGEA2vw2x2hDQ3PrsF0
40
40
  makea_cli/commands/production/pricing_spec.py,sha256=xGbj7-ps3PcKuU6Oc59A70b62FjF6Awhr5IY3ymZveU,27174
41
41
  makea_cli/commands/supplier/__init__.py,sha256=qfQDeQdQ-B7I_uwFVfcp1vXFUTL4fAcNLu3ipsZ7dfs,77
42
42
  makea_cli/commands/supplier/cmd.py,sha256=CrG1m0U5-dvdJi4vk9-JRSYY_moPfV_Ud6jRTf-G5Z8,56947
43
- makea_cli-0.2.1.dist-info/METADATA,sha256=yZr1GR_KU8YLRxufe04hPVDi5oY4yCks2NKomp9ATDc,27908
44
- makea_cli-0.2.1.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
45
- makea_cli-0.2.1.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
46
- makea_cli-0.2.1.dist-info/RECORD,,
43
+ makea_cli-0.2.2.dist-info/METADATA,sha256=jW5EW6HvLmvM2Zrr1Afg6kJTZgXq-0P9Wz0qPKcJGyQ,29877
44
+ makea_cli-0.2.2.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
45
+ makea_cli-0.2.2.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
46
+ makea_cli-0.2.2.dist-info/RECORD,,