siteplane 0.1.61 → 0.1.62

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.
@@ -2167,8 +2167,95 @@ var editorColorSchemes = editorColorSchemeSchema.options;
2167
2167
  var editorColorModeSchema = z20.enum(["light", "dark"]);
2168
2168
  var editorColorModes = editorColorModeSchema.options;
2169
2169
 
2170
- // ../shared/dist/site-slug.js
2170
+ // ../shared/dist/editor-organization.js
2171
2171
  import { z as z21 } from "zod";
2172
+ var labelSchema = z21.string().trim().min(1).max(120);
2173
+ var updateFieldSchema = z21.object({
2174
+ operation: z21.literal("update_field"),
2175
+ siteId: z21.string().uuid(),
2176
+ fieldId: fieldIdSchema,
2177
+ label: labelSchema.optional(),
2178
+ description: z21.string().trim().max(500).nullable().optional(),
2179
+ section: labelSchema.nullable().optional(),
2180
+ subsection: labelSchema.nullable().optional(),
2181
+ sortOrder: z21.number().int().nonnegative().optional(),
2182
+ status: z21.enum(["hidden", "active"]).optional()
2183
+ });
2184
+ var updateEditorOrganizationInputSchema = z21.discriminatedUnion("operation", [
2185
+ updateFieldSchema,
2186
+ z21.object({
2187
+ operation: z21.literal("rename_section"),
2188
+ siteId: z21.string().uuid(),
2189
+ routeKey: siteFieldRouteKeySchema,
2190
+ currentSection: labelSchema,
2191
+ nextSection: labelSchema
2192
+ }),
2193
+ z21.object({
2194
+ operation: z21.literal("create_group"),
2195
+ siteId: z21.string().uuid(),
2196
+ routeKey: siteFieldRouteKeySchema,
2197
+ section: labelSchema,
2198
+ fieldIds: z21.array(fieldIdSchema).max(200).default([])
2199
+ }),
2200
+ z21.object({
2201
+ operation: z21.literal("delete_section"),
2202
+ siteId: z21.string().uuid(),
2203
+ routeKey: siteFieldRouteKeySchema,
2204
+ section: labelSchema
2205
+ }),
2206
+ z21.object({
2207
+ operation: z21.literal("move_section"),
2208
+ siteId: z21.string().uuid(),
2209
+ routeKey: siteFieldRouteKeySchema,
2210
+ section: labelSchema,
2211
+ direction: z21.enum(["up", "down"])
2212
+ }),
2213
+ z21.object({
2214
+ operation: z21.literal("create_subgroup"),
2215
+ siteId: z21.string().uuid(),
2216
+ routeKey: siteFieldRouteKeySchema,
2217
+ section: labelSchema,
2218
+ subsection: labelSchema,
2219
+ fieldIds: z21.array(fieldIdSchema).min(1).max(200)
2220
+ }),
2221
+ z21.object({
2222
+ operation: z21.literal("update_subgroup"),
2223
+ siteId: z21.string().uuid(),
2224
+ routeKey: siteFieldRouteKeySchema,
2225
+ currentSection: labelSchema,
2226
+ currentSubsection: labelSchema,
2227
+ section: labelSchema,
2228
+ subsection: labelSchema.nullable()
2229
+ }),
2230
+ z21.object({
2231
+ operation: z21.literal("rename_route"),
2232
+ siteId: z21.string().uuid(),
2233
+ routeKey: siteFieldRouteKeySchema.refine((value) => value !== "$global", "Global content has no page label."),
2234
+ label: labelSchema
2235
+ })
2236
+ ]).and(z21.object({
2237
+ review: z21.object({
2238
+ runId: z21.string().uuid(),
2239
+ expectedReviewVersion: z21.number().int().positive()
2240
+ }).strict().optional()
2241
+ })).superRefine((input, context) => {
2242
+ if (input.operation === "update_field" && input.label === void 0 && input.description === void 0 && input.section === void 0 && input.subsection === void 0 && input.sortOrder === void 0 && input.status === void 0) {
2243
+ context.addIssue({
2244
+ code: "custom",
2245
+ message: "At least one field organization value is required."
2246
+ });
2247
+ }
2248
+ if (input.operation === "update_field" && input.section === null && typeof input.subsection === "string") {
2249
+ context.addIssue({
2250
+ code: "custom",
2251
+ message: "A subgroup requires a group.",
2252
+ path: ["subsection"]
2253
+ });
2254
+ }
2255
+ });
2256
+
2257
+ // ../shared/dist/site-slug.js
2258
+ import { z as z22 } from "zod";
2172
2259
  var SITE_SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
