@binaryandthread/cli 0.4.1 → 0.4.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.
@@ -1516,13 +1516,23 @@ async function runStage(client, config, args) {
1516
1516
  if (!r.ok) {
1517
1517
  if (r.reason === "ambiguous_fit") {
1518
1518
  const fitList = r.fits.map((f) => `${f.fit} (${fmtPrice(f.amount, f.currency)})`).join(" \xB7 ");
1519
+ const cmds = r.fits.map(
1520
+ (f) => `bt stage ${handleShown} --fit ${f.fit}${size ? ` --size ${size}` : ""} (${fmtPrice(f.amount, f.currency)})`
1521
+ );
1519
1522
  const res = failResult({
1520
1523
  code: EXIT.DATAERR,
1521
- what: `${handleShown} comes in two fits: ${fitList}.`,
1524
+ what: `${handleShown} comes in two fits, different garments at different prices: ${fitList}.`,
1522
1525
  money: "nothing staged, nothing charged.",
1523
- fix: `bt stage ${handleShown} --fit ${r.fits[0].fit}${size ? ` --size ${size}` : ""}`
1526
+ fix: "ask which fit is wanted, don't choose for them, then run one of:"
1524
1527
  });
1525
- res.lines.push(` or set yours once \u2192 bt config set defaultFit ${r.fits[0].fit}`);
1528
+ for (const c of cmds) res.lines.push(` ${c}`);
1529
+ res.json = {
1530
+ error: {
1531
+ code: EXIT.DATAERR,
1532
+ message: `${handleShown} comes in two fits, different garments at different prices: ${fitList}.`,
1533
+ fix: `ask which fit is wanted, don't choose for them, then run one of: ${cmds.join(" | ")}`
1534
+ }
1535
+ };
1526
1536
  return res;
1527
1537
  }
1528
1538
  if (r.reason === "fit_not_offered") {
@@ -1530,7 +1540,9 @@ async function runStage(client, config, args) {
1530
1540
  code: EXIT.DATAERR,
1531
1541
  what: `${handleShown} isn't sold in "${r.requested}"${r.fits.length ? ` \u2014 it comes in ${r.fits.join(" \xB7 ")}` : ""}.`,
1532
1542
  money: "nothing staged, nothing charged.",
1533
- fix: r.fits.length ? `bt stage ${handleShown} --fit ${r.fits[0]}${size ? ` --size ${size}` : ""}` : `bt stage ${handleShown}${size ? ` --size ${size}` : ""} (this design comes in one fit)`
1543
+ // Same rule as ambiguous_fit above: with more than one fit on offer, list them ALL rather
1544
+ // than naming the first — a single named fit reads as a prescription to an agent.
1545
+ fix: r.fits.length ? `${r.fits.length > 1 ? "ask which fit is wanted, then: " : ""}${r.fits.map((f) => `bt stage ${handleShown} --fit ${f}${size ? ` --size ${size}` : ""}`).join(" | ")}` : `bt stage ${handleShown}${size ? ` --size ${size}` : ""} (this design comes in one fit)`
1534
1546
  });
1535
1547
  }
1536
1548
  if (r.reason === "fit_unavailable") {
@@ -1705,4 +1717,4 @@ export {
1705
1717
  runStage,
1706
1718
  registerStage
1707
1719
  };
1708
- //# sourceMappingURL=chunk-42NDSW24.js.map
1720
+ //# sourceMappingURL=chunk-LWDCGSCV.js.map