@gadicc/loom 1.23.0 → 1.25.0

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.
Files changed (35) hide show
  1. package/README.md +19 -2
  2. package/db/databaseTls.js +42 -0
  3. package/db/databaseTls.test.ts +171 -0
  4. package/db/neonFull.js +2 -4
  5. package/esm/_dnt.polyfills.d.ts +11 -0
  6. package/esm/_dnt.polyfills.d.ts.map +1 -1
  7. package/esm/_dnt.polyfills.js +14 -0
  8. package/esm/src/cli/filesR2Policy.d.ts +33 -0
  9. package/esm/src/cli/filesR2Policy.d.ts.map +1 -0
  10. package/esm/src/cli/filesR2Policy.js +130 -0
  11. package/esm/src/cli/mod.d.ts.map +1 -1
  12. package/esm/src/cli/mod.js +163 -60
  13. package/esm/src/cli/releaseConfig.d.ts +10 -0
  14. package/esm/src/cli/releaseConfig.d.ts.map +1 -0
  15. package/esm/src/cli/releaseConfig.js +22 -0
  16. package/esm/src/next/pwa/mod.d.ts +10 -2
  17. package/esm/src/next/pwa/mod.d.ts.map +1 -1
  18. package/esm/src/next/pwa/mod.js +142 -31
  19. package/package.json +2 -2
  20. package/script/_dnt.polyfills.d.ts +11 -0
  21. package/script/_dnt.polyfills.d.ts.map +1 -1
  22. package/script/_dnt.polyfills.js +14 -0
  23. package/script/src/cli/filesR2Policy.d.ts +33 -0
  24. package/script/src/cli/filesR2Policy.d.ts.map +1 -0
  25. package/script/src/cli/filesR2Policy.js +135 -0
  26. package/script/src/cli/mod.d.ts.map +1 -1
  27. package/script/src/cli/mod.js +163 -60
  28. package/script/src/cli/releaseConfig.d.ts +10 -0
  29. package/script/src/cli/releaseConfig.d.ts.map +1 -0
  30. package/script/src/cli/releaseConfig.js +26 -0
  31. package/script/src/next/pwa/mod.d.ts +10 -2
  32. package/script/src/next/pwa/mod.d.ts.map +1 -1
  33. package/script/src/next/pwa/mod.js +142 -31
  34. package/skills/loom-db/SKILL.md +5 -1
  35. package/skills/loom-files/SKILL.md +12 -1
@@ -6,6 +6,8 @@ import { createRequire } from "node:module";
6
6
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
7
7
  import process from "node:process";
8
8
  import { parseArgs } from "node:util";
9
+ import { filesR2PolicyIssues, parseWranglerR2Cors, r2CorsMatchesPolicy, } from "./filesR2Policy.js";
10
+ import { resolveProductionBranch, } from "./releaseConfig.js";
9
11
  import { DEFAULT_API_KEY_AUDIT_RETENTION } from "../apiKeys/retention.js";
10
12
  import { checkProjectSkills, getProjectSkillStatus, LOOM_EXTERNAL_SKILLS_GITIGNORE_LINE, removeLegacyNextSkillLink, setProjectSkillDisabled, syncExternalProjectSkills, syncInstalledPackageSkills, } from "./projectSkills.js";
11
13
  import { resolveMigrationEnvironment, resolveMigrationEnvironmentFromEnvFile, verifyMigrationConnection, verifyMigrationConnectionFromEnvFile, } from "./migrationEnv.js";
@@ -1201,6 +1203,7 @@ function mergeDbConfig(framework, featureConfig) {
1201
1203
  ...featureConfig?.modules,
1202
1204
  },
1203
1205
  provider: featureConfig?.provider,
1206
+ release: featureConfig?.release,
1204
1207
  };
1205
1208
  }
1206
1209
  function isIdentifierLikeChar(char) {
@@ -3222,12 +3225,6 @@ function yamlListContainsToken(lines, startIndex, parentIndent, token) {
3222
3225
  }
3223
3226
  return false;
3224
3227
  }
