import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; export interface FooterSettings { showCwd: boolean; showBranch: boolean; } // Bundle-level `config/` is the single source of truth: the extension reads // `config/pi-minimal-footer.json` from inside the installed bundle (resolved // relative to this source file), never environment variables. export const FOOTER_CONFIG_PATH = fileURLToPath( new URL("../config/pi-minimal-footer.json", import.meta.url), ); export function readFooterSettings(configPath: string = FOOTER_CONFIG_PATH): FooterSettings { try { const parsed = JSON.parse(readFileSync(configPath, "utf8")) as unknown; const raw = parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? (parsed as Record) : {}; return { showCwd: typeof raw.showCwd === "boolean" ? raw.showCwd : true, showBranch: typeof raw.showBranch === "boolean" ? raw.showBranch : true, }; } catch { return { showCwd: true, showBranch: true }; } }