From ec58c9c8439e9e22c8e85452b82263c60d2d35ca Mon Sep 17 00:00:00 2001 From: Hikari Date: Mon, 23 Feb 2026 20:18:41 -0800 Subject: [PATCH] feat: reorganise bash scripts and add comprehensive documentation (#6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This PR completes the bash script restructuring and adds comprehensive documentation across all script categories. ### Bash Restructuring - Moved cohort shell scripts (`remove_github_members.sh`, `update_github_teams.sh`) from `python/cohort/` into a new `bash/cohort/` directory - Moved existing bash utilities (`add-keys-to-git.sh`, `fix-yubikey-perms.sh`, `list-yubikey-ssh-keys.sh`) into a new `bash/yubikey/` subdirectory - Updated `run.sh` to support **Bash** as a third language option alongside TypeScript and Python - Bash scripts are run directly (no 1Password secret injection needed) - Category discovery and script listing works the same as for TS/Python - Removed dead "Root Scripts" logic that was no longer needed ### Documentation Added `README.md` files for all script categories that were missing them: - `bash/cohort/README.md` — cohort GitHub team management scripts - `bash/yubikey/README.md` — YubiKey SSH key and permission utilities - `typescript/src/crowdin/README.md` — Crowdin translation management scripts - `typescript/src/discord/README.md` — Discord bot utility scripts - `typescript/src/discourse/README.md` — Discourse forum management scripts - `typescript/src/gitea/README.md` — Gitea bulk repository operation scripts - `typescript/src/github/README.md` — GitHub API interaction scripts - `typescript/src/music/README.md` — Music file metadata tools - `typescript/src/s3/README.md` — S3-compatible object storage scripts - `typescript/src/security/README.md` — Security analysis and reporting scripts - `python/cohort/README.md` — Updated to remove moved shell scripts, fix usage commands Also updated project-level docs: - **`README.md`** — Corrected project structure, fixed running instructions (removed references to non-existent `make run-ts`/`make run-py` targets), added Bash prerequisites - **`CLAUDE.md`** — Updated project overview, structure, development standards, and script-adding guides to reflect the current state of the project ✨ This PR was created with help from Hikari~ 🌸 Co-authored-by: Naomi Carrigan Reviewed-on: https://git.nhcarrigan.com/nhcarrigan/ephemere/pulls/6 Co-authored-by: Hikari Co-committed-by: Hikari --- CLAUDE.md | 77 +- README.md | 150 ++- bash/cohort/README.md | 75 ++ bash/cohort/remove_github_members.sh | 52 ++ bash/cohort/update_github_teams.sh | 73 ++ bash/yubikey/README.md | 109 +++ bash/{ => yubikey}/add-keys-to-git.sh | 0 bash/{ => yubikey}/fix-yubikey-perms.sh | 0 bash/{ => yubikey}/list-yubikey-ssh-keys.sh | 0 python/cohort/README.md | 883 ++++++++++++++++++ python/cohort/add_github_team_members.py | 20 +- python/cohort/analyse_availability.py | 26 +- python/cohort/assign_cohort_role.py | 5 +- python/cohort/assign_team_roles.py | 5 +- python/cohort/catch_up_report.py | 519 ++++++++++ python/cohort/check_channel_permissions.py | 142 +++ python/cohort/check_lengths.py | 86 ++ python/cohort/check_member_status.py | 49 + python/cohort/discord_activity_checker.py | 22 +- .../cohort/evaluate_technical_proficiency.py | 23 +- python/cohort/fetch_roster.py | 33 + python/cohort/fix_channel_permissions.py | 129 +++ python/cohort/generate_member_files.py | 37 +- python/cohort/generate_timeslots.py | 17 +- python/cohort/get_cohort_members.py | 88 ++ python/cohort/list_all_guild_roles.py | 61 ++ python/cohort/list_discord_roles.py | 48 + python/cohort/remove_discord_roles.py | 116 +++ python/cohort/remove_member.py | 247 +++++ python/cohort/remove_resigned_members.py | 63 ++ python/cohort/send_activity_report.py | 178 ++++ python/cohort/send_checkin.py | 97 ++ python/cohort/send_team_checkin.py | 104 +++ python/cohort/send_team_messages.py | 25 +- python/cohort/update_roster_messages.py | 103 ++ python/cohort/verify_discord.py | 22 +- python/pyproject.toml | 2 + python/requirements.txt | 3 +- run.sh | 28 +- typescript/src/crowdin/README.md | 125 +++ .../src/crowdin/clearHiddenTranslations.ts | 11 + typescript/src/crowdin/reapplyTranslations.ts | 8 + typescript/src/discord/README.md | 87 ++ typescript/src/discord/cycThreads.ts | 6 + typescript/src/discord/guildCount.ts | 10 + typescript/src/discourse/README.md | 84 ++ .../src/discourse/bulkUpdateCategories.ts | 8 + typescript/src/discourse/closeOldTopics.ts | 7 + typescript/src/gitea/README.md | 124 +++ typescript/src/gitea/deleteFromAllRepos.ts | 6 + typescript/src/gitea/uploadToAllRepos.ts | 7 + .../src/gitea/uploadToReposConditionally.ts | 7 + typescript/src/github/README.md | 124 +++ typescript/src/github/auditNpmPackages.ts | 8 + typescript/src/github/onboardMentee.ts | 8 + typescript/src/github/postUserStories.ts | 7 + typescript/src/music/README.md | 48 + typescript/src/music/id3v2.ts | 6 + typescript/src/s3/README.md | 163 ++++ typescript/src/s3/bulkUpload.ts | 9 + typescript/src/s3/correctContentType.ts | 8 + typescript/src/s3/deleteContents.ts | 8 + typescript/src/s3/upload.ts | 8 + typescript/src/security/README.md | 53 ++ typescript/src/security/generateReport.ts | 7 + 65 files changed, 4507 insertions(+), 157 deletions(-) create mode 100644 bash/cohort/README.md create mode 100755 bash/cohort/remove_github_members.sh create mode 100755 bash/cohort/update_github_teams.sh create mode 100644 bash/yubikey/README.md rename bash/{ => yubikey}/add-keys-to-git.sh (100%) rename bash/{ => yubikey}/fix-yubikey-perms.sh (100%) rename bash/{ => yubikey}/list-yubikey-ssh-keys.sh (100%) create mode 100644 python/cohort/README.md create mode 100644 python/cohort/catch_up_report.py create mode 100644 python/cohort/check_channel_permissions.py create mode 100644 python/cohort/check_lengths.py create mode 100644 python/cohort/check_member_status.py create mode 100644 python/cohort/fetch_roster.py create mode 100644 python/cohort/fix_channel_permissions.py create mode 100644 python/cohort/get_cohort_members.py create mode 100644 python/cohort/list_all_guild_roles.py create mode 100644 python/cohort/list_discord_roles.py create mode 100644 python/cohort/remove_discord_roles.py create mode 100644 python/cohort/remove_member.py create mode 100644 python/cohort/remove_resigned_members.py create mode 100644 python/cohort/send_activity_report.py create mode 100644 python/cohort/send_checkin.py create mode 100644 python/cohort/send_team_checkin.py create mode 100644 python/cohort/update_roster_messages.py create mode 100644 typescript/src/crowdin/README.md create mode 100644 typescript/src/discord/README.md create mode 100644 typescript/src/discourse/README.md create mode 100644 typescript/src/gitea/README.md create mode 100644 typescript/src/github/README.md create mode 100644 typescript/src/music/README.md create mode 100644 typescript/src/s3/README.md create mode 100644 typescript/src/security/README.md diff --git a/CLAUDE.md b/CLAUDE.md index 6d24e56..66dafe7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,32 +4,37 @@ This document contains project-specific instructions for working with the Epheme ## Project Overview -Ephemere is a collection of ephemeral scripts for various tasks, written in TypeScript and Python. It contains utilities for: +Ephemere is a collection of ephemeral scripts for various tasks, written in TypeScript, Python, and Bash. It contains utilities for: - S3 operations (upload, bulk upload, delete, content type correction) - Discord bot utilities - Discourse forum management - Gitea/GitHub operations - Security analysis tools - Music-related scripts -- Various utility functions +- Cohort programme management (Python + Bash) +- YubiKey SSH key and permission utilities (Bash) ## Project Structure ``` ephemere/ ├── typescript/ # TypeScript scripts -│ ├── src/ -│ │ ├── s3/ # S3 operations (upload, delete, bulk operations) -│ │ ├── discord/ # Discord bot and utilities -│ │ ├── discourse/ # Discourse forum management -│ │ ├── gitea/ # Gitea API interactions -│ │ ├── github/ # GitHub API interactions -│ │ ├── security/ # Security analysis tools -│ │ ├── music/ # Music-related utilities -│ │ └── utils/ # Shared utilities -│ └── data/ # Data files for S3 uploads -├── python/ # Python scripts -└── prod.env # 1Password vault references (safe to commit) +│ └── src/ +│ ├── s3/ # S3 operations (upload, delete, bulk operations) +│ ├── discord/ # Discord bot and utilities +│ ├── discourse/ # Discourse forum management +│ ├── gitea/ # Gitea API interactions +│ ├── github/ # GitHub API interactions +│ ├── security/ # Security analysis tools +│ ├── music/ # Music-related utilities +│ └── utils/ # Shared utilities +├── python/ +│ └── cohort/ # Cohort programme management scripts +├── bash/ +│ ├── cohort/ # GitHub team management for cohorts +│ └── yubikey/ # YubiKey SSH key and permission utilities +├── data/ # Input/output data files (gitignored) +└── prod.env # 1Password vault references (safe to commit) ``` ## Development Standards @@ -37,13 +42,20 @@ ephemere/ ### TypeScript Scripts - All TypeScript scripts must follow Naomi's Node.js project standards - Use `@nhcarrigan/typescript-config` and `@nhcarrigan/eslint-config` -- Run scripts using the Makefile: `make run-ts src/path/to/script.ts` +- Run scripts using the interactive runner: `make run` (select TypeScript → category → script) - Interactive scripts should use `@inquirer/prompts` for user input ### Python Scripts - Use `uv` for package management - Linting and formatting with `ruff` -- Run scripts using the Makefile: `make run-py script_name.py` +- Scripts live in subdirectories of `python/` (e.g. `python/cohort/`) +- Run scripts using the interactive runner: `make run` (select Python → category → script) + +### Bash Scripts +- Scripts live in subdirectories of `bash/` (e.g. `bash/cohort/`, `bash/yubikey/`) +- Run scripts using the interactive runner: `make run` (select Bash → category → script) +- Or run directly: `bash bash//