create-oke 0.2.6 → 0.3.2

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 (126) hide show
  1. package/README.md +26 -35
  2. package/package.json +10 -12
  3. package/src/cli.test.ts +124 -144
  4. package/src/cli.ts +62 -160
  5. package/src/docs-origin.ts +2 -3
  6. package/src/index.ts +1 -2
  7. package/src/scaffold.ts +52 -32
  8. package/src/templates.ts +12 -91
  9. package/src/transform.ts +60 -10
  10. package/template/.env.example +56 -0
  11. package/template/README.md +77 -0
  12. package/template/bun.lock +845 -0
  13. package/template/drizzle.config.ts +25 -0
  14. package/{templates/standard → template}/oke.config.ts +22 -25
  15. package/{templates/standard → template}/package.json +3 -0
  16. package/{templates/minimal → template}/src/core.ts +1 -1
  17. package/template/src/schema.decl.ts +12 -0
  18. package/examples/linkly/oke.config.ts +0 -10
  19. package/examples/linkly/package.json +0 -15
  20. package/examples/linkly/src/app.ts +0 -21
  21. package/examples/linkly/src/core.ts +0 -4
  22. package/examples/linkly/src/flows/analytics/index.ts +0 -24
  23. package/examples/linkly/src/flows/links/index.ts +0 -59
  24. package/examples/linkly/src/flows/links/shapes.ts +0 -22
  25. package/examples/linkly/src/flows/links/signals.ts +0 -13
  26. package/examples/linkly/src/gates.ts +0 -8
  27. package/examples/linkly/src/schema.ts +0 -17
  28. package/examples/linkly/tests/linkly.test.ts +0 -19
  29. package/examples/notes/oke.config.ts +0 -14
  30. package/examples/notes/package.json +0 -16
  31. package/examples/notes/src/app.ts +0 -13
  32. package/examples/notes/src/core.ts +0 -4
  33. package/examples/notes/src/flows/notes/index.ts +0 -44
  34. package/examples/notes/src/schema.ts +0 -9
  35. package/examples/notes/tests/notes.test.ts +0 -10
  36. package/examples/provisions/oke.config.ts +0 -17
  37. package/examples/provisions/package.json +0 -15
  38. package/examples/provisions/src/app.ts +0 -60
  39. package/examples/provisions/src/channels.ts +0 -14
  40. package/examples/provisions/src/core.ts +0 -4
  41. package/examples/provisions/src/flows/notifications/index.ts +0 -19
  42. package/examples/provisions/src/flows/orders/index.ts +0 -70
  43. package/examples/provisions/src/flows/orders/shapes.ts +0 -21
  44. package/examples/provisions/src/flows/orders/signals.ts +0 -19
  45. package/examples/provisions/src/flows/payments/index.ts +0 -37
  46. package/examples/provisions/src/flows/payments/shapes.ts +0 -3
  47. package/examples/provisions/src/flows/payments/stripe.ts +0 -18
  48. package/examples/provisions/src/gates.ts +0 -4
  49. package/examples/provisions/src/locales/ar.ts +0 -1
  50. package/examples/provisions/src/locales/en.ts +0 -1
  51. package/examples/provisions/src/plugins/audit-schema.ts +0 -2
  52. package/examples/provisions/src/plugins/audit.ts +0 -14
  53. package/examples/provisions/src/schema.ts +0 -16
  54. package/examples/provisions/src/vault.ts +0 -16
  55. package/examples/provisions/tests/orders.test.ts +0 -18
  56. package/examples/skyport/evals/triage.jsonl +0 -1
  57. package/examples/skyport/oke.config.ts +0 -44
  58. package/examples/skyport/oke.images.lock +0 -4
  59. package/examples/skyport/package.json +0 -16
  60. package/examples/skyport/src/ai.ts +0 -25
  61. package/examples/skyport/src/app.ts +0 -57
  62. package/examples/skyport/src/channels.ts +0 -12
  63. package/examples/skyport/src/core.ts +0 -4
  64. package/examples/skyport/src/flows/bookings/index.ts +0 -50
  65. package/examples/skyport/src/flows/bookings/shapes.ts +0 -6
  66. package/examples/skyport/src/flows/bookings/signals.ts +0 -9
  67. package/examples/skyport/src/flows/notifications/index.ts +0 -16
  68. package/examples/skyport/src/flows/payments/index.ts +0 -14
  69. package/examples/skyport/src/flows/payments/shapes.ts +0 -5
  70. package/examples/skyport/src/flows/support/index.ts +0 -38
  71. package/examples/skyport/src/flows/users/elements.ts +0 -2
  72. package/examples/skyport/src/flows/users/index.ts +0 -12
  73. package/examples/skyport/src/flows/users/shapes.ts +0 -6
  74. package/examples/skyport/src/gates.ts +0 -10
  75. package/examples/skyport/src/journeys.ts +0 -9
  76. package/examples/skyport/src/locales/ar.ts +0 -4
  77. package/examples/skyport/src/locales/en.ts +0 -4
  78. package/examples/skyport/src/plugins/audit-schema.ts +0 -7
  79. package/examples/skyport/src/plugins/audit.ts +0 -14
  80. package/examples/skyport/src/plugins/panel.tsx +0 -4
  81. package/examples/skyport/src/schema.ts +0 -22
  82. package/examples/skyport/src/vault.ts +0 -24
  83. package/examples/skyport/tests/support.test.ts +0 -16
  84. package/src/sync-templates.ts +0 -86
  85. package/templates/full/README.md +0 -49
  86. package/templates/full/oke.config.ts +0 -68
  87. package/templates/full/package.json +0 -15
  88. package/templates/full/src/ai.ts +0 -11
  89. package/templates/full/src/app.ts +0 -34
  90. package/templates/full/src/channels.ts +0 -9
  91. package/templates/full/src/core.ts +0 -4
  92. package/templates/full/src/flows/main/index.ts +0 -45
  93. package/templates/full/src/flows/main/shapes.ts +0 -3
  94. package/templates/full/src/flows/main/signals.ts +0 -8
  95. package/templates/full/src/gates.ts +0 -4
  96. package/templates/full/src/locales/ar.ts +0 -3
  97. package/templates/full/src/locales/en.ts +0 -3
  98. package/templates/full/src/schema.ts +0 -8
  99. package/templates/full/src/vault.ts +0 -9
  100. package/templates/full/tests/full.test.ts +0 -11
  101. package/templates/hello/README.md +0 -38
  102. package/templates/hello/oke.config.ts +0 -3
  103. package/templates/hello/package.json +0 -14
  104. package/templates/hello/src/app.ts +0 -10
  105. package/templates/hello/src/flows/hello/index.ts +0 -27
  106. package/templates/hello/tests/hello.test.ts +0 -10
  107. package/templates/minimal/README.md +0 -41
  108. package/templates/minimal/oke.config.ts +0 -14
  109. package/templates/minimal/package.json +0 -15
  110. package/templates/minimal/src/app.ts +0 -13
  111. package/templates/minimal/src/flows/main/index.ts +0 -49
  112. package/templates/minimal/src/schema.ts +0 -8
  113. package/templates/minimal/tests/minimal.test.ts +0 -13
  114. package/templates/standard/README.md +0 -47
  115. package/templates/standard/src/core.ts +0 -4
  116. package/templates/standard/src/schema.ts +0 -9
  117. /package/{templates/standard → template}/src/app.ts +0 -0
  118. /package/{templates/standard → template}/src/channels.ts +0 -0
  119. /package/{templates/standard → template}/src/flows/main/index.ts +0 -0
  120. /package/{templates/standard → template}/src/flows/main/shapes.ts +0 -0
  121. /package/{templates/standard → template}/src/flows/main/signals.ts +0 -0
  122. /package/{templates/standard → template}/src/gates.ts +0 -0
  123. /package/{templates/standard → template}/src/locales/ar.ts +0 -0
  124. /package/{templates/standard → template}/src/locales/en.ts +0 -0
  125. /package/{templates/standard → template}/src/vault.ts +0 -0
  126. /package/{templates/standard → template}/tests/standard.test.ts +0 -0