2173
2260
  var RESERVED_SITE_SLUGS = /* @__PURE__ */ new Set([
2174
2261
  "account",
@@ -2185,31 +2272,31 @@ var RESERVED_SITE_SLUGS = /* @__PURE__ */ new Set([
2185
2272
  "support",
2186
2273
  "workspace"
2187
2274
  ]);
2188
- var siteSlugSchema = z21.string().regex(SITE_SLUG_PATTERN, "Invalid site slug").refine((value) => !RESERVED_SITE_SLUGS.has(value), "Reserved site slug");
2275
+ var siteSlugSchema = z22.string().regex(SITE_SLUG_PATTERN, "Invalid site slug").refine((value) => !RESERVED_SITE_SLUGS.has(value), "Reserved site slug");
2189
2276
 
2190
2277
  // ../shared/dist/entitlements.js
2191
- import { z as z22 } from "zod";
2192
- var entitlementSnapshotSchema = z22.object({
2193
- planKey: z22.string().trim().min(1),
2194
- sitesLimit: z22.number().int().positive(),
2195
- siteMembersPerSiteLimit: z22.number().int().positive(),
2196
- customAdminDomainsEnabled: z22.boolean(),
2197
- agentMcpEnabled: z22.boolean(),
2198
- emailNotificationsEnabled: z22.boolean(),
2199
- analyticsEnabled: z22.boolean(),
2200
- analyticsSitesLimit: z22.number().int().min(0),
2201
- analyticsPortalPerformanceEnabled: z22.boolean(),
2202
- analyticsMonthlyReportsEnabled: z22.boolean(),
2203
- analyticsAiSummaryEnabled: z22.boolean(),
2204
- analyticsRawEventRetentionDays: z22.number().int().min(1).max(ANALYTICS_RETENTION_DEFAULTS.maxRawEventRetentionDaysWithoutAdr),
2205
- analyticsMonthlyEventLimit: z22.number().int().min(0),
2206
- bookingEnabled: z22.boolean().default(false),
2207
- bookingSitesLimit: z22.number().int().min(0).default(0),
2208
- bookingPortalManagementEnabled: z22.boolean().default(false),
2209
- bookingResourcesPerSiteLimit: z22.number().int().min(0).default(0),
2210
- bookingServicesPerSiteLimit: z22.number().int().min(0).default(0),
2211
- bookingMonthlyBookingsLimit: z22.number().int().min(0).default(0),
2212
- bookingRemindersEnabled: z22.boolean().default(false)
2278
+ import { z as z23 } from "zod";
2279
+ var entitlementSnapshotSchema = z23.object({
2280
+ planKey: z23.string().trim().min(1),
2281
+ sitesLimit: z23.number().int().positive(),
2282
+ siteMembersPerSiteLimit: z23.number().int().positive(),
2283
+ customAdminDomainsEnabled: z23.boolean(),
2284
+ agentMcpEnabled: z23.boolean(),
2285
+ emailNotificationsEnabled: z23.boolean(),
2286
+ analyticsEnabled: z23.boolean(),
2287
+ analyticsSitesLimit: z23.number().int().min(0),
2288
+ analyticsPortalPerformanceEnabled: z23.boolean(),
2289
+ analyticsMonthlyReportsEnabled: z23.boolean(),
2290
+ analyticsAiSummaryEnabled: z23.boolean(),
2291
+ analyticsRawEventRetentionDays: z23.number().int().min(1).max(ANALYTICS_RETENTION_DEFAULTS.maxRawEventRetentionDaysWithoutAdr),
2292
+ analyticsMonthlyEventLimit: z23.number().int().min(0),
2293
+ bookingEnabled: z23.boolean().default(false),
2294
+ bookingSitesLimit: z23.number().int().min(0).default(0),
2295
+ bookingPortalManagementEnabled: z23.boolean().default(false),
2296
+ bookingResourcesPerSiteLimit: z23.number().int().min(0).default(0),
2297
+ bookingServicesPerSiteLimit: z23.number().int().min(0).default(0),
2298
+ bookingMonthlyBookingsLimit: z23.number().int().min(0).default(0),
2299
+ bookingRemindersEnabled: z23.boolean().default(false)
2213
2300
  });
2214
2301
  var EARLY_ACCESS_PLAN = {
2215
2302
  planKey: "early_access_2026",
@@ -2238,7 +2325,7 @@ var EARLY_ACCESS_PLAN = {
2238
2325
  var maxFirstPartyImageUploadBytes = 4 * 1024 * 1024;
2239
2326
 
2240
2327
  // ../shared/dist/readiness.js
2241
- import { z as z23 } from "zod";
2328
+ import { z as z24 } from "zod";
2242
2329
  var READINESS_CHECK_KEYS = [
2243
2330
  "agent_instructions_installed",
2244
2331
  "runtime_package_connected",
@@ -2253,118 +2340,118 @@ var READINESS_STATUSES = [
2253
2340
  "failing",
2254
2341
  "warning"
2255
2342
  ];
2256
- var readinessCheckKeySchema = z23.enum(READINESS_CHECK_KEYS);
2257
- var readinessStatusSchema = z23.enum(READINESS_STATUSES);
2343
+ var readinessCheckKeySchema = z24.enum(READINESS_CHECK_KEYS);
2344
+ var readinessStatusSchema = z24.enum(READINESS_STATUSES);
2258
2345
 
2259
2346
  // ../shared/dist/site.js
2260
- import { z as z24 } from "zod";
2347
+ import { z as z25 } from "zod";
2261
2348
  var SITE_STATUSES = [
2262
2349
  "setup",
2263
2350
  "active",
2264
2351
  "disabled",
2265
2352
  "archived"
2266
2353
  ];
2267
- var siteStatusSchema = z24.enum(SITE_STATUSES);
2268
- var websiteUrlSchema = z24.string().trim().url().refine((value) => value.startsWith("https://") || value.startsWith("http://"), "Website URL must use http or https");
2354
+ var siteStatusSchema = z25.enum(SITE_STATUSES);
2355
+ var websiteUrlSchema = z25.string().trim().url().refine((value) => value.startsWith("https://") || value.startsWith("http://"), "Website URL must use http or https");
2269
2356
 
2270
2357
  // ../shared/dist/setup-assets.js
2271
- import { z as z25 } from "zod";
2272
- var configureSetupAssetTargetInputSchema = z25.object({
2273
- siteId: z25.string().uuid(),
2274
- runId: z25.string().uuid(),
2275
- expectedReviewVersion: z25.number().int().positive(),
2276
- expectedSnapshotHash: z25.string().regex(/^sha256:[0-9a-f]{64}$/u),
2277
- mutationId: z25.string().uuid(),
2278
- expectedApprovalId: z25.string().uuid().nullable(),
2279
- targetId: z25.string().uuid().nullable(),
2280
- targetType: z25.enum(["repo_static_assets", "siteplane_managed_fallback"]),
2281
- approveManagedHosting: z25.boolean()
2358
+ import { z as z26 } from "zod";
2359
+ var configureSetupAssetTargetInputSchema = z26.object({
2360
+ siteId: z26.string().uuid(),
2361
+ runId: z26.string().uuid(),
2362
+ expectedReviewVersion: z26.number().int().positive(),
2363
+ expectedSnapshotHash: z26.string().regex(/^sha256:[0-9a-f]{64}$/u),
2364
+ mutationId: z26.string().uuid(),
2365
+ expectedApprovalId: z26.string().uuid().nullable(),
2366
+ targetId: z26.string().uuid().nullable(),
2367
+ targetType: z26.enum(["repo_static_assets", "siteplane_managed_fallback"]),
2368
+ approveManagedHosting: z26.boolean()
2282
2369
  }).strict().refine((value) => value.targetType === "siteplane_managed_fallback" || !value.approveManagedHosting);
2283
- var setupAssetTargetApprovalSchema = z25.object({
2284
- id: z25.string().uuid(),
2285
- runId: z25.string().uuid(),
2286
- reviewVersion: z25.number().int().positive(),
2287
- snapshotHash: z25.string().regex(/^sha256:[0-9a-f]{64}$/u),
2288
- targetId: z25.string().uuid(),
2289
- targetType: z25.enum(["repo_static_assets", "siteplane_managed_fallback"]),
2290
- targetRevision: z25.number().int().positive(),
2291
- deploymentOrigin: z25.string().url(),
2292
- gitConnectionId: z25.string().uuid().nullable(),
2293
- gitRevision: z25.number().int().positive().nullable(),
2294
- managedHostingApproved: z25.boolean(),
2295
- actorUserId: z25.string().uuid(),
2296
- approvedAt: z25.string().datetime({ offset: true })
2370
+ var setupAssetTargetApprovalSchema = z26.object({
2371
+ id: z26.string().uuid(),
2372
+ runId: z26.string().uuid(),
2373
+ reviewVersion: z26.number().int().positive(),
2374
+ snapshotHash: z26.string().regex(/^sha256:[0-9a-f]{64}$/u),
2375
+ targetId: z26.string().uuid(),
2376
+ targetType: z26.enum(["repo_static_assets", "siteplane_managed_fallback"]),
2377
+ targetRevision: z26.number().int().positive(),
2378
+ deploymentOrigin: z26.string().url(),
2379
+ gitConnectionId: z26.string().uuid().nullable(),
2380
+ gitRevision: z26.number().int().positive().nullable(),
2381
+ managedHostingApproved: z26.boolean(),
2382
+ actorUserId: z26.string().uuid(),
2383
+ approvedAt: z26.string().datetime({ offset: true })
2297
2384
  }).strict();
2298
- var setupAssetReadinessSchema = z25.union([
2299
- z25.object({
2300
- status: z25.enum([
2385
+ var setupAssetReadinessSchema = z26.union([
2386
+ z26.object({
2387
+ status: z26.enum([
2301
2388
  "not_required",
2302
2389
  "needs_choice",
2303
2390
  "stale_setup_review",
2304
2391
  "permission_denied"
2305
2392
  ])
2306
2393
  }).strict(),
2307
- z25.object({
2308
- status: z25.literal("stale_approval"),
2394
+ z26.object({
2395
+ status: z26.literal("stale_approval"),
2309
2396
  approval: setupAssetTargetApprovalSchema.optional()
2310
2397
  }).strict(),
2311
- z25.object({
2312
- status: z25.literal("not_verified"),
2398
+ z26.object({
2399
+ status: z26.literal("not_verified"),
2313
2400
  approval: setupAssetTargetApprovalSchema,
2314
- jobId: z25.string().uuid().optional(),
2315
- checkedAt: z25.string().datetime({ offset: true }).nullable().optional()
2401
+ jobId: z26.string().uuid().optional(),
2402
+ checkedAt: z26.string().datetime({ offset: true }).nullable().optional()
2316
2403
  }).strict(),
2317
- z25.object({
2318
- status: z25.enum(["ready", "checking", "retrying"]),
2404
+ z26.object({
2405
+ status: z26.enum(["ready", "checking", "retrying"]),
2319
2406
  approval: setupAssetTargetApprovalSchema,
2320
- jobId: z25.string().uuid(),
2321
- checkedAt: z25.string().datetime({ offset: true }).nullable()
2407
+ jobId: z26.string().uuid(),
2408
+ checkedAt: z26.string().datetime({ offset: true }).nullable()
2322
2409
  }).strict().refine((value) => value.status !== "ready" || value.checkedAt !== null)
2323
2410
  ]);
2324
- var checkSetupAssetTargetInputSchema = z25.object({
2325
- siteId: z25.string().uuid(),
2326
- runId: z25.string().uuid(),
2327
- approvalId: z25.string().uuid(),
2328
- intent: z25.enum(["start", "poll"])
2411
+ var checkSetupAssetTargetInputSchema = z26.object({
2412
+ siteId: z26.string().uuid(),
2413
+ runId: z26.string().uuid(),
2414
+ approvalId: z26.string().uuid(),
2415
+ intent: z26.enum(["start", "poll"])
2329
2416
  }).strict();
2330
2417
 
2331
2418
  // ../shared/dist/setup-installation.js
2332
- import { z as z26 } from "zod";
2333
- var setupInstallationRequestSchema = z26.object({
2419
+ import { z as z27 } from "zod";
2420
+ var setupInstallationRequestSchema = z27.object({
2334
2421
  modules: siteSetupModulesSchema,
2335
2422
  ownerEditabilityNote: siteSetupOwnerEditabilityNoteSchema,
2336
- provider: z26.object({
2337
- projectId: z26.string().min(1).max(200),
2338
- teamId: z26.string().min(1).max(200)
2423
+ provider: z27.object({
2424
+ projectId: z27.string().min(1).max(200),
2425
+ teamId: z27.string().min(1).max(200)
2339
2426
  }).strict()
2340
2427
  }).strict();
2341
2428
 
2342
2429
  // ../shared/dist/setup-claim.js
2343
- import { z as z27 } from "zod";
2344
- var setupClaimCodeSchema = z27.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/u);
2345
- var setupClaimBindingSchema = z27.object({
2346
- siteId: z27.string().uuid(),
2347
- runId: z27.string().uuid()
2430
+ import { z as z28 } from "zod";
2431
+ var setupClaimCodeSchema = z28.string().regex(/^[0-9A-HJKMNP-TV-Z]{8}$/u);
2432
+ var setupClaimBindingSchema = z28.object({
2433
+ siteId: z28.string().uuid(),
2434
+ runId: z28.string().uuid()
2348
2435
  });
2349
2436
  var setupClaimReceiptSchema = setupClaimBindingSchema.extend({
2350
- status: z27.literal("claimed"),
2351
- requestId: z27.string().uuid(),
2352
- workspaceId: z27.string().uuid(),
2353
- userId: z27.string().uuid(),
2354
- claimedAt: z27.string().datetime({ offset: true })
2437
+ status: z28.literal("claimed"),
2438
+ requestId: z28.string().uuid(),
2439
+ workspaceId: z28.string().uuid(),
2440
+ userId: z28.string().uuid(),
2441
+ claimedAt: z28.string().datetime({ offset: true })
2355
2442
  }).strict();
2356
2443
  var setupClaimInspectionSchema = setupClaimBindingSchema.extend({
2357
- status: z27.literal("pending"),
2358
- requestId: z27.string().uuid(),
2359
- siteName: z27.string(),
2360
- userId: z27.string().uuid(),
2361
- accountEmail: z27.string().email(),
2362
- workspaceId: z27.string().uuid(),
2363
- workspaceName: z27.string(),
2364
- expiresAt: z27.string().datetime({ offset: true })
2444
+ status: z28.literal("pending"),
2445
+ requestId: z28.string().uuid(),
2446
+ siteName: z28.string(),
2447
+ userId: z28.string().uuid(),
2448
+ accountEmail: z28.string().email(),
2449
+ workspaceId: z28.string().uuid(),
2450
+ workspaceName: z28.string(),
2451
+ expiresAt: z28.string().datetime({ offset: true })
2365
2452
  }).strict();
2366
- var setupClaimDenialSchema = z27.object({
2367
- status: z27.enum([
2453
+ var setupClaimDenialSchema = z28.object({
2454
+ status: z28.enum([
2368
2455
  "invalid_claim_request",
2369
2456
  "invalid_installation",
2370
2457
  "already_claimed",
@@ -3204,16 +3291,16 @@ async function analyticsReadinessCommand(input) {
3204
3291
  }
3205
3292
 
3206
3293
  // ../cli/dist/commands/analytics/public-key.js
3207
- import { z as z28 } from "zod";
3208
- var responseSchema = z28.object({
3209
- ok: z28.literal(true),
3210
- data: z28.object({
3211
- rawPublicKey: z28.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/)
3294
+ import { z as z29 } from "zod";
3295
+ var responseSchema = z29.object({
3296
+ ok: z29.literal(true),
3297
+ data: z29.object({
3298
+ rawPublicKey: z29.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/)
3212
3299
  })
3213
3300
  });
3214
- var errorResponseSchema = z28.object({
3215
- error: z28.object({
3216
- code: z28.string().regex(/^[a-z][a-z0-9_.-]+$/u)
3301
+ var errorResponseSchema = z29.object({
3302
+ error: z29.object({
3303
+ code: z29.string().regex(/^[a-z][a-z0-9_.-]+$/u)
3217
3304
  })
3218
3305
  });
3219
3306
  async function analyticsPublicKeyCommand(input) {
@@ -3235,13 +3322,13 @@ async function analyticsPublicKeyCommand(input) {
3235
3322
  }
3236
3323
 
3237
3324
  // ../cli/dist/commands/analytics/prepare.js
3238
- import { z as z29 } from "zod";
3239
- var resultSchema = z29.object({
3240
- ok: z29.literal(true),
3241
- data: z29.object({
3242
- rawPublicKey: z29.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/u),
3243
- generation: z29.number().int().positive(),
3244
- status: z29.enum([
3325
+ import { z as z30 } from "zod";
3326
+ var resultSchema = z30.object({
3327
+ ok: z30.literal(true),
3328
+ data: z30.object({
3329
+ rawPublicKey: z30.string().regex(/^pk_siteplane_[A-Za-z0-9_-]{16}_[A-Za-z0-9_-]{43}$/u),
3330
+ generation: z30.number().int().positive(),
3331
+ status: z30.enum([
3245
3332
  "setup_started",
3246
3333
  "test_mode",
3247
3334
  "active",
@@ -3251,8 +3338,8 @@ var resultSchema = z29.object({
3251
3338
  ])
3252
3339
  }).strict()
3253
3340
  }).strict();
3254
- var errorSchema = z29.object({
3255
- error: z29.object({ code: z29.string().regex(/^[a-z][a-z0-9_.-]+$/u) })
3341
+ var errorSchema = z30.object({
3342
+ error: z30.object({ code: z30.string().regex(/^[a-z][a-z0-9_.-]+$/u) })
3256
3343
  });
3257
3344
  async function analyticsPrepareCommand(input) {
3258
3345
  const response = await (input.fetchImpl ?? fetch)(`${input.config.apiBaseUrl.replace(/\/$/u, "")}/api/cli/analytics/prepare`, {
@@ -3472,19 +3559,19 @@ async function bookingTestCommand(input) {
3472
3559
  import { access, chmod, open, readFile as readFile5, rename, rm } from "fs/promises";
3473
3560
  import { randomUUID as randomUUID2 } from "crypto";
3474
3561
  import { join as join3 } from "path";
3475
- import { z as z30 } from "zod";
3476
- var siteplaneProjectConfigSchema = z30.object({
3477
- version: z30.literal(2),
3478
- apiBaseUrl: z30.string().url(),
3479
- siteId: z30.string().uuid(),
3480
- publicSiteKeyId: z30.string().uuid(),
3481
- publicSiteKey: z30.string().trim().min(1),
3482
- runId: z30.string().uuid(),
3483
- appDirectory: z30.string().min(1),
3484
- taskContractVersion: z30.literal("siteplane.setup-task.v2"),
3485
- adminProtocolVersion: z30.literal(2),
3562
+ import { z as z31 } from "zod";
3563
+ var siteplaneProjectConfigSchema = z31.object({
3564
+ version: z31.literal(2),
3565
+ apiBaseUrl: z31.string().url(),
3566
+ siteId: z31.string().uuid(),
3567
+ publicSiteKeyId: z31.string().uuid(),
3568
+ publicSiteKey: z31.string().trim().min(1),
3569
+ runId: z31.string().uuid(),
3570
+ appDirectory: z31.string().min(1),
3571
+ taskContractVersion: z31.literal("siteplane.setup-task.v2"),
3572
+ adminProtocolVersion: z31.literal(2),
3486
3573
  packages: siteSetupPackagesSchema,
3487
- fieldContractHash: z30.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
3574
+ fieldContractHash: z31.string().regex(/^sha256:[0-9a-f]{64}$/iu).optional()
3488
3575
  }).strict();
3489
3576
  async function readProjectPackageJson(projectDir) {
3490
3577
  return JSON.parse(await readFile5(join3(projectDir, "package.json"), "utf8"));
@@ -3544,27 +3631,27 @@ import { randomUUID as randomUUID3 } from "crypto";
3544
3631
  import { chmod as chmod2, lstat, mkdir as mkdir5, open as open2, readFile as readFile6, rename as rename2, rm as rm2 } from "fs/promises";
3545
3632
  import { dirname as dirname5, join as join4, relative } from "path";
3546
3633
  import { promisify } from "util";
3547
- import { z as z31 } from "zod";
3548
- var localSetupInstallationSchema = z31.object({
3549
- key: z31.string().regex(/^[A-Za-z0-9_-]{43}$/u),
3550
- idempotencyKey: z31.string().uuid(),
3551
- apiBaseUrl: z31.string().url(),
3634
+ import { z as z32 } from "zod";
3635
+ var localSetupInstallationSchema = z32.object({
3636
+ key: z32.string().regex(/^[A-Za-z0-9_-]{43}$/u),
3637
+ idempotencyKey: z32.string().uuid(),
3638
+ apiBaseUrl: z32.string().url(),
3552
3639
  request: setupInstallationRequestSchema,
3553
- bootstrapAcknowledged: z31.boolean()
3640
+ bootstrapAcknowledged: z32.boolean()
3554
3641
  }).strict();
3555
- var siteplaneCredentialsSchema = z31.object({
3556
- accessToken: z31.string().trim().min(1),
3557
- siteRevalidationSecret: z31.string().trim().min(1),
3642
+ var siteplaneCredentialsSchema = z32.object({
3643
+ accessToken: z32.string().trim().min(1),
3644
+ siteRevalidationSecret: z32.string().trim().min(1),
3558
3645
  installation: localSetupInstallationSchema.optional(),
3559
3646
  claimReceipt: setupClaimReceiptSchema.optional(),
3560
- adminSession: z31.object({
3561
- secret: z31.string().regex(/^[A-Za-z0-9_-]{43}$/u),
3562
- generation: z31.string().uuid()
3647
+ adminSession: z32.object({
3648
+ secret: z32.string().regex(/^[A-Za-z0-9_-]{43}$/u),
3649
+ generation: z32.string().uuid()
3563
3650
  }).strict().optional()
3564
3651
  }).strict();
3565
- var localSetupCredentialsSchema = z31.union([
3652
+ var localSetupCredentialsSchema = z32.union([
3566
3653
  siteplaneCredentialsSchema,
3567
- z31.object({ installation: localSetupInstallationSchema }).strict()
3654
+ z32.object({ installation: localSetupInstallationSchema }).strict()
3568
3655
  ]);
3569
3656
  async function assertLocalCredentialsPathSafe(projectDir, options = {}) {
3570
3657
  const path = join4(projectDir, ".siteplane/credentials.json");
@@ -3662,7 +3749,7 @@ async function gitPathMatches(projectDir, path, command) {
3662
3749
  // ../cli/dist/commands/init.js
3663
3750
  import { access as access3 } from "fs/promises";
3664
3751
  import { join as join7, relative as relative3 } from "path";
3665
- import { z as z34 } from "zod";
3752
+ import { z as z35 } from "zod";
3666
3753
 
3667
3754
  // ../cli/dist/commands/setup-preflight.js
3668
3755
  import { createHash as createHash2 } from "crypto";
@@ -3674,11 +3761,11 @@ import { parse as parseYaml } from "yaml";
3674
3761
  import { createRequire } from "module";
3675
3762
  import { readFile as readFile7 } from "fs/promises";
3676
3763
  import { join as join5 } from "path";
3677
- import { z as z32 } from "zod";
3678
- var packageSchema = z32.object({
3679
- name: z32.string().optional(),
3680
- version: z32.string(),
3681
- peerDependencies: z32.record(z32.string(), z32.string()).optional()
3764
+ import { z as z33 } from "zod";
3765
+ var packageSchema = z33.object({
3766
+ name: z33.string().optional(),
3767
+ version: z33.string(),
3768
+ peerDependencies: z33.record(z33.string(), z33.string()).optional()
3682
3769
  });
3683
3770
  async function readInstalledPackage(projectDir, name2) {
3684
3771
  const require2 = createRequire(join5(projectDir, "package.json"));
@@ -3693,9 +3780,9 @@ async function readInstalledPackage(projectDir, name2) {
3693
3780
  throw new Error(`Install ${name2} with the canonical package manager before setup.`);
3694
3781
  }
3695
3782
  async function assertExactSetupPackages(projectDir, packages) {
3696
- const manifest = z32.object({
3697
- dependencies: z32.record(z32.string(), z32.string()).optional(),
3698
- devDependencies: z32.record(z32.string(), z32.string()).optional()
3783
+ const manifest = z33.object({
3784
+ dependencies: z33.record(z33.string(), z33.string()).optional(),
3785
+ devDependencies: z33.record(z33.string(), z33.string()).optional()
3699
3786
  }).parse(JSON.parse(await readFile7(join5(projectDir, "package.json"), "utf8")));
3700
3787
  for (const [name2, version2] of [
3701
3788
  ["siteplane", packages.siteplane],
@@ -3712,7 +3799,7 @@ async function assertExactSetupPackages(projectDir, packages) {
3712
3799
  // ../cli/dist/commands/setup-preflight.js
3713
3800
  import { access as access2, readFile as readFile8, realpath, readdir, readlink } from "fs/promises";
3714
3801
  import { dirname as dirname6, join as join6, relative as relative2, resolve, sep } from "path";
3715
- import { z as z33 } from "zod";
3802
+ import { z as z34 } from "zod";
3716
3803
 
3717
3804
  // ../cli/dist/commands/setup-process.js
3718
3805
  import { spawn } from "child_process";
@@ -3813,29 +3900,29 @@ async function setupVercelApi(cwd, endpoint, body, method, options) {
3813
3900
  }
3814
3901
 
3815
3902
  // ../cli/dist/commands/setup-preflight.js
3816
- var manifestSchema = z33.object({
3817
- packageManager: z33.string().optional(),
3818
- engines: z33.object({ node: z33.string().optional() }).optional(),
3819
- dependencies: z33.record(z33.string(), z33.string()).optional(),
3820
- devDependencies: z33.record(z33.string(), z33.string()).optional(),
3821
- scripts: z33.record(z33.string(), z33.string()).optional(),
3822
- workspaces: z33.unknown().optional()
3903
+ var manifestSchema = z34.object({
3904
+ packageManager: z34.string().optional(),
3905
+ engines: z34.object({ node: z34.string().optional() }).optional(),
3906
+ dependencies: z34.record(z34.string(), z34.string()).optional(),
3907
+ devDependencies: z34.record(z34.string(), z34.string()).optional(),
3908
+ scripts: z34.record(z34.string(), z34.string()).optional(),
3909
+ workspaces: z34.unknown().optional()
3823
3910
  });
3824
- var vercelProjectSchema = z33.object({
3825
- id: z33.string(),
3826
- accountId: z33.string(),
3827
- name: z33.string(),
3828
- nodeVersion: z33.string().nullable().optional(),
3829
- rootDirectory: z33.string().nullable().optional(),
3830
- framework: z33.string().nullable().optional(),
3831
- installCommand: z33.string().nullable().optional(),
3832
- buildCommand: z33.string().nullable().optional(),
3833
- link: z33.object({
3834
- type: z33.string(),
3835
- repo: z33.string().optional(),
3836
- repoId: z33.union([z33.string(), z33.number()]).optional(),
3837
- org: z33.string().optional(),
3838
- productionBranch: z33.string().optional()
3911
+ var vercelProjectSchema = z34.object({
3912
+ id: z34.string(),
3913
+ accountId: z34.string(),
3914
+ name: z34.string(),
3915
+ nodeVersion: z34.string().nullable().optional(),
3916
+ rootDirectory: z34.string().nullable().optional(),
3917
+ framework: z34.string().nullable().optional(),
3918
+ installCommand: z34.string().nullable().optional(),
3919
+ buildCommand: z34.string().nullable().optional(),
3920
+ link: z34.object({
3921
+ type: z34.string(),
3922
+ repo: z34.string().optional(),
3923
+ repoId: z34.union([z34.string(), z34.number()]).optional(),
3924
+ org: z34.string().optional(),
3925
+ productionBranch: z34.string().optional()
3839
3926
  }).nullable().optional()
3840
3927
  });
3841
3928
  var exists = async (path) => access2(path).then(() => true, () => false);
@@ -3892,9 +3979,9 @@ async function inspectSetupLocalProject(projectDir) {
3892
3979
  const rootManifest = manifestSchema.parse(JSON.parse(await readFile8(join6(lockfileRoot, "package.json"), "utf8")));
3893
3980
  if (lockfileRoot !== projectDirectory) {
3894
3981
  const workspaceFile = join6(lockfileRoot, "pnpm-workspace.yaml");
3895
- const workspace = lockName === "pnpm-lock.yaml" && await exists(workspaceFile) ? z33.object({ packages: z33.array(z33.string()) }).parse(parseYaml(await readFile8(workspaceFile, "utf8"))).packages : z33.union([
3896
- z33.array(z33.string()),
3897
- z33.object({ packages: z33.array(z33.string()) }).transform((value) => value.packages)
3982
+ const workspace = lockName === "pnpm-lock.yaml" && await exists(workspaceFile) ? z34.object({ packages: z34.array(z34.string()) }).parse(parseYaml(await readFile8(workspaceFile, "utf8"))).packages : z34.union([
3983
+ z34.array(z34.string()),
3984
+ z34.object({ packages: z34.array(z34.string()) }).transform((value) => value.packages)
3898
3985
  ]).parse(rootManifest.workspaces);
3899
3986
  const selected = relative2(lockfileRoot, projectDirectory).split(sep).join("/");
3900
3987
  if (!workspace.some((pattern) => !pattern.startsWith("!") && minimatch(selected, pattern)) || workspace.some((pattern) => pattern.startsWith("!") && minimatch(selected, pattern.slice(1))))
@@ -3908,11 +3995,11 @@ async function inspectSetupLocalProject(projectDir) {
3908
3995
  break;
3909
3996
  }
3910
3997
  const lockText = await readFile8(join6(lockfileRoot, lockName), "utf8");
3911
- const npmLock = lockName === "package-lock.json" ? z33.object({
3912
- lockfileVersion: z33.number(),
3913
- packages: z33.record(z33.string(), z33.object({
3914
- version: z33.string().optional(),
3915
- peerDependencies: z33.record(z33.string(), z33.string()).optional()
3998
+ const npmLock = lockName === "package-lock.json" ? z34.object({
3999
+ lockfileVersion: z34.number(),
4000
+ packages: z34.record(z34.string(), z34.object({
4001
+ version: z34.string().optional(),
4002
+ peerDependencies: z34.record(z34.string(), z34.string()).optional()
3916
4003
  })).optional()
3917
4004
  }).parse(JSON.parse(lockText)) : null;
3918
4005
  async function version2(name3) {
@@ -4050,9 +4137,9 @@ async function setupPreflightCommand(input) {
4050
4137
  linkDirectory = dirname6(linkDirectory);
4051
4138
  if (!await exists(join6(linkDirectory, ".vercel/project.json")))
4052
4139
  fail("vercel_project_not_linked", "Link this application to its intended Vercel project before setup; Siteplane will not guess a target.");
4053
- const linked = z33.object({
4054
- projectId: z33.string().regex(/^prj_[A-Za-z0-9]+$/u),
4055
- orgId: z33.string().regex(/^(?:team|user)_[A-Za-z0-9]+$/u)
4140
+ const linked = z34.object({
4141
+ projectId: z34.string().regex(/^prj_[A-Za-z0-9]+$/u),
4142
+ orgId: z34.string().regex(/^(?:team|user)_[A-Za-z0-9]+$/u)
4056
4143
  }).parse(JSON.parse(await readFile8(join6(linkDirectory, ".vercel/project.json"), "utf8")));
4057
4144
  const project = vercelProjectSchema.parse(await setupVercelApi(linkDirectory, `/v9/projects/${linked.projectId}?teamId=${linked.orgId}`));
4058
4145
  if (project.id !== linked.projectId || project.accountId !== linked.orgId)
@@ -4066,11 +4153,11 @@ async function setupPreflightCommand(input) {
4066
4153
  fail("vercel_production_branch_conflict", "The local branch differs from the bound Vercel Production branch.");
4067
4154
  if (project.link?.repo && project.link.org && !local.git.remote?.replace(/\.git$/u, "").endsWith(`${project.link.org}/${project.link.repo}`))
4068
4155
  fail("vercel_git_conflict", "The local origin repository differs from the Vercel Git connection.");
4069
- const env = z33.object({
4070
- envs: z33.array(z33.object({
4071
- key: z33.string(),
4072
- value: z33.string().optional(),
4073
- target: z33.array(z33.string()).optional()
4156
+ const env = z34.object({
4157
+ envs: z34.array(z34.object({
4158
+ key: z34.string(),
4159
+ value: z34.string().optional(),
4160
+ target: z34.array(z34.string()).optional()
4074
4161
  }))
4075
4162
  }).parse(await setupVercelApi(linkDirectory, `/v10/projects/${linked.projectId}/env?teamId=${linked.orgId}`));
4076
4163
  const corepack = env.envs.some((item) => item.key === "ENABLE_EXPERIMENTAL_COREPACK" && item.value === "1" && item.target?.includes("production"));
@@ -4088,6 +4175,11 @@ async function setupPreflightCommand(input) {
4088
4175
  fail("vercel_package_manager_conflict", "The provider install command conflicts with the canonical lockfile.");
4089
4176
  if (overridePin && local.packageManager.declared && `${overridePin[1]}@${overridePin[2]}` !== local.packageManager.declared)
4090
4177
  fail("vercel_package_manager_conflict", "The Vercel install override conflicts with the exact packageManager declaration.");
4178
+ const build = project.buildCommand;
4179
+ const buildPin = build ? /\b(npm|pnpm|yarn|bun)@(\d+\.\d+\.\d+)\b/u.exec(build) : null;
4180
+ const buildFamily = buildPin?.[1] ?? (build ? /(?:^|[;&|]\s*)(npm|pnpm|yarn|bun)\s+(?:run\s+)?build\b/u.exec(build)?.[1] : null);
4181
+ if (buildFamily && (buildFamily !== local.packageManager.name || buildPin && local.packageManager.declared && `${buildPin[1]}@${buildPin[2]}` !== local.packageManager.declared))
4182
+ fail("vercel_package_manager_conflict", "The explicit Vercel build command conflicts with the selected package manager or its declared version. Align the existing build override and rerun preflight; no setup writes were performed.");
4091
4183
  return {
4092
4184
  status: "ready",
4093
4185
  local,
@@ -4160,26 +4252,26 @@ async function initCommand(input) {
4160
4252
  ]
4161
4253
  };
4162
4254
  }
4163
- var siteSetupBootstrapDataSchema = z34.object({
4164
- credentialPurpose: z34.literal("site_setup"),
4165
- apiBaseUrl: z34.string().url(),
4166
- siteId: z34.string().uuid(),
4167
- publicSiteKeyId: z34.string().uuid(),
4168
- publicSiteKey: z34.string().trim().min(1),
4169
- accessToken: z34.string().trim().min(1),
4170
- siteRevalidationSecret: z34.string().regex(/^[A-Za-z0-9_-]{43}$/u),
4171
- runId: z34.string().uuid(),
4255
+ var siteSetupBootstrapDataSchema = z35.object({
4256
+ credentialPurpose: z35.literal("site_setup"),
4257
+ apiBaseUrl: z35.string().url(),
4258
+ siteId: z35.string().uuid(),
4259
+ publicSiteKeyId: z35.string().uuid(),
4260
+ publicSiteKey: z35.string().trim().min(1),
4261
+ accessToken: z35.string().trim().min(1),
4262
+ siteRevalidationSecret: z35.string().regex(/^[A-Za-z0-9_-]{43}$/u),
4263
+ runId: z35.string().uuid(),
4172
4264
  packages: siteSetupPackagesSchema
4173
4265
  }).strict();
4174
- var featureBootstrapDataSchema = z34.object({
4175
- credentialPurpose: z34.enum(["analytics", "booking"]),
4176
- apiBaseUrl: z34.string().url(),
4177
- siteId: z34.string().uuid(),
4178
- accessToken: z34.string().trim().min(1)
4266
+ var featureBootstrapDataSchema = z35.object({
4267
+ credentialPurpose: z35.enum(["analytics", "booking"]),
4268
+ apiBaseUrl: z35.string().url(),
4269
+ siteId: z35.string().uuid(),
4270
+ accessToken: z35.string().trim().min(1)
4179
4271
  }).strict();
4180
- var bootstrapResponseSchema = z34.object({
4181
- ok: z34.literal(true),
4182
- data: z34.discriminatedUnion("credentialPurpose", [
4272
+ var bootstrapResponseSchema = z35.object({
4273
+ ok: z35.literal(true),
4274
+ data: z35.discriminatedUnion("credentialPurpose", [
4183
4275
  siteSetupBootstrapDataSchema,
4184
4276
  featureBootstrapDataSchema
4185
4277
  ])
@@ -4339,7 +4431,7 @@ async function collectSourceFiles(directory) {
4339
4431
  import { execFile as execFile2 } from "child_process";
4340
4432
  import { readFile as readFile9 } from "fs/promises";
4341
4433
  import { promisify as promisify2 } from "util";
4342
- import { z as z35 } from "zod";
4434
+ import { z as z36 } from "zod";
4343
4435
 
4344
4436
  // ../cli/dist/scan/next-source-scan.js
4345
4437
  import ts2 from "typescript";
@@ -5044,32 +5136,32 @@ function isPositionalFieldReference(value) {
5044
5136
 
5045
5137
  // ../cli/dist/commands/site-setup.js
5046
5138
  var execFileAsync2 = promisify2(execFile2);
5047
- var safeErrorSchema = z35.object({
5048
- code: z35.string().trim().min(1),
5049
- message: z35.string().trim().min(1)
5139
+ var safeErrorSchema = z36.object({
5140
+ code: z36.string().trim().min(1),
5141
+ message: z36.string().trim().min(1)
5050
5142
  }).passthrough();
5051
- var errorResponseSchema2 = z35.object({ ok: z35.literal(false), error: safeErrorSchema }).passthrough();
5052
- var contextDataSchema = z35.object({
5143
+ var errorResponseSchema2 = z36.object({ ok: z36.literal(false), error: safeErrorSchema }).passthrough();
5144
+ var contextDataSchema = z36.object({
5053
5145
  task: siteSetupTaskSchema.refine((task) => task.run !== null)
5054
5146
  }).strict();
5055
- var contextResponseSchema = z35.object({ ok: z35.literal(true), data: contextDataSchema }).strict();
5056
- var applyDataSchema = z35.object({
5057
- status: z35.enum(["applied", "ready_for_review"]),
5058
- runId: z35.string().uuid().optional(),
5059
- contractVersionId: z35.string().uuid().optional(),
5060
- fieldContractHash: z35.string().regex(/^sha256:[0-9a-f]{64}$/u),
5061
- editorDefinitionHash: z35.string().regex(/^sha256:[0-9a-f]{64}$/u).optional(),
5062
- fieldCount: z35.number().int().nonnegative().optional(),
5063
- routeCount: z35.number().int().nonnegative().optional()
5147
+ var contextResponseSchema = z36.object({ ok: z36.literal(true), data: contextDataSchema }).strict();
5148
+ var applyDataSchema = z36.object({
5149
+ status: z36.enum(["applied", "ready_for_review"]),
5150
+ runId: z36.string().uuid().optional(),
5151
+ contractVersionId: z36.string().uuid().optional(),
5152
+ fieldContractHash: z36.string().regex(/^sha256:[0-9a-f]{64}$/u),
5153
+ editorDefinitionHash: z36.string().regex(/^sha256:[0-9a-f]{64}$/u).optional(),
5154
+ fieldCount: z36.number().int().nonnegative().optional(),
5155
+ routeCount: z36.number().int().nonnegative().optional()
5064
5156
  }).strict();
5065
- var applyResponseSchema = z35.object({ ok: z35.literal(true), data: applyDataSchema }).strict();
5066
- var verifyDataSchema = z35.object({
5067
- status: z35.literal("ready_for_review"),
5068
- runId: z35.string().uuid().optional(),
5069
- deploymentOrigin: z35.string().url().optional(),
5070
- deploymentRevision: z35.string().optional()
5157
+ var applyResponseSchema = z36.object({ ok: z36.literal(true), data: applyDataSchema }).strict();
5158
+ var verifyDataSchema = z36.object({
5159
+ status: z36.literal("ready_for_review"),
5160
+ runId: z36.string().uuid().optional(),
5161
+ deploymentOrigin: z36.string().url().optional(),
5162
+ deploymentRevision: z36.string().optional()
5071
5163
  }).strict();
5072
- var verifyResponseSchema = z35.object({ ok: z35.literal(true), data: verifyDataSchema }).strict();
5164
+ var verifyResponseSchema = z36.object({ ok: z36.literal(true), data: verifyDataSchema }).strict();
5073
5165
  async function siteSetupContextCommand(input) {
5074
5166
  const response = await postSiteSetup(input, "context", {});
5075
5167
  const parsed = contextResponseSchema.safeParse(response.payload);
@@ -5233,9 +5325,9 @@ async function siteSetupActivityCommand(input) {
5233
5325
  message: "Choose inspecting, integrating, deploying, verifying or repairing."
5234
5326
  };
5235
5327
  const response = await postSiteSetup(input, "activity", activity.data);
5236
- const parsed = z35.object({
5237
- ok: z35.literal(true),
5238
- data: z35.object({ status: z35.enum(["recorded", "rate_limited"]) }).strict()
5328
+ const parsed = z36.object({
5329
+ ok: z36.literal(true),
5330
+ data: z36.object({ status: z36.enum(["recorded", "rate_limited"]) }).strict()
5239
5331
  }).strict().safeParse(response.payload);
5240
5332
  return response.ok && parsed.success ? parsed.data.data : actionRequired(response.payload, "Setup activity could not be recorded.");
5241
5333
  }
@@ -5244,9 +5336,9 @@ async function siteSetupActivityCommand(input) {
5244
5336
  import { randomBytes, randomUUID as randomUUID4 } from "crypto";
5245
5337
  import { access as access4 } from "fs/promises";
5246
5338
  import { join as join9, relative as relative5 } from "path";
5247
- import { z as z36 } from "zod";
5248
- var bootstrapResponseSchema2 = z36.object({
5249
- ok: z36.literal(true),
5339
+ import { z as z37 } from "zod";
5340
+ var bootstrapResponseSchema2 = z37.object({
5341
+ ok: z37.literal(true),
5250
5342
  data: siteSetupBootstrapDataSchema
5251
5343
  }).strict();
5252
5344
  async function setupStartCommand(input) {
@@ -5320,9 +5412,9 @@ async function acknowledge(input, credentials) {
5320
5412
  if (!installation || !("accessToken" in credentials))
5321
5413
  throw new Error("Incomplete installation exchange.");
5322
5414
  const payload = await installationRequest(input, installation, "acknowledge");
5323
- z36.object({
5324
- ok: z36.literal(true),
5325
- data: z36.object({ acknowledged: z36.literal(true) }).strict()
5415
+ z37.object({
5416
+ ok: z37.literal(true),
5417
+ data: z37.object({ acknowledged: z37.literal(true) }).strict()
5326
5418
  }).strict().parse(payload);
5327
5419
  await writeLocalSetupCredentials(input.projectDir, {
5328
5420
  ...credentials,
@@ -5343,9 +5435,9 @@ async function installationRequest(input, installation, action) {
5343
5435
  });
5344
5436
  const payload = await response.json();
5345
5437
  if (!response.ok) {
5346
- const error = z36.object({
5347
- error: z36.object({
5348
- code: z36.string().regex(/^[a-z][a-z0-9_.]{0,100}$/u)
5438
+ const error = z37.object({
5439
+ error: z37.object({
5440
+ code: z37.string().regex(/^[a-z][a-z0-9_.]{0,100}$/u)
5349
5441
  })
5350
5442
  }).safeParse(payload);
5351
5443
  throw new SetupFailure(error.success ? error.data.error.code : "setup_start_failed", "Siteplane could not complete this installation request. The saved local key and request are unchanged; retry after resolving the reported boundary.");
@@ -5374,12 +5466,12 @@ async function exists2(path) {
5374
5466
  }
5375
5467
 
5376
5468
  // ../cli/dist/commands/setup-review.js
5377
- import { z as z37 } from "zod";
5378
- var responseSchema2 = z37.object({
5379
- ok: z37.literal(true),
5380
- data: z37.object({
5381
- reviewUrl: z37.string().url(),
5382
- expiresAt: z37.string().datetime({ offset: true })
5469
+ import { z as z38 } from "zod";
5470
+ var responseSchema2 = z38.object({
5471
+ ok: z38.literal(true),
5472
+ data: z38.object({
5473
+ reviewUrl: z38.string().url(),
5474
+ expiresAt: z38.string().datetime({ offset: true })
5383
5475
  }).strict()
5384
5476
  }).strict();
5385
5477
  async function setupReviewCommand(input) {
@@ -5431,9 +5523,9 @@ async function setupReviewCommand(input) {
5431
5523
  throw new Error("Invalid review destination.");
5432
5524
  return { status: "ready", ...parsed.data.data };
5433
5525
  }
5434
- const denied = z37.object({
5435
- error: z37.object({
5436
- code: z37.enum([
5526
+ const denied = z38.object({
5527
+ error: z38.object({
5528
+ code: z38.enum([
5437
5529
  "invalid_installation",
5438
5530
  "already_claimed",
5439
5531
  "project_expired",
@@ -5579,8 +5671,15 @@ export default function SiteplaneBridge() {
5579
5671
  if (closingBodies.length !== 1)
5580
5672
  throw new SetupFailure("layout_integration_conflict", "Mount SiteplaneBridge inside the existing root body. The layout shape requires a deliberate agent edit.");
5581
5673
  const point = closingBodies[0];
5582
- files.set(layoutPath, `import SiteplaneBridge from "./_siteplane/bridge";
5583
- ${layoutSource.slice(0, point)}<SiteplaneBridge />${layoutSource.slice(point)}`);
5674
+ let importPoint = 0;
5675
+ for (const statement of ast.statements) {
5676
+ if (!ts3.isExpressionStatement(statement) || !ts3.isStringLiteral(statement.expression))
5677
+ break;
5678
+ importPoint = statement.end;
5679
+ }
5680
+ files.set(layoutPath, `${layoutSource.slice(0, importPoint)}
5681
+ import SiteplaneBridge from "./_siteplane/bridge";
5682
+ ${layoutSource.slice(importPoint, point)}<SiteplaneBridge />${layoutSource.slice(point)}`);
5584
5683
  }
5585
5684
  const configs = (await Promise.all(["next.config.ts", "next.config.mjs", "next.config.js"].map(async (name2) => await exists3(join10(directory, name2)) ? join10(directory, name2) : null))).filter((path) => path !== null);
5586
5685
  if (configs.length > 1)
@@ -5605,7 +5704,7 @@ ${task.goal}
5605
5704
 
5606
5705
  ${task.discovery.rules.map((rule) => `- ${rule}`).join("\n")}
5607
5706
 
5608
- Run setup context for the current user instructions and authorized modules. Keep the user instructions distinct from your selection summary. Use setup deploy --wait for environment transfer and deployment; never read or print credential values. If the linked provider project has multiple eligible Production domains, choose its canonical verified non-redirecting origin with --production-origin <https-origin>; before an origin-dependent local build use that exact value as SITEPLANE_SITE_ORIGIN, then pass the same origin to setup deploy. Resume reuses the stored choice. If a requested deploy passes its provider deadline, rerun the same command for a bounded readback of that operation; do not start a replacement while its outcome is unresolved. For image fields, withSiteplane adds only the exact Siteplane asset route and website /siteplane-assets/ pattern while preserving existing sources, loaders, and redirect policy. This grants no hosting permission. If the website uses a global or component image loader, keep it and verify Siteplane image delivery explicitly. Inspect CSP written by middleware/proxy/meta tags before deployment. Never use a wildcard, private host or different origin for local builds.
5707
+ Run setup context for the current user instructions and authorized modules. Keep the user instructions distinct from your selection summary. Use setup deploy --wait for environment transfer and deployment; never read or print credential values. If the linked provider project has multiple eligible Production domains, choose its canonical verified non-redirecting origin with --production-origin <https-origin>; before an origin-dependent local build use that exact value as SITEPLANE_SITE_ORIGIN, then pass the same origin to setup deploy. Resume reuses the stored choice. If a requested deploy passes its provider deadline, rerun the same command for a bounded readback of that operation; do not start a replacement while its outcome is unresolved. Local builds using code-fallback images need no SITEPLANE_SITE_ORIGIN or setup secrets. For image fields, withSiteplane adds only the exact Siteplane asset route and website /siteplane-assets/ pattern while preserving existing sources, loaders, and redirect policy. This grants no hosting permission. If the website uses a global or component image loader, keep it and verify Siteplane image delivery explicitly. Inspect CSP written by middleware/proxy/meta tags before deployment. Never use a wildcard, private host or different origin for local builds.
5609
5708
  `);
5610
5709
  for (const [path, content] of files) {
5611
5710
  if (path === layoutPath || path === nextPath || path === guidePath)
@@ -5735,8 +5834,8 @@ async function assertSourcePath(root, target) {
5735
5834
  import { randomUUID as randomUUID6 } from "crypto";
5736
5835
  import { lstat as lstat3, mkdir as mkdir7, open as open4, readFile as readFile11, rm as rm4, rmdir } from "fs/promises";
5737
5836
  import { resolve as resolve2 } from "path";
5738
- import { z as z38 } from "zod";
5739
- var ownerSchema = z38.object({ pid: z38.number().int().positive(), nonce: z38.string().uuid() }).strict();
5837
+ import { z as z39 } from "zod";
5838
+ var ownerSchema = z39.object({ pid: z39.number().int().positive(), nonce: z39.string().uuid() }).strict();
5740
5839
  async function withSetupLock(projectDir, work) {
5741
5840
  const gitPath = (await setupProcess("git", ["rev-parse", "--git-path", "siteplane-setup.lock"], { cwd: projectDir })).trim();
5742
5841
  const path = resolve2(projectDir, gitPath);
@@ -5800,23 +5899,23 @@ import { execFile as execFile3 } from "child_process";
5800
5899
  import { lstat as lstat4, readFile as readFile12, writeFile as writeFile5, mkdir as mkdir8 } from "fs/promises";
5801
5900
  import { dirname as dirname8, isAbsolute as isAbsolute2, join as join11, relative as relative7, resolve as resolve3, sep as sep3 } from "path";
5802
5901
  import { isDeepStrictEqual, promisify as promisify3 } from "util";
5803
- import { z as z39 } from "zod";
5902
+ import { z as z40 } from "zod";
5804
5903
  var execute = promisify3(execFile3);
5805
5904
  var name = ".siteplane/build-source.json";
5806
- var oid = z39.string().regex(/^[0-9a-f]{40}$/u);
5807
- var entrySchema = z39.object({
5808
- path: z39.string().min(1).max(4096),
5809
- mode: z39.enum(["100644", "100755", "120000"]),
5905
+ var oid = z40.string().regex(/^[0-9a-f]{40}$/u);
5906
+ var entrySchema = z40.object({
5907
+ path: z40.string().min(1).max(4096),
5908
+ mode: z40.enum(["100644", "100755", "120000"]),
5810
5909
  oid
5811
5910
  }).strict();
5812
- var schema = z39.object({
5813
- version: z39.literal(2),
5911
+ var schema = z40.object({
5912
+ version: z40.literal(2),
5814
5913
  revision: oid,
5815
- commit: z39.string().min(1).max(1048576),
5816
- entries: z39.array(entrySchema).min(1).max(1e5),
5817
- providerConfigurations: z39.array(z39.object({
5818
- path: z39.string().max(4096).regex(/(?:^|\/)vercel\.json$/u),
5819
- source: z39.string().max(1048576)
5914
+ commit: z40.string().min(1).max(1048576),
5915
+ entries: z40.array(entrySchema).min(1).max(1e5),
5916
+ providerConfigurations: z40.array(z40.object({
5917
+ path: z40.string().max(4096).regex(/(?:^|\/)vercel\.json$/u),
5918
+ source: z40.string().max(1048576)
5820
5919
  }).strict()).max(1e3)
5821
5920
  }).strict();
5822
5921
  async function writeBuildProvenance(checkout, revision) {
@@ -5865,38 +5964,38 @@ import { createHash as createHash4, randomBytes as randomBytes2, randomUUID as r
5865
5964
  import { access as access6, mkdir as mkdir9, mkdtemp, rm as rm5, writeFile as writeFile6 } from "fs/promises";
5866
5965
  import { tmpdir } from "os";
5867
5966
  import { join as join12 } from "path";
5868
- import { z as z40 } from "zod";
5869
- var envSchema = z40.object({
5870
- id: z40.string(),
5871
- key: z40.string(),
5872
- target: z40.array(z40.string()),
5873
- type: z40.string(),
5874
- comment: z40.string().optional(),
5875
- updatedAt: z40.number().optional()
5967
+ import { z as z41 } from "zod";
5968
+ var envSchema = z41.object({
5969
+ id: z41.string(),
5970
+ key: z41.string(),
5971
+ target: z41.array(z41.string()),
5972
+ type: z41.string(),
5973
+ comment: z41.string().optional(),
5974
+ updatedAt: z41.number().optional()
5876
5975
  });
5877
- var deploymentSchema = z40.object({
5878
- id: z40.string(),
5879
- projectId: z40.string(),
5880
- ownerId: z40.string().optional(),
5881
- target: z40.string().nullable(),
5882
- readyState: z40.string(),
5883
- createdAt: z40.number(),
5884
- url: z40.string(),
5885
- meta: z40.record(z40.string(), z40.unknown()).optional(),
5886
- gitSource: z40.object({ sha: z40.string().optional() }).nullable().optional()
5976
+ var deploymentSchema = z41.object({
5977
+ id: z41.string(),
5978
+ projectId: z41.string(),
5979
+ ownerId: z41.string().optional(),
5980
+ target: z41.string().nullable(),
5981
+ readyState: z41.string(),
5982
+ createdAt: z41.number(),
5983
+ url: z41.string(),
5984
+ meta: z41.record(z41.string(), z41.unknown()).optional(),
5985
+ gitSource: z41.object({ sha: z41.string().optional() }).nullable().optional()
5887
5986
  });
5888
- var buildProofSchema = z40.object({
5889
- node: z40.string(),
5890
- packageManager: z40.enum(["npm", "pnpm"]),
5891
- packageManagerVersion: z40.string(),
5892
- lockfileHash: z40.string(),
5893
- revision: z40.string(),
5894
- fieldContractHash: z40.string(),
5895
- siteplane: z40.string(),
5896
- runtimeNext: z40.string(),
5897
- analytics: z40.string().optional(),
5898
- next: z40.string(),
5899
- react: z40.string()
5987
+ var buildProofSchema = z41.object({
5988
+ node: z41.string(),
5989
+ packageManager: z41.enum(["npm", "pnpm"]),
5990
+ packageManagerVersion: z41.string(),
5991
+ lockfileHash: z41.string(),
5992
+ revision: z41.string(),
5993
+ fieldContractHash: z41.string(),
5994
+ siteplane: z41.string(),
5995
+ runtimeNext: z41.string(),
5996
+ analytics: z41.string().optional(),
5997
+ next: z41.string(),
5998
+ react: z41.string()
5900
5999
  }).strict();
5901
6000
  var digest = (value) => `sha256:${createHash4("sha256").update(stableJsonStringify(value)).digest("hex")}`;
5902
6001
  function fail2(code, message) {
@@ -5984,12 +6083,12 @@ async function setupDeployCommand(input, deps = defaults) {
5984
6083
  remaining();
5985
6084
  return result2;
5986
6085
  };
5987
- const domains = z40.object({
5988
- domains: z40.array(z40.object({
5989
- name: z40.string(),
5990
- verified: z40.boolean(),
5991
- redirect: z40.string().nullable().optional(),
5992
- gitBranch: z40.string().nullable().optional()
6086
+ const domains = z41.object({
6087
+ domains: z41.array(z41.object({
6088
+ name: z41.string(),
6089
+ verified: z41.boolean(),
6090
+ redirect: z41.string().nullable().optional(),
6091
+ gitBranch: z41.string().nullable().optional()
5993
6092
  }))
5994
6093
  }).parse(await api(`/v9/projects/${provider.projectId}/domains?${scope}`)).domains.filter((domain) => domain.verified && !domain.redirect && !domain.gitBranch);
5995
6094
  const eligibleOrigins = domains.map((domain) => new URL(`https://${domain.name}`).origin);
@@ -6018,7 +6117,7 @@ async function setupDeployCommand(input, deps = defaults) {
6018
6117
  remaining();
6019
6118
  return output;
6020
6119
  };
6021
- const listEnv = async () => z40.object({ envs: z40.array(envSchema) }).parse(await api(`/v10/projects/${provider.projectId}/env?${scope}`)).envs;
6120
+ const listEnv = async () => z41.object({ envs: z41.array(envSchema) }).parse(await api(`/v10/projects/${provider.projectId}/env?${scope}`)).envs;
6022
6121
  let env = await listEnv();
6023
6122
  const owned = (key) => {
6024
6123
  const matches2 = env.filter((item) => item.key === key && item.target.includes("production"));
@@ -6091,9 +6190,9 @@ async function setupDeployCommand(input, deps = defaults) {
6091
6190
  expectedOperationId: record?.operationId ?? null,
6092
6191
  record: next
6093
6192
  });
6094
- const parsed = z40.object({
6095
- ok: z40.literal(true),
6096
- data: z40.object({ record: setupDeploymentRecordSchema }).strict()
6193
+ const parsed = z41.object({
6194
+ ok: z41.literal(true),
6195
+ data: z41.object({ record: setupDeploymentRecordSchema }).strict()
6097
6196
  }).strict().safeParse(result2.payload);
6098
6197
  if (!result2.ok || !parsed.success || stableJsonStringify(parsed.data.data.record) !== stableJsonStringify(next))
6099
6198
  fail2("deployment_record_unconfirmed", "The setup deployment record was not acknowledged. Reload context before continuing; no deployment is blindly repeated.");
@@ -6143,7 +6242,7 @@ async function setupDeployCommand(input, deps = defaults) {
6143
6242
  const item = owned(key);
6144
6243
  if (key === "SITEPLANE_ADMIN_SESSION_SECRET" && item && record.phase === "verified")
6145
6244
  continue;
6146
- const current = item ? z40.object({ key: z40.literal(key), value: z40.string() }).parse(await api(`/v1/projects/${provider.projectId}/env/${encodeURIComponent(item.id)}?${scope}`)).value : null;
6245
+ const current = item ? z41.object({ key: z41.literal(key), value: z41.string() }).parse(await api(`/v1/projects/${provider.projectId}/env/${encodeURIComponent(item.id)}?${scope}`)).value : null;
6147
6246
  if (current !== value)
6148
6247
  pending.push({
6149
6248
  key,
@@ -6168,7 +6267,7 @@ async function setupDeployCommand(input, deps = defaults) {
6168
6267
  const item = owned(key);
6169
6268
  if (!item)
6170
6269
  fail2("environment_write_unconfirmed", "A Siteplane Production binding was not persisted; retry the same configuration.");
6171
- const observed = z40.object({ key: z40.literal(key), value: z40.string() }).parse(await api(`/v1/projects/${provider.projectId}/env/${encodeURIComponent(item.id)}?${scope}`));
6270
+ const observed = z41.object({ key: z41.literal(key), value: z41.string() }).parse(await api(`/v1/projects/${provider.projectId}/env/${encodeURIComponent(item.id)}?${scope}`));
6172
6271
  if (observed.value !== value)
6173
6272
  fail2("environment_write_unconfirmed", "The provider readback does not match the authorized Siteplane value; no deployment was started.");
6174
6273
  }
@@ -6181,7 +6280,7 @@ async function setupDeployCommand(input, deps = defaults) {
6181
6280
  const detail = async (id) => deploymentSchema.parse(await api(`/v13/deployments/${encodeURIComponent(id)}?${scope}&withGitRepoInfo=true`));
6182
6281
  const matches = (deployment2) => deployment2.projectId === provider.projectId && deployment2.target === "production" && (!deployment2.ownerId || deployment2.ownerId === provider.teamId) && deployment2.createdAt >= Date.parse(record.environmentWrittenAt) && (deployment2.meta?.siteplaneOperationId === record.operationId || provider.git && (deployment2.gitSource?.sha ?? deployment2.meta?.githubCommitSha ?? deployment2.meta?.gitlabCommitSha ?? deployment2.meta?.bitbucketCommitSha ?? deployment2.meta?.gitCommitSha) === revision);
6183
6282
  const discover = async () => {
6184
- const result2 = z40.object({ deployments: z40.array(z40.object({ uid: z40.string() })) }).parse(await api(`/v6/deployments?${scope}&projectId=${provider.projectId}&target=production&since=${Date.parse(record.environmentWrittenAt)}&limit=100`));
6283
+ const result2 = z41.object({ deployments: z41.array(z41.object({ uid: z41.string() })) }).parse(await api(`/v6/deployments?${scope}&projectId=${provider.projectId}&target=production&since=${Date.parse(record.environmentWrittenAt)}&limit=100`));
6185
6284
  const candidates = [];
6186
6285
  for (const item of result2.deployments) {
6187
6286
  const found = await detail(item.uid);
@@ -6356,10 +6455,10 @@ async function setupDeployCommand(input, deps = defaults) {
6356
6455
  }
6357
6456
 
6358
6457
  // ../cli/dist/commands/setup-claim.js
6359
- import { z as z41 } from "zod";
6458
+ import { z as z42 } from "zod";
6360
6459
  async function setupClaimCommand(input) {
6361
6460
  const code = setupClaimCodeSchema.safeParse(input.code);
6362
- const requestId = z41.string().uuid().safeParse(input.claimRequestId);
6461
+ const requestId = z42.string().uuid().safeParse(input.claimRequestId);
6363
6462
  if (!code.success || input.action === "confirm" && !requestId.success)
6364
6463
  return required("invalid_claim_request", "Inspect the code from your review, then confirm that concrete request with --code and --request after the user's explicit approval.");
6365
6464
  const [config, credentials] = await Promise.all([readProjectConfig(input.projectDir), readLocalCredentials(input.projectDir)]);
@@ -6398,11 +6497,11 @@ async function setupClaimCommand(input) {
6398
6497
  ...input.action === "confirm" ? { claimRequestId: input.claimRequestId } : {}
6399
6498
  });
6400
6499
  if (!response.ok) {
6401
- const denied = z41.object({ error: z41.object({ code: setupClaimDenialSchema.shape.status }) }).safeParse(payload);
6500
+ const denied = z42.object({ error: z42.object({ code: setupClaimDenialSchema.shape.status }) }).safeParse(payload);
6402
6501
  return required(denied.success ? denied.data.error.code : "claim_unavailable", "Claim was not acknowledged. Check the review and retry the same request; do not create another project.");
6403
6502
  }
6404
6503
  if (input.action === "inspect") {
6405
- const inspected = z41.object({ ok: z41.literal(true), data: setupClaimInspectionSchema }).strict().parse(payload).data;
6504
+ const inspected = z42.object({ ok: z42.literal(true), data: setupClaimInspectionSchema }).strict().parse(payload).data;
6406
6505
  if (inspected.siteId !== config.siteId || inspected.runId !== config.runId)
6407
6506
  throw new Error("Claim binding mismatch.");
6408
6507
  return {
@@ -6411,7 +6510,7 @@ async function setupClaimCommand(input) {
6411
6510
  nextAction: "Show this account, workspace and website to the user. Only after their explicit approval, run setup claim confirm with the same code and this requestId."
6412
6511
  };
6413
6512
  }
6414
- receipt = z41.object({ ok: z41.literal(true), data: setupClaimReceiptSchema }).strict().parse(payload).data;
6513
+ receipt = z42.object({ ok: z42.literal(true), data: setupClaimReceiptSchema }).strict().parse(payload).data;
6415
6514
  if (receipt.siteId !== config.siteId || receipt.runId !== config.runId || receipt.requestId !== input.claimRequestId)
6416
6515
  throw new Error("Claim receipt binding mismatch.");
6417
6516
  } catch {
@@ -6422,7 +6521,7 @@ async function setupClaimCommand(input) {
6422
6521
  let acknowledgementSettled = false;
6423
6522
  try {
6424
6523
  const { response, payload } = await send({ action: "acknowledge", claimRequestId: receipt.requestId });
6425
- const result2 = z41.object({ ok: z41.literal(true), data: z41.object({ acknowledged: z41.boolean() }).strict() }).strict().safeParse(payload);
6524
+ const result2 = z42.object({ ok: z42.literal(true), data: z42.object({ acknowledged: z42.boolean() }).strict() }).strict().safeParse(payload);
6426
6525
  acknowledgementSettled = response.ok && result2.success;
6427
6526
  } catch {
6428
6527
  }