@akal/supaforge 0.0.0-stage → 0.0.31

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 (99) hide show
  1. package/README.md +350 -2
  2. package/bin/dev.js +10 -0
  3. package/bin/run.js +18 -0
  4. package/dist/base-command.d.ts +134 -0
  5. package/dist/base-command.js +9 -0
  6. package/dist/base-command.js.map +1 -0
  7. package/dist/branch-C4ndfoj5.d.ts +58 -0
  8. package/dist/chunk-4OU7KO5Y.js +13 -0
  9. package/dist/chunk-4OU7KO5Y.js.map +1 -0
  10. package/dist/chunk-5QQBTLWO.js +642 -0
  11. package/dist/chunk-5QQBTLWO.js.map +1 -0
  12. package/dist/chunk-5Z3SAIQS.js +2807 -0
  13. package/dist/chunk-5Z3SAIQS.js.map +1 -0
  14. package/dist/chunk-6WAMNZLO.js +336 -0
  15. package/dist/chunk-6WAMNZLO.js.map +1 -0
  16. package/dist/chunk-BHYLBKYD.js +156 -0
  17. package/dist/chunk-BHYLBKYD.js.map +1 -0
  18. package/dist/chunk-BLKJWDTL.js +153 -0
  19. package/dist/chunk-BLKJWDTL.js.map +1 -0
  20. package/dist/chunk-DQQ5E563.js +64 -0
  21. package/dist/chunk-DQQ5E563.js.map +1 -0
  22. package/dist/chunk-G2DIPIYU.js +94 -0
  23. package/dist/chunk-G2DIPIYU.js.map +1 -0
  24. package/dist/chunk-H5MJ5DFX.js +16 -0
  25. package/dist/chunk-H5MJ5DFX.js.map +1 -0
  26. package/dist/chunk-KIFJGON5.js +248 -0
  27. package/dist/chunk-KIFJGON5.js.map +1 -0
  28. package/dist/chunk-LQXF65MC.js +240 -0
  29. package/dist/chunk-LQXF65MC.js.map +1 -0
  30. package/dist/chunk-NXRSAVRU.js +478 -0
  31. package/dist/chunk-NXRSAVRU.js.map +1 -0
  32. package/dist/chunk-PARSNTBD.js +837 -0
  33. package/dist/chunk-PARSNTBD.js.map +1 -0
  34. package/dist/chunk-RRMI5CZD.js +376 -0
  35. package/dist/chunk-RRMI5CZD.js.map +1 -0
  36. package/dist/chunk-SF3YA42C.js +506 -0
  37. package/dist/chunk-SF3YA42C.js.map +1 -0
  38. package/dist/chunk-TQJSQLWA.js +574 -0
  39. package/dist/chunk-TQJSQLWA.js.map +1 -0
  40. package/dist/chunk-VMTBLHN2.js +122 -0
  41. package/dist/chunk-VMTBLHN2.js.map +1 -0
  42. package/dist/chunk-VOXZWQ3N.js +948 -0
  43. package/dist/chunk-VOXZWQ3N.js.map +1 -0
  44. package/dist/chunk-X6V2GGDZ.js +333 -0
  45. package/dist/chunk-X6V2GGDZ.js.map +1 -0
  46. package/dist/chunk-XMYMIURR.js +552 -0
  47. package/dist/chunk-XMYMIURR.js.map +1 -0
  48. package/dist/chunk-YVDSR4GM.js +1264 -0
  49. package/dist/chunk-YVDSR4GM.js.map +1 -0
  50. package/dist/commands/clone.d.ts +66 -0
  51. package/dist/commands/clone.js +416 -0
  52. package/dist/commands/clone.js.map +1 -0
  53. package/dist/commands/diff.d.ts +65 -0
  54. package/dist/commands/diff.js +24 -0
  55. package/dist/commands/diff.js.map +1 -0
  56. package/dist/commands/help.d.ts +32 -0
  57. package/dist/commands/help.js +36 -0
  58. package/dist/commands/help.js.map +1 -0
  59. package/dist/commands/hukam.d.ts +13 -0
  60. package/dist/commands/hukam.js +29 -0
  61. package/dist/commands/hukam.js.map +1 -0
  62. package/dist/commands/init.d.ts +47 -0
  63. package/dist/commands/init.js +388 -0
  64. package/dist/commands/init.js.map +1 -0
  65. package/dist/commands/mcp.d.ts +13 -0
  66. package/dist/commands/mcp.js +44 -0
  67. package/dist/commands/mcp.js.map +1 -0
  68. package/dist/commands/migrate/baseline.d.ts +24 -0
  69. package/dist/commands/migrate/baseline.js +69 -0
  70. package/dist/commands/migrate/baseline.js.map +1 -0
  71. package/dist/commands/migrate/create.d.ts +36 -0
  72. package/dist/commands/migrate/create.js +128 -0
  73. package/dist/commands/migrate/create.js.map +1 -0
  74. package/dist/commands/migrate/list.d.ts +23 -0
  75. package/dist/commands/migrate/list.js +110 -0
  76. package/dist/commands/migrate/list.js.map +1 -0
  77. package/dist/commands/migrate/run.d.ts +61 -0
  78. package/dist/commands/migrate/run.js +19 -0
  79. package/dist/commands/migrate/run.js.map +1 -0
  80. package/dist/commands/report.d.ts +27 -0
  81. package/dist/commands/report.js +210 -0
  82. package/dist/commands/report.js.map +1 -0
  83. package/dist/commands/restore.d.ts +26 -0
  84. package/dist/commands/restore.js +268 -0
  85. package/dist/commands/restore.js.map +1 -0
  86. package/dist/commands/snapshot.d.ts +33 -0
  87. package/dist/commands/snapshot.js +251 -0
  88. package/dist/commands/snapshot.js.map +1 -0
  89. package/dist/commands/sync.d.ts +16 -0
  90. package/dist/commands/sync.js +39 -0
  91. package/dist/commands/sync.js.map +1 -0
  92. package/dist/config-CTbeRlJk.d.ts +134 -0
  93. package/dist/help.d.ts +28 -0
  94. package/dist/help.js +64 -0
  95. package/dist/help.js.map +1 -0
  96. package/dist/index.d.ts +493 -0
  97. package/dist/index.js +147 -0
  98. package/dist/index.js.map +1 -0
  99. package/package.json +74 -4
