@akal/supaforge 0.0.47 → 0.0.48

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 (32) hide show
  1. package/README.md +21 -11
  2. package/dist/base-command.js +2 -2
  3. package/dist/{chunk-4TBYWXUK.js → chunk-3XQHSJOJ.js} +3 -3
  4. package/dist/{chunk-YYS4FJ23.js → chunk-AMG4PVQS.js} +2 -2
  5. package/dist/{chunk-WNZCOYOK.js → chunk-C7VBY54T.js} +15 -5
  6. package/dist/{chunk-UUDXVYEI.js → chunk-D3JEYV4M.js} +6 -6
  7. package/dist/{chunk-TU5UIODX.js → chunk-EPGKCP3K.js} +2 -2
  8. package/dist/{chunk-CUGDLO2L.js → chunk-FKL3TQB7.js} +8 -8
  9. package/dist/{chunk-EB6PCOIL.js → chunk-HKG4KGDV.js} +2 -2
  10. package/dist/{chunk-HWRRFF55.js → chunk-HZ2FKMY3.js} +2 -2
  11. package/dist/{chunk-YQLVRHJA.js → chunk-NCMERJNX.js} +2 -2
  12. package/dist/{chunk-EGXQ37PA.js → chunk-PSSMJRMM.js} +8 -7
  13. package/dist/{chunk-XTSFAUXI.js → chunk-RXPYUFJR.js} +6 -6
  14. package/dist/{chunk-2XMRTAFX.js → chunk-S2GQI7ZO.js} +8 -7
  15. package/dist/{chunk-KBZUTGGF.js → chunk-VEXHBRNW.js} +7 -7
  16. package/dist/{chunk-RC7ZU7OV.js → chunk-W42J6U7R.js} +3 -1
  17. package/dist/{chunk-3SEVACCT.js → chunk-X4L3JT4R.js} +3 -3
  18. package/dist/{chunk-CRUFF6K5.js → chunk-Z3SB66RS.js} +5 -5
  19. package/dist/commands/clone.js +5 -5
  20. package/dist/commands/diff.js +9 -9
  21. package/dist/commands/hukam.js +9 -9
  22. package/dist/commands/mcp.js +8 -8
  23. package/dist/commands/migrate/baseline.js +3 -3
  24. package/dist/commands/migrate/create.js +8 -8
  25. package/dist/commands/migrate/list.js +3 -3
  26. package/dist/commands/migrate/run.js +7 -7
  27. package/dist/commands/report.js +2 -2
  28. package/dist/commands/restore.js +8 -8
  29. package/dist/commands/snapshot.js +5 -5
  30. package/dist/commands/sync.js +9 -9
  31. package/dist/index.js +13 -13
  32. package/package.json +23 -3
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # supaforge
2
2
 