3225
- function yamlBranchValueContainsMain(value) {
3226
- return yamlScalarValueContainsToken(value, "main");
3227
- }
3228
- function yamlListContainsMainBranch(lines, startIndex, parentIndent) {
3229
- return yamlListContainsToken(lines, startIndex, parentIndent, "main");
3230
- }
3231
3228
  function findGithubOnPushIndex(lines) {
3232
3229
  const onIndex = lines.findIndex((line) => /^\s*on:\s*(?:#.*)?$/.test(line));
3233
3230
  if (onIndex === -1) {
@@ -3250,7 +3247,7 @@ function findGithubOnPushIndex(lines) {
3250
3247
  }
3251
3248
  return -1;
3252
3249
  }
3253
- function githubWorkflowRunsOnMainPush(text) {
3250
+ function githubWorkflowRunsOnBranchPush(text, productionBranch) {
3254
3251
  const normalized = normalizeText(text);
3255
3252
  if (/^\s*on:\s*(?:push|\[\s*push\s*\])\s*(?:#.*)?$/m.test(normalized)) {
3256
3253
  return true;
@@ -3262,7 +3259,7 @@ function githubWorkflowRunsOnMainPush(text) {
3262
3259
  }
3263
3260
  const pushIndent = lines[pushIndex].match(/^(\s*)/)?.[1].length ?? 0;
3264
3261
  let hasBranchFilter = false;
3265
- let ignoresMain = false;
3262
+ let ignoresProductionBranch = false;
3266
3263
  for (let index = pushIndex + 1; index < lines.length; index++) {
3267
3264
  const line = lines[index];
3268
3265
  const indent = line.match(/^(\s*)/)?.[1].length ?? 0;
@@ -3276,20 +3273,20 @@ function githubWorkflowRunsOnMainPush(text) {
3276
3273
  const branchMatch = line.match(/^\s*branches:\s*(.*)$/);
3277
3274
  if (branchMatch) {
3278
3275
  hasBranchFilter = true;
3279
- if (yamlBranchValueContainsMain(branchMatch[1]) ||
3280
- yamlListContainsMainBranch(lines, index, indent)) {
3276
+ if (yamlScalarValueContainsToken(branchMatch[1], productionBranch) ||
3277
+ yamlListContainsToken(lines, index, indent, productionBranch)) {
3281
3278
  return true;
3282
3279
  }
3283
3280
  continue;
3284
3281
  }
3285
3282
  const branchIgnoreMatch = line.match(/^\s*branches-ignore:\s*(.*)$/);
3286
3283
  if (branchIgnoreMatch &&
3287
- (yamlBranchValueContainsMain(branchIgnoreMatch[1]) ||
3288
- yamlListContainsMainBranch(lines, index, indent))) {
3289
- ignoresMain = true;
3284
+ (yamlScalarValueContainsToken(branchIgnoreMatch[1], productionBranch) ||
3285
+ yamlListContainsToken(lines, index, indent, productionBranch))) {
3286
+ ignoresProductionBranch = true;
3290
3287
  }
3291
3288
  }
3292
- return !hasBranchFilter && !ignoresMain;
3289
+ return !hasBranchFilter && !ignoresProductionBranch;
3293
3290
  }
3294
3291
  function workflowStepRunsDbMigrate(block) {
3295
3292
  return /\b(?:deno\s+task\s+db:migrate|pnpm\s+(?:run\s+)?db:migrate|npm\s+run\s+db:migrate|yarn\s+(?:run\s+)?db:migrate|bun\s+run\s+db:migrate)\b/
@@ -3427,7 +3424,7 @@ function getGithubWorkflowJobBlocks(text) {
3427
3424
  };
3428
3425
  });
3429
3426
  }
3430
- function inspectDbMigrationWorkflow(relativePath, workflowText) {
3427
+ function inspectDbMigrationWorkflow(relativePath, workflowText, productionBranch) {
3431
3428
  const normalized = normalizeText(workflowText);
3432
3429
  const workflowEnvText = workflowPreambleBeforeJobs(normalized);
3433
3430
  const jobs = getGithubWorkflowJobBlocks(normalized).map((job) => {
@@ -3479,7 +3476,7 @@ function inspectDbMigrationWorkflow(relativePath, workflowText) {
3479
3476
  });
3480
3477
  return {
3481
3478
  jobs,
3482
- mainPush: githubWorkflowRunsOnMainPush(normalized),
3479
+ productionPush: githubWorkflowRunsOnBranchPush(normalized, productionBranch),
3483
3480
  usesGithubDatabaseUrlVariable: workflowUsesGithubDatabaseUrlVariable(normalized),
3484
3481
  relativePath,
3485
3482
  usesGithubDatabaseUrlSecret: workflowUsesGithubDatabaseUrlSecret(normalized),
@@ -3509,7 +3506,7 @@ function dbMigrationWorkflowIsValid(workflow) {
3509
3506
  function isJsonObject(value) {
3510
3507
  return typeof value === "object" && value !== null && !Array.isArray(value);
3511
3508
  }
3512
- function vercelMainDeploymentIsDisabled(vercelJson) {
3509
+ function vercelProductionDeploymentIsDisabled(vercelJson, productionBranch) {
3513
3510
  const git = vercelJson.git;
3514
3511
  if (!isJsonObject(git)) {
3515
3512
  return false;
@@ -3519,9 +3516,9 @@ function vercelMainDeploymentIsDisabled(vercelJson) {
3519
3516
  return true;
3520
3517
  }
3521
3518
  return isJsonObject(deploymentEnabled) &&
3522
- deploymentEnabled.main === false;
3519
+ deploymentEnabled[productionBranch] === false;
3523
3520
  }
3524
- async function checkDbProductionMigrationFlow(cwd, production) {
3521
+ async function checkDbProductionMigrationFlow(cwd, production, productionBranch) {
3525
3522
  const issues = [];
3526
3523
  const suggestions = new Set();
3527
3524
  const warnings = [];
@@ -3529,21 +3526,21 @@ async function checkDbProductionMigrationFlow(cwd, production) {
3529
3526
  const vercelJsonPath = join(cwd, "vercel.json");
3530
3527
  const vercelJsonText = await readTextIfExists(vercelJsonPath);
3531
3528
  if (!vercelJsonText) {
3532
- findings.push("DB production migration flow is missing vercel.json with automatic main deployments disabled.");
3533
- suggestions.add("Add `git.deploymentEnabled.main: false` to vercel.json so production deploys wait for the GitHub Actions migration job.");
3529
+ findings.push(`DB production migration flow is missing vercel.json with automatic ${productionBranch} deployments disabled.`);
3530
+ suggestions.add(`Add \`git.deploymentEnabled[${JSON.stringify(productionBranch)}]: false\` to vercel.json so production deploys wait for the GitHub Actions migration job.`);
3534
3531
  }
3535
3532
  else {
3536
3533
  try {
3537
3534
  const vercelJson = parseJson(vercelJsonText, "vercel.json");
3538
- if (!vercelMainDeploymentIsDisabled(vercelJson)) {
3539
- findings.push("DB production migration flow does not disable Vercel automatic deployments for main in vercel.json.");
3535
+ if (!vercelProductionDeploymentIsDisabled(vercelJson, productionBranch)) {
3536
+ findings.push(`DB production migration flow does not disable Vercel automatic deployments for ${productionBranch} in vercel.json.`);
3540
3537
  suggestions.add("Set `git.deploymentEnabled` to `false` in vercel.json so GitHub Actions owns production deployments.");
3541
3538
  }
3542
3539
  }
3543
3540
  catch (error) {
3544
3541
  findings.push("DB production migration flow could not inspect vercel.json: " +
3545
3542
  (error instanceof Error ? error.message : String(error)));
3546
- suggestions.add("Fix vercel.json so Loom can verify `git.deploymentEnabled.main: false`.");
3543
+ suggestions.add(`Fix vercel.json so Loom can verify \`git.deploymentEnabled[${JSON.stringify(productionBranch)}]: false\`.`);
3547
3544
  }
3548
3545
  }
3549
3546
  const workflowInspections = [];
@@ -3552,67 +3549,69 @@ async function checkDbProductionMigrationFlow(cwd, production) {
3552
3549
  if (!workflowText) {
3553
3550
  continue;
3554
3551
  }
3555
- workflowInspections.push(inspectDbMigrationWorkflow(relativePath, workflowText));
3552
+ workflowInspections.push(inspectDbMigrationWorkflow(relativePath, workflowText, productionBranch));
3556
3553
  }
3557
- const mainPushWorkflows = workflowInspections.filter((inspection) => inspection.mainPush);
3558
- const migrationJobs = mainPushWorkflows.flatMap((inspection) => inspection.jobs.filter((job) => job.migrateStepIndex >= 0));
3554
+ const productionPushWorkflows = workflowInspections.filter((inspection) => inspection.productionPush);
3555
+ const migrationJobs = productionPushWorkflows.flatMap((inspection) => inspection.jobs.filter((job) => job.migrateStepIndex >= 0));
3559
3556
  const migrationWorkflowPaths = [
3560
3557
  ...new Set(migrationJobs.map((inspection) => inspection.relativePath)),
3561
3558
  ];
3562
- const validMigrationWorkflow = mainPushWorkflows.find(dbMigrationWorkflowIsValid);
3563
- const oldDeployHookWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesOldVercelDeployHook);
3564
- const duplicatedDatabaseUrlWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlSecret);
3565
- const databaseUrlVariableWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlVariable);
3566
- const legacyUnpooledSecretWorkflows = mainPushWorkflows.filter((inspection) => inspection.usesGithubUnpooledDatabaseUrlSecret &&
3559
+ const validMigrationWorkflow = productionPushWorkflows.find(dbMigrationWorkflowIsValid);
3560
+ const oldDeployHookWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesOldVercelDeployHook);
3561
+ const duplicatedDatabaseUrlWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlSecret);
3562
+ const databaseUrlVariableWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesGithubDatabaseUrlVariable);
3563
+ const legacyUnpooledSecretWorkflows = productionPushWorkflows.filter((inspection) => inspection.usesGithubUnpooledDatabaseUrlSecret &&
3567
3564
  !inspection.usesGithubMigrationDatabaseUrlSecret);
3568
- const invalidMigrationValidationPaths = mainPushWorkflows.flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 &&
3565
+ const invalidMigrationValidationPaths = productionPushWorkflows.flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 &&
3569
3566
  !job.migrationVerifyUsesPulledSnapshot
3570
3567
  ? [inspection.relativePath]
3571
3568
  : []));
3572
- const structuralOnlyMigrationValidationPaths = mainPushWorkflows.flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 && !job.migrationVerifyConnects
3569
+ const structuralOnlyMigrationValidationPaths = productionPushWorkflows
3570
+ .flatMap((inspection) => inspection.jobs.flatMap((job) => job.migrationVerifyStepIndex >= 0 && !job.migrationVerifyConnects
3573
3571
  ? [inspection.relativePath]
3574
3572
  : []));
3575
- const vercelCurlWorkflowPaths = mainPushWorkflows.flatMap((inspection) => inspection.jobs.some((job) => job.vercelCurlStepIndex >= 0)
3573
+ const vercelCurlWorkflowPaths = productionPushWorkflows.flatMap((inspection) => inspection.jobs.some((job) => job.vercelCurlStepIndex >= 0)
3576
3574
  ? [inspection.relativePath]
3577
3575
  : []);
3578
3576
  if (!validMigrationWorkflow) {
3579
- if (mainPushWorkflows.length === 0) {
3580
- findings.push("DB production migration flow is missing a GitHub Actions workflow for pushes to main.");
3577
+ if (productionPushWorkflows.length === 0) {
3578
+ findings.push(`DB production migration flow is missing a GitHub Actions workflow for pushes to ${productionBranch}.`);
3581
3579
  }
3582
3580
  else if (migrationJobs.length === 0) {
3583
- findings.push("DB production migration flow does not run `db:migrate` in the main release workflow: " +
3584
- mainPushWorkflows.map((inspection) => inspection.relativePath).join(", "));
3581
+ findings.push(`DB production migration flow does not run \`db:migrate\` in the ${productionBranch} release workflow: ` +
3582
+ productionPushWorkflows.map((inspection) => inspection.relativePath)
3583
+ .join(", "));
3585
3584
  }
3586
3585
  else if (!migrationJobs.some((inspection) => inspection.hasDatabaseUrlBinding ||
3587
3586
  inspection.migrateWithVercelProductionEnvStepIndex >= 0)) {
3588
3587
  findings.push("DB production migration flow runs migrations without Vercel production env injection: " +
3589
3588
  migrationWorkflowPaths.join(", "));
3590
3589
  }
3591
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.stageStepIndex >= 0))) {
3590
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.stageStepIndex >= 0))) {
3592
3591
  findings.push("DB production migration flow does not stage a prebuilt production deployment before migrations: " +
3593
3592
  migrationWorkflowPaths.join(", "));
3594
3593
  }
3595
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.promoteStepIndex >= 0))) {
3594
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.promoteStepIndex >= 0))) {
3596
3595
  findings.push("DB production migration flow does not promote the staged deployment after migrations: " +
3597
3596
  migrationWorkflowPaths.join(", "));
3598
3597
  }
3599
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.snapshotStepIndex === job.pullStepIndex &&
3598
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.snapshotStepIndex === job.pullStepIndex &&
3600
3599
  job.metadataStepIndex > job.pullStepIndex &&
3601
3600
  job.prepareBuildEnvStepIndex > job.metadataStepIndex &&
3602
3601
  job.verifyBuildEnvStepIndex > job.buildStepIndex))) {
3603
3602
  findings.push("DB production migration flow does not preserve the pulled migration env and verify metadata-backed build placeholders: " +
3604
3603
  migrationWorkflowPaths.join(", "));
3605
3604
  }
