@beignet/cli 0.0.9 → 0.0.11

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 (76) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +70 -21
  3. package/dist/choices.d.ts +32 -3
  4. package/dist/choices.d.ts.map +1 -1
  5. package/dist/choices.js +54 -3
  6. package/dist/choices.js.map +1 -1
  7. package/dist/create-prompts.d.ts +5 -4
  8. package/dist/create-prompts.d.ts.map +1 -1
  9. package/dist/create-prompts.js +22 -4
  10. package/dist/create-prompts.js.map +1 -1
  11. package/dist/create.d.ts +7 -1
  12. package/dist/create.d.ts.map +1 -1
  13. package/dist/create.js +13 -3
  14. package/dist/create.js.map +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +47 -6
  17. package/dist/index.js.map +1 -1
  18. package/dist/make.d.ts +21 -1
  19. package/dist/make.d.ts.map +1 -1
  20. package/dist/make.js +210 -37
  21. package/dist/make.js.map +1 -1
  22. package/dist/mcp.d.ts +19 -0
  23. package/dist/mcp.d.ts.map +1 -0
  24. package/dist/mcp.js +250 -0
  25. package/dist/mcp.js.map +1 -0
  26. package/dist/templates/agents.d.ts +14 -0
  27. package/dist/templates/agents.d.ts.map +1 -0
  28. package/dist/templates/agents.js +98 -0
  29. package/dist/templates/agents.js.map +1 -0
  30. package/dist/templates/base.d.ts.map +1 -1
  31. package/dist/templates/base.js +79 -9
  32. package/dist/templates/base.js.map +1 -1
  33. package/dist/templates/db/index.d.ts +21 -0
  34. package/dist/templates/db/index.d.ts.map +1 -0
  35. package/dist/templates/db/index.js +14 -0
  36. package/dist/templates/db/index.js.map +1 -0
  37. package/dist/templates/db/mysql.d.ts +4 -0
  38. package/dist/templates/db/mysql.d.ts.map +1 -0
  39. package/dist/templates/db/mysql.js +972 -0
  40. package/dist/templates/db/mysql.js.map +1 -0
  41. package/dist/templates/db/postgres.d.ts +4 -0
  42. package/dist/templates/db/postgres.d.ts.map +1 -0
  43. package/dist/templates/db/postgres.js +863 -0
  44. package/dist/templates/db/postgres.js.map +1 -0
  45. package/dist/templates/db/sqlite.d.ts +3 -0
  46. package/dist/templates/db/sqlite.d.ts.map +1 -0
  47. package/dist/templates/db/sqlite.js +878 -0
  48. package/dist/templates/db/sqlite.js.map +1 -0
  49. package/dist/templates/index.d.ts +5 -5
  50. package/dist/templates/index.d.ts.map +1 -1
  51. package/dist/templates/index.js +24 -20
  52. package/dist/templates/index.js.map +1 -1
  53. package/dist/templates/server.d.ts +3 -3
  54. package/dist/templates/server.d.ts.map +1 -1
  55. package/dist/templates/server.js +149 -97
  56. package/dist/templates/server.js.map +1 -1
  57. package/dist/templates/shared.d.ts +34 -1
  58. package/dist/templates/shared.d.ts.map +1 -1
  59. package/dist/templates/shared.js +45 -0
  60. package/dist/templates/shared.js.map +1 -1
  61. package/package.json +5 -3
  62. package/src/choices.ts +70 -3
  63. package/src/create-prompts.ts +25 -3
  64. package/src/create.ts +24 -2
  65. package/src/index.ts +58 -5
  66. package/src/make.ts +265 -34
  67. package/src/mcp.ts +367 -0
  68. package/src/templates/agents.ts +103 -0
  69. package/src/templates/base.ts +95 -9
  70. package/src/templates/db/index.ts +34 -0
  71. package/src/templates/db/mysql.ts +976 -0
  72. package/src/templates/db/postgres.ts +867 -0
  73. package/src/templates/{db.ts → db/sqlite.ts} +31 -152
  74. package/src/templates/index.ts +27 -19
  75. package/src/templates/server.ts +161 -97
  76. package/src/templates/shared.ts +90 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @beignet/cli
