-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
99 lines (91 loc) · 4.03 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
99 lines (91 loc) · 4.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Pre-commit hooks — embodies the CI/Hook Parity Principle for this repo.
#
# Every hook below ALSO runs in CI; CI is the authoritative backstop. Local
# hooks are pinned by `rev:` and Renovate bumps them automatically. There is
# a small drift window between a Renovate bump in CI and the local config
# catching up; this is the standard pre-commit pattern.
#
# "Also runs in CI" means the same check, not merely the same tool: same
# flags AND same version. shellcheck is the one that drifted on all three —
# the hook ran at its default severity without `-x` while CI passed
# `-S error -x`, and CI's binary came from apt (Ubuntu 24.04 ships 0.9.0)
# while the hook pins 0.11.0.x. A file CI accepted could therefore be
# uncommittable, and 0.9.0 reports findings 0.11 does not. Both sides now run
# 0.11.0 with `-x` at `style` (see the shellcheck block below and
# validate.yml's pinned download plus its `shellcheck-severity` input).
#
# This repo dogfoods its own hooks (validate-skill, check-version-parity from
# skill-repo-skill itself).
#
# See netresearch/agent-harness-skill references/enforcement-mechanisms.md
# for the CI/Hook Parity Principle in full.
#
# Install once after clone: `pre-commit install` (auto-runs via package.json's
# `prepare` script when contributors run `npm install`).
# Bypass (use sparingly): `git commit --no-verify`. If you need this often,
# the hook is wrong — fix it; don't tolerate the bypass.
default_install_hook_types: [pre-commit]
default_stages: [pre-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
- id: check-added-large-files
- id: check-json
- id: check-yaml
args: [--allow-multiple-documents]
# validate-skill runs from the WORKING COPY, not from the pinned release.
# This repository ships that validator, so pinning it to the last tag means a
# change to it is never exercised by its own pre-commit until after it is
# published -- and a SKILL.md written against the new rules is rejected by the
# old ones, with no way out but weakening the content or bypassing the gate.
# check-version-parity stays pinned: it is not authored against itself.
- repo: local
hooks:
- id: validate-skill
name: Validate skill repo structure
description: Run validate-skill.sh against the repo when skill metadata changes.
entry: skills/skill-repo/scripts/validate-skill.sh
language: script
pass_filenames: false
files: (^skills/.+/SKILL\.md$|^SKILL\.md$|^skills/.+/checkpoints\.yaml$|^checkpoints\.yaml$|^\.claude-plugin/plugin\.json$|^composer\.json$)
require_serial: true
- repo: https://github.com/netresearch/skill-repo-skill
rev: v1.36.0
hooks:
- id: check-version-parity
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.23.2
hooks:
- id: markdownlint-cli2
files: '\.md$'
- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint
args: [-c, .yamllint.yml]
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.4
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
# `-x` mirrors CI, which passes it: without it a `source`d file is not
# followed, so the two gates would analyse the same script differently
# even at equal severity and version. The severity itself is
# shellcheck's default (style) here, and validate.yml is called with
# `shellcheck-severity: style` to match. The `rev` below and the version
# validate.yml downloads are one pair — bump them together, or CI starts
# reporting what the hook does not. A repo whose tree is not clean at
# `style` pins the SAME lower severity on both sides, not on one.
- id: shellcheck
args: [-x]