@carrierllc/mcp 0.13.47 → 0.13.51
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/{chunk-4XUAUQ3U.js → chunk-NPAD6AA7.js} +53 -24
- package/dist/chunk-NPAD6AA7.js.map +1 -0
- package/dist/cli.js +102 -11
- package/dist/cli.js.map +1 -1
- package/dist/index.js +69 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/plugin/carrier/skills/storefront/SKILL.md +2 -2
- package/templates/storefront/CLERK.md +2 -0
- package/dist/chunk-4XUAUQ3U.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
deriveAccentDark,
|
|
15
15
|
deriveAccentLight,
|
|
16
16
|
deriveAccentPaletteSubs,
|
|
17
|
+
discoverSecrets,
|
|
17
18
|
extractSubscriberStatus,
|
|
18
19
|
fleetScreen,
|
|
19
20
|
formatProbes,
|
|
@@ -44,7 +45,7 @@ import {
|
|
|
44
45
|
verifyStorefront,
|
|
45
46
|
walletScreen,
|
|
46
47
|
which
|
|
47
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-NPAD6AA7.js";
|
|
48
49
|
import {
|
|
49
50
|
copyTree,
|
|
50
51
|
exists,
|
|
@@ -2144,7 +2145,17 @@ var COPY_FIELDS = [
|
|
|
2144
2145
|
["hero", "hero"],
|
|
2145
2146
|
["tagline", "tagline"],
|
|
2146
2147
|
["supportEmail", "supportEmail"],
|
|
2147
|
-
["legalName", "legalName"]
|
|
2148
|
+
["legalName", "legalName"],
|
|
2149
|
+
["address", "address"],
|
|
2150
|
+
["locale", "locale"],
|
|
2151
|
+
["intro", "intro"],
|
|
2152
|
+
["ctaLabel", "ctaLabel"],
|
|
2153
|
+
["howHeading", "howHeading"],
|
|
2154
|
+
["plansHeading", "plansHeading"],
|
|
2155
|
+
["buyLabel", "buyLabel"],
|
|
2156
|
+
["emptyPlansText", "emptyPlansText"],
|
|
2157
|
+
["searchHeading", "searchHeading"],
|
|
2158
|
+
["searchPlaceholder", "searchPlaceholder"]
|
|
2148
2159
|
];
|
|
2149
2160
|
function storefrontBrandPatch(input, existing) {
|
|
2150
2161
|
const theme = overlay(existing?.theme, input, THEME_FIELDS);
|
|
@@ -2170,6 +2181,9 @@ function completePlanInput(input, plans) {
|
|
|
2170
2181
|
input.description,
|
|
2171
2182
|
input.active,
|
|
2172
2183
|
input.sortOrder,
|
|
2184
|
+
input.group,
|
|
2185
|
+
input.availableFrom,
|
|
2186
|
+
input.availableUntil,
|
|
2173
2187
|
input.stripePriceId,
|
|
2174
2188
|
input.stripePriceMode
|
|
2175
2189
|
].some((value) => value !== void 0);
|
|
@@ -2200,6 +2214,8 @@ function storefrontPlanBody(input) {
|
|
|
2200
2214
|
}
|
|
2201
2215
|
const stripe = stripePriceFields(input.stripePriceId, input.stripePriceMode);
|
|
2202
2216
|
if (stripe && "error" in stripe) return stripe;
|
|
2217
|
+
const windowFields = planWindowFields(input);
|
|
2218
|
+
if (windowFields && "error" in windowFields) return windowFields;
|
|
2203
2219
|
const productId = input.productId?.trim() ?? "";
|
|
2204
2220
|
if (productId !== "") {
|
|
2205
2221
|
const body2 = { product_id: productId };
|
|
@@ -2207,7 +2223,7 @@ function storefrontPlanBody(input) {
|
|
|
2207
2223
|
if (input.priceCents !== void 0) body2.price_cents = input.priceCents;
|
|
2208
2224
|
if (input.active !== void 0) body2.active = input.active;
|
|
2209
2225
|
if (input.sortOrder !== void 0) body2.sort_order = input.sortOrder;
|
|
2210
|
-
return
|
|
2226
|
+
return { ...body2, ...windowFields ?? {}, ...stripe ?? {} };
|
|
2211
2227
|
}
|
|
2212
2228
|
const touched = [
|
|
2213
2229
|
input.slug,
|
|
@@ -2223,6 +2239,9 @@ function storefrontPlanBody(input) {
|
|
|
2223
2239
|
input.description,
|
|
2224
2240
|
input.active,
|
|
2225
2241
|
input.sortOrder,
|
|
2242
|
+
input.group,
|
|
2243
|
+
input.availableFrom,
|
|
2244
|
+
input.availableUntil,
|
|
2226
2245
|
input.stripePriceId,
|
|
2227
2246
|
input.stripePriceMode
|
|
2228
2247
|
].some((value) => value !== void 0);
|
|
@@ -2248,7 +2267,41 @@ function storefrontPlanBody(input) {
|
|
|
2248
2267
|
if (input.description !== void 0) body.description = input.description;
|
|
2249
2268
|
if (input.active !== void 0) body.active = input.active;
|
|
2250
2269
|
if (input.sortOrder !== void 0) body.sort_order = input.sortOrder;
|
|
2251
|
-
return
|
|
2270
|
+
return { ...body, ...windowFields ?? {}, ...stripe ?? {} };
|
|
2271
|
+
}
|
|
2272
|
+
function planWindowFields(input) {
|
|
2273
|
+
const out = {};
|
|
2274
|
+
let touched = false;
|
|
2275
|
+
if (input.group !== void 0) {
|
|
2276
|
+
out.group = input.group === null || input.group.trim() === "" ? null : input.group.trim().slice(0, 80);
|
|
2277
|
+
touched = true;
|
|
2278
|
+
}
|
|
2279
|
+
if (input.availableFrom !== void 0) {
|
|
2280
|
+
if (input.availableFrom === null || input.availableFrom.trim() === "") {
|
|
2281
|
+
out.available_from = null;
|
|
2282
|
+
} else {
|
|
2283
|
+
const ms = Date.parse(input.availableFrom.trim());
|
|
2284
|
+
if (!Number.isFinite(ms)) return { error: "available_from must be an ISO-8601 date or timestamp." };
|
|
2285
|
+
out.available_from = new Date(ms).toISOString();
|
|
2286
|
+
}
|
|
2287
|
+
touched = true;
|
|
2288
|
+
}
|
|
2289
|
+
if (input.availableUntil !== void 0) {
|
|
2290
|
+
if (input.availableUntil === null || input.availableUntil.trim() === "") {
|
|
2291
|
+
out.available_until = null;
|
|
2292
|
+
} else {
|
|
2293
|
+
const trimmed = input.availableUntil.trim();
|
|
2294
|
+
const expanded = /^\d{4}-\d{2}-\d{2}$/.test(trimmed) ? `${trimmed}T23:59:59.999Z` : trimmed;
|
|
2295
|
+
const ms = Date.parse(expanded);
|
|
2296
|
+
if (!Number.isFinite(ms)) return { error: "available_until must be an ISO-8601 date or timestamp." };
|
|
2297
|
+
out.available_until = new Date(ms).toISOString();
|
|
2298
|
+
}
|
|
2299
|
+
touched = true;
|
|
2300
|
+
}
|
|
2301
|
+
if (out.available_from && out.available_until && Date.parse(out.available_from) > Date.parse(out.available_until)) {
|
|
2302
|
+
return { error: "available_from must not be after available_until." };
|
|
2303
|
+
}
|
|
2304
|
+
return touched ? out : void 0;
|
|
2252
2305
|
}
|
|
2253
2306
|
function stripePriceFields(id, mode) {
|
|
2254
2307
|
if (id === void 0 && mode === void 0) return void 0;
|
|
@@ -2369,6 +2422,10 @@ function hostedPublishInputFromFlags(flags) {
|
|
|
2369
2422
|
if (stripeMode !== void 0 && stripeMode !== "test" && stripeMode !== "live") {
|
|
2370
2423
|
return { ok: false, text: "stripe_price_mode must be test or live." };
|
|
2371
2424
|
}
|
|
2425
|
+
const locale = flags.locale === void 0 ? void 0 : flags.locale.trim().toLowerCase();
|
|
2426
|
+
if (locale !== void 0 && locale !== "en" && locale !== "nl") {
|
|
2427
|
+
return { ok: false, text: "Locale must be en or nl." };
|
|
2428
|
+
}
|
|
2372
2429
|
return {
|
|
2373
2430
|
ok: true,
|
|
2374
2431
|
input: {
|
|
@@ -2384,6 +2441,16 @@ function hostedPublishInputFromFlags(flags) {
|
|
|
2384
2441
|
tagline: flags.tagline,
|
|
2385
2442
|
supportEmail: flags.supportEmail,
|
|
2386
2443
|
legalName: flags.legalName,
|
|
2444
|
+
address: flags.address,
|
|
2445
|
+
locale,
|
|
2446
|
+
intro: flags.intro,
|
|
2447
|
+
ctaLabel: flags.ctaLabel,
|
|
2448
|
+
howHeading: flags.howHeading,
|
|
2449
|
+
plansHeading: flags.plansHeading,
|
|
2450
|
+
buyLabel: flags.buyLabel,
|
|
2451
|
+
emptyPlansText: flags.emptyPlansText,
|
|
2452
|
+
searchHeading: flags.searchHeading,
|
|
2453
|
+
searchPlaceholder: flags.searchPlaceholder,
|
|
2387
2454
|
productId: flags.product,
|
|
2388
2455
|
planSlug: flags.plan,
|
|
2389
2456
|
planName: flags.planName,
|
|
@@ -2398,6 +2465,9 @@ function hostedPublishInputFromFlags(flags) {
|
|
|
2398
2465
|
description: flags.planText,
|
|
2399
2466
|
planActive: flags.inactive ? false : void 0,
|
|
2400
2467
|
planSortOrder: sortOrder.value,
|
|
2468
|
+
planGroup: flags.planGroup,
|
|
2469
|
+
availableFrom: flags.availableFrom,
|
|
2470
|
+
availableUntil: flags.availableUntil,
|
|
2401
2471
|
stripePriceId: flags.stripePriceId,
|
|
2402
2472
|
stripePriceMode: stripeMode
|
|
2403
2473
|
}
|
|
@@ -2461,6 +2531,9 @@ function planInput(input) {
|
|
|
2461
2531
|
description: input.description,
|
|
2462
2532
|
active: input.planActive,
|
|
2463
2533
|
sortOrder: input.planSortOrder,
|
|
2534
|
+
group: input.planGroup,
|
|
2535
|
+
availableFrom: input.availableFrom,
|
|
2536
|
+
availableUntil: input.availableUntil,
|
|
2464
2537
|
stripePriceId: input.stripePriceId,
|
|
2465
2538
|
stripePriceMode: input.stripePriceMode
|
|
2466
2539
|
};
|
|
@@ -6533,7 +6606,7 @@ async function maybeBuildDeploy(target, brand, opts) {
|
|
|
6533
6606
|
}
|
|
6534
6607
|
if (r.url) info(pc4.green(r.url));
|
|
6535
6608
|
if (opts.clerk && r.url) {
|
|
6536
|
-
const secretKey = process.env.CLERK_SECRET_KEY?.trim();
|
|
6609
|
+
const secretKey = process.env.CLERK_SECRET_KEY?.trim() || (await discoverSecrets(target, process.env)).CLERK_SECRET_KEY?.trim();
|
|
6537
6610
|
if (secretKey) {
|
|
6538
6611
|
const { allowedOrigins, redirectUrls } = storefrontClerkUrls(r.url, brand.domain);
|
|
6539
6612
|
const configured = await configureClerkInstance(secretKey, { allowedOrigins, redirectUrls });
|
|
@@ -6574,7 +6647,18 @@ async function verifyAndRepair(storefront, brand, url, targetId, projectName, op
|
|
|
6574
6647
|
}
|
|
6575
6648
|
const rs = p3.spinner();
|
|
6576
6649
|
rs.start(`Repairing: ${plan.note}`);
|
|
6577
|
-
if (plan.runClerk)
|
|
6650
|
+
if (plan.runClerk) {
|
|
6651
|
+
const provisioned = await runClerkStep(storefront, brand, url);
|
|
6652
|
+
if (!provisioned) {
|
|
6653
|
+
rs.stop("Repair skipped: Clerk could not be provisioned");
|
|
6654
|
+
info(
|
|
6655
|
+
pc4.yellow(
|
|
6656
|
+
"The storefront stays live without sign-in. Set CLERK_PLATFORM_API_KEY or add existing Clerk keys to .env.local, then redeploy."
|
|
6657
|
+
)
|
|
6658
|
+
);
|
|
6659
|
+
return;
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6578
6662
|
if (plan.rebuild) {
|
|
6579
6663
|
const rebuilt = await buildSite(storefront, targetId);
|
|
6580
6664
|
if (!rebuilt) {
|
|
@@ -6612,10 +6696,14 @@ async function verifyAndRepair(storefront, brand, url, targetId, projectName, op
|
|
|
6612
6696
|
async function runClerkStep(storefront, brand, deployedUrl) {
|
|
6613
6697
|
const s = p3.spinner();
|
|
6614
6698
|
s.start("Provisioning Clerk");
|
|
6699
|
+
const env = { ...process.env, ...await discoverSecrets(storefront, process.env) };
|
|
6615
6700
|
const result = await provisionClerk({
|
|
6616
6701
|
name: brand.name,
|
|
6617
6702
|
domain: brand.domain,
|
|
6618
|
-
|
|
6703
|
+
// carrier site deploy ships a production storefront, so a platform-tier
|
|
6704
|
+
// application must be created with a production instance, not a dev one.
|
|
6705
|
+
production: true,
|
|
6706
|
+
env,
|
|
6619
6707
|
storefront,
|
|
6620
6708
|
cli: clerkCliDeps()
|
|
6621
6709
|
});
|
|
@@ -6623,7 +6711,7 @@ async function runClerkStep(storefront, brand, deployedUrl) {
|
|
|
6623
6711
|
s.stop("Clerk not configured");
|
|
6624
6712
|
if (result.reason) info(pc4.yellow(result.reason));
|
|
6625
6713
|
if (result.guidance) p3.note(result.guidance.join("\n"), "Set up Clerk");
|
|
6626
|
-
return;
|
|
6714
|
+
return false;
|
|
6627
6715
|
}
|
|
6628
6716
|
const { credentials } = result;
|
|
6629
6717
|
s.stop(
|
|
@@ -6646,6 +6734,7 @@ async function runClerkStep(storefront, brand, deployedUrl) {
|
|
|
6646
6734
|
});
|
|
6647
6735
|
if (configured.applied.length) info(pc4.dim(`Clerk configured: ${configured.applied.length} settings`));
|
|
6648
6736
|
for (const f of configured.failed) info(pc4.yellow(`Clerk ${f.step}: ${f.reason}`));
|
|
6737
|
+
return true;
|
|
6649
6738
|
}
|
|
6650
6739
|
async function interactiveSiteCreate() {
|
|
6651
6740
|
const brand = await promptBrand(CARRIER_BRAND);
|
|
@@ -7246,7 +7335,9 @@ site.command("create [dir]").description("Scaffold a white-labeled storefront fr
|
|
|
7246
7335
|
}
|
|
7247
7336
|
p3.outro(pc4.green(`Scaffolded. cd ${dir ?? "storefront"} && pnpm install && pnpm dev`));
|
|
7248
7337
|
});
|
|
7249
|
-
site.command("deploy [dir]").description(
|
|
7338
|
+
site.command("deploy [dir]").description(
|
|
7339
|
+
"Build + deploy a storefront to whichever host is available on this box. Clerk is provisioned and configured automatically; pass --no-clerk to skip."
|
|
7340
|
+
).option("--name <name>", "Project/worker name (defaults from brand)").option("--force", "Deploy under the scaffold default name anyway (acknowledges the overwrite risk)").option(`--target <target>`, `Force a host: ${TARGET_IDS.join(" | ")}`).option("--no-secrets", "Skip staging runtime secrets on the host").option("--no-clerk", "Skip Clerk provisioning and configuration (default is to do it)").option("--no-verify", "Skip the post-deploy check that the site actually serves").option("--autofix-agent", "On an unrecognised failure, print an agent-ready diagnosis bundle").option("--domain", "Route the brand domain to the deployment (Cloudflare provisions DNS + cert)").action(
|
|
7250
7341
|
async (dir, o) => {
|
|
7251
7342
|
header();
|
|
7252
7343
|
const target = resolve4(dir ?? "./storefront");
|
|
@@ -7263,7 +7354,7 @@ site.command("deploy [dir]").description("Build + deploy a storefront to whichev
|
|
|
7263
7354
|
deploy: true,
|
|
7264
7355
|
preferred: o.target,
|
|
7265
7356
|
pushSecrets: o.secrets !== false,
|
|
7266
|
-
clerk: o.clerk
|
|
7357
|
+
clerk: o.clerk !== false,
|
|
7267
7358
|
verify: o.verify !== false,
|
|
7268
7359
|
autofixAgent: o.autofixAgent === true,
|
|
7269
7360
|
customDomain: o.domain === true,
|
|
@@ -7281,7 +7372,7 @@ site.command("deploy [dir]").description("Build + deploy a storefront to whichev
|
|
|
7281
7372
|
p3.outro("");
|
|
7282
7373
|
}
|
|
7283
7374
|
);
|
|
7284
|
-
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("--ocs-account-id <id>", "Owned OCS account override; omit for automatic resolution").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").option("--plan-sort-order <n>", "Plan display order on the shop (ascending, default 0)").option("--stripe-price-id <id>", "Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with --stripe-price-mode.").option("--stripe-price-mode <mode>", "test or live. Set with --stripe-price-id.").action(async (o) => {
|
|
7375
|
+
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("--address <text>", "Seller address in the footer").option("--locale <locale>", "Storefront language: en or nl").option("--cta-label <text>", "Hero primary button text").option("--plans-heading <text>", "Heading for the plans section").option("--buy-label <text>", "Button text on each plan card").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("--ocs-account-id <id>", "Owned OCS account override; omit for automatic resolution").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").option("--plan-sort-order <n>", "Plan display order on the shop (ascending, default 0)").option("--plan-group <label>", "Optional section/group label on the storefront (e.g. Uitwedstrijden)").option("--available-from <iso>", "Optional ISO-8601 start timestamp from which the plan is visible").option("--available-until <iso>", "Optional ISO-8601 end timestamp until which the plan is visible").option("--stripe-price-id <id>", "Existing Stripe Price id (price_\u2026, 1-255 characters), stored, not yet charged. Set with --stripe-price-mode.").option("--stripe-price-mode <mode>", "test or live. Set with --stripe-price-id.").action(async (o) => {
|
|
7285
7376
|
header();
|
|
7286
7377
|
const built = hostedPublishInputFromFlags(o);
|
|
7287
7378
|
if (!built.ok) {
|