Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Pre-commit hooks for Semantic Anchors
# Install: pip install pre-commit
# Setup: pre-commit install
# Run manually: pre-commit run --all-files

repos:
# AsciiDoc Linter
- repo: local
hooks:
- id: asciidoc-linter
name: AsciiDoc Linter
entry: asciidoc-linter
language: system
files: \.adoc$
pass_filenames: true
args: [--format, console]
stages: [commit]

# Trailing whitespace
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: \.(adoc|md)$
- id: end-of-file-fixer
exclude: \.(adoc|md)$
- id: check-yaml
- id: check-json
- id: check-added-large-files
args: [--maxkb=1000]
28 changes: 28 additions & 0 deletions .pre-commit-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Installation script for pre-commit hooks

set -e

echo "Installing pre-commit framework..."

# Check if Python is available
if ! command -v python3 &> /dev/null; then
echo "Error: Python 3 is required"
exit 1
fi

# Install pre-commit
pip install pre-commit

# Install AsciiDoc linter
pip install git+https://github.com/doctoolchain/asciidoc-linter.git

# Install pre-commit hooks
pre-commit install

echo "✓ Pre-commit hooks installed successfully!"
echo ""
echo "Usage:"
echo " - Hooks run automatically on 'git commit'"
echo " - Run manually: pre-commit run --all-files"
echo " - Update hooks: pre-commit autoupdate"
41 changes: 41 additions & 0 deletions CONTRIBUTING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,47 @@ Evaluate the response:
* *Depth:* Does it cover multiple related concepts?
* *Specificity:* Is the scope well-defined?

== Developer Setup

=== Prerequisites

* Git
* Python 3.12+ (for pre-commit hooks)
* Node.js 20+ (for website development, optional)

=== Installing Pre-Commit Hooks

**Required for all contributors!**

Run the installation script:

[source,bash]
----
./pre-commit-install.sh
----

This installs:

* **AsciiDoc Linter** - validates anchor file syntax automatically
* **pre-commit framework** - runs checks before each commit
* **Standard hooks** - trailing whitespace, YAML/JSON validation

=== Manual Hook Execution

Run all hooks on all files:

[source,bash]
----
pre-commit run --all-files
----

Run specific hook:

[source,bash]
----
pre-commit run asciidoc-linter --all-files
----

== How to Propose a New Anchor

We use an *automated workflow with GitHub Copilot* to validate and enrich proposals:
Expand Down
Loading