{"version":3,"file":"env-vars.d.ts","sourceRoot":"","sources":["../../src/core/env-vars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAEvG;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAGzF;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG7E","sourcesContent":["/**\n * Branded environment variables.\n *\n * phi reads its own `PHI_*` variables — the tool is `phi`, its config lives in\n * `.phi`, and it already shipped `PHI_DEBUG`, `PHI_DISABLE_*` and `PHI_SANDBOX_*`.\n * The inherited `PI_*` names stay accepted as a fallback so a script or shell\n * profile written against upstream pi keeps working, and writers set both.\n *\n * The brand is derived from `APP_NAME`, so a rebranded distribution gets its own\n * prefix without touching call sites.\n *\n * `config.ts` imports this module, so the prefix is read INSIDE the functions and\n * never at module scope: evaluating `APP_NAME` while the cycle is still\n * initialising throws \"Cannot access 'APP_NAME' before initialization\".\n */\n\nimport { APP_NAME } from \"../config.ts\";\n\nconst LEGACY_PREFIX = \"PI_\";\n\n/** Canonical variable name for a suffix, e.g. \"OFFLINE\" -> \"PHI_OFFLINE\". */\nexport function brandedEnvName(suffix: string): string {\n\treturn `${APP_NAME.toUpperCase()}_${suffix}`;\n}\n\n/** Inherited upstream name for a suffix, e.g. \"OFFLINE\" -> \"PI_OFFLINE\". */\nexport function legacyEnvName(suffix: string): string {\n\treturn `${LEGACY_PREFIX}${suffix}`;\n}\n\n/** Read `PHI_<suffix>`, falling back to the inherited `PI_<suffix>`. */\nexport function readBrandedEnv(suffix: string, env: NodeJS.ProcessEnv = process.env): string | undefined {\n\treturn env[brandedEnvName(suffix)] ?? env[legacyEnvName(suffix)];\n}\n\n/** Set both the branded and the inherited name, for values handed to child processes. */\nexport function setBrandedEnv(env: NodeJS.ProcessEnv, suffix: string, value: string): void {\n\tenv[brandedEnvName(suffix)] = value;\n\tenv[legacyEnvName(suffix)] = value;\n}\n\n/** Delete both names, used before repopulating a child environment. */\nexport function deleteBrandedEnv(env: NodeJS.ProcessEnv, suffix: string): void {\n\tdelete env[brandedEnvName(suffix)];\n\tdelete env[legacyEnvName(suffix)];\n}\n"]}