From 10398290704e99a969aec921bb392af6552b383a Mon Sep 17 00:00:00 2001 From: Denis Chevalier Date: Tue, 11 Aug 2026 01:48:41 +0200 Subject: typo in README.md, add git hook for new typ files SPDX header --- .githooks/pre-commit | 35 +++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 12 ++++++++++-- README.md | 1 + 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 .githooks/pre-commit diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 0000000..7f9d85e --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +HEADER='// SAME Analog Modular Ecosystem +// +// / SPDX-FileCopyrightText: 2026 Denis Chevalier +// / SPDX-License-Identifier: CC-BY-SA-4.0 +// / SPDX-License-Identifier: CERN-OHL-S-2.0+ +// / SPDX-License-Identifier: GPL-3.0-or-later +// +// The prose, explanatory text, rendered figures, tables, and mathematical +// content of this specification are licensed under CC BY-SA 4.0. If a later +// version of CC BY-SA is published, the author grants permission to distribute +// this work under that later version as well. +// +// Hardware designs contained herein (schematics, PCB layouts, mechanical +// drawings, and CAD models) are licensed under CERN-OHL-S-2.0+. +// +// All executable code, helper libraries (`lib/*`), metrology assertions, and +// embedded verification scripts throughout the source documents are licensed +// under the GNU General Public License v3.0 or later (GPL-3.0-or-later).' + +# Find newly added staged .typ files +new_files=$(git diff --cached --name-only --diff-filter=A | grep '\.typ$') + +for file in $new_files; do + if [ -f "$file" ] && ! grep -q "SPDX-FileCopyrightText" "$file"; then + echo "Injecting SPDX header into $file..." + tmpfile=$(mktemp) + echo "$HEADER" > "$tmpfile" + echo "" >> "$tmpfile" + cat "$file" >> "$tmpfile" + mv "$tmpfile" "$file" + git add "$file" + fi +done diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6847e39..331d51e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,15 @@ fails, the PDF build will halt.** cd same ``` -1. **Run a live watch build:** +2. **Enable git hooks:** To automatically inject required SPDX license headers + on newly created `.typ` files: + + ```bash + chmod +x .githooks/pre-commit + git config core.hooksPath .githooks + ``` + +3. **Run a live watch build:** ```bash typst watch preamble.typ specification.pdf @@ -74,7 +82,7 @@ fails, the PDF build will halt.** *If your edits break an assertion metrology check anywhere in the 90+ pages, Typst will throw an immediate compiler error in your terminal.* -2. **Perform a clean release compile:** +4. **Perform a clean release compile:** ```bash typst compile preamble.typ specification.pdf diff --git a/README.md b/README.md index e41527e..67ae748 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ rigorous topological error compensation. ├── preamble.typ # Document entry point & main layout └── LICENSE.md # Comprehensive tri-license legal breakdown └── LICENSES # Actual licences text +``` ## Compiling the Specification -- cgit