2
2
 
3
+ ## 0.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - 72601c8: `beignet mcp` runs a Model Context Protocol server over stdio exposing routes, doctor (with fix), lint, and the generators as structured tools, so MCP clients like Claude Code and Cursor can inspect and maintain a Beignet app directly.
8
+ - 72601c8: Generated apps now include an AGENTS.md agent guide (registration checklist, validation loop, placement rules) and a .mcp.json registering the beignet mcp server, so coding agents get the non-obvious conventions and structured tools out of the box.
9
+ - @beignet/core@0.0.11
10
+
11
+ ## 0.0.10
12
+
13
+ ### Patch Changes
14
+
15
+ - 2972ee4: `beignet create` supports `--db sqlite|postgres|mysql` (default `sqlite`), with a matching database prompt in interactive setup. Each backend scaffolds end to end: provider wiring, an idiomatic Drizzle schema, the vendored initial migration, env examples (`POSTGRES_DB_URL`, `MYSQL_DB_URL`), and a dialect-matched test database — in-memory libSQL for SQLite, in-process PGlite for Postgres, and a real server via `MYSQL_TEST_URL` for MySQL. `make resource` and `make feature` detect the app's database and generate dialect-correct schema and repository code, and `beignet db generate|migrate` work unchanged for every dialect.
16
+ - @beignet/core@0.0.10
17
+
3
18
  ## 0.0.9
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -40,23 +40,25 @@ equivalent.
40
40
 
41
41
  Running create in an interactive terminal without selection flags opens a
42
42
  prompt-based setup that asks for the project directory, whether to scaffold
43
- an API-only app, and which provider integrations to add. Passing any
44
- selection flag (`--api`, `--integrations`, or `--package-manager`) skips the
45
- prompts, and `--yes` forces the non-interactive defaults (the full-stack
46
- starter with `bun`) even on a terminal. Non-interactive runs in scripts and
47
- CI behave exactly as before.
43
+ an API-only app, which database to use, and which provider integrations to
44
+ add. Passing any selection flag (`--api`, `--db`, `--integrations`, or
45
+ `--package-manager`) skips the prompts, and `--yes` forces the
46
+ non-interactive defaults (the full-stack SQLite starter with `bun`) even on a
47
+ terminal. Non-interactive runs in scripts and CI behave exactly as before.
48
48
 
49
49
  By default the CLI creates a Next.js app with:
50
50
 
51
51
  - Contract-first todos API routes
52
52
  - Better Auth routes and Beignet auth provider wiring
53
- - Drizzle SQLite (libSQL) persistence with a local SQLite default and support for hosted libSQL (Turso)
53
+ - Drizzle persistence — SQLite (libSQL) by default, with `--db postgres` and `--db mysql` for the other backends
54
54
  - UOW, audit logging, durable idempotency, and a durable outbox drain route
55
55
  - Jobs, events, listeners, schedules, mail-backed notifications, and uploads
56
56
  - App-owned ports with provider-backed infra adapters
57
57
  - Validated application use cases
58
58
  - A Beignet server wired through Next.js route handlers
59
59
  - App error helpers, auth helpers, env validation, health checks, and devtools
60
+ - An `AGENTS.md` agent guide and a `.mcp.json` that registers the
61
+ `beignet mcp` server for MCP clients such as Claude Code
60
62
  - A typed client
61
63
  - TanStack Query
62
64
  - React Hook Form
@@ -67,9 +69,9 @@ persistence, and devtools, and swaps the UI shell for a minimal API landing
67
69
  page and a reduced typed client.
68
70
 
69
71
  The starter ships local production-shaped defaults: Better Auth, Drizzle
70
- SQLite (libSQL) persistence, pino logging, UOW, durable idempotency, a
71
- durable outbox, audit logging, and devtools. Add external service
72
- integrations only when you want those providers:
72
+ persistence, pino logging, UOW, durable idempotency, a durable outbox, audit
73
+ logging, and devtools. Add external service integrations only when you want
74
+ those providers:
73
75
 
