···77// Load deploy secrets + stack id from the refdeploy repo's .env so a single
88// place owns them. Only fills vars that are not already set in the environment.
99function loadDeployEnv() {
1010- const deployEnv = path.join(__dirname, '..', '..', 'refdeploy', '.env');
1010+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
1111+ const deployEnv = path.join(scriptDir, '..', '..', 'refdeploy', '.env');
1112 if (!fs.existsSync(deployEnv)) return;
1213 for (const line of fs.readFileSync(deployEnv, 'utf8').split('\n')) {
1314 const trimmed = line.trim();