makea-cli 0.2.0__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.0"
1
+ __version__ = "0.2.2"
makea_cli/api_client.py CHANGED
@@ -1220,3 +1220,141 @@ def supplier_download_document(
1220
1220
  ) -> tuple[bytes, str | None]:
1221
1221
  """GET /supplier/document/download — a document this factory may read."""
1222
1222
  return _download("/supplier/document/download", {"document_id": document_id}, timeout=timeout)
1223
+
1224
+
1225
+ # --- clearing the queue: tasks, actions, and the assistant's proposals ----------
1226
+
1227
+
1228
+ def designer_task_action(action: str, task_id: str) -> Any:
1229
+ """POST /designer/tasks/{dismiss|complete} — body ``{"task_id": "<type>#<key>"}``."""
1230
+ return post_json(f"/designer/tasks/{action}", {"task_id": task_id})
1231
+
1232
+
1233
+ def designer_action_state(action_id: str, state: str, *, days: int | None = None) -> Any:
1234
+ """POST /designer/actions/{id}/{acknowledge|snooze|dismiss}."""
1235
+ body: dict[str, Any] = {}
1236
+ if state == "snooze" and days is not None:
1237
+ body["days"] = days
1238
+ return post_json(f"/designer/actions/{action_id}/{state}", body)
1239
+
1240
+
1241
+ def designer_note_decision(product_id: str, note_id: str, decision: str) -> Any:
1242
+ """POST /designer/products/{id}/notes/{note_id}/{accept|reject} — a task candidate."""
1243
+ return post_json(f"/designer/products/{product_id}/notes/{note_id}/{decision}", {})
1244
+
1245
+
1246
+ def designer_approve_proposal(note_id: str, proposal_id: str) -> Any:
1247
+ """POST /designer/beeboo_proposals/approve — apply one of the assistant's spec proposals."""
1248
+ return post_json(
1249
+ "/designer/beeboo_proposals/approve", {"note_id": note_id, "proposal_id": proposal_id}
1250
+ )
1251
+
1252
+
1253
+ def designer_bulk_accept_actions(channel_id: str, actions: list[dict[str, str]]) -> Any:
1254
+ """POST /designer/channels/{id}/suggested_actions/bulk_accept — accept several at once."""
1255
+ return post_json(
1256
+ f"/designer/channels/{channel_id}/suggested_actions/bulk_accept", {"actions": actions}
1257
+ )
1258
+
1259
+
1260
+ def supplier_task_action(action: str, task_id: str) -> Any:
1261
+ """POST /supplier/tasks/{dismiss|complete} — body ``{"task_id": "<type>#<key>"}``."""
1262
+ return post_json(f"/supplier/tasks/{action}", {"task_id": task_id})
1263
+
1264
+
1265
+ def supplier_action_state(action_id: str, state: str, *, days: int | None = None) -> Any:
1266
+ """POST /supplier/actions/{id}/{acknowledge|snooze}."""
1267
+ body: dict[str, Any] = {}
1268
+ if state == "snooze" and days is not None:
1269
+ body["days"] = days
1270
+ return post_json(f"/supplier/actions/{action_id}/{state}", body)
1271
+
1272
+
1273
+ # --- the factory's quote lifecycle ----------------------------------------------
1274
+
1275
+
1276
+ def supplier_edit_quote(quote_request_id: str, link_id: str, body: dict[str, Any]) -> Any:
1277
+ """POST /supplier/quote_requests/{id}/links/{link_id}/edit — revise a quote already sent."""
1278
+ return post_json(
1279
+ f"/supplier/quote_requests/{quote_request_id}/links/{link_id}/edit", body, timeout=120.0
1280
+ )
1281
+
1282
+
1283
+ def supplier_set_rfq_status(quote_request_id: str, status: str) -> Any:
1284
+ """POST /supplier/quote_requests/{id}/status — accept or decline the invitation."""
1285
+ return post_json(f"/supplier/quote_requests/{quote_request_id}/status", {"status": status})
1286
+
1287
+
1288
+ def supplier_archive_rfq(quote_request_id: str) -> Any:
1289
+ """POST /supplier/quote_requests/{id}/archive — take it off your board."""
1290
+ return post_json(f"/supplier/quote_requests/{quote_request_id}/archive", {})
1291
+
1292
+
1293
+ def supplier_accept_terms(quote_request_id: str, agreement_keys: list[str]) -> Any:
1294
+ """POST /supplier/quote_requests/{id}/accept_terms — accept the named agreements."""
1295
+ return post_json(
1296
+ f"/supplier/quote_requests/{quote_request_id}/accept_terms",
1297
+ {"agreement_keys": agreement_keys},
1298
+ )
1299
+
1300
+
1301
+ def supplier_list_quote_edit_requests(quote_request_id: str) -> Any:
1302
+ """GET /supplier/quote_requests/{id}/quote_edit_requests — the brand's change requests."""
1303
+ return get_json(f"/supplier/quote_requests/{quote_request_id}/quote_edit_requests")
1304
+
1305
+
1306
+ def designer_list_actions(*, product_id: str | None = None) -> Any:
1307
+ """GET /designer/actions — the brand's pending actions, optionally for one product."""
1308
+ params = {"product_id": product_id} if product_id else None
1309
+ return get_json("/designer/actions", params=params)
1310
+
1311
+
1312
+ def supplier_list_tasks() -> Any:
1313
+ """GET /supplier/tasks — the factory's onboarding and per-order to-dos."""
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", {})
@@ -272,6 +272,23 @@ def register(app: typer.Typer) -> None:
272
272
  """List the brand's open tasks."""
