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
+4 -3
View File
@@ -3,9 +3,10 @@ import type { InstanceContext } from "../project/instance"
import { Filesystem } from "@/util/filesystem"
import { Process } from "@/util/process"
import { which } from "../util/which"
import { Flag } from "@opencode-ai/core/flag/flag"
export interface Context extends Pick<InstanceContext, "directory" | "worktree"> {}
export interface Context extends Pick<InstanceContext, "directory" | "worktree"> {
experimentalOxfmt: boolean
}
export interface Info {
name: string
@@ -90,7 +91,7 @@ export const oxfmt: Info = {
},
extensions: [".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx", ".mts", ".cts"],
async enabled(context) {
if (!Flag.OPENCODE_EXPERIMENTAL_OXFMT) return false
if (!context.experimentalOxfmt) return false
const items = await Filesystem.findUp("package.json", context.directory, context.worktree)
for (const item of items) {
const json = await Filesystem.readJson<{