@binaryandthread/cli 0.3.1 → 0.3.2

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.
package/dist/bin.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  forgetConfig,
6
6
  loadConfig,
7
7
  saveConfig
8
- } from "./chunk-ZNDKXHMV.js";
8
+ } from "./chunk-RGFMXWD5.js";
9
9
  import {
10
10
  makePrompts
11
11
  } from "./chunk-AAN4VWP3.js";
@@ -53,7 +53,7 @@ import {
53
53
  versionLine,
54
54
  warn,
55
55
  working
56
- } from "./chunk-VDOFLQ2P.js";
56
+ } from "./chunk-BFMH7VCE.js";
57
57
  import {
58
58
  __require
59
59
  } from "./chunk-7OCVIDC7.js";
@@ -102,7 +102,7 @@ function makeLogger(debug, write = (s) => process.stderr.write(s)) {
102
102
  }
103
103
 
104
104
  // src/version.ts
105
- var VERSION = "0.3.1";
105
+ var VERSION = "0.3.2";
106
106
 
107
107
  // src/eggs.ts
108
108
  function teapot() {
@@ -514,7 +514,7 @@ function registerBrowse(program, makeClient2, loadConfig2) {
514
514
  program.command("browse").alias("ls").description("list what's in stock on a branch.").option("--branch <branch>", "main (live) or next (terminal-only drops)").option("--pick", "opt into the arrow-key picker (default is the numbered table \u2014 use bt stage <n>)").option("--plain", "force the static table (the default; kept for back-compat)").action(async (opts) => {
515
515
  const { json, brand } = resolveOutput(program);
516
516
  if (opts.pick && !json && brand.color && process.stdout.isTTY && process.stdin.isTTY) {
517
- const { runInteractiveBrowse } = await import("./interactive-JALKLT56.js");
517
+ const { runInteractiveBrowse } = await import("./interactive-BOS6VMRJ.js");
518
518
  const handled = await runInteractiveBrowse(makeClient2(), loadConfig2(), { branch: opts.branch, brand });
519
519
  if (handled) return;
520
520
  }
@@ -927,10 +927,16 @@ async function runCheckout(client, config, args, deps) {
927
927
  lines.push(ok("deploy successful."));
928
928
  lines.push(` committed to wardrobe@main`);
929
929
  lines.push(` order #${displayId}`);
930
- if (mint.discount && mint.discount.amount > 0) {
930
+ const settled = outcome.summary;
931
+ const finalTotal = settled?.total ?? mint.total ?? shippedCart?.total ?? cart.total;
932
+ const finalCurrency = settled?.currency_code ?? currency;
933
+ if (settled?.discount_total) {
934
+ const codes = settled.discount_codes.length ? ` (${settled.discount_codes.join(", ")})` : "";
935
+ lines.push(dim(style, ` discount${codes} \u2212${fmtPrice(settled.discount_total, finalCurrency)}`));
936
+ } else if (mint.discount && mint.discount.amount > 0) {
931
937
  lines.push(dim(style, ` dev channel \u2212${fmtPrice(mint.discount.amount, currency)} (${mint.discount.pct}% \u2014 the terminal's cut for you)`));
932
938
  }
933
- lines.push(` total ${cyan(style, totalLine)}${taxIncl ? " (incl. VAT)" : ""}`);
939
+ lines.push(` total ${cyan(style, fmtPrice(finalTotal, finalCurrency))}${taxIncl ? " (incl. VAT)" : ""}`);
934
940
  if (shipsTo) {
935
941
  lines.push(` ships to ${shipsTo} \xB7 ~3\u20136 working days`);
936
942
  } else {
@@ -947,11 +953,13 @@ async function runCheckout(client, config, args, deps) {
947
953
  status: "placed",
948
954
  order_id: outcome.order_id,
949
955
  display_id: displayId,
950
- // A2 — the SHIPPING-INCLUSIVE, dev-channel-discounted total the buyer consented to (same
951
- // figure as the review), so a --json / bt buy consumer has the real amount, not just a status.
952
- total: mint.total ?? shippedCart?.total ?? cart.total ?? null,
953
- currency: mint.currency ?? cart.currency_code ?? region.currency_code ?? null,
954
- discount: mint.discount ?? null
956
+ // A2/ENG-39 — the REAL settled total (every discount applied, incl. at payment); fall back
957
+ // to the mint estimate for an older backend. A --json / bt buy consumer gets the true amount.
958
+ total: settled?.total ?? mint.total ?? shippedCart?.total ?? cart.total ?? null,
959
+ currency: settled?.currency_code ?? mint.currency ?? cart.currency_code ?? region.currency_code ?? null,
960
+ discount: mint.discount ?? null,
961
+ // The full settled summary (subtotal, discount_total, promo codes, line items) when available.
962
+ summary: settled ?? null
955
963
  } : void 0
956
964
  };
957
965
  }
@@ -1008,8 +1016,8 @@ function registerCheckout(program, makeClient2, loadConfig2) {
1008
1016
  const { json, brand } = resolveOutput(program);
1009
1017
  const { makePrompts: makePrompts2 } = await import("./prompts-DDVV5RE6.js");
1010
1018
  const { openCheckout } = await import("./browser-WCNC4AWS.js");
1011
- const { pollUntilPlaced } = await import("./poll-O3VUD5WV.js");
1012
- const { saveConfig: saveConfig2 } = await import("./config-GVEB4R7I.js");
1019
+ const { pollUntilPlaced } = await import("./poll-II3TVJLK.js");
1020
+ const { saveConfig: saveConfig2 } = await import("./config-WV4DTQXU.js");
1013
1021
  const client = makeClient2();
1014
1022
  const print = json ? () => {
1015
1023
  } : (line) => process.stdout.write(line + "\n");
@@ -1783,8 +1791,8 @@ function registerBuy(program, makeClient2, loadConfig2) {
1783
1791
  const { json, brand } = resolveOutput(program);
1784
1792
  const { makePrompts: makePrompts2 } = await import("./prompts-DDVV5RE6.js");
1785
1793
  const { openCheckout } = await import("./browser-WCNC4AWS.js");
1786
- const { pollUntilPlaced } = await import("./poll-O3VUD5WV.js");
1787
- const { saveConfig: saveConfig2 } = await import("./config-GVEB4R7I.js");
1794
+ const { pollUntilPlaced } = await import("./poll-II3TVJLK.js");
1795
+ const { saveConfig: saveConfig2 } = await import("./config-WV4DTQXU.js");
1788
1796
  const client = makeClient2();
1789
1797
  const print = json ? () => {
1790
1798
  } : (line) => process.stdout.write(line + "\n");
@@ -1844,7 +1852,7 @@ function runConfig(args, deps) {
1844
1852
  function registerConfig(program) {
1845
1853
  program.command("config").argument("[sub]", "get | set", "get").argument("[key]", "config key").argument("[value]", "value (for set)").description("view or set local prefs (email, region, defaults). the auth token is never stored here.").action(async (sub, key, value) => {
1846
1854
  const { json } = resolveOutput(program);
1847
- const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await import("./config-GVEB4R7I.js");
1855
+ const { loadConfig: loadConfig2, saveConfig: saveConfig2 } = await import("./config-WV4DTQXU.js");
1848
1856
  const res = runConfig({ sub, key, value, json }, { load: loadConfig2, save: saveConfig2 });
1849
1857
  printResult(res, json);
1850
1858
  });