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.
- package/README.md +26 -35
- package/package.json +10 -12
- package/src/cli.test.ts +124 -144
- package/src/cli.ts +62 -160
- package/src/docs-origin.ts +2 -3
- package/src/index.ts +1 -2
- package/src/scaffold.ts +52 -32
- package/src/templates.ts +12 -91
- package/src/transform.ts +60 -10
- package/template/.env.example +56 -0
- package/template/README.md +77 -0
- package/template/bun.lock +845 -0
- package/template/drizzle.config.ts +25 -0
- package/{templates/standard → template}/oke.config.ts +22 -25
- package/{templates/standard → template}/package.json +3 -0
- package/{templates/minimal → template}/src/core.ts +1 -1
- package/template/src/schema.decl.ts +12 -0
- package/examples/linkly/oke.config.ts +0 -10
- package/examples/linkly/package.json +0 -15
- package/examples/linkly/src/app.ts +0 -21
- package/examples/linkly/src/core.ts +0 -4
- package/examples/linkly/src/flows/analytics/index.ts +0 -24
- package/examples/linkly/src/flows/links/index.ts +0 -59
- package/examples/linkly/src/flows/links/shapes.ts +0 -22
- package/examples/linkly/src/flows/links/signals.ts +0 -13
- package/examples/linkly/src/gates.ts +0 -8
- package/examples/linkly/src/schema.ts +0 -17
- package/examples/linkly/tests/linkly.test.ts +0 -19
- package/examples/notes/oke.config.ts +0 -14
- package/examples/notes/package.json +0 -16
- package/examples/notes/src/app.ts +0 -13
- package/examples/notes/src/core.ts +0 -4
- package/examples/notes/src/flows/notes/index.ts +0 -44
- package/examples/notes/src/schema.ts +0 -9
- package/examples/notes/tests/notes.test.ts +0 -10
- package/examples/provisions/oke.config.ts +0 -17
- package/examples/provisions/package.json +0 -15
- package/examples/provisions/src/app.ts +0 -60
- package/examples/provisions/src/channels.ts +0 -14
- package/examples/provisions/src/core.ts +0 -4
- package/examples/provisions/src/flows/notifications/index.ts +0 -19
- package/examples/provisions/src/flows/orders/index.ts +0 -70
- package/examples/provisions/src/flows/orders/shapes.ts +0 -21
- package/examples/provisions/src/flows/orders/signals.ts +0 -19
- package/examples/provisions/src/flows/payments/index.ts +0 -37
- package/examples/provisions/src/flows/payments/shapes.ts +0 -3
- package/examples/provisions/src/flows/payments/stripe.ts +0 -18
- package/examples/provisions/src/gates.ts +0 -4
- package/examples/provisions/src/locales/ar.ts +0 -1
- package/examples/provisions/src/locales/en.ts +0 -1
- package/examples/provisions/src/plugins/audit-schema.ts +0 -2
- package/examples/provisions/src/plugins/audit.ts +0 -14
- package/examples/provisions/src/schema.ts +0 -16
- package/examples/provisions/src/vault.ts +0 -16
- package/examples/provisions/tests/orders.test.ts +0 -18
- package/examples/skyport/evals/triage.jsonl +0 -1
- package/examples/skyport/oke.config.ts +0 -44
- package/examples/skyport/oke.images.lock +0 -4
- package/examples/skyport/package.json +0 -16
- package/examples/skyport/src/ai.ts +0 -25
- package/examples/skyport/src/app.ts +0 -57
- package/examples/skyport/src/channels.ts +0 -12
- package/examples/skyport/src/core.ts +0 -4
- package/examples/skyport/src/flows/bookings/index.ts +0 -50
- package/examples/skyport/src/flows/bookings/shapes.ts +0 -6
- package/examples/skyport/src/flows/bookings/signals.ts +0 -9
- package/examples/skyport/src/flows/notifications/index.ts +0 -16
- package/examples/skyport/src/flows/payments/index.ts +0 -14
- package/examples/skyport/src/flows/payments/shapes.ts +0 -5
- package/examples/skyport/src/flows/support/index.ts +0 -38
- package/examples/skyport/src/flows/users/elements.ts +0 -2
- package/examples/skyport/src/flows/users/index.ts +0 -12
- package/examples/skyport/src/flows/users/shapes.ts +0 -6
- package/examples/skyport/src/gates.ts +0 -10
- package/examples/skyport/src/journeys.ts +0 -9
- package/examples/skyport/src/locales/ar.ts +0 -4
- package/examples/skyport/src/locales/en.ts +0 -4
- package/examples/skyport/src/plugins/audit-schema.ts +0 -7
- package/examples/skyport/src/plugins/audit.ts +0 -14
- package/examples/skyport/src/plugins/panel.tsx +0 -4
- package/examples/skyport/src/schema.ts +0 -22
- package/examples/skyport/src/vault.ts +0 -24
- package/examples/skyport/tests/support.test.ts +0 -16
- package/src/sync-templates.ts +0 -86
- package/templates/full/README.md +0 -49
- package/templates/full/oke.config.ts +0 -68
- package/templates/full/package.json +0 -15
- package/templates/full/src/ai.ts +0 -11
- package/templates/full/src/app.ts +0 -34
- package/templates/full/src/channels.ts +0 -9
- package/templates/full/src/core.ts +0 -4
- package/templates/full/src/flows/main/index.ts +0 -45
- package/templates/full/src/flows/main/shapes.ts +0 -3
- package/templates/full/src/flows/main/signals.ts +0 -8
- package/templates/full/src/gates.ts +0 -4
- package/templates/full/src/locales/ar.ts +0 -3
- package/templates/full/src/locales/en.ts +0 -3
- package/templates/full/src/schema.ts +0 -8
- package/templates/full/src/vault.ts +0 -9
- package/templates/full/tests/full.test.ts +0 -11
- package/templates/hello/README.md +0 -38
- package/templates/hello/oke.config.ts +0 -3
- package/templates/hello/package.json +0 -14
- package/templates/hello/src/app.ts +0 -10
- package/templates/hello/src/flows/hello/index.ts +0 -27
- package/templates/hello/tests/hello.test.ts +0 -10
- package/templates/minimal/README.md +0 -41
- package/templates/minimal/oke.config.ts +0 -14
- package/templates/minimal/package.json +0 -15
- package/templates/minimal/src/app.ts +0 -13
- package/templates/minimal/src/flows/main/index.ts +0 -49
- package/templates/minimal/src/schema.ts +0 -8
- package/templates/minimal/tests/minimal.test.ts +0 -13
- package/templates/standard/README.md +0 -47
- package/templates/standard/src/core.ts +0 -4
- package/templates/standard/src/schema.ts +0 -9
- /package/{templates/standard → template}/src/app.ts +0 -0
- /package/{templates/standard → template}/src/channels.ts +0 -0
- /package/{templates/standard → template}/src/flows/main/index.ts +0 -0
- /package/{templates/standard → template}/src/flows/main/shapes.ts +0 -0
- /package/{templates/standard → template}/src/flows/main/signals.ts +0 -0
- /package/{templates/standard → template}/src/gates.ts +0 -0
- /package/{templates/standard → template}/src/locales/ar.ts +0 -0
- /package/{templates/standard → template}/src/locales/en.ts +0 -0
- /package/{templates/standard → template}/src/vault.ts +0 -0
- /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,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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|