From 7166f534caf005c9ea90830dd30f6e571004b420 Mon Sep 17 00:00:00 2001 From: jeirmeister Date: Tue, 7 Apr 2026 12:34:37 -0700 Subject: [PATCH] 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) --- README.md | 9 +++++++++ generate-readme.sh | 30 ++++++++++++++++++++++++++++++ scripts/ihss-autofill.user.js | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 README.md create mode 100644 generate-readme.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..afd7c4f --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Tampermonkey Scripts + +Personal collection of userscripts. Click **Install** to add to Tampermonkey. + + +| 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) | + diff --git a/generate-readme.sh b/generate-readme.sh new file mode 100644 index 0000000..83b1974 --- /dev/null +++ b/generate-readme.sh @@ -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" ' + // { print; print table; skip=1; next } + // { skip=0 } + !skip { print } +' "$README" > "${README}.tmp" && mv "${README}.tmp" "$README" + +echo "Updated $README" diff --git a/scripts/ihss-autofill.user.js b/scripts/ihss-autofill.user.js index 6ded565..ef35465 100644 --- a/scripts/ihss-autofill.user.js +++ b/scripts/ihss-autofill.user.js @@ -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 () {