3
- > Diff and sync your Supabase environments.
4
-
5
- SupaForge compares two Supabase projects (dev and prod, say) across
6
- everything that makes up a project, not just the schema. It reports every
7
- difference and makes the target match the source. Fixes run in dependency
8
- order, in one transaction, and can be proved on a throwaway copy before
9
- anything changes. With a single project, it snapshots, restores and clones it.
3
+ > Diff, sync and clone Supabase and Postgres environments - and prove every change before it reaches production.
4
+
5
+ [![CI](https://github.com/akalsoftware/supaforge/actions/workflows/ci.yml/badge.svg)](https://github.com/akalsoftware/supaforge/actions/workflows/ci.yml)
6
+ [![npm version](https://img.shields.io/npm/v/@akal/supaforge.svg)](https://www.npmjs.com/package/@akal/supaforge)
7
+ [![npm downloads](https://img.shields.io/npm/dm/@akal/supaforge.svg)](https://www.npmjs.com/package/@akal/supaforge)
8
+ [![MCP Registry](https://img.shields.io/badge/MCP_Registry-supaforge-blue)](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.akalsoftware/supaforge)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/akalsoftware/supaforge/blob/main/LICENSE)
10
+
11
+ SupaForge compares two environments (dev and prod, say) across everything
12
+ that makes up a Supabase project, not just the schema. It reports every
13
+ difference, including the security gaps - an RLS policy that never reached
14
+ production, a bucket public on one side only - and makes the target match the
15
+ source. Fixes run in dependency order, in one transaction, and can be proved
16
+ on a throwaway copy before anything changes. With a single project, it
17
+ snapshots, restores and clones it. It works with Supabase Cloud, self-hosted
18
+ Supabase, local stacks and plain PostgreSQL.
10
19
 
11
20
  - **The whole project.** It covers schema, RLS, storage, auth, Edge Functions,
12
21
  cron, webhooks, Realtime, queues, partition sets, Vault, extensions, grants,
@@ -22,7 +31,8 @@ anything changes. With a single project, it snapshots, restores and clones it.
22
31
  - **Anywhere.** It works with Supabase Cloud, self-hosted stacks, plain
23
32
  PostgreSQL targets, CI pipelines and AI agents (MCP).
24
33
 
25
- Built by [Akal](https://github.com/akalsoftware).
34
+ Built by [Akal Software](https://akalsoftware.com). Website and guides:
35
+ [supaforge.dev](https://supaforge.dev).
26
36
 
27
37
  ## Quick start
28
38
 
@@ -44,9 +54,9 @@ Everything that writes previews first. Add `--apply` to make it happen.
44
54
  | npm | `npm install -g @akal/supaforge`, or run it with `npx @akal/supaforge` |
45
55
  | Homebrew | `brew install akalsoftware/tap/supaforge` |
46
56
  | Docker | `docker run --rm -v "$PWD:/work" ghcr.io/akalsoftware/supaforge diff` |
47
- | GitHub Actions | [`akalsoftware/supaforge-action`](https://github.com/akalsoftware/supaforge-action) — see [CI](#ci-and-exit-codes) |
57
+ | GitHub Actions | [`akalsoftware/supaforge-action`](https://github.com/akalsoftware/supaforge-action) - see [CI](#ci-and-exit-codes) |
48
58
  | VS Code and its forks | The SupaForge extension: commands, and the MCP server for the editor's agent. Each [release](https://github.com/akalsoftware/supaforge/releases/latest) carries it as a `.vsix` |
49
- | Cursor, VS Code, Claude | One-click installs of the MCP server — see [MCP](#mcp-ai-agents) |
59
+ | Cursor, VS Code, Claude | One-click installs of the MCP server - see [MCP](#mcp-ai-agents) |
50
60
 
51
61
  It needs Node.js 22 or newer. DBDiff, its diff engine, comes with it as a
52
62
  native binary for your platform, so there is nothing else to install. The
@@ -279,7 +289,7 @@ supaforge migrate run --env=prod --apply
279
289
  | `SUPAFORGE_CONNECT_TIMEOUT` | `15` | Seconds to wait for a connection |
280
290
  | `SUPAFORGE_CHECK_CONCURRENCY` | `4` | Checks run at once. Lower it behind a tight pooler |
281
291
  | `SUPAFORGE_PROVE_ROWS` | `1000` | Rows of each table `--prove` copies to check they survive; `0` checks structure only |
282
- | `SUPAFORGE_PG_BIN` | — | A directory of PostgreSQL client tools (`pg_dump`, `psql`), used ahead of `PATH` — for a server newer than the tools on `PATH` |
292
+ | `SUPAFORGE_PG_BIN` | — | A directory of PostgreSQL client tools (`pg_dump`, `psql`), used ahead of `PATH`, for a server newer than the tools on `PATH` |
283
293
 
284
294
  ## Self-hosted Supabase
285
295
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BaseCommand
3
- } from "./chunk-TU5UIODX.js";
4
- import "./chunk-RC7ZU7OV.js";
3
+ } from "./chunk-EPGKCP3K.js";
4
+ import "./chunk-W42J6U7R.js";
5
5
  import "./chunk-KHXEES2M.js";
6
6
  import "./chunk-SQ52YBKK.js";
7
7
  export {
@@ -2,12 +2,12 @@ import {
2
2
  captureSnapshot,
3
3
  findLatestSnapshot,
4
4
  loadSnapshot
5
- } from "./chunk-3SEVACCT.js";
5
+ } from "./chunk-X4L3JT4R.js";
6
6
  import {
7
7
  isCommentOnly,
8
8
  slugify,
9
9
  splitSqlStatements
10
- } from "./chunk-YYS4FJ23.js";
10
+ } from "./chunk-AMG4PVQS.js";
11
11
  import {
12
12
  MIGRATIONS_SUBDIR,
13
13
  SUPAFORGE_DIR
@@ -243,4 +243,4 @@ export {
243
243
  loadMigrations,
244
244
  listMigrationFiles
245
245
  };
246
- //# sourceMappingURL=chunk-4TBYWXUK.js.map
246
+ //# sourceMappingURL=chunk-3XQHSJOJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  newPgClient
3
- } from "./chunk-RC7ZU7OV.js";
3
+ } from "./chunk-W42J6U7R.js";
4
4
 
5
5
  // src/utils/sql-split.ts
6
6
  var ROUTINE_HEAD = /^CREATE\s+(?:OR\s+REPLACE\s+)?(?:FUNCTION|PROCEDURE)\b/i;
@@ -393,4 +393,4 @@ export {
393
393
  checkPgDumpCompat,
394
394
  pgToolConnection
395
395
  };
396
- //# sourceMappingURL=chunk-YYS4FJ23.js.map
396
+ //# sourceMappingURL=chunk-AMG4PVQS.js.map
@@ -10,7 +10,7 @@ import {
10
10
  pgToolConnection,
11
11
  resolvePgDumpPath,
12
12
  splitSqlStatements
13
- } from "./chunk-YYS4FJ23.js";
13
+ } from "./chunk-AMG4PVQS.js";
14
14
  import {
15
15
  Check,
16
16
  heldSnapshot,
@@ -20,7 +20,7 @@ import {
20
20
  quoteLiteral,
21
21
  quoteName,
22
22
  snapshotsOff
23
- } from "./chunk-RC7ZU7OV.js";
23
+ } from "./chunk-W42J6U7R.js";
24
24
  import {
25
25
  DBDIFF_EXEC_TIMEOUT_MS,
26
26
  DBDIFF_MAX_BUFFER,
@@ -157,7 +157,12 @@ var PLATFORM_ROLES = [
157
157
  "supabase_functions_admin",
158
158
  "supabase_realtime_admin",
159
159
  "supabase_read_only_user",
160
- "supabase_replication_admin"
160
+ "supabase_replication_admin",
161
+ // Newer images add these two, reserved: Supabase refuses to drop or alter
162
+ // them. Syncing plain PostgreSQL into such a project offered DROP ROLE for
163
+ // both, and the refusal rolled back the whole apply.
164
+ "supabase_etl_admin",
165
+ "supabase_privileged_role"
161
166
  ];
162
167
  var API_ROLES = ["anon", "authenticated", "service_role"];
163
168
  var quoted = (names2) => names2.map((n) => `'${n.replace(/'/g, "''")}'`).join(", ");
@@ -1319,7 +1324,7 @@ function buildDbDiffArgs(options, outputFile) {
1319
1324
  if (memoryLimit) {
1320
1325
  args.push(`--memory-limit=${memoryLimit}`);
1321
1326
  }
1322
- if (options.type === "schema" && options.ignoreSchemas) {
1327
+ if (options.ignoreSchemas && (options.type === "schema" || options.type === "data")) {
1323
1328
  args.push(`--ignore-schemas=${schemaDiffIgnores(options.ignoreSchemas).join(",")}`);
1324
1329
  }
1325
1330
  const ignore = options.ignoreTables ?? [];
@@ -1331,6 +1336,10 @@ function buildDbDiffArgs(options, outputFile) {
1331
1336
  }
1332
1337
  return args;
1333
1338
  }
1339
+ function dataScope(tables, ignoreSchemas) {
1340
+ if (!tables.some((t) => t.includes("."))) return { tables };
1341
+ return { tables: tables.map((t) => t.includes(".") ? t : `public.${t}`), ignoreSchemas };
1342
+ }
1334
1343
  function dbdiffUrlEnv(options) {
1335
1344
  if (options.urlsOnCommandLine) return {};
1336
1345
  return { DBDIFF_SERVER1_URL: options.sourceUrl, DBDIFF_SERVER2_URL: options.targetUrl };
@@ -3565,6 +3574,7 @@ export {
3565
3574
  PLATFORM_ROLES,
3566
3575
  RolesCheck,
3567
3576
  ExtensionsCheck,
3577
+ dataScope,
3568
3578
  runDbDiff,
3569
3579
  isDestructiveSql,
3570
3580
  destructiveReason,
@@ -3593,4 +3603,4 @@ export {
3593
3603
  residualHeldBack,
3594
3604
  proofScope
3595
3605
  };
3596
- //# sourceMappingURL=chunk-WNZCOYOK.js.map
3606
+ //# sourceMappingURL=chunk-C7VBY54T.js.map
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  targetFingerprint,
3
3
  writtenAgainst
4
- } from "./chunk-YQLVRHJA.js";
4
+ } from "./chunk-NCMERJNX.js";
5
5
  import {
6
6
  ensureMigrationsTable,
7
7
  getAppliedVersions,
8
8
  getPendingMigrations,
9
9
  runMigration
10
- } from "./chunk-HWRRFF55.js";
10
+ } from "./chunk-HZ2FKMY3.js";
11
11
  import {
12
12
  isDestructiveSql
13
- } from "./chunk-WNZCOYOK.js";
13
+ } from "./chunk-C7VBY54T.js";
14
14
  import {
15
15
  BaseCommand
16
- } from "./chunk-TU5UIODX.js";
16
+ } from "./chunk-EPGKCP3K.js";
17
17
  import {
18
18
  splitSqlStatements
19
- } from "./chunk-YYS4FJ23.js";
19
+ } from "./chunk-AMG4PVQS.js";
20
20
  import {
21
21
  DEFAULT_IGNORE_SCHEMAS,
22
22
  bold,
@@ -180,4 +180,4 @@ export {
180
180
  findDestructiveStatements,
181
181
  truncateSql
182
182
  };
183
- //# sourceMappingURL=chunk-UUDXVYEI.js.map
183
+ //# sourceMappingURL=chunk-D3JEYV4M.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_MIGRATIONS_DIR,
3
3
  Preflight
4
- } from "./chunk-RC7ZU7OV.js";
4
+ } from "./chunk-W42J6U7R.js";
5
5
  import {
6
6
  installProcessGuard,
7
7
  noteJsonWritten
@@ -213,4 +213,4 @@ export {
213
213
  readRunLog,
214
214
  BaseCommand
215
215
  };
216
- //# sourceMappingURL=chunk-TU5UIODX.js.map
216
+ //# sourceMappingURL=chunk-EPGKCP3K.js.map
@@ -6,13 +6,13 @@ import {
6
6
  formatSkips,
7
7
  renderDetailed,
8
8
  renderSummary
9
- } from "./chunk-EB6PCOIL.js";
9
+ } from "./chunk-HKG4KGDV.js";
10
10
  import {
11
11
  createDefaultRegistry,
12
12
  proveBeforeApply,
13
13
  scan,
14
14
  summarizeByKind
15
- } from "./chunk-EGXQ37PA.js";
15
+ } from "./chunk-PSSMJRMM.js";
16
16
  import {
17
17
  CHECK_META,
18
18
  CHECK_NAMES,
@@ -24,17 +24,17 @@ import {
24
24
  psqlBeside,
25
25
  resolveTableFilter,
26
26
  withDatabase
27
- } from "./chunk-WNZCOYOK.js";
27
+ } from "./chunk-C7VBY54T.js";
28
28
  import {
29
29
  renderTip
30
30
  } from "./chunk-RQCXGO37.js";
31
31
  import {
32
32
  BaseCommand
33
- } from "./chunk-TU5UIODX.js";
33
+ } from "./chunk-EPGKCP3K.js";
34
34
  import {
35
35
  isCloneDatabase,
36
36
  sourceLooksLikeCloneOf
37
- } from "./chunk-2XMRTAFX.js";
37
+ } from "./chunk-S2GQI7ZO.js";
38
38
  import {
39
39
  describeMissingPgDump,
40
40
  getServerMajorVersion,
@@ -42,12 +42,12 @@ import {
42
42
  parseFlagList,
43
43
  resolvePgDumpPath,
44
44
  splitSqlStatements
45
- } from "./chunk-YYS4FJ23.js";
45
+ } from "./chunk-AMG4PVQS.js";
46
46
  import {
47
47
  Preflight,
48
48
  pgQuery,
49
49
  quoteName
50
- } from "./chunk-RC7ZU7OV.js";
50
+ } from "./chunk-W42J6U7R.js";
51
51
  import {
52
52
  CLONE_SKIP_FLAGS,
53
53
  DEFAULT_IGNORE_SCHEMAS,
@@ -754,4 +754,4 @@ export {
754
754
  inertApplyFlags,
755
755
  Diff
756
756
  };
757
- //# sourceMappingURL=chunk-CUGDLO2L.js.map
757
+ //# sourceMappingURL=chunk-FKL3TQB7.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CHECK_META,
3
3
  isComparisonCheck
4
- } from "./chunk-WNZCOYOK.js";
4
+ } from "./chunk-C7VBY54T.js";
5
5
  import {
6
6
  CHECK_LINE_PADDING,
7
7
  bold,
@@ -241,4 +241,4 @@ export {
241
241
  renderDetailed,
242
242
  formatSkips
243
243
  };
244
- //# sourceMappingURL=chunk-EB6PCOIL.js.map
244
+ //# sourceMappingURL=chunk-HKG4KGDV.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  pgQuery,
3
3
  readLocalMigrations
4
- } from "./chunk-RC7ZU7OV.js";
4
+ } from "./chunk-W42J6U7R.js";
5
5
  import {
6
6
  MIGRATIONS_SCHEMA,
7
7
  MIGRATIONS_TABLE
@@ -119,4 +119,4 @@ export {
119
119
  runMigration,
120
120
  baselineMigrations
121
121
  };
122
- //# sourceMappingURL=chunk-HWRRFF55.js.map
122
+ //# sourceMappingURL=chunk-HZ2FKMY3.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  comparedSchemas,
3
3
  fingerprint
4
- } from "./chunk-WNZCOYOK.js";
4
+ } from "./chunk-C7VBY54T.js";
5
5
 
