create-oke 0.1.4

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 (74) hide show
  1. package/package.json +36 -0
  2. package/src/cli.test.ts +110 -0
  3. package/src/cli.ts +156 -0
  4. package/src/index.ts +8 -0
  5. package/src/scaffold.ts +160 -0
  6. package/src/sync-templates.ts +65 -0
  7. package/src/templates.ts +85 -0
  8. package/src/transform.ts +124 -0
  9. package/templates/linkly/oke.config.ts +10 -0
  10. package/templates/linkly/package.json +15 -0
  11. package/templates/linkly/src/app.ts +21 -0
  12. package/templates/linkly/src/core.ts +4 -0
  13. package/templates/linkly/src/flows/analytics/index.ts +24 -0
  14. package/templates/linkly/src/flows/links/index.ts +59 -0
  15. package/templates/linkly/src/flows/links/shapes.ts +22 -0
  16. package/templates/linkly/src/flows/links/signals.ts +13 -0
  17. package/templates/linkly/src/gates.ts +8 -0
  18. package/templates/linkly/src/schema.ts +17 -0
  19. package/templates/linkly/tests/linkly.test.ts +19 -0
  20. package/templates/notes/oke.config.ts +7 -0
  21. package/templates/notes/package.json +16 -0
  22. package/templates/notes/src/app.ts +13 -0
  23. package/templates/notes/src/core.ts +4 -0
  24. package/templates/notes/src/flows/notes/index.ts +44 -0
  25. package/templates/notes/src/schema.ts +9 -0
  26. package/templates/notes/tests/notes.test.ts +10 -0
  27. package/templates/provisions/oke.config.ts +17 -0
  28. package/templates/provisions/package.json +15 -0
  29. package/templates/provisions/src/app.ts +60 -0
  30. package/templates/provisions/src/channels.ts +14 -0
  31. package/templates/provisions/src/core.ts +4 -0
  32. package/templates/provisions/src/flows/notifications/index.ts +19 -0
  33. package/templates/provisions/src/flows/orders/index.ts +70 -0
  34. package/templates/provisions/src/flows/orders/shapes.ts +21 -0
  35. package/templates/provisions/src/flows/orders/signals.ts +19 -0
  36. package/templates/provisions/src/flows/payments/index.ts +37 -0
  37. package/templates/provisions/src/flows/payments/shapes.ts +3 -0
  38. package/templates/provisions/src/flows/payments/stripe.ts +18 -0
  39. package/templates/provisions/src/gates.ts +4 -0
  40. package/templates/provisions/src/locales/ar.ts +1 -0
  41. package/templates/provisions/src/locales/en.ts +1 -0
  42. package/templates/provisions/src/plugins/audit-schema.ts +2 -0
  43. package/templates/provisions/src/plugins/audit.ts +14 -0
  44. package/templates/provisions/src/schema.ts +16 -0
  45. package/templates/provisions/src/vault.ts +16 -0
  46. package/templates/provisions/tests/orders.test.ts +18 -0
  47. package/templates/skyport/evals/triage.jsonl +1 -0
  48. package/templates/skyport/oke.config.ts +44 -0
  49. package/templates/skyport/oke.images.lock +4 -0
  50. package/templates/skyport/package.json +16 -0
  51. package/templates/skyport/src/ai.ts +25 -0
  52. package/templates/skyport/src/app.ts +57 -0
  53. package/templates/skyport/src/channels.ts +12 -0
  54. package/templates/skyport/src/core.ts +4 -0
  55. package/templates/skyport/src/flows/bookings/index.ts +50 -0
  56. package/templates/skyport/src/flows/bookings/shapes.ts +6 -0
  57. package/templates/skyport/src/flows/bookings/signals.ts +9 -0
  58. package/templates/skyport/src/flows/notifications/index.ts +16 -0
  59. package/templates/skyport/src/flows/payments/index.ts +14 -0
  60. package/templates/skyport/src/flows/payments/shapes.ts +5 -0
  61. package/templates/skyport/src/flows/support/index.ts +38 -0
  62. package/templates/skyport/src/flows/users/elements.ts +2 -0
  63. package/templates/skyport/src/flows/users/index.ts +12 -0
  64. package/templates/skyport/src/flows/users/shapes.ts +6 -0
  65. package/templates/skyport/src/gates.ts +10 -0
  66. package/templates/skyport/src/journeys.ts +9 -0
  67. package/templates/skyport/src/locales/ar.ts +4 -0
  68. package/templates/skyport/src/locales/en.ts +4 -0
  69. package/templates/skyport/src/plugins/audit-schema.ts +7 -0
  70. package/templates/skyport/src/plugins/audit.ts +14 -0
  71. package/templates/skyport/src/plugins/panel.tsx +4 -0
  72. package/templates/skyport/src/schema.ts +22 -0
  73. package/templates/skyport/src/vault.ts +24 -0
  74. package/templates/skyport/tests/support.test.ts +16 -0
