-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlefthook.yml
More file actions
105 lines (101 loc) · 4.28 KB
/
Copy pathlefthook.yml
File metadata and controls
105 lines (101 loc) · 4.28 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
pre-commit:
parallel: true
commands:
lockfile-guard:
glob: "{package.json,packages/*/package.json}"
# When a manifest changes, fail fast if bun.lock would change so a frozen
# install in CI (and any AI-agent automation) never breaks on drift.
# --ignore-scripts skips the generate postinstall to stay fast and
# offline. This is a guard, not an auto-fixer, so it never touches the git
# index in parallel with build-and-stage-codegen. To fix: run
# `bun install` then stage bun.lock.
run: |
bun install --frozen-lockfile --ignore-scripts 2>/dev/null \
|| { echo "bun.lock is out of sync with package.json. Run 'bun install' then stage bun.lock."; exit 1; }
css-backticks:
# A backtick inside a css`` template ENDS the template. Cheap grep, four
# debugging detours saved.
run: bun run scripts/check-css-backticks.ts
glob: "packages/ui/src/**/*.ts"
biome-check:
glob: "*.{ts,tsx,js,jsx,json}"
# Skip when only deletions or `.d.ts` files are staged. biome refuses an
# empty file list with exit 1, which would block deletion-only commits.
# --no-errors-on-unmatched covers the remaining case: every staged file
# is biome-ignored (e.g. a specs/openapi.json-only sync commit).
run: |
staged=$(git diff --name-only --cached --diff-filter=ACMR | grep -E '\.(ts|tsx|js|jsx|json)$' | grep -vE '\.d\.ts$' || true)
if [ -z "$staged" ]; then exit 0; fi
bun run check --staged --no-errors-on-unmatched
stage_fixed: true
typecheck:
run: bun run typecheck
build-and-stage-codegen:
glob: "packages/ui/src/**/*.{ts,css}"
# The build emits committed codegen: packages/ui-react/src and
# packages/ui-vue/src (wrappers + load-ui), registry,
# apps/docs/manifest.js. Stage every diff so the commit captures the full
# regenerated tree. Per .gitignore, build output (packages/ui/dist,
# packages/ui-react/dist, packages/ui-vue/dist, apps/docs/dist) and
# generated types (packages/ui/src/types) are skipped automatically.
run: bun run build && git add -A
pre-push:
parallel: false
commands:
spec-drift:
run: |
bun run generate
git diff --exit-code -- specs/openapi.json packages/ui/src/types/ \
|| { echo "specs/openapi.json or generated types drifted from live spec. Run 'bun run generate' and commit."; exit 1; }
priority: 1
typecheck:
run: bun run typecheck
priority: 2
biome-full:
run: bun run check
priority: 3
brand-grep:
run: bun run scripts/brand-grep.ts
priority: 4
test-unit:
run: bun run test
priority: 5
test-e2e:
env:
PLAYWRIGHT_PROJECTS: chromium
run: bun run test:e2e
priority: 6
audit:
run: |
bun run build
bun run preview > /tmp/lefthook-preview.log 2>&1 &
PREVIEW_PID=$!
for i in $(seq 1 30); do
curl -sf http://localhost:3001/ -o /dev/null && break
sleep 1
done
bun run audit
AUDIT_EXIT=$?
kill $PREVIEW_PID 2>/dev/null || true
exit $AUDIT_EXIT
priority: 7
wrapper-drift:
# packages/ui-{react,vue}/src is 100% generated from packages/ui: the
# component manifest plus the shared prop/type maps in
# scripts/wrapper-meta.ts. Nothing there is hand-authored, so a diff after
# regenerating means someone edited generated output, and the next build
# would silently revert it.
run: |
bun run build
git diff --exit-code -- packages/ui-react/src packages/ui-vue/src \
|| { echo "packages/ui-{react,vue}/src is GENERATED from packages/ui. Do not hand-edit: change manifest.ts or scripts/wrapper-meta.ts, then 'bun run build'."; exit 1; }
priority: 9
docs-drift:
run: bun run docs:sync && git diff --exit-code -- README.md AGENTS.md || { echo "README.md or AGENTS.md drifted from spec, commit the sync output"; exit 1; }
priority: 8
size-check:
# Runs after the build-dependent gates (audit priority 7, wrapper-drift
# priority 9 both run `bun run build`), so dist/cdn is fresh. Asserts the
# gzip/raw bundle budgets the README and CLAUDE.md claim.
run: bun run size:check
priority: 10