@sdxc/kit 2026.10.16 → 2026.10.20

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 (358) hide show
  1. package/README.md +391 -20
  2. package/changelog.jsonl +1160 -1035
  3. package/config.schema.json +47 -1
  4. package/dist/author.d.ts +36 -0
  5. package/dist/author.js +107 -0
  6. package/dist/cli.js +12 -0
  7. package/dist/commands/create.js +9 -4
  8. package/dist/commands/deploy.d.ts +23 -0
  9. package/dist/commands/deploy.js +167 -0
  10. package/dist/commands/destroy.d.ts +22 -0
  11. package/dist/commands/destroy.js +92 -0
  12. package/dist/commands/doctor.d.ts +26 -0
  13. package/dist/commands/doctor.js +65 -0
  14. package/dist/commands/initializers.d.ts +16 -0
  15. package/dist/commands/initializers.js +23 -0
  16. package/dist/commands/make.d.ts +72 -6
  17. package/dist/commands/make.js +127 -19
  18. package/dist/commands/middleware.d.ts +16 -0
  19. package/dist/commands/middleware.js +21 -0
  20. package/dist/commands/models.d.ts +18 -0
  21. package/dist/commands/models.js +29 -0
  22. package/dist/commands/notes.d.ts +17 -0
  23. package/dist/commands/notes.js +27 -0
  24. package/dist/commands/routes.d.ts +25 -0
  25. package/dist/commands/routes.js +50 -0
  26. package/dist/commands/run.d.ts +18 -2
  27. package/dist/commands/run.js +35 -12
  28. package/dist/commands/scaffold.d.ts +29 -0
  29. package/dist/commands/scaffold.js +33 -0
  30. package/dist/commands/schedule.d.ts +16 -0
  31. package/dist/commands/schedule.js +21 -0
  32. package/dist/commands/stats.d.ts +16 -0
  33. package/dist/commands/stats.js +21 -0
  34. package/dist/commands/ui/update.d.ts +6 -3
  35. package/dist/commands/ui/update.js +24 -7
  36. package/dist/commands/upgrade.d.ts +3 -1
  37. package/dist/commands/upgrade.js +88 -23
  38. package/dist/config.d.ts +18 -0
  39. package/dist/config.js +28 -1
  40. package/dist/contract.d.ts +97 -3
  41. package/dist/contract.js +360 -26
  42. package/dist/create/templates.d.ts +8 -1
  43. package/dist/create/templates.js +26 -2
  44. package/dist/dependencies.d.ts +4 -1
  45. package/dist/dependencies.js +13 -1
  46. package/dist/deploy/plan.d.ts +49 -0
  47. package/dist/deploy/plan.js +68 -0
  48. package/dist/destroy.d.ts +40 -0
  49. package/dist/destroy.js +311 -0
  50. package/dist/doctor/check.d.ts +71 -0
  51. package/dist/doctor/check.js +53 -0
  52. package/dist/doctor/checks.d.ts +23 -0
  53. package/dist/doctor/checks.js +68 -0
  54. package/dist/doctor/define.d.ts +59 -0
  55. package/dist/doctor/define.js +16 -0
  56. package/dist/doctor/emails.d.ts +18 -0
  57. package/dist/doctor/emails.js +243 -0
  58. package/dist/doctor/env.d.ts +26 -0
  59. package/dist/doctor/env.js +88 -0
  60. package/dist/doctor/files.d.ts +14 -0
  61. package/dist/doctor/files.js +34 -0
  62. package/dist/doctor/fixture.d.ts +23 -0
  63. package/dist/doctor/fixture.js +46 -0
  64. package/dist/doctor/install.d.ts +17 -0
  65. package/dist/doctor/install.js +37 -0
  66. package/dist/doctor/installed.d.ts +11 -0
  67. package/dist/doctor/installed.js +79 -0
  68. package/dist/doctor/layout.d.ts +23 -0
  69. package/dist/doctor/layout.js +83 -0
  70. package/dist/doctor/migrations.d.ts +16 -0
  71. package/dist/doctor/migrations.js +96 -0
  72. package/dist/doctor/models.d.ts +13 -0
  73. package/dist/doctor/models.js +69 -0
  74. package/dist/doctor/pins.d.ts +15 -0
  75. package/dist/doctor/pins.js +79 -0
  76. package/dist/doctor/project.d.ts +58 -0
  77. package/dist/doctor/project.js +261 -0
  78. package/dist/doctor/remix.d.ts +14 -0
  79. package/dist/doctor/remix.js +44 -0
  80. package/dist/doctor/routes.d.ts +11 -0
  81. package/dist/doctor/routes.js +49 -0
  82. package/dist/doctor/typegen.d.ts +13 -0
  83. package/dist/doctor/typegen.js +57 -0
  84. package/dist/doctor/ui.d.ts +14 -0
  85. package/dist/doctor/ui.js +51 -0
  86. package/dist/init.d.ts +5 -3
  87. package/dist/init.js +15 -7
  88. package/dist/initializers.d.ts +25 -0
  89. package/dist/initializers.js +89 -0
  90. package/dist/lock.d.ts +2 -2
  91. package/dist/make/actions.d.ts +23 -0
  92. package/dist/make/actions.js +82 -0
  93. package/dist/make/declare.d.ts +32 -4
  94. package/dist/make/declare.js +405 -27
  95. package/dist/make/email.d.ts +23 -0
  96. package/dist/make/email.js +111 -0
  97. package/dist/make/from-fields.d.ts +30 -0
  98. package/dist/make/from-fields.js +162 -0
  99. package/dist/make/from-model.d.ts +39 -0
  100. package/dist/make/from-model.js +161 -0
  101. package/dist/make/generate.d.ts +16 -5
  102. package/dist/make/generate.js +43 -14
  103. package/dist/make/guard.d.ts +35 -0
  104. package/dist/make/guard.js +73 -0
  105. package/dist/make/imports.d.ts +6 -0
  106. package/dist/make/imports.js +19 -0
  107. package/dist/make/index.d.ts +47 -4
  108. package/dist/make/index.js +287 -25
  109. package/dist/make/kinds.d.ts +31 -3
  110. package/dist/make/kinds.js +82 -9
  111. package/dist/make/mount.d.ts +25 -0
  112. package/dist/make/mount.js +135 -0
  113. package/dist/make/schema-diff.d.ts +58 -0
  114. package/dist/make/schema-diff.js +609 -0
  115. package/dist/make/schema.d.ts +76 -0
  116. package/dist/make/schema.js +206 -0
  117. package/dist/make/stubs.d.ts +7 -5
  118. package/dist/make/stubs.js +16 -5
  119. package/dist/make/test.d.ts +43 -0
  120. package/dist/make/test.js +149 -0
  121. package/dist/make/trigger.d.ts +31 -0
  122. package/dist/make/trigger.js +163 -0
  123. package/dist/models.d.ts +42 -0
  124. package/dist/models.js +149 -0
  125. package/dist/notes.d.ts +28 -0
  126. package/dist/notes.js +66 -0
  127. package/dist/reference.d.ts +27 -0
  128. package/dist/reference.js +103 -0
  129. package/dist/releases.d.ts +9 -0
  130. package/dist/releases.js +29 -8
  131. package/dist/routes/chains.d.ts +34 -0
  132. package/dist/routes/chains.js +95 -0
  133. package/dist/routes/filter.d.ts +53 -0
  134. package/dist/routes/filter.js +147 -0
  135. package/dist/routes/format.d.ts +23 -0
  136. package/dist/routes/format.js +123 -0
  137. package/dist/routes/helpers.d.ts +21 -0
  138. package/dist/routes/helpers.js +165 -0
  139. package/dist/routes/index.d.ts +56 -0
  140. package/dist/routes/index.js +167 -0
  141. package/dist/routes/modules.d.ts +116 -0
  142. package/dist/routes/modules.js +235 -0
  143. package/dist/routes/parse.d.ts +161 -0
  144. package/dist/routes/parse.js +621 -0
  145. package/dist/routes/routers.d.ts +69 -0
  146. package/dist/routes/routers.js +327 -0
  147. package/dist/scaffold/fields.d.ts +129 -0
  148. package/dist/scaffold/fields.js +421 -0
  149. package/dist/scaffold/index.d.ts +37 -0
  150. package/dist/scaffold/index.js +613 -0
  151. package/dist/scaffold/render.d.ts +51 -0
  152. package/dist/scaffold/render.js +332 -0
  153. package/dist/schedule.d.ts +45 -0
  154. package/dist/schedule.js +124 -0
  155. package/dist/stats.d.ts +37 -0
  156. package/dist/stats.js +126 -0
  157. package/dist/testing.d.ts +12 -2
  158. package/dist/testing.js +22 -3
  159. package/dist/ui/commands.d.ts +10 -3
  160. package/dist/ui/commands.js +85 -15
  161. package/dist/ui/registry.d.ts +8 -8
  162. package/dist/upgrade/agents.d.ts +49 -0
  163. package/dist/upgrade/agents.js +110 -0
  164. package/dist/upgrade/changelog.d.ts +2 -2
  165. package/dist/upgrade/project.d.ts +4 -0
  166. package/dist/upgrade/project.js +11 -1
  167. package/dist/upgrade/prompt.d.ts +11 -0
  168. package/dist/upgrade/prompt.js +50 -7
  169. package/package.json +6 -4
  170. package/registry/ui/alert-dialog.json +2 -2
  171. package/registry/ui/attachment.json +2 -2
  172. package/registry/ui/calendar.json +2 -2
  173. package/registry/ui/color-picker.json +2 -2
  174. package/registry/ui/command.json +2 -2
  175. package/registry/ui/date-picker.json +2 -2
  176. package/registry/ui/date-range-picker.json +2 -2
  177. package/registry/ui/dialog.json +2 -2
  178. package/registry/ui/file-trigger.json +2 -2
  179. package/registry/ui/heading-scope.json +2 -2
  180. package/registry/ui/message-scroller.json +2 -2
  181. package/registry/ui/number-field.json +2 -2
  182. package/registry/ui/range-calendar.json +2 -2
  183. package/registry/ui/resizable.json +2 -2
  184. package/registry/ui/select.json +2 -2
  185. package/registry/ui/shared-element.json +2 -2
  186. package/stubs/command.stub +4 -0
  187. package/stubs/command.test.stub +3 -0
  188. package/stubs/controller.api.resource.stub +23 -0
  189. package/stubs/controller.api.stub +21 -0
  190. package/stubs/controller.api.test.stub +18 -0
  191. package/stubs/controller.form.stub +40 -10
  192. package/stubs/controller.form.test.stub +61 -0
  193. package/stubs/controller.resource.form.stub +67 -0
  194. package/stubs/controller.resource.stub +28 -0
  195. package/stubs/controller.stub +15 -8
  196. package/stubs/controller.test.stub +3 -0
  197. package/stubs/email.stub +15 -38
  198. package/stubs/email.test.stub +12 -7
  199. package/stubs/factory.stub +4 -1
  200. package/stubs/initializer.stub +2 -0
  201. package/stubs/initializer.test.stub +3 -0
  202. package/stubs/job.cron.stub +4 -0
  203. package/stubs/job.stub +4 -0
  204. package/stubs/job.test.stub +3 -0
  205. package/stubs/mcp.resource.stub +3 -0
  206. package/stubs/mcp.stub +3 -0
  207. package/stubs/mcp.test.stub +3 -0
  208. package/stubs/middleware.stub +6 -1
  209. package/stubs/middleware.test.stub +3 -0
  210. package/stubs/model.stub +12 -3
  211. package/stubs/model.test.stub +3 -0
  212. package/stubs/policy.test.stub +36 -7
  213. package/stubs/scaffold.api.create.stub +34 -0
  214. package/stubs/scaffold.api.create.test.stub +37 -0
  215. package/stubs/scaffold.api.destroy.stub +34 -0
  216. package/stubs/scaffold.api.destroy.test.stub +44 -0
  217. package/stubs/scaffold.api.index.stub +23 -0
  218. package/stubs/scaffold.api.index.test.stub +31 -0
  219. package/stubs/scaffold.api.show.stub +27 -0
  220. package/stubs/scaffold.api.show.test.stub +41 -0
  221. package/stubs/scaffold.api.update.stub +44 -0
  222. package/stubs/scaffold.api.update.test.stub +46 -0
  223. package/stubs/scaffold.command.create.stub +22 -0
  224. package/stubs/scaffold.command.create.test.stub +30 -0
  225. package/stubs/scaffold.command.delete.stub +20 -0
  226. package/stubs/scaffold.command.delete.test.stub +39 -0
  227. package/stubs/scaffold.command.list.stub +18 -0
  228. package/stubs/scaffold.command.list.test.stub +31 -0
  229. package/stubs/scaffold.command.show.stub +19 -0
  230. package/stubs/scaffold.command.show.test.stub +37 -0
  231. package/stubs/scaffold.controller.destroy.stub +35 -0
  232. package/stubs/scaffold.controller.destroy.test.stub +65 -0
  233. package/stubs/scaffold.controller.edit.stub +97 -0
  234. package/stubs/scaffold.controller.edit.test.stub +91 -0
  235. package/stubs/scaffold.controller.index.stub +55 -0
  236. package/stubs/scaffold.controller.index.test.stub +32 -0
  237. package/stubs/scaffold.controller.new.stub +70 -0
  238. package/stubs/scaffold.controller.new.test.stub +81 -0
  239. package/stubs/scaffold.controller.show.stub +59 -0
  240. package/stubs/scaffold.controller.show.test.stub +43 -0
  241. package/stubs/scaffold.factory.stub +16 -0
  242. package/stubs/scaffold.form.stub +75 -0
  243. package/stubs/scaffold.mcp.create.stub +24 -0
  244. package/stubs/scaffold.mcp.create.test.stub +36 -0
  245. package/stubs/scaffold.mcp.delete.stub +31 -0
  246. package/stubs/scaffold.mcp.delete.test.stub +43 -0
  247. package/stubs/scaffold.mcp.get.stub +21 -0
  248. package/stubs/scaffold.mcp.get.test.stub +31 -0
  249. package/stubs/scaffold.mcp.list.stub +23 -0
  250. package/stubs/scaffold.mcp.list.test.stub +25 -0
  251. package/stubs/scaffold.mcp.update.stub +37 -0
  252. package/stubs/scaffold.mcp.update.test.stub +40 -0
  253. package/stubs/scaffold.migration.stub +2 -0
  254. package/stubs/scaffold.model.stub +35 -0
  255. package/stubs/scaffold.model.test.stub +25 -0
  256. package/stubs/scaffold.test-database.stub +33 -0
  257. package/stubs/scaffold.test-mcp.stub +92 -0
  258. package/stubs/scaffold.validator.stub +18 -0
  259. package/stubs/scaffold.validator.test.stub +26 -0
  260. package/stubs/service.stub +4 -0
  261. package/stubs/service.test.stub +3 -0
  262. package/stubs/validator.stub +3 -0
  263. package/stubs/validator.test.stub +3 -0
  264. package/templates/app/.env.example +16 -0
  265. package/templates/app/AGENTS.md +163 -0
  266. package/templates/app/CLAUDE.md +1 -0
  267. package/templates/app/README.md +79 -37
  268. package/templates/app/app/commands/about.test.ts +1 -1
  269. package/templates/app/app/commands/console.test.ts +26 -0
  270. package/templates/app/app/commands/console.ts +19 -0
  271. package/templates/app/app/commands/db/console.ts +6 -0
  272. package/templates/app/app/commands/db/fresh.test.ts +57 -0
  273. package/templates/app/app/commands/db/fresh.ts +37 -0
  274. package/templates/app/app/commands/db/migrate.test.ts +46 -0
  275. package/templates/app/app/commands/db/migrate.ts +88 -0
  276. package/templates/app/app/commands/db/prepare.test.ts +39 -0
  277. package/templates/app/app/commands/db/prepare.ts +35 -0
  278. package/templates/app/app/commands/db/seed.test.ts +38 -0
  279. package/templates/app/app/commands/db/seed.ts +26 -0
  280. package/templates/app/app/commands/deploy.test.ts +34 -0
  281. package/templates/app/app/commands/deploy.ts +18 -0
  282. package/templates/app/app/commands/emails/preview.test.tsx +63 -0
  283. package/templates/app/app/commands/emails/preview.ts +24 -0
  284. package/templates/app/app/commands/index.ts +72 -1
  285. package/templates/app/app/commands/typegen.test.ts +17 -0
  286. package/templates/app/app/commands/typegen.ts +16 -0
  287. package/templates/app/app/emails/index.ts +10 -0
  288. package/templates/app/app/http/controllers/api/health.tsx +15 -0
  289. package/templates/app/app/http/controllers/api/not-found.tsx +16 -0
  290. package/templates/app/app/http/controllers/api/openapi.tsx +17 -0
  291. package/templates/app/app/http/controllers/home.tsx +21 -13
  292. package/templates/app/app/http/controllers/mcp.tsx +16 -0
  293. package/templates/app/app/http/controllers/not-found.tsx +23 -18
  294. package/templates/app/app/http/controllers/robots.test.ts +18 -0
  295. package/templates/app/app/http/controllers/robots.ts +24 -0
  296. package/templates/app/app/http/controllers/sitemap.test.ts +28 -0
  297. package/templates/app/app/http/controllers/sitemap.ts +25 -0
  298. package/templates/app/app/http/middleware/access.test.ts +43 -0
  299. package/templates/app/app/http/middleware/access.ts +41 -0
  300. package/templates/app/app/http/middleware/api.ts +19 -0
  301. package/templates/app/app/http/middleware/page.test.ts +43 -0
  302. package/templates/app/app/http/middleware/page.ts +51 -0
  303. package/templates/app/app/http/middleware/server-timing.test.ts +15 -0
  304. package/templates/app/app/http/middleware/server-timing.ts +42 -0
  305. package/templates/app/app/initializers/assets.ts +1 -1
  306. package/templates/app/app/initializers/captcha.ts +11 -0
  307. package/templates/app/app/initializers/cli.ts +68 -2
  308. package/templates/app/app/initializers/database.test.ts +18 -0
  309. package/templates/app/app/initializers/database.ts +18 -0
  310. package/templates/app/app/initializers/dispatcher.ts +26 -0
  311. package/templates/app/app/initializers/honeypot.ts +11 -0
  312. package/templates/app/app/initializers/i18n.test.ts +16 -0
  313. package/templates/app/app/initializers/i18n.ts +28 -0
  314. package/templates/app/app/initializers/local-database.test.ts +33 -0
  315. package/templates/app/app/initializers/local-database.ts +53 -0
  316. package/templates/app/app/initializers/mail-transport.test.ts +27 -0
  317. package/templates/app/app/initializers/mail-transport.ts +26 -0
  318. package/templates/app/app/initializers/mail.test.ts +27 -0
  319. package/templates/app/app/initializers/mail.ts +19 -0
  320. package/templates/app/app/initializers/mcp.ts +1 -1
  321. package/templates/app/app/initializers/openapi.ts +21 -0
  322. package/templates/app/app/initializers/router.test.ts +68 -0
  323. package/templates/app/app/initializers/router.tsx +81 -25
  324. package/templates/app/app/initializers/seo.ts +15 -0
  325. package/templates/app/app/initializers/session.test.ts +34 -0
  326. package/templates/app/app/initializers/session.ts +29 -0
  327. package/templates/app/app/initializers/spam.ts +10 -0
  328. package/templates/app/app/jobs/email.test.tsx +70 -0
  329. package/templates/app/app/jobs/email.ts +16 -0
  330. package/templates/app/app/jobs/index.ts +6 -2
  331. package/templates/app/app/models/index.ts +10 -0
  332. package/templates/app/app/policies/abilities.ts +13 -0
  333. package/templates/app/app/policies/policy.test.ts +15 -0
  334. package/templates/app/app/policies/policy.ts +30 -0
  335. package/templates/app/app/services/commands.ts +30 -0
  336. package/templates/app/app/services/migrations.test.ts +92 -0
  337. package/templates/app/app/services/migrations.ts +117 -0
  338. package/templates/app/app/test/cloudflare-workers.ts +25 -0
  339. package/templates/app/app/test/local-database.ts +67 -0
  340. package/templates/app/app/test/session.ts +28 -0
  341. package/templates/app/bootstrap/cli.ts +1 -1
  342. package/templates/app/bootstrap/console.ts +13 -0
  343. package/templates/app/bootstrap/worker.ts +4 -4
  344. package/templates/app/cloudflare.config.ts +30 -2
  345. package/templates/app/config/constants.ts +19 -0
  346. package/templates/app/config/problems.ts +24 -0
  347. package/templates/app/config/security-policy.ts +34 -0
  348. package/templates/app/config/security-txt.ts +28 -0
  349. package/templates/app/database/migrations/.gitkeep +0 -0
  350. package/templates/app/database/seed.ts +12 -0
  351. package/templates/app/package.json +37 -6
  352. package/templates/app/resources/layouts/document.tsx +28 -7
  353. package/templates/app/resources/locales/en.json +10 -0
  354. package/templates/app/routes/api.ts +29 -0
  355. package/templates/app/routes/web.ts +6 -4
  356. package/templates/app/vite.config.ts +4 -0
  357. package/stubs/policy.stub +0 -13
  358. package/templates/app/config/router-context.d.ts +0 -20
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The `list_{{pluralSnake}}` tool, called over `/mcp` as a client calls it.
3
+ *
4
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/mcp-server}
5
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/testing}{{header}}
6
+ */
7
+
8
+ import { beforeAll, describe, expect, test } from "vitest";
9
+
10
+ import { factories, migrate } from "~/app/test/database";
11
+ import { callTool } from "~/app/test/mcp";
12
+ import { {{Name}}Factory } from "~/database/factories/{{name}}";
13
+
14
+ beforeAll(migrate);
15
+
16
+ describe("list_{{pluralSnake}}", () => {
17
+ test("answers the {{pluralWords}} there are", async () => {
18
+ let row = await factories().create({{Name}}Factory);
19
+
20
+ let result = await callTool("list_{{pluralSnake}}", {});
21
+
22
+ expect(result.isError).toBe(false);
23
+ expect(result.text).toContain(row.id);
24
+ });
25
+ });
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Answers `update_{{snake}}`: changes the fields the call names on the {{words}} with the id, and
3
+ * answers it as saved. An id no {{words}} has, one `{{path}}.read` hides, or a write the database
4
+ * refuses is a tool error; a caller `{{path}}.update` refuses is a forbidden call.
5
+ *
6
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/mcp-server}
7
+ * @see {@link https://sdxc.dev/api/mcp}{{header}}
8
+ */
9
+
10
+ import { NotFound } from "@sdxc/data-model";
11
+ import { createTool, ForbiddenError, ToolError } from "@sdxc/mcp";
12
+ import { isFailure } from "@sdxc/result";
13
+
14
+ import toolset from "~/app/mcp/tools";
15
+ import { {{Name}} } from "~/app/models/{{name}}";
16
+ import abilities from "~/app/policies/abilities";
17
+
18
+ export default createTool(toolset.{{pluralKey}}.update, async (ctx) => {
19
+ let { id, ...changes } = ctx.input;
20
+ let model = {{Name}}.bind({ db: ctx.db });
21
+ let row = await model.find(id);
22
+ if (row === null || !ctx.access.can(abilities.{{path}}.read, { {{key}}: row })) {
23
+ throw new ToolError(`No {{words}} has the id ${id}; list_{{pluralSnake}} lists them.`);
24
+ }
25
+ if (!ctx.access.can(abilities.{{path}}.update, { {{key}}: row })) {
26
+ throw new ForbiddenError("{{path}}.update is not permitted");
27
+ }
28
+ let updated = await model.update(id, changes);
29
+ if (isFailure(updated)) {
30
+ throw new ToolError(
31
+ updated.error instanceof NotFound
32
+ ? `No {{words}} has the id ${id}; list_{{pluralSnake}} lists them.`
33
+ : updated.error.message,
34
+ );
35
+ }
36
+ return updated.data;
37
+ });
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The `update_{{snake}}` tool, called over `/mcp` as a client calls it: as a member, whom
3
+ * `{{path}}.update` allows, and as a guest, whom it refuses.
4
+ *
5
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/mcp-server}
6
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/testing}{{header}}
7
+ */
8
+
9
+ import { beforeAll, describe, expect, test } from "vitest";
10
+
11
+ import { factories, migrate } from "~/app/test/database";
12
+ import { callTool } from "~/app/test/mcp";
13
+ import { {{Name}}Factory } from "~/database/factories/{{name}}";
14
+
15
+ beforeAll(migrate);
16
+
17
+ describe("update_{{snake}}", () => {
18
+ test("changes the fields it names and keeps the rest", async () => {
19
+ let row = await factories().create({{Name}}Factory);
20
+
21
+ let result = await callTool("update_{{snake}}", { id: row.id, {{changedJson}} }, "member");
22
+
23
+ expect(result.isError).toBe(false);
24
+ expect(JSON.parse(result.text)).toMatchObject({ id: row.id, {{changedJson}} });
25
+ });
26
+
27
+ test("reports an id no {{words}} has", async () => {
28
+ let result = await callTool("update_{{snake}}", { id: "missing" }, "member");
29
+
30
+ expect(result.isError).toBe(true);
31
+ });
32
+
33
+ test("refuses a guest", async () => {
34
+ let row = await factories().create({{Name}}Factory);
35
+
36
+ let result = await callTool("update_{{snake}}", { id: row.id, {{changedJson}} });
37
+
38
+ expect(result.isError).toBe(true);
39
+ });
40
+ });
@@ -0,0 +1,2 @@
1
+ -- Creates the {{table}} table the {{Name}} model reads and writes.
2
+ {{statement}}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * The {{title}} model over the `{{table}}` table, with a column per field `sdxc scaffold` was
3
+ * given. Keep the columns in step with the migrations that change the table, and add the rules
4
+ * that keep a {{words}} consistent as callbacks.
5
+ *
6
+ * @see {@link https://sdxc.dev/docs/data-and-background-work/data-models}
7
+ * @see {@link https://sdxc.dev/api/data-model}{{header}}
8
+ */
9
+
10
+ import type { TableRow } from "remix/data-table";
11
+
12
+ import { createModel } from "@sdxc/data-model";
13
+ import { generateUUID } from "@sdxc/uuid/v7";
14
+ import { column as c, table } from "remix/data-table";
15
+
16
+ /** The `{{table}}` table, as its migration creates it. */
17
+ export const {{key}}Table = table({
18
+ name: "{{table}}",
19
+ columns: {
20
+ id: c.text().primaryKey(),
21
+ {{columns}}
22
+ created_at: c.integer(),
23
+ updated_at: c.integer(),
24
+ },
25
+ /** `create` and `update` stamp `created_at` and `updated_at` with the database's clock. */
26
+ timestamps: true,
27
+ });
28
+
29
+ /** One {{words}} as it reads back from the database. */
30
+ export type {{Name}}Row = TableRow<typeof {{key}}Table>;
31
+
32
+ /** {{pluralTitle}}, each created with a time-ordered id; a handler reaches them as `ctx.models.{{key}}`. */
33
+ export const {{Name}} = createModel({{key}}Table, { generateId: generateUUID });
34
+
35
+ export default {{Name}};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The {{title}} model, writing to and reading from the `{{table}}` table its migration creates.
3
+ *
4
+ * @see {@link https://sdxc.dev/docs/data-and-background-work/data-models}
5
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/testing}{{header}}
6
+ */
7
+
8
+ import { beforeAll, describe, expect, test } from "vitest";
9
+
10
+ import { openDatabase } from "~/app/initializers/database";
11
+ import { {{Name}} } from "~/app/models/{{name}}";
12
+ import { factories, migrate } from "~/app/test/database";
13
+ import { {{Name}}Factory } from "~/database/factories/{{name}}";
14
+
15
+ beforeAll(migrate);
16
+
17
+ describe("{{Name}}", () => {
18
+ test("reads back a {{words}} it created", async () => {
19
+ let created = await factories().create({{Name}}Factory);
20
+
21
+ let found = await {{Name}}.bind({ db: openDatabase() }).find(created.id);
22
+
23
+ expect(found).toMatchObject({ id: created.id });
24
+ });
25
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The database a test reads and writes: the in-memory `DB` binding with every migration in
3
+ * `database/migrations/` applied in name order, as `sdxc run db migrate` applies them, and
4
+ * factories that write through the app's own models.
5
+ *
6
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/test-data}{{header}}
7
+ */
8
+
9
+ import { createFactories } from "@sdxc/data-model/testing";
10
+ import { env } from "cloudflare:workers";
11
+
12
+ import { openDatabase } from "~/app/initializers/database";
13
+ import registry from "~/app/models";
14
+
15
+ /** Every migration's SQL by path, bundled by Vite, so a test reads them without the file system. */
16
+ const MIGRATIONS = import.meta.glob<string>("/database/migrations/*.sql", {
17
+ query: "?raw",
18
+ import: "default",
19
+ eager: true,
20
+ });
21
+
22
+ /**
23
+ * Applies every migration to the `DB` binding. Each test file starts with an empty binding, so a
24
+ * file runs this once, in `beforeAll`.
25
+ */
26
+ export async function migrate(): Promise<void> {
27
+ for (let path of Object.keys(MIGRATIONS).sort()) await env.DB.exec(MIGRATIONS[path] ?? "");
28
+ }
29
+
30
+ /** Factories writing through the app's models over the `DB` binding, with values that repeat run to run. */
31
+ export function factories() {
32
+ return createFactories(registry.bind({ db: openDatabase() }), { seed: 1 });
33
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Calls the app's MCP tools the way a client does: a JSON-RPC `tools/call` posted to `/mcp`. A
3
+ * guest's call goes through the app's router, running every middleware a real call runs; a
4
+ * member's goes through a router binding that principal, which the API grants nobody yet.
5
+ *
6
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/mcp-server}{{header}}
7
+ */
8
+
9
+ import { access } from "@sdxc/authz/middleware/router";
10
+ import { models } from "@sdxc/data-model/router";
11
+ import { database } from "@sdxc/database-middleware";
12
+ import { LATEST_PROTOCOL_VERSION, MetaKey } from "@sdxc/mcp";
13
+ import { createRouter } from "remix/router";
14
+
15
+ import { openDatabase } from "~/app/initializers/database";
16
+ import mcp from "~/app/initializers/mcp";
17
+ import { createWebRouter } from "~/app/initializers/router";
18
+ import registry from "~/app/models";
19
+ import abilities from "~/app/policies/abilities";
20
+ import policy from "~/app/policies/policy";
21
+ import routes from "~/routes/api";
22
+
23
+ /** Who a call is made as: a guest, as the API binds every caller, or a signed-in member. */
24
+ export type Caller = "guest" | "member";
25
+
26
+ /** What a call answered: its text, and whether the tool, or the protocol, reported a failure. */
27
+ export interface ToolCall {
28
+ text: string;
29
+ isError: boolean;
30
+ }
31
+
32
+ /** The JSON-RPC response to a `tools/call`. */
33
+ interface CallResponse {
34
+ result?: { content?: Array<{ text?: string }>; isError?: boolean };
35
+ error?: { message?: string };
36
+ }
37
+
38
+ /**
39
+ * A router answering `/mcp` over the app's database and models as a member, the principal the
40
+ * API binds once it authenticates its callers.
41
+ */
42
+ function createMemberRouter() {
43
+ let router = createRouter({
44
+ middleware: [
45
+ database(openDatabase()),
46
+ models(registry, (ctx) => ({ db: ctx.db })),
47
+ access(policy, { roles: ["member"], facts: { actor: { id: "1" } }, load: [abilities] }),
48
+ ],
49
+ });
50
+ router.map(routes.mcp, (ctx) => mcp.fetch(ctx));
51
+ return router;
52
+ }
53
+
54
+ /**
55
+ * Calls the tool `name` with `args` as `caller`. A protocol error, such as arguments the tool's
56
+ * schema refuses or a forbidden call, answers its message as a failure.
57
+ */
58
+ export async function callTool(
59
+ name: string,
60
+ args: Record<string, unknown>,
61
+ caller: Caller = "guest",
62
+ ): Promise<ToolCall> {
63
+ let router = caller === "member" ? createMemberRouter() : createWebRouter();
64
+ let response = await router.fetch(
65
+ new Request(new URL(routes.mcp.href(), "https://example.com"), {
66
+ method: "POST",
67
+ headers: {
68
+ "Content-Type": "application/json",
69
+ "MCP-Protocol-Version": LATEST_PROTOCOL_VERSION,
70
+ "Mcp-Method": "tools/call",
71
+ "Mcp-Name": name,
72
+ },
73
+ body: JSON.stringify({
74
+ jsonrpc: "2.0",
75
+ id: 1,
76
+ method: "tools/call",
77
+ params: {
78
+ name,
79
+ arguments: args,
80
+ _meta: {
81
+ [MetaKey.ProtocolVersion]: LATEST_PROTOCOL_VERSION,
82
+ [MetaKey.ClientInfo]: { name: "test", version: "1.0.0" },
83
+ [MetaKey.ClientCapabilities]: {},
84
+ },
85
+ },
86
+ }),
87
+ }),
88
+ );
89
+ let body = (await response.json()) as CallResponse;
90
+ if (body.error !== undefined) return { text: body.error.message ?? "", isError: true };
91
+ return { text: body.result?.content?.[0]?.text ?? "", isError: body.result?.isError === true };
92
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The {{words}} fields the new and edit forms submit, validated before a create or an update
3
+ * writes them. Each field matches a column of the {{Name}} model, so a valid submission is a
4
+ * complete row.
5
+ *
6
+ * @see {@link https://sdxc.dev/docs/building-remix-apps/forms-and-params}
7
+ * @see {@link https://sdxc.dev/api/validate}{{header}}
8
+ */
9
+
10
+ {{schemaImports}}
11
+
12
+ /** The {{words}} fields, as the form's action receives them; an unticked box reads `false`. */
13
+ export const {{Name}}Schema = f.object({
14
+ {{schemaFields}}
15
+ });
16
+
17
+ /** A validated {{words}} submission, ready for `create` or `update`. */
18
+ export type {{Name}}Input = s.InferOutput<typeof {{Name}}Schema>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The {{words}} form's validation.
3
+ *
4
+ * @see {@link https://sdxc.dev/docs/building-remix-apps/forms-and-params}
5
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/testing}{{header}}
6
+ */
7
+
8
+ import { isFailure, isSuccess } from "@sdxc/result";
9
+ import { validate } from "@sdxc/validate";
10
+ import { describe, expect, test } from "vitest";
11
+
12
+ import { {{Name}}Schema } from "~/app/http/validators/{{name}}";
13
+
14
+ describe("{{Name}}Schema", () => {
15
+ test("accepts a complete submission", async () => {
16
+ let form = new URLSearchParams({ {{formSample}} });
17
+
18
+ expect(isSuccess(await validate(form, {{Name}}Schema))).toBe(true);
19
+ });
20
+
21
+ test("refuses a submission with a value its field cannot take", async () => {
22
+ let form = new URLSearchParams({ {{invalidForm}} });
23
+
24
+ expect(isFailure(await validate(form, {{Name}}Schema))).toBe(true);
25
+ });
26
+ });
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * {{title}}: describe the rule this service carries out across models, and what a caller can
3
3
  * rely on when it succeeds.
4
+ *
5
+ * @see {@link https://sdxc.dev/docs/conventions/result-everywhere}
6
+ * @see {@link https://sdxc.dev/api/result}{{header}}
4
7
  */
5
8
 
6
9
  import type { Result } from "@sdxc/result";
@@ -9,5 +12,6 @@ import { success } from "@sdxc/result";
9
12
 
10
13
  /** Carries out {{title}}; a failure says why nothing changed. */
11
14
  export function {{key}}(): Result<void, Error> {
15
+ // TODO: carry out the rule across models
12
16
  return success(undefined);
13
17
  }
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * The {{title}} service.
3
+ *
4
+ * @see {@link https://sdxc.dev/docs/conventions/result-everywhere}
5
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/testing}{{header}}
3
6
  */
4
7
 
5
8
  import { isSuccess } from "@sdxc/result";
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * The fields the {{title}} form submits, validated before anything trusts them.
3
+ *
4
+ * @see {@link https://sdxc.dev/docs/building-remix-apps/forms-and-params}
5
+ * @see {@link https://sdxc.dev/api/validate}{{header}}
3
6
  */
4
7
 
5
8
  import * as s from "remix/data-schema";
@@ -1,5 +1,8 @@
1
1
  /**
2
2
  * The {{title}} form's validation.
3
+ *
4
+ * @see {@link https://sdxc.dev/docs/building-remix-apps/forms-and-params}
5
+ * @see {@link https://sdxc.dev/docs/operations-and-testing/testing}{{header}}
3
6
  */
4
7
 
5
8
  import { isFailure, isSuccess } from "@sdxc/result";
@@ -0,0 +1,16 @@
1
+ # The Worker's secrets, with values for local development. `sdxc create` copies this file to
2
+ # `.dev.vars`, which `bun dev` reads; copy it yourself in a fresh clone. Set each one for
3
+ # production with `cf workers secrets update <NAME>` before the first deploy.
4
+
5
+ # Signs the session cookie. Use a long random value in production; changing it signs every
6
+ # visitor out.
7
+ SESSION_SECRET=development-session-secret
8
+
9
+ # Signs the honeypot fields every page form carries. Use a long random value in production.
10
+ HONEYPOT_SECRET=development-honeypot-secret
11
+
12
+ # Cloudflare Turnstile, which a form asks a visitor to pass. These are Cloudflare's test keys,
13
+ # which render a visible widget that always passes; create a widget in the Cloudflare dashboard
14
+ # for the production keys.
15
+ TURNSTILE_SITE_KEY=1x00000000000000000000AA
16
+ TURNSTILE_SECRET_KEY=1x0000000000000000000000000000000AA
@@ -0,0 +1,163 @@
1
+ # Agent instructions
2
+
3
+ <!-- sdxc:start · sdxc upgrade rewrites this section from the release it installs; keep project rules outside it -->
4
+
5
+ ## sdxc conventions
6
+
7
+ A Remix v3 app on Cloudflare Workers, built on the `@sdxc/*` packages. Every package is
8
+ documented at `https://sdxc.dev/api/<name>.md` (`https://sdxc.dev/api/result.md` for
9
+ `@sdxc/result`), and the guides at https://sdxc.dev/docs.
10
+
11
+ ### Commands
12
+
13
+ Read a command's flags from `sdxc <command> --help`, which always matches the installed version,
14
+ and what each command is for in the guides, starting from
15
+ https://sdxc.dev/docs/getting-started/the-sdxc-command.
16
+
17
+ ```sh
18
+ sdxc make <kind> <name> # write a file where the layout puts it, with its test
19
+ sdxc make <kind> <name> --dry-run # print what it would write, and write nothing
20
+ sdxc make model <name> [field...] # a model, the migration creating its table, and its factory
21
+ sdxc scaffold <name> [field:type] # model, migration, pages and tests for a resource
22
+ sdxc ui add <component> # copy an @sdxc/ui component into the app to edit it
23
+ sdxc routes --json # every route, its controller and the middleware it runs
24
+ sdxc doctor --json # release drift, installs, secrets, migrations and wiring
25
+ sdxc run <command> # the app's own command line: db migrate, db console, typegen
26
+ sdxc run db prepare # migrate the local database, seeding it when it is new
27
+ sdxc run db fresh --seed # drop every local table, apply every migration, seed
28
+ sdxc run console # Bun's REPL with the local db and models on globalThis
29
+ sdxc upgrade # move every @sdxc package to the latest release
30
+ sdxc deploy --dry-run # build and print the deploy plan, changing nothing
31
+ bun check # format, lint and type check
32
+ bun run test # every test, under Vitest
33
+ ```
34
+
35
+ - Create every file a feature needs with `sdxc make`, then fill it in. The kinds are
36
+ `controller`, `middleware`, `validator`, `job`, `model`, `migration`, `factory`, `service`,
37
+ `policy`, `initializer`, `email`, `mcp` and `command`. `make` writes the test beside the file
38
+ and declares and maps controllers, jobs, MCP tools, commands and emails, so the file works at
39
+ once. `sdxc make email <name> field ...` takes fields as `make model` does; they become the
40
+ email's props.
41
+ - For a resource people list, show, create, edit and delete, start from
42
+ `sdxc scaffold <name> title body:text` (`--mcp` and `--command` add its tools and commands).
43
+ - `sdxc make policy <resource>` adds the resource's `create`, `read`, `update` and `delete`
44
+ abilities to `app/policies/abilities.ts` and grants them in `app/policies/policy.ts`, reads to
45
+ `everyone` and writes to `member`. Check them in a handler with `ctx.access.can(…)`: a hidden
46
+ read answers 404, a refused write 403. A signed-in visitor (`ctx.session.set("actor", { id })`)
47
+ is a `member`; tests sign in with `signIn()` from `app/test/session.ts`.
48
+ - `sdxc make middleware <name> --mount <router|page|api>` also adds the middleware to that chain.
49
+ - `sdxc make model post title body published_at` writes the model, the migration creating its
50
+ plural table (`posts`) and its factory; `--skip migration,factory` leaves those out.
51
+ - Change a table with `sdxc make migration add-slug-to-posts 'slug?'` or
52
+ `remove-slug-from-posts slug` (`create-posts title …` creates one). After changing a model's
53
+ columns, write its migration with `sdxc make migration <name> --from-model <model>`; read its
54
+ warnings before applying it. Apply migrations with `sdxc run db migrate`.
55
+ - Seed the local database from `database/seed.ts`: a `defineSeed(registry, { … })` from
56
+ `@sdxc/data-model/seed`, whose named steps run in order and write through `models` for fixed
57
+ rows or `factories` (`database/factories/`) for generated ones. `db seed`, `db fresh` and
58
+ `db prepare` refuse `--remote`.
59
+ - Read `sdxc routes --json` to find the controller and middleware behind a URL; narrow it with
60
+ `-g <text>`, `-c <controller>`, `--method`, `--contract`, and `--unused` for what no router maps.
61
+ - Run `sdxc doctor` after an upgrade or a structural change; each finding names its fix.
62
+ - Build UI from `@sdxc/ui` components; `sdxc ui add` copies one in when it needs changes.
63
+ - `sdxc upgrade` prints a prompt with the release notes to apply; follow it, then run
64
+ `bun check` and `bun run test`.
65
+ - Run `bun check` and `bun run test` before every commit.
66
+
67
+ ### Where code goes
68
+
69
+ | If the code… | It goes in |
70
+ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
71
+ | is the Worker, browser, command-line or REPL entry point | `bootstrap/` (`worker.ts`, `browser.ts`, `cli.ts`, `console.ts`) |
72
+ | is a Durable Object class | `app/models/` when it owns stored state, `app/services/` otherwise |
73
+ | builds the one instance of something (logger, router, dispatcher, MCP handler, database, mailer, assets) | `app/initializers/` |
74
+ | handles HTTP: controllers, middleware, input validators | `app/http/{controllers,middleware,validators}/` |
75
+ | is a background job, an MCP tool or resource, an email | `app/jobs/`, `app/mcp/`, `app/emails/` |
76
+ | is a command for `sdxc run` | `app/commands/` |
77
+ | reads or writes stored state, in any storage (D1, KV, R2, Durable Object) | `app/models/` |
78
+ | is a rule about one model | a method on that model |
79
+ | is business logic across models, or a rule about none | `app/services/` |
80
+ | is an authorization rule | `app/policies/` |
81
+ | is a view, component, layout, stylesheet or translation | `resources/` (`resources/locales/` for translations) |
82
+ | is a route contract, a migration, a test factory, the seed | `routes/`, `database/{migrations,factories}/`, `database/seed.ts` |
83
+ | is static configuration (site constants, security policy, security.txt, API problems) | `config/` |
84
+ | is any other test helper | `app/test/` |
85
+
86
+ - `bootstrap/` holds entry points only, and only `bootstrap/` imports from it. A Durable Object
87
+ class lives where its role puts it, and `bootstrap/worker.ts` re-exports it in one line.
88
+ - Every file lives in a folder the table names. Code with no knowledge of the app belongs in a
89
+ package of its own.
90
+ - An initializer exports a singleton, or a function when the instance needs per-request input.
91
+ - Group a crowded layer by feature with the same folder name in every layer
92
+ (`app/jobs/billing/`, `app/services/billing/`).
93
+ - `app/mcp/` declares tools in `tools/index.ts` and resources in `resources/index.ts`, with one
94
+ handler file per tool or resource beside them; `app/initializers/mcp.ts` maps each one
95
+ through `lazy()` from `@sdxc/mcp`. `app/commands/` follows the same shape, with the contract
96
+ in `app/commands/index.ts` and the wiring in `app/initializers/cli.ts`.
97
+
98
+ ### Writing code
99
+
100
+ - Map every route through `lazy()` from `@sdxc/lazy-route`, so a request loads only the
101
+ controller it reaches; a route group's guards go in `lazy()`'s second argument.
102
+ - Write the router's global middleware inline in `createRouter({ middleware: [...] })`.
103
+ Middleware publishes services onto the context (`ctx.db`, `ctx.models`, `ctx.email`), so a
104
+ handler reads them there and a test installs its own.
105
+ - Send an email by its declaration, with the reader's language rather than translated copy:
106
+ `ctx.email.send(emails.welcome, { to, locale, props })`, or `queue()` for a delivery that must
107
+ survive a failure. The template translates with `handle.props.t`, so a queued delivery stays
108
+ plain JSON.
109
+ - Give every email template a `preview()`: `bun dev` lists and renders each one at `/_emails`, and
110
+ `sdxc run emails preview <name> --locale <language>` prints it.
111
+ - Build UI with `remix/component` JSX, styled with `css()` mixins through `mix`. Render server
112
+ HTML as JSX. A page renders through `ctx.render()` inside `DocumentLayout`, passing it
113
+ `ctx.assets` for the stylesheets, entry script and CSP nonce.
114
+ - Build dialogs, popovers, menus, tooltips and disclosures with the platform: `<dialog>`, the
115
+ Popover API, `<button commandfor command>`, and `<details>`. Reach for JavaScript only for
116
+ behavior HTML cannot express.
117
+ - Return a `Result` from `@sdxc/result` (`success`, `failure`, `wrap`) for an operation that
118
+ can fail, so callers see the failure in the type.
119
+ - Log through `ctx.log` in controllers, jobs and commands, and `currentLog()` from
120
+ `@sdxc/logger` anywhere else; every line then carries the request's `trace_id`.
121
+ - Validate every untrusted input (params, forms, JSON bodies, webhooks, environment values) with
122
+ `remix/data-schema`.
123
+ - Run background work as a job from `@sdxc/jobs` (`sdxc make job`).
124
+ - Import `env` from `cloudflare:workers`. Declare each binding in `cloudflare.config.ts`, then
125
+ run `sdxc run typegen`; declare each secret with `bindings.secret()` and list it in
126
+ `.env.example`.
127
+ - Call the global `fetch` directly; tests intercept it with MSW.
128
+ - Create record ids with `generateUUID` from `@sdxc/uuid/v7`, other identifiers with
129
+ `@sdxc/uuid/v4`, and secrets (tokens, codes, OAuth `state`) with `randomToken` from
130
+ `@sdxc/crypto`.
131
+ - Write each multi-step database change as a single statement or upsert, or with compensating
132
+ steps: D1 commits every statement as it runs. Keep every migration chain applicable to an
133
+ empty database.
134
+ - Use `let` for local variables and `const` for module-level constants, named in
135
+ `UPPER_SNAKE_CASE`. Prefer `interface` to `type`, and import types in their own
136
+ `import type` statement.
137
+
138
+ ### Testing
139
+
140
+ - Write tests with Vitest, in a `*.test.ts` file beside the module.
141
+ - Back database tests with the in-memory D1 from `@sdxc/cloudflare-mocks/sqlite`.
142
+ - Mock outbound HTTP with MSW (`setupServer` from `msw/node`).
143
+ - Add a regression test with every bug fix, one that fails without the fix.
144
+
145
+ ### Deploying
146
+
147
+ `sdxc deploy` builds, then runs this app's `db migrate --remote` and `deploy` commands, so the
148
+ new code reaches production only once its schema is there. Change how the app migrates or ships
149
+ in `app/commands/db/migrate.ts` and `app/commands/deploy.ts`, never by running `cf deploy` by
150
+ hand. It changes production, so run it only when asked to deploy, and print the plan first:
151
+
152
+ ```sh
153
+ bun check
154
+ sdxc deploy --dry-run
155
+ sdxc deploy
156
+ ```
157
+
158
+ <!-- sdxc:end -->
159
+
160
+ ## This project
161
+
162
+ Rules for this project go here. `sdxc upgrade` keeps everything outside the sdxc section as
163
+ you wrote it.
@@ -0,0 +1 @@
1
+ @AGENTS.md