-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
112 lines (105 loc) · 4.84 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
112 lines (105 loc) · 4.84 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
100
101
102
103
104
105
106
107
108
109
110
111
112
# =============================================================================
# Pre-commit Configuration
# =============================================================================
# Foundation hooks for local development. Install with:
# pip install pre-commit && pre-commit install --hook-type commit-msg --hook-type pre-push
#
# Run manually: pre-commit run --all-files
# Update hooks: pre-commit autoupdate
# =============================================================================
repos:
# ---------------------------------------------------------------------------
# Base hooks - standard file hygiene
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
name: Validate YAML syntax
- id: check-json
name: Validate JSON syntax
- id: end-of-file-fixer
name: Fix end-of-file newlines
exclude: '^\.github/(aw/imports/|workflows/.*\.lock\.yml$)'
- id: trailing-whitespace
name: Trim trailing whitespace
exclude: '^\.github/(aw/imports/|workflows/.*\.lock\.yml$)'
- id: check-case-conflict
name: Check for case conflicts
- id: check-merge-conflict
name: Check for merge conflict markers
- id: mixed-line-ending
name: Normalize line endings
args: [--fix=lf]
# ---------------------------------------------------------------------------
# Markdown linting
# ---------------------------------------------------------------------------
- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.20.0
hooks:
- id: markdownlint-cli2
name: Lint markdown files
exclude: '^(\.github/(aw/imports/|workflows/.*\.lock\.yml$)|CHANGELOG\.md$)'
# ---------------------------------------------------------------------------
# Commit message validation (commit-msg stage)
# ---------------------------------------------------------------------------
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.24.0
hooks:
- id: commitlint
name: Validate commit message format
stages: [commit-msg]
additional_dependencies: ["@commitlint/config-conventional@20.4.1"]
- repo: https://github.com/commit-check/commit-check
rev: v2.4.1
hooks:
- id: check-branch
name: Check branch naming conventions
stages: [pre-push]
# ---------------------------------------------------------------------------
# File size enforcement
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
name: Check file sizes
args: ['--maxkb=10']
exclude: '^\.github/(aw/imports/|workflows/.*\.lock\.yml$)'
# ---------------------------------------------------------------------------
# Agent Skills validation (agentskills.io spec)
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: validate-skills
name: Validate agent skills (agentskills.io)
entry: bash -c 'for d in $(find . -name "SKILL.md" -path "*/skills/*" -not -path "./.github/*" -exec dirname {} \;); do agentskills validate "$d" || exit 1; done'
language: system
pass_filenames: false
files: 'skills/.*SKILL\.md$'
# ---------------------------------------------------------------------------
# Anthropic plugin validator (cclint) — fails locally on the same checks
# .github/workflows/validate-plugin.yml runs on CI (e.g. angle brackets in
# `description`). cclint's built-in `--staged` git-integration mode
# (documented as the pre-commit entrypoint) reads files from the git
# index, detects each file's plugin context (e.g. `<plugin>/skills/<name>/
# SKILL.md`), and validates accordingly. This avoids both the type-
# detection failures that come from passing arbitrary support files
# directly and the per-plugin loop that would otherwise need a wrapper
# script. `language: golang` installs cclint into an isolated env, so no
# host Go toolchain is required.
#
# Caveat: --staged only inspects what is currently staged in git, so
# `pre-commit run --all-files` is a near no-op for this hook. Run cclint
# directly (`cclint <plugin-dir>`) or rely on CI for full-tree validation.
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: cclint-plugins
name: Validate plugin frontmatter (cclint, staged)
language: golang
additional_dependencies:
- github.com/dotcommander/cclint@latest
entry: cclint --staged
pass_filenames: false
files: '^[^/]+/(skills/.*\.md$|\.claude-plugin/plugin\.json$)'