@@ -0,0 +1,416 @@
1
+ import {
2
+ renderTip
3
+ } from "../chunk-BLKJWDTL.js";
4
+ import {
5
+ BaseCommand,
6
+ DEFAULT_LOCAL_PORT,
7
+ LOCAL_PG_PASSWORD,
8
+ LOCAL_PG_USER,
9
+ startLocalPg
10
+ } from "../chunk-SF3YA42C.js";
11
+ import {
12
+ addBranchToManifest,
13
+ cloneRemoteToLocal,
14
+ deleteBranch,
15
+ listBranches,
16
+ reconcileClones,
17
+ replaceDbName
18
+ } from "../chunk-5QQBTLWO.js";
19
+ import {
20
+ captureSnapshot,
21
+ checkPgDumpCompat,
22
+ formatSnapshotLayers
23
+ } from "../chunk-YVDSR4GM.js";
24
+ import "../chunk-DQQ5E563.js";
25
+ import {
26
+ errMsg,
27
+ pgClientConfig,
28
+ redactUrls
29
+ } from "../chunk-X6V2GGDZ.js";
30
+ import {
31
+ CLONE_EXTRA_EXCLUDE_SCHEMAS,
32
+ CLONE_SKIP_FLAGS,
33
+ DEFAULT_IGNORE_SCHEMAS,
34
+ MIGRATIONS_SUBDIR,
35
+ SUPAFORGE_DIR,
36
+ bold,
37
+ cmd,
38
+ dim,
39
+ loadConfig,
40
+ ok,
41
+ warn
42
+ } from "../chunk-6WAMNZLO.js";
43
+
44
+ // src/commands/clone.ts
45
+ import { writeFile, mkdir } from "fs/promises";
46
+ import { resolve } from "path";
47
+ import { Flags } from "@oclif/core";
48
+ import pg from "pg";
49
+ var CLONE_EXCLUDE_SCHEMAS = [.../* @__PURE__ */ new Set([
50
+ ...DEFAULT_IGNORE_SCHEMAS,
51
+ ...CLONE_EXTRA_EXCLUDE_SCHEMAS
52
+ ])];
53
+ var Clone = class _Clone extends BaseCommand {
54
+ static description = "Clone a remote Supabase environment to a local database";
55
+ static examples = [
56
+ "<%= config.bin %> clone --env=production",
57
+ "<%= config.bin %> clone --env=production --apply",
58
+ "<%= config.bin %> clone --env=production --force --apply",
59
+ "<%= config.bin %> clone --env=production --schema-only --apply",
60
+ "<%= config.bin %> clone --env=production --start-local --apply",
61
+ "<%= config.bin %> clone --list",
62
+ "<%= config.bin %> clone --delete=my-clone --apply"
63
+ ];
64
+ static flags = {
65
+ env: Flags.string({
66
+ char: "e",
67
+ description: "Source environment to clone from (defaults to config source)"
68
+ }),
69
+ "local-db": Flags.string({
70
+ description: "Name for the local database (default: supaforge_local)",
71
+ default: "supaforge_local"
72
+ }),
73
+ "local-url": Flags.string({
74
+ description: "Local PostgreSQL URL (default: postgres://postgres:postgres@localhost:5432/postgres)",
75
+ default: `postgres://${LOCAL_PG_USER}:${LOCAL_PG_PASSWORD}@localhost:${DEFAULT_LOCAL_PORT}/postgres`
76
+ }),
77
+ "start-local": Flags.boolean({
78
+ description: "Auto-start a local PostgreSQL container via Podman or Docker",
79
+ default: false
80
+ }),
81
+ "schema-only": Flags.boolean({
82
+ description: "Copy schema only, no data",
83
+ default: false
84
+ }),
85
+ force: Flags.boolean({
86
+ char: "f",
87
+ description: "Drop and recreate the target database if it already exists",
88
+ default: false
89
+ }),
90
+ apply: Flags.boolean({
91
+ description: "Execute the operation (default: dry-run preview)",
92
+ default: false
93
+ }),
94
+ list: Flags.boolean({
95
+ description: "List existing clones",
96
+ default: false
97
+ }),
98
+ delete: Flags.string({
99
+ description: "Delete a clone by name (requires --apply to execute)"
100
+ }),
101
+ json: Flags.boolean({ description: "Output results as JSON" })
102
+ };
103
+ async run() {
104
+ const { flags } = await this.parse(_Clone);
105
+ if (flags.list) {
106
+ const softConfig = await loadConfig().catch(() => void 0);
107
+ const localEnv = softConfig?.environments?.local;
108
+ let localServerUrl;
109
+ let configuredLocalDb;
110
+ if (localEnv?.dbUrl) {
111
+ localServerUrl = localEnv.dbUrl;
112
+ try {
113
+ configuredLocalDb = new URL(localEnv.dbUrl).pathname.replace(/^\//, "") || void 0;
114
+ } catch {
115
+ }
116
+ }
117
+ const branches = localServerUrl ? await reconcileClones({ localServerUrl, configuredLocalDb }) : (await listBranches()).map((b) => ({ ...b, missing: false, discovered: false }));
118
+ if (branches.length === 0) {
119
+ this.log(`
120
+ No clones found. Create one with: ${cmd("supaforge clone --env=<name> --apply")}
121
+ `);
122
+ return;
123
+ }
124
+ if (flags.json) {
125
+ this.json(branches);
126
+ return;
127
+ }
128
+ this.log(`
129
+ ${bold(`${branches.length} clone(s):`)}
130
+ `);
131
+ for (const b of branches) {
132
+ const tags = [
133
+ b.discovered ? dim("(discovered)") : "",
134
+ b.missing ? warn("(database missing)") : ""
135
+ ].filter(Boolean).join(" ");
136
+ this.log(` ${bold(b.name)}${tags ? " " + tags : ""}`);
137
+ this.log(` Database: ${b.dbName}`);
138
+ this.log(` From: ${b.createdFrom}`);
139
+ if (b.createdAt) this.log(` Created: ${b.createdAt}`);
140
+ this.log(` Schema: ${b.schemaOnly ? "only" : "full"}`);
141
+ this.log("");
142
+ }
143
+ return;
144
+ }
145
+ const config = await this.loadConfigOrFail();
146
+ if (flags.delete) {
147
+ const { env: env2 } = this.resolveEnv(config, flags.env);
148
+ const branches = await listBranches();
149
+ const branch = branches.find((b) => b.name === flags.delete);
150
+ if (!branch) {
151
+ this.error(`Clone "${flags.delete}" not found. Run "supaforge clone --list" to see clones.`);
152
+ }
153
+ if (!flags.apply) {
154
+ this.log(`
155
+ ${bold("Delete clone preview")} ${dim("(dry-run)")}
156
+ `);
157
+ this.log(` Clone: ${branch.name}`);
158
+ this.log(` Database: ${branch.dbName}`);
159
+ this.log(` Created: ${branch.createdAt}`);
160
+ this.log(` From: ${branch.createdFrom}`);
161
+ this.log("");
162
+ this.log(" This would:");
163
+ this.log(` 1. Terminate connections to "${branch.dbName}"`);
164
+ this.log(` 2. DROP DATABASE "${branch.dbName}"`);
165
+ this.log(" 3. Remove clone from .supaforge/branches.json");
166
+ this.log(`
167
+ \u2192 Add ${cmd("--apply")} to delete the clone.
168
+ `);
169
+ return;
170
+ }
171
+ this.log(`
172
+ Deleting clone "${branch.name}"...
173
+ `);
174
+ await deleteBranch(flags.delete, env2.dbUrl);
175
+ this.log(` ${ok("\u2713")} Clone "${branch.name}" deleted.
176
+ `);
177
+ return;
178
+ }
179
+ const { envName, env } = this.resolveEnv(config, flags.env);
180
+ const localDbName = flags["local-db"];
181
+ let localBaseUrl = flags["local-url"];
182
+ if (flags["start-local"]) {
183
+ this.log(`
184
+ ${bold("Starting local PostgreSQL container...")}
185
+ `);
186
+ const info = await startLocalPg();
187
+ localBaseUrl = info.url;
188
+ this.log(` ${ok("\u2713")} PostgreSQL running via ${bold(info.runtime)} on port ${info.port}
189
+ `);
190
+ }
191
+ const localDbUrl = replaceDbName(localBaseUrl, localDbName);
192
+ const pre = this.createPreflight("Clone preflight checks").addDatabase("Remote", envName, env.dbUrl).addInfo("Local DB", localDbName).addInfo("Local URL", dim(redactUrls(localDbUrl))).addInfo("Schema only", String(flags["schema-only"]));
193
+ if (flags["start-local"]) {
194
+ pre.addCheck("Local PostgreSQL", async () => ({
195
+ detail: `auto-started via --start-local`
196
+ }));
197
+ } else {
198
+ pre.addDatabase("Local", "local", localBaseUrl);
199
+ }
200
+ pre.addCheck("pg_dump compatibility", async () => {
201
+ try {
202
+ const compat = await checkPgDumpCompat(env.dbUrl);
203
+ if (compat.compatible) {
204
+ const pathNote = compat.pgDumpPath === "pg_dump" ? "" : ` (${compat.pgDumpPath})`;
205
+ return { detail: `v${compat.localMajor} \u2194 server v${compat.serverMajor}${pathNote}` };
206
+ }
207
+ return { error: compat.message };
208
+ } catch (err) {
209
+ return { error: `pg_dump check failed: ${err.message}` };
210
+ }
211
+ });
212
+ pre.addCheck("Target database", async () => {
213
+ try {
214
+ const client = new pg.Client(pgClientConfig(localBaseUrl));
215
+ await client.connect();
216
+ const { rows } = await client.query(
217
+ "SELECT 1 FROM pg_database WHERE datname = $1",
218
+ [localDbName]
219
+ );
220
+ await client.end();
221
+ if (rows.length > 0) {
222
+ if (flags.force) {
223
+ return { detail: `"${localDbName}" exists \u2014 will be dropped (--force)` };
224
+ }
225
+ return {
226
+ error: `"${localDbName}" already exists on local server`,
227
+ hints: [`Use ${cmd("--force")} to drop and recreate it.`]
228
+ };
229
+ }
230
+ return { detail: `"${localDbName}" does not exist yet` };
231
+ } catch {
232
+ return {};
233
+ }
234
+ });
235
+ const report = await pre.run();
236
+ if (!flags.apply) {
237
+ if (flags.json) {
238
+ this.json({ dryRun: true, passed: report.passed, localDb: localDbName });
239
+ if (!report.passed) this.exit(1);
240
+ return;
241
+ }
242
+ if (report.passed) {
243
+ this.log(` Steps that will be performed:`);
244
+ this.log(" 1. Create local database via pg_dump | pg_restore");
245
+ this.log(" 2. Capture full snapshot of remote environment");
246
+ this.log(" 3. Store snapshot as baseline migration");
247
+ this.log(" 4. Update supaforge.config.json with local + remote environments");
248
+ this.log("");
249
+ this.log(` \u2192 Add ${cmd("--apply")} to execute the clone.
250
+ `);
251
+ this.log(renderTip({ command: "clone", cloneApplied: false, schemaOnly: flags["schema-only"] }));
252
+ }
253
+ return;
254
+ }
255
+ if (!report.passed) {
256
+ this.error("Clone aborted \u2014 fix the issues above first.", { exit: 1 });
257
+ }
258
+ this.log(`
259
+ ${bold(`Cloning "${envName}" to local database "${localDbName}"...`)}
260
+ `);
261
+ const progressOut = flags.json ? process.stderr : process.stdout;
262
+ this.log(" [1/4] Creating local database...");
263
+ let cloned;
264
+ try {
265
+ cloned = await cloneRemoteToLocal({
266
+ remoteUrl: env.dbUrl,
267
+ localBaseUrl,
268
+ localDbName,
269
+ schemaOnly: flags["schema-only"],
270
+ force: flags.force,
271
+ excludeSchemas: CLONE_EXCLUDE_SCHEMAS,
272
+ onProgress: (p) => {
273
+ const mb = (p.bytesTransferred / 1024 / 1024).toFixed(1);
274
+ const sec = Math.round(p.elapsedMs / 1e3);
275
+ progressOut.write(`\r ${dim(`pg_dump \u2192 pg_restore: ${mb} MB transferred (${sec}s)`)} `);
276
+ }
277
+ });
278
+ progressOut.write("\n");
279
+ this.log(` ${ok("\u2713")} Database created: ${bold(localDbName)}`);
280
+ if (cloned.extensionsInstalled.length > 0) {
281
+ this.log(` ${dim(`Installed first, in the schema the source keeps them in: ${cloned.extensionsInstalled.join(", ")}`)}`);
282
+ }
283
+ for (const line of formatUnavailable(cloned.unavailable)) this.log(line);
284
+ for (const line of formatRestoreFailures(cloned.failures)) this.log(line);
285
+ } catch (err) {
286
+ progressOut.write("\n");
287
+ const msg = errMsg(err);
288
+ this.log(` ${warn("\u2717")} Failed: ${msg}`);
289
+ this.error("Clone aborted at step 1/4.", { exit: 1 });
290
+ }
291
+ this.log(" [2/4] Capturing remote snapshot...");
292
+ const snapshot = await captureSnapshot({ envName, env, config });
293
+ const capturedCount = Object.values(snapshot.manifest.layers).filter((l) => l.captured).length;
294
+ this.log(` ${ok("\u2713")} Snapshot captured: ${capturedCount} layer(s)`);
295
+ for (const line of formatSnapshotLayers(snapshot.manifest)) {
296
+ this.log(` ${line}`);
297
+ }
298
+ this.log(" [3/4] Storing baseline migration...");
299
+ const migrationsDir = resolve(SUPAFORGE_DIR, MIGRATIONS_SUBDIR);
300
+ await mkdir(migrationsDir, { recursive: true });
301
+ const migrationFile = resolve(migrationsDir, `${snapshot.timestamp}_clone-baseline.json`);
302
+ const migration = {
303
+ version: snapshot.timestamp,
304
+ description: `clone-baseline from ${envName}`,
305
+ parent: null,
306
+ layers: Object.entries(snapshot.manifest.layers).filter(([, v]) => v.captured).map(([k]) => k),
307
+ up: { sql: [], api: [] },
308
+ down: { sql: [], api: [] }
309
+ };
310
+ await writeFile(migrationFile, JSON.stringify(migration, null, 2) + "\n");
311
+ this.log(` ${ok("\u2713")} Baseline stored: ${migrationFile}`);
312
+ this.log(" [4/4] Updating config...");
313
+ const newConfig = configAfterClone(config, envName, localDbUrl);
314
+ const configPath = resolve("supaforge.config.json");
315
+ await writeFile(configPath, JSON.stringify(newConfig, null, 2) + "\n");
316
+ this.log(` ${ok("\u2713")} Config updated: ${configPath}`);
317
+ const wasSource = config.source;
318
+ const wasTarget = config.target;
319
+ if (wasSource !== envName || wasTarget !== "local") {
320
+ this.log(` ${dim("source:")} ${wasSource ?? dim("(unset)")} ${dim("\u2192")} ${envName}`);
321
+ this.log(` ${dim("target:")} ${wasTarget ?? dim("(unset)")} ${dim("\u2192")} local ${dim("(the clone)")}`);
322
+ this.log(` ${dim("A bare")} ${cmd("supaforge diff --apply")} ${dim("now writes into the clone, not into")} "${envName}".`);
323
+ }
324
+ const branchMeta = {
325
+ name: localDbName,
326
+ dbName: localDbName,
327
+ dbUrl: localDbUrl,
328
+ createdFrom: envName,
329
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
330
+ schemaOnly: flags["schema-only"]
331
+ };
332
+ await addBranchToManifest(branchMeta);
333
+ const missing = cloned.failures.length;
334
+ if (flags.json) {
335
+ this.json({
336
+ snapshot: snapshot.manifest,
337
+ config: newConfig,
338
+ restoreFailures: cloned.failures,
339
+ unavailable: cloned.unavailable
340
+ });
341
+ if (missing > 0) this.exit(1);
342
+ return;
343
+ }
344
+ this.log(missing > 0 ? `
345
+ ${warn(`Clone complete, but ${missing} statement(s) could not be restored`)} ${dim("\u2014 listed under step 1.")}
346
+ ` : `
347
+ ${ok("Clone complete!")}
348
+ `);
349
+ this.log(` ${bold("Not included in this clone")} ${dim("(expected drift on the first diff):")}`);
350
+ this.log(` ${dim("\u2022")} Supabase-managed schemas, excluded from the dump so they restore cleanly`);
351
+ this.log(` on vanilla Postgres: ${dim(CLONE_EXCLUDE_SCHEMAS.join(", "))}`);
352
+ this.log(` ${dim("\u2022")} Platform state that lives outside the SQL dump: storage objects &`);
353
+ this.log(` policies, edge functions, auth config, and vault secrets.`);
354
+ this.log(` ${dim("\u2022")} Postgres roles & grants \u2014 Supabase's service roles do not exist`);
355
+ this.log(` on vanilla Postgres, so every grant that references one reads as drift.`);
356
+ if (flags["schema-only"]) {
357
+ this.log(` ${dim("\u2022")} Table data \u2014 you passed ${cmd("--schema-only")} (structure only).`);
358
+ }
359
+ this.log(` ${dim("These appear as drift below but are managed by Supabase, not your migrations.")}`);
360
+ this.log("");
361
+ const skipFlags = CLONE_SKIP_FLAGS;
362
+ this.log(` ${bold("Your workflow is now:")}`);
363
+ this.log(` 1. Develop against the local database ${dim(`(${localDbName})`)}`);
364
+ this.log(` 2. Verify the clone matches "${envName}": ${cmd("supaforge diff --detail")}`);
365
+ this.log(` ${dim("Add")} ${cmd(skipFlags)} ${dim("to hide the Supabase-managed noise above.")}`);
366
+ this.log(` 3. See what drifted as you work: ${cmd("supaforge diff")}`);
367
+ this.log(` 4. Capture the current state: ${cmd("supaforge snapshot --apply")}`);
368
+ this.log("");
369
+ this.log(` ${bold(`Pushing local changes back to "${envName}"`)} ${dim("writes to that database:")}`);
370
+ this.log(` ${cmd(`supaforge diff --source=local --target=${envName} --dry-run`)} ${dim("\u2190 review first")}`);
371
+ this.log(` ${cmd(`supaforge diff --source=local --target=${envName} --apply`)}`);
372
+ this.log(` ${dim("A clone is vanilla PostgreSQL, so")} ${cmd(skipFlags)} ${dim("belongs on those too.")}`);
373
+ this.log("");
374
+ this.log(renderTip({ command: "clone", cloneApplied: true, schemaOnly: flags["schema-only"] }));
375
+ if (missing > 0) this.exit(1);
376
+ }
377
+ };
378
+ function formatUnavailable(items) {
379
+ if (items.length === 0) return [];
380
+ const extensions = items.filter((i) => i.object.startsWith("extension ")).map((i) => i.object.slice("extension ".length));
381
+ const others = items.length - extensions.length;
382
+ const parts = [
383
+ ...extensions.length ? [`extension${extensions.length > 1 ? "s" : ""} ${extensions.join(", ")}`] : [],
384
+ ...others ? [`${others} event trigger(s) of the platform's`] : []
385
+ ];
386
+ return [` ${dim(`Not available on this server, as expected for a Supabase project: ${parts.join("; ")}`)}`];
387
+ }
388
+ var RESTORE_FAILURES_SHOWN = 15;
389
+ function formatRestoreFailures(failures) {
390
+ if (failures.length === 0) return [];
391
+ const lines = [` ${warn("\u26A0")} ${failures.length} statement(s) failed, so these are not in the clone:`];
392
+ for (const f of failures.slice(0, RESTORE_FAILURES_SHOWN)) {
393
+ lines.push(` ${dim("\u2022")} ${f.object} ${dim(`\u2014 ${f.error}`)}`);
394
+ }
395
+ const rest = failures.length - RESTORE_FAILURES_SHOWN;
396
+ if (rest > 0) lines.push(` ${dim(`\u2026and ${rest} more`)}`);
397
+ return lines;
398
+ }
399
+ function configAfterClone(config, envName, localDbUrl) {
400
+ return {
401
+ ...config,
402
+ environments: {
403
+ ...config.environments,
404
+ local: { ...config.environments.local, dbUrl: localDbUrl }
405
+ },
406
+ source: envName,
407
+ target: "local"
408
+ };
409
+ }
410
+ export {
411
+ configAfterClone,
412
+ Clone as default,
413
+ formatRestoreFailures,
414
+ formatUnavailable
415
+ };
416
+ //# sourceMappingURL=clone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/clone.ts"],"sourcesContent":["import { writeFile, mkdir } from 'node:fs/promises'\nimport { resolve } from 'node:path'\nimport { Flags } from '@oclif/core'\nimport pg from 'pg'\nimport { pgClientConfig } from '../db.js'\nimport { BaseCommand } from '../base-command.js'\nimport { captureSnapshot, formatSnapshotLayers } from '../snapshot.js'\nimport {\n cloneRemoteToLocal,\n replaceDbName,\n listBranches,\n reconcileClones,\n deleteBranch,\n addBranchToManifest,\n} from '../branch.js'\nimport type { BranchMeta, CloneResult, RestoreFailure } from '../branch.js'\nimport { loadConfig } from '../config.js'\nimport { checkPgDumpCompat } from '../pg-tools.js'\nimport { startLocalPg, DEFAULT_LOCAL_PORT, LOCAL_PG_USER, LOCAL_PG_PASSWORD } from '../local-pg.js'\nimport { ok, warn, dim, cmd, bold } from '../ui.js'\nimport { renderTip } from '../tips.js'\nimport { DEFAULT_IGNORE_SCHEMAS, CLONE_SKIP_FLAGS } from '../defaults.js'\nimport { CLONE_EXTRA_EXCLUDE_SCHEMAS, SUPAFORGE_DIR, MIGRATIONS_SUBDIR } from '../constants.js'\nimport { errMsg, redactUrls } from '../utils/error.js'\nimport type { SupaForgeConfig } from '../types/config.js'\n\n/** Combined list of schemas to exclude from pg_dump when cloning. */\n// De-duplicated: `_realtime` is in both lists, so it was excluded — and\n// printed — twice (issue #97).\nconst CLONE_EXCLUDE_SCHEMAS = [...new Set([\n ...DEFAULT_IGNORE_SCHEMAS,\n ...CLONE_EXTRA_EXCLUDE_SCHEMAS,\n])]\n\n/**\n * Clone a remote environment to a local database and manage clones.\n *\n * Default: preflight checks (dry-run)\n * --apply: execute the clone\n * --list: list existing clones\n * --delete=NAME: remove a clone\n * --delete=NAME --apply: actually drop the database\n */\nexport default class Clone extends BaseCommand {\n static override description = 'Clone a remote Supabase environment to a local database'\n\n static override examples = [\n '<%= config.bin %> clone --env=production',\n '<%= config.bin %> clone --env=production --apply',\n '<%= config.bin %> clone --env=production --force --apply',\n '<%= config.bin %> clone --env=production --schema-only --apply',\n '<%= config.bin %> clone --env=production --start-local --apply',\n '<%= config.bin %> clone --list',\n '<%= config.bin %> clone --delete=my-clone --apply',\n ]\n\n static override flags = {\n env: Flags.string({\n char: 'e',\n description: 'Source environment to clone from (defaults to config source)',\n }),\n 'local-db': Flags.string({\n description: 'Name for the local database (default: supaforge_local)',\n default: 'supaforge_local',\n }),\n 'local-url': Flags.string({\n description: 'Local PostgreSQL URL (default: postgres://postgres:postgres@localhost:5432/postgres)',\n default: `postgres://${LOCAL_PG_USER}:${LOCAL_PG_PASSWORD}@localhost:${DEFAULT_LOCAL_PORT}/postgres`,\n }),\n 'start-local': Flags.boolean({\n description: 'Auto-start a local PostgreSQL container via Podman or Docker',\n default: false,\n }),\n 'schema-only': Flags.boolean({\n description: 'Copy schema only, no data',\n default: false,\n }),\n force: Flags.boolean({\n char: 'f',\n description: 'Drop and recreate the target database if it already exists',\n default: false,\n }),\n apply: Flags.boolean({\n description: 'Execute the operation (default: dry-run preview)',\n default: false,\n }),\n list: Flags.boolean({\n description: 'List existing clones',\n default: false,\n }),\n delete: Flags.string({\n description: 'Delete a clone by name (requires --apply to execute)',\n }),\n json: Flags.boolean({ description: 'Output results as JSON' }),\n }\n\n async run(): Promise<void> {\n const { flags } = await this.parse(Clone)\n\n // ── List clones ──────────────────────────────────────────────────────────\n // The manifest alone misses clones it never recorded (older versions, a\n // different checkout, or a cleaned .supaforge/). Reconcile it against the\n // databases that actually exist on the local server so existing clones show\n // up too — not just freshly-created ones. Config is optional here.\n if (flags.list) {\n const softConfig = await loadConfig().catch(() => undefined)\n const localEnv = softConfig?.environments?.local\n let localServerUrl: string | undefined\n let configuredLocalDb: string | undefined\n if (localEnv?.dbUrl) {\n localServerUrl = localEnv.dbUrl\n try {\n configuredLocalDb = new URL(localEnv.dbUrl).pathname.replace(/^\\//, '') || undefined\n } catch { /* unpar-seable url — skip discovery hint */ }\n }\n\n const branches = localServerUrl\n ? await reconcileClones({ localServerUrl, configuredLocalDb })\n : (await listBranches()).map(b => ({ ...b, missing: false, discovered: false }))\n\n if (branches.length === 0) {\n this.log(`\\n No clones found. Create one with: ${cmd('supaforge clone --env=<name> --apply')}\\n`)\n return\n }\n\n if (flags.json) {\n this.json(branches)\n return\n }\n\n this.log(`\\n ${bold(`${branches.length} clone(s):`)}\\n`)\n for (const b of branches) {\n const tags = [\n b.discovered ? dim('(discovered)') : '',\n b.missing ? warn('(database missing)') : '',\n ].filter(Boolean).join(' ')\n this.log(` ${bold(b.name)}${tags ? ' ' + tags : ''}`)\n this.log(` Database: ${b.dbName}`)\n this.log(` From: ${b.createdFrom}`)\n if (b.createdAt) this.log(` Created: ${b.createdAt}`)\n this.log(` Schema: ${b.schemaOnly ? 'only' : 'full'}`)\n this.log('')\n }\n return\n }\n\n const config = await this.loadConfigOrFail()\n\n // ── Delete clone ─────────────────────────────────────────────────────────\n if (flags.delete) {\n const { env } = this.resolveEnv(config, flags.env)\n\n const branches = await listBranches()\n const branch = branches.find(b => b.name === flags.delete)\n if (!branch) {\n this.error(`Clone \"${flags.delete}\" not found. Run \"supaforge clone --list\" to see clones.`)\n }\n\n if (!flags.apply) {\n this.log(`\\n ${bold('Delete clone preview')} ${dim('(dry-run)')}\\n`)\n this.log(` Clone: ${branch.name}`)\n this.log(` Database: ${branch.dbName}`)\n this.log(` Created: ${branch.createdAt}`)\n this.log(` From: ${branch.createdFrom}`)\n this.log('')\n this.log(' This would:')\n this.log(` 1. Terminate connections to \"${branch.dbName}\"`)\n this.log(` 2. DROP DATABASE \"${branch.dbName}\"`)\n this.log(' 3. Remove clone from .supaforge/branches.json')\n this.log(`\\n → Add ${cmd('--apply')} to delete the clone.\\n`)\n return\n }\n\n this.log(`\\n Deleting clone \"${branch.name}\"...\\n`)\n await deleteBranch(flags.delete, env.dbUrl)\n this.log(` ${ok('✓')} Clone \"${branch.name}\" deleted.\\n`)\n return\n }\n\n // ── Clone: preflight + execute ───────────────────────────────────────────\n const { envName, env } = this.resolveEnv(config, flags.env)\n const localDbName = flags['local-db']\n let localBaseUrl = flags['local-url']\n\n // Auto-start a local PostgreSQL container if requested\n if (flags['start-local']) {\n this.log(`\\n ${bold('Starting local PostgreSQL container...')}\\n`)\n const info = await startLocalPg()\n localBaseUrl = info.url\n this.log(` ${ok('✓')} PostgreSQL running via ${bold(info.runtime)} on port ${info.port}\\n`)\n }\n\n const localDbUrl = replaceDbName(localBaseUrl, localDbName)\n\n // Always run preflight checks — even with --apply\n const pre = this.createPreflight('Clone preflight checks')\n .addDatabase('Remote', envName, env.dbUrl)\n .addInfo('Local DB', localDbName)\n .addInfo('Local URL', dim(redactUrls(localDbUrl)))\n .addInfo('Schema only', String(flags['schema-only']))\n\n if (flags['start-local']) {\n pre.addCheck('Local PostgreSQL', async () => ({\n detail: `auto-started via --start-local`,\n }))\n } else {\n pre.addDatabase('Local', 'local', localBaseUrl)\n }\n\n pre.addCheck('pg_dump compatibility', async () => {\n try {\n const compat = await checkPgDumpCompat(env.dbUrl)\n if (compat.compatible) {\n const pathNote = compat.pgDumpPath === 'pg_dump' ? '' : ` (${compat.pgDumpPath})`\n return { detail: `v${compat.localMajor} ↔ server v${compat.serverMajor}${pathNote}` }\n }\n return { error: compat.message }\n } catch (err) {\n return { error: `pg_dump check failed: ${(err as Error).message}` }\n }\n })\n\n pre.addCheck('Target database', async () => {\n try {\n const client = new pg.Client(pgClientConfig(localBaseUrl))\n await client.connect()\n const { rows } = await client.query(\n 'SELECT 1 FROM pg_database WHERE datname = $1',\n [localDbName],\n )\n await client.end()\n if (rows.length > 0) {\n if (flags.force) {\n return { detail: `\"${localDbName}\" exists — will be dropped (--force)` }\n }\n return {\n error: `\"${localDbName}\" already exists on local server`,\n hints: [`Use ${cmd('--force')} to drop and recreate it.`],\n }\n }\n return { detail: `\"${localDbName}\" does not exist yet` }\n } catch {\n return {} // Can't check — let the apply step handle it\n }\n })\n\n const report = await pre.run()\n\n if (!flags.apply) {\n if (flags.json) {\n this.json({ dryRun: true, passed: report.passed, localDb: localDbName })\n if (!report.passed) this.exit(1)\n return\n }\n if (report.passed) {\n this.log(` Steps that will be performed:`)\n this.log(' 1. Create local database via pg_dump | pg_restore')\n this.log(' 2. Capture full snapshot of remote environment')\n this.log(' 3. Store snapshot as baseline migration')\n this.log(' 4. Update supaforge.config.json with local + remote environments')\n this.log('')\n this.log(` → Add ${cmd('--apply')} to execute the clone.\\n`)\n this.log(renderTip({ command: 'clone', cloneApplied: false, schemaOnly: flags['schema-only'] }))\n }\n return\n }\n\n if (!report.passed) {\n this.error('Clone aborted — fix the issues above first.', { exit: 1 })\n }\n\n // Execute clone\n this.log(`\\n ${bold(`Cloning \"${envName}\" to local database \"${localDbName}\"...`)}\\n`)\n // The transfer meter, like every other line here, stays off stdout under --json.\n const progressOut = flags.json ? process.stderr : process.stdout\n\n this.log(' [1/4] Creating local database...')\n let cloned: CloneResult\n try {\n cloned = await cloneRemoteToLocal({\n remoteUrl: env.dbUrl,\n localBaseUrl,\n localDbName,\n schemaOnly: flags['schema-only'],\n force: flags.force,\n excludeSchemas: CLONE_EXCLUDE_SCHEMAS,\n onProgress: (p) => {\n const mb = (p.bytesTransferred / 1024 / 1024).toFixed(1)\n const sec = Math.round(p.elapsedMs / 1000)\n progressOut.write(`\\r ${dim(`pg_dump → pg_restore: ${mb} MB transferred (${sec}s)`)} `)\n },\n })\n progressOut.write('\\n')\n this.log(` ${ok('✓')} Database created: ${bold(localDbName)}`)\n if (cloned.extensionsInstalled.length > 0) {\n this.log(` ${dim(`Installed first, in the schema the source keeps them in: ${cloned.extensionsInstalled.join(', ')}`)}`)\n }\n for (const line of formatUnavailable(cloned.unavailable)) this.log(line)\n for (const line of formatRestoreFailures(cloned.failures)) this.log(line)\n } catch (err) {\n progressOut.write('\\n')\n const msg = errMsg(err)\n this.log(` ${warn('✗')} Failed: ${msg}`)\n this.error('Clone aborted at step 1/4.', { exit: 1 })\n }\n\n this.log(' [2/4] Capturing remote snapshot...')\n const snapshot = await captureSnapshot({ envName, env, config })\n const capturedCount = Object.values(snapshot.manifest.layers).filter(l => l.captured).length\n this.log(` ${ok('✓')} Snapshot captured: ${capturedCount} layer(s)`)\n // Show exactly what was captured / skipped / errored per layer (like supaforge diff),\n // so the user can see at a glance what made it into the baseline.\n for (const line of formatSnapshotLayers(snapshot.manifest)) {\n this.log(` ${line}`)\n }\n\n this.log(' [3/4] Storing baseline migration...')\n const migrationsDir = resolve(SUPAFORGE_DIR, MIGRATIONS_SUBDIR)\n await mkdir(migrationsDir, { recursive: true })\n const migrationFile = resolve(migrationsDir, `${snapshot.timestamp}_clone-baseline.json`)\n const migration = {\n version: snapshot.timestamp,\n description: `clone-baseline from ${envName}`,\n parent: null,\n layers: Object.entries(snapshot.manifest.layers)\n .filter(([, v]) => v.captured)\n .map(([k]) => k),\n up: { sql: [], api: [] },\n down: { sql: [], api: [] },\n }\n await writeFile(migrationFile, JSON.stringify(migration, null, 2) + '\\n')\n this.log(` ${ok('✓')} Baseline stored: ${migrationFile}`)\n\n this.log(' [4/4] Updating config...')\n const newConfig = configAfterClone(config, envName, localDbUrl)\n const configPath = resolve('supaforge.config.json')\n await writeFile(configPath, JSON.stringify(newConfig, null, 2) + '\\n')\n this.log(` ${ok('✓')} Config updated: ${configPath}`)\n\n // Say what moved. Overwriting these silently is the other half of #89:\n // whatever the project was pointed at before is gone, with no record of it\n // in the output.\n const wasSource = config.source\n const wasTarget = config.target\n if (wasSource !== envName || wasTarget !== 'local') {\n this.log(` ${dim('source:')} ${wasSource ?? dim('(unset)')} ${dim('→')} ${envName}`)\n this.log(` ${dim('target:')} ${wasTarget ?? dim('(unset)')} ${dim('→')} local ${dim('(the clone)')}`)\n this.log(` ${dim('A bare')} ${cmd('supaforge diff --apply')} ${dim('now writes into the clone, not into')} \"${envName}\".`)\n }\n\n // Register clone in .supaforge/branches.json so `clone --list` works\n const branchMeta: BranchMeta = {\n name: localDbName,\n dbName: localDbName,\n dbUrl: localDbUrl,\n createdFrom: envName,\n createdAt: new Date().toISOString(),\n schemaOnly: flags['schema-only'],\n }\n await addBranchToManifest(branchMeta)\n\n const missing = cloned.failures.length\n if (flags.json) {\n this.json({\n snapshot: snapshot.manifest, config: newConfig,\n restoreFailures: cloned.failures, unavailable: cloned.unavailable,\n })\n if (missing > 0) this.exit(1)\n return\n }\n\n this.log(missing > 0\n ? `\\n ${warn(`Clone complete, but ${missing} statement(s) could not be restored`)} ${dim('— listed under step 1.')}\\n`\n : `\\n ${ok('Clone complete!')}\\n`)\n\n // ── What was NOT cloned (Issue: set expectations before the first diff) ───\n // The pg_dump pipeline deliberately excludes Supabase-managed schemas and\n // can't carry platform-managed state (storage objects, edge functions, auth\n // config, vault secrets). Spelling this out up front explains why the first\n // diff against the remote is large — it is expected, not a tool failure.\n this.log(` ${bold('Not included in this clone')} ${dim('(expected drift on the first diff):')}`)\n this.log(` ${dim('•')} Supabase-managed schemas, excluded from the dump so they restore cleanly`)\n this.log(` on vanilla Postgres: ${dim(CLONE_EXCLUDE_SCHEMAS.join(', '))}`)\n this.log(` ${dim('•')} Platform state that lives outside the SQL dump: storage objects &`)\n this.log(` policies, edge functions, auth config, and vault secrets.`)\n // Roles arrived as Layer 14, after this list was written for 13 layers, and\n // is the second-largest source of clone noise — 227 findings on the diff in\n // issue #47. Left unmentioned, they read as unexplained drift.\n this.log(` ${dim('•')} Postgres roles & grants — Supabase's service roles do not exist`)\n this.log(` on vanilla Postgres, so every grant that references one reads as drift.`)\n if (flags['schema-only']) {\n this.log(` ${dim('•')} Table data — you passed ${cmd('--schema-only')} (structure only).`)\n }\n this.log(` ${dim('These appear as drift below but are managed by Supabase, not your migrations.')}`)\n this.log('')\n\n // ── Contextual next steps (Issue: give the exact commands for THIS clone) ─\n const skipFlags = CLONE_SKIP_FLAGS\n this.log(` ${bold('Your workflow is now:')}`)\n this.log(` 1. Develop against the local database ${dim(`(${localDbName})`)}`)\n this.log(` 2. Verify the clone matches \"${envName}\": ${cmd('supaforge diff --detail')}`)\n this.log(` ${dim('Add')} ${cmd(skipFlags)} ${dim('to hide the Supabase-managed noise above.')}`)\n this.log(` 3. See what drifted as you work: ${cmd('supaforge diff')}`)\n this.log(` 4. Capture the current state: ${cmd('supaforge snapshot --apply')}`)\n this.log('')\n // Named in full rather than as a bare `--apply`. This is the direction that\n // writes to a hosted database, and from a clone it carries the absences the\n // warning above is about — so it should not be reachable by habit.\n this.log(` ${bold(`Pushing local changes back to \"${envName}\"`)} ${dim('writes to that database:')}`)\n this.log(` ${cmd(`supaforge diff --source=local --target=${envName} --dry-run`)} ${dim('← review first')}`)\n this.log(` ${cmd(`supaforge diff --source=local --target=${envName} --apply`)}`)\n this.log(` ${dim('A clone is vanilla PostgreSQL, so')} ${cmd(skipFlags)} ${dim('belongs on those too.')}`)\n this.log('')\n this.log(renderTip({ command: 'clone', cloneApplied: true, schemaOnly: flags['schema-only'] }))\n // The clone is usable, but it is not a copy of the source, and a script\n // relying on it should not carry on as though it were.\n if (missing > 0) this.exit(1)\n }\n}\n\n/**\n * What this server cannot have, in one line: extensions it does not ship and\n * the platform's own event triggers. Every Supabase project has some, so they\n * are stated rather than counted as the clone failing — see restoreFailures.\n */\nexport function formatUnavailable(items: readonly RestoreFailure[]): string[] {\n if (items.length === 0) return []\n const extensions = items.filter(i => i.object.startsWith('extension ')).map(i => i.object.slice('extension '.length))\n const others = items.length - extensions.length\n const parts = [\n ...(extensions.length ? [`extension${extensions.length > 1 ? 's' : ''} ${extensions.join(', ')}`] : []),\n ...(others ? [`${others} event trigger(s) of the platform's`] : []),\n ]\n return [` ${dim(`Not available on this server, as expected for a Supabase project: ${parts.join('; ')}`)}`]\n}\n\n/** Shown at most, before \"…and N more\". */\nconst RESTORE_FAILURES_SHOWN = 15\n\n/**\n * What pg_restore could not reproduce, for step 1 of the output.\n *\n * pg_restore exits 1 and carries on when a statement fails, which used to be\n * read as success: the step printed a tick and the objects were simply not in\n * the clone.\n */\nexport function formatRestoreFailures(failures: readonly RestoreFailure[]): string[] {\n if (failures.length === 0) return []\n const lines = [` ${warn('⚠')} ${failures.length} statement(s) failed, so these are not in the clone:`]\n for (const f of failures.slice(0, RESTORE_FAILURES_SHOWN)) {\n lines.push(` ${dim('•')} ${f.object} ${dim(`— ${f.error}`)}`)\n }\n const rest = failures.length - RESTORE_FAILURES_SHOWN\n if (rest > 0) lines.push(` ${dim(`…and ${rest} more`)}`)\n return lines\n}\n\n/**\n * The config a clone leaves behind.\n *\n * The clone becomes the **target**, so a bare `supaforge diff --apply` in this\n * directory writes into the local copy.\n *\n * It used to be the source, with the cloned-from environment as the target —\n * and the closing guidance recommended a bare `diff --apply`. Together those\n * pointed the next unqualified apply at the hosted database the clone had just\n * been taken from, carrying with it exactly the roles-and-grants drift the same\n * screen warns about (issue #89). Pushing that way is still available and is\n * now spelled out in full, which is the direction that deserves to be explicit.\n *\n * Everything else about the config is preserved, including any environment\n * already called `local`, which is replaced rather than merged: it names a\n * database, and the clone is the database it now names.\n */\nexport function configAfterClone(\n config: SupaForgeConfig,\n envName: string,\n localDbUrl: string,\n): SupaForgeConfig {\n return {\n ...config,\n environments: {\n ...config.environments,\n local: { ...config.environments.local, dbUrl: localDbUrl },\n },\n source: envName,\n target: 'local',\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,aAAa;AACjC,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,OAAO,QAAQ;AA0Bf,IAAM,wBAAwB,CAAC,GAAG,oBAAI,IAAI;AAAA,EACxC,GAAG;AAAA,EACH,GAAG;AACL,CAAC,CAAC;AAWF,IAAqB,QAArB,MAAqB,eAAc,YAAY;AAAA,EAC7C,OAAgB,cAAc;AAAA,EAE9B,OAAgB,WAAW;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EAEA,OAAgB,QAAQ;AAAA,IACtB,KAAK,MAAM,OAAO;AAAA,MAChB,MAAM;AAAA,MACN,aAAa;AAAA,IACf,CAAC;AAAA,IACD,YAAY,MAAM,OAAO;AAAA,MACvB,aAAa;AAAA,MACb,SAAS;AAAA,IACX,CAAC;AAAA,IACD,aAAa,MAAM,OAAO;AAAA,MACxB,aAAa;AAAA,MACb,SAAS,c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AC,IAAI,SAAS,MAAM,sDAAsD;AAC1G,aAAW,KAAK,SAAS,MAAM,GAAG,sBAAsB,GAAG;AACzD,UAAM,KAAK,WAAW,IAAI,QAAG,CAAC,IAAI,EAAE,MAAM,IAAI,IAAI,UAAK,EAAE,KAAK,EAAE,CAAC,EAAE;AAAA,EACrE;AACA,QAAM,OAAO,SAAS,SAAS;AAC/B,MAAI,OAAO,EAAG,OAAM,KAAK,WAAW,IAAI,aAAQ,IAAI,OAAO,CAAC,EAAE;AAC9D,SAAO;AACT;AAmBO,SAAS,iBACd,QACA,SACA,YACiB;AACjB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc;AAAA,MACZ,GAAG,OAAO;AAAA,MACV,OAAO,EAAE,GAAG,OAAO,aAAa,OAAO,OAAO,WAAW;AAAA,IAC3D;AAAA,IACA,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV;AACF;","names":["env"]}
@@ -0,0 +1,65 @@
1
+ import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
+ import { BaseCommand } from '../base-command.js';
3
+ import '@oclif/core';
4
+ import '../config-CTbeRlJk.js';
5
+
6
+ /** Which apply-only flags this invocation will silently ignore. */
7
+ declare function inertApplyFlags(flags: Record<string, unknown>): ReadonlyArray<{
8
+ flag: string;
9
+ shapesThePlan: boolean;
10
+ }>;
11
+ /**
12
+ * Unified drift detection & resolution command.
13
+ *
14
+ * Default: summary of what's drifted (was: scan)
15
+ * --detail: full SQL diffs (was: diff)
16
+ * --apply: fix the drift (was: promote)
17
+ * --ci: emit GitHub Actions annotations + structured exit codes
18
+ */
19
+ declare class Diff extends BaseCommand {
20
+ static description: string;
21
+ static examples: string[];
22
+ /**
23
+ * Read from the environment rather than passed as flags, because they tune
24
+ * limits rather than select behaviour. Rendered as their own `--help`
25
+ * section (issue #40); the README carries the same table plus the timeout
26
+ * precedence chain.
27
+ */
28
+ static envVars: {
29
+ name: string;
30
+ description: string;
31
+ }[];
32
+ static flags: {
33
+ check: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
34
+ skip: _oclif_core_interfaces.OptionFlag<string[] | undefined, _oclif_core_interfaces.CustomOptions>;
35
+ detail: _oclif_core_interfaces.BooleanFlag<boolean>;
36
+ apply: _oclif_core_interfaces.BooleanFlag<boolean>;
37
+ 'allow-destructive': _oclif_core_interfaces.BooleanFlag<boolean>;
38
+ 'dry-run': _oclif_core_interfaces.BooleanFlag<boolean>;
39
+ 'no-transaction': _oclif_core_interfaces.BooleanFlag<boolean>;
40
+ only: _oclif_core_interfaces.OptionFlag<string[] | undefined, _oclif_core_interfaces.CustomOptions>;
41
+ 'include-files': _oclif_core_interfaces.BooleanFlag<boolean>;
42
+ tables: _oclif_core_interfaces.OptionFlag<string[] | undefined, _oclif_core_interfaces.CustomOptions>;
43
+ 'exclude-tables': _oclif_core_interfaces.OptionFlag<string[] | undefined, _oclif_core_interfaces.CustomOptions>;
44
+ json: _oclif_core_interfaces.BooleanFlag<boolean>;
45
+ source: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
46
+ target: _oclif_core_interfaces.OptionFlag<string | undefined, _oclif_core_interfaces.CustomOptions>;
47
+ ci: _oclif_core_interfaces.BooleanFlag<boolean>;
48
+ prove: _oclif_core_interfaces.BooleanFlag<boolean>;
49
+ 'apply-posture': _oclif_core_interfaces.BooleanFlag<boolean>;
50
+ 'fail-on': _oclif_core_interfaces.OptionFlag<string, _oclif_core_interfaces.CustomOptions>;
51
+ 'fail-on-posture': _oclif_core_interfaces.BooleanFlag<boolean>;
52
+ };
53
+ /**
54
+ * Report what `--apply` did, or — under `--dry-run` — what it would do.
55
+ *
56
+ * The applied list is printed in execution order, which is now dependency
57
+ * order rather than the order the checks reported the issues. That ordering
58
+ * is the whole point of the dry run: it is what makes the outcome of a real
59
+ * apply predictable before running it (issue #48).
60
+ */
61
+ private renderApplyResult;
62
+ run(): Promise<void>;
63
+ }
64
+
65
+ export { Diff as default, inertApplyFlags };
@@ -0,0 +1,24 @@
1
+ import {
2
+ Diff,
3
+ inertApplyFlags
4
+ } from "../chunk-XMYMIURR.js";
5
+ import "../chunk-4OU7KO5Y.js";
6
+ import "../chunk-LQXF65MC.js";
7
+ import "../chunk-5Z3SAIQS.js";
8
+ import "../chunk-TQJSQLWA.js";
9
+ import "../chunk-H5MJ5DFX.js";
10
+ import "../chunk-VOXZWQ3N.js";
11
+ import "../chunk-RRMI5CZD.js";
12
+ import "../chunk-G2DIPIYU.js";
13
+ import "../chunk-BLKJWDTL.js";
14
+ import "../chunk-SF3YA42C.js";
15
+ import "../chunk-5QQBTLWO.js";
16
+ import "../chunk-YVDSR4GM.js";
17
+ import "../chunk-DQQ5E563.js";
18
+ import "../chunk-X6V2GGDZ.js";
19
+ import "../chunk-6WAMNZLO.js";
20
+ export {
21
+ Diff as default,
22
+ inertApplyFlags
23
+ };
24
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,32 @@
1
+ import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
+ import { Command } from '@oclif/core';
3
+
4
+ /**
5
+ * `supaforge help [COMMAND]`.
6
+ *
7
+ * oclif's `helpClass` only styles the help that `--help` renders; the `help`
8
+ * *command* comes from `@oclif/plugin-help`, which this CLI does not install.
9
+ * So `supaforge help migrate create` — the form people reach for first, and the
10
+ * one every other CLI accepts — answered:
11
+ *
12
+ * › Error: command help:migrate:create not found
13
+ *
14
+ * which reads as "there is no such command" rather than "there is no help
15
+ * command" (issue #97). Written here rather than added as a dependency because
16
+ * the rendering is already ours: this hands straight to the same `helpClass`,
17
+ * so `help X` and `X --help` produce identical output.
18
+ */
19
+ declare class HelpCommand extends Command {
20
+ static description: string;
21
+ static strict: boolean;
22
+ static args: {
23
+ command: _oclif_core_interfaces.Arg<string | undefined, Record<string, unknown>>;
24
+ };
25
+ static flags: {
26
+ 'nested-commands': _oclif_core_interfaces.BooleanFlag<boolean>;
27
+ };
28
+ static examples: string[];
29
+ run(): Promise<void>;
30
+ }
31
+
32
+ export { HelpCommand as default };
@@ -0,0 +1,36 @@
1
+ // src/commands/help.ts
2
+ import { Args, Command, Flags, loadHelpClass } from "@oclif/core";
3
+ var HelpCommand = class _HelpCommand extends Command {
4
+ static description = "Display help for supaforge";
5
+ static strict = false;
6
+ static args = {
7
+ command: Args.string({
8
+ description: 'Command to show help for, e.g. "diff" or "migrate create"',
9
+ required: false
10
+ })
11
+ };
12
+ static flags = {
13
+ "nested-commands": Flags.boolean({
14
+ char: "n",
15
+ description: "Include all nested commands in the output"
16
+ })
17
+ };
18
+ static examples = [
19
+ "$ supaforge help",
20
+ "$ supaforge help diff",
21
+ "$ supaforge help migrate create"
22
+ ];
23
+ async run() {
24
+ const { argv, flags } = await this.parse(_HelpCommand);
25
+ const Help = await loadHelpClass(this.config);
26
+ const help = new Help(this.config, {
27
+ all: flags["nested-commands"],
28
+ ...this.config.pjson.oclif.helpOptions
29
+ });
30
+ await help.showHelp(argv);
31
+ }
32
+ };
33
+ export {
34
+ HelpCommand as default
35
+ };
36
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/commands/help.ts"],"sourcesContent":["import { Args, Command, Flags, loadHelpClass } from '@oclif/core'\n\n/**\n * `supaforge help [COMMAND]`.\n *\n * oclif's `helpClass` only styles the help that `--help` renders; the `help`\n * *command* comes from `@oclif/plugin-help`, which this CLI does not install.\n * So `supaforge help migrate create` — the form people reach for first, and the\n * one every other CLI accepts — answered:\n *\n * › Error: command help:migrate:create not found\n *\n * which reads as \"there is no such command\" rather than \"there is no help\n * command\" (issue #97). Written here rather than added as a dependency because\n * the rendering is already ours: this hands straight to the same `helpClass`,\n * so `help X` and `X --help` produce identical output.\n */\nexport default class HelpCommand extends Command {\n static description = 'Display help for supaforge'\n\n static strict = false\n\n static args = {\n command: Args.string({\n description: 'Command to show help for, e.g. \"diff\" or \"migrate create\"',\n required: false,\n }),\n }\n\n static flags = {\n 'nested-commands': Flags.boolean({\n char: 'n',\n description: 'Include all nested commands in the output',\n }),\n }\n\n static examples = [\n '$ supaforge help',\n '$ supaforge help diff',\n '$ supaforge help migrate create',\n ]\n\n async run(): Promise<void> {\n const { argv, flags } = await this.parse(HelpCommand)\n\n const Help = await loadHelpClass(this.config)\n const help = new Help(this.config, {\n all: flags['nested-commands'],\n ...this.config.pjson.oclif.helpOptions,\n })\n\n // The whole argv, so a topic and its subcommand arrive together: oclif\n // addresses `migrate create` as one command, and passing only the first\n // argument would show the topic every time.\n await help.showHelp(argv as string[])\n }\n}\n"],"mappings":";AAAA,SAAS,MAAM,SAAS,OAAO,qBAAqB;AAiBpD,IAAqB,cAArB,MAAqB,qBAAoB,QAAQ;AAAA,EAC/C,OAAO,cAAc;AAAA,EAErB,OAAO,SAAS;AAAA,EAEhB,OAAO,OAAO;AAAA,IACZ,SAAS,KAAK,OAAO;AAAA,MACnB,aAAa;AAAA,MACb,UAAU;AAAA,IACZ,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,QAAQ;AAAA,IACb,mBAAmB,MAAM,QAAQ;AAAA,MAC/B,MAAM;AAAA,MACN,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AAAA,EAEA,OAAO,WAAW;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EAEA,MAAM,MAAqB;AACzB,UAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,MAAM,YAAW;AAEpD,UAAM,OAAO,MAAM,cAAc,KAAK,MAAM;AAC5C,UAAM,OAAO,IAAI,KAAK,KAAK,QAAQ;AAAA,MACjC,KAAK,MAAM,iBAAiB;AAAA,MAC5B,GAAG,KAAK,OAAO,MAAM,MAAM;AAAA,IAC7B,CAAC;AAKD,UAAM,KAAK,SAAS,IAAgB;AAAA,EACtC;AACF;","names":[]}