@akal/supaforge 0.0.33 → 0.0.35

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 (55) hide show
  1. package/README.md +67 -14
  2. package/dist/base-command.d.ts +1 -1
  3. package/dist/base-command.js +4 -3
  4. package/dist/{branch-C4ndfoj5.d.ts → branch-BppjQBv_.d.ts} +1 -1
  5. package/dist/{chunk-4IVN7QVY.js → chunk-44UVQJV2.js} +159 -18
  6. package/dist/{chunk-3HGAV5CC.js → chunk-4AGJRRBT.js} +390 -43
  7. package/dist/{chunk-SQPCWGQO.js → chunk-4M6OQLPO.js} +22 -121
  8. package/dist/{chunk-2SELREHW.js → chunk-5Q6LSLA3.js} +56 -9
  9. package/dist/{chunk-7NAZGZPV.js → chunk-7N63OPFN.js} +28 -21
  10. package/dist/chunk-AGONS5JJ.js +242 -0
  11. package/dist/chunk-GQPGH6YR.js +50 -0
  12. package/dist/{chunk-GEHPTPNZ.js → chunk-H2D3YSKM.js} +7 -3
  13. package/dist/{chunk-6Q7MHFBM.js → chunk-HNJ6BNNZ.js} +2 -2
  14. package/dist/{chunk-6WAMNZLO.js → chunk-KNXHLVF7.js} +126 -4
  15. package/dist/{chunk-DMIWAJRB.js → chunk-NEM5AEPQ.js} +172 -22
  16. package/dist/{chunk-6LJERPUN.js → chunk-NX2KKUS7.js} +20 -12
  17. package/dist/{chunk-SC2XHGIS.js → chunk-O5ERC2SE.js} +3 -3
  18. package/dist/{chunk-MIRLB5JM.js → chunk-SM7HP6EP.js} +64 -182
  19. package/dist/{chunk-BUOWHE36.js → chunk-T7GMPGUO.js} +613 -66
  20. package/dist/{chunk-G2DIPIYU.js → chunk-WK5YTINL.js} +29 -2
  21. package/dist/{chunk-UWAVXC57.js → chunk-WNTCZM2J.js} +34 -482
  22. package/dist/{chunk-GZREXCQZ.js → chunk-XLZCX6R2.js} +17 -10
  23. package/dist/{chunk-ORQJVE57.js → chunk-YWERIWFD.js} +18 -17
  24. package/dist/{chunk-NTUASFQ3.js → chunk-YZM76W22.js} +5 -5
  25. package/dist/{chunk-BLKJWDTL.js → chunk-ZI435CAU.js} +2 -2
  26. package/dist/commands/clone.d.ts +2 -2
  27. package/dist/commands/clone.js +14 -13
  28. package/dist/commands/diff.d.ts +37 -23
  29. package/dist/commands/diff.js +20 -17
  30. package/dist/commands/hukam.d.ts +2 -3
  31. package/dist/commands/hukam.js +16 -15
  32. package/dist/commands/init.d.ts +1 -1
  33. package/dist/commands/init.js +5 -1
  34. package/dist/commands/mcp.js +16 -10
  35. package/dist/commands/migrate/baseline.d.ts +1 -1
  36. package/dist/commands/migrate/baseline.js +5 -4
  37. package/dist/commands/migrate/create.d.ts +1 -1
  38. package/dist/commands/migrate/create.js +15 -9
  39. package/dist/commands/migrate/list.d.ts +1 -1
  40. package/dist/commands/migrate/list.js +6 -5
  41. package/dist/commands/migrate/run.d.ts +4 -1
  42. package/dist/commands/migrate/run.js +10 -8
  43. package/dist/commands/report.d.ts +1 -1
  44. package/dist/commands/report.js +5 -4
  45. package/dist/commands/restore.d.ts +1 -1
  46. package/dist/commands/restore.js +14 -13
  47. package/dist/commands/snapshot.d.ts +8 -1
  48. package/dist/commands/snapshot.js +37 -9
  49. package/dist/commands/sync.d.ts +2 -3
  50. package/dist/commands/sync.js +16 -15
  51. package/dist/{config-CTbeRlJk.d.ts → config-l3ggjw9r.d.ts} +2 -0
  52. package/dist/index.d.ts +21 -4
  53. package/dist/index.js +15 -15
  54. package/package.json +2 -2
  55. package/dist/chunk-DQQ5E563.js +0 -64