6
6
  // src/written-against.ts
7
7
  import { createHash } from "crypto";
@@ -24,4 +24,4 @@ export {
24
24
  writtenAgainstLine,
25
25
  writtenAgainst
26
26
  };
27
- //# sourceMappingURL=chunk-YQLVRHJA.js.map
27
+ //# sourceMappingURL=chunk-NCMERJNX.js.map
@@ -4,6 +4,7 @@ import {
4
4
  RolesCheck,
5
5
  applyTableFilter,
6
6
  comparedSchemas,
7
+ dataScope,
7
8
  destructiveReason,
8
9
  isComparisonCheck,
9
10
  parseStatements,
@@ -21,7 +22,7 @@ import {
21
22
  sqlToIssues,
22
23
  withPlatformExtensionCalls,
23
24
  withoutAbsentRoles
24
- } from "./chunk-WNZCOYOK.js";
25
+ } from "./chunk-C7VBY54T.js";
25
26
  import {
26
27
  RealtimeCheck,
27
28
  createPolicySql,
@@ -33,10 +34,10 @@ import {
33
34
  readJsonArray,
34
35
  readJsonObject,
35
36
  schemaPolicySql
36
- } from "./chunk-3SEVACCT.js";
37
+ } from "./chunk-X4L3JT4R.js";
37
38
  import {
38
39
  splitSqlStatements
39
- } from "./chunk-YYS4FJ23.js";
40
+ } from "./chunk-AMG4PVQS.js";
40
41
  import {
41
42
  Check,
42
43
  CheckSkipped,
@@ -51,7 +52,7 @@ import {
51
52
  releaseSnapshots,
52
53
  setSnapshotsOff,
53
54
  sqlLiteral
54
- } from "./chunk-RC7ZU7OV.js";
55
+ } from "./chunk-W42J6U7R.js";
55
56
  import {
56
57
  DEFAULT_IGNORE_SCHEMAS,
57
58
  SCORE_MAX,
@@ -1850,7 +1851,7 @@ async function getTableFingerprint(dbUrl, table2, queryFn = pgQuery) {
1850
1851
  coalesce(sum(('x' || substr(d, 1, 16))::bit(64)::bigint::numeric), 0)::text
1851
1852
  || ':' ||
1852
1853
  coalesce(sum(('x' || substr(d, 17, 16))::bit(64)::bigint::numeric), 0)::text AS content
1853
- FROM (SELECT md5(t::text) AS d FROM ${quoteIdent(table2)} t) s
1854
+ FROM (SELECT md5(ROW(t.*)::text) AS d FROM ${quoteIdent(table2)} t) s
1854
1855
  `;
1855
1856
  const [row] = await queryFn(dbUrl, sql);
1856
1857
  return {
@@ -1919,7 +1920,7 @@ var DataCheck = class extends Check {
1919
1920
  targetUrl: ctx.target.dbUrl,
1920
1921
  type: "data",
1921
1922
  include: "both",
1922
- tables: changed,
1923
+ ...dataScope(changed, ctx.config.ignoreSchemas ?? DEFAULT_IGNORE_SCHEMAS),
1923
1924
  timeoutSeconds: ctx.target?.checks?.schema?.timeout
1924
1925
  });
1925
1926
  return sqlToIssues(result, "data");
@@ -2467,4 +2468,4 @@ export {
2467
2468
  createDefaultRegistry,
2468
2469
  proveBeforeApply
2469
2470
  };
2470
- //# sourceMappingURL=chunk-EGXQ37PA.js.map
2471
+ //# sourceMappingURL=chunk-PSSMJRMM.js.map
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  migrationsDir,
3
3
  writeMigrationFile
4
- } from "./chunk-CRUFF6K5.js";
4
+ } from "./chunk-Z3SB66RS.js";
5
5
  import {
6
6
  createDefaultRegistry,
7
7
  proveBeforeApply,
8
8
  scan
9
- } from "./chunk-EGXQ37PA.js";
9
+ } from "./chunk-PSSMJRMM.js";
10
10
  import {
11
11
  CHECK_NAMES,
12
12
  promote
13
- } from "./chunk-WNZCOYOK.js";
13
+ } from "./chunk-C7VBY54T.js";
14
14
  import {
15
15
  captureSnapshot,
16
16
  unrestorableSchema
17
- } from "./chunk-3SEVACCT.js";
17
+ } from "./chunk-X4L3JT4R.js";
18
18
  import {
19
19
  checkConnection
20
- } from "./chunk-RC7ZU7OV.js";
20
+ } from "./chunk-W42J6U7R.js";
21
21
  import {
22
22
  describeFailure,
23
23
  redactUrls,
@@ -530,4 +530,4 @@ export {
530
530
  clearLastScanResult,
531
531
  createServer
532
532
  };
533
- //# sourceMappingURL=chunk-XTSFAUXI.js.map
533
+ //# sourceMappingURL=chunk-RXPYUFJR.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  captureSnapshot
3
- } from "./chunk-3SEVACCT.js";
3
+ } from "./chunk-X4L3JT4R.js";
4
4
  import {
5
5
  checkPgDumpCompat,
6
6
  pgToolConnection,
7
7
  splitSqlStatements
8
- } from "./chunk-YYS4FJ23.js";
8
+ } from "./chunk-AMG4PVQS.js";
9
9
  import {
10
10
  newPgClient,
11
11
  pgQuery,
12
12
  quoteName
13
- } from "./chunk-RC7ZU7OV.js";
13
+ } from "./chunk-W42J6U7R.js";
14
14
  import {
15
15
  BRANCHES_FILE,
16
16
  CLONE_PROGRESS_INTERVAL_MS,
@@ -20,7 +20,7 @@ import {
20
20
 
21
21
  // src/branch.ts
22
22
  import { spawn } from "child_process";
23
- import { readFile, writeFile as writeFile2, mkdir } from "fs/promises";
23
+ import { readFile, writeFile as writeFile2, mkdir, chmod } from "fs/promises";
24
24
  import { resolve, dirname } from "path";
25
25
 
26
26
  // src/stubs.ts
@@ -210,8 +210,9 @@ async function loadManifest(cwd = process.cwd()) {
210
210
  }
211
211
  async function saveManifest(manifest, cwd) {
212
212
  const p = await manifestPath(cwd);
213
- await mkdir(dirname(p), { recursive: true });
214
- await writeFile2(p, JSON.stringify(manifest, null, 2) + "\n");
213
+ await mkdir(dirname(p), { recursive: true, mode: 448 });
214
+ await writeFile2(p, JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
215
+ await chmod(p, 384);
215
216
  }
216
217
  async function createBranch(opts) {
217
218
  const cwd = opts.cwd ?? process.cwd();
@@ -744,4 +745,4 @@ export {
744
745
  isCloneDatabase,
745
746
  sourceLooksLikeCloneOf
746
747
  };
747
- //# sourceMappingURL=chunk-2XMRTAFX.js.map
748
+ //# sourceMappingURL=chunk-S2GQI7ZO.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  loadMigrations
3
- } from "./chunk-4TBYWXUK.js";
3
+ } from "./chunk-3XQHSJOJ.js";
4
4
  import {
5
5
  ensureMigrationsTable,
6
6
  getAppliedVersions
7
- } from "./chunk-HWRRFF55.js";
7
+ } from "./chunk-HZ2FKMY3.js";
8
8
  import {
9
9
  ABSENT_ON_TARGET,
10
10
  EXTENSION_UNAVAILABLE,
@@ -18,23 +18,23 @@ import {
18
18
  rolesNamedBy,
19
19
  sqlSkeleton,
20
20
  statementSubject
21
- } from "./chunk-WNZCOYOK.js";
21
+ } from "./chunk-C7VBY54T.js";
22
22
  import {
23
23
  loadSnapshot
24
- } from "./chunk-3SEVACCT.js";
24
+ } from "./chunk-X4L3JT4R.js";
25
25
  import {
26
26
  isCommentOnly,
27
27
  isPsqlMetaCommand,
28
28
  splitSqlStatements,
29
29
  stripPsqlMetaCommands
30
- } from "./chunk-YYS4FJ23.js";
30
+ } from "./chunk-AMG4PVQS.js";
31
31
  import {
32
32
  newPgClient,
33
33
  pgQuery,
34
34
  quoteIdent,
35
35
  quoteLiteral,
36
36
  quoteName
37
- } from "./chunk-RC7ZU7OV.js";
37
+ } from "./chunk-W42J6U7R.js";
38
38
  import {
39
39
  DEFAULT_IGNORE_SCHEMAS,
40
40
  MIGRATIONS_TABLE,
@@ -900,4 +900,4 @@ export {
900
900
  previewMigrationRestore,
901
901
  summarizeStatement
902
902
  };
903
- //# sourceMappingURL=chunk-KBZUTGGF.js.map
903
+ //# sourceMappingURL=chunk-VEXHBRNW.js.map
@@ -39,11 +39,13 @@ function newPgClient(dbUrl, queryTimeoutMs) {
39
39
  client.on("error", () => void 0);
40
40
  return client;
41
41
  }
42
+ var PINNED_OUTPUT = "SET extra_float_digits = 3; SET bytea_output = hex";
42
43
  function newPgPool(config) {
43
44
  const pool = new pg.Pool(config);
44
45
  pool.on("error", () => void 0);
45
46
  pool.on("connect", (client) => {
46
47
  client.on("error", () => void 0);
48
+ client.query(PINNED_OUTPUT).catch(() => void 0);
47
49
  });
48
50
  return pool;
49
51
  }
@@ -627,4 +629,4 @@ export {
627
629
  MigrationsCheck,
628
630
  readLocalMigrations
629
631
  };
630
- //# sourceMappingURL=chunk-RC7ZU7OV.js.map
632
+ //# sourceMappingURL=chunk-W42J6U7R.js.map
@@ -5,7 +5,7 @@ import {
5
5
  normalizeRoles,
6
6
  pgToolConnection,
7
7
  resolvePgDumpPath
8
- } from "./chunk-YYS4FJ23.js";
8
+ } from "./chunk-AMG4PVQS.js";
9
9
  import {
10
10
  Check,
11
11
  inRolledBackTransaction,
@@ -16,7 +16,7 @@ import {
16
16
  quoteLiteral,
17
17
  quoteName,
18
18
  readOrAbsent
19
- } from "./chunk-RC7ZU7OV.js";
19
+ } from "./chunk-W42J6U7R.js";
20
20
  import {
21
21
  DEFAULT_IGNORE_SCHEMAS,
22
22
  MIGRATIONS_SUBDIR,
@@ -1252,4 +1252,4 @@ export {
1252
1252
  DEFAULT_KEEP_COUNT,
1253
1253
  pruneSnapshots
1254
1254
  };
1255
- //# sourceMappingURL=chunk-3SEVACCT.js.map
1255
+ //# sourceMappingURL=chunk-X4L3JT4R.js.map
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  targetFingerprint,
3
3
  writtenAgainstLine
4
- } from "./chunk-YQLVRHJA.js";
4
+ } from "./chunk-NCMERJNX.js";
5
5
  import {
6
6
  RolesCheck,
7
7
  isDestructiveSql,
8
8
  runDbDiff
9
- } from "./chunk-WNZCOYOK.js";
9
+ } from "./chunk-C7VBY54T.js";
10
10
  import {
11
11
  slugify,
12
12
  splitSqlStatements
13
- } from "./chunk-YYS4FJ23.js";
13
+ } from "./chunk-AMG4PVQS.js";
14
14
  import {
15
15
  DEFAULT_MIGRATIONS_DIR,
16
16
  pgQuery
17
- } from "./chunk-RC7ZU7OV.js";
17
+ } from "./chunk-W42J6U7R.js";
18
18
  import {
19
19
  DEFAULT_IGNORE_SCHEMAS
20
20
  } from "./chunk-SQ52YBKK.js";
@@ -89,4 +89,4 @@ export {
89
89
  writeMigrationFile,
90
90
  generateTimestamp
91
91
  };
92
- //# sourceMappingURL=chunk-CRUFF6K5.js.map
92
+ //# sourceMappingURL=chunk-Z3SB66RS.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-RQCXGO37.js";
4
4
  import {
5
5
  BaseCommand
6
- } from "../chunk-TU5UIODX.js";
6
+ } from "../chunk-EPGKCP3K.js";
7
7
  import {
8
8
  addBranchToManifest,
9
9
  cloneRemoteToLocal,
@@ -13,21 +13,21 @@ import {
13
13
  maintenanceUrl,
14
14
  reconcileClones,
15
15
  replaceDbName
16
- } from "../chunk-2XMRTAFX.js";
16
+ } from "../chunk-S2GQI7ZO.js";
17
17
  import {
18
18
  captureSnapshot,
19
19
  formatSnapshotLayers
20
- } from "../chunk-3SEVACCT.js";
20
+ } from "../chunk-X4L3JT4R.js";
21
21
  import {
22
22
  checkPgDumpCompat
23
- } from "../chunk-YYS4FJ23.js";
23
+ } from "../chunk-AMG4PVQS.js";
24
24
  import {
25
25
  DEFAULT_LOCAL_PORT,
26
26
  LOCAL_PG_PASSWORD,
27
27
  LOCAL_PG_USER,
28
28
  newPgClient,
29
29
  startLocalPg
30
- } from "../chunk-RC7ZU7OV.js";
30
+ } from "../chunk-W42J6U7R.js";
31
31
  import "../chunk-KHXEES2M.js";
32
32
  import {
33
33
  CLONE_EXTRA_EXCLUDE_SCHEMAS,
@@ -2,17 +2,17 @@ import {
2
2
  Diff,
3
3
  inertApplyFlags,
4
4
  rollbackHint
5
- } from "../chunk-CUGDLO2L.js";
5
+ } from "../chunk-FKL3TQB7.js";
6
6
  import "../chunk-Q43MN6NE.js";
7
- import "../chunk-EB6PCOIL.js";
8
- import "../chunk-EGXQ37PA.js";
9
- import "../chunk-WNZCOYOK.js";
7
+ import "../chunk-HKG4KGDV.js";
8
+ import "../chunk-PSSMJRMM.js";
9
+ import "../chunk-C7VBY54T.js";
10
10
  import "../chunk-RQCXGO37.js";
11
- import "../chunk-TU5UIODX.js";
12
- import "../chunk-2XMRTAFX.js";
13
- import "../chunk-3SEVACCT.js";
14
- import "../chunk-YYS4FJ23.js";
15
- import "../chunk-RC7ZU7OV.js";
11
+ import "../chunk-EPGKCP3K.js";
12
+ import "../chunk-S2GQI7ZO.js";
13
+ import "../chunk-X4L3JT4R.js";
14
+ import "../chunk-AMG4PVQS.js";
15
+ import "../chunk-W42J6U7R.js";
16
16
  import "../chunk-KHXEES2M.js";
17
17
  import "../chunk-SQ52YBKK.js";
18
18
  export {
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  Diff
3
- } from "../chunk-CUGDLO2L.js";
3
+ } from "../chunk-FKL3TQB7.js";
4
4
  import "../chunk-Q43MN6NE.js";
5
- import "../chunk-EB6PCOIL.js";
6
- import "../chunk-EGXQ37PA.js";
7
- import "../chunk-WNZCOYOK.js";
5
+ import "../chunk-HKG4KGDV.js";
6
+ import "../chunk-PSSMJRMM.js";
7
+ import "../chunk-C7VBY54T.js";
8
8
  import "../chunk-RQCXGO37.js";
9
- import "../chunk-TU5UIODX.js";
10
- import "../chunk-2XMRTAFX.js";
11
- import "../chunk-3SEVACCT.js";
12
- import "../chunk-YYS4FJ23.js";
13
- import "../chunk-RC7ZU7OV.js";
9
+ import "../chunk-EPGKCP3K.js";
10
+ import "../chunk-S2GQI7ZO.js";
11
+ import "../chunk-X4L3JT4R.js";
12
+ import "../chunk-AMG4PVQS.js";
13
+ import "../chunk-W42J6U7R.js";
14
14
  import "../chunk-KHXEES2M.js";
15
15
  import "../chunk-SQ52YBKK.js";
16
16
 
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createServer
3
- } from "../chunk-XTSFAUXI.js";
4
- import "../chunk-CRUFF6K5.js";
5
- import "../chunk-YQLVRHJA.js";
6
- import "../chunk-EGXQ37PA.js";
7
- import "../chunk-WNZCOYOK.js";
8
- import "../chunk-3SEVACCT.js";
9
- import "../chunk-YYS4FJ23.js";
10
- import "../chunk-RC7ZU7OV.js";
3
+ } from "../chunk-RXPYUFJR.js";
4
+ import "../chunk-Z3SB66RS.js";
5
+ import "../chunk-NCMERJNX.js";
6
+ import "../chunk-PSSMJRMM.js";
7
+ import "../chunk-C7VBY54T.js";
8
+ import "../chunk-X4L3JT4R.js";
9
+ import "../chunk-AMG4PVQS.js";
10
+ import "../chunk-W42J6U7R.js";
11
11
  import {
12
12
  installProcessGuard,
13
13
  keepRunningOnStrayErrors
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  baselineMigrations
3
- } from "../../chunk-HWRRFF55.js";
3
+ } from "../../chunk-HZ2FKMY3.js";
4
4
  import {
5
5
  BaseCommand
6
- } from "../../chunk-TU5UIODX.js";
7
- import "../../chunk-RC7ZU7OV.js";
6
+ } from "../../chunk-EPGKCP3K.js";
7
+ import "../../chunk-W42J6U7R.js";
8
8
  import "../../chunk-KHXEES2M.js";
9
9
  import {
10
10
  bold,
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  truncateSql
3
- } from "../../chunk-UUDXVYEI.js";
3
+ } from "../../chunk-D3JEYV4M.js";
4
4
  import {
5
5
  generateTimestamp,
6
6
  writeMigrationFile
7
- } from "../../chunk-CRUFF6K5.js";
8
- import "../../chunk-YQLVRHJA.js";
9
- import "../../chunk-HWRRFF55.js";
10
- import "../../chunk-WNZCOYOK.js";
7
+ } from "../../chunk-Z3SB66RS.js";
8
+ import "../../chunk-NCMERJNX.js";
9
+ import "../../chunk-HZ2FKMY3.js";
10
+ import "../../chunk-C7VBY54T.js";
11
11
  import {
12
12
  BaseCommand
13
- } from "../../chunk-TU5UIODX.js";
13
+ } from "../../chunk-EPGKCP3K.js";
14
14
  import {
15
15
  slugify
16
- } from "../../chunk-YYS4FJ23.js";
17
- import "../../chunk-RC7ZU7OV.js";
16
+ } from "../../chunk-AMG4PVQS.js";
17
+ import "../../chunk-W42J6U7R.js";
18
18
  import "../../chunk-KHXEES2M.js";
19
19
  import {
20
20
  bold,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getAppliedVersions
3
- } from "../../chunk-HWRRFF55.js";
3
+ } from "../../chunk-HZ2FKMY3.js";
4
4
  import {
5
5
  BaseCommand
6
- } from "../../chunk-TU5UIODX.js";
6
+ } from "../../chunk-EPGKCP3K.js";
7
7
  import {
8
8
  pgQuery,
9
9
  readLocalMigrations
10
- } from "../../chunk-RC7ZU7OV.js";
10
+ } from "../../chunk-W42J6U7R.js";
11
11
  import "../../chunk-KHXEES2M.js";
12
12
  import {
13
13
  bold,
@@ -2,13 +2,13 @@ import {
2
2
  MigrateRun,
3
3
  findDestructiveStatements,
4
4
  truncateSql
5
- } from "../../chunk-UUDXVYEI.js";
6
- import "../../chunk-YQLVRHJA.js";
7
- import "../../chunk-HWRRFF55.js";
8
- import "../../chunk-WNZCOYOK.js";
9
- import "../../chunk-TU5UIODX.js";
10
- import "../../chunk-YYS4FJ23.js";
11
- import "../../chunk-RC7ZU7OV.js";
5
+ } from "../../chunk-D3JEYV4M.js";
6
+ import "../../chunk-NCMERJNX.js";
7
+ import "../../chunk-HZ2FKMY3.js";
8
+ import "../../chunk-C7VBY54T.js";
9
+ import "../../chunk-EPGKCP3K.js";
10
+ import "../../chunk-AMG4PVQS.js";
11
+ import "../../chunk-W42J6U7R.js";
12
12
  import "../../chunk-KHXEES2M.js";
13
13
  import "../../chunk-SQ52YBKK.js";
14
14
  export {
@@ -5,8 +5,8 @@ import {
5
5
  BaseCommand,
6
6
  readRunLog,
7
7
  runLogPath
8
- } from "../chunk-TU5UIODX.js";
9
- import "../chunk-RC7ZU7OV.js";
8
+ } from "../chunk-EPGKCP3K.js";
9
+ import "../chunk-W42J6U7R.js";
10
10
  import "../chunk-KHXEES2M.js";
11
11
  import {
12
12
  bold,
@@ -5,22 +5,22 @@ import {
5
5
  restoreFromMigrations,
6
6
  restoreFromSnapshot,
7
7
  summarizeStatement
8
- } from "../chunk-KBZUTGGF.js";
9
- import "../chunk-4TBYWXUK.js";
10
- import "../chunk-HWRRFF55.js";
11
- import "../chunk-WNZCOYOK.js";
8
+ } from "../chunk-VEXHBRNW.js";
9
+ import "../chunk-3XQHSJOJ.js";
10
+ import "../chunk-HZ2FKMY3.js";
11
+ import "../chunk-C7VBY54T.js";
12
12
  import {
13
13
  renderTip
14
14
  } from "../chunk-RQCXGO37.js";
15
15
  import {
16
16
  BaseCommand
17
- } from "../chunk-TU5UIODX.js";
17
+ } from "../chunk-EPGKCP3K.js";
18
18
  import {
19
19
  findLatestSnapshot,
20
20
  listSnapshots
21
- } from "../chunk-3SEVACCT.js";
22
- import "../chunk-YYS4FJ23.js";
23
- import "../chunk-RC7ZU7OV.js";
21
+ } from "../chunk-X4L3JT4R.js";
22
+ import "../chunk-AMG4PVQS.js";
23
+ import "../chunk-W42J6U7R.js";
24
24
  import "../chunk-KHXEES2M.js";
25
25
  import {
26
26
  cmd,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  backup,
3
3
  listMigrationFiles
4
- } from "../chunk-4TBYWXUK.js";
4
+ } from "../chunk-3XQHSJOJ.js";
5
5
  import {
6
6
  renderTip
7
7
  } from "../chunk-RQCXGO37.js";
8
8
  import {
9
9
  BaseCommand
10
- } from "../chunk-TU5UIODX.js";
10
+ } from "../chunk-EPGKCP3K.js";
11
11
  import {
12
12
  DEFAULT_KEEP_COUNT,
13
13
  captureSnapshot,
@@ -15,9 +15,9 @@ import {
15
15
  listSnapshots,
16
16
  pruneSnapshots,
17
17
  unrestorableSchema
18
- } from "../chunk-3SEVACCT.js";
19
- import "../chunk-YYS4FJ23.js";
20
- import "../chunk-RC7ZU7OV.js";
18
+ } from "../chunk-X4L3JT4R.js";
19
+ import "../chunk-AMG4PVQS.js";
20
+ import "../chunk-W42J6U7R.js";
21
21
  import "../chunk-KHXEES2M.js";
22
22
  import {
23
23
  bold,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  Diff
3
- } from "../chunk-CUGDLO2L.js";
3
+ } from "../chunk-FKL3TQB7.js";
4
4
  import "../chunk-Q43MN6NE.js";
5
- import "../chunk-EB6PCOIL.js";
6
- import "../chunk-EGXQ37PA.js";
7
- import "../chunk-WNZCOYOK.js";
5
+ import "../chunk-HKG4KGDV.js";
6
+ import "../chunk-PSSMJRMM.js";
7
+ import "../chunk-C7VBY54T.js";
8
8
  import "../chunk-RQCXGO37.js";
9
- import "../chunk-TU5UIODX.js";
10
- import "../chunk-2XMRTAFX.js";
11
- import "../chunk-3SEVACCT.js";
12
- import "../chunk-YYS4FJ23.js";
13
- import "../chunk-RC7ZU7OV.js";
9
+ import "../chunk-EPGKCP3K.js";
10
+ import "../chunk-S2GQI7ZO.js";
11
+ import "../chunk-X4L3JT4R.js";
12
+ import "../chunk-AMG4PVQS.js";
13
+ import "../chunk-W42J6U7R.js";
14
14
  import "../chunk-KHXEES2M.js";
15
15
  import "../chunk-SQ52YBKK.js";
16
16
 
package/dist/index.js CHANGED
@@ -3,37 +3,37 @@ import {
3
3
  createServer,
4
4
  getLastScanResult,
5
5
  setLastScanResult
6
- } from "./chunk-XTSFAUXI.js";
6
+ } from "./chunk-RXPYUFJR.js";
7
7
  import {
8
8
  previewMigrationRestore,
9
9
  previewSnapshotRestore,
10
10
  restoreFromMigrations,
11
11
  restoreFromSnapshot
12
- } from "./chunk-KBZUTGGF.js";
12
+ } from "./chunk-VEXHBRNW.js";
13
13
  import {
14
14
  backup,
15
15
  listMigrationFiles,
16
16
  loadMigrations
17
- } from "./chunk-4TBYWXUK.js";
18
- import "./chunk-CRUFF6K5.js";
19
- import "./chunk-YQLVRHJA.js";
20
- import "./chunk-HWRRFF55.js";
17
+ } from "./chunk-3XQHSJOJ.js";
18
+ import "./chunk-Z3SB66RS.js";
19
+ import "./chunk-NCMERJNX.js";
20
+ import "./chunk-HZ2FKMY3.js";
21
21
  import {
22
22
  renderDetailed,
23
23
  renderSummary
24
- } from "./chunk-EB6PCOIL.js";
24
+ } from "./chunk-HKG4KGDV.js";
25
25
  import {
26
26
  CheckRegistry,
27
27
  computeScore,
28
28
  createDefaultRegistry,
29
29
  scan,
30
30
  summarize
31
- } from "./chunk-EGXQ37PA.js";
31
+ } from "./chunk-PSSMJRMM.js";
32
32
  import {
33
33
  CHECK_META,
34
34
  CHECK_NAMES,
35
35
  promote
36
- } from "./chunk-WNZCOYOK.js";
36
+ } from "./chunk-C7VBY54T.js";
37
37
  import {
38
38
  BRANCH_DB_PREFIX,
39
39
  branchDbName,
@@ -42,17 +42,17 @@ import {
42
42
  listBranches,
43
43
  loadManifest,
44
44
  replaceDbName
45
- } from "./chunk-2XMRTAFX.js";
45
+ } from "./chunk-S2GQI7ZO.js";
46
46
  import {
47
47
  captureSnapshot,
48
48
  findLatestSnapshot,
49
49
  listSnapshots,
50
50
  loadSnapshot
51
- } from "./chunk-3SEVACCT.js";
52
- import "./chunk-YYS4FJ23.js";
51
+ } from "./chunk-X4L3JT4R.js";
52
+ import "./chunk-AMG4PVQS.js";
53
53
  import {
54
54
  Check
55
- } from "./chunk-RC7ZU7OV.js";
55
+ } from "./chunk-W42J6U7R.js";
56
56
  import {
57
57
  loadConfig,
58
58
  resolveConfig,
package/package.json CHANGED
@@ -1,8 +1,28 @@
1
1
  {
2
2
  "name": "@akal/supaforge",
3
- "version": "0.0.47",
3
+ "version": "0.0.48",
4
4
  "mcpName": "io.github.akalsoftware/supaforge",
5
- "description": "Diff and sync your Supabase environments",
5
+ "description": "Diff, sync and clone Supabase and Postgres environments - schema, data, RLS, grants, storage, auth, Edge Functions, cron and more - and prove every change before it reaches production",
6
+ "keywords": [
7
+ "supabase",
8
+ "postgres",
9
+ "postgresql",
10
+ "database",
11
+ "schema-diff",
12
+ "data-diff",
13
+ "migrations",
14
+ "database-migrations",
15
+ "drift-detection",
16
+ "rls",
17
+ "row-level-security",
18
+ "sync",
19
+ "clone",
20
+ "snapshot",
21
+ "cli",
22
+ "mcp",
23
+ "mcp-server",
24
+ "ai-agents"
25
+ ],
6
26
  "author": "Akal Software Ltd",
7
27
  "license": "MIT",
8
28
  "repository": {
@@ -56,7 +76,7 @@
56
76
  },
57
77
  "dependencies": {
58
78
  "@akal/pg-conformance": "~0.0.19",
59
- "@dbdiff/cli": "3.0.0-rc.39",
79
+ "@dbdiff/cli": "3.0.0-rc.40",
60
80
  "@modelcontextprotocol/sdk": "^1.32.1",
61
81
  "@oclif/core": "^5.1.12",
62
82
  "@supabase/supabase-js": "^2.103.0",