@sdxc/kit 0.0.0-pre.1

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 (144) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +93 -0
  3. package/config.schema.json +89 -0
  4. package/dist/bin.d.ts +9 -0
  5. package/dist/bin.js +10 -0
  6. package/dist/cli.d.ts +33 -0
  7. package/dist/cli.js +58 -0
  8. package/dist/commands/create.d.ts +20 -0
  9. package/dist/commands/create.js +164 -0
  10. package/dist/commands/init.d.ts +16 -0
  11. package/dist/commands/init.js +27 -0
  12. package/dist/commands/make.d.ts +335 -0
  13. package/dist/commands/make.js +152 -0
  14. package/dist/commands/run.d.ts +23 -0
  15. package/dist/commands/run.js +51 -0
  16. package/dist/commands/ui/add.d.ts +23 -0
  17. package/dist/commands/ui/add.js +50 -0
  18. package/dist/commands/ui/diff.d.ts +20 -0
  19. package/dist/commands/ui/diff.js +28 -0
  20. package/dist/commands/ui/list.d.ts +24 -0
  21. package/dist/commands/ui/list.js +45 -0
  22. package/dist/commands/ui/remove.d.ts +22 -0
  23. package/dist/commands/ui/remove.js +48 -0
  24. package/dist/commands/ui/update.d.ts +23 -0
  25. package/dist/commands/ui/update.js +37 -0
  26. package/dist/commands/upgrade.d.ts +30 -0
  27. package/dist/commands/upgrade.js +184 -0
  28. package/dist/config.d.ts +81 -0
  29. package/dist/config.js +157 -0
  30. package/dist/contract.d.ts +161 -0
  31. package/dist/contract.js +308 -0
  32. package/dist/create/github.d.ts +63 -0
  33. package/dist/create/github.js +172 -0
  34. package/dist/create/target.d.ts +31 -0
  35. package/dist/create/target.js +56 -0
  36. package/dist/create/templates.d.ts +62 -0
  37. package/dist/create/templates.js +228 -0
  38. package/dist/dependencies.d.ts +34 -0
  39. package/dist/dependencies.js +76 -0
  40. package/dist/diff.d.ts +14 -0
  41. package/dist/diff.js +103 -0
  42. package/dist/format.d.ts +21 -0
  43. package/dist/format.js +40 -0
  44. package/dist/init.d.ts +38 -0
  45. package/dist/init.js +92 -0
  46. package/dist/lock.d.ts +74 -0
  47. package/dist/lock.js +214 -0
  48. package/dist/make/declare.d.ts +54 -0
  49. package/dist/make/declare.js +495 -0
  50. package/dist/make/generate.d.ts +56 -0
  51. package/dist/make/generate.js +139 -0
  52. package/dist/make/imports.d.ts +43 -0
  53. package/dist/make/imports.js +104 -0
  54. package/dist/make/index.d.ts +43 -0
  55. package/dist/make/index.js +136 -0
  56. package/dist/make/kinds.d.ts +39 -0
  57. package/dist/make/kinds.js +95 -0
  58. package/dist/make/migrations.d.ts +21 -0
  59. package/dist/make/migrations.js +48 -0
  60. package/dist/make/names.d.ts +31 -0
  61. package/dist/make/names.js +47 -0
  62. package/dist/make/stubs.d.ts +44 -0
  63. package/dist/make/stubs.js +89 -0
  64. package/dist/middleware.d.ts +44 -0
  65. package/dist/middleware.js +49 -0
  66. package/dist/package-manager.d.ts +41 -0
  67. package/dist/package-manager.js +80 -0
  68. package/dist/project.d.ts +19 -0
  69. package/dist/project.js +42 -0
  70. package/dist/releases.d.ts +40 -0
  71. package/dist/releases.js +110 -0
  72. package/dist/testing.d.ts +47 -0
  73. package/dist/testing.js +126 -0
  74. package/dist/ui/commands.d.ts +114 -0
  75. package/dist/ui/commands.js +432 -0
  76. package/dist/ui/imports.d.ts +46 -0
  77. package/dist/ui/imports.js +160 -0
  78. package/dist/ui/layout.d.ts +48 -0
  79. package/dist/ui/layout.js +138 -0
  80. package/dist/ui/registry.d.ts +58 -0
  81. package/dist/ui/registry.js +82 -0
  82. package/dist/upgrade/changelog.d.ts +50 -0
  83. package/dist/upgrade/changelog.js +69 -0
  84. package/dist/upgrade/project.d.ts +62 -0
  85. package/dist/upgrade/project.js +132 -0
  86. package/dist/upgrade/prompt.d.ts +51 -0
  87. package/dist/upgrade/prompt.js +227 -0
  88. package/dist/upgrade/registry.d.ts +33 -0
  89. package/dist/upgrade/registry.js +50 -0
  90. package/lock.schema.json +60 -0
  91. package/package.json +45 -0
  92. package/stubs/command.stub +12 -0
  93. package/stubs/command.test.stub +18 -0
  94. package/stubs/controller.form.stub +33 -0
  95. package/stubs/controller.stub +17 -0
  96. package/stubs/controller.test.stub +15 -0
  97. package/stubs/email.stub +44 -0
  98. package/stubs/email.test.stub +16 -0
  99. package/stubs/factory.stub +10 -0
  100. package/stubs/initializer.stub +7 -0
  101. package/stubs/initializer.test.stub +13 -0
  102. package/stubs/job.cron.stub +12 -0
  103. package/stubs/job.stub +11 -0
  104. package/stubs/job.test.stub +15 -0
  105. package/stubs/mcp.resource.stub +12 -0
  106. package/stubs/mcp.stub +10 -0
  107. package/stubs/mcp.test.stub +15 -0
  108. package/stubs/middleware.stub +11 -0
  109. package/stubs/middleware.test.stub +13 -0
  110. package/stubs/migration.stub +1 -0
  111. package/stubs/model.stub +24 -0
  112. package/stubs/model.test.stub +15 -0
  113. package/stubs/policy.stub +13 -0
  114. package/stubs/policy.test.stub +17 -0
  115. package/stubs/service.stub +13 -0
  116. package/stubs/service.test.stub +14 -0
  117. package/stubs/validator.stub +14 -0
  118. package/stubs/validator.test.stub +22 -0
  119. package/templates/app/README.md +57 -0
  120. package/templates/app/app/commands/about.test.ts +29 -0
  121. package/templates/app/app/commands/about.ts +34 -0
  122. package/templates/app/app/commands/index.ts +15 -0
  123. package/templates/app/app/http/controllers/home.tsx +22 -0
  124. package/templates/app/app/http/controllers/not-found.tsx +25 -0
  125. package/templates/app/app/initializers/assets.ts +11 -0
  126. package/templates/app/app/initializers/cli.ts +35 -0
  127. package/templates/app/app/initializers/dispatcher.ts +18 -0
  128. package/templates/app/app/initializers/logger.ts +10 -0
  129. package/templates/app/app/initializers/mcp.ts +16 -0
  130. package/templates/app/app/initializers/router.tsx +65 -0
  131. package/templates/app/app/jobs/index.ts +10 -0
  132. package/templates/app/app/mcp/resources/index.ts +9 -0
  133. package/templates/app/app/mcp/tools/index.ts +10 -0
  134. package/templates/app/bootstrap/browser.ts +27 -0
  135. package/templates/app/bootstrap/cli.ts +9 -0
  136. package/templates/app/bootstrap/worker.ts +31 -0
  137. package/templates/app/cloudflare.config.ts +28 -0
  138. package/templates/app/config/router-context.d.ts +20 -0
  139. package/templates/app/gitignore +9 -0
  140. package/templates/app/package.json +38 -0
  141. package/templates/app/resources/layouts/document.tsx +58 -0
  142. package/templates/app/routes/web.ts +12 -0
  143. package/templates/app/tsconfig.json +40 -0
  144. package/templates/app/vite.config.ts +40 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Cloudflare configuration for the Worker, read by `cf` and the Vite plugin alike. Every
