create-oke 0.9.0 → 0.10.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.
Files changed (56) hide show
  1. package/README.md +7 -5
  2. package/package.json +2 -3
  3. package/src/agents-md.ts +1 -1
  4. package/src/ai-setup/apply.ts +66 -23
  5. package/src/ai-setup/catalog.ts +1316 -35
  6. package/src/ai-setup/detect-ollama.ts +48 -0
  7. package/src/ai-setup/from-pref.ts +32 -0
  8. package/src/ai-setup/prompts.ts +430 -486
  9. package/src/ai-setup/recommend.ts +118 -101
  10. package/src/cli.test.ts +36 -7
  11. package/src/cli.ts +21 -16
  12. package/src/customize-flow.test.ts +43 -13
  13. package/src/customize-flow.ts +136 -61
  14. package/src/drivers-catalog.ts +29 -12
  15. package/src/local-okengine.test.ts +59 -0
  16. package/src/local-okengine.ts +137 -0
  17. package/src/scaffold.ts +1 -1
  18. package/src/transform.test.ts +54 -32
  19. package/src/transform.ts +46 -9
  20. package/src/wizard-select.ts +5 -6
  21. package/templates/advanced/.github/workflows/ci.yml +24 -0
  22. package/templates/advanced/.vscode/settings.json +15 -0
  23. package/templates/advanced/README.md +15 -4
  24. package/templates/advanced/drizzle.config.ts +6 -4
  25. package/templates/advanced/oke.config.ts +6 -2
  26. package/templates/advanced/package.json +5 -2
  27. package/templates/advanced/src/app.ts +2 -14
  28. package/templates/advanced/src/core/index.ts +12 -0
  29. package/templates/advanced/src/{core.ts → core/store.ts} +1 -1
  30. package/templates/advanced/src/db/migrations/.gitkeep +0 -0
  31. package/templates/{standard/src → advanced/src/db}/schema.decl.ts +1 -1
  32. package/templates/advanced/src/{seed → db/seed}/index.ts +2 -2
  33. package/templates/advanced/src/flows/notes/index.ts +2 -4
  34. package/templates/advanced/tests/advanced.test.ts +10 -9
  35. package/templates/advanced/tsconfig.json +23 -0
  36. package/templates/standard/.github/workflows/ci.yml +24 -0
  37. package/templates/standard/.vscode/settings.json +15 -0
  38. package/templates/standard/README.md +20 -9
  39. package/templates/standard/drizzle.config.ts +6 -4
  40. package/templates/standard/oke.config.ts +4 -0
  41. package/templates/standard/package.json +5 -2
  42. package/templates/standard/src/app.ts +2 -14
  43. package/templates/standard/src/core/index.ts +12 -0
  44. package/templates/standard/src/{core.ts → core/store.ts} +1 -1
  45. package/templates/standard/src/db/migrations/.gitkeep +0 -0
  46. package/templates/{advanced/src → standard/src/db}/schema.decl.ts +1 -1
  47. package/templates/standard/src/{seed → db/seed}/index.ts +2 -2
  48. package/templates/standard/src/flows/notes/index.ts +2 -4
  49. package/templates/standard/tests/standard.test.ts +13 -10
  50. package/templates/standard/tsconfig.json +23 -0
  51. /package/templates/advanced/src/{channels.ts → core/channels.ts} +0 -0
  52. /package/templates/advanced/src/{gates.ts → core/gates.ts} +0 -0
  53. /package/templates/advanced/src/{vault.ts → core/vault.ts} +0 -0
  54. /package/templates/standard/src/{channels.ts → core/channels.ts} +0 -0
  55. /package/templates/standard/src/{gates.ts → core/gates.ts} +0 -0
  56. /package/templates/standard/src/{vault.ts → core/vault.ts} +0 -0
@@ -152,6 +152,13 @@ export async function detectOllama(
152
152
  };
153
153
  }
154
154
 
155
+ /** Detected host hardware for the Ollama banner. */
156
+ export type MachineInfo = {
157
+ readonly osName: string;
158
+ readonly cpuCount: number | null;
159
+ readonly ramGb: number | null;
160
+ };
161
+
155
162
  /**
156
163
  * Best-effort total system RAM in GB.
157
164
  */