@@ -1,24 +1,25 @@
1
1
  import {
2
- captureSnapshot,
2
+ captureSnapshot
3
+ } from "./chunk-SM7HP6EP.js";
4
+ import {
3
5
  checkPgDumpCompat
4
- } from "./chunk-MIRLB5JM.js";
6
+ } from "./chunk-AGONS5JJ.js";
5
7
  import {
6
- pgClientConfig,
8
+ newPgClient,
7
9
  pgQuery,
8
10
  quoteName
9
- } from "./chunk-SQPCWGQO.js";
11
+ } from "./chunk-4M6OQLPO.js";
10
12
  import {
11
13
  BRANCHES_FILE,
12
14
  CLONE_PROGRESS_INTERVAL_MS,
13
15
  PG_PIPELINE_TIMEOUT_MS,
14
16
  SUPABASE_PLATFORM_SCHEMAS
15
- } from "./chunk-6WAMNZLO.js";
17
+ } from "./chunk-KNXHLVF7.js";
16
18
 
17
19
  // src/branch.ts
18
20
  import { spawn } from "child_process";
19
21
  import { readFile, writeFile, mkdir } from "fs/promises";
20
22
  import { resolve, dirname } from "path";
21
- import pg from "pg";
22
23
 
23
24
  // src/stubs.ts
