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
9 changes: 9 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ if git stripspace --strip-comments <"${msg_file}" | grep -qiE 'bump version'; th
echo " (Not blocking this commit; the release build enforces it at tag time.)" >&2
fi
fi

# The writing standard covers a commit message like any other artifact, and the pre-commit hook
# beside this one reads only the staged files. Reports and never blocks, like the check above.
prose_check="${repo_root}/src/usr/share/ai-tools/skills/ai-tools-technical-docs/prose-check.py"
if command -v python3 >/dev/null 2>&1 && [[ -r "${prose_check}" ]]; then
if ! python3 "${prose_check}" --message "${msg_file}" >&2; then
echo " (not blocking this commit)" >&2
fi
fi
26 changes: 26 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-only
# pre-commit hook: report the prose figures the ai-tools-technical-docs skill rules out, in the
# lines this commit ADDS. Reuses the checker the skill ships (prose-check.py beside its
# SKILL.md), so the hook and a full pass apply one set of patterns.
#
# Never blocks, matching the commit-msg reminder beside it: the default checks report correct
# prose occasionally, and a hook that refuses a commit over a style call is a hook developers
# turn off. It reports, the author decides.
#
# Only the added lines are read, so the ~650 findings already in the tree stay out of every
# commit until a sweep addresses them.
#
# Not installed automatically -- enable once per clone with `make -C packaging hooks`
# (sets core.hooksPath to .githooks).
set -euo pipefail

command -v python3 >/dev/null 2>&1 || exit 0
repo_root="$(git rev-parse --show-toplevel)"
checker="${repo_root}/src/usr/share/ai-tools/skills/ai-tools-technical-docs/prose-check.py"
[[ -r "${checker}" ]] || exit 0

if ! python3 "${checker}" --staged; then
echo " (not blocking this commit)" >&2
fi
exit 0
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ See the root `README.md`'s manual install steps if you're working without the RP

Optional, recommended for regular contributors:

make -C packaging hooks # enable the local git hooks (a non-blocking changelog reminder)
make -C packaging hooks # enable the local git hooks (non-blocking reminders)

A per-clone developer opt-in: it sets `core.hooksPath` to `.githooks` and quiets git's
ignored-hook advice for sandbox-account commits. None of this ships in the RPM — the
ignored-hook advice for sandbox-account commits. Two hooks come with it, and neither blocks a
commit: a `commit-msg` changelog reminder, and a `pre-commit` prose report over the lines the
commit adds (`prose-check.py`, shipped with the `ai-tools-technical-docs` skill). None of this ships in the RPM — the
package builds only from `src/`, `docs/`, the spec, and the compiled policy.

## Running the tests
Expand Down
6 changes: 4 additions & 2 deletions packaging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ check-version:
changelog:
@bash $(CURDIR)/changelog-draft.sh

# Opt in (once per clone) to the local git hooks in .githooks -- currently a non-blocking
# commit-msg reminder to complete the %changelog on a "bump version" commit. Also silence
# Opt in (once per clone) to the local git hooks in .githooks -- a non-blocking commit-msg
# reminder to complete the %changelog on a "bump version" commit, and a non-blocking pre-commit
# report of the prose figures the ai-tools-technical-docs skill rules out in the lines a commit
# adds. Also silence
# git's ignored-hook advice: the sandbox account commits under the SELinux ai_tools_t domain,
# which has no execute on the project-tree ai_tools_project_t label, so git skips the hook and
# nags about it on every agent commit. That skip is the confinement working (the operator, who
Expand Down
Loading