74
76
  ```bash
75
77
  bunx @beignet/cli create my-app --integrations inngest,resend
@@ -86,14 +88,27 @@ Each selected integration adds its provider package dependencies, wires the
86
88
  provider in `server/providers.ts`, extends `.env.example`, and writes setup
87
89
  notes to `docs/integrations.md`.
88
90
 
89
- Drizzle SQLite (libSQL) ships in every starter. The scaffold includes
90
- `infra/db/schema/`, `infra/db/repositories.ts`, `infra/db/test-database.ts`,
91
- SQL-backed idempotency and outbox tables, a Drizzle todo repository adapter,
92
- `drizzle.config.ts`, checked-in starter migrations, database scripts, and
93
- `SQLITE_*` env examples, so the generated todo resource uses durable
94
- persistence instead of an in-memory repository. Later `make feature` or
95
- `make resource` calls in that app generate both a Drizzle table/repository
96
- and an in-memory test fake.
91
+ Drizzle persistence ships in every starter; pick the backend with `--db`
92
+ (default `sqlite`):
93
+
94
+ ```bash
95
+ bunx @beignet/cli create my-app --db postgres
96
+ ```
97
+
98
+ `--db` accepts `sqlite` (libSQL, local files plus hosted libSQL/Turso),
99
+ `postgres` (node-postgres, requires a running Postgres 14+ server), and
100
+ `mysql` (`mysql2`, requires MySQL 8.0+). Every backend scaffolds the same
101
+ structure: `infra/db/schema/`, `infra/db/repositories.ts`,
102
+ `infra/db/test-database.ts`, SQL-backed idempotency and outbox tables, a
103
+ Drizzle todo repository adapter, `drizzle.config.ts` with the matching
104
+ dialect, checked-in starter migrations, database scripts, and env examples
105
+ (`SQLITE_*`, `POSTGRES_DB_URL`, or `MYSQL_DB_URL`), so the generated todo
106
+ resource uses durable persistence instead of an in-memory repository.
107
+ Postgres starters run repository tests against in-process PGlite with no
108
+ server; MySQL persistence tests need a real server via `MYSQL_TEST_URL`.
109
+ Later `make feature` or `make resource` calls detect the app's backend from
110
+ `infra/db/repositories.ts` and generate a dialect-correct Drizzle
111
+ table/repository plus an in-memory test fake.
97
112
 
98
113
  Better Auth also ships in every starter. The scaffold adds the Better Auth
99
114
  Next.js route, Beignet auth provider wiring, typed `UNAUTHORIZED` and
@@ -169,13 +184,15 @@ beignet db reset [--dry-run] [--json]
169
184
  beignet routes [--json] [--cwd <dir>]
170
185
  beignet lint [--json] [--cwd <dir>] [--format human|json|github]
171
186
  beignet doctor [--json] [--strict] [--fix] [--cwd <dir>] [--format human|json|github]
172
- beignet completion install [--shell bash|zsh]
173
- beignet completion uninstall [--shell bash|zsh]
187
+ beignet mcp
188
+ beignet completion install [--shell bash|zsh] [--json]
189
+ beignet completion uninstall [--shell bash|zsh] [--json]
174
190
  beignet --version
175
191
 
176
192
  Options:
177
193
  --template next Template to use. Currently only `next`.
178
194
  --api Scaffold an API-only app without the UI shell.
195
+ --db postgres Database backend: sqlite (default), postgres, or mysql.
179
196
  --package-manager bun Package manager shown in next steps.
180
197
  --integrations inngest,resend Add integrations: inngest, resend, upstash-rate-limit. Accepts one value or a comma-separated list.
181
198
  --yes Skip interactive create prompts and use the defaults.
@@ -188,6 +205,7 @@ Options:
188
205
  --payload '{"date":"..."}' JSON payload for `beignet schedule run`.
189
206
  --module server/tasks.ts Override the task, outbox, or schedule registry path.
190
207
  --batch-size 100 Maximum outbox messages to claim in one drain pass.
208
+ --id run_123 Provider or app schedule run ID for schedule runs.
191
209
  --scheduled-at 2026-01-01 Provider scheduled timestamp for schedule runs.
192
210
  --triggered-at 2026-01-01 Trigger timestamp for schedule runs.
193
211
  --attempt 1 One-based provider attempt number for schedule runs.
@@ -666,8 +684,10 @@ package script to restore.
666
684
  `db reset` is intentionally app-owned because destructive behavior depends on
667
685
  the environment. The standard starter refuses to reset non-local database URLs
668
686
  unless `BEIGNET_ALLOW_DATABASE_RESET=true` is set. Drizzle starters also include
669
- `infra/db/test-database.ts`, which creates an isolated local libSQL database for
670
- repository and persistence tests.
687
+ `infra/db/test-database.ts`, which creates an isolated test database for
688
+ repository and persistence tests: an in-memory libSQL database for SQLite, an
689
+ in-process PGlite database for Postgres, or a real server via `MYSQL_TEST_URL`
690
+ for MySQL.
671
691
 
672
692
  Generate feature-owned test factories and local/demo seeds with:
673
693
 
@@ -833,6 +853,35 @@ artifacts are already registered individually, the fix bails out and the
833
853
  diagnostic stays. Listener registration is report-only because apps own their
834
854
  event-bus wiring.
835
855
 
856
+ ## MCP server for coding agents
857
+
858
+ Run an MCP (Model Context Protocol) server over stdio so coding agents can
859
+ call the CLI as tools:
860
+
861
+ ```bash
862
+ beignet mcp
863
+ ```
864
+
865
+ The server exposes five tools:
866
+
867
+ - `routes` - list app routes and contracts (read-only)
868
+ - `doctor` - drift diagnostics as JSON, `{ strict?: boolean }` defaults to
869
+ `true` (read-only)
870
+ - `doctor_fix` - apply doctor's low-risk fixes; repairs route-group,
871
+ schedule, task, and outbox registration drift, while listener drift stays
872
+ report-only
873
+ - `lint` - architecture dependency-direction diagnostics (read-only)
874
+ - `make` - run a generator with `{ artifact, name, ...options }`, the same
875
+ artifact kinds as `beignet make`
876
+
877
+ Tool outputs match the JSON the matching `--json` flags print. Generated apps
878
+ ship a `.mcp.json` that registers the server through the app's package runner
879
+ (`bunx` in bun apps, `npx` in npm, pnpm, and yarn apps), so Claude Code picks
880
+ it up with no configuration; Cursor and VS Code users add the same command to
881
+ `.cursor/mcp.json` or `.vscode/mcp.json`. Generated apps also include an
882
+ `AGENTS.md` covering registration, generator, placement, and validation
883
+ conventions.
884
+
836
885
  ## License
837
886
 
838
887
  MIT
package/dist/choices.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Choice lists and string-literal types shared by the CLI entrypoint and the
3
- * heavier scaffold/generator modules. Keeping them here lets the bin define
4
- * flag enums without loading templates or generators at startup.
2
+ * Choice lists, string-literal types, and small pure helpers shared by the
3
+ * CLI entrypoint and the heavier scaffold/generator modules. Keeping them
4
+ * here lets the bin define flag enums and next steps without loading
5
+ * templates or generators at startup.
5
6
  */
6
7
  /**
7
8
  * Package managers supported by the app template generator.
@@ -18,6 +19,10 @@ export type TemplateName = "next";
18
19
  * integrations that add an external service remain selectable.
19
20
  */
20
21
  export type IntegrationName = "inngest" | "resend" | "upstash-rate-limit";
22
+ /**
23
+ * Databases supported by the starter's Drizzle persistence layer.
24
+ */
25
+ export type DatabaseName = "sqlite" | "postgres" | "mysql";
21
26
  /**
22
27
  * Supported scaffold template choices.
23
28
  */
@@ -30,6 +35,30 @@ export declare const packageManagerChoices: readonly ["bun", "npm", "pnpm", "yar
30
35
  * Supported scaffold integration choices.
31
36
  */
32
37
  export declare const integrationChoices: readonly ["inngest", "resend", "upstash-rate-limit"];
38
+ /**
39
+ * Supported scaffold database choices.
40
+ */
41
+ export declare const databaseChoices: readonly ["sqlite", "postgres", "mysql"];
42
+ /**
43
+ * Local database name derived from the app name.
44
+ *
45
+ * Postgres and MySQL database identifiers are stricter than project names,
46
+ * so dashes and dots become underscores. Used by `.env.example`, the
47
+ * generated drizzle config, and the create command's next steps, which must
48
+ * all point at the same local database.
49
+ */
50
+ export declare function databaseLocalName(appName: string): string;
51
+ /**
52
+ * Docker one-liner that starts a local database matching the generated
53
+ * `.env.example` connection URL. Returns undefined for SQLite, which needs
54
+ * no server.
55
+ */
56
+ export declare function databaseStartCommand(database: DatabaseName, appName: string): string | undefined;
57
+ /**
58
+ * Local development connection URL matching `databaseStartCommand`.
59
+ * Used as the `.env.example` value and the generated env defaults.
60
+ */
61
+ export declare function databaseLocalUrl(database: DatabaseName, appName: string): string;
33
62
  /**
34
63
  * Shells supported by `beignet completion install` and `uninstall`.
35
64
  */
@@ -1 +1 @@
1
- {"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,eAAe,mBAEgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,yCAKY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAIgB,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAGY,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,oIAa1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"choices.d.ts","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,oBAAoB,CAAC;AAC1E;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAE3D;;GAEG;AACH,eAAO,MAAM,eAAe,mBAEgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,qBAAqB,yCAKY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,sDAIgB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,eAAe,0CAIgB,CAAC;AAE7C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAWpB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,MAAM,GACd,MAAM,CAWR;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,sBAAsB,0BAGY,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,uBAAuB,oIAa1B,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/choices.js CHANGED
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Choice lists and string-literal types shared by the CLI entrypoint and the
3
- * heavier scaffold/generator modules. Keeping them here lets the bin define
4
- * flag enums without loading templates or generators at startup.
2
+ * Choice lists, string-literal types, and small pure helpers shared by the
3
+ * CLI entrypoint and the heavier scaffold/generator modules. Keeping them
4
+ * here lets the bin define flag enums and next steps without loading
5
+ * templates or generators at startup.
5
6
  */
6
7
  /**
7
8
  * Supported scaffold template choices.
@@ -26,6 +27,56 @@ export const integrationChoices = [
26
27
  "resend",
27
28
  "upstash-rate-limit",
28
29
  ];
30
+ /**
31
+ * Supported scaffold database choices.
32
+ */
33
+ export const databaseChoices = [
34
+ "sqlite",
35
+ "postgres",
36
+ "mysql",
37
+ ];
38
+ /**
39
+ * Local database name derived from the app name.
40
+ *
41
+ * Postgres and MySQL database identifiers are stricter than project names,
42
+ * so dashes and dots become underscores. Used by `.env.example`, the
43
+ * generated drizzle config, and the create command's next steps, which must
44
+ * all point at the same local database.
45
+ */
46
+ export function databaseLocalName(appName) {
47
+ return appName.replaceAll(/[^a-z0-9_]/g, "_");
48
+ }
49
+ /**
50
+ * Docker one-liner that starts a local database matching the generated
51
+ * `.env.example` connection URL. Returns undefined for SQLite, which needs
52
+ * no server.
53
+ */
54
+ export function databaseStartCommand(database, appName) {
55
+ const databaseName = databaseLocalName(appName);
56
+ switch (database) {
57
+ case "postgres":
58
+ return `docker run --rm -d -e POSTGRES_USER=beignet -e POSTGRES_PASSWORD=beignet -e POSTGRES_DB=${databaseName} -p 5432:5432 postgres:17-alpine`;
59
+ case "mysql":
60
+ return `docker run --rm -d -e MYSQL_ROOT_PASSWORD=beignet -e MYSQL_DATABASE=${databaseName} -p 3306:3306 mysql:8.4`;
61
+ default:
62
+ return undefined;
63
+ }
64
+ }
65
+ /**
66
+ * Local development connection URL matching `databaseStartCommand`.
67
+ * Used as the `.env.example` value and the generated env defaults.
68
+ */
69
+ export function databaseLocalUrl(database, appName) {
70
+ const databaseName = databaseLocalName(appName);
71
+ switch (database) {
72
+ case "postgres":
73
+ return `postgres://beignet:beignet@127.0.0.1:5432/${databaseName}`;
74
+ case "mysql":
75
+ return `mysql://root:beignet@127.0.0.1:3306/${databaseName}`;
76
+ default:
77
+ return "file:local.db";
78
+ }
79
+ }
29
80
  /**
30
81
  * Supported completion shell choices.
31
82
  */