3
+ * binding and trigger the app reads is declared here, so `bun cf:typegen` types `env` from
4
+ * this file and local development simulates exactly what production provides.
5
+ */
6
+
7
+ import { bindings, defineConfig, triggers } from "cf/config";
8
+
9
+ import manifest from "./package.json" with { type: "json" };
10
+
11
+ export default defineConfig({
12
+ worker: {
13
+ name: manifest.name,
14
+ compatibilityDate: "2026-09-02",
15
+ compatibilityFlags: ["nodejs_compat"],
16
+ entrypoint: "./bootstrap/worker.ts",
17
+ observability: { enabled: true },
18
+ /**
19
+ * A queue has exactly one consumer, so this Worker owns the role: every job the
20
+ * dispatcher enqueues is delivered back here and run through the same dispatcher.
21
+ */
22
+ triggers: [triggers.queue({ name: manifest.name })],
23
+ env: {
24
+ /** Where the job dispatcher enqueues; `cf queues create <name>` before the first deploy. */
25
+ QUEUE: bindings.queue({ name: manifest.name }),
26
+ },
27
+ },
28
+ });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What the router's global middleware adds to every request context: `render()` publishes
3
+ * `ctx.render` and `formData()` publishes `ctx.formData`. Declaring them here lets the
4
+ * default handler and any helper typed as `RequestContext` read them.
5
+ */
6
+
7
+ import type { RemixNode } from "remix/component";
8
+ import type { Renderer } from "remix/middleware/render";
9
+ import type {} from "remix/router";
10
+
11
+ declare module "remix/router" {
12
+ interface RequestContext {
13
+ /** Renders a `remix/component` node into an HTML `Response`. */
14
+ render: Renderer<RemixNode>;
15
+ /** The request's parsed form body. */
16
+ formData: FormData;
17
+ }
18
+ }
19
+
20
+ export {};
@@ -0,0 +1,9 @@
1
+ # Dependencies and build output
2
+ node_modules
3
+ dist
4
+
5
+ # Cloudflare's generated types and local state
6
+ .cloudflare
7
+
8
+ # Local secrets
9
+ .dev.vars
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "app",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "build": "vite build",
7
+ "cf:deploy": "cf deploy --prebuilt",
8
+ "cf:typegen": "cf workers types",
9
+ "check": "vp check",
10
+ "cli": "bun ./bootstrap/cli.ts",
11
+ "dev": "vite dev",
12
+ "start": "vite preview",
13
+ "test": "vp test run",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "dependencies": {
17
+ "@pitlane/assets": "0.1.0",
18
+ "@sdxc/assets-middleware": "0.0.1",
19
+ "@sdxc/cli": "0.0.1",
20
+ "@sdxc/jobs": "0.0.1",
21
+ "@sdxc/lazy-route": "0.0.1",
22
+ "@sdxc/logger": "0.0.1",
23
+ "@sdxc/mcp": "0.0.1",
24
+ "@sdxc/ui": "0.0.1",
25
+ "remix": "3.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@cloudflare/vite-plugin": "2.0.0-beta.sha-ad79608dd",
29
+ "@pitlane/vite-plugin-remix": "0.8.0",
30
+ "@types/node": "^26.6.5",
31
+ "cf": "1.0.0-beta.5",
32
+ "typescript": "^6.0.3",
33
+ "vite": "^8.3.4",
34
+ "vite-plus": "0.3.3",
35
+ "vitest": "4.1.11"
36
+ },
37
+ "packageManager": "bun@1.4.2"
38
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * The HTML document every page renders inside: the head tags, the page title, and the
3
+ * stylesheets imported below in cascade order. The client entry is linked only by a page
4
+ * that carries an island.
5
+ */
6
+
7
+ import type { DocumentAssets } from "@sdxc/assets-middleware";
8
+ import type { Handle, RemixNode } from "remix/component";
9
+
10
+ import { css } from "remix/component";
11
+ import { ImportMap } from "remix/component/server";
12
+
13
+ import "@sdxc/ui/reset.css";
14
+ import "@sdxc/ui/theme.css";
15
+
16
+ namespace DocumentLayout {
17
+ export interface Props {
18
+ /** The page's content, rendered inside `<main>`. */
19
+ children: RemixNode;
20
+ /** The stylesheets and client entry the request resolved, from `ctx.assets`. */
21
+ assets: DocumentAssets;
22
+ title: string;
23
+ /** Whether the page carries an island, the only reason to link the client entry. */
24
+ hydrates?: boolean;
25
+ }
26
+ }
27
+
28
+ /** Renders the `<html>`, `<head>` and `<body>` shell around a page. */
29
+ export default function DocumentLayout(handle: Handle<DocumentLayout.Props>) {
30
+ return () => {
31
+ let { assets, children, hydrates = false, title } = handle.props;
32
+ let { script, stylesheets } = assets;
33
+
34
+ return (
35
+ <html lang="en" class="system">
36
+ <head>
37
+ <meta charSet="utf-8" data-rmx-key="charset" />
38
+ <meta
39
+ name="viewport"
40
+ content="width=device-width, initial-scale=1"
41
+ data-rmx-key="viewport"
42
+ />
43
+ <title data-rmx-key="title">{title}</title>
44
+ {stylesheets.map((href) => (
45
+ <link key={href} rel="stylesheet" href={href} data-rmx-key={href} />
46
+ ))}
47
+ {hydrates ? <ImportMap value={script.importMap} /> : null}
48
+ </head>
49
+ <body>
50
+ <main mix={css({ maxInlineSize: "48rem", marginInline: "auto", padding: "1.5rem" })}>
51
+ {children}
52
+ </main>
53
+ {hydrates ? <script type="module" src={script.href}></script> : null}
54
+ </body>
55
+ </html>
56
+ );
57
+ };
58
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The web route contract: every URL the app answers, by name. Controllers and links build
3
+ * URLs with `routes.<name>.href()`, so a pattern changes here and nowhere else.
4
+ */
5
+
6
+ import { get, post, route } from "remix/routes";
7
+
8
+ /** The home page and the MCP endpoint an agent connects to. */
9
+ export default route({
10
+ home: get("/"),
11
+ mcp: post("/mcp"),
12
+ });
@@ -0,0 +1,40 @@
1
+ {
2
+ "include": [
3
+ "app/**/*",
4
+ "bootstrap/**/*",
5
+ "config/**/*",
6
+ "database/**/*",
7
+ "resources/**/*",
8
+ "routes/**/*",
9
+ ".cloudflare/types/index.d.ts",
10
+ "cloudflare.config.ts",
11
+ "vite.config.ts"
12
+ ],
13
+ "compilerOptions": {
14
+ "target": "es2022",
15
+ "lib": ["es2023", "dom", "dom.iterable"],
16
+ "module": "preserve",
17
+ "moduleResolution": "bundler",
18
+ "moduleDetection": "force",
19
+ "resolveJsonModule": true,
20
+ "allowImportingTsExtensions": true,
21
+ "isolatedModules": true,
22
+ "verbatimModuleSyntax": true,
23
+ "esModuleInterop": true,
24
+ "skipLibCheck": true,
25
+ "noEmit": true,
26
+ "strict": true,
27
+ "noUncheckedIndexedAccess": true,
28
+ "noImplicitOverride": true,
29
+ "jsx": "react-jsx",
30
+ "jsxImportSource": "remix/component",
31
+ "types": ["node", "vite/client"],
32
+ "paths": {
33
+ "~/app/*": ["./app/*"],
34
+ "~/config/*": ["./config/*"],
35
+ "~/database/*": ["./database/*"],
36
+ "~/resources/*": ["./resources/*"],
37
+ "~/routes/*": ["./routes/*"]
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Vite+ configuration: the dev server and build, the tests, and the formatting and lint rules
3
+ * `vp check` applies. The Cloudflare plugin runs the Worker in the SSR environment, and the
4
+ * Remix plugin builds the client entry and writes the asset manifest the document links from.
5
+ */
6
+
7
+ import { cloudflare } from "@cloudflare/vite-plugin";
8
+ import { remix } from "@pitlane/vite-plugin-remix";
9
+ import { defineConfig } from "vite-plus";
10
+
11
+ export default defineConfig({
12
+ resolve: { tsconfigPaths: true },
13
+
14
+ plugins: [
15
+ remix({
16
+ clientEntry: "bootstrap/browser.ts",
17
+ serverEntry: "bootstrap/worker.ts",
18
+ serverHandler: false,
19
+ }),
20
+ /**
21
+ * Tests import modules on their own, in Node, so the Worker runtime the plugin starts
22
+ * is left out while Vitest runs.
23
+ */
24
+ process.env.VITEST === undefined ? cloudflare({ viteEnvironment: { name: "ssr" } }) : null,
25
+ ],
26
+
27
+ test: {
28
+ include: ["app/**/*.test.ts?(x)", "resources/**/*.test.ts?(x)"],
29
+ },
30
+
31
+ fmt: {
32
+ useTabs: true,
33
+ ignorePatterns: [".cloudflare/**"],
34
+ },
35
+
36
+ lint: {
37
+ options: { typeAware: true, typeCheck: true },
38
+ ignorePatterns: [".cloudflare/**"],
39
+ },
40
+ });