fix(core): keep lenient env grammar for config-backed layers

This commit is contained in:
Kit Langton 2026-07-02 09:20:23 -04:00
commit ca318328ea
5 changed files with 66 additions and 35 deletions

View file

@ -1,10 +1,24 @@
import { Config } from "effect"
export function truthy(key: string) {
const value = process.env[key]?.toLowerCase()
return value === "true" || value === "1"
function truthyValue(value: string) {
const lower = value.toLowerCase()
return lower === "true" || lower === "1"
}
export function truthy(key: string) {
const value = process.env[key]
return value !== undefined && truthyValue(value)
}
/**
* The `truthy` grammar read through Effect Config, so layer builds can be
* steered by a ConfigProvider. Missing or malformed values are false, exactly
* like `truthy`; strict boolean decoding would turn a stray env value into a
* startup defect.
*/
export const truthyConfig = (name: string) =>
Config.string(name).pipe(Config.map(truthyValue), Config.withDefault(false))
const copy = process.env["OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"]
const fff = process.env["OPENCODE_DISABLE_FFF"]