Add readme generator with pre-commit hook

Shell script scrapes @name/@description from userscripts and builds
a table in README.md between marker comments. Pre-commit hook runs
it automatically so the table stays in sync.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jeirmeister 2026-04-07 12:34:37 -07:00
parent a9094dbb1b
commit 7166f534ca
3 changed files with 41 additions and 0 deletions

9
README.md Normal file
View file

@ -0,0 +1,9 @@
# Tampermonkey Scripts
Personal collection of userscripts. Click **Install** to add to Tampermonkey.
<!-- SCRIPTS:START -->
| Script | Description | |
|--------|-------------|-|
| **IHSS Timesheet Autofill** | Auto-populate IHSS timesheet hours with random distribution | [Install](https://git.jeirslab.xyz/jeirmeister/tampermonkey-scripts/raw/branch/master/scripts/ihss-autofill.user.js) |
<!-- SCRIPTS:END -->

30
generate-readme.sh Normal file
View file

@ -0,0 +1,30 @@
#!/bin/bash
# Updates the scripts table in README.md between SCRIPTS:START and SCRIPTS:END markers.
# Scrapes @name and @description from each .user.js file in scripts/
REPO_RAW_BASE="https://git.jeirslab.xyz/jeirmeister/tampermonkey-scripts/raw/branch/master"
README="README.md"
# Build the table
TABLE="| Script | Description | |
|--------|-------------|-|"
for script in scripts/*.user.js; do
[ -f "$script" ] || continue
name=$(grep -m1 '@name' "$script" | sed 's/.*@name\s*//')
desc=$(grep -m1 '@description' "$script" | sed 's/.*@description\s*//')
raw_url="${REPO_RAW_BASE}/${script}"
TABLE="${TABLE}
| **${name}** | ${desc} | [Install](${raw_url}) |"
done
# Replace everything between the markers
awk -v table="$TABLE" '
/<!-- SCRIPTS:START -->/ { print; print table; skip=1; next }
/<!-- SCRIPTS:END -->/ { skip=0 }
!skip { print }
' "$README" > "${README}.tmp" && mv "${README}.tmp" "$README"
echo "Updated $README"

View file

@ -7,6 +7,8 @@
// @grant GM_getValue
// @grant GM_setValue
// @run-at document-idle
// @downloadURL https://git.jeirslab.xyz/jeirmeister/tampermonkey-scripts/raw/branch/master/scripts/ihss-autofill.user.js
// @updateURL https://git.jeirslab.xyz/jeirmeister/tampermonkey-scripts/raw/branch/master/scripts/ihss-autofill.user.js
// ==/UserScript==
(function () {