Skip to content

An AI-powered search engine with a generative UI

feat: Add typecheck, format commands and CI workflow

Yoshiki Miura7f9ba6a3fed5
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..2e1cff12
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,35 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+jobs:
+ lint-typecheck-format:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup Bun
+ uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: 1.2.12
+
+ - name: Install dependencies
+ run: bun install
+
+ - name: Run linting
+ run: bun lint
+
+ - name: Run type checking
+ run: bun typecheck
+
+ - name: Check formatting
+ run: bun format:check
+
+ - name: Build application
+ run: bun build
\ No newline at end of file
diff --git a/CLAUDE.md b/CLAUDE.md
index 26faee84..8f148900 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -9,6 +9,9 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- `bun build` - Create production build
- `bun start` - Start production server
- `bun lint` - Run ESLint for code quality checks
+- `bun typecheck` - Run TypeScript type checking
+- `bun format` - Format code with Prettier
+- `bun format:check` - Check code formatting without modifying files
### Docker
- `docker compose up -d` - Run the application with Docker
@@ -85,6 +88,15 @@ Currently no dedicated test framework. Verify changes by:
2. Building with `bun build` to catch TypeScript errors
3. Manual testing in development mode
+## Pre-PR Requirements
+Before creating a pull request, you MUST ensure all of the following checks pass:
+1. **Linting**: Run `bun lint` and fix all ESLint errors and warnings
+2. **Type checking**: Run `bun typecheck` to ensure no TypeScript errors
+3. **Formatting**: Run `bun format:check` to verify code formatting (or `bun format` to auto-fix)
+4. **Build**: Run `bun build` to ensure the application builds successfully
+
+These checks are enforced in CI/CD and PRs will fail if any of these steps don't pass.
+
## Model Configuration
Models are defined in `public/config/models.json` with:
- `id`: Model identifier
diff --git a/bun.lock b/bun.lock
index 90734d28..21bcea7b 100644
--- a/bun.lock
+++ b/bun.lock
@@ -75,6 +75,7 @@
"eslint": "^8",
"eslint-config-next": "^14.2.25",
"postcss": "^8",
+ "prettier": "^3.6.2",
"tailwindcss": "^3.4.1",
"typescript": "^5",
},
@@ -1185,6 +1186,8 @@
"prelude-ls": ["[email protected]", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
+ "prettier": ["[email protected]", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="],
+
"prismjs": ["[email protected]", "", {}, "sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw=="],
"prop-types": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg=="],
diff --git a/package.json b/package.json
index c01becb8..1f7c4c7d 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,10 @@
"dev": "next dev --turbo",
"build": "next build",
"start": "next start",
- "lint": "next lint"
+ "lint": "next lint",
+ "typecheck": "tsc --noEmit",
+ "format": "prettier --write .",
+ "format:check": "prettier --check ."
},
"dependencies": {
"@ai-sdk/anthropic": "^1.2.10",
@@ -81,6 +84,7 @@
"eslint": "^8",
"eslint-config-next": "^14.2.25",
"postcss": "^8",
+ "prettier": "^3.6.2",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},