From f077398c5da7371e0f49974b4c7540e4f2b45490 Mon Sep 17 00:00:00 2001 From: Jarvis Prime Date: Wed, 4 Mar 2026 04:42:28 +0000 Subject: [PATCH] Add .env loading to all scripts (simulate_merge, refresh_stale, mcp_server) --- mcp_server.py | 10 ++++++++++ refresh_stale.py | 10 ++++++++++ simulate_merge.py | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/mcp_server.py b/mcp_server.py index 221fe80..772817b 100644 --- a/mcp_server.py +++ b/mcp_server.py @@ -3,6 +3,16 @@ import os import sys import json +from pathlib import Path + +# Load .env if present +_env_file = Path(__file__).parent / ".env" +if _env_file.exists(): + for line in _env_file.read_text().splitlines(): + line = line.strip() + if line and not line.startswith("#") and "=" in line: + key, _, val = line.partition("=") + os.environ.setdefault(key.strip(), val.strip()) sys.path.insert(0, os.path.dirname(__file__)) diff --git a/refresh_stale.py b/refresh_stale.py index 9d02706..8e1184e 100644 --- a/refresh_stale.py +++ b/refresh_stale.py @@ -2,6 +2,16 @@ import sys import os +from pathlib import Path + +# Load .env if present +_env_file = Path(__file__).parent / ".env" +if _env_file.exists(): + for line in _env_file.read_text().splitlines(): + line = line.strip() + if line and not line.startswith("#") and "=" in line: + key, _, val = line.partition("=") + os.environ.setdefault(key.strip(), val.strip()) sys.path.insert(0, os.path.dirname(__file__)) diff --git a/simulate_merge.py b/simulate_merge.py index 6297071..008a44c 100644 --- a/simulate_merge.py +++ b/simulate_merge.py @@ -3,6 +3,16 @@ import sys import os import time +from pathlib import Path + +# Load .env if present +_env_file = Path(__file__).parent / ".env" +if _env_file.exists(): + for line in _env_file.read_text().splitlines(): + line = line.strip() + if line and not line.startswith("#") and "=" in line: + key, _, val = line.partition("=") + os.environ.setdefault(key.strip(), val.strip()) sys.path.insert(0, os.path.dirname(__file__))