@@ -0,0 +1,14 @@
1
+ import { plugin, store } from "okengine";
2
+ import { z } from "zod";
3
+
4
+ export const audit = plugin("audit", { version: "1.0.0" })
5
+ .config(z.object({ retain: z.string().default("2y") }))
6
+ .element(store.sql("audit", { schema: () => import("./audit-schema") }))
7
+ .needs("store.kv")
8
+ .decorate("audit", { enabled: true })
9
+ .hook("afterHandle", async (ctx, fx) => {
10
+ if (ctx.trigger.meta?.audit) await fx.store("audit").log(ctx);
11
+ })
12
+ .errors({ AuditWriteFailed: z.object({ reason: z.string() }) })
13
+ .consolePanel({ id: "audit", title: "Audit Trail", entry: "./panel.tsx" })
14
+ .cli("audit:export", ({ fx }) => fx.store("audit").exportCsv());
@@ -0,0 +1,4 @@
1
+ /** Audit Console panel stub (Skyport tree). */
2
+ export default function AuditPanel() {
3
+ return null;
4
+ }
@@ -0,0 +1,22 @@
1
+ import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
2
+ import { id } from "okengine/store";
3
+
4
+ export const bookings = sqliteTable("bookings", {
5
+ id: text("id").primaryKey().$defaultFn(id),
6
+ userId: text("user_id").notNull(),
7
+ flightId: text("flight_id").notNull(),
8
+ seats: integer("seats").notNull(),
9
+ status: text("status").notNull().default("pending"),
10
+ createdAt: integer("created_at").notNull(),
11
+ });
12
+
13
+ export const flights = sqliteTable("flights", {
14
+ id: text("id").primaryKey(),
15
+ seatsAvailable: integer("seats_available").notNull(),
16
+ });
17
+
18
+ export const tickets = sqliteTable("tickets", {
19
+ id: text("id").primaryKey(), subject: text("subject").notNull(),
20
+ body: text("body").notNull(), urgency: text("urgency"), team: text("team"),
21
+ summary: text("summary"),
22
+ });
@@ -0,0 +1,24 @@
1
+ import { vault } from "okengine";
2
+ import { z } from "zod";
3
+
4
+ export const dbUrl = vault.secret("DATABASE_URL", {
5
+ schema: z.string().url(),
6
+ dev: vault.fromStack("store.sql"),
7
+ });
8
+
9
+ export const dbReplica1 = vault.secret("DATABASE_REPLICA_1", {
10
+ schema: z.string().url(),
11
+ dev: "postgres://localhost/oke-replica",
12
+ });
13
+
14
+ export const anthropicKey = vault.secret("ANTHROPIC_KEY", {
15
+ schema: z.string().min(1),
16
+ dev: "sk-ant-test",
17
+ });
18
+
19
+ export const stripeKey = vault.secret("STRIPE_KEY", {
20
+ schema: z.string().startsWith("sk_"),
21
+ description: "Payments gateway key",
22
+ rotate: "90d",
23
+ dev: "sk_test_local",
24
+ });
@@ -0,0 +1,16 @@
1
+ import { test, expect } from "bun:test";
2
+ import { createTestApp } from "okengine/test";
3
+ import { app } from "../src/app";
4
+ import { triage } from "../src/ai";
5
+
6
+ test("AI triage is mockable and cost-bounded", async () => {
7
+ const t = await createTestApp(app);
8
+ t.ai.mock(triage, { urgency: "high", team: "ops", summary: "seat dispute" });
9
+
10
+ const u = await t.auth.loginAs({});
11
+ const { data } = await t.api.support.createTicket({ subject: "…", body: "…" }, { as: u });
12
+
13
+ expect(data!.urgency).toBe("high");
14
+ expect(t.ai.cost()).toBeLessThan(0.02); // budgets are assertable
15
+ await t.close();
16
+ });