fix: allow experimental flags to override umbrella (#29273)

This commit is contained in:
Aiden Cline
2026-05-25 16:42:34 -05:00
committed by GitHub
parent d595e472b3
commit 633b5d6208
3 changed files with 24 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import { Config, ConfigProvider, Context, Effect, Layer } from "effect"
import { Config, ConfigProvider, Context, Effect, Layer, Option } from "effect"
import { ConfigService } from "@/effect/config-service"
const bool = (name: string) => Config.boolean(name).pipe(Config.withDefault(false))
@@ -9,7 +9,9 @@ const positiveInteger = (name: string) =>
)
const experimental = bool("OPENCODE_EXPERIMENTAL")
const enabledByExperimental = (name: string) =>
Config.all({ experimental, enabled: bool(name) }).pipe(Config.map((flags) => flags.experimental || flags.enabled))
Config.all({ experimental, enabled: Config.boolean(name).pipe(Config.option) }).pipe(
Config.map((flags) => Option.getOrElse(flags.enabled, () => flags.experimental)),
)
export class Service extends ConfigService.Service<Service>()("@opencode/RuntimeFlags", {
autoShare: bool("OPENCODE_AUTO_SHARE"),