chore(config): pin @types/bun, tighten TypeScript strictness, and refactor config logic

- Pin `@types/bun` to `^1.3.14` for reproducible builds instead of using `latest`
- Update `tsconfig.json` with stricter type-checking flags and reorganize compiler options
- Refactor `initConfig` to DRY up the model default logic and add a null guard before process exit
This commit is contained in:
mitchell 2026-05-26 19:27:41 -04:00
parent d98ddb3ca7
commit f668037582
5 changed files with 39 additions and 26 deletions

View file

@ -23,17 +23,20 @@ export async function initConfig(old: AppConfig | null): Promise<AppConfig> {
if (isCancel(baseURL)) process.exit(1);
const models = await getModels(baseURL);
const initialValue = models.includes(old?.model ?? "")
? old?.model
: models[0];
const model = await autocomplete({
message: "Choose a default model:",
initialValue: models.includes(old?.model ?? "") ? old?.model : models[0],
placeholder: models.includes(old?.model ?? "") ? old?.model : models[0],
initialValue,
placeholder: initialValue ?? "Start typing...",
options: models.map((model) => ({ value: model })),
validate: (value) =>
models.includes(typeof value === "string" ? value : "")
? undefined
: `Unable to find model "${value}"`,
});
if (isCancel(model)) process.exit(1);
if (!model || isCancel(model)) process.exit(1);
const config = { baseURL, model } satisfies AppConfig;