273
273
  print_json_or_exit(console, lambda: api_client.designer_list_tasks())
274
274
 
275
+ @command(
276
+ app,
277
+ "designer",
278
+ "list",
279
+ "action",
280
+ api="GET /designer/actions",
281
+ help=(
282
+ "GET /designer/actions — the pending actions on you, optionally for one product. "
283
+ "An action is closed by the fact it asks for, not by acknowledging it."
284
+ ),
285
+ )
286
+ def list_actions(
287
+ product: str | None = typer.Option(None, "--product", "-p", help="Only this product's."),
288
+ ) -> None:
289
+ """List the brand's pending actions."""
290
+ print_json_or_exit(console, lambda: api_client.designer_list_actions(product_id=product))
291
+
275
292
  @command(
276
293
  app,
277
294
  "designer",
@@ -377,6 +394,151 @@ def register(app: typer.Typer) -> None:
377
394
  console, lambda: api_client.designer_update_product_basic_info(product_id, payload)
378
395
  )
379
396
 
397
+ @command(
398
+ app,
399
+ "designer",
400
+ "update",
401
+ "task",
402
+ api="POST /designer/tasks/{complete|dismiss}",
403
+ side_effects=["clears the task off your dashboard"],
404
+ approval="auto",
405
+ help=(
406
+ "POST /designer/tasks/{complete|dismiss} — close one of the tasks from "
407
+ "`designer list task`. Complete means you did it; dismiss means it does not apply."
408
+ ),
409
+ )
410
+ def update_task(
411
+ task_id: str = typer.Argument(..., help="Task id, the '<type>#<key>' from list task."),
412
+ complete: bool = typer.Option(False, "--complete", help="Mark it done."),
413
+ dismiss: bool = typer.Option(False, "--dismiss", help="Hide it as not applicable."),
414
+ ) -> None:
415
+ """Complete or dismiss a task."""
416
+ if complete == dismiss:
417
+ raise typer.BadParameter("pass exactly one of --complete / --dismiss")
418
+ verb = "complete" if complete else "dismiss"
419
+ print_json_or_exit(console, lambda: api_client.designer_task_action(verb, task_id))
420
+
421
+ @command(
422
+ app,
423
+ "designer",
424
+ "update",
425
+ "action",
426
+ api="POST /designer/actions/{action_id}/{acknowledge|snooze|dismiss}",
427
+ side_effects=["changes what your pending-actions list shows"],
428
+ approval="auto",
429
+ help=(
430
+ "POST /designer/actions/{id}/{acknowledge|snooze|dismiss} — respond to one of the "
431
+ "pending actions from `designer list action`. An action is closed by the fact it "
432
+ "asks for, not by this; acknowledging only says you have seen it."
433
+ ),
434
+ )
435
+ def update_action(
436
+ action_id: str = typer.Argument(..., help="Action id from list action."),
437
+ acknowledge: bool = typer.Option(False, "--acknowledge", help="Mark it seen."),
438
+ snooze: int | None = typer.Option(
439
+ None, "--snooze", metavar="DAYS", help="Hide it for this many days."
440
+ ),
441
+ dismiss: bool = typer.Option(False, "--dismiss", help="Drop it."),
442
+ ) -> None:
443
+ """Acknowledge, snooze or dismiss a pending action."""
444
+ chosen = [
445
+ n
446
+ for n, v in (
447
+ ("acknowledge", acknowledge),
448
+ ("snooze", snooze is not None),
449
+ ("dismiss", dismiss),
450
+ )
451
+ if v
452
+ ]
453
+ if len(chosen) != 1:
454
+ raise typer.BadParameter(
455
+ "pass exactly one of --acknowledge / --snooze DAYS / --dismiss"
456
+ )
457
+ state = chosen[0]
458
+ print_json_or_exit(
459
+ console, lambda: api_client.designer_action_state(action_id, state, days=snooze)
460
+ )
461
+
462
+ @command(
463
+ app,
464
+ "designer",
465
+ "update",
466
+ "note",
467
+ api="POST /designer/products/{product_id}/notes/{note_id}/{accept|reject}",
468
+ side_effects=["accepting a task candidate creates the task and notifies whoever it is for"],
469
+ approval="ask",
470
+ help=(
471
+ "POST /designer/products/{id}/notes/{note_id}/{accept|reject} — decide on a task "
472
+ "the assistant proposed on a product."
473
+ ),
474
+ )
475
+ def update_note(
476
+ note_id: str = typer.Argument(..., help="Note id carrying the proposed task."),
477
+ product: str = typer.Option(..., "--product", "-p", help="Product the note is on."),
478
+ accept: bool = typer.Option(False, "--accept", help="Create the task."),
479
+ reject: bool = typer.Option(False, "--reject", help="Turn it down."),
480
+ ) -> None:
481
+ """Accept or reject a proposed task."""
482
+ if accept == reject:
483
+ raise typer.BadParameter("pass exactly one of --accept / --reject")
484
+ decision = "accept" if accept else "reject"
485
+ print_json_or_exit(
486
+ console, lambda: api_client.designer_note_decision(product, note_id, decision)
487
+ )
488
+
489
+ @command(
490
+ app,
491
+ "designer",
492
+ "update",
493
+ "proposal",
494
+ api="POST /designer/beeboo_proposals/approve",
495
+ side_effects=[
496
+ "writes the proposed change into the tech pack",
497
+ "notifies the suppliers who hold that pack",
498
+ ],
499
+ approval="ask",
500
+ help=(
501
+ "POST /designer/beeboo_proposals/approve — apply one spec change the assistant "
502
+ "proposed. This edits the pack, so read the proposal first."
503
+ ),
504
+ )
505
+ def update_proposal(
506
+ proposal_id: str = typer.Argument(..., help="Proposal id from the note."),
507
+ note: str = typer.Option(..., "--note", help="Note id the proposal hangs on."),
508
+ ) -> None:
509
+ """Approve one assistant proposal."""
510
+ print_json_or_exit(console, lambda: api_client.designer_approve_proposal(note, proposal_id))
511
+
512
+ @command(
513
+ app,
514
+ "designer",
515
+ "update",
516
+ "suggested-action",
517
+ api="POST /designer/channels/{channel_id}/suggested_actions/bulk_accept",
518
+ side_effects=["applies every accepted action", "fans out one notification for the batch"],
519
+ approval="ask",
520
+ help=(
521
+ "POST /designer/channels/{id}/suggested_actions/bulk_accept — accept several of a "
522
+ "channel's suggested actions in one write. --action takes note_id:action_id and repeats."
523
+ ),
524
+ )
525
+ def update_suggested_actions(
526
+ channel_id: str = typer.Argument(..., help="Channel holding the notes."),
527
+ action: list[str] = typer.Option(
528
+ ..., "--action", "-a", help="note_id:action_id (repeat per action)."
529
+ ),
530
+ ) -> None:
531
+ """Accept suggested actions in bulk."""
532
+ pairs: list[dict[str, str]] = []
533
+ for raw in action:
534
+ note_id, sep, action_id = raw.partition(":")
535
+ if not sep or not note_id or not action_id:
536
+ raise typer.BadParameter(f"--action must be note_id:action_id, got {raw!r}")
537
+ pairs.append({"note_id": note_id, "action_id": action_id})
538
+ print_json_or_exit(
539
+ console, lambda: api_client.designer_bulk_accept_actions(channel_id, pairs)
540
+ )
541
+
380
542
  @command(
381
543
  app,
382
544
  "designer",
@@ -400,6 +562,197 @@ def register(app: typer.Typer) -> None:
400
562
  body["channel_key"] = channel
401
563
  print_json_or_exit(console, lambda: api_client.designer_add_product_note(product_id, body))
402
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
+
403
756
  @command(
404
757
  app,
405
758
  "designer",
@@ -192,6 +192,149 @@ def register(app: typer.Typer) -> None:
192
192
 
193
193
  print_json_or_exit(console, run)
194
194
 
195
+ @command(
196
+ app,
197
+ "supplier",
198
+ "list",
199
+ "quote-edit-request",
200
+ api="GET /supplier/quote_requests/{quote_request_id}/quote_edit_requests",
201
+ help=(
202
+ "GET /supplier/quote_requests/{id}/quote_edit_requests — changes the brand has "
203
+ "asked you to make to a quote you already sent."
204
+ ),
205
+ )
206
+ def list_quote_edit_requests(
207
+ quote_request_id: str = typer.Argument(..., help="The quote request."),
208
+ ) -> None:
209
+ """List the brand's requested changes to your quote."""
210
+ print_json_or_exit(
211
+ console, lambda: api_client.supplier_list_quote_edit_requests(quote_request_id)
212
+ )
213
+
214
+ @command(
215
+ app,
216
+ "supplier",
217
+ "update",
218
+ "task",
219
+ api="POST /supplier/tasks/{complete|dismiss}",
220
+ side_effects=["clears the task off your dashboard"],
221
+ approval="auto",
222
+ help="POST /supplier/tasks/{complete|dismiss} — close one of the tasks from `supplier list task`.",
223
+ )
224
+ def update_task(
225
+ task_id: str = typer.Argument(..., help="Task id, the '<type>#<key>' from list task."),
226
+ complete: bool = typer.Option(False, "--complete", help="Mark it done."),
227
+ dismiss: bool = typer.Option(False, "--dismiss", help="Hide it as not applicable."),
228
+ ) -> None:
229
+ """Complete or dismiss a task."""
230
+ if complete == dismiss:
231
+ raise typer.BadParameter("pass exactly one of --complete / --dismiss")
232
+ verb = "complete" if complete else "dismiss"
233
+ print_json_or_exit(console, lambda: api_client.supplier_task_action(verb, task_id))
234
+
235
+ @command(
236
+ app,
237
+ "supplier",
238
+ "update",
239
+ "action",
240
+ api="POST /supplier/actions/{action_id}/{acknowledge|snooze}",
241
+ side_effects=["changes what your pending-actions list shows"],
242
+ approval="auto",
243
+ help=(
244
+ "POST /supplier/actions/{id}/{acknowledge|snooze} — respond to a pending action. "
245
+ "Acknowledging says you have seen it; the action still closes on the fact it asks for."
246
+ ),
247
+ )
248
+ def update_action(
249
+ action_id: str = typer.Argument(..., help="Action id from list action."),
250
+ acknowledge: bool = typer.Option(False, "--acknowledge", help="Mark it seen."),
251
+ snooze: int | None = typer.Option(
252
+ None, "--snooze", metavar="DAYS", help="Hide it for this many days."
253
+ ),
254
+ ) -> None:
255
+ """Acknowledge or snooze a pending action."""
256
+ if acknowledge == (snooze is not None):
257
+ raise typer.BadParameter("pass exactly one of --acknowledge / --snooze DAYS")
258
+ state = "acknowledge" if acknowledge else "snooze"
259
+ print_json_or_exit(
260
+ console, lambda: api_client.supplier_action_state(action_id, state, days=snooze)
261
+ )
262
+
263
+ @command(
264
+ app,
265
+ "supplier",
266
+ "list",
267
+ "task",
268
+ api="GET /supplier/tasks",
269
+ help="GET /supplier/tasks — your onboarding and per-order to-dos.",
270
+ )
271
+ def list_tasks() -> None:
272
+ """List the factory's tasks."""
273
+ print_json_or_exit(console, lambda: api_client.supplier_list_tasks())
274
+
275
+ @command(
276
+ app,
277
+ "supplier",
278
+ "update",
279
+ "quote",
280
+ api="POST /supplier/quote_requests/{quote_request_id}/links/{link_id}/edit",
281
+ side_effects=["changes the price the brand sees", "notifies the brand of the revision"],
282
+ approval="ask",
283
+ help=(
284
+ "POST /supplier/quote_requests/{id}/links/{link_id}/edit — revise a quote you "
285
+ "already sent. --file is the same payload shape as submit; --dry-run first."
286
+ ),
287
+ )
288
+ def update_quote(
289
+ quote_request_id: str = typer.Argument(..., help="The quote request."),
290
+ link_id: str = typer.Argument(..., help="The quote (supplier link) to revise."),
291
+ file: Path = typer.Option(
292
+ ..., "--file", "-f", exists=True, dir_okay=False, help="JSON file with the revision."
293
+ ),
294
+ ) -> None:
295
+ """Revise a submitted quote."""
296
+ body = _load_json_object(file)
297
+ print_json_or_exit(
298
+ console, lambda: api_client.supplier_edit_quote(quote_request_id, link_id, body)
299
+ )
300
+
301
+ @command(
302
+ app,
303
+ "supplier",
304
+ "update",
305
+ "rfq",
306
+ api="POST /supplier/quote_requests/{quote_request_id}/{status|archive|accept_terms}",
307
+ side_effects=[
308
+ "the brand sees whether you took the job",
309
+ "archiving hides it from your board",
310
+ ],
311
+ approval="ask",
312
+ help=(
313
+ "POST /supplier/quote_requests/{id}/{status|archive|accept_terms} — answer an RFQ. "
314
+ "--status accepts or declines the invitation; --archive takes it off your board; "
315
+ "--accept-terms accepts the named agreements (repeat the flag)."
316
+ ),
317
+ )
318
+ def update_rfq(
319
+ quote_request_id: str = typer.Argument(..., help="The quote request."),
320
+ status: str | None = typer.Option(None, "--status", help="New status, e.g. ACCEPTED."),
321
+ archive: bool = typer.Option(False, "--archive", help="Take it off your board."),
322
+ accept_terms: list[str] = typer.Option(
323
+ [], "--accept-terms", help="Agreement key to accept (repeat per agreement)."
324
+ ),
325
+ ) -> None:
326
+ """Answer, archive, or accept the terms of an RFQ."""
327
+ chosen = [bool(status), archive, bool(accept_terms)]
328
+ if sum(chosen) != 1:
329
+ raise typer.BadParameter("pass exactly one of --status / --archive / --accept-terms")
330
+ if status:
331
+ run = lambda: api_client.supplier_set_rfq_status(quote_request_id, status) # noqa: E731
332
+ elif archive:
333
+ run = lambda: api_client.supplier_archive_rfq(quote_request_id) # noqa: E731
334
+ else:
335
+ run = lambda: api_client.supplier_accept_terms(quote_request_id, list(accept_terms)) # noqa: E731
336
+ print_json_or_exit(console, run)
337
+
195
338
  @command(
196
339
  app,
197
340
  "supplier",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: makea-cli
3
- Version: 0.2.0
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. | — |
@@ -154,6 +158,7 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
154
158
  | `makea-cli designer get quote-advice` | read | `GET /designer/product/quote_advice` | which quote to award and why, from cache. Reading never spends a model call; the web app is what asks for a fresh one. | — |
155
159
  | `makea-cli designer get tech-pack` | read | `GET /designer/products/{product_id}/technical-specifications` | the product's tech pack. | — |
156
160
  | `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. | — |
161
+ | `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… | — |
157
162
  | `makea-cli designer list channel` | read | `GET /designer/products/{product_id}/channels` | the product's conversation channels. | — |
158
163
  | `makea-cli designer list collection` | read | `GET /designer/collections` | the brand's collections. | — |
159
164
  | `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. | — |
@@ -166,7 +171,17 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
166
171
  | `makea-cli designer list task` | read | `GET /designer/tasks` | what the platform is waiting on you for. | — |
167
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. | — |
168
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. | — |
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… | — |
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. | — |
169
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… | — |
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. | — |
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. | — |
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. | — |
170
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` |
171
186
 
172
187
  ### `supplier`
@@ -183,8 +198,14 @@ exit code:`0` 成功 · `2` 用法错 · `3` 未登录或身份与 persona 不
183
198
  | `makea-cli supplier list channel` | read | `GET /supplier/products/{product_id}/channels` | the channels you are part of on a product. | — |
184
199
  | `makea-cli supplier list note` | read | `GET /supplier/products/{product_id}/channels/{channel_key}/notes` | the conversation in one channel. | — |
185
200
  | `makea-cli supplier list production-order` | read | `GET /supplier/production_orders` | your production orders, optionally for one RFQ. | — |
201
+ | `makea-cli supplier list quote-edit-request` | read | `GET /supplier/quote_requests/{quote_request_id}/quote_edit_requests` | changes the brand has asked you to make to a quote you already sent. | — |
186
202
  | `makea-cli supplier list rfq` | read | `GET /supplier/quote_requests` | the RFQs (quote requests) sent to you. | — |
203
+ | `makea-cli supplier list task` | read | `GET /supplier/tasks` | your onboarding and per-order to-dos. | — |
187
204
  | `makea-cli supplier submit quote` | write(ask) | `POST /supplier/quote_requests/{id}/submit_quote` | submit your quote for an RFQ. --file is the supplier link payload as JSON (same shape the web form posts); run with -… | — |
205
+ | `makea-cli supplier update action` | write(auto) | `POST /supplier/actions/{action_id}/{acknowledge\|snooze}` | respond to a pending action. Acknowledging says you have seen it; the action still closes on the fact it asks for. | — |
206
+ | `makea-cli supplier update quote` | write(ask) | `POST /supplier/quote_requests/{quote_request_id}/links/{link_id}/edit` | revise a quote you already sent. --file is the same payload shape as submit; --dry-run first. | — |
207
+ | `makea-cli supplier update rfq` | write(ask) | `POST /supplier/quote_requests/{quote_request_id}/{status\|archive\|accept_terms}` | answer an RFQ. --status accepts or declines the invitation; --archive takes it off your board; --accept-terms accepts… | — |
208
+ | `makea-cli supplier update task` | write(auto) | `POST /supplier/tasks/{complete\|dismiss}` | close one of the tasks from `supplier list task`. | — |
188
209
 
189
210
  其它:`makea-cli auth [--logout]` 登录/登出;`makea-cli version` 版本号。
190
211
 
@@ -1,6 +1,6 @@
1
- makea_cli/__init__.py,sha256=Zn1KFblwuFHiDRdRAiRnDBRkbPttWh44jKa5zG2ov0E,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=oVIR8QD8lkKJm0YM0CzWwOPQ3vi4sNSWqgq_HnaNuXQ,42139
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=KgOOFRNkLwxyMB80rpCPZ9JPlruKPBT90rCFtUIPsVE,16818
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
@@ -26,7 +26,7 @@ makea_cli/commands/document/cmd.py,sha256=IqjzGoTYXp1RbTIYY1MSEqX93btK4eESDTX40C
26
26
  makea_cli/commands/email/__init__.py,sha256=EWMqMTgZK1GQDW7-9RGVSGU-CvaHTARjXZL18Hdj80I,74
27
27
  makea_cli/commands/email/cmd.py,sha256=s22JQjJ7bPdpgBaL7Tmr8hx80ki_JN_iGQtUekXmmdo,4177
28
28
  makea_cli/commands/factory/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- makea_cli/commands/factory/cmd.py,sha256=gK2ezMDzSc3MNV9zy06nHyvD0fltWO43pa2xemJrmgI,8734
29
+ makea_cli/commands/factory/cmd.py,sha256=ae2KGxnzoY1i7C4miVIk52IQZm53pOfePnJa9zeL_sI,14724
30
30
  makea_cli/commands/library/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  makea_cli/commands/library/cmd.py,sha256=eXZa6iLyPaoEWtRd-UmhRT6Ox-zlfs89gJqGn-IPuSU,11187
32
32
  makea_cli/commands/metrics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.0.dist-info/METADATA,sha256=zmAtw_mXRFW14exkDGOR1IQBp7qES7AvNT1GbMA9HB4,25373
44
- makea_cli-0.2.0.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
45
- makea_cli-0.2.0.dist-info/entry_points.txt,sha256=4x-lbVa1jBbNlkNq7L-rYyfRh2spZmc3BLIzP-Dl-Qk,50
46
- makea_cli-0.2.0.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,,