From c720479f497da3d226b9894f95b465ac07e1ad6d Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sun, 12 Jul 2026 11:28:39 +0100 Subject: [PATCH 1/2] feat: add pre-commit-check script to run repo/system/global pre-commit hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves which pre-commit hook to use — repo's own .git/hooks/pre-commit, then system core.hooksPath, then global core.hooksPath — and runs it with --all-files. Prompt: can you create me a script, in the development folder a that will run the pre-commit... however there's a wrinkle. if the CWD is in a repo, and that repo has pre-commit configured we should run repo's pre-commit (if configured). Otherwise we should look for the system pre-commit or the global pre-commit and run that. each pre-commit should run the ``pre-commit --all-files``. Any questions? --- development/pre-commit-check | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 development/pre-commit-check diff --git a/development/pre-commit-check b/development/pre-commit-check new file mode 100755 index 00000000..542cf7bb --- /dev/null +++ b/development/pre-commit-check @@ -0,0 +1,46 @@ +#! /bin/sh + +die() { + if [ -t 2 ]; then + printf '\n\033[31m✗\033[0m %s\n' "$*" >&2 + else + printf '\n✗ %s\n' "$*" >&2 + fi + exit 1 +} + +success() { + if [ -t 1 ]; then + printf '\n\033[32m✓\033[0m %s\n' "$*" + else + printf '\n✓ %s\n' "$*" + fi +} + +info() { + if [ -t 1 ]; then + printf '\n\033[32m→\033[0m %s\n' "$*" + else + printf '\n→ %s\n' "$*" + fi +} + +# Same check at every level: does /pre-commit exist and is it +# executable? Tried in order: repo's own hooks folder, system, global. +hook_in() { + [ -n "$1" ] && [ -x "$1/pre-commit" ] && printf '%s/pre-commit\n' "$1" +} + +GIT_DIR=$(git rev-parse --absolute-git-dir 2>/dev/null) +REPO_HOOKS_DIR="" +[ -n "$GIT_DIR" ] && REPO_HOOKS_DIR="$GIT_DIR/hooks" +HOOK=$(hook_in "$REPO_HOOKS_DIR") + +[ -n "$HOOK" ] || HOOK=$(hook_in "$(git config --system --get core.hooksPath 2>/dev/null)") +[ -n "$HOOK" ] || HOOK=$(hook_in "$(git config --global --get core.hooksPath 2>/dev/null)") + +[ -n "$HOOK" ] || die "No pre-commit hook found in the repo's hooks folder, system hooksPath, or global hooksPath" + +info "Running $HOOK --all-files" +"$HOOK" --all-files || die "pre-commit hook failed" +success "Pre-commit checks passed" From 6ef4e12cc76be39811aa0f6b31078dae856e4d30 Mon Sep 17 00:00:00 2001 From: Mark Ridgwell Date: Sun, 12 Jul 2026 11:46:41 +0100 Subject: [PATCH 2/2] fix: resolve markdownlint issues flagged by pre-commit-check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit README.md had two top-level H1 headings (Git, Ethereum) — demoted to H2 so the doc has a single title. db/README.md was missing blank lines around headings/lists/fences and language identifiers on fenced blocks. Prompt: run the pre-commit-check and fix the issues until its clean --- README.md | 6 +++--- db/README.md | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3aeaa082..1684a20d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # General Development Scripts -# Git +## Git Helper/Setup/Template scripts for working with git. @@ -9,7 +9,7 @@ Helper/Setup/Template scripts for working with git. -# Ethereum +## Ethereum Helper/Setup/Template scripts for working with Ethereum/Ethereum clients @@ -22,4 +22,4 @@ Helper/Setup/Template scripts for working with Ethereum/Ethereum clients - \ No newline at end of file + diff --git a/db/README.md b/db/README.md index 288ab262..e8676ad7 100644 --- a/db/README.md +++ b/db/README.md @@ -3,10 +3,12 @@ ## Prerequisites ## Linux + * docker needs to be installed * sqlcmd needs to be installed e.g. ``yay -Sy mssql-tools`` ### Mac OS X + * docker needs to be installed * sqlcmd needs to be installed see [mssql-tools](https://ports.macports.org/port/mssql-tools/) @@ -21,9 +23,10 @@ [1] Assumes appropriate license for Redgate SQLCompare These scripts use the following files: + * ``~/.database`` - file containing properties for talking to mssql -``` +```text SERVER=localhost USER=sa PASSWORD=NotTellingYou! @@ -33,9 +36,10 @@ Note: if SERVER is set as localhost then the local docker instance will be used * ``Repo/.database`` => file containing the DatabaseName for synchronising -``` +```text DB=MyDatabaseName ``` + ### Common Command line parameters * ``--server servername`` - overrides the server name in ~/.database @@ -51,21 +55,27 @@ DB=MyDatabaseName * Uses ~/.database to set get the connection details for the database Usage: + ```bash ./install-mssql --data /home/mssql ``` ### ``createmssqldb`` + * Creates a named database reading ``Repo/.database`` for DB name and ``~/.database`` for connection details ### ``updatedb`` + * Updates a named database reading ``Repo/.database`` for DB name and ``~/.database`` for connection details reading the db schema from ``Repo/db`` folder. ### ``extractdb`` + * Saves a named database reading ``Repo/.database`` for DB name and ``~/.database`` for connection details saving the db schema from ``Repo/db`` folder. Note: + * this does not update the content of static data tables ### ``dbappsettings`` + * Creates\updates appsettings-local.json in each project with the connection string to the DB