docs: add data file documentation and fix data path resolution

All Python cohort scripts now use DATA_DIR = Path(__file__).parent.parent.parent / "data"
to correctly resolve the repo-root data/ directory regardless of the working directory
set by run.sh. All TypeScript scripts have expanded JSDoc headers documenting data file
requirements and environment variables.
This commit is contained in:
2026-02-23 15:42:03 -08:00
parent 4fdb5d06f1
commit a40188413a
39 changed files with 424 additions and 53 deletions
+9 -6
View File
@@ -18,9 +18,12 @@ import json
import os
import sys
from datetime import datetime, timezone
from pathlib import Path
import aiohttp
DATA_DIR = Path(__file__).parent.parent.parent / "data"
DISCORD_BOT_TOKEN = os.environ["DISCORD_BOT_TOKEN"]
DISCORD_API_BASE = "https://discord.com/api/v10"
DISCORD_GUILD_ID = "692816967895220344"
@@ -71,7 +74,7 @@ class MemberRemover:
def find_member_info(self) -> bool:
"""Find which team the member is on and their role."""
with open("team_assignments.json") as f:
with open(DATA_DIR / "team_assignments.json") as f:
teams = json.load(f)
for team in teams:
@@ -88,7 +91,7 @@ class MemberRemover:
def remove_from_team_assignments(self) -> None:
"""Remove member from team_assignments.json."""
with open("team_assignments.json") as f:
with open(DATA_DIR / "team_assignments.json") as f:
teams = json.load(f)
for team in teams:
@@ -103,19 +106,19 @@ class MemberRemover:
f"✅ Removed from {team['name']} participants in team_assignments.json"
)
with open("team_assignments.json", "w") as f:
with open(DATA_DIR / "team_assignments.json", "w") as f:
json.dump(teams, f, indent=2)
def remove_from_discord_to_github(self) -> None:
"""Remove member from discord_to_github.json."""
with open("discord_to_github.json") as f:
with open(DATA_DIR / "discord_to_github.json") as f:
mappings = json.load(f)
if self.discord_id in mappings:
self.github_username = mappings[self.discord_id]
del mappings[self.discord_id]
with open("discord_to_github.json", "w") as f:
with open(DATA_DIR / "discord_to_github.json", "w") as f:
json.dump(mappings, f, indent=2)
print(f"✅ Removed {self.github_username} from discord_to_github.json")
@@ -135,7 +138,7 @@ class MemberRemover:
async def remove_discord_roles(self) -> None:
"""Remove Discord roles from the member."""
with open("team_message_ids.json") as f:
with open(DATA_DIR / "team_message_ids.json") as f:
team_message_data = json.load(f)
if self.team_name not in team_message_data: