Skip to content

refactor(kilo-auto-model): replace string-keyed maps with zod enums#1749

Merged
chrarnoldus merged 2 commits intomainfrom
refactor/kilo-auto-model-zod-enum
Mar 31, 2026
Merged

refactor(kilo-auto-model): replace string-keyed maps with zod enums#1749
chrarnoldus merged 2 commits intomainfrom
refactor/kilo-auto-model-zod-enum

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot bot commented Mar 30, 2026

Summary

  • Introduced modeSchema (z.enum) for the mode routing keys used in FRONTIER_MODE_TO_MODEL and BALANCED_MODE_TO_MODEL, replacing Record<string, ...> with Record<Mode, ...>
  • Introduced legacyModelIdSchema (z.enum) for legacy model IDs, replacing Record<string, AutoModel | undefined> with a fully-typed Record<..., AutoModel>
  • All Object.hasOwn(...) guard hacks are eliminated; membership is now checked via z.enum.safeParse()

Verification

  • Manual code review; pnpm typecheck could not run in the local environment (tsgo not installed), but the types are straightforwardly correct: Record<Mode, ...> requires all enum members be present (exhaustive), and safeParse returns a discriminated union that narrows the key type.

Visual Changes

N/A

Reviewer Notes

KILO_AUTO_FREE_MODEL_DEPRECATED is now typed as z.infer<typeof legacyModelIdSchema> (i.e. 'kilo/auto' | 'kilo/auto-free') rather than plain string, which is strictly more precise. Callers that compare it with === are unaffected.

@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot bot commented Mar 30, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • src/lib/kilo-auto-model.ts

@kilo-code-bot kilo-code-bot bot force-pushed the refactor/kilo-auto-model-zod-enum branch from cb5d74f to 21e70e4 Compare March 30, 2026 20:44
@kilo-code-bot kilo-code-bot bot force-pushed the refactor/kilo-auto-model-zod-enum branch from 21e70e4 to 399aae4 Compare March 30, 2026 20:46
@chrarnoldus chrarnoldus merged commit e2e2d46 into main Mar 31, 2026
14 checks passed
@chrarnoldus chrarnoldus deleted the refactor/kilo-auto-model-zod-enum branch March 31, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants