@gadicc/loom 1.25.0 → 1.26.1

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 (34) hide show
  1. package/README.md +4 -3
  2. package/esm/src/cli/mod.d.ts +5 -0
  3. package/esm/src/cli/mod.d.ts.map +1 -1
  4. package/esm/src/cli/mod.js +65 -145
  5. package/esm/src/cli/releaseCredentials.d.ts +32 -0
  6. package/esm/src/cli/releaseCredentials.d.ts.map +1 -0
  7. package/esm/src/cli/releaseCredentials.js +388 -0
  8. package/esm/src/cli/releaseTrust.d.ts +39 -0
  9. package/esm/src/cli/releaseTrust.d.ts.map +1 -0
  10. package/esm/src/cli/releaseTrust.js +125 -0
  11. package/esm/src/cli/releaseTrustCommand.d.ts +18 -0
  12. package/esm/src/cli/releaseTrustCommand.d.ts.map +1 -0
  13. package/esm/src/cli/releaseTrustCommand.js +142 -0
  14. package/esm/src/cli/vercelBuildEnv.d.ts +6 -2
  15. package/esm/src/cli/vercelBuildEnv.d.ts.map +1 -1
  16. package/esm/src/cli/vercelBuildEnv.js +130 -14
  17. package/package.json +2 -2
  18. package/script/src/cli/mod.d.ts +5 -0
  19. package/script/src/cli/mod.d.ts.map +1 -1
  20. package/script/src/cli/mod.js +65 -145
  21. package/script/src/cli/releaseCredentials.d.ts +32 -0
  22. package/script/src/cli/releaseCredentials.d.ts.map +1 -0
  23. package/script/src/cli/releaseCredentials.js +392 -0
  24. package/script/src/cli/releaseTrust.d.ts +39 -0
  25. package/script/src/cli/releaseTrust.d.ts.map +1 -0
  26. package/script/src/cli/releaseTrust.js +130 -0
  27. package/script/src/cli/releaseTrustCommand.d.ts +18 -0
  28. package/script/src/cli/releaseTrustCommand.d.ts.map +1 -0
  29. package/script/src/cli/releaseTrustCommand.js +145 -0
  30. package/script/src/cli/vercelBuildEnv.d.ts +6 -2
  31. package/script/src/cli/vercelBuildEnv.d.ts.map +1 -1
  32. package/script/src/cli/vercelBuildEnv.js +128 -12
  33. package/skills/loom/SKILL.md +3 -1
  34. package/skills/loom-db/SKILL.md +22 -10
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runGithubReleaseTrustCommand = runGithubReleaseTrustCommand;
4
+ const promises_1 = require("node:fs/promises");
5
+ const node_path_1 = require("node:path");
6
+ const releaseConfig_js_1 = require("./releaseConfig.js");
7
+ const releaseTrust_js_1 = require("./releaseTrust.js");
8
+ function object(value) {
9
+ return value !== null && typeof value === "object" && !Array.isArray(value);
10
+ }
11
+ function json(text, description) {
12
+ try {
13
+ const value = JSON.parse(text);
14
+ if (object(value))
15
+ return value;
16
+ }
17
+ catch {
18
+ // Provider stdout can contain credentials; never reproduce it in an error.
19
+ }
20
+ throw new Error(`Invalid ${description} JSON.`);
21
+ }
22
+ /**
23
+ * Plan, apply, or verify one reviewed GitHub production HTTP trust rule.
24
+ * Planning only reads providers and writes an exclusive local proposal file.
25
+ * Apply checks current state twice, requires the reviewed proposal digest, and
26
+ * verifies the exact resulting provider state. It never creates a deploy token.
27
+ */
28
+ async function runGithubReleaseTrustCommand(action, args, options) {
29
+ const requiredCount = action === "plan" || action === "apply" ? 2 : 1;
30
+ if (args.length !== requiredCount) {
31
+ throw new Error(action === "plan"
32
+ ? "Usage: loom db release trust-plan <workflow-path> <plan-file> [--environment <name>]"
33
+ : action === "apply"
34
+ ? "Usage: loom db release trust-apply <plan-file> <reviewed-plan-sha256>"
35
+ : "Usage: loom db release trust-check <plan-file>");
36
+ }
37
+ const { cwd, env, commandRunner, vercelCli } = options;
38
+ async function command(command, args, input) {
39
+ let result;
40
+ try {
41
+ result = await commandRunner(command, args, {
42
+ cwd,
43
+ env,
44
+ ...(input === undefined ? {} : { input }),
45
+ stdio: "pipe",
46
+ });
47
+ }
48
+ catch {
49
+ throw new Error("Trusted Sources provider command did not complete.");
50
+ }
51
+ if (result.code !== 0) {
52
+ throw new Error(`Trusted Sources provider command failed (exit ${result.code}); inspect provider state before retrying an apply.`);
53
+ }
54
+ return result.stdout;
55
+ }
56
+ const link = json(await (0, promises_1.readFile)((0, node_path_1.resolve)(cwd, ".vercel/project.json"), "utf8"), "local Vercel project link");
57
+ if (typeof link.orgId !== "string" ||
58
+ typeof link.projectId !== "string" ||
59
+ !/^[A-Za-z0-9_-]+(?![\s\S])/.test(link.orgId) ||
60
+ !/^[A-Za-z0-9_-]+(?![\s\S])/.test(link.projectId))
61
+ throw new Error("Invalid local Vercel project link.");
62
+ const manifest = json(await (0, promises_1.readFile)((0, node_path_1.resolve)(cwd, "loom.json"), "utf8"), "Loom manifest");
63
+ const db = object(manifest.features) && object(manifest.features.db)
64
+ ? manifest.features.db
65
+ : undefined;
66
+ const release = db && object(db.config) ? db.config.release : undefined;
67
+ const productionBranch = (0, releaseConfig_js_1.resolveProductionBranch)(release);
68
+ const repository = json(await command("gh", ["api", "repos/:owner/:repo"]), "GitHub repository");
69
+ if (typeof repository.full_name !== "string" ||
70
+ (typeof repository.id !== "string" &&
71
+ !(typeof repository.id === "number" &&
72
+ Number.isSafeInteger(repository.id))))
73
+ throw new Error("Invalid canonical GitHub repository identity.");
74
+ const providerPath = (version) => `/v${version}/projects/${link.projectId}?teamId=${encodeURIComponent(link.orgId)}`;
75
+ const readProject = async () => json(await command(vercelCli, [
76
+ "api",
77
+ providerPath(10),
78
+ "--method",
79
+ "GET",
80
+ "--raw",
81
+ ]), "Vercel project");
82
+ if (action === "plan") {
83
+ if (typeof options.environment !== "string") {
84
+ throw new Error("A resolved GitHub environment is required for planning.");
85
+ }
86
+ // Requiring a local file avoids authorizing a misspelled/nonexistent workflow.
87
+ const workflowPath = args[0];
88
+ const target = {
89
+ projectId: link.projectId,
90
+ teamId: link.orgId,
91
+ repository: repository.full_name,
92
+ repositoryId: String(repository.id),
93
+ productionBranch,
94
+ githubEnvironment: options.environment,
95
+ workflowPath,
96
+ };
97
+ const plan = (0, releaseTrust_js_1.prepareGithubReleaseTrust)(await readProject(), target);
98
+ await (0, promises_1.readFile)((0, node_path_1.resolve)(cwd, workflowPath), "utf8");
99
+ const planFile = (0, node_path_1.resolve)(cwd, args[1]);
100
+ await (0, promises_1.writeFile)(planFile, `${JSON.stringify(plan, null, 2)}\n`, {
101
+ flag: "wx",
102
+ mode: 0o600,
103
+ });
104
+ return [
105
+ `Wrote Trusted Sources proposal: ${planFile}`,
106
+ `Reviewed proposal SHA-256: ${plan.approvalSha256}`,
107
+ "No provider settings changed. Review the proposal before trust-apply.",
108
+ ];
109
+ }
110
+ const value = json(await (0, promises_1.readFile)((0, node_path_1.resolve)(cwd, args[0]), "utf8"), "trust proposal");
111
+ if (value.profile !== "loom-github-release-trust-v1" || !object(value.target) ||
112
+ !object(value.patch) || !object(value.patch.trustedSources) ||
113
+ typeof value.approvalSha256 !== "string" ||
114
+ !/^[a-f0-9]{64}$/.test(value.approvalSha256) ||
115
+ value.target.projectId !== link.projectId ||
116
+ value.target.teamId !== link.orgId ||
117
+ value.target.repository !== repository.full_name ||
118
+ value.target.repositoryId !== String(repository.id) ||
119
+ value.target.productionBranch !== productionBranch ||
120
+ (options.environment !== undefined &&
121
+ value.target.githubEnvironment !== options.environment)) {
122
+ throw new Error("Trust proposal does not match this linked project and repository.");
123
+ }
124
+ const plan = value;
125
+ // Validate the workflow path before resolving untrusted proposal contents.
126
+ if (typeof plan.target.workflowPath !== "string" ||
127
+ !/^\.github\/workflows\/[A-Za-z0-9_.-]+\.ya?ml(?![\s\S])/.test(plan.target.workflowPath))
128
+ throw new Error("Invalid workflow path in trust proposal.");
129
+ await (0, promises_1.readFile)((0, node_path_1.resolve)(cwd, plan.target.workflowPath), "utf8");
130
+ if (action === "check") {
131
+ (0, releaseTrust_js_1.verifyGithubReleaseTrustApplied)(await readProject(), plan);
132
+ return ["Verified production Trusted Sources matches the local proposal."];
133
+ }
134
+ (0, releaseTrust_js_1.verifyGithubReleaseTrustPlan)(await readProject(), plan, args[1]);
135
+ if (plan.changed) {
136
+ (0, releaseTrust_js_1.verifyGithubReleaseTrustPlan)(await readProject(), plan, args[1]);
137
+ await command(vercelCli, ["api", providerPath(9), "--method", "PATCH", "--input", "-", "--raw"], JSON.stringify(plan.patch));
138
+ }
139
+ (0, releaseTrust_js_1.verifyGithubReleaseTrustApplied)(await readProject(), plan);
140
+ return [
141
+ plan.changed
142
+ ? "Applied and verified the reviewed production Trusted Sources rule."
143
+ : "Trusted Sources already matched; no provider settings changed.",
144
+ ];
145
+ }
@@ -20,9 +20,13 @@ export declare function prepareVercelBuildEnvironment({ envFile, manifestFile, m
20
20
  placeholders: BuildPlaceholder[];
21
21
  };
22
22
  /**
23
- * Rejects a Vercel artifact containing any unique build-only marker.
23
+ * Rejects a Vercel artifact containing any unique build-only marker. The scan
24
+ * follows contained symlinks and Vercel function filePathMap references so it
25
+ * covers FileFsRef content uploaded from outside `.vercel/output`.
24
26
  */
25
- export declare function verifyVercelBuildArtifact({ manifestFile, outputDirectory, }: {
27
+ export declare function verifyVercelBuildArtifact({ deploymentRoot, manifestFile, outputDirectory, }: {
28
+ /** Root from which Vercel resolves function filePathMap source paths. */
29
+ deploymentRoot?: string;
26
30
  manifestFile: string;
27
31
  outputDirectory: string;
28
32
  }, io?: CliOutput): void;
@@ -1 +1 @@
1
- {"version":3,"file":"vercelBuildEnv.d.ts","sourceRoot":"","sources":["../../../src/src/cli/vercelBuildEnv.ts"],"names":[],"mappings":"AAyBA,KAAK,gBAAgB,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAMF,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAAC;AAgBF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,WAG5D;AAsFD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,EACE,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,UAAU,GACX,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,EACD,EAAE,GAAE,SAAgD;;EAoGrD;AAeD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,EACE,YAAY,EACZ,eAAe,GAChB,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB,EACD,EAAE,GAAE,SAAgD,QAyCrD"}
1
+ {"version":3,"file":"vercelBuildEnv.d.ts","sourceRoot":"","sources":["../../../src/src/cli/vercelBuildEnv.ts"],"names":[],"mappings":"AAwCA,KAAK,gBAAgB,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAMF,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CAAC;AAgBF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,WAG5D;AAsFD;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,EACE,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,UAAU,GACX,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,EACD,EAAE,GAAE,SAAgD;;EAoGrD;AA0MD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,EACE,cAAc,EACd,YAAY,EACZ,eAAe,GAChB,EAAE;IACD,yEAAyE;IACzE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB,EACD,EAAE,GAAE,SAAgD,QA8CrD"}
@@ -149,23 +149,139 @@ function prepareVercelBuildEnvironment({ envFile, manifestFile, metadataFile, po
149
149
  (0, node_fs_1.chmodSync)(manifestFile, 0o600);
150
150
  return { placeholders };
151
151
  }
152
- function regularFiles(root) {
153
- const files = [];
154
- for (const entry of (0, node_fs_1.readdirSync)(root, { withFileTypes: true })) {
155
- const path = (0, node_path_1.join)(root, entry.name);
156
- if (entry.isDirectory()) {
157
- files.push(...regularFiles(path));
152
+ function isWithin(root, path) {
153
+ const rel = (0, node_path_1.relative)(root, path);
154
+ return rel === "" ||
155
+ (rel !== ".." && !rel.startsWith(`..${node_path_1.sep}`) && !(0, node_path_1.isAbsolute)(rel));
156
+ }
157
+ function fileSystemErrorCode(error) {
158
+ return typeof error === "object" && error !== null && "code" in error &&
159
+ typeof error.code === "string"
160
+ ? error.code
161
+ : undefined;
162
+ }
163
+ function inferDeploymentRoot(outputDirectory) {
164
+ const output = (0, node_path_1.resolve)(outputDirectory);
165
+ const vercelDirectory = (0, node_path_1.dirname)(output);
166
+ return (0, node_path_1.basename)(output) === "output" &&
167
+ (0, node_path_1.basename)(vercelDirectory) === ".vercel"
168
+ ? (0, node_path_1.dirname)(vercelDirectory)
169
+ : undefined;
170
+ }
171
+ function resolveGraphPath(path, description) {
172
+ try {
173
+ return (0, node_fs_1.realpathSync)(path);
174
+ }
175
+ catch (error) {
176
+ const code = fileSystemErrorCode(error);
177
+ if (code === "ELOOP") {
178
+ throw new Error(`Vercel artifact contains a symlink cycle at ${description}: ${path}`);
179
+ }
180
+ if (code === "ENOENT") {
181
+ throw new Error(`Vercel artifact path is missing or has a broken symlink at ${description}: ${path}`);
182
+ }
183
+ throw new Error(`Vercel artifact path cannot be resolved at ${description}: ${path}`);
184
+ }
185
+ }
186
+ function visitArtifactPath(path, description, allowedRoot, graph, ancestors = new Set()) {
187
+ const canonicalPath = resolveGraphPath(path, description);
188
+ if (!isWithin(allowedRoot, canonicalPath)) {
189
+ throw new Error(`Vercel artifact path resolves outside the deployment root at ${description}: ${path}`);
190
+ }
191
+ let stats;
192
+ try {
193
+ stats = (0, node_fs_1.lstatSync)(canonicalPath);
194
+ }
195
+ catch {
196
+ throw new Error(`Vercel artifact path cannot be inspected at ${description}: ${path}`);
197
+ }
198
+ if (stats.isFile()) {
199
+ graph.files.add(canonicalPath);
200
+ if ((0, node_path_1.basename)(path) === ".vc-config.json" ||
201
+ (0, node_path_1.basename)(canonicalPath) === ".vc-config.json") {
202
+ graph.configurationFiles.add(canonicalPath);
203
+ }
204
+ return;
205
+ }
206
+ if (!stats.isDirectory()) {
207
+ throw new Error(`Vercel artifact contains an unsupported filesystem entry at ${description}: ${path}`);
208
+ }
209
+ if (ancestors.has(canonicalPath)) {
210
+ throw new Error(`Vercel artifact contains a directory symlink cycle at ${description}: ${path}`);
211
+ }
212
+ if (graph.visitedDirectories.has(canonicalPath)) {
213
+ return;
214
+ }
215
+ graph.visitedDirectories.add(canonicalPath);
216
+ const nextAncestors = new Set(ancestors);
217
+ nextAncestors.add(canonicalPath);
218
+ for (const entry of (0, node_fs_1.readdirSync)(canonicalPath, { withFileTypes: true })) {
219
+ visitArtifactPath((0, node_path_1.join)(canonicalPath, entry.name), description, allowedRoot, graph, nextAncestors);
220
+ }
221
+ }
222
+ function collectDeployableArtifactFiles(outputDirectory, deploymentRoot) {
223
+ const output = (0, node_path_1.resolve)(outputDirectory);
224
+ const resolutionRoot = deploymentRoot === undefined
225
+ ? inferDeploymentRoot(output)
226
+ : (0, node_path_1.resolve)(deploymentRoot);
227
+ const lexicalRoot = resolutionRoot ?? output;
228
+ if (!isWithin(lexicalRoot, output)) {
229
+ throw new Error(`Vercel output directory is outside the deployment root: ${output}`);
230
+ }
231
+ const allowedRoot = resolveGraphPath(lexicalRoot, "deployment root");
232
+ const graph = {
233
+ configurationFiles: new Set(),
234
+ files: new Set(),
235
+ visitedDirectories: new Set(),
236
+ };
237
+ visitArtifactPath(output, "output directory", allowedRoot, graph);
238
+ const configurationFiles = [...graph.configurationFiles];
239
+ for (const configurationFile of configurationFiles) {
240
+ let configuration;
241
+ try {
242
+ configuration = readJson(configurationFile);
243
+ }
244
+ catch {
245
+ throw new Error(`Vercel function configuration is not valid JSON: ${configurationFile}`);
246
+ }
247
+ if (typeof configuration !== "object" || configuration === null ||
248
+ Array.isArray(configuration)) {
249
+ throw new Error(`Vercel function configuration is invalid: ${configurationFile}`);
158
250
  }
159
- else if (entry.isFile()) {
160
- files.push(path);
251
+ const filePathMap = configuration.filePathMap;
252
+ if (filePathMap === undefined) {
253
+ continue;
254
+ }
255
+ if (typeof filePathMap !== "object" || filePathMap === null ||
256
+ Array.isArray(filePathMap)) {
257
+ throw new Error(`Vercel function filePathMap is invalid: ${configurationFile}`);
258
+ }
259
+ const filePathMapEntries = Object.entries(filePathMap);
260
+ if (filePathMapEntries.length === 0) {
261
+ continue;
262
+ }
263
+ if (resolutionRoot === undefined) {
264
+ throw new Error(`Vercel function filePathMap requires a deployment root; use .vercel/output or provide deploymentRoot: ${configurationFile}`);
265
+ }
266
+ for (const [bundlePath, sourcePath] of filePathMapEntries) {
267
+ if (typeof sourcePath !== "string" || sourcePath.length === 0) {
268
+ throw new Error(`Vercel function filePathMap target is invalid for ${bundlePath}: ${configurationFile}`);
269
+ }
270
+ const mappedPath = (0, node_path_1.resolve)((0, node_path_1.join)(resolutionRoot, sourcePath));
271
+ if (!isWithin(resolutionRoot, mappedPath)) {
272
+ throw new Error(`Vercel function filePathMap target resolves outside the deployment root and would be ignored by Vercel CLI for ${bundlePath}: ${sourcePath}`);
273
+ }
274
+ visitArtifactPath(mappedPath, `filePathMap entry ${bundlePath}`, allowedRoot, graph);
161
275
  }
162
276
  }
163
- return files;
277
+ return graph.files;
164
278
  }
165
279
  /**
166
- * Rejects a Vercel artifact containing any unique build-only marker.
280
+ * Rejects a Vercel artifact containing any unique build-only marker. The scan
281
+ * follows contained symlinks and Vercel function filePathMap references so it
282
+ * covers FileFsRef content uploaded from outside `.vercel/output`.
167
283
  */
168
- function verifyVercelBuildArtifact({ manifestFile, outputDirectory, }, io = { out: (line) => console.log(line) }) {
284
+ function verifyVercelBuildArtifact({ deploymentRoot, manifestFile, outputDirectory, }, io = { out: (line) => console.log(line) }) {
169
285
  const manifest = readJson(manifestFile);
170
286
  if (!Array.isArray(manifest.placeholders)) {
171
287
  throw new Error("Build placeholder manifest is invalid.");
@@ -179,7 +295,7 @@ function verifyVercelBuildArtifact({ manifestFile, outputDirectory, }, io = { ou
179
295
  throw new Error("Build placeholder manifest is invalid.");
180
296
  }
181
297
  const leaks = [];
182
- for (const path of regularFiles(outputDirectory)) {
298
+ for (const path of collectDeployableArtifactFiles(outputDirectory, deploymentRoot)) {
183
299
  const contents = (0, node_fs_1.readFileSync)(path);
184
300
  for (const placeholder of placeholders) {
185
301
  if (contents.includes(Buffer.from(placeholder.marker))) {
@@ -75,7 +75,9 @@ from the consumer's working directory.
75
75
  versions may write either an empty value or a redaction sentinel.
76
76
  - For external prebuilds, query Vercel env metadata, preserve usable pulled
77
77
  values, add unique build-only placeholders only for confirmed Sensitive
78
- entries, and reject an artifact containing any placeholder marker. Preserve an
78
+ entries, and reject any marker across the complete deployable artifact graph,
79
+ including contained symlinks and function `filePathMap` content. Prefer
80
+ `vercel build --standalone` for local prebuilt deployments. Preserve an
79
81
  untouched pull snapshot for migrations; once database variables are Sensitive,
80
82
  overlay a separately governed GitHub `MIGRATION_DATABASE_URL_UNPOOLED` secret
81
83
  only for migration validation and the migration command. Readable pulled URLs
@@ -91,7 +91,11 @@ Use this skill when working on the shared DB stack from a consuming app.
91
91
  Sensitive values, and scan `.vercel/output` for those markers before uploading
92
92
  the prebuilt artifact. Prefer `loom db release prepare-build-env` and
93
93
  `loom db release verify-build-env`; keep only the declarative requirements
94
- policy app-local.
94
+ policy app-local. Prefer `vercel build --standalone` for local prebuilt
95
+ deployments so FileFsRef content is materialized inside the output. Loom also
96
+ scans contained symlinks and function `filePathMap` targets; pass the Vercel
97
+ deployment root as the optional third `verify-build-env` argument when a
98
+ monorepo's mappings are relative to a root above the app.
95
99
  - Use
96
100
  `loom db migrations verify-env --connect --env-file
97
101
  "$RUNNER_TEMP/vercel-production.env"`
@@ -113,16 +117,24 @@ Use this skill when working on the shared DB stack from a consuming app.
113
117
  skill links are hydrated. Initialization preserves an equivalent formatted
114
118
  `loom.json` instead of creating formatting-only drift.
115
119
  - Use `loom db release setup-github` to create/update that GitHub release
116
- configuration from the linked Vercel project, including storing a Vercel token
117
- scoped to the linked team as the GitHub `VERCEL_TOKEN` environment secret.
118
- Vercel CLI 55 advertised project-scoped token creation but the service
119
- rejected it during verification on 2026-07-21; treat project scope as an
120
- availability-dependent improvement and verify a replacement before revoking
121
- the working team-scoped token.
120
+ configuration from the linked Vercel project. A normal rerun preserves an
121
+ existing write-only GitHub `VERCEL_TOKEN` and refuses to associate it with a
122
+ different linked org or project. New credentials default to project scope and
123
+ expire after 90 days; use `--rotate-token` for explicit replacement,
124
+ `--token-expiry-days` for another bounded lifetime, or `--token-scope team`
125
+ only as an explicit compatibility option. Keep the previous token active until
126
+ a full release succeeds with its replacement. If the current Vercel login
127
+ cannot mint tokens, create a bounded project token in Vercel and install it
128
+ through GitHub's hidden environment-secret input rather than broadening its
129
+ scope.
122
130
  - Smoke check the staged deployment URL after promotion with normal `curl`.
123
- Create a short-lived Vercel Protection Bypass for Automation secret through
124
- the Vercel API, send it as the `x-vercel-protection-bypass` header, and revoke
125
- it in the same step. Avoid the beta `vercel curl` command in CI.
131
+ Existing workflows may continue to create a short-lived Vercel Protection
132
+ Bypass for Automation secret through the Vercel API, send it as the
133
+ `x-vercel-protection-bypass` header, and revoke it in the same step. Apps may
134
+ instead adopt the reviewed GitHub OIDC Trusted Sources flow with
135
+ `loom db release trust-plan`, `trust-apply`, and `trust-check`; see
136
+ `docs/release-trusted-sources.md`. Keep either change app-owned and
137
+ deliberate. Avoid the beta `vercel curl` command in CI.
126
138
  - Production migrations must remain backward-compatible with the currently live
127
139
  app because old code continues serving traffic until the staged deployment is
128
140
  promoted. Use expand/contract migrations for destructive schema changes.