3606
- else if (!mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.migrateStepRestoresPulledEnv))) {
3605
+ else if (!productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => job.migrateStepRestoresPulledEnv))) {
3607
3606
  findings.push("DB production migration flow does not restore the untouched pulled env before migrations: " +
3608
3607
  migrationWorkflowPaths.join(", "));
3609
3608
  }
3610
- else if (!mainPushWorkflows.some((inspection) => inspection.usesGithubMigrationDatabaseUrlSecret ||
3609
+ else if (!productionPushWorkflows.some((inspection) => inspection.usesGithubMigrationDatabaseUrlSecret ||
3611
3610
  inspection.usesGithubUnpooledDatabaseUrlSecret)) {
3612
3611
  findings.push("DB production migration flow is not ready for Sensitive database variables because it lacks a GitHub migration-secret binding: " +
3613
3612
  migrationWorkflowPaths.join(", "));
3614
3613
  }
3615
- else if (mainPushWorkflows.some((inspection) => inspection.jobs.some((job) => dbMigrationJobHasOrderedStagedRelease(job) &&
3614
+ else if (productionPushWorkflows.some((inspection) => inspection.jobs.some((job) => dbMigrationJobHasOrderedStagedRelease(job) &&
3616
3615
  !job.promoteStepUsesExplicitScope))) {
3617
3616
  findings.push("DB production migration flow promotes the staged deployment without an explicit Vercel team scope: " +
3618
3617
  migrationWorkflowPaths.join(", "));
@@ -5973,6 +5972,11 @@ export async function setupCloudflareR2(cwd, options = {}) {
5973
5972
  const dbConfig = mergeDbConfig(framework, dbFeature.config);
5974
5973
  const config = getFilesConfig(framework, dbConfig, feature.config);
5975
5974
  const existingProvider = config.storage.provider;
5975
+ if (existingProvider) {
5976
+ const policyIssues = filesR2PolicyIssues(existingProvider);
5977
+ if (policyIssues.length)
5978
+ throw new Error(policyIssues.join(" "));
5979
+ }
5976
5980
  const wranglerCommand = await detectWranglerCommand(cwd, commandRunner, env);
5977
5981
  if (!wranglerCommand) {
5978
5982
  throw new Error("Wrangler is not available. On Arch Linux install it with `sudo pacman -S wrangler`, then run `wrangler login`.");
@@ -6094,7 +6098,13 @@ export async function setupCloudflareR2(cwd, options = {}) {
6094
6098
  buckets,
6095
6099
  connectionStatus: "buckets-ready",
6096
6100
  credentialMode: "manual",
6097
- directBrowserAccess: false,
6101
+ directBrowserAccess: existingProvider?.directBrowserAccess ?? false,
6102
+ ...(existingProvider?.directUpload
6103
+ ? { directUpload: existingProvider.directUpload }
6104
+ : {}),
6105
+ ...(existingProvider?.forcePathStyle !== undefined
6106
+ ? { forcePathStyle: existingProvider.forcePathStyle }
6107
+ : {}),
6098
6108
  endpoint: cloudflareR2Endpoint(accountId, jurisdiction),
6099
6109
  jurisdiction,
6100
6110
  kind: "cloudflare-r2",
@@ -6119,6 +6129,16 @@ export async function setupCloudflareR2(cwd, options = {}) {
6119
6129
  throw new Error(`R2 bucket \`${bucket}\` exists, but Loom could not verify its private-access policy: ${privacy.detail}. Rerun after Wrangler can inspect public URL and custom-domain settings.`);
6120
6130
  }
6121
6131
  }
6132
+ if (config.storage.provider.directBrowserAccess) {
6133
+ for (const bucket of new Set(Object.values(buckets))) {
6134
+ const cors = await inspectR2BucketCors(cwd, commandRunner, providerEnv, wranglerCommand, bucket, config.storage.provider, options.cloudflareProfile);
6135
+ if (cors !== "matching") {
6136
+ throw new Error(`R2 bucket \`${bucket}\` CORS ${cors === "unknown"
6137
+ ? "could not be verified"
6138
+ : "differs from the declared presigned-PUT policy"}. Review and apply its exact CORS separately, then rerun setup; Loom never applies CORS implicitly.`);
6139
+ }
6140
+ }
6141
+ }
6122
6142
  const dependencyUpdate = await mutateProjectDependencies(cwd, tooling.dependencies, { dependencies: FILES_S3_DEPENDENCIES });
6123
6143
  if (dependencyUpdate.changed) {
6124
6144
  changedFiles.push(dependencyUpdate.config);
@@ -6138,7 +6158,9 @@ export async function setupCloudflareR2(cwd, options = {}) {
6138
6158
  const desiredLocalValues = {
6139
6159
  FILES_S3_BUCKET: localBucket,
6140
6160
  FILES_S3_ENDPOINT: localEndpoint,
6141
- FILES_S3_FORCE_PATH_STYLE: localProvider === "minio" ? "true" : "false",
6161
+ FILES_S3_FORCE_PATH_STYLE: localProvider === "minio"
6162
+ ? "true"
6163
+ : String(config.storage.provider.forcePathStyle ?? false),
6142
6164
  FILES_S3_REGION: "auto",
6143
6165
  FILES_STORAGE_PROVIDER: localProvider === "minio"
6144
6166
  ? "minio"
@@ -6186,6 +6208,7 @@ export async function setupCloudflareR2(cwd, options = {}) {
6186
6208
  FILES_S3_BUCKET: buckets[environment],
6187
6209
  FILES_S3_ENDPOINT: cloudflareR2Endpoint(accountId, jurisdiction),
6188
6210
  ...FILES_S3_NON_SECRET_ENV_VALUES,
6211
+ FILES_S3_FORCE_PATH_STYLE: String(config.storage.provider.forcePathStyle ?? false),
6189
6212
  };
6190
6213
  const existingNonSecretNames = Object.keys(nonSecretValues).filter((name) => hasExactEnvName(listing, name));
6191
6214
  if (existingNonSecretNames.length) {
@@ -6394,14 +6417,14 @@ function findGithubVariableValue(name, ...collections) {
6394
6417
  }
6395
6418
  return null;
6396
6419
  }
6397
- async function hasMainPushDbMigrationWorkflow(cwd) {
6420
+ async function hasProductionPushDbMigrationWorkflow(cwd, productionBranch) {
6398
6421
  for (const relativePath of await getGithubWorkflowRelativePaths(cwd)) {
6399
6422
  const workflowText = await readTextIfExists(join(cwd, relativePath));
6400
6423
  if (!workflowText) {
6401
6424
  continue;
6402
6425
  }
6403
- const inspection = inspectDbMigrationWorkflow(relativePath, workflowText);
6404
- if (inspection.mainPush &&
6426
+ const inspection = inspectDbMigrationWorkflow(relativePath, workflowText, productionBranch);
6427
+ if (inspection.productionPush &&
6405
6428
  inspection.jobs.some((job) => job.migrateStepIndex >= 0 ||
6406
6429
  job.stageStepIndex >= 0 ||
6407
6430
  job.promoteStepIndex >= 0)) {
@@ -6848,6 +6871,19 @@ async function checkDbNetworkFeature(context) {
6848
6871
  if (!feature || feature.status !== "active") {
6849
6872
  return [];
6850
6873
  }
6874
+ let productionBranch;
6875
+ try {
6876
+ productionBranch = resolveProductionBranch(feature.config?.release);
6877
+ }
6878
+ catch (error) {
6879
+ return [{
6880
+ label: "DB release configuration",
6881
+ run: () => Promise.resolve(networkCheckResult("issue", error.message, {
6882
+ issues: [error.message],
6883
+ suggestions: ["Fix features.db.config.release in loom.json."],
6884
+ })),
6885
+ }];
6886
+ }
6851
6887
  const provider = feature.config
6852
6888
  ?.provider;
6853
6889
  const state = {
@@ -6955,7 +6991,7 @@ async function checkDbNetworkFeature(context) {
6955
6991
  createDbEnvCheckStep("Preview has Neon/Postgres env vars", "preview", "present", state, context),
6956
6992
  createDbEnvCheckStep("Development does not have Neon/Postgres env vars", "development", "absent", state, context),
6957
6993
  ];
6958
- if (await hasMainPushDbMigrationWorkflow(context.cwd)) {
6994
+ if (await hasProductionPushDbMigrationWorkflow(context.cwd, productionBranch)) {
6959
6995
  steps.push(createGithubReleaseConfigCheckStep(state, context));
6960
6996
  }
6961
6997
  return steps;
@@ -6996,6 +7032,28 @@ async function inspectR2BucketPrivacy(cwd, commandRunner, env, wranglerCommand,
6996
7032
  }
6997
7033
  return { detail: "No public endpoint detected.", status: "private" };
6998
7034
  }
7035
+ async function inspectR2BucketCors(cwd, commandRunner, env, wranglerCommand, bucket, provider, cloudflareProfile) {
7036
+ const result = await commandRunner(wranglerCommand, r2BucketCommandArgs(["r2", "bucket", "cors", "list", bucket], provider, cloudflareProfile), {
7037
+ cwd,
7038
+ env: {
7039
+ ...env,
7040
+ NO_COLOR: "1",
7041
+ FORCE_COLOR: "0",
7042
+ WRANGLER_HIDE_BANNER: "true",
7043
+ },
7044
+ stdio: "pipe",
7045
+ });
7046
+ const rules = result.code === 0
7047
+ ? parseWranglerR2Cors(result.stdout, bucket)
7048
+ : null;
7049
+ if (rules === null)
7050
+ return "unknown";
7051
+ const environments = FILES_R2_ENVIRONMENTS.filter((environment) => provider.buckets[environment] === bucket);
7052
+ return provider.directUpload &&
7053
+ r2CorsMatchesPolicy(rules, provider.directUpload, environments)
7054
+ ? "matching"
7055
+ : "drift";
7056
+ }
6999
7057
  function checkFilesNetworkFeature(context) {
7000
7058
  const feature = context.manifest.features.files;
7001
7059
  if (!feature || feature.status !== "active")
@@ -7015,6 +7073,13 @@ function checkFilesNetworkFeature(context) {
7015
7073
  })),
7016
7074
  }];
7017
7075
  }
7076
+ const policyIssues = filesR2PolicyIssues(provider);
7077
+ if (policyIssues.length) {
7078
+ return [{
7079
+ label: "Cloudflare R2 private upload policy is valid",
7080
+ run: () => Promise.resolve(networkCheckResult("issue", "Invalid Files R2 policy; provider checks were not attempted.", { issues: policyIssues })),
7081
+ }];
7082
+ }
7018
7083
  const state = {
7019
7084
  accountAvailable: false,
7020
7085
  vercelCommand: null,
@@ -7134,6 +7199,33 @@ function checkFilesNetworkFeature(context) {
7134
7199
  },
7135
7200
  });
7136
7201
  }
7202
+ if (provider.directBrowserAccess) {
7203
+ for (const bucket of new Set(Object.values(provider.buckets))) {
7204
+ steps.push({
7205
+ label: `R2 bucket ${bucket} CORS matches the private presigned-PUT policy`,
7206
+ run: async () => {
7207
+ if (!state.wranglerCommand || !state.accountAvailable) {
7208
+ return networkCheckResult("skipped", "Skipped until Wrangler account access is verified.");
7209
+ }
7210
+ const cors = await inspectR2BucketCors(context.cwd, context.commandRunner, providerEnv, state.wranglerCommand, bucket, provider, context.cloudflareProfile);
7211
+ return cors === "matching"
7212
+ ? networkCheckResult("ok", `R2 bucket \`${bucket}\` CORS matches the declared private presigned-PUT policy.`)
7213
+ : networkCheckResult("issue", `R2 bucket \`${bucket}\` CORS is ${cors === "unknown"
7214
+ ? "unverified"
7215
+ : "different from the declared policy"}.`, {
7216
+ issues: [
7217
+ `Files R2 direct-upload CORS ${cors === "unknown"
7218
+ ? "could not be read or parsed"
7219
+ : "drift detected"}: ${bucket}.`,
7220
+ ],
7221
+ suggestions: [
7222
+ "Review the bucket's exact CORS policy using Wrangler; apply changes separately, then rerun `loom files r2 check`. Loom never applies CORS implicitly.",
7223
+ ],
7224
+ });
7225
+ },
7226
+ });
7227
+ }
7228
+ }
7137
7229
  steps.push({
7138
7230
  label: "Vercel CLI authentication and project link are available",
7139
7231
  run: async () => {
@@ -7209,6 +7301,7 @@ function checkFilesNetworkFeature(context) {
7209
7301
  FILES_S3_BUCKET: provider.buckets[environment],
7210
7302
  FILES_S3_ENDPOINT: provider.endpoint,
7211
7303
  ...FILES_S3_NON_SECRET_ENV_VALUES,
7304
+ FILES_S3_FORCE_PATH_STYLE: String(provider.forcePathStyle ?? false),
7212
7305
  };
7213
7306
  const drift = Object.entries(expectedValues).filter(([name, value]) => actualValues[name] !== value).map(([name]) => name);
7214
7307
  return drift.length
@@ -7469,6 +7562,7 @@ export async function setupGithubVercelRelease(cwd, options = {}) {
7469
7562
  const manifest = manifestText
7470
7563
  ? parseJson(manifestText, "loom.json")
7471
7564
  : null;
7565
+ const productionBranch = resolveProductionBranch(manifest?.features.db?.config?.release);
7472
7566
  const vercelLink = await readVercelProjectLink(cwd);
7473
7567
  if (!vercelLink.linked || !vercelLink.orgId || !vercelLink.projectId) {
7474
7568
  throw new Error(`${vercelLink.detail} Run \`vercel link\` before \`loom db release setup-github\`.`);
@@ -7507,8 +7601,8 @@ export async function setupGithubVercelRelease(cwd, options = {}) {
7507
7601
  `repos/:owner/:repo/environments/${environment}/deployment-branch-policies`,
7508
7602
  ], { cwd, env, stdio: "pipe" });
7509
7603
  const branchPolicies = parseJson(branchPoliciesResult.stdout || "{}", "GitHub deployment branch policies");
7510
- if (!branchPolicies.branch_policies?.some((policy) => policy.name === "main")) {
7511
- await requireCommand(`Allow main to deploy to GitHub ${environment}`, commandRunner, "gh", [
7604
+ if (!branchPolicies.branch_policies?.some((policy) => policy.name === productionBranch)) {
7605
+ await requireCommand(`Allow ${productionBranch} to deploy to GitHub ${environment}`, commandRunner, "gh", [
7512
7606
  "api",
7513
7607
  "--method",
7514
7608
  "POST",
@@ -7518,11 +7612,11 @@ export async function setupGithubVercelRelease(cwd, options = {}) {
7518
7612
  ], {
7519
7613
  cwd,
7520
7614
  env,
7521
- input: JSON.stringify({ name: "main", type: "branch" }),
7615
+ input: JSON.stringify({ name: productionBranch, type: "branch" }),
7522
7616
  stdio: "pipe",
7523
7617
  });
7524
7618
  }
7525
- notes.push(`Ensured GitHub environment \`${environment}\` exists and only allows the main release branch.`);
7619
+ notes.push(`Ensured GitHub environment \`${environment}\` exists and allows the ${productionBranch} release branch; existing branch policies are preserved.`);
7526
7620
  await requireCommand("Set GitHub VERCEL_ORG_ID variable", commandRunner, "gh", [
7527
7621
  "variable",
7528
7622
  "set",
@@ -7680,6 +7774,7 @@ async function applyDbFeature(cwd, framework, manifest, activate) {
7680
7774
  const currentFeature = manifest.features.db;
7681
7775
  const currentConfig = currentFeature?.config;
7682
7776
  const config = mergeDbConfig(framework, currentConfig);
7777
+ resolveProductionBranch(config.release);
7683
7778
  const feature = currentFeature
7684
7779
  ? structuredClone(currentFeature)
7685
7780
  : { status: "planned" };
@@ -8586,11 +8681,22 @@ async function checkDbFeature(cwd, framework, manifest, options) {
8586
8681
  return { issues, suggestions: [], warnings };
8587
8682
  }
8588
8683
  const config = mergeDbConfig(framework, feature.config);
8684
+ let productionBranch;
8685
+ try {
8686
+ productionBranch = resolveProductionBranch(config.release);
8687
+ }
8688
+ catch (error) {
8689
+ return {
8690
+ issues: [error.message],
8691
+ suggestions: ["Fix features.db.config.release in loom.json."],
8692
+ warnings,
8693
+ };
8694
+ }
8589
8695
  const { packageJson } = await readProjectPackageJson(cwd);
8590
8696
  const tooling = await getProjectTooling(cwd, manifest);
8591
8697
  const testRunner = await getDbTestRunner(cwd, tooling);
8592
8698
  const expectedScripts = getDbExpectedScripts(config, tooling);
8593
- const migrationFlowCheck = await checkDbProductionMigrationFlow(cwd, options.production ?? false);
8699
+ const migrationFlowCheck = await checkDbProductionMigrationFlow(cwd, options.production ?? false, productionBranch);
8594
8700
  issues.push(...migrationFlowCheck.issues);
8595
8701
  warnings.push(...migrationFlowCheck.warnings);
8596
8702
  for (const suggestion of migrationFlowCheck.suggestions) {
@@ -8915,10 +9021,7 @@ async function checkFilesFeature(cwd, framework, manifest, options) {
8915
9021
  if (provider.kind !== "cloudflare-r2") {
8916
9022
  issues.push("Files storage provider kind must be cloudflare-r2.");
8917
9023
  }
8918
- if (provider.accessMode !== "private" || provider.directBrowserAccess ||
8919
- provider.publicUrl !== null) {
8920
- issues.push("Files R2 provider policy must remain private unless a future explicit public-access workflow is adopted.");
8921
- }
9024
+ issues.push(...filesR2PolicyIssues(provider));
8922
9025
  if (!provider.accountId || !provider.buckets.production ||
8923
9026
  !provider.buckets.preview) {
8924
9027
  issues.push("Files R2 provider policy is missing account or bucket identifiers.");
@@ -0,0 +1,10 @@
1
+ /** App-owned production release settings in features.db.config.release. */
2
+ export type DbReleaseConfig = {
3
+ /** Literal short Git branch name; omitted settings retain the main default. */
4
+ productionBranch?: string;
5
+ };
6
+ /** Portable literal branch names, excluding Git-invalid paths and glob syntax. */
7
+ export declare const PRODUCTION_BRANCH_PATTERN: string;
8
+ /** Resolve the release branch before writing provider configuration or checking it. */
9
+ export declare function resolveProductionBranch(release: unknown): string;
10
+ //# sourceMappingURL=releaseConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"releaseConfig.d.ts","sourceRoot":"","sources":["../../../src/src/cli/releaseConfig.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GAAG;IAC5B,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,QAC8E,CAAC;AAErH,uFAAuF;AACvF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAuBhE"}
@@ -0,0 +1,22 @@
1
+ /** Portable literal branch names, excluding Git-invalid paths and glob syntax. */
2
+ export const PRODUCTION_BRANCH_PATTERN = String
3
+ .raw `^(?!HEAD$)(?!refs/)(?!.*(?:\.\.|//|/\.))(?!.*\.lock(?:/|$))(?!.*[/.]$)[A-Za-z0-9_][A-Za-z0-9._/-]*(?![\s\S])`;
4
+ /** Resolve the release branch before writing provider configuration or checking it. */
5
+ export function resolveProductionBranch(release) {
6
+ if (release === undefined)
7
+ return "main";
8
+ if (typeof release !== "object" || release === null || Array.isArray(release)) {
9
+ throw new Error("features.db.config.release must be an object.");
10
+ }
11
+ if (Object.keys(release).some((key) => key !== "productionBranch")) {
12
+ throw new Error("features.db.config.release only supports productionBranch.");
13
+ }
14
+ const branch = release.productionBranch;
15
+ if (branch === undefined)
16
+ return "main";
17
+ if (typeof branch !== "string" ||
18
+ !new RegExp(PRODUCTION_BRANCH_PATTERN).test(branch)) {
19
+ throw new Error("features.db.config.release.productionBranch must be a literal short Git branch name using letters, numbers, underscores, dots, hyphens or slashes; patterns and refs/ prefixes are not supported.");
20
+ }
21
+ return branch;
22
+ }
@@ -6,6 +6,10 @@ export declare const DEFAULT_LOOM_PWA_UPDATE_PROMPT = "A newer version of this w
6
6
  export interface LoomSerwistLifecycleEvent {
7
7
  /** Whether Serwist identified the event as an update to an existing worker. */
8
8
  isUpdate?: boolean;
9
+ /** Worker associated with this event, when supplied by the integration. */
10
+ sw?: ServiceWorker;
11
+ /** Whether another registration or tab initiated this lifecycle event. */
12
+ isExternal?: boolean;
9
13
  /** The Serwist lifecycle event name. */
10
14
  type: string;
11
15
  /** Whether a waiting service worker existed before registration completed. */
@@ -21,7 +25,7 @@ export type LoomSerwistEventName = "activated" | "controlling" | "installed" | "
21
25
  */
22
26
  export interface LoomWindowSerwist {
23
27
  addEventListener: (type: LoomSerwistEventName, listener: (event: LoomSerwistLifecycleEvent) => void) => void;
24
- messageSkipWaiting: () => Promise<void>;
28
+ messageSkipWaiting: () => void | Promise<void>;
25
29
  register: () => Promise<ServiceWorkerRegistration | undefined>;
26
30
  removeEventListener: (type: LoomSerwistEventName, listener: (event: LoomSerwistLifecycleEvent) => void) => void;
27
31
  }
@@ -80,6 +84,7 @@ export interface LoomPwaLifecycleOptions {
80
84
  updateMode?: LoomPwaUpdateMode;
81
85
  }
82
86
  declare global {
87
+ var serwist: LoomWindowSerwist | undefined;
83
88
  interface Window {
84
89
  serwist?: LoomWindowSerwist;
85
90
  }
@@ -87,7 +92,10 @@ declare global {
87
92
  /**
88
93
  * Registers Loom's Serwist lifecycle listeners and optional update polling.
89
94
  *
90
- * The returned cleanup function removes listeners and clears the polling timer.
95
+ * Cleanup removes this observer's listeners and polling without unregistering
96
+ * the worker or removing offline caches. Pending callbacks cannot activate or
97
+ * reload after cleanup. Registration is shared across effect remounts.
98
+ *
91
99
  * In `prompt` mode, a waiting worker is activated only after `canReloadNow` and
92
100
  * `confirmUpdate` both allow it; in `manual` mode Loom reports availability but
93
101
  * never activates the worker for the app.
@@ -1 +1 @@
1
- {"version":3,"file":"m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