refactor(format): move oxfmt flag to runtime flags (#27608)

This commit is contained in:
Shoubhit Dash
2026-05-15 03:03:37 +05:30
committed by GitHub
parent 304d7d846d
commit 87f89f8ab7
5 changed files with 52 additions and 6 deletions
+8 -2
View File
@@ -5,6 +5,7 @@ import { InstanceState } from "@/effect/instance-state"
import path from "path"
import { mergeDeep } from "remeda"
import { Config } from "@/config/config"
import { RuntimeFlags } from "@/effect/runtime-flags"
import { errorMessage } from "@/util/error"
import * as Log from "@opencode-ai/core/util/log"
import * as Formatter from "./formatter"
@@ -31,6 +32,7 @@ export const layer = Layer.effect(
Effect.gen(function* () {
const config = yield* Config.Service
const appProcess = yield* AppProcess.Service
const flags = yield* RuntimeFlags.Service
const state = yield* InstanceState.make(
Effect.fn("Format.state")(function* (ctx) {
@@ -40,7 +42,7 @@ export const layer = Layer.effect(
async function getCommand(item: Formatter.Info) {
let cmd = commands[item.name]
if (cmd === false || cmd === undefined) {
cmd = await item.enabled(ctx)
cmd = await item.enabled({ ...ctx, experimentalOxfmt: flags.experimentalOxfmt })
commands[item.name] = cmd
}
return cmd
@@ -198,6 +200,10 @@ export const layer = Layer.effect(
}),
)
export const defaultLayer = layer.pipe(Layer.provide(Config.defaultLayer), Layer.provide(AppProcess.defaultLayer))
export const defaultLayer = layer.pipe(
Layer.provide(Config.defaultLayer),
Layer.provide(AppProcess.defaultLayer),
Layer.provide(RuntimeFlags.defaultLayer),
)
export * as Format from "."