Repository navigation
Expand file tree
/
Copy pathlefthook.yml
More file actions
69 lines (65 loc) · 4.13 KB
/
Copy pathlefthook.yml
File metadata and controls
69 lines (65 loc) · 4.13 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
pre-commit:
commands:
# Fast structural gate: lint + typecheck, then the I/O-free guard suite (tests/guards) which catches implemented-but-unregistered/unfunctional commands before the commit lands. priority orders them lint -> typecheck -> guards; the full suite and built-bundle matrix stay on pre-push/CI.
ts-lint:
priority: 1
# Each of these four checks records its green result on the tree it checked (scripts/prepush-green.mjs) and the pre-push tier reuses it on the identical tree.
run: node scripts/prepush-green.mjs run lint -- npm run lint
glob: "**/*.ts"
ts-typecheck:
priority: 2
run: node scripts/prepush-green.mjs run typecheck -- npm run typecheck
glob: "**/*.ts"
ts-typecheck-tests:
priority: 2
run: node scripts/prepush-green.mjs run typecheck:tests -- npm run typecheck:tests
glob: "**/*.ts"
# The three checks below are the ones CI ran that nothing local did, which is the only way a green push could still turn the build red. They carry no glob on purpose, unlike the checks above: the extension compiles against its own package.json and tsconfig, and a secret can land in a .env, a .json or a fixture as easily as in a .ts file, so a TypeScript glob would let exactly the commits that break them through. Together they cost about seven seconds against the tier's existing minute.
ts-typecheck-vscode:
priority: 2
run: npm run typecheck:vscode-extension && npm run typecheck:vscode-extension:tests
# Glob'd to the lockfile because that is the only thing that changes which tarballs get verified, and the check costs a round trip to the registry for every resolved package. A commit that does not move the lockfile cannot change the answer, so it does not pay for it.
dependency-signatures:
priority: 3
run: npm audit signatures
glob: "package-lock.json"
vscode-extension-tests:
priority: 3
run: npm run test:vscode-extension
secrets:
priority: 3
# Wrapped for the same reason as the guards below, plus one of its own: the wrapper hard-fails when gitleaks is absent rather than passing, so the gate cannot quietly stop existing. See the script's header.
run: bash .lefthook-scripts/run-secrets.sh
fast-guards:
priority: 3
# Wrapped rather than run directly so a passing run prints nothing: the guards' own stdout is ~150 lines that no reporter suppresses, and on a commit made by an agent every one of those lines is paid for. The wrapper replays the full output on failure. See the script's header.
run: bash .lefthook-scripts/run-guards.sh
glob: "**/*.ts"
commit-msg:
commands:
no-tool-attribution:
# Runs on the message, not on files, so it has no glob: every commit is checked. See the script's header for why this cannot be left to memory.
run: bash .lefthook-scripts/check-commit-msg.sh {1}
lock-commit-subject:
# Reads the staged file list, not just the message: a package-lock.json change belongs in a chore(deps) or release commit. See the script's header.
run: node scripts/lock-commit-subject.mjs {1}
no-hard-wrap:
# One line per paragraph and per list item, and no verification checklist. See the script's header.
run: bash .lefthook-scripts/check-commit-style.sh {1}
pre-push:
commands:
all-checks:
# Single bash wrapper runs typecheck + tests in parallel internally. Avoids lefthook's parallel-mode EvalSymlinks canonicalize failure on Windows (affects commands with glob: on parallel runners when stdin is read concurrently).
# use_stdin hands run-all-checks.sh the ref lines git gives a pre-push hook, which decide whether the WSL leg runs (.lefthook-scripts/wsl-gate.sh).
use_stdin: true
run: sh .lefthook-scripts/run-with-bash-5.sh .lefthook-scripts/run-all-checks.sh {1}
post-merge:
commands:
sync-on-pull:
# Automatically builds bundle, restarts in-memory daemons, updates shims, and reindexes on git pull/merge
run: node scripts/post-merge.mjs
post-rewrite:
commands:
sync-on-rebase:
# Runs the same sync after git pull --rebase or git rebase
run: node scripts/post-merge.mjs