24
25
  var AUTH_STUBS_SQL = `
@@ -176,7 +177,7 @@ async function createBranch(opts) {
176
177
  async function tryTemplateCopy(sourceUrl, newDb) {
177
178
  const { database } = parseUrl(sourceUrl);
178
179
  const maintenanceUrl = replaceDbName(sourceUrl, "postgres");
179
- const client = new pg.Client(pgClientConfig(maintenanceUrl));
180
+ const client = newPgClient(maintenanceUrl);
180
181
  try {
181
182
  await client.connect();
182
183
  await client.query(`CREATE DATABASE ${quoteName(newDb)} TEMPLATE ${quoteName(database)}`);
@@ -189,7 +190,7 @@ async function tryTemplateCopy(sourceUrl, newDb) {
189
190
  }
190
191
  async function tryDumpRestore(sourceUrl, newDb, schemaOnly, pgDumpPath = "pg_dump", pgRestorePath = "pg_restore") {
191
192
  const maintenanceUrl = replaceDbName(sourceUrl, "postgres");
192
- const client = new pg.Client(pgClientConfig(maintenanceUrl));
193
+ const client = newPgClient(maintenanceUrl);
193
194
  try {
194
195
  await client.connect();
195
196
  await client.query(`CREATE DATABASE ${quoteName(newDb)}`);
@@ -256,7 +257,7 @@ async function tryDumpRestore(sourceUrl, newDb, schemaOnly, pgDumpPath = "pg_dum
256
257
  });
257
258
  return true;
258
259
  } catch {
259
- const cleanup = new pg.Client(pgClientConfig(maintenanceUrl));
260
+ const cleanup = newPgClient(maintenanceUrl);
260
261
  try {
261
262
  await cleanup.connect();
262
263
  await cleanup.query(`DROP DATABASE IF EXISTS ${quoteName(newDb)}`);
@@ -272,7 +273,7 @@ async function listBranches(cwd = process.cwd()) {
272
273
  }
273
274
  async function listServerDatabases(serverUrl) {
274
275
  const maintenanceUrl = replaceDbName(serverUrl, "postgres");
275
- const client = new pg.Client(pgClientConfig(maintenanceUrl));
276
+ const client = newPgClient(maintenanceUrl);
276
277
  try {
277
278
  await client.connect();
278
279
  const { rows } = await client.query(
@@ -334,7 +335,7 @@ async function deleteBranch(name, sourceUrl, cwd = process.cwd()) {
334
335
  if (idx === -1) throw new Error(`Branch "${name}" not found.`);
335
336
  const branch = manifest.branches[idx];
336
337
  const maintenanceUrl = replaceDbName(sourceUrl, "postgres");
337
- const client = new pg.Client(pgClientConfig(maintenanceUrl));
338
+ const client = newPgClient(maintenanceUrl);
338
339
  try {
339
340
  await client.connect();
340
341
  await client.query(
@@ -355,7 +356,7 @@ async function cloneRemoteToLocal(opts) {
355
356
  }
356
357
  const localMaintenanceUrl = opts.localBaseUrl;
357
358
  const localDbUrl = replaceDbName(opts.localBaseUrl, opts.localDbName);
358
- const client = new pg.Client(pgClientConfig(localMaintenanceUrl));
359
+ const client = newPgClient(localMaintenanceUrl);
359
360
  try {
360
361
  await client.connect();
361
362
  if (opts.force) {
@@ -378,7 +379,7 @@ async function cloneRemoteToLocal(opts) {
378
379
  await client.end();
379
380
  }
380
381
  if (opts.excludeSchemas?.length) {
381
- const stubClient = new pg.Client(pgClientConfig(localDbUrl));
382
+ const stubClient = newPgClient(localDbUrl);
382
383
  try {
383
384
  await stubClient.connect();
384
385
  await stubClient.query(CLONE_STUBS_SQL);
@@ -492,7 +493,7 @@ async function cloneRemoteToLocal(opts) {
492
493
  }, PG_PIPELINE_TIMEOUT_MS);
493
494
  });
494
495
  } catch (err) {
495
- const cleanup = new pg.Client(pgClientConfig(localMaintenanceUrl));
496
+ const cleanup = newPgClient(localMaintenanceUrl);
496
497
  try {
497
498
  await cleanup.connect();
498
499
  await cleanup.query(`DROP DATABASE IF EXISTS ${quoteName(opts.localDbName)}`);
@@ -553,7 +554,7 @@ function summariseCommand(command) {
553
554
  async function installRemoteExtensions(remoteUrl, localDbUrl, excludeSchemas) {
554
555
  const installed = [];
555
556
  if (excludeSchemas.length === 0) return { installed };
556
- const remote = new pg.Client(pgClientConfig(remoteUrl));
557
+ const remote = newPgClient(remoteUrl);
557
558
  let wanted = [];
558
559
  try {
559
560
  await remote.connect();
@@ -571,7 +572,7 @@ async function installRemoteExtensions(remoteUrl, localDbUrl, excludeSchemas) {
571
572
  } finally {
572
573
  await remote.end();
573
574
  }
574
- const local = new pg.Client(pgClientConfig(localDbUrl));
575
+ const local = newPgClient(localDbUrl);
575
576
  try {
576
577
  await local.connect();
577
578
  const { rows } = await local.query("SELECT name FROM pg_available_extensions");
@@ -639,4 +640,4 @@ export {
639
640
  isCloneDatabase,
640
641
  sourceLooksLikeCloneOf
641
642
  };
642
- //# sourceMappingURL=chunk-ORQJVE57.js.map
643
+ //# sourceMappingURL=chunk-YWERIWFD.js.map
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  isCommentOnly,
3
3
  splitSqlStatements
4
- } from "./chunk-G2DIPIYU.js";
4
+ } from "./chunk-WK5YTINL.js";
5
5
  import {
6
6
  captureSnapshot,
7
7
  findLatestSnapshot,
8
8
  loadSnapshot
9
- } from "./chunk-MIRLB5JM.js";
9
+ } from "./chunk-SM7HP6EP.js";
10
10
  import {
11
11
  slugify
12
- } from "./chunk-DQQ5E563.js";
12
+ } from "./chunk-AGONS5JJ.js";
13
13
  import {
14
14
  MIGRATIONS_SUBDIR,
15
15
  SUPAFORGE_DIR
16
- } from "./chunk-6WAMNZLO.js";
16
+ } from "./chunk-KNXHLVF7.js";
17
17
 
18
18
  // src/migration.ts
19
19
  import { mkdir, writeFile, readFile, readdir } from "fs/promises";
@@ -245,4 +245,4 @@ export {
245
245
  loadMigrations,
246
246
  listMigrationFiles
247
247
  };
248
- //# sourceMappingURL=chunk-NTUASFQ3.js.map
248
+ //# sourceMappingURL=chunk-YZM76W22.js.map
@@ -2,7 +2,7 @@ import {
2
2
  CLONE_SKIP_FLAGS,
3
3
  cmd,
4
4
  dim
5
- } from "./chunk-6WAMNZLO.js";
5
+ } from "./chunk-KNXHLVF7.js";
6
6
 
7
7
  // src/tips.ts
8
8
  function applyTip(sourceIsClone, driftedChecks) {
@@ -150,4 +150,4 @@ function renderTip(ctx) {
150
150
  export {
151
151
  renderTip
152
152
  };
153
- //# sourceMappingURL=chunk-BLKJWDTL.js.map
153
+ //# sourceMappingURL=chunk-ZI435CAU.js.map
@@ -1,7 +1,7 @@
1
1
  import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
2
  import { BaseCommand } from '../base-command.js';
3
- import { R as RestoreFailure } from '../branch-C4ndfoj5.js';
4
- import { S as SupaForgeConfig } from '../config-CTbeRlJk.js';
3
+ import { R as RestoreFailure } from '../branch-BppjQBv_.js';
4
+ import { S as SupaForgeConfig } from '../config-l3ggjw9r.js';
5
5
  import '@oclif/core';
6
6
 
7
7
  /**
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  renderTip
3
- } from "../chunk-BLKJWDTL.js";
3
+ } from "../chunk-ZI435CAU.js";
4
4
  import {
5
5
  BaseCommand
6
- } from "../chunk-GZREXCQZ.js";
6
+ } from "../chunk-XLZCX6R2.js";
7
7
  import {
8
8
  addBranchToManifest,
9
9
  cloneRemoteToLocal,
@@ -11,22 +11,22 @@ import {
11
11
  listBranches,
12
12
  reconcileClones,
13
13
  replaceDbName
14
- } from "../chunk-ORQJVE57.js";
14
+ } from "../chunk-YWERIWFD.js";
15
15
  import {
16
16
  captureSnapshot,
17
- checkPgDumpCompat,
18
17
  formatSnapshotLayers
19
- } from "../chunk-MIRLB5JM.js";
20
- import "../chunk-DQQ5E563.js";
18
+ } from "../chunk-SM7HP6EP.js";
19
+ import {
20
+ checkPgDumpCompat
21
+ } from "../chunk-AGONS5JJ.js";
21
22
  import {
22
23
  DEFAULT_LOCAL_PORT,
23
24
  LOCAL_PG_PASSWORD,
24
25
  LOCAL_PG_USER,
25
- errMsg,
26
- pgClientConfig,
27
- redactUrls,
26
+ newPgClient,
28
27
  startLocalPg
29
- } from "../chunk-SQPCWGQO.js";
28
+ } from "../chunk-4M6OQLPO.js";
29
+ import "../chunk-GQPGH6YR.js";
30
30
  import {
31
31
  CLONE_EXTRA_EXCLUDE_SCHEMAS,
32
32
  CLONE_SKIP_FLAGS,
@@ -36,16 +36,17 @@ import {
36
36
  bold,
37
37
  cmd,
38
38
  dim,
39
+ errMsg,
39
40
  loadConfig,
40
41
  ok,
42
+ redactUrls,
41
43
  warn
42
- } from "../chunk-6WAMNZLO.js";
44
+ } from "../chunk-KNXHLVF7.js";
43
45
 
44
46
  // src/commands/clone.ts
45
47
  import { writeFile, mkdir } from "fs/promises";
46
48
  import { resolve } from "path";
47
49
  import { Flags } from "@oclif/core";
48
- import pg from "pg";
49
50
  var CLONE_EXCLUDE_SCHEMAS = [.../* @__PURE__ */ new Set([
50
51
  ...DEFAULT_IGNORE_SCHEMAS,
51
52
  ...CLONE_EXTRA_EXCLUDE_SCHEMAS
@@ -211,7 +212,7 @@ var Clone = class _Clone extends BaseCommand {
211
212
  });
212
213
  pre.addCheck("Target database", async () => {
213
214
  try {
214
- const client = new pg.Client(pgClientConfig(localBaseUrl));
215
+ const client = newPgClient(localBaseUrl);
215
216
  await client.connect();
216
217
  const { rows } = await client.query(
217
218
  "SELECT 1 FROM pg_database WHERE datname = $1",
@@ -1,8 +1,19 @@
1
- import * as _oclif_core_interfaces from '@oclif/core/interfaces';
1
+ import { Interfaces } from '@oclif/core';
2
2
  import { BaseCommand } from '../base-command.js';
3
- import '@oclif/core';
4
- import '../config-CTbeRlJk.js';
3
+ import '../config-l3ggjw9r.js';
5
4
 
5
+ /**
6
+ * What to do after a rolled-back apply.
7
+ *
8
+ * Usually: apply the fixes that work without the one that failed. Not when
9
+ * the failure is replacing a view or type something else depends on — the
10
+ * others may be what depends on it, and applying them alone leaves the two
11
+ * out of step — so that one is named to fix or leave out instead.
12
+ */
13
+ declare function rollbackHint(errors: ReadonlyArray<{
14
+ issueId: string;
15
+ error: string;
16
+ }>): string;
6
17
  /** Which apply-only flags this invocation will silently ignore. */
7
18
  declare function inertApplyFlags(flags: Record<string, unknown>): ReadonlyArray<{
8
19
  flag: string;
@@ -30,25 +41,26 @@ declare class Diff extends BaseCommand {
30
41
  description: string;
31
42
  }[];
32
43
  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>;
44
+ 'source-dir': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
45
+ check: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
46
+ skip: Interfaces.OptionFlag<string[] | undefined, Interfaces.CustomOptions>;
47
+ detail: Interfaces.BooleanFlag<boolean>;
48
+ apply: Interfaces.BooleanFlag<boolean>;
49
+ 'allow-destructive': Interfaces.BooleanFlag<boolean>;
50
+ 'dry-run': Interfaces.BooleanFlag<boolean>;
51
+ 'no-transaction': Interfaces.BooleanFlag<boolean>;
52
+ only: Interfaces.OptionFlag<string[] | undefined, Interfaces.CustomOptions>;
53
+ 'include-files': Interfaces.BooleanFlag<boolean>;
54
+ tables: Interfaces.OptionFlag<string[] | undefined, Interfaces.CustomOptions>;
55
+ 'exclude-tables': Interfaces.OptionFlag<string[] | undefined, Interfaces.CustomOptions>;
56
+ json: Interfaces.BooleanFlag<boolean>;
57
+ source: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
58
+ target: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
59
+ ci: Interfaces.BooleanFlag<boolean>;
60
+ prove: Interfaces.BooleanFlag<boolean>;
61
+ 'apply-posture': Interfaces.BooleanFlag<boolean>;
62
+ 'fail-on': Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
63
+ 'fail-on-posture': Interfaces.BooleanFlag<boolean>;
52
64
  };
53
65
  /**
54
66
  * Report what `--apply` did, or — under `--dry-run` — what it would do.
@@ -60,6 +72,8 @@ declare class Diff extends BaseCommand {
60
72
  */
61
73
  private renderApplyResult;
62
74
  run(): Promise<void>;
75
+ /** The comparison itself, between the config's source and target. */
76
+ private compare;
63
77
  /**
64
78
  * Stop before applying anything: the proof could not run, or ran and found
65
79
  * the migration would not reproduce the source. Under --json the reason is
@@ -78,4 +92,4 @@ declare class Diff extends BaseCommand {
78
92
  private preflightBothDatabases;
79
93
  }
80
94
 
81
- export { Diff as default, inertApplyFlags };
95
+ export { Diff as default, inertApplyFlags, rollbackHint };
@@ -1,23 +1,26 @@
1
1
  import {
2
2
  Diff,
3
- inertApplyFlags
4
- } from "../chunk-4IVN7QVY.js";
5
- import "../chunk-6Q7MHFBM.js";
6
- import "../chunk-GEHPTPNZ.js";
7
- import "../chunk-3HGAV5CC.js";
8
- import "../chunk-DMIWAJRB.js";
9
- import "../chunk-UWAVXC57.js";
10
- import "../chunk-BUOWHE36.js";
11
- import "../chunk-G2DIPIYU.js";
12
- import "../chunk-BLKJWDTL.js";
13
- import "../chunk-GZREXCQZ.js";
14
- import "../chunk-ORQJVE57.js";
15
- import "../chunk-MIRLB5JM.js";
16
- import "../chunk-DQQ5E563.js";
17
- import "../chunk-SQPCWGQO.js";
18
- import "../chunk-6WAMNZLO.js";
3
+ inertApplyFlags,
4
+ rollbackHint
5
+ } from "../chunk-44UVQJV2.js";
6
+ import "../chunk-HNJ6BNNZ.js";
7
+ import "../chunk-H2D3YSKM.js";
8
+ import "../chunk-4AGJRRBT.js";
9
+ import "../chunk-WNTCZM2J.js";
10
+ import "../chunk-NEM5AEPQ.js";
11
+ import "../chunk-T7GMPGUO.js";
12
+ import "../chunk-WK5YTINL.js";
13
+ import "../chunk-ZI435CAU.js";
14
+ import "../chunk-XLZCX6R2.js";
15
+ import "../chunk-YWERIWFD.js";
16
+ import "../chunk-SM7HP6EP.js";
17
+ import "../chunk-AGONS5JJ.js";
18
+ import "../chunk-4M6OQLPO.js";
19
+ import "../chunk-GQPGH6YR.js";
20
+ import "../chunk-KNXHLVF7.js";
19
21
  export {
20
22
  Diff as default,
21
- inertApplyFlags
23
+ inertApplyFlags,
24
+ rollbackHint
22
25
  };
23
26
  //# sourceMappingURL=diff.js.map
@@ -1,8 +1,7 @@
1
1
  import Diff from './diff.js';
2
- import '@oclif/core/interfaces';
3
- import '../base-command.js';
4
2
  import '@oclif/core';
5
- import '../config-CTbeRlJk.js';
3
+ import '../base-command.js';
4
+ import '../config-l3ggjw9r.js';
6
5
 
7
6
  declare class Hukam extends Diff {
8
7
  static hidden: boolean;
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  Diff
3
- } from "../chunk-4IVN7QVY.js";
4
- import "../chunk-6Q7MHFBM.js";
5
- import "../chunk-GEHPTPNZ.js";
6
- import "../chunk-3HGAV5CC.js";
7
- import "../chunk-DMIWAJRB.js";
8
- import "../chunk-UWAVXC57.js";
9
- import "../chunk-BUOWHE36.js";
10
- import "../chunk-G2DIPIYU.js";
11
- import "../chunk-BLKJWDTL.js";
12
- import "../chunk-GZREXCQZ.js";
13
- import "../chunk-ORQJVE57.js";
14
- import "../chunk-MIRLB5JM.js";
15
- import "../chunk-DQQ5E563.js";
16
- import "../chunk-SQPCWGQO.js";
17
- import "../chunk-6WAMNZLO.js";
3
+ } from "../chunk-44UVQJV2.js";
4
+ import "../chunk-HNJ6BNNZ.js";
5
+ import "../chunk-H2D3YSKM.js";
6
+ import "../chunk-4AGJRRBT.js";
7
+ import "../chunk-WNTCZM2J.js";
8
+ import "../chunk-NEM5AEPQ.js";
9
+ import "../chunk-T7GMPGUO.js";
10
+ import "../chunk-WK5YTINL.js";
11
+ import "../chunk-ZI435CAU.js";
12
+ import "../chunk-XLZCX6R2.js";
13
+ import "../chunk-YWERIWFD.js";
14
+ import "../chunk-SM7HP6EP.js";
15
+ import "../chunk-AGONS5JJ.js";
16
+ import "../chunk-4M6OQLPO.js";
17
+ import "../chunk-GQPGH6YR.js";
18
+ import "../chunk-KNXHLVF7.js";
18
19
 
19
20
  // src/commands/hukam.ts
20
21
  var Hukam = class extends Diff {
@@ -1,6 +1,6 @@
1
1
  import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
2
  import { Command } from '@oclif/core';
3
- import { S as SupaForgeConfig } from '../config-CTbeRlJk.js';
3
+ import { S as SupaForgeConfig } from '../config-l3ggjw9r.js';
4
4
 
5
5
  type AskFn = ((question: string) => Promise<string>) & {
6
6
  close: () => void;
@@ -1,3 +1,6 @@
1
+ import {
2
+ installProcessGuard
3
+ } from "../chunk-GQPGH6YR.js";
1
4
  import {
2
5
  INIT_HINTS,
3
6
  SUPAFORGE_DIR,
@@ -12,7 +15,7 @@ import {
12
15
  validateConfig,
13
16
  validateSingleEnvConfig,
14
17
  warn
15
- } from "../chunk-6WAMNZLO.js";
18
+ } from "../chunk-KNXHLVF7.js";
16
19
 
17
20
  // src/commands/init.ts
18
21
  import { Command, Flags } from "@oclif/core";
@@ -248,6 +251,7 @@ var Init = class _Init extends Command {
248
251
  })
249
252
  };
250
253
  async run() {
254
+ installProcessGuard(this.argv);
251
255
  const { flags } = await this.parse(_Init);
252
256
  const configPath = resolve(process.cwd(), CONFIG_FILENAME);
253
257
  if (!flags.force) {
@@ -1,15 +1,19 @@
1
1
  import {
2
2
  createServer
3
- } from "../chunk-6LJERPUN.js";
4
- import "../chunk-NTUASFQ3.js";
5
- import "../chunk-3HGAV5CC.js";
6
- import "../chunk-UWAVXC57.js";
7
- import "../chunk-BUOWHE36.js";
8
- import "../chunk-G2DIPIYU.js";
9
- import "../chunk-MIRLB5JM.js";
10
- import "../chunk-DQQ5E563.js";
11
- import "../chunk-SQPCWGQO.js";
12
- import "../chunk-6WAMNZLO.js";
3
+ } from "../chunk-NX2KKUS7.js";
4
+ import "../chunk-YZM76W22.js";
5
+ import "../chunk-4AGJRRBT.js";
6
+ import "../chunk-WNTCZM2J.js";
7
+ import "../chunk-T7GMPGUO.js";
8
+ import "../chunk-WK5YTINL.js";
9
+ import "../chunk-SM7HP6EP.js";
10
+ import "../chunk-AGONS5JJ.js";
11
+ import "../chunk-4M6OQLPO.js";
12
+ import {
13
+ installProcessGuard,
14
+ keepRunningOnStrayErrors
15
+ } from "../chunk-GQPGH6YR.js";
16
+ import "../chunk-KNXHLVF7.js";
13
17
 
14
18
  // src/commands/mcp.ts
15
19
  import { existsSync, statSync } from "fs";
@@ -34,6 +38,8 @@ var Mcp = class _Mcp extends Command {
34
38
  })
35
39
  };
36
40
  async run() {
41
+ keepRunningOnStrayErrors();
42
+ installProcessGuard(this.argv);
37
43
  const { flags } = await this.parse(_Mcp);
38
44
  const project = resolve(flags.project ?? process.cwd());
39
45
  if (!existsSync(project) || !statSync(project).isDirectory()) {
@@ -1,7 +1,7 @@
1
1
  import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
2
  import { BaseCommand } from '../../base-command.js';
3
3
  import '@oclif/core';
4
- import '../../config-CTbeRlJk.js';
4
+ import '../../config-l3ggjw9r.js';
5
5
 
6
6
  /**
7
7
  * Mark all local migration files as applied without executing them.
@@ -1,15 +1,16 @@
1
1
  import {
2
2
  baselineMigrations
3
- } from "../../chunk-SC2XHGIS.js";
3
+ } from "../../chunk-O5ERC2SE.js";
4
4
  import {
5
5
  BaseCommand
6
- } from "../../chunk-GZREXCQZ.js";
7
- import "../../chunk-SQPCWGQO.js";
6
+ } from "../../chunk-XLZCX6R2.js";
7
+ import "../../chunk-4M6OQLPO.js";
8
+ import "../../chunk-GQPGH6YR.js";
8
9
  import {
9
10
  bold,
10
11
  dim,
11
12
  ok
12
- } from "../../chunk-6WAMNZLO.js";
13
+ } from "../../chunk-KNXHLVF7.js";
13
14
 
14
15
  // src/commands/migrate/baseline.ts
15
16
  import { Flags } from "@oclif/core";
@@ -1,7 +1,7 @@
1
1
  import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
2
  import { BaseCommand } from '../../base-command.js';
3
3
  import '@oclif/core';
4
- import '../../config-CTbeRlJk.js';
4
+ import '../../config-l3ggjw9r.js';
5
5
 
6
6
  /**
7
7
  * Shared string manipulation utilities.
@@ -1,21 +1,25 @@
1
1
  import {
2
- truncateSql
3
- } from "../../chunk-2SELREHW.js";
4
- import "../../chunk-SC2XHGIS.js";
2
+ targetFingerprint,
3
+ truncateSql,
4
+ writtenAgainstLine
5
+ } from "../../chunk-5Q6LSLA3.js";
6
+ import "../../chunk-O5ERC2SE.js";
7
+ import "../../chunk-NEM5AEPQ.js";
5
8
  import {
6
9
  isDestructiveSql,
7
10
  runDbDiff
8
- } from "../../chunk-BUOWHE36.js";
11
+ } from "../../chunk-T7GMPGUO.js";
9
12
  import {
10
13
  splitSqlStatements
11
- } from "../../chunk-G2DIPIYU.js";
14
+ } from "../../chunk-WK5YTINL.js";
12
15
  import {
13
16
  BaseCommand
14
- } from "../../chunk-GZREXCQZ.js";
17
+ } from "../../chunk-XLZCX6R2.js";
15
18
  import {
16
19
  slugify
17
- } from "../../chunk-DQQ5E563.js";
18
- import "../../chunk-SQPCWGQO.js";
20
+ } from "../../chunk-AGONS5JJ.js";
21
+ import "../../chunk-4M6OQLPO.js";
22
+ import "../../chunk-GQPGH6YR.js";
19
23
  import {
20
24
  DEFAULT_IGNORE_SCHEMAS,
21
25
  bold,
@@ -23,7 +27,7 @@ import {
23
27
  dim,
24
28
  ok,
25
29
  warn
26
- } from "../../chunk-6WAMNZLO.js";
30
+ } from "../../chunk-KNXHLVF7.js";
27
31
 
28
32
  // src/commands/migrate/create.ts
29
33
  import { writeFile, mkdir } from "fs/promises";
@@ -71,10 +75,12 @@ var MigrateCreate = class _MigrateCreate extends BaseCommand {
71
75
  const slug = slugify(flags.name);
72
76
  const filename = `${timestamp}_${slug}.sql`;
73
77
  const destructive = splitSqlStatements(result.up).filter(isDestructiveSql);
78
+ const digest = await targetFingerprint(targetEnv.dbUrl, ignoreSchemas).catch(() => void 0);
74
79
  const lines = [
75
80
  `-- Migration: ${flags.name}`,
76
81
  `-- Generated by supaforge migrate create`,
77
82
  `-- Source: ${config.source} \u2192 Target: ${config.target}`,
83
+ ...digest ? [writtenAgainstLine(config.target, digest)] : [],
78
84
  ...destructive.length > 0 ? [`-- WARNING: ${destructive.length} destructive statement(s) \u2014 drops or deletes data. Review before running.`] : [],
79
85
  "",
80
86
  result.up
@@ -1,7 +1,7 @@
1
1
  import * as _oclif_core_interfaces from '@oclif/core/interfaces';
2
2
  import { BaseCommand } from '../../base-command.js';
3
3
  import '@oclif/core';
4
- import '../../config-CTbeRlJk.js';
4
+ import '../../config-l3ggjw9r.js';
5
5
 
6
6
  /**
7
7
  * List local migration files and their applied status.
@@ -1,20 +1,21 @@
1
1
  import {
2
2
  getAppliedVersions
3
- } from "../../chunk-SC2XHGIS.js";
3
+ } from "../../chunk-O5ERC2SE.js";
4
4
  import {
5
5
  BaseCommand
6
- } from "../../chunk-GZREXCQZ.js";
6
+ } from "../../chunk-XLZCX6R2.js";
7
7
  import {
8
- errMsg,
9
8
  pgQuery,
10
9
  readLocalMigrations
11
- } from "../../chunk-SQPCWGQO.js";
10
+ } from "../../chunk-4M6OQLPO.js";
11
+ import "../../chunk-GQPGH6YR.js";
12
12
  import {
13
13
  bold,
14
14
  dim,
15
+ errMsg,
15
16
  ok,
16
17
  warn
17
- } from "../../chunk-6WAMNZLO.js";
18
+ } from "../../chunk-KNXHLVF7.js";
18
19
 
19
20
  // src/commands/migrate/list.ts
20
21
  import { Flags } from "@oclif/core";