@carrierllc/mcp 0.13.13 → 0.13.15

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
@@ -39,7 +39,7 @@ import {
39
39
  verifyStorefront,
40
40
  walletScreen,
41
41
  which
42
- } from "./chunk-OJITGTFO.js";
42
+ } from "./chunk-QXIY42R6.js";
43
43
  import {
44
44
  copyTree,
45
45
  exists,
@@ -292,8 +292,10 @@ for (let first = 65; first <= 90; first += 1) {
292
292
  NAME_TO_CODE.set("uk", "GB");
293
293
  var CODE_ALIASES = { UK: "GB" };
294
294
  function parseDataGb(raw) {
295
- if (raw.trim().toLowerCase() === "unlimited") return { ok: true, value: 0 };
296
- return parseAmount(raw, /gigabytes?|gbs?|gb/gi, "Enter data like 1, 1 GB, or Unlimited.", 1e4, false);
295
+ if (raw.trim().toLowerCase() === "unlimited") return { ok: true, value: 0, unlimited: true };
296
+ const parsed = parseAmount(raw, /gigabytes?|gbs?|gb/gi, "Enter data like 1, 1 GB, or Unlimited.", 1e4, false);
297
+ if (!parsed.ok) return parsed;
298
+ return { ok: true, value: parsed.value, unlimited: false };
297
299
  }
298
300
  function parseValidityDays(raw) {
299
301
  return parseAmount(raw, /days?/gi, "Enter validity like 7 or 7 days.", 3650, true);
@@ -452,6 +454,7 @@ function completePlanInput(input, plans) {
452
454
  input.currency,
453
455
  input.templateId,
454
456
  input.dataGb,
457
+ input.unlimited,
455
458
  input.validityDays,
456
459
  input.regions,
457
460
  input.description,
@@ -493,6 +496,7 @@ function storefrontPlanBody(input) {
493
496
  input.currency,
494
497
  input.templateId,
495
498
  input.dataGb,
499
+ input.unlimited,
496
500
  input.validityDays,
497
501
  input.regions,
498
502
  input.description,
@@ -502,6 +506,9 @@ function storefrontPlanBody(input) {
502
506
  if (!input.slug || !input.name || input.priceCents === void 0 || !input.currency || input.templateId === void 0) {
503
507
  return { error: "A plan needs a slug, name, price in minor units, currency, and OCS template id." };
504
508
  }
509
+ if (input.dataGb !== void 0 && input.dataGb <= 0 && input.unlimited !== true) {
510
+ return { error: "data_gb of 0 is refused. Send unlimited: true to sell an unlimited plan." };
511
+ }
505
512
  const body = {
506
513
  slug: input.slug,
507
514
  name: input.name,
@@ -510,6 +517,7 @@ function storefrontPlanBody(input) {
510
517
  ocs_package_template_id: input.templateId
511
518
  };
512
519
  if (input.dataGb !== void 0) body.data_gb = input.dataGb;
520
+ if (input.unlimited !== void 0) body.unlimited = input.unlimited;
513
521
  if (input.validityDays !== void 0) body.validity_days = input.validityDays;
514
522
  if (input.regions !== void 0) body.regions = input.regions;
515
523
  if (input.description !== void 0) body.description = input.description;
@@ -1543,7 +1551,7 @@ function hostedPublishInputFromFlags(flags) {
1543
1551
  if (!price.ok) return { ok: false, text: price.text };
1544
1552
  const template = parseWholeNumber(flags.templateId, "Template id");
1545
1553
  if (!template.ok) return { ok: false, text: template.message };
1546
- const data = readLabel(flags.dataGb, parseDataGb);
1554
+ const data = readDataGb(flags.dataGb, flags.unlimited);
1547
1555
  if (!data.ok) return { ok: false, text: data.text };
1548
1556
  const validity = readLabel(flags.validityDays, parseValidityDays);
1549
1557
  if (!validity.ok) return { ok: false, text: validity.text };
@@ -1573,6 +1581,7 @@ function hostedPublishInputFromFlags(flags) {
1573
1581
  currency: flags.currency,
1574
1582
  templateId: template.value,
1575
1583
  dataGb: data.value,
1584
+ unlimited: data.unlimited,
1576
1585
  validityDays: validity.value,
1577
1586
  regions: countries.value,
1578
1587
  description: flags.planText,
@@ -1611,6 +1620,12 @@ function readLabel(value, parse) {
1611
1620
  const parsed = parse(value);
1612
1621
  return parsed.ok ? { ok: true, value: parsed.value } : { ok: false, text: parsed.message };
1613
1622
  }
1623
+ function readDataGb(value, unlimitedFlag) {
1624
+ if (value === void 0) return { ok: true, value: void 0, unlimited: unlimitedFlag };
1625
+ const parsed = parseDataGb(value);
1626
+ if (!parsed.ok) return { ok: false, text: parsed.message };
1627
+ return { ok: true, value: parsed.value, unlimited: unlimitedFlag === true || parsed.unlimited };
1628
+ }
1614
1629
  function readCountries(value) {
1615
1630
  if (value === void 0) return { ok: true, value: void 0 };
1616
1631
  const parsed = parseCountryInput(value);
@@ -1625,6 +1640,7 @@ function planInput(input) {
1625
1640
  currency: input.currency,
1626
1641
  templateId: input.templateId,
1627
1642
  dataGb: input.dataGb,
1643
+ unlimited: input.unlimited,
1628
1644
  validityDays: input.validityDays,
1629
1645
  regions: input.regions,
1630
1646
  description: input.description,
@@ -3205,6 +3221,78 @@ var CLI_DOMAINS = [
3205
3221
  }
3206
3222
  ]
3207
3223
  },
3224
+ {
3225
+ name: "network-default",
3226
+ summary: "Which networks a SIM gets per country. Default: the cheapest available.",
3227
+ commands: [
3228
+ {
3229
+ name: "show",
3230
+ tool: "get_network_default",
3231
+ summary: "Show the org network default (cheapest_available, all or custom) and what applies today. New assignments only.",
3232
+ options: []
3233
+ },
3234
+ {
3235
+ name: "set",
3236
+ tool: "set_network_default",
3237
+ summary: "Store the org network default. Changes no SIM and writes nothing to OCS; applies to new assignments.",
3238
+ options: [
3239
+ {
3240
+ flags: "--mode <mode>",
3241
+ description: "cheapest_available | all | custom",
3242
+ arg: "mode",
3243
+ type: "string",
3244
+ required: true
3245
+ },
3246
+ {
3247
+ flags: "--list-id <id>",
3248
+ description: "Steering list ID from `carrier steering list`. Required when --mode is custom.",
3249
+ arg: "steeringListId",
3250
+ type: "number"
3251
+ }
3252
+ ],
3253
+ write: true
3254
+ },
3255
+ {
3256
+ name: "plan",
3257
+ tool: "plan_network_default",
3258
+ summary: "Show which networks a SIM would get in the given countries. Read only. Falls back to all networks with a loud warning when the tariff is missing.",
3259
+ options: [
3260
+ {
3261
+ flags: "--countries <codes>",
3262
+ description: "Comma-separated ISO-3166 alpha-2 codes, e.g. CA,US",
3263
+ arg: "countries",
3264
+ type: "string[]",
3265
+ required: true
3266
+ },
3267
+ {
3268
+ flags: "--sim-mode <mode>",
3269
+ description: "Override for this SIM: cheapest_available | all | custom",
3270
+ arg: "simOverride.mode",
3271
+ type: "string"
3272
+ },
3273
+ {
3274
+ flags: "--sim-list-id <id>",
3275
+ description: "Steering list ID when --sim-mode is custom",
3276
+ arg: "simOverride.steeringListId",
3277
+ type: "number"
3278
+ },
3279
+ {
3280
+ flags: "--package-mode <mode>",
3281
+ description: "Override for this package: cheapest_available | all | custom",
3282
+ arg: "packageOverride.mode",
3283
+ type: "string"
3284
+ },
3285
+ {
3286
+ flags: "--package-list-id <id>",
3287
+ description: "Steering list ID when --package-mode is custom",
3288
+ arg: "packageOverride.steeringListId",
3289
+ type: "number"
3290
+ },
3291
+ RESELLER_ID
3292
+ ]
3293
+ }
3294
+ ]
3295
+ },
3208
3296
  {
3209
3297
  name: "accounts",
3210
3298
  summary: "Reseller accounts: balances and subscriber moves.",
@@ -5983,7 +6071,7 @@ site.command("deploy [dir]").description("Build + deploy a storefront to whichev
5983
6071
  p3.outro("");
5984
6072
  }
5985
6073
  );
5986
- site.command("publish").description("Publish a Carrier-hosted storefront. Does not deploy a self-hosted copy.").requiredOption("--slug <slug>", "Shop address, such as acme or Acme Mobile").requiredOption("--name <name>", "Brand name").option("--status <status>", "draft or published", "published").option("--accent <hex>", "Accent color, such as #112233").option("--accent-dark <hex>", "Darker accent").option("--bg <hex>", "Page background").option("--text <hex>", "Body text color").option("--logo <url-or-file>", "https logo address, or a PNG, JPEG, WebP, or GIF under 70 KB").option("--hero <text>", "Shop headline").option("--tagline <text>", "Line under the headline").option("--support-email <email>", "Support address").option("--legal-name <name>", "Legal name in the footer").option("--product <id>", "Connectivity plan id. Copies its template, price, and allowance.").option("--plan <slug>", "Plan slug, such as eu-1gb").option("--plan-name <name>", "Plan name on the shop").option("--price <amount>", "Retail price, such as 9.00").option("--price-cents <cents>", "Retail price in minor units").option("--currency <code>", "Three-letter currency code").option("--template-id <id>", "OCS package template id").option("--data-gb <gb>", "Data allowance, such as 1 or 1 GB").option("--validity-days <days>", "Validity, such as 7 or 7 days").option("--countries <names>", "Country names or codes, such as France, DE").option("--plan-text <text>", "Buyer-facing sentence. Omit to leave the saved text unchanged.").option("--inactive", "Keep the plan off the shop").action(async (o) => {
6074
+ site.command("publish").description("Publish a Carrier-hosted storefront. Does not deploy a self-hosted copy.").requiredOption("--slug <slug>", "Shop address, such as acme or Acme Mobile").requiredOption("--name <name>", "Brand name").option("--status <status>", "draft or published", "published").option("--accent <hex>", "Accent color, such as #112233").option("--accent-dark <hex>", "Darker accent").option("--bg <hex>", "Page background").option("--text <hex>", "Body text color").option("--logo <url-or-file>", "https logo address, or a PNG, JPEG, WebP, or GIF under 70 KB").option("--hero <text>", "Shop headline").option("--tagline <text>", "Line under the headline").option("--support-email <email>", "Support address").option("--legal-name <name>", "Legal name in the footer").option("--product <id>", "Connectivity plan id. Copies its template, price, and allowance.").option("--plan <slug>", "Plan slug, such as eu-1gb").option("--plan-name <name>", "Plan name on the shop").option("--price <amount>", "Retail price, such as 9.00").option("--price-cents <cents>", "Retail price in minor units").option("--currency <code>", "Three-letter currency code").option("--template-id <id>", "OCS package template id").option("--data-gb <gb>", "Data allowance, such as 1 or 1 GB, or the text Unlimited").option("--unlimited", "The only way to sell an unlimited plan. A 0 or missing --data-gb without this is refused.").option("--validity-days <days>", "Validity, such as 7 or 7 days").option("--countries <names>", "Country names or codes, such as France, DE").option("--plan-text <text>", "Buyer-facing sentence. Omit to leave the saved text unchanged.").option("--inactive", "Keep the plan off the shop").action(async (o) => {
5987
6075
  header();
5988
6076
  const built = hostedPublishInputFromFlags(o);
5989
6077
  if (!built.ok) {