@@ -1 +1 @@
1
- {"version":3,"file":"choices.js","sourceRoot":"","sources":["../src/choices.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,MAAM;CACoC,CAAC;AAE7C;;GAEG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CAAC;QACjB,KAAK,UAAU;YACb,OAAO,2FAA2F,YAAY,kCAAkC,CAAC;QACnJ,KAAK,OAAO;YACV,OAAO,uEAAuE,YAAY,yBAAyB,CAAC;QACtH;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAsB,EACtB,OAAe;IAEf,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEhD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,UAAU;YACb,OAAO,6CAA6C,YAAY,EAAE,CAAC;QACrE,KAAK,OAAO;YACV,OAAO,uCAAuC,YAAY,EAAE,CAAC;QAC/D;YACE,OAAO,eAAe,CAAC;IAC3B,CAAC;AACH,CAAC;AAOD;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,MAAM;IACN,KAAK;CACwC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,KAAK;IACL,MAAM;IACN,cAAc;IACd,eAAe;IACf,MAAM;IACN,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,SAAS;CACD,CAAC"}
@@ -5,13 +5,14 @@
5
5
  * `@clack/prompts` is loaded lazily inside the prompt flow so non-interactive
6
6
  * runs and CLI startup never pay for it.
7
7
  */
8
- import { type IntegrationName, type PackageManager } from "./choices.js";
8
+ import { type DatabaseName, type IntegrationName, type PackageManager } from "./choices.js";
9
9
  /**
10
10
  * Selections shared by create flags and interactive prompt answers.
11
11
  */
12
12
  export type CreateSelections = {
13
13
  directory?: string;
14
14
  api?: boolean;
15
+ db?: DatabaseName;
15
16
  integrations?: readonly IntegrationName[];
16
17
  packageManager?: PackageManager;
17
18
  };
@@ -26,9 +27,9 @@ type CreatePromptTty = {
26
27
  * Decide whether `beignet create` should run the interactive prompt flow.
27
28
  *
28
29
  * Prompts run only on a full TTY, only when `--yes` is absent, and only when
29
- * no selection flag was passed. Any explicit api, integration, or package
30
- * manager selection means the invocation is scripted, so the non-interactive
31
- * path stays byte-identical for agents and CI.
30
+ * no selection flag was passed. Any explicit api, database, integration, or
31
+ * package manager selection means the invocation is scripted, so the
32
+ * non-interactive path stays byte-identical for agents and CI.
32
33
  */
33
34
  export declare function shouldPromptInteractively(flags: CreatePromptFlags, tty: CreatePromptTty): boolean;
34
35
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"create-prompts.d.ts","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC1C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,iBAAiB,GAAG,gBAAgB,GAAG;IAC1C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAUT;AAQD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CA4CvC"}
1
+ {"version":3,"file":"create-prompts.d.ts","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC1C,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,iBAAiB,GAAG,gBAAgB,GAAG;IAC1C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,eAAe,GACnB,OAAO,CAWT;AAcD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAwDvC"}
@@ -5,14 +5,14 @@
5
5
  * `@clack/prompts` is loaded lazily inside the prompt flow so non-interactive
6
6
  * runs and CLI startup never pay for it.
7
7
  */
8
- import { integrationChoices, } from "./choices.js";
8
+ import { databaseChoices, integrationChoices, } from "./choices.js";
9
9
  /**
10
10
  * Decide whether `beignet create` should run the interactive prompt flow.
11
11
  *
12
12
  * Prompts run only on a full TTY, only when `--yes` is absent, and only when
13
- * no selection flag was passed. Any explicit api, integration, or package
14
- * manager selection means the invocation is scripted, so the non-interactive
15
- * path stays byte-identical for agents and CI.
13
+ * no selection flag was passed. Any explicit api, database, integration, or
14
+ * package manager selection means the invocation is scripted, so the
15
+ * non-interactive path stays byte-identical for agents and CI.
16
16
  */
17
17
  export function shouldPromptInteractively(flags, tty) {
18
18
  if (!tty.stdin || !tty.stdout)
@@ -20,6 +20,7 @@ export function shouldPromptInteractively(flags, tty) {
20
20
  if (flags.yes)
21
21
  return false;
22
22
  const selectionFlagPassed = flags.api !== undefined ||
23
+ flags.db !== undefined ||
23
24
  (flags.integrations?.length ?? 0) > 0 ||
24
25
  flags.packageManager !== undefined;
25
26
  return !selectionFlagPassed;
@@ -29,6 +30,11 @@ const integrationHints = {
29
30
  resend: "Resend-backed mail provider",
30
31
  "upstash-rate-limit": "Upstash-backed rate limiting",
31
32
  };
33
+ const databaseHints = {
34
+ sqlite: "libSQL/Turso, zero setup — default",
35
+ postgres: "node-postgres, requires a Postgres 14+ server",
36
+ mysql: "mysql2, requires MySQL 8.0+",
37
+ };
32
38
  /**
33
39
  * Run the interactive `beignet create` prompt flow.
34
40
  *
@@ -56,6 +62,17 @@ export async function promptCreateSelections(initial) {
56
62
  });
57
63
  if (prompts.isCancel(api))
58
64
  return undefined;
65
+ const db = await prompts.select({
66
+ message: "Which database?",
67
+ options: databaseChoices.map((database) => ({
68
+ value: database,
69
+ label: database,
70
+ hint: databaseHints[database],
71
+ })),
72
+ initialValue: initial.db ?? "sqlite",
73
+ });
74
+ if (prompts.isCancel(db))
75
+ return undefined;
59
76
  const integrations = await prompts.multiselect({
60
77
  message: "Add provider integrations? (press enter to skip)",
61
78
  options: integrationChoices.map((integration) => ({
@@ -71,6 +88,7 @@ export async function promptCreateSelections(initial) {
71
88
  return {
72
89
  directory,
73
90
  api,
91
+ db,
74
92
  integrations,
75
93
  packageManager: initial.packageManager,
76
94
  };
@@ -1 +1 @@
1
- {"version":3,"file":"create-prompts.js","sourceRoot":"","sources":["../src/create-prompts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,kBAAkB,GAEnB,MAAM,cAAc,CAAC;AAqBtB;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAwB,EACxB,GAAoB;IAEpB,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC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AC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC1C,KAAK,EAAE,QAAQ;YACf,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC;SAC9B,CAAC,CAAC;QACH,YAAY,EAAE,OAAO,CAAC,EAAE,IAAI,QAAQ;KACrC,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAE3C,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,WAAW,CAAkB;QAC9D,OAAO,EAAE,kDAAkD;QAC3D,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAChD,KAAK,EAAE,WAAW;YAClB,KAAK,EAAE,WAAW;YAClB,IAAI,EAAE,gBAAgB,CAAC,WAAW,CAAC;SACpC,CAAC,CAAC;QACH,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,SAAS,CAAC;IAErD,OAAO,CAAC,KAAK,CAAC,YAAY,SAAS,EAAE,CAAC,CAAC;IAEvC,OAAO;QACL,SAAS;QACT,GAAG;QACH,EAAE;QACF,YAAY;QACZ,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;AACJ,CAAC"}
package/dist/create.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type IntegrationName, type PackageManager, type TemplateName } from "./templates/index.js";
1
+ import { type DatabaseName, type IntegrationName, type PackageManager, type TemplateName } from "./templates/index.js";
2
2
  /**
3
3
  * Options for creating a new Beignet app.
4
4
  */
@@ -12,6 +12,11 @@ export type CreateOptions = {
12
12
  api?: boolean;
13
13
  packageManager?: PackageManager;
14
14
  integrations?: IntegrationName[];
15
+ /**
16
+ * Database backing the starter's Drizzle persistence layer.
17
+ * Defaults to "sqlite".
18
+ */
19
+ db?: DatabaseName;
15
20
  force?: boolean;
16
21
  dryRun?: boolean;
17
22
  beignetVersion?: string;
@@ -26,6 +31,7 @@ export type CreateResult = {
26
31
  dryRun: boolean;
27
32
  files: string[];
28
33
  packageManager: PackageManager;
34
+ database: DatabaseName;
29
35
  };
30
36
  /**
31
37
  * Create a Beignet app from the starter template.
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CA6CvB"}
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAG9B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;IACjC;;;OAGG;IACH,EAAE,CAAC,EAAE,YAAY,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,CAAC,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAsDvB"}
package/dist/create.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { mkdir, readdir, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { getTemplateFiles, integrationChoices, } from "./templates/index.js";
3
+ import { databaseChoices, getTemplateFiles, integrationChoices, } from "./templates/index.js";
4
4
  import { getCliVersion } from "./version.js";
5
5
  /**
6
6
  * Create a Beignet app from the starter template.
@@ -13,9 +13,13 @@ export async function createProject(options) {
13
13
  const template = options.template ?? "next";
14
14
  const api = Boolean(options.api);
15
15
  const integrations = resolveIntegrations(options.integrations ?? []);
16
+ const database = options.db ?? "sqlite";
16
17
  if (template !== "next") {
17
18
  throw new Error(`Unknown template "${template}". Available templates: next`);
18
19
  }
20
+ if (!databaseChoices.includes(database)) {
21
+ throw new Error(`Unknown database "${database}". Available databases: ${databaseChoices.join(", ")}`);
22
+ }
19
23
  const dryRun = Boolean(options.dryRun);
20
24
  await assertCanWrite(targetDir, Boolean(options.force));
21
25
  const files = getTemplateFiles({
@@ -24,6 +28,7 @@ export async function createProject(options) {
24
28
  beignetVersion: options.beignetVersion ?? getDefaultBeignetVersion(),
25
29
  api,
26
30
  integrations,
31
+ database,
27
32
  });
28
33
  if (!dryRun) {
29
34
  await mkdir(targetDir, { recursive: true });
@@ -40,6 +45,7 @@ export async function createProject(options) {
40
45
  dryRun,
41
46
  files: files.map((file) => file.path),
42
47
  packageManager,
48
+ database,
43
49
  };
44
50
  }
45
51
  /**
@@ -49,8 +55,12 @@ export async function createProject(options) {
49
55
  const baseProviderNames = new Set(["better-auth", "drizzle-sqlite", "pino"]);
50
56
  function resolveIntegrations(explicitIntegrations) {
51
57
  for (const integration of explicitIntegrations) {
52
- if (baseProviderNames.has(integration)) {
53
- throw new Error(`${integration} is part of every Beignet starter and no longer an --integrations choice.`);
58
+ const integrationName = integration;
59
+ if (baseProviderNames.has(integrationName)) {
60
+ const databaseHint = integrationName === "drizzle-sqlite"
61
+ ? " Choose the starter database with --db sqlite|postgres|mysql instead."
62
+ : "";
63
+ throw new Error(`${integration} is part of every Beignet starter and no longer an --integrations choice.${databaseHint}`);
54
64
  }
55
65
  }
56
66
  const integrations = new Set(explicitIntegrations);
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAEhB,kBAAkB,GAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MA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ED,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,IAAI;SACR,QAAQ,CAAC,OAAO,CAAC;SACjB,WAAW,EAAE;SACb,UAAU,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,SAAiB,EACjB,KAAc;IAEd,IAAI,OAAiB,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,aAAa,SAAS,8CAA8C,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAIL,KAAK,cAAc,EAInB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAiBvB,KAAK,UAAU,GAAG,cAAc,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC,CAAC;AA86CF,wBAAsB,IAAI,CACxB,MAAM,WAAwB,EAC9B,OAAO,GAAE,4BAA4B,CAAC,UAAU,CAAe,GAC9D,OAAO,CAAC,IAAI,CAAC,CAiBf"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAIL,KAAK,cAAc,EAInB,KAAK,4BAA4B,EACjC,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AAoBvB,KAAK,UAAU,GAAG,cAAc,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC,CAAC;AAg+CF,wBAAsB,IAAI,CACxB,MAAM,WAAwB,EAC9B,OAAO,GAAE,4BAA4B,CAAC,UAAU,CAAe,GAC9D,OAAO,CAAC,IAAI,CAAC,CAiBf"}