Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander Whitestone
8cdae49f48 fix(#553): eliminate hardcoded home-directory paths in Phase-6 infrastructure scripts
Some checks failed
Agent PR Gate / gate (pull_request) Failing after 1m2s
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 27s
Smoke Test / smoke (pull_request) Failing after 28s
Agent PR Gate / report (pull_request) Successful in 12s
Migrates hardcoded ~/.timmy, ~/.config, and Path.home() references across
the autonomous infrastructure stack to use environment variables with
sensible defaults:

- scripts/autonomous_issue_creator.py:
  - DEFAULT_TOKEN_FILE → XDG_CONFIG_HOME fallback
  - DEFAULT_FAILOVER_STATUS → TIMMY_HOME fallback

- scripts/failover_monitor.py:
  - STATUS_FILE → TIMMY_HOME fallback

- scripts/dynamic_dispatch_optimizer.py:
  - STATUS_FILE, SPEC_FILE, OUTPUT_FILE → TIMMY_HOME fallback

- scripts/backlog_cleanup.py:
  - token path → XDG_CONFIG_HOME fallback

- scripts/backlog_triage.py:
  - TOKEN_PATH → XDG_CONFIG_HOME fallback

- scripts/burn_lane_issue_audit.py:
  - DEFAULT_TOKEN_PATH → XDG_CONFIG_HOME fallback

- scripts/cross-repo-qa.py:
  - GITEA_TOKEN_PATH → XDG_CONFIG_HOME fallback

This makes the Phase-6 buildings (self-healing fleet, autonomous issue
creation, community pipeline, global mesh) portable across different
user accounts and deployment environments.
2026-04-22 03:05:16 -04:00
7 changed files with 12 additions and 10 deletions

View File

@@ -18,8 +18,8 @@ from urllib import request
DEFAULT_BASE_URL = "https://forge.alexanderwhitestone.com/api/v1"
DEFAULT_OWNER = "Timmy_Foundation"
DEFAULT_REPO = "timmy-home"
DEFAULT_TOKEN_FILE = Path.home() / ".config" / "gitea" / "token"
DEFAULT_FAILOVER_STATUS = Path.home() / ".timmy" / "failover_status.json"
DEFAULT_TOKEN_FILE = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "gitea" / "token"
DEFAULT_FAILOVER_STATUS = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "failover_status.json"
DEFAULT_RESTART_STATE_DIR = Path("/var/lib/timmy/restarts")
DEFAULT_HEARTBEAT_FILE = Path("/var/lib/timmy/heartbeats/fleet_health.last")

View File

@@ -18,7 +18,7 @@ from pathlib import Path
def get_token():
f = Path.home() / ".config" / "gitea" / "token"
f = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "gitea" / "token"
if f.exists():
return f.read_text().strip()
return os.environ.get("GITEA_TOKEN", "")

View File

@@ -15,7 +15,7 @@ from typing import Any, Dict, List
# Configuration
GITEA_BASE = "https://forge.alexanderwhitestone.com/api/v1"
TOKEN_PATH = os.path.expanduser("~/.config/gitea/token")
TOKEN_PATH = os.path.join(os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), "gitea", "token")
ORG = "Timmy_Foundation"
REPO = "timmy-home"

View File

@@ -13,7 +13,7 @@ from urllib.request import Request, urlopen
API_BASE = "https://forge.alexanderwhitestone.com/api/v1"
ORG = "Timmy_Foundation"
DEFAULT_TOKEN_PATH = os.path.expanduser("~/.config/gitea/token")
DEFAULT_TOKEN_PATH = os.path.join(os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), "gitea", "token")
@dataclass(frozen=True)

View File

@@ -27,7 +27,7 @@ from pathlib import Path
import re
GITEA_URL = "https://forge.alexanderwhitestone.com"
GITEA_TOKEN_PATH = Path.home() / ".config" / "gitea" / "token"
GITEA_TOKEN_PATH = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "gitea" / "token"
ORG = "Timmy_Foundation"
REPOS = [

View File

@@ -12,12 +12,14 @@ from __future__ import annotations
import argparse
import json
import os
from pathlib import Path
from typing import Any
STATUS_FILE = Path.home() / ".timmy" / "failover_status.json"
SPEC_FILE = Path.home() / ".timmy" / "fleet_dispatch.json"
OUTPUT_FILE = Path.home() / ".timmy" / "dispatch_plan.json"
TIMMY_HOME = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy"))
STATUS_FILE = TIMMY_HOME / "failover_status.json"
SPEC_FILE = TIMMY_HOME / "fleet_dispatch.json"
OUTPUT_FILE = TIMMY_HOME / "dispatch_plan.json"
def load_json(path: Path, default: Any):

View File

@@ -13,7 +13,7 @@ FLEET = {
"bezalel": "167.99.126.228"
}
STATUS_FILE = Path.home() / ".timmy" / "failover_status.json"
STATUS_FILE = Path(os.environ.get("TIMMY_HOME", Path.home() / ".timmy")) / "failover_status.json"
def check_health(host):
try: