// The setting keep-main-rules (the operator, 2026-10-23: "disable the gitea branch protection reset thing"): only when it // is true does the module put main's rule right in every repository of the organisation (client.ts ensureMainMerges). // False, the default, leaves every repository's branch protection as people set it at the forge. import { readFileSync } from "node:fs"; /** The setting from the settings-merged config file the mesh delivers; absent, unreadable or not true is false. */ export function keepMainRules(env: NodeJS.ProcessEnv = process.env): boolean { const file = env.MESH_GITEA_CONFIG_FILE; if (!file) return false; try { const v = (JSON.parse(readFileSync(file, "utf8")) as Record)["keep-main-rules"]; return v === true || v === "true"; } catch { return false; } }