-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhk.pkl
More file actions
145 lines (126 loc) · 4.31 KB
/
hk.pkl
File metadata and controls
145 lines (126 loc) · 4.31 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
amends "package://github.com/jdx/hk/releases/download/v1.28.0/hk@1.28.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.28.0/hk@1.28.0#/Builtins.pkl"
// =============================================================================
// hk Configuration for ExFig Action
// =============================================================================
// Migrated from pre-commit
// All hooks run in parallel for maximum performance
// =============================================================================
// Excludes for generated files
local generated_excludes = List("CHANGELOG.md")
// =============================================================================
// dprint Formatter (Markdown) - Rust-based, fast
// =============================================================================
local dprint_checks = new Mapping<String, Step> {
["dprint"] = (Builtins.dprint) {
exclude = List("CHANGELOG.md", ".claude/**", "openspec/**")
stage = List("*.md")
check_first = true
hide = true
}
}
// =============================================================================
// YAML Linting
// =============================================================================
local yaml_checks = new Mapping<String, Step> {
["yamllint"] {
glob = List("*.yml", "*.yaml")
check = "yamllint -c .yamllint.yaml {{files}}"
batch = true
hide = true
}
["actionlint"] {
glob = List(".github/workflows/*.yml", ".github/workflows/*.yaml")
check = "actionlint {{files}}"
batch = true
hide = true
}
}
// =============================================================================
// jq Template Validation
// =============================================================================
local jq_checks = new Mapping<String, Step> {
["jq-templates"] {
glob = List("action.yml")
check = "./scripts/validate-jq.sh"
hide = true
}
}
// =============================================================================
// TypeScript Checks
// =============================================================================
local ts_checks = new Mapping<String, Step> {
["eslint"] {
glob = List("src/**/*.ts")
check = "npm run lint"
fix = "npm run lint:fix"
batch = true
hide = true
}
["prettier"] {
glob = List("src/**/*.ts")
check = "npm run format:check"
fix = "npm run format"
batch = true
hide = true
}
["tsc"] {
glob = List("src/**/*.ts")
check = "npx tsc --noEmit"
batch = true
hide = true
}
}
// =============================================================================
// Builtin Checks (fast, parallel)
// =============================================================================
local builtin_checks = new Mapping<String, Step> {
["trailing-whitespace"] = (Builtins.trailing_whitespace) {
exclude = generated_excludes
hide = true
}
["check-merge-conflict"] = (Builtins.check_merge_conflict) {
hide = true
}
["newlines"] = (Builtins.newlines) {
exclude = generated_excludes
hide = true
}
}
// =============================================================================
// Combined Linters
// =============================================================================
local all_linters = new Mapping<String, Step> {
...dprint_checks
...yaml_checks
...jq_checks
...ts_checks
...builtin_checks
}
// =============================================================================
// Hooks Configuration
// =============================================================================
hooks {
// Pre-commit: runs all linters with auto-fix
// Using patch-file stash mode to properly handle untracked files
["pre-commit"] {
fix = true
stash = "patch-file"
steps = all_linters
}
// Commit-msg: validate conventional commits format
["commit-msg"] {
steps {
["conventional-commit"] = Builtins.check_conventional_commit
}
}
// Helper: run all linters with fix
["fix"] {
fix = true
steps = all_linters
}
// Helper: run all linters without fix
["check"] {
steps = all_linters
}
}