@carrierllc/mcp 0.13.28 → 0.13.29

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/cli.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  verifyStorefront,
41
41
  walletScreen,
42
42
  which
43
- } from "./chunk-RF3NNGZX.js";
43
+ } from "./chunk-LJPYVILK.js";
44
44
  import {
45
45
  copyTree,
46
46
  exists,
@@ -1106,6 +1106,13 @@ function bodyText(raw) {
1106
1106
  return trimmed;
1107
1107
  }
1108
1108
  }
1109
+ function orgNotConnected(raw) {
1110
+ try {
1111
+ return JSON.parse(raw).error_code === "org_not_connected";
1112
+ } catch {
1113
+ return false;
1114
+ }
1115
+ }
1109
1116
  async function callRestEndpoint(method, path, args, opts = {}) {
1110
1117
  const token = resolveApiKey() ?? await getAccessToken();
1111
1118
  if (!token) {
@@ -1187,6 +1194,15 @@ async function callRestEndpoint(method, path, args, opts = {}) {
1187
1194
  )
1188
1195
  };
1189
1196
  }
1197
+ if (res.status === 409 && orgNotConnected(raw)) {
1198
+ return {
1199
+ ok: false,
1200
+ text: withNextStep(redact(bodyText(raw).slice(0, 500)), [
1201
+ "Switch back: sign in again with `carrier login` and pick your connected organization",
1202
+ "Or use an org API key (ak_\u2026) from that organization: export CARRIER_API_KEY=\u2026"
1203
+ ])
1204
+ };
1205
+ }
1190
1206
  if (!res.ok) {
1191
1207
  return {
1192
1208
  ok: false,