create-oke 0.10.3 → 0.11.0
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 +2 -2
- package/package.json +2 -2
- package/src/ai-setup/apply.ts +113 -17
- package/src/ai-setup/catalog.ts +3 -3
- package/src/ai-setup/from-pref.ts +1 -1
- package/src/ai-setup/prompts.ts +1 -1
- package/src/cli.test.ts +183 -142
- package/src/cli.ts +190 -32
- package/src/create-defaults.test.ts +21 -15
- package/src/create-defaults.ts +33 -13
- package/src/customize-flow.test.ts +30 -35
- package/src/customize-flow.ts +68 -229
- package/src/drivers-catalog.ts +42 -48
- package/src/local-okengine.test.ts +50 -41
- package/src/local-okengine.ts +28 -14
- package/src/locales.test.ts +128 -0
- package/src/locales.ts +321 -0
- package/src/scaffold.ts +277 -33
- package/src/templates.ts +2 -8
- package/src/transform.test.ts +96 -36
- package/src/transform.ts +285 -110
- package/templates/advanced/.env.example +23 -3
- package/templates/advanced/README.md +1 -1
- package/templates/advanced/drizzle.config.ts +10 -13
- package/templates/advanced/oke.config.ts +12 -57
- package/templates/advanced/package.json +3 -1
- package/templates/advanced/src/app.ts +3 -10
- package/templates/advanced/src/core.ts +58 -0
- package/templates/advanced/src/db/schema.decl.ts +1 -1
- package/templates/advanced/src/db/seed/index.ts +2 -2
- package/templates/advanced/src/flows/notes/index.ts +1 -13
- package/templates/advanced/src/locales/index.ts +6 -0
- package/templates/advanced/tests/advanced.test.ts +1 -1
- package/templates/standard/.env.example +23 -3
- package/templates/standard/README.md +1 -1
- package/templates/standard/drizzle.config.ts +10 -13
- package/templates/standard/oke.config.ts +10 -56
- package/templates/standard/package.json +3 -1
- package/templates/standard/src/app.ts +3 -10
- package/templates/standard/src/core.ts +55 -0
- package/templates/standard/src/db/schema.decl.ts +1 -1
- package/templates/standard/src/db/seed/index.ts +2 -2
- package/templates/standard/src/flows/notes/index.ts +1 -10
- package/templates/standard/src/locales/index.ts +6 -0
- package/templates/standard/tests/standard.test.ts +1 -1
- package/templates/advanced/src/core/channels.ts +0 -13
- package/templates/advanced/src/core/gates.ts +0 -12
- package/templates/advanced/src/core/index.ts +0 -12
- package/templates/advanced/src/core/store.ts +0 -8
- package/templates/advanced/src/core/vault.ts +0 -7
- package/templates/advanced/src/locales/ar.ts +0 -18
- package/templates/standard/src/core/channels.ts +0 -13
- package/templates/standard/src/core/gates.ts +0 -12
- package/templates/standard/src/core/index.ts +0 -12
- package/templates/standard/src/core/store.ts +0 -5
- package/templates/standard/src/core/vault.ts +0 -7
- package/templates/standard/src/locales/ar.ts +0 -18
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { channel } from "okengine";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
const mail = channel.email({ from: "Notes <notes@localhost>" });
|
|
5
|
-
|
|
6
|
-
/** Email when a note is created (console driver locally · SMTP in docker). */
|
|
7
|
-
export const noteCreatedMail = mail.template("note-created", {
|
|
8
|
-
locales: ["en", "ar"],
|
|
9
|
-
schema: z.object({
|
|
10
|
-
id: z.string(),
|
|
11
|
-
title: z.string(),
|
|
12
|
-
}),
|
|
13
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { gate } from "okengine";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Starter keeps HTTP public. Replace with real policies when you add auth:
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* export const canWriteNotes = gate.policy("notes:write", ({ auth }) =>
|
|
8
|
-
* auth.scopes.has("notes:write"),
|
|
9
|
-
* );
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export const notesWrite = gate.policy("notes:write", () => true);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core wiring — stores, gates, vault, channels (and AI when configured).
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { db, files } from "./store";
|
|
6
|
-
export { notesWrite } from "./gates";
|
|
7
|
-
export { webhookSecret } from "./vault";
|
|
8
|
-
export { noteCreatedMail } from "./channels";
|
|
9
|
-
|
|
10
|
-
import "./gates";
|
|
11
|
-
import "./vault";
|
|
12
|
-
import "./channels";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { store } from "okengine";
|
|
2
|
-
import * as schema from "@/db/schema.decl";
|
|
3
|
-
|
|
4
|
-
/** App SQL store — tables from {@link schema}. */
|
|
5
|
-
export const db = store.sql("app", { schema });
|
|
6
|
-
|
|
7
|
-
/** Object storage for note attachments (fs locally · s3 in docker). */
|
|
8
|
-
export const files = store.files("uploads");
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { vault } from "okengine";
|
|
2
|
-
|
|
3
|
-
/** Shared webhook HMAC secret — prove Vault wiring on note create. */
|
|
4
|
-
export const webhookSecret = vault.secret("APP_WEBHOOK_SECRET", {
|
|
5
|
-
description: "HMAC secret for outbound note webhooks",
|
|
6
|
-
dev: "dev-webhook-secret-change-me",
|
|
7
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineLocale } from "okengine";
|
|
2
|
-
import type { MessagesFor } from "okengine";
|
|
3
|
-
import type { en } from "./en";
|
|
4
|
-
|
|
5
|
-
const ar = {
|
|
6
|
-
errors: {
|
|
7
|
-
notFound: "غير موجود",
|
|
8
|
-
unauthorized: "غير مصرح",
|
|
9
|
-
},
|
|
10
|
-
notes: {
|
|
11
|
-
created: "تم إنشاء الملاحظة «{title}».",
|
|
12
|
-
archived: "تم أرشفة الملاحظة.",
|
|
13
|
-
empty: "لا توجد ملاحظات نشطة بعد.",
|
|
14
|
-
count: "{count, plural, zero {لا ملاحظات} one {ملاحظة واحدة} two {ملاحظتان} few {# ملاحظات} many {# ملاحظة} other {# ملاحظة}}",
|
|
15
|
-
},
|
|
16
|
-
} satisfies MessagesFor<typeof en>;
|
|
17
|
-
|
|
18
|
-
defineLocale("ar", ar);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { channel } from "okengine";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
const mail = channel.email({ from: "Notes <notes@localhost>" });
|
|
5
|
-
|
|
6
|
-
/** Email when a note is created (console driver locally · SMTP in docker). */
|
|
7
|
-
export const noteCreatedMail = mail.template("note-created", {
|
|
8
|
-
locales: ["en", "ar"],
|
|
9
|
-
schema: z.object({
|
|
10
|
-
id: z.string(),
|
|
11
|
-
title: z.string(),
|
|
12
|
-
}),
|
|
13
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { gate } from "okengine";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Starter keeps HTTP public. Replace with real policies when you add auth:
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* export const canWriteNotes = gate.policy("notes:write", ({ auth }) =>
|
|
8
|
-
* auth.scopes.has("notes:write"),
|
|
9
|
-
* );
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export const notesWrite = gate.policy("notes:write", () => true);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core wiring — stores, gates, vault, channels (and AI when configured).
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { db } from "./store";
|
|
6
|
-
export { notesWrite } from "./gates";
|
|
7
|
-
export { webhookSecret } from "./vault";
|
|
8
|
-
export { noteCreatedMail } from "./channels";
|
|
9
|
-
|
|
10
|
-
import "./gates";
|
|
11
|
-
import "./vault";
|
|
12
|
-
import "./channels";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { vault } from "okengine";
|
|
2
|
-
|
|
3
|
-
/** Shared webhook HMAC secret — prove Vault wiring on note create. */
|
|
4
|
-
export const webhookSecret = vault.secret("APP_WEBHOOK_SECRET", {
|
|
5
|
-
description: "HMAC secret for outbound note webhooks",
|
|
6
|
-
dev: "dev-webhook-secret-change-me",
|
|
7
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineLocale } from "okengine";
|
|
2
|
-
import type { MessagesFor } from "okengine";
|
|
3
|
-
import type { en } from "./en";
|
|
4
|
-
|
|
5
|
-
const ar = {
|
|
6
|
-
errors: {
|
|
7
|
-
notFound: "غير موجود",
|
|
8
|
-
unauthorized: "غير مصرح",
|
|
9
|
-
},
|
|
10
|
-
notes: {
|
|
11
|
-
created: "تم إنشاء الملاحظة «{title}».",
|
|
12
|
-
archived: "تم أرشفة الملاحظة.",
|
|
13
|
-
empty: "لا توجد ملاحظات نشطة بعد.",
|
|
14
|
-
count: "{count, plural, zero {لا ملاحظات} one {ملاحظة واحدة} two {ملاحظتان} few {# ملاحظات} many {# ملاحظة} other {# ملاحظة}}",
|
|
15
|
-
},
|
|
16
|
-
} satisfies MessagesFor<typeof en>;
|
|
17
|
-
|
|
18
|
-
defineLocale("ar", ar);
|