You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/cli/ui/presets.ts defines the three model bundles (auto / flash / pro) and two pure helpers — resolvePreset and canonicalPresetName — used wherever the CLI maps a preset name to model + reasoning settings. The helpers also keep three legacy aliases alive (fast → flash+high, smart → auto, max → pro) so older config.json files don't break.
There are zero tests for this file. A drift on the alias table or a typo in the legacy mapping would silently change every user's session settings — exactly the kind of thing a small unit-test file pins down forever.
Current state
src/cli/ui/presets.ts (~80 lines) — pure functions only, no I/O, no React
tests/presets.test.ts — does not exist
Expected behaviour
A new tests/presets.test.ts exercising the public surface:
resolvePreset("auto") / "flash" / "pro" — returns the canonical bundle
resolvePreset("fast") — returns flash but with reasoningEffort: "high" (alias rewires effort)
resolvePreset("smart") — returns the auto bundle byte-for-byte
resolvePreset("max") — returns the pro bundle byte-for-byte
resolvePreset(undefined) and unknown names — fall through to auto
canonicalPresetName(...) — only returns "auto" | "flash" | "pro"; legacy and unknown values normalize to "auto"
Branch / harvest invariant — every preset has harvest: false and branch: 1 (the project rule that branch and harvest are NEVER auto-enabled)
Files to touch
tests/presets.test.ts (new, ~50-80 lines)
Acceptance criteria
All 6+ behaviours above covered with it(...) blocks
An invariant test asserts that every entry in PRESETS has harvest === false && branch === 1 (so the rule is enforced even if a future preset is added)
Background
src/cli/ui/presets.tsdefines the three model bundles (auto/flash/pro) and two pure helpers —resolvePresetandcanonicalPresetName— used wherever the CLI maps a preset name to model + reasoning settings. The helpers also keep three legacy aliases alive (fast→flash+high,smart→auto,max→pro) so olderconfig.jsonfiles don't break.There are zero tests for this file. A drift on the alias table or a typo in the legacy mapping would silently change every user's session settings — exactly the kind of thing a small unit-test file pins down forever.
Current state
src/cli/ui/presets.ts(~80 lines) — pure functions only, no I/O, no Reacttests/presets.test.ts— does not existExpected behaviour
A new
tests/presets.test.tsexercising the public surface:resolvePreset("auto")/"flash"/"pro"— returns the canonical bundleresolvePreset("fast")— returns flash but withreasoningEffort: "high"(alias rewires effort)resolvePreset("smart")— returns the auto bundle byte-for-byteresolvePreset("max")— returns the pro bundle byte-for-byteresolvePreset(undefined)and unknown names — fall through to autocanonicalPresetName(...)— only returns"auto" | "flash" | "pro"; legacy and unknown values normalize to"auto"harvest: falseandbranch: 1(the project rule that branch and harvest are NEVER auto-enabled)Files to touch
tests/presets.test.ts(new, ~50-80 lines)Acceptance criteria
it(...)blocksPRESETShasharvest === false && branch === 1(so the rule is enforced even if a future preset is added)npm run verifypassesHints
tests/clipboard.test.ts(closed via Add unit tests forsrc/cli/ui/clipboard.ts#18) for the shape of a small pure-function test file in this repo.describe("resolvePreset", () => { ... })/describe("canonicalPresetName", () => { ... })blocks.for (const [name, p] of Object.entries(PRESETS))+ a singleexpect(p.harvest).toBe(false)plusexpect(p.branch).toBe(1).PresetNamefromconfig.tsif you don't need it — the helpers acceptstring | undefinedsemantically; cast at the call site.Out of scope
Difficulty
2 hours.