create-smoodly-app 0.0.2 → 0.0.3

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.
package/README.md CHANGED
@@ -14,9 +14,13 @@ sign in. Spec: `docs/superpowers/specs/2026-09-04-create-smoodly-app-design.md`.
14
14
  another project holds the default `543xx` ports the new one moves to the
15
15
  next free block, `553xx` and so on, and says so) or a
16
16
  **hosted project** (URL, publishable key, secret key; then an offer to
17
- `supabase link` + `supabase db push`).
17
+ `supabase link --project-ref <ref>` + `supabase db push`, the ref taken
18
+ from the URL so the CLI never opens its project picker).
18
19
  3. The first editor: pick an existing Auth user or create one (email +
19
20
  password). The `editors` row is written with role `owner`.
21
+ If `@` does not appear when you type it (macOS, `@` on Option+2 with the
22
+ terminal's "Option as Meta" setting on), paste the address or pass
23
+ `--editor-email`.
20
24
 
21
25
  Every prompt has a flag, so CI can run it: `--supabase local|hosted`, `--url`,
22
26
  `--publishable-key`, `--secret-key`, `--editor-email` (password from
@@ -40,6 +44,18 @@ The CLI has no runtime dependency on `smoodly`.
40
44
  npm test # unit tests (template build, planner, runner, editor)
41
45
  npm run build # template + esbuild bundle → dist/index.js
42
46
 
47
+ ## Follow-ups (logged 2026-09-05)
48
+
49
+ - Text prompts drop `@` when the terminal sends Option as Meta (macOS,
50
+ Finnish/Nordic layouts put `@` on Option+2): the terminal emits `ESC 2` and
51
+ Node's readline discards meta-keys, so nothing reaches the prompt.
52
+ Reproduced against `@clack/prompts` 1.7.0 with a scripted stdin. Not
53
+ fixable from prompt options; documented under "What it asks" with the
54
+ paste / `--editor-email` workaround. Revisit if clack exposes a key hook.
55
+ - Fresh installs printed a `NOTICE ... does not exist, skipping` for every
56
+ `drop trigger/policy if exists` in the migration (fixed 2026-09-05: the
57
+ migration opens with `set client_min_messages = warning`).
58
+
43
59
  ## Follow-ups (logged 2026-09-04)
44
60
 
45
61
  - The port probe binds `0.0.0.0` (a loopback-only bind coexists with a Docker-published port on macOS), so macOS may prompt once to allow `node` incoming connections during local mode; either answer is fine.
@@ -47,22 +63,32 @@ The CLI has no runtime dependency on `smoodly`.
47
63
  but does not quote arguments, so a project name or path containing a space
48
64
  or `&` breaks. Quote the args when the shell is on, or resolve the `.cmd`
49
65
  path and drop `shell`. Untested on Windows.
50
- - Hosted mode has not been run against a real hosted Supabase project with a
51
- new-format `sb_secret_` key; CI and the local smoke run both use legacy JWT
52
- keys. One manual run before the first customer install.
66
+ - Hosted mode, manual run against a real hosted project with new-format keys
67
+ (done 2026-09-05, throwaway project, `sb_secret_` + `sb_publishable_`):
68
+ `db push` of the template migration printed no NOTICE, the CLI listed and
69
+ created the first editor through the GoTrue admin API with the secret key
70
+ as the sole `apikey`, the `editors` row landed with role `owner`, `next
71
+ build` passed, `/admin` served the shell, and a password sign-in with the
72
+ publishable key returned a session. Caveat: the link step ran by hand with
73
+ an explicit `--project-ref` (see the next-but-one item); the CLI's own
74
+ `supabase link` was not driven interactively.
75
+ - Supabase CLI 2.78.1 prints `sb_secret_` keys masked (middle dots) from
76
+ `supabase projects api-keys`; 2.116.0 needs `--reveal`. A user who copies
77
+ the key from the CLI rather than the dashboard gets "Invalid API key" at
78
+ the editor step. Worth a hint in the "Finish by hand" text.
53
79
  - `listUsers` reads one page of 200 Auth users when offering an existing user
54
80
  to make the first editor. Fine for a fresh project, wrong for a populated one.
55
- - `supabase link` runs without `--project-ref`, so the CLI re-asks for the
56
- project even though it is derivable from the URL already typed.
81
+ - `supabase link` ran without `--project-ref`, so the CLI opened the
82
+ project picker, which preselects the account's first project; `db push`
83
+ follows the link, so one Enter would push Smoodly's schema into whichever
84
+ project sorts first (seen 2026-09-05 during the hosted run, caught before
85
+ the push). Fixed 2026-09-05: `projectRef` (src/env.ts) takes the ref from
86
+ the typed URL's first host label and the link step and every fallback
87
+ line pass it; a custom domain yields no ref and falls back to the picker.
57
88
  - The `--yes` flag defaults to local mode; with the Supabase CLI absent that
58
89
  stops with the install message rather than falling through to hosted.
59
90
  - Captured `exec` output is stdout only; stderr streams straight through, so
60
91
  `git init` hints and the Supabase CLI's update notice appear between the
61
92
  prompt lines.
62
- - CI never runs local mode, and never applies the template's migration to a
63
- fresh database: the e2e uses hosted mode against a stack whose schema came
64
- from the repo's own migration. Add a local-mode e2e step — the runner's stack
65
- uses ports 643xx and a fresh `supabase init` defaults to 543xx, so both can
66
- run at once.
67
93
  - The "Local" option is still offered in the select when the Supabase CLI is
68
94
  absent, and only bails afterwards; the spec wants the check before the prompt.
package/dist/index.js CHANGED
@@ -244,6 +244,16 @@ function renderEnv(keys) {
244
244
  ""
245
245
  ].join("\n");
246
246
  }
247
+ function projectRef(url) {
248
+ let host;
249
+ try {
250
+ host = new URL(url).hostname;
251
+ } catch {
252
+ return null;
253
+ }
254
+ const m = /^([a-z0-9]{20})\.supabase\.(co|in|red)$/.exec(host);
255
+ return m ? m[1] : null;
256
+ }
247
257
 
248
258
  // src/plan.ts
249
259
  function plan(a) {
@@ -347,7 +357,7 @@ async function run(answers2, deps) {
347
357
  await sh("supabase", ["init"], { stdin: "ignore" });
348
358
  break;
349
359
  case "linkAndPush":
350
- await sh("supabase", ["link"]);
360
+ await sh("supabase", linkArgs(answers2));
351
361
  await sh("supabase", ["db", "push"]);
352
362
  break;
353
363
  case "writeEnv":
@@ -387,11 +397,11 @@ ${renderEnv(keys).split("\n").filter((l) => !l.startsWith("#")).join("\n").trimE
387
397
  case "supabaseLocal":
388
398
  return [`cd ${answers2.name} && supabase init && supabase start`, "", envLines, "", editorLines].join("\n");
389
399
  case "supabaseInit": {
390
- const commands = answers2.hosted?.linkAndPush ? [`cd ${answers2.name} && supabase init && supabase link && supabase db push`] : [`cd ${answers2.name} && supabase init`, "", "When you are ready: supabase link && supabase db push"];
400
+ const commands = answers2.hosted?.linkAndPush ? [`cd ${answers2.name} && supabase init && ${linkCommand(answers2)} && supabase db push`] : [`cd ${answers2.name} && supabase init`, "", `When you are ready: ${linkCommand(answers2)} && supabase db push`];
391
401
  return [...commands, "", envLines, "", editorLines].join("\n");
392
402
  }
393
403
  case "linkAndPush":
394
- return [`cd ${answers2.name} && supabase link && supabase db push`, "", envLines, "", editorLines].join("\n");
404
+ return [`cd ${answers2.name} && ${linkCommand(answers2)} && supabase db push`, "", envLines, "", editorLines].join("\n");
395
405
  case "writeEnv":
396
406
  return [envLines, "", editorLines].join("\n");
397
407
  case "ensureEditor":
@@ -404,6 +414,13 @@ ${renderEnv(keys).split("\n").filter((l) => !l.startsWith("#")).join("\n").trimE
404
414
  return "";
405
415
  }
406
416
  }
417
+ function linkArgs(answers2) {
418
+ const ref = answers2.hosted ? projectRef(answers2.hosted.keys.url) : null;
419
+ return ref ? ["link", "--project-ref", ref] : ["link"];
420
+ }
421
+ function linkCommand(answers2) {
422
+ return `supabase ${linkArgs(answers2).join(" ")}`;
423
+ }
407
424
 
408
425
  // src/index.ts
409
426
  var TEMPLATE_DIR = fileURLToPath(new URL("../templates/next/", import.meta.url));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-smoodly-app",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Create a Smoodly site: a fresh Next.js app with the admin mounted, a Supabase schema, an env file and a first editor.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  "react": "^19",
14
14
  "react-dom": "^19",
15
15
  "@supabase/supabase-js": "^2.113.0",
16
- "smoodly": "0.0.2"
16
+ "smoodly": "0.0.3"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "^26.4.1",
@@ -1,3 +1,5 @@
1
+ set client_min_messages = warning;
2
+
1
3
  -- The space a request acts in: the key's claim in Smoodly Cloud, the
2
4
  -- default space in self-host (service role, anon key). Policies, the
3
5
  -- insert trigger and the reorder RPC all read this ONE function.