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.
- package/README.md +7 -5
- package/package.json +2 -3
- package/src/agents-md.ts +1 -1
- package/src/ai-setup/apply.ts +66 -23
- package/src/ai-setup/catalog.ts +1316 -35
- package/src/ai-setup/detect-ollama.ts +48 -0
- package/src/ai-setup/from-pref.ts +32 -0
- package/src/ai-setup/prompts.ts +430 -486
- package/src/ai-setup/recommend.ts +118 -101
- package/src/cli.test.ts +36 -7
- package/src/cli.ts +21 -16
- package/src/customize-flow.test.ts +43 -13
- package/src/customize-flow.ts +136 -61
- package/src/drivers-catalog.ts +29 -12
- package/src/local-okengine.test.ts +59 -0
- package/src/local-okengine.ts +137 -0
- package/src/scaffold.ts +1 -1
- package/src/transform.test.ts +54 -32
- package/src/transform.ts +46 -9
- package/src/wizard-select.ts +5 -6
- package/templates/advanced/.github/workflows/ci.yml +24 -0
- package/templates/advanced/.vscode/settings.json +15 -0
- package/templates/advanced/README.md +15 -4
- package/templates/advanced/drizzle.config.ts +6 -4
- package/templates/advanced/oke.config.ts +6 -2
- package/templates/advanced/package.json +5 -2
- package/templates/advanced/src/app.ts +2 -14
- package/templates/advanced/src/core/index.ts +12 -0
- package/templates/advanced/src/{core.ts → core/store.ts} +1 -1
- package/templates/advanced/src/db/migrations/.gitkeep +0 -0
- package/templates/{standard/src → advanced/src/db}/schema.decl.ts +1 -1
- package/templates/advanced/src/{seed → db/seed}/index.ts +2 -2
- package/templates/advanced/src/flows/notes/index.ts +2 -4
- package/templates/advanced/tests/advanced.test.ts +10 -9
- package/templates/advanced/tsconfig.json +23 -0
- package/templates/standard/.github/workflows/ci.yml +24 -0
- package/templates/standard/.vscode/settings.json +15 -0
- package/templates/standard/README.md +20 -9
- package/templates/standard/drizzle.config.ts +6 -4
- package/templates/standard/oke.config.ts +4 -0
- package/templates/standard/package.json +5 -2
- package/templates/standard/src/app.ts +2 -14
- package/templates/standard/src/core/index.ts +12 -0
- package/templates/standard/src/{core.ts → core/store.ts} +1 -1
- package/templates/standard/src/db/migrations/.gitkeep +0 -0
- package/templates/{advanced/src → standard/src/db}/schema.decl.ts +1 -1
- package/templates/standard/src/{seed → db/seed}/index.ts +2 -2
- package/templates/standard/src/flows/notes/index.ts +2 -4
- package/templates/standard/tests/standard.test.ts +13 -10
- package/templates/standard/tsconfig.json +23 -0
- /package/templates/advanced/src/{channels.ts → core/channels.ts} +0 -0
- /package/templates/advanced/src/{gates.ts → core/gates.ts} +0 -0
- /package/templates/advanced/src/{vault.ts → core/vault.ts} +0 -0
- /package/templates/standard/src/{channels.ts → core/channels.ts} +0 -0
- /package/templates/standard/src/{gates.ts → core/gates.ts} +0 -0
- /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") {
|