@rebasepro/cli 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Detect Postgres connection strings that libpq refuses to parse.
3
+ *
4
+ * libpq splits a URI query parameter on the FIRST `=` and rejects any further
5
+ * one in the same parameter:
6
+ *
7
+ * extra key/value separator "=" in URI query parameter: "options"
8
+ *
9
+ * That makes a URL like
10
+ *
11
+ * postgresql://u:p@h:5432/db?options=-c%20search_path=public&sslmode=disable
12
+ *
13
+ * unusable by every libpq caller — `pg_dump`/`pg_restore` behind
14
+ * `rebase db backup|restore`, and a plain `psql "$DATABASE_URL"`. It is not a
15
+ * version quirk: Postgres 15 through 18 all refuse it.
16
+ *
17
+ * `rebase init` generated exactly that string until 2026-08-18, and the failure
18
+ * is invisible day to day because node-postgres parses URLs itself and accepts
19
+ * it — so `rebase dev` and `rebase db push` work while backups do not. Fixing
20
+ * the generator does nothing for projects that already exist, which is what
21
+ * these functions are for: `rebase doctor` reads them off disk and reports.
22
+ */
23
+ /** A query parameter whose value carries a literal `=`. */
24
+ export interface UnparseableParam {
25
+ /** The parameter name, e.g. "options". */
26
+ name: string;
27
+ /** The raw `name=value` text as it appears in the URL. */
28
+ raw: string;
29
+ }
30
+ /**
31
+ * Return the query parameters libpq would reject, or an empty array.
32
+ *
33
+ * Deliberately not built on `new URL()`: that parser is happy to accept the
34
+ * broken form (it splits on the first `=` and keeps the rest as the value),
35
+ * so it cannot see the defect at all. The rule being checked is libpq's, and
36
+ * it is about the raw text.
37
+ */
38
+ export declare function findUnparseableParams(connectionString: string): UnparseableParam[];
39
+ /**
40
+ * Percent-encode the offending `=` characters, leaving everything else byte for
41
+ * byte as it was.
42
+ *
43
+ * Only the second and later `=` in a parameter are rewritten — the first is the
44
+ * real separator. Nothing else is touched: re-serialising through `URL` would
45
+ * also reorder parameters and turn spaces into `+`, which libpq does not decode,
46
+ * so a "tidy up" would trade one unparseable string for another.
47
+ */
48
+ export declare function encodeExtraEquals(connectionString: string): string;
49
+ /** One connection string, found somewhere on disk, that libpq cannot parse. */
50
+ export interface LibpqUrlFinding {
51
+ /** File it came from, relative to the project root. */
52
+ file: string;
53
+ /** The variable holding it, e.g. "DATABASE_URL". */
54
+ variable: string;
55
+ /** Parameter names libpq objects to. */
56
+ params: string[];
57
+ /** The same string with the offending `=` encoded. */
58
+ suggested: string;
59
+ }
60
+ /**
61
+ * Scan one file's text for connection strings libpq would reject.
62
+ *
63
+ * Handles both shapes a scaffolded project uses, because both shipped with the
64
+ * defect and a deployed stack is broken by the compose one alone:
65
+ *
66
+ * .env DATABASE_URL=postgresql://…
67
+ * docker-compose.yml DATABASE_URL: postgresql://…
68
+ */
69
+ export declare function scanTextForLibpqUrls(file: string, text: string): LibpqUrlFinding[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebasepro/cli",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Developer tools for Rebase projects",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",
@@ -31,12 +31,12 @@
31
31
  "execa": "^9.6.1",
32
32
  "inquirer": "14.0.2",
33
33
  "jiti": "^2.7.0",
34
- "@rebasepro/agent-skills": "0.15.0",
35
- "@rebasepro/client": "0.15.0",
36
- "@rebasepro/server": "0.15.0",
37
- "@rebasepro/server-postgres": "0.15.0",
38
- "@rebasepro/codegen": "0.15.0",
39
- "@rebasepro/types": "0.15.0"
34
+ "@rebasepro/agent-skills": "0.16.0",
35
+ "@rebasepro/client": "0.16.0",
36
+ "@rebasepro/codegen": "0.16.0",
37
+ "@rebasepro/server": "0.16.0",
38
+ "@rebasepro/server-postgres": "0.16.0",
39
+ "@rebasepro/types": "0.16.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "^26.1.2",
@@ -48,8 +48,8 @@ services:
48
48
  - "${PORT:-3001}:3001"
49
49
  env_file: .env
50
50
  environment:
51
- DATABASE_URL: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path=public
52
- ADMIN_CONNECTION_STRING: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path=public
51
+ DATABASE_URL: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path%3Dpublic
52
+ ADMIN_CONNECTION_STRING: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path%3Dpublic
53
53
  NODE_ENV: production
54
54
  PORT: "3001"
55
55
  # {{#frontend}}
@@ -16,10 +16,10 @@ table is never exposed just by existing — and logs each table it skipped and w
16
16
  ```sql
17
17
  ALTER TABLE your_table ENABLE ROW LEVEL SECURITY;
18
18
  CREATE POLICY your_table_owner ON your_table
19
- FOR ALL USING (user_id = auth.uid());
19
+ FOR ALL USING (user_id = rebase.uid());
20
20
  ```
21
21
 
22
- `auth.uid()`, `auth.roles()` and `auth.jwt()` are provided by Rebase and read the
22
+ `rebase.uid()`, `rebase.roles()` and `rebase.jwt()` are provided by Rebase and read the
23
23
  identity of the authenticated request.
24
24
 
25
25
  To serve unprotected tables anyway (development only), set
@@ -10,7 +10,7 @@
10
10
  # sslmode=disable matches the local docker-compose database, which has no TLS;
11
11
  # schema tooling (atlas) would otherwise default to requiring SSL. Remove it
12
12
  # when pointing at a managed/cloud database.
13
- DATABASE_URL=postgresql://rebase_app:changeme@localhost:5432/rebase?options=-c%20search_path=public&sslmode=disable
13
+ DATABASE_URL=postgresql://rebase_app:changeme@localhost:5432/rebase?options=-c%20search_path%3Dpublic&sslmode=disable
14
14
  # DATABASE_URL=mongodb://localhost:27017/rebase
15
15
  #
16
16
  # Seeing "SSL is not enabled on the server"? Something in your environment
@@ -22,7 +22,7 @@ DATABASE_URL=postgresql://rebase_app:changeme@localhost:5432/rebase?options=-c%2
22
22
  # downgrade SSL for you when you have asked for it, not even on localhost:
23
23
  # quietly ignoring a security setting is worse than a clear failure. To opt out
24
24
  # explicitly for a local database, say so:
25
- # DATABASE_URL=postgresql://rebase_app:changeme@localhost:5432/rebase?options=-c%20search_path=public&sslmode=disable
25
+ # DATABASE_URL=postgresql://rebase_app:changeme@localhost:5432/rebase?options=-c%20search_path%3Dpublic&sslmode=disable
26
26
 
27
27
  # Separate admin connection string for migrations and schema operations (optional)
28
28
  # Falls back to DATABASE_URL if not set
@@ -65,6 +65,9 @@ ALLOW_REGISTRATION=true
65
65
  # SMTP_FROM=noreply@yourapp.com
66
66
  # SMTP_NAME=
67
67
  # APP_NAME=Your App Name
68
+ # Logo atop the default email templates. Absolute http(s) PNG/JPG only —
69
+ # mail clients strip SVG and block data: URIs.
70
+ # EMAIL_LOGO_URL=https://yourapp.com/logo.png
68
71
 
69
72
  # ── URLs ──────────────────────────────────────────────────────────────────────
70
73
  # Canonical frontend URL (used in password-reset / verification emails)
@@ -75,8 +75,8 @@ services:
75
75
  ports:
76
76
  - "${PORT:-3001}:3001"
77
77
  environment:
78
- DATABASE_URL: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path=public
79
- ADMIN_CONNECTION_STRING: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path=public
78
+ DATABASE_URL: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path%3Dpublic
79
+ ADMIN_CONNECTION_STRING: postgresql://rebase_app:${DATABASE_PASSWORD:-changeme}@db:5432/rebase?options=-c%20search_path%3Dpublic
80
80
  JWT_SECRET: ${JWT_SECRET:?set JWT_SECRET in .env — `rebase init` generates one}
81
81
  REBASE_SERVICE_KEY: ${REBASE_SERVICE_KEY:?set REBASE_SERVICE_KEY in .env — `rebase init` generates one}
82
82
  NODE_ENV: production