Skip to content

Commit 60fbac0

Browse files
committed
feat: add husky to the project
1 parent 39d20af commit 60fbac0

7 files changed

Lines changed: 269 additions & 91 deletions

File tree

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
4+
pnpm lint-staged
5+
pnpm typecheck

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
set -e
3+
4+
pnpm ci:check

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Optional Python runner: pip install pre-commit && pre-commit install && pre-commit install --hook-type pre-push
2+
# Default: Husky hooks installed via `pnpm install` (see .husky/)
3+
repos:
4+
- repo: local
5+
hooks:
6+
- id: lint-staged
7+
name: lint-staged
8+
entry: pnpm exec lint-staged
9+
language: system
10+
pass_filenames: false
11+
- id: typecheck
12+
name: typecheck
13+
entry: pnpm typecheck
14+
language: system
15+
pass_filenames: false
16+
- id: ci-check
17+
name: ci:check (mirror GitHub Actions)
18+
entry: pnpm ci:check
19+
language: system
20+
pass_filenames: false
21+
stages: [pre-push]

CONTRIBUTING.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,23 @@ from-zero-rag/
5959
1. **Fork** the repository
6060
2. **Create a branch** from `main`: `git checkout -b feat/your-feature`
6161
3. **Make your changes**
62-
4. **Verify** before pushing:
62+
4. **Verify** before pushing (same checks as [CI](.github/workflows/ci.yml)):
6363

6464
```bash
65-
# Production build (includes type checking via Nuxt build)
66-
pnpm build
65+
# Full pipeline (lint, typecheck, tests, eval, build)
66+
pnpm ci:check
67+
```
68+
69+
Git hooks run automatically after `pnpm install` (via [Husky](https://typicode.github.io/husky/)):
6770

68-
# Unit tests (chunking, text utils, agent commands)
69-
pnpm test
71+
| Hook | Command |
72+
|------|---------|
73+
| `pre-commit` | `lint-staged` + `typecheck` |
74+
| `pre-push` | `pnpm ci:check` |
7075

76+
Optional [pre-commit](https://pre-commit.com/) (Python): `pip install pre-commit && pre-commit install && pre-commit install --hook-type pre-push` — uses `.pre-commit-config.yaml` with the same commands.
77+
78+
```bash
7179
# Docs site (if you change docs/**)
7280
pnpm docs:build
7381

composables/useSearchParams.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface SearchParamsConfig {
44
hybridAlpha: number
55
mmrLambda: number
66
embeddingDims: number
7+
embeddingProvider: string
78
hybridEnabled: boolean
89
rerankEnabled: boolean
910
overFetch: number

package.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"build": "nuxt build",
1010
"start": "node .output/server/index.mjs",
1111
"generate": "nuxt generate",
12+
"prepare": "husky",
1213
"postinstall": "nuxt prepare && prisma generate",
14+
"ci:check": "pnpm lint && pnpm typecheck && pnpm test && pnpm eval && SKIP_ENV_VALIDATION=true pnpm build",
1315
"db:migrate": "prisma migrate dev",
1416
"db:deploy": "prisma migrate deploy",
1517
"db:generate": "prisma generate",
@@ -56,22 +58,24 @@
5658
"devDependencies": {
5759
"@eslint/js": "^9.22.0",
5860
"@nuxt/devtools": "latest",
59-
"@vitest/coverage-v8": "^2.1.0",
60-
"eslint": "^9.22.0",
61-
"globals": "^16.0.0",
62-
"redis": "^4.7.0",
63-
"typescript-eslint": "^8.26.0",
6461
"@tailwindcss/vite": "^4.2.4",
6562
"@types/node": "^20.10.0",
6663
"@types/pdf-parse": "^1.1.4",
6764
"@types/uuid": "^9.0.7",
65+
"@vitest/coverage-v8": "^2.1.0",
6866
"dotenv": "^17.4.2",
67+
"eslint": "^9.22.0",
68+
"globals": "^16.0.0",
6969
"gsap": "^3.15.0",
70+
"husky": "^9.1.7",
71+
"lint-staged": "^17.0.5",
7072
"nuxt": "^3.15.3",
7173
"prisma": "^7.8.0",
74+
"redis": "^4.7.0",
7275
"tailwindcss": "^4.2.4",
7376
"tsx": "^4.19.0",
7477
"typescript": "^5.3.3",
78+
"typescript-eslint": "^8.26.0",
7579
"vitepress": "^1.6.3",
7680
"vitest": "^2.1.0",
7781
"vue-tsc": "^3.2.7"
@@ -90,5 +94,10 @@
9094
"engines": {
9195
"node": ">=20.0.0",
9296
"pnpm": ">=10.0.0"
97+
},
98+
"lint-staged": {
99+
"server/**/*.ts": "eslint --fix",
100+
"tests/**/*.ts": "eslint --fix",
101+
"scripts/**/*.ts": "eslint --fix"
93102
}
94103
}

0 commit comments

Comments
 (0)