@@ -1,15 +0,0 @@
1
- {
2
- "name": "@oke/template-minimal",
3
- "version": "0.0.1",
4
- "private": true,
5
- "type": "module",
6
- "dependencies": {
7
- "okengine": "file:../..",
8
- "drizzle-orm": "^1.0.0-rc.4",
9
- "zod": "^4.4.3"
10
- },
11
- "scripts": {
12
- "test": "bun test",
13
- "dev": "oke dev"
14
- }
15
- }
@@ -1,13 +0,0 @@
1
- import { db } from "./core";
2
-
3
- import { oke } from "okengine";
4
- import * as main from "./flows/main";
5
-
6
- export const app = oke({ name: "minimal" }).adopt({ main });
7
-
8
- export type App = typeof app;
9
-
10
- Object.assign(app.$options, {
11
- env: "test",
12
- stores: [db],
13
- });
@@ -1,49 +0,0 @@
1
- import { on, flow, http } from "okengine";
2
- import { z } from "zod";
3
- import { db } from "../../core";
4
- import { entries } from "../../schema";
5
-
6
- const NewEntry = z.object({ body: z.string().min(1) });
7
- const EntryId = z.object({ id: z.string() });
8
- const Entry = z.object({
9
- id: z.string(),
10
- body: z.string(),
11
- createdAt: z.number(),
12
- });
13
-
14
- /** First-run welcome — visit :6530/ after `oke dev`. */
15
- export const root = on(
16
- http.get("/"),
17
- flow({
18
- out: z.object({
19
- ok: z.literal(true),
20
- console: z.string(),
21
- try: z.string(),
22
- }),
23
- do: () => ({
24
- ok: true as const,
25
- console: "http://127.0.0.1:6533",
26
- try: "GET /entries",
27
- }),
28
- }),
29
- );
30
-
31
- export const create = on(
32
- http.post("/entries"),
33
- flow({
34
- in: NewEntry,
35
- out: EntryId,
36
- do: async (input, fx) => {
37
- const [row] = await fx.store(db).insert(entries).values(input).returning();
38
- return { id: row.id };
39
- },
40
- }),
41
- );
42
-
43
- export const list = on(
44
- http.get("/entries"),
45
- flow({
46
- out: Entry.array(),
47
- do: (_, fx) => fx.store(db).select().from(entries),
48
- }),
49
- );
@@ -1,8 +0,0 @@
1
- import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
2
- import { id, now } from "okengine/store";
3
-
4
- export const entries = sqliteTable("entries", {
5
- id: text("id").primaryKey().$defaultFn(id),
6
- body: text("body").notNull(),
7
- createdAt: integer("created_at").notNull().$defaultFn(now),
8
- });
@@ -1,13 +0,0 @@
1
- import { test, expect } from "bun:test";
2
- import { createTestApp } from "okengine/test";
3
- import { app } from "../src/app";
4
-
5
- test("boots — create then list", async () => {
6
- const t = await createTestApp(app);
7
- const { data, error } = await t.api.main.create({ body: "hello" });
8
- expect(error).toBeNull();
9
- expect(data?.id).toBeTruthy();
10
- const { data: rows } = await t.api.main.list({});
11
- expect(rows?.length).toBe(1);
12
- expect(rows?.[0]?.body).toBe("hello");
13
- });
@@ -1,47 +0,0 @@
1
- # standard
2
-
3
- Full recommended file layout with **empty scaffolding** — structure without
4
- business logic. Default `create-oke` template.
5
-
6
- ## Run
7
-
8
- ```bash
9
- bun install
10
- oke dev # app :6530 · Console :6533 · MCP :6535
11
- ```
12
-
13
- | Port | Try |
14
- |---|---|
15
- | `:6530` | `GET /` · `GET /health` |
16
- | `:6533` | Console |
17
- | `:6535` | MCP |
18
-
19
- ## What’s in this template
20
-
21
- ```text
22
- standard/
23
- ├── oke.config.ts
24
- ├── src/
25
- │ ├── app.ts # adopt({ main }); wires stores + side modules
26
- │ ├── core.ts / schema.ts # Store (replace the placeholder table)
27
- │ ├── gates.ts # Gate stubs
28
- │ ├── vault.ts # Vault stubs
29
- │ ├── channels.ts # Channel stubs
30
- │ ├── locales/en.ts · ar.ts # i18n stubs
31
- │ └── flows/main/
32
- │ ├── index.ts # GET / · GET /health
33
- │ ├── shapes.ts # contracts live next to flows
34
- │ └── signals.ts # Signal stubs
35
- └── tests/standard.test.ts
36
- ```
37
-
38
- - **Elements stubbed:** Flow · Store · Signal · Gate · Vault · Channel (+ locales)
39
- - **Unit:** `main`
40
- - **Flows to replace:** `root`, `health` — delete or rename once your domain exists
41
-
42
- Fill `schema.ts`, then add real flows under `src/flows/<unit>/`. Prefer this
43
- layout for new products; use `hello` / `minimal` only when you want less surface.
44
-
45
- ## Agent contract
46
-
47
- See [`AGENTS.md`](./AGENTS.md). Handbook: [okengine.vercel.app/docs](https://okengine.vercel.app/docs)
@@ -1,4 +0,0 @@
1
- import { store } from "okengine";
2
- import * as schema from "./schema";
3
-
4
- export const db = store.sql("app", { schema });
@@ -1,9 +0,0 @@
1
- import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
2
- import { id, now } from "okengine/store";
3
-
4
- /** Replace with your tables — keep defaults on the schema. */
5
- export const entries = sqliteTable("entries", {
6
- id: text("id").primaryKey().$defaultFn(id),
7
- body: text("body").notNull(),
8
- createdAt: integer("created_at").notNull().$defaultFn(now),
9
- });
File without changes
File without changes
File without changes