Skip to content

Commit 16d5d03

Browse files
authored
(#9) 프런트엔드 검증 계약과 엔트리포인트를 정리
- typecheck script와 verification contract 문서 추가 - AGENTS.md 추가 및 README overview-only 정리 - CI baseline을 lint/typecheck/build 순서로 맞춤
1 parent 5fff71d commit 16d5d03

5 files changed

Lines changed: 111 additions & 66 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# - develop, main 브랜치 push 시: 코드 품질 검사
1111
#
1212
# 파이프라인 흐름:
13-
# Checkout → Setup Node.js → Install → Lint → Build
13+
# Checkout → Setup Node.js → Install → Lint → Typecheck → Build
1414
#
1515
# =============================================================================
1616

@@ -65,12 +65,38 @@ jobs:
6565
run: npm run lint
6666

6767
# =========================================
68-
# Job 2: 빌드 검사
68+
# Job 2: 타입 검사
69+
# =========================================
70+
typecheck:
71+
name: Type Check
72+
runs-on: ubuntu-latest
73+
needs: lint # lint 성공 후 실행
74+
75+
steps:
76+
- name: Checkout code
77+
uses: actions/checkout@v4
78+
79+
- name: Setup Node.js
80+
uses: actions/setup-node@v4
81+
with:
82+
node-version: '20'
83+
cache: 'npm'
84+
85+
- name: Install dependencies
86+
run: npm ci
87+
88+
# TypeScript 타입 검사
89+
# - noEmit 기준으로 타입 계약만 확인
90+
- name: Run typecheck
91+
run: npm run typecheck
92+
93+
# =========================================
94+
# Job 3: 빌드 검사
6995
# =========================================
7096
build:
7197
name: Build
7298
runs-on: ubuntu-latest
73-
needs: lint # lint 성공 후 실행
99+
needs: typecheck # lint + typecheck 성공 후 실행
74100

75101
steps:
76102
- name: Checkout code
@@ -86,7 +112,7 @@ jobs:
86112
run: npm ci
87113

88114
# Next.js 빌드
89-
# - 빌드 성공 = TypeScript 타입 오류 없음 + 코드 문법 정상
115+
# - 빌드 성공 = production bundle + route tree + required public env contract 정상
90116
# - 환경변수: 빌드 시점에 필요 (NEXT_PUBLIC_* 변수는 빌드 시 인라인됨)
91117
- name: Build Next.js
92118
run: npm run build

AGENTS.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# AGENTS.md
2+
3+
`git-ranker-client`는 Git Ranker의 Next.js 16 프런트엔드다. workflow repo는 orchestration만 소유하고, 프런트엔드 구현 판단의 canonical source는 이 저장소 안에 둔다.
4+
5+
## Start Order
6+
7+
1. [README.md](README.md)에서 프로젝트 overview만 확인한다.
8+
2. [docs/verification-contract.md](docs/verification-contract.md), [package.json](package.json), [.env.example](.env.example)에서 verification command와 required public env를 확인한다.
9+
3. [.github/workflows/ci.yml](.github/workflows/ci.yml), [.github/workflows/deploy.yml](.github/workflows/deploy.yml)에서 retained CI/deploy gate를 확인한다.
10+
4. [next.config.ts](next.config.ts), [tsconfig.json](tsconfig.json), [eslint.config.mjs](eslint.config.mjs), [Dockerfile](Dockerfile), [docker-compose.yml](docker-compose.yml)에서 build/runtime config surface를 확인한다.
11+
5. [src/app](src/app), [src/features](src/features), [src/shared](src/shared), [src/proxy.ts](src/proxy.ts)에서 route, feature, shared runtime ownership을 따라간다.
12+
13+
## Source Of Truth
14+
15+
- [README.md](README.md): 프로젝트 overview-only surface
16+
- [docs/verification-contract.md](docs/verification-contract.md): lint/typecheck/build contract와 결과 해석 기준
17+
- [package.json](package.json): npm command surface
18+
- [.env.example](.env.example): required public env baseline
19+
- [.github/workflows/ci.yml](.github/workflows/ci.yml), [.github/workflows/deploy.yml](.github/workflows/deploy.yml): retained CI/deploy gate
20+
- [next.config.ts](next.config.ts), [tsconfig.json](tsconfig.json), [eslint.config.mjs](eslint.config.mjs): build/static analysis config
21+
- [src/app](src/app), [src/features](src/features), [src/shared](src/shared), [src/proxy.ts](src/proxy.ts): app behavior canonical source
22+
23+
## Operational Rules
24+
25+
- repo-local docs, config, code가 workflow 문서보다 우선한다.
26+
- root `README.md`는 overview만 맡고, concrete bootstrap과 execution guidance는 `AGENTS.md`와 named entry docs가 소유한다.
27+
- verification baseline은 `npm run lint`, `npm run typecheck`, `npm run build`다.
28+
- `.github/workflows/ci.yml`는 같은 baseline order를 그대로 실행해야 한다.
29+
- `npm run build`와 runtime bootstrap은 absolute URL로 설정된 `NEXT_PUBLIC_BASE_URL`, `NEXT_PUBLIC_API_URL`를 요구한다.
30+
- local Next.js 명령은 `.env.local`, Docker Compose는 `.env`를 사용하며 시작값은 `.env.example`에서 가져온다.
31+
- repo-local `.codex/skills/`는 현재 없으므로 fallback first source는 `AGENTS.md`와 nearest docs/config/code surface다.
32+
- verification contract나 deploy gate가 바뀌면 `docs/verification-contract.md`, `package.json`, workflow, `AGENTS.md`를 함께 갱신한다.

README.md

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,5 @@
11
# git-ranker-client
22

3-
`git-ranker-client`는 Git Ranker의 Next.js 16 프런트엔드다. 랭킹 조회, 사용자 상세, 로그인 진입, SEO 메타데이터와 배지 링크를 제공한다.
3+
`git-ranker-client`는 Git Ranker의 Next.js 16 프런트엔드다. 랭킹 조회, 사용자 상세, 로그인 진입, SEO 메타데이터, 배지 링크 생성을 담당한다.
44

5-
## Requirements
6-
7-
- Node.js 20+
8-
- npm
9-
- `NEXT_PUBLIC_BASE_URL`
10-
- `NEXT_PUBLIC_API_URL`
11-
12-
`NEXT_PUBLIC_BASE_URL``NEXT_PUBLIC_API_URL`는 build와 runtime 모두에서 필수다. 값이 없으면 `npm run build`와 런타임 초기화가 즉시 실패한다.
13-
14-
## Environment
15-
16-
로컬 Next.js 실행은 `.env.local`, Docker Compose 실행은 `.env`를 사용하면 된다. 시작점으로는 [.env.example](.env.example)을 복사한다.
17-
18-
로컬 개발 예시:
19-
20-
```env
21-
NEXT_PUBLIC_BASE_URL=http://localhost:3000
22-
NEXT_PUBLIC_API_URL=http://localhost:8080
23-
```
24-
25-
프로덕션 예시:
26-
27-
```env
28-
NEXT_PUBLIC_BASE_URL=https://www.git-ranker.com
29-
NEXT_PUBLIC_API_URL=https://www.git-ranker.com
30-
```
31-
32-
선택 env:
33-
34-
- `NEXT_PUBLIC_ANALYTICS_ENDPOINT`
35-
- `NEXT_PUBLIC_SENTRY_DSN`
36-
- `SENTRY_DSN`
37-
38-
선택 env가 없어도 핵심 기능은 동작한다. 없으면 analytics/web vitals 전송이나 Sentry 수집만 비활성화된다.
39-
40-
## Commands
41-
42-
```bash
43-
npm install
44-
npm run dev
45-
npm run lint
46-
npx tsc --noEmit
47-
npm run build
48-
```
49-
50-
## Docker Compose
51-
52-
```bash
53-
cp .env.example .env
54-
docker compose up --build
55-
```
56-
57-
`docker-compose.yml``Dockerfile``NEXT_PUBLIC_BASE_URL`, `NEXT_PUBLIC_API_URL`가 비어 있으면 즉시 실패한다.
58-
59-
## Build And Runtime Notes
60-
61-
- `JetBrains Mono`는 공식 JetBrains Mono release v2.304에서 가져온 로컬 자산을 사용한다.
62-
- 폰트 라이선스는 [src/fonts/JetBrainsMono-OFL.txt](src/fonts/JetBrainsMono-OFL.txt)에 보관한다.
63-
- locale routing과 보안 헤더는 [src/proxy.ts](src/proxy.ts)에서 처리한다.
64-
- public URL 정책은 [src/shared/lib/public-env.ts](src/shared/lib/public-env.ts)에서 단일 기준으로 관리한다.
5+
repo-local entrypoint는 [AGENTS.md](AGENTS.md), verification contract는 [docs/verification-contract.md](docs/verification-contract.md)에 둔다.

docs/verification-contract.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Frontend Verification Contract
2+
3+
`git-ranker-client`의 verification contract는 repo-local command surface가 소유한다. workflow repo는 상위 `frontend-change` semantics만 가리키고, concrete command와 environment precondition은 이 문서와 repo config가 canonical source다.
4+
5+
## Required Environment
6+
7+
- Node.js `20+`
8+
- `npm`
9+
- dependency install 완료 상태 (`npm install` 또는 `npm ci`)
10+
- absolute URL로 설정된 `NEXT_PUBLIC_BASE_URL`
11+
- absolute URL로 설정된 `NEXT_PUBLIC_API_URL`
12+
13+
local Next.js 명령은 `.env.local`, Docker Compose는 `.env`를 읽는다. 시작점은 [.env.example](../.env.example)이며, `NEXT_PUBLIC_BASE_URL`, `NEXT_PUBLIC_API_URL`가 비어 있거나 absolute URL이 아니면 build/runtime verification은 실패해야 한다.
14+
15+
## Commands
16+
17+
```bash
18+
npm run lint
19+
npm run typecheck
20+
npm run build
21+
```
22+
23+
- `npm run lint`
24+
- `eslint.config.mjs` 기준으로 Next.js / TypeScript lint surface를 검사한다.
25+
- `npm run typecheck`
26+
- `tsconfig.json` 기준으로 `tsc --noEmit`를 실행한다.
27+
- `strict: true`, `noEmit: true`, path alias resolution이 깨지면 실패해야 한다.
28+
- `npm run build`
29+
- `next build`를 실행한다.
30+
- production bundle, route tree, required public env contract를 함께 검증한다.
31+
32+
## Result Interpretation
33+
34+
- lint 실패:
35+
- ESLint rule 위반이나 React/Next static analysis regression이 생긴 상태다.
36+
- typecheck 실패:
37+
- TypeScript contract, import path, generated type surface 중 하나가 깨진 상태다.
38+
- build 실패:
39+
- Next.js production build, required public env, 또는 build-time code path 중 하나가 깨진 상태다.
40+
41+
## Current Notes
42+
43+
- `.github/workflows/ci.yml``npm run lint`, `npm run typecheck`, `npm run build`를 같은 baseline order로 실행한다.
44+
- CI build 단계는 placeholder absolute URL env를 주입해 required public env contract를 함께 검증한다.
45+
- current repo-local baseline 기준 추가 GC follow-up risk는 없다.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "eslint"
9+
"lint": "eslint",
10+
"typecheck": "tsc --noEmit"
1011
},
1112
"dependencies": {
1213
"@radix-ui/react-alert-dialog": "^1.1.15",

0 commit comments

Comments
 (0)