@@ -178,3 +185,44 @@ export function detectTotalRamGb(): number | null {
178
185
  }
179
186
  return null;
180
187
  }
188
+
189
+ /**
190
+ * Best-effort OS name · CPU count · RAM for the Ollama banner.
191
+ */
192
+ export function detectMachineInfo(): MachineInfo {
193
+ const osName =
194
+ process.platform === "darwin"
195
+ ? "macOS"
196
+ : process.platform === "linux"
197
+ ? "Linux"
198
+ : process.platform === "win32"
199
+ ? "Windows"
200
+ : process.platform;
201
+
202
+ let cpuCount: number | null = null;
203
+ try {
204
+ if (process.platform === "darwin") {
205
+ const proc = Bun.spawnSync(["sysctl", "-n", "hw.ncpu"], { stdout: "pipe" });
206
+ if (proc.exitCode === 0) {
207
+ const n = Number(proc.stdout.toString().trim());
208
+ if (Number.isFinite(n) && n > 0) cpuCount = n;
209
+ }
210
+ } else if (typeof navigator !== "undefined" && "hardwareConcurrency" in navigator) {
211
+ const n = Number(navigator.hardwareConcurrency);
212
+ if (Number.isFinite(n) && n > 0) cpuCount = n;
213
+ }
214
+ } catch {
215
+ // ignore
216
+ }
217
+ if (cpuCount === null) {
218
+ try {
219
+ // Bun / Node expose this on process when available
220
+ const n = (process as { availableParallelism?: () => number }).availableParallelism?.();
221
+ if (typeof n === "number" && Number.isFinite(n) && n > 0) cpuCount = n;
222
+ } catch {
223
+ // ignore
224
+ }
225
+ }
226
+
227
+ return { osName, cpuCount, ramGb: detectTotalRamGb() };
228
+ }
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import type { CreateAiPref } from "../create-defaults.ts";
6
+ import { LLAMA_CPP_IMAGE } from "../drivers-catalog.ts";
6
7
  import type { AiSetupApplyInput } from "./apply.ts";
7
8
 
8
9
  /**
@@ -63,6 +64,16 @@ export function aiPrefWithModels(
63
64
  * @param provider - Menu id
64
65
  */
65
66
  export function nonInteractiveAiApply(provider: string): AiSetupApplyInput {
67
+ if (provider === "llama-cpp") {
68
+ return {
69
+ driver: "openai-compatible",
70
+ baseUrl: process.env.OKE_AI_URL ?? "http://127.0.0.1:8080/v1",
71
+ chatModel: "smollm2",
72
+ visionModel: null,
73
+ embedModel: null,
74
+ image: LLAMA_CPP_IMAGE,
75
+ };
76
+ }
66
77
  if (provider === "ollama") {
67
78
  return {
68
79
  driver: "ollama",
@@ -70,6 +81,27 @@ export function nonInteractiveAiApply(provider: string): AiSetupApplyInput {
70
81
  chatModel: "gemma4:e4b",
71
82
  visionModel: "qwen3-vl:4b",
72
83
  embedModel: "nomic-embed-text",
84
+ image: "ollama/ollama:0.32.6",
85
+ };
86
+ }
87
+ if (provider === "vllm") {
88
+ return {
89
+ driver: "openai-compatible",
90
+ baseUrl: process.env.OKE_AI_URL ?? "http://127.0.0.1:8000/v1",
91
+ chatModel: "Qwen/Qwen3-0.6B",
92
+ visionModel: null,
93
+ embedModel: null,
94
+ image: "vllm/vllm-openai:v0.26.0",
95
+ };
96
+ }
97
+ if (provider === "sglang") {
98
+ return {
99
+ driver: "openai-compatible",
100
+ baseUrl: process.env.OKE_AI_URL ?? "http://127.0.0.1:30000/v1",
101
+ chatModel: "Qwen/Qwen3-0.6B",
102
+ visionModel: null,
103
+ embedModel: null,
104
+ image: "lmsysorg/sglang:v0.5.16-runtime",
73
105
  };
74
106
  }
75
107
  if (provider === "anthropic") {