-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
91 lines (83 loc) · 3.11 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
91 lines (83 loc) · 3.11 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
# Pre-commit configuration for katana-openapi-client
# See https://pre-commit.com for more information
#
# This configuration uses LOCAL hooks that run via uv to avoid network
# restrictions in CI environments (e.g., GitHub Copilot agents that block
# pip.pypa.io). All tools are installed via project dependencies.
#
# See issue #134 for background on why we use local hooks.
# Make `pre-commit install` set up the pre-push hook too. Without this, the
# pre-push hook would silently not run for contributors who only ran the bare
# `pre-commit install` from the README. See block-push-to-main below.
default_install_hook_types: [pre-commit, pre-push]
# Global exclude — Claude Code agent worktrees are parallel git checkouts
# living under the main repo only for locality. They have their own branches
# and pre-commit cycles; formatting/linting them from a sibling worktree's
# hook causes cross-contamination (observed during the #346 parallel-agent
# rollup: a fixup commit from one worktree rewrote a sibling's commit
# message because both hooks ran in the shared .git/ dir).
exclude: |
(?x)(
^\.claude/worktrees/
)
repos:
- repo: local
hooks:
# Python formatting and linting with Ruff (via uv)
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types: [python]
pass_filenames: true
- id: ruff-check
name: ruff check
entry: uv run ruff check --fix
language: system
types: [python]
pass_filenames: true
# Markdown formatting (via uv)
- id: mdformat
name: mdformat
entry: uv run mdformat --wrap=88
language: system
types: [markdown]
exclude: |
(?x)(
CHANGELOG\.md|
docs/CHANGELOG\.md|
katana_public_api_client/docs/CHANGELOG\.md|
\.agent\.md$|
docs/upstream-specs/readme-reference/.*\.md$|
katana_mcp_server/src/katana_mcp/templates/.*\.md$|
\.claude/skills/.*\.md$|
\.claude/agents/.*\.md$
)
pass_filenames: true
# YAML linting (via uv)
- id: yamllint
name: yamllint
entry: uv run yamllint -c=.yamllint.yml
language: system
types: [yaml]
pass_filenames: true
# Run tests (via poe task)
- id: pytest
name: pytest
entry: uv run poe test
language: system
pass_filenames: false
always_run: true
# Refuse pushes that would land non-main commits on the `main` ref.
# See CLAUDE.md "Known Pitfalls" — git's tracked-upstream resolution can
# silently route `git push -u origin <branch>` to main when the local
# branch was created from origin/main. This hook is the only mechanical
# guardrail until #429 (GitHub App auth migration) lets us tighten the
# ruleset's admin bypass.
- id: block-push-to-main
name: block direct push to main from a non-main branch
entry: scripts/pre-push-guard.sh
language: system
stages: [pre-push]
pass_